diff --git a/move_draw_controls/assets/About-3be1e6da.js b/move_draw_controls/assets/About-469acba2.js similarity index 98% rename from move_draw_controls/assets/About-3be1e6da.js rename to move_draw_controls/assets/About-469acba2.js index c126ffef..f619e8dc 100644 --- a/move_draw_controls/assets/About-3be1e6da.js +++ b/move_draw_controls/assets/About-469acba2.js @@ -1,4 +1,4 @@ -import{S as Ce,i as Ie,s as Pe,au as Me,g as We,h as Le,j as u,p,u as je,t as c,q as m,v as g,b5 as d,e as k,y as r,a as v,b as Te,c as h,o as l,d as _}from"./index-7b4eed78.js";function Re(a){let e;return{c(){e=r("open source project")},m(t,s){h(t,e,s)},d(t){t&&_(e)}}}function qe(a){let e;return{c(){e=r(`Dustin Carlino +import{S as Ce,i as Ie,s as Pe,au as Me,g as We,h as Le,j as u,p,u as je,t as c,q as m,v as g,b6 as d,e as k,y as r,a as v,b as Te,c as h,o as l,d as _}from"./index-d36e2ea3.js";function Re(a){let e;return{c(){e=r("open source project")},m(t,s){h(t,e,s)},d(t){t&&_(e)}}}function qe(a){let e;return{c(){e=r(`Dustin Carlino `)},m(t,s){h(t,e,s)},d(t){t&&_(e)}}}function Be(a){let e;return{c(){e=r("Peter York")},m(t,s){h(t,e,s)},d(t){t&&_(e)}}}function Ee(a){let e;return{c(){e=r("Madison Wang")},m(t,s){h(t,e,s)},d(t){t&&_(e)}}}function Ge(a){let e;return{c(){e=r(`Stuart Lynn `)},m(t,s){h(t,e,s)},d(t){t&&_(e)}}}function Ue(a){let e;return{c(){e=r("Ben Ritter")},m(t,s){h(t,e,s)},d(t){t&&_(e)}}}function Ye(a){let e;return{c(){e=r("OpenStreetMap")},m(t,s){h(t,e,s)},d(t){t&&_(e)}}}function ze(a){let e;return{c(){e=r("MapLibre")},m(t,s){h(t,e,s)},d(t){t&&_(e)}}}function De(a){let e;return{c(){e=r(`svelte-maplibre `)},m(t,s){h(t,e,s)},d(t){t&&_(e)}}}function He(a){let e;return{c(){e=r("GeoRust")},m(t,s){h(t,e,s)},d(t){t&&_(e)}}}function Je(a){let e;return{c(){e=r(`osm2streets diff --git a/move_draw_controls/assets/Popup-b9aeab86.js b/move_draw_controls/assets/Popup-61834b7b.js similarity index 92% rename from move_draw_controls/assets/Popup-b9aeab86.js rename to move_draw_controls/assets/Popup-61834b7b.js index fa6c4977..a9ba022f 100644 --- a/move_draw_controls/assets/Popup-b9aeab86.js +++ b/move_draw_controls/assets/Popup-61834b7b.js @@ -1 +1 @@ -import{S as I,i as S,s as j,X as M,j as E,p as F,t as v,q as b,v as H,Y as N,am as C,a as O,e as h,b as c,c as m,Z as g,_ as P,d,ax as Q,$ as U,W as V,y as W,o as X,P as Y,aH as Z,Q as z,T as B,U as D,V as G}from"./index-7b4eed78.js";function w(s,e,n){const t=s.slice();return t[0]=e[n][0],t[3]=e[n][1],t}function T(s){let e,n;return{c(){e=h("div"),n=W(s[2]),c(e,"class","govuk-hint")},m(t,l){m(t,e,l),X(e,n)},p(t,l){l&4&&Y(n,t[2])},d(t){t&&d(e)}}}function q(s){let e,n,t;return{c(){e=h("option"),e.__value=n=s[0],g(e,e.__value),c(e,"label",t=s[3])},m(l,o){m(l,e,o)},p(l,o){o&2&&n!==(n=l[0])&&(e.__value=n,g(e,e.__value)),o&2&&t!==(t=l[3])&&c(e,"label",t)},d(l){l&&d(e)}}}function J(s){let e,n,t,l,o,_,i=s[2]&&T(s),r=C(s[1]),u=[];for(let a=0;a{"label"in a&&n(3,t=a.label),"value"in a&&n(0,l=a.value),"options"in a&&n(1,o=a.options),"hint"in a&&n(2,_=a.hint)},[l,o,_,t,i,r,u]}class ne extends I{constructor(e){super(),S(this,e,L,K,j,{label:3,value:0,options:1,hint:2})}}const R=s=>({props:s&16}),A=s=>({props:x(s[4])});function $(s){let e,n;const t=s[2].default,l=z(t,s,s[3],A);return{c(){e=h("div"),l&&l.c(),c(e,"class","govuk-prose")},m(o,_){m(o,e,_),l&&l.m(e,null),n=!0},p(o,_){l&&l.p&&(!n||_&24)&&B(l,t,o,o[3],n?G(t,o[3],_,R):D(o[3]),A)},i(o){n||(v(l,o),n=!0)},o(o){b(l,o),n=!1},d(o){o&&d(e),l&&l.d(o)}}}function y(s){let e,n;return e=new Z({props:{openOn:s[0],popupClass:s[1],openIfTopMost:!0,$$slots:{default:[$,({features:t})=>({4:t}),({features:t})=>t?16:0]},$$scope:{ctx:s}}}),{c(){E(e.$$.fragment)},m(t,l){F(e,t,l),n=!0},p(t,[l]){const o={};l&1&&(o.openOn=t[0]),l&2&&(o.popupClass=t[1]),l&24&&(o.$$scope={dirty:l,ctx:t}),e.$set(o)},i(t){n||(v(e.$$.fragment,t),n=!0)},o(t){b(e.$$.fragment,t),n=!1},d(t){H(e,t)}}}function x(s){return s?s[0].properties??{}:{}}function ee(s,e,n){let{$$slots:t={},$$scope:l}=e,{openOn:o="hover"}=e,{popupClass:_=void 0}=e;return s.$$set=i=>{"openOn"in i&&n(0,o=i.openOn),"popupClass"in i&&n(1,_=i.popupClass),"$$scope"in i&&n(3,l=i.$$scope)},[o,_,t,l]}class le extends I{constructor(e){super(),S(this,e,ee,y,j,{openOn:0,popupClass:1})}}export{ne as A,le as P}; +import{S as I,i as S,s as j,W as M,j as E,p as F,t as v,q as b,v as H,X as N,am as C,a as O,e as h,b as c,c as m,Y as g,Z as P,d,ax as Q,_ as U,$ as V,y as W,o as X,P as Y,aH as Z,Q as z,T as B,U as D,V as G}from"./index-d36e2ea3.js";function w(s,e,n){const t=s.slice();return t[0]=e[n][0],t[3]=e[n][1],t}function T(s){let e,n;return{c(){e=h("div"),n=W(s[2]),c(e,"class","govuk-hint")},m(t,l){m(t,e,l),X(e,n)},p(t,l){l&4&&Y(n,t[2])},d(t){t&&d(e)}}}function q(s){let e,n,t;return{c(){e=h("option"),e.__value=n=s[0],g(e,e.__value),c(e,"label",t=s[3])},m(l,o){m(l,e,o)},p(l,o){o&2&&n!==(n=l[0])&&(e.__value=n,g(e,e.__value)),o&2&&t!==(t=l[3])&&c(e,"label",t)},d(l){l&&d(e)}}}function J(s){let e,n,t,l,o,_,i=s[2]&&T(s),r=C(s[1]),u=[];for(let a=0;a{"label"in a&&n(3,t=a.label),"value"in a&&n(0,l=a.value),"options"in a&&n(1,o=a.options),"hint"in a&&n(2,_=a.hint)},[l,o,_,t,i,r,u]}class ne extends I{constructor(e){super(),S(this,e,L,K,j,{label:3,value:0,options:1,hint:2})}}const R=s=>({props:s&16}),A=s=>({props:x(s[4])});function $(s){let e,n;const t=s[2].default,l=z(t,s,s[3],A);return{c(){e=h("div"),l&&l.c(),c(e,"class","govuk-prose")},m(o,_){m(o,e,_),l&&l.m(e,null),n=!0},p(o,_){l&&l.p&&(!n||_&24)&&B(l,t,o,o[3],n?G(t,o[3],_,R):D(o[3]),A)},i(o){n||(v(l,o),n=!0)},o(o){b(l,o),n=!1},d(o){o&&d(e),l&&l.d(o)}}}function y(s){let e,n;return e=new Z({props:{openOn:s[0],popupClass:s[1],openIfTopMost:!0,$$slots:{default:[$,({features:t})=>({4:t}),({features:t})=>t?16:0]},$$scope:{ctx:s}}}),{c(){E(e.$$.fragment)},m(t,l){F(e,t,l),n=!0},p(t,[l]){const o={};l&1&&(o.openOn=t[0]),l&2&&(o.popupClass=t[1]),l&24&&(o.$$scope={dirty:l,ctx:t}),e.$set(o)},i(t){n||(v(e.$$.fragment,t),n=!0)},o(t){b(e.$$.fragment,t),n=!1},d(t){H(e,t)}}}function x(s){return s?s[0].properties??{}:{}}function ee(s,e,n){let{$$slots:t={},$$scope:l}=e,{openOn:o="hover"}=e,{popupClass:_=void 0}=e;return s.$$set=i=>{"openOn"in i&&n(0,o=i.openOn),"popupClass"in i&&n(1,_=i.popupClass),"$$scope"in i&&n(3,l=i.$$scope)},[o,_,t,l]}class le extends I{constructor(e){super(),S(this,e,ee,y,j,{openOn:0,popupClass:1})}}export{ne as A,le as P}; diff --git a/move_draw_controls/assets/ZoomOutMap-aaf9f888.js b/move_draw_controls/assets/ZoomOutMap-9b4ebb28.js similarity index 99% rename from move_draw_controls/assets/ZoomOutMap-aaf9f888.js rename to move_draw_controls/assets/ZoomOutMap-9b4ebb28.js index 6880378f..d1e2eb90 100644 --- a/move_draw_controls/assets/ZoomOutMap-aaf9f888.js +++ b/move_draw_controls/assets/ZoomOutMap-9b4ebb28.js @@ -1,4 +1,4 @@ -import{S as K,i as J,s as X,Q as we,e as P,b as c,c as T,o as E,T as ke,U as pe,V as Le,t as I,q as F,d as C,a as Q,m as Ce,_ as V,$ as Oe,bi as Pn,Y as Zt,W as le,y as de,P as Me,X as Tn,j as x,p as $,v as ee,E as Cn,am as Ke,aa as Ge,bj as Sn,bk as yt,ax as zn,bl as En,Z as We,a9 as Rn,aY as Bn,bm as In,bn as Fn,g as Xe,h as ft,u as ut,w as Se,aZ as bt,bo as _e,n as N,bp as ve,aX as ne,b6 as Je,bq as An,z as ze,r as Ee,aj as Wt,ad as qt,br as On,an as Gn,ao as Un,b4 as Nt,x as Zn,bs as Wn,b8 as Vt,l as qn,aU as vt,ap as Nn,f as ct,R as Vn,aI as wt,aJ as Qe,aL as Dn,aO as kt,aQ as Ae,aR as Dt,aN as Fe,b7 as Ht,ab as Qt,bt as pt,bu as st,av as Hn,bv as Qn,af as Lt}from"./index-7b4eed78.js";function Kn(n){let e,t,r;const i=n[3].default,l=we(i,n,n[2],null);return{c(){e=P("fieldset"),t=P("div"),l&&l.c(),c(t,"class",n[0]),c(t,"data-module","govuk-checkboxes"),c(e,"class","govuk-fieldset")},m(o,s){T(o,e,s),E(e,t),l&&l.m(t,null),r=!0},p(o,[s]){l&&l.p&&(!r||s&4)&&ke(l,i,o,o[2],r?Le(i,o[2],s,null):pe(o[2]),null)},i(o){r||(I(l,o),r=!0)},o(o){F(l,o),r=!1},d(o){o&&C(e),l&&l.d(o)}}}function Jn(n,e,t){let{$$slots:r={},$$scope:i}=e,{small:l=!1}=e,o=l?"govuk-checkboxes--small":"govuk-checkboxes";return n.$$set=s=>{"small"in s&&t(1,l=s.small),"$$scope"in s&&t(2,i=s.$$scope)},[o,l,i,r]}class Hi extends K{constructor(e){super(),J(this,e,Jn,Kn,X,{small:1})}}const Xn=n=>({}),Mt=n=>({});function Yn(n){let e,t,r,i,l,o,s,a,f;const u=n[5].default,m=we(u,n,n[4],null),_=n[5].right,g=we(_,n,n[4],Mt);return{c(){e=P("div"),t=P("input"),r=Q(),i=P("label"),m&&m.c(),l=Q(),o=P("span"),g&&g.c(),c(t,"type","checkbox"),c(t,"class","govuk-checkboxes__input"),c(t,"id",n[3]),c(i,"class","govuk-label govuk-checkboxes__label"),c(i,"for",n[3]),c(i,"title",n[1]),Ce(o,"float","right"),c(e,"class","govuk-checkboxes__item"),c(e,"style",n[2])},m(y,M){T(y,e,M),E(e,t),t.checked=n[0],E(e,r),E(e,i),m&&m.m(i,null),E(e,l),E(e,o),g&&g.m(o,null),s=!0,a||(f=[V(t,"change",n[7]),V(t,"change",n[6])],a=!0)},p(y,[M]){M&1&&(t.checked=y[0]),m&&m.p&&(!s||M&16)&&ke(m,u,y,y[4],s?Le(u,y[4],M,null):pe(y[4]),null),(!s||M&2)&&c(i,"title",y[1]),g&&g.p&&(!s||M&16)&&ke(g,_,y,y[4],s?Le(_,y[4],M,Xn):pe(y[4]),Mt)},i(y){s||(I(m,y),I(g,y),s=!0)},o(y){F(m,y),F(g,y),s=!1},d(y){y&&C(e),m&&m.d(y),g&&g.d(y),a=!1,Oe(f)}}}function jn(n,e,t){let{$$slots:r={},$$scope:i}=e;const l=Pn(r);let{checked:o}=e,{hint:s=null}=e,f=l.right!==void 0?"float: none":"",u=Zt();function m(g){le.call(this,n,g)}function _(){o=this.checked,t(0,o)}return n.$$set=g=>{"checked"in g&&t(0,o=g.checked),"hint"in g&&t(1,s=g.hint),"$$scope"in g&&t(4,i=g.$$scope)},[o,s,f,u,i,r,m,_]}class Qi extends K{constructor(e){super(),J(this,e,jn,Yn,X,{checked:0,hint:1})}}function xn(n){let e,t,r,i,l,o,s;const a=n[3].default,f=we(a,n,n[2],null);return{c(){e=P("details"),t=P("summary"),r=P("span"),i=de(n[0]),l=Q(),o=P("div"),f&&f.c(),c(r,"class","govuk-details__summary-text"),c(t,"class","govuk-details__summary"),c(o,"class","govuk-details__text"),e.open=n[1],c(e,"class","govuk-details"),c(e,"data-module","govuk-details")},m(u,m){T(u,e,m),E(e,t),E(t,r),E(r,i),E(e,l),E(e,o),f&&f.m(o,null),s=!0},p(u,[m]){(!s||m&1)&&Me(i,u[0]),f&&f.p&&(!s||m&4)&&ke(f,a,u,u[2],s?Le(a,u[2],m,null):pe(u[2]),null),(!s||m&2)&&(e.open=u[1])},i(u){s||(I(f,u),s=!0)},o(u){F(f,u),s=!1},d(u){u&&C(e),f&&f.d(u)}}}function $n(n,e,t){let{$$slots:r={},$$scope:i}=e,{label:l}=e,{open:o=!1}=e;return n.$$set=s=>{"label"in s&&t(0,l=s.label),"open"in s&&t(1,o=s.open),"$$scope"in s&&t(2,i=s.$$scope)},[l,o,i,r]}class er extends K{constructor(e){super(),J(this,e,$n,xn,X,{label:0,open:1})}}function Pt(n,e,t){const r=n.slice();return r[10]=e[t][0],r[11]=e[t][1],r}function Tt(n){let e,t;return{c(){e=P("div"),t=de(n[2]),c(e,"class","govuk-hint")},m(r,i){T(r,e,i),E(e,t)},p(r,i){i&4&&Me(t,r[2])},d(r){r&&C(e)}}}function Ct(n){let e;return{c(){e=P("option"),e.__value="",We(e,e.__value)},m(t,r){T(t,e,r)},d(t){t&&C(e)}}}function St(n){let e,t=n[11]+"",r,i;return{c(){e=P("option"),r=de(t),e.__value=i=n[10],We(e,e.__value)},m(l,o){T(l,e,o),E(e,r)},p(l,o){o&8&&t!==(t=l[11]+"")&&Me(r,t),o&8&&i!==(i=l[10])&&(e.__value=i,We(e,e.__value))},d(l){l&&C(e)}}}function tr(n){let e,t,r,i,l,o,s,a;e=new Cn({props:{errorMessage:n[6]}});let f=n[2]&&Tt(n),u=n[4]&&Ct(),m=Ke(n[3]),_=[];for(let g=0;gn[9].call(i))},m(g,y){$(e,g,y),T(g,t,y),f&&f.m(g,y),T(g,r,y),T(g,i,y),u&&u.m(i,null),E(i,l);for(let M=0;M<_.length;M+=1)_[M]&&_[M].m(i,null);yt(i,n[0],!0),o=!0,s||(a=[V(i,"change",n[9]),V(i,"change",n[8])],s=!0)},p(g,y){const M={};if(y&64&&(M.errorMessage=g[6]),e.$set(M),g[2]?f?f.p(g,y):(f=Tt(g),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null),g[4]?u||(u=Ct(),u.c(),u.m(i,l)):u&&(u.d(1),u=null),y&8){m=Ke(g[3]);let b;for(b=0;b{"label"in g&&t(1,r=g.label),"hint"in g&&t(2,i=g.hint),"choices"in g&&t(3,l=g.choices),"emptyOption"in g&&t(4,o=g.emptyOption),"disabled"in g&&t(5,s=g.disabled),"errorMessage"in g&&t(6,a=g.errorMessage),"value"in g&&t(0,f=g.value)},[f,r,i,l,o,s,a,u,m,_]}class ir extends K{constructor(e){super(),J(this,e,rr,nr,X,{label:1,hint:2,choices:3,emptyOption:4,disabled:5,errorMessage:6,value:0})}}function Ki(n,e){let t=new Set(n.getStyle().layers.filter(r=>r.type=="line").map(r=>r.id));if(e=="dataviz")return["Road network","Path"].filter(r=>t.has(r));if(e=="hybrid")return["Path","Road","Tunnel"].filter(r=>t.has(r));if(e=="streets"){let r=[];for(let i of["road","bridge","tunnel"])for(let l of["link","minor","minor_construction","motorway","motorway_construction","motorway_link","path_pedestrian","secondary_tertiary","secondary_tertiary_construction","service_track","service_track_construction","street","trunk_primary","trunk_primary_construction","trunk_primary_link"])r.push(`${i}_${l}`);return r.filter(i=>t.has(i))}return e=="uk-openzoomstack-light"?n.getStyle().layers.filter(r=>r["source-layer"]=="roads"&&r.type=="line").map(r=>r.id):[]}let L=n=>n,te=n=>n,lr=n=>n,or=n=>n,sr=n=>n,ar=n=>n,fr=n=>n,ur=[fr("raster-basemap"),L("parliamentary_constituencies"),L("parliamentary_constituencies-outline"),L("wards"),L("wards-outline"),L("combined_authorities"),L("combined_authorities-outline"),L("local_authority_districts"),L("local_authority_districts-outline"),L("local_planning_authorities"),L("local_planning_authorities-outline"),L("census_output_areas"),L("census_output_areas-outline"),L("imd"),L("imd-outline"),L("pollution"),L("road_noise"),L("mrn"),L("srn"),L("bus_routes"),L("trams"),L("national_cycle_network"),L("cycle_paths"),L("pct_commute"),L("pct_school"),L("road_widths"),L("road_speeds"),L("pavement_widths"),L("gradient"),L("gradient_arrows"),L("education"),L("hospitals"),L("sports_spaces"),L("railway_stations"),L("cycle_parking"),L("crossings"),L("vehicle_counts"),L("stats19"),L("bus_stops"),te("interventions-coverage-polygons-outlines"),te("interventions-polygons"),te("interventions-polygons-outlines"),te("hover-polygons"),L("atf-interventions-polygons"),L("lcwip-interventions-polygons"),L("atf-interventions-polygons-outlines"),L("lcwip-interventions-polygons-outlines"),te("hover-lines"),te("interventions-lines"),te("interventions-lines-endpoints"),L("atf-interventions-lines"),L("lcwip-interventions-lines"),L("atf-interventions-lines-endpoints"),L("lcwip-interventions-lines-endpoints"),te("hover-points"),te("interventions-points"),L("atf-interventions-points"),L("lcwip-interventions-points"),L("problems"),te("edit-polygon-fill"),te("edit-polygon-lines"),te("edit-polygon-vertices"),te("draw-split-route"),te("route-points"),te("route-lines"),te("route-polygons"),lr("road_label"),ar(or(sr("Road labels"))),te("boundary"),L("measurement-line"),te("georeferenced-image"),L("cover-interactive-layers")],cr=Rn(null);function dr(n,e){return{id:e,beforeId:mr(n,e)}}function mr(n,e){let t=Bn(cr);if(!t){console.warn(`getBeforeId(${e}) called before map is ready. Z-ordering may be incorrect.`);return}let r,i=!1;for(let l=n.layerZorder.length-1;l>=0;l--){let o=n.layerZorder[l];if(o==e){i=!0;break}t.getLayer(o)&&(r=o)}if(!i)throw new Error(`Layer ID ${e} not defined in layerZorder`);return r}const Ji=["==",["geometry-type"],"Polygon"],Xi=["==",["geometry-type"],"LineString"],Yi=["==",["geometry-type"],"Point"];function ji(){return{type:"FeatureCollection",features:[]}}function xi(n,e,t){let r=["match",n];for(let[i,l]of Object.entries(e))r.push(i),r.push(l);return r.push(t),r}function gr(n){return In(n)}function $i(n){var t,r;let e={type:"FeatureCollection",features:[]};for(let i of n.features)if(e.features.push(i),i.geometry.type=="LineString"&&!((t=i.properties)!=null&&t.hide_while_editing))for(let l of[i.geometry.coordinates[0],i.geometry.coordinates[i.geometry.coordinates.length-1]])e.features.push({type:"Feature",properties:{endpoint:!0,scheme_reference:(r=i.properties)==null?void 0:r.scheme_reference},geometry:{type:"Point",coordinates:l}});return e}function el(n,e,t){let r=["step",n];for(let i=1;iTerms of Use +import{S as K,i as J,s as X,Q as we,e as P,b as c,c as T,o as E,T as ke,U as pe,V as Le,t as I,q as F,d as C,a as Q,m as Ce,Z as V,_ as Oe,bj as Pn,X as Zt,$ as le,y as de,P as Me,W as Tn,j as x,p as $,v as ee,E as Cn,am as Ke,aa as Ge,bk as Sn,bl as yt,ax as zn,bm as En,Y as We,a9 as Rn,aZ as Bn,bn as In,bo as Fn,g as Xe,h as ft,u as ut,w as Se,a_ as bt,bp as _e,n as N,aX as ve,aY as ne,b7 as Je,bq as An,z as ze,r as Ee,aj as Wt,ad as qt,br as On,an as Gn,ao as Un,b5 as Nt,x as Zn,bs as Wn,b9 as Vt,l as qn,aU as vt,ap as Nn,f as ct,R as Vn,aI as wt,aJ as Qe,aL as Dn,aO as kt,aQ as Ae,aR as Dt,aN as Fe,b8 as Ht,ab as Qt,bt as pt,bu as st,av as Hn,bv as Qn,af as Lt}from"./index-d36e2ea3.js";function Kn(n){let e,t,r;const i=n[3].default,l=we(i,n,n[2],null);return{c(){e=P("fieldset"),t=P("div"),l&&l.c(),c(t,"class",n[0]),c(t,"data-module","govuk-checkboxes"),c(e,"class","govuk-fieldset")},m(o,s){T(o,e,s),E(e,t),l&&l.m(t,null),r=!0},p(o,[s]){l&&l.p&&(!r||s&4)&&ke(l,i,o,o[2],r?Le(i,o[2],s,null):pe(o[2]),null)},i(o){r||(I(l,o),r=!0)},o(o){F(l,o),r=!1},d(o){o&&C(e),l&&l.d(o)}}}function Jn(n,e,t){let{$$slots:r={},$$scope:i}=e,{small:l=!1}=e,o=l?"govuk-checkboxes--small":"govuk-checkboxes";return n.$$set=s=>{"small"in s&&t(1,l=s.small),"$$scope"in s&&t(2,i=s.$$scope)},[o,l,i,r]}class Hi extends K{constructor(e){super(),J(this,e,Jn,Kn,X,{small:1})}}const Xn=n=>({}),Mt=n=>({});function Yn(n){let e,t,r,i,l,o,s,a,f;const u=n[5].default,m=we(u,n,n[4],null),_=n[5].right,g=we(_,n,n[4],Mt);return{c(){e=P("div"),t=P("input"),r=Q(),i=P("label"),m&&m.c(),l=Q(),o=P("span"),g&&g.c(),c(t,"type","checkbox"),c(t,"class","govuk-checkboxes__input"),c(t,"id",n[3]),c(i,"class","govuk-label govuk-checkboxes__label"),c(i,"for",n[3]),c(i,"title",n[1]),Ce(o,"float","right"),c(e,"class","govuk-checkboxes__item"),c(e,"style",n[2])},m(y,M){T(y,e,M),E(e,t),t.checked=n[0],E(e,r),E(e,i),m&&m.m(i,null),E(e,l),E(e,o),g&&g.m(o,null),s=!0,a||(f=[V(t,"change",n[7]),V(t,"change",n[6])],a=!0)},p(y,[M]){M&1&&(t.checked=y[0]),m&&m.p&&(!s||M&16)&&ke(m,u,y,y[4],s?Le(u,y[4],M,null):pe(y[4]),null),(!s||M&2)&&c(i,"title",y[1]),g&&g.p&&(!s||M&16)&&ke(g,_,y,y[4],s?Le(_,y[4],M,Xn):pe(y[4]),Mt)},i(y){s||(I(m,y),I(g,y),s=!0)},o(y){F(m,y),F(g,y),s=!1},d(y){y&&C(e),m&&m.d(y),g&&g.d(y),a=!1,Oe(f)}}}function jn(n,e,t){let{$$slots:r={},$$scope:i}=e;const l=Pn(r);let{checked:o}=e,{hint:s=null}=e,f=l.right!==void 0?"float: none":"",u=Zt();function m(g){le.call(this,n,g)}function _(){o=this.checked,t(0,o)}return n.$$set=g=>{"checked"in g&&t(0,o=g.checked),"hint"in g&&t(1,s=g.hint),"$$scope"in g&&t(4,i=g.$$scope)},[o,s,f,u,i,r,m,_]}class Qi extends K{constructor(e){super(),J(this,e,jn,Yn,X,{checked:0,hint:1})}}function xn(n){let e,t,r,i,l,o,s;const a=n[3].default,f=we(a,n,n[2],null);return{c(){e=P("details"),t=P("summary"),r=P("span"),i=de(n[0]),l=Q(),o=P("div"),f&&f.c(),c(r,"class","govuk-details__summary-text"),c(t,"class","govuk-details__summary"),c(o,"class","govuk-details__text"),e.open=n[1],c(e,"class","govuk-details"),c(e,"data-module","govuk-details")},m(u,m){T(u,e,m),E(e,t),E(t,r),E(r,i),E(e,l),E(e,o),f&&f.m(o,null),s=!0},p(u,[m]){(!s||m&1)&&Me(i,u[0]),f&&f.p&&(!s||m&4)&&ke(f,a,u,u[2],s?Le(a,u[2],m,null):pe(u[2]),null),(!s||m&2)&&(e.open=u[1])},i(u){s||(I(f,u),s=!0)},o(u){F(f,u),s=!1},d(u){u&&C(e),f&&f.d(u)}}}function $n(n,e,t){let{$$slots:r={},$$scope:i}=e,{label:l}=e,{open:o=!1}=e;return n.$$set=s=>{"label"in s&&t(0,l=s.label),"open"in s&&t(1,o=s.open),"$$scope"in s&&t(2,i=s.$$scope)},[l,o,i,r]}class er extends K{constructor(e){super(),J(this,e,$n,xn,X,{label:0,open:1})}}function Pt(n,e,t){const r=n.slice();return r[10]=e[t][0],r[11]=e[t][1],r}function Tt(n){let e,t;return{c(){e=P("div"),t=de(n[2]),c(e,"class","govuk-hint")},m(r,i){T(r,e,i),E(e,t)},p(r,i){i&4&&Me(t,r[2])},d(r){r&&C(e)}}}function Ct(n){let e;return{c(){e=P("option"),e.__value="",We(e,e.__value)},m(t,r){T(t,e,r)},d(t){t&&C(e)}}}function St(n){let e,t=n[11]+"",r,i;return{c(){e=P("option"),r=de(t),e.__value=i=n[10],We(e,e.__value)},m(l,o){T(l,e,o),E(e,r)},p(l,o){o&8&&t!==(t=l[11]+"")&&Me(r,t),o&8&&i!==(i=l[10])&&(e.__value=i,We(e,e.__value))},d(l){l&&C(e)}}}function tr(n){let e,t,r,i,l,o,s,a;e=new Cn({props:{errorMessage:n[6]}});let f=n[2]&&Tt(n),u=n[4]&&Ct(),m=Ke(n[3]),_=[];for(let g=0;gn[9].call(i))},m(g,y){$(e,g,y),T(g,t,y),f&&f.m(g,y),T(g,r,y),T(g,i,y),u&&u.m(i,null),E(i,l);for(let M=0;M<_.length;M+=1)_[M]&&_[M].m(i,null);yt(i,n[0],!0),o=!0,s||(a=[V(i,"change",n[9]),V(i,"change",n[8])],s=!0)},p(g,y){const M={};if(y&64&&(M.errorMessage=g[6]),e.$set(M),g[2]?f?f.p(g,y):(f=Tt(g),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null),g[4]?u||(u=Ct(),u.c(),u.m(i,l)):u&&(u.d(1),u=null),y&8){m=Ke(g[3]);let b;for(b=0;b{"label"in g&&t(1,r=g.label),"hint"in g&&t(2,i=g.hint),"choices"in g&&t(3,l=g.choices),"emptyOption"in g&&t(4,o=g.emptyOption),"disabled"in g&&t(5,s=g.disabled),"errorMessage"in g&&t(6,a=g.errorMessage),"value"in g&&t(0,f=g.value)},[f,r,i,l,o,s,a,u,m,_]}class ir extends K{constructor(e){super(),J(this,e,rr,nr,X,{label:1,hint:2,choices:3,emptyOption:4,disabled:5,errorMessage:6,value:0})}}function Ki(n,e){let t=new Set(n.getStyle().layers.filter(r=>r.type=="line").map(r=>r.id));if(e=="dataviz")return["Road network","Path"].filter(r=>t.has(r));if(e=="hybrid")return["Path","Road","Tunnel"].filter(r=>t.has(r));if(e=="streets"){let r=[];for(let i of["road","bridge","tunnel"])for(let l of["link","minor","minor_construction","motorway","motorway_construction","motorway_link","path_pedestrian","secondary_tertiary","secondary_tertiary_construction","service_track","service_track_construction","street","trunk_primary","trunk_primary_construction","trunk_primary_link"])r.push(`${i}_${l}`);return r.filter(i=>t.has(i))}return e=="uk-openzoomstack-light"?n.getStyle().layers.filter(r=>r["source-layer"]=="roads"&&r.type=="line").map(r=>r.id):[]}let L=n=>n,te=n=>n,lr=n=>n,or=n=>n,sr=n=>n,ar=n=>n,fr=n=>n,ur=[fr("raster-basemap"),L("parliamentary_constituencies"),L("parliamentary_constituencies-outline"),L("wards"),L("wards-outline"),L("combined_authorities"),L("combined_authorities-outline"),L("local_authority_districts"),L("local_authority_districts-outline"),L("local_planning_authorities"),L("local_planning_authorities-outline"),L("census_output_areas"),L("census_output_areas-outline"),L("imd"),L("imd-outline"),L("pollution"),L("road_noise"),L("mrn"),L("srn"),L("bus_routes"),L("trams"),L("national_cycle_network"),L("cycle_paths"),L("pct_commute"),L("pct_school"),L("road_widths"),L("road_speeds"),L("pavement_widths"),L("gradient"),L("gradient_arrows"),L("education"),L("hospitals"),L("sports_spaces"),L("railway_stations"),L("cycle_parking"),L("crossings"),L("vehicle_counts"),L("stats19"),L("bus_stops"),te("interventions-coverage-polygons-outlines"),te("interventions-polygons"),te("interventions-polygons-outlines"),te("hover-polygons"),L("atf-interventions-polygons"),L("lcwip-interventions-polygons"),L("atf-interventions-polygons-outlines"),L("lcwip-interventions-polygons-outlines"),te("hover-lines"),te("interventions-lines"),te("interventions-lines-endpoints"),L("atf-interventions-lines"),L("lcwip-interventions-lines"),L("atf-interventions-lines-endpoints"),L("lcwip-interventions-lines-endpoints"),te("hover-points"),te("interventions-points"),L("atf-interventions-points"),L("lcwip-interventions-points"),L("problems"),te("edit-polygon-fill"),te("edit-polygon-lines"),te("edit-polygon-vertices"),te("draw-split-route"),te("route-points"),te("route-lines"),te("route-polygons"),lr("road_label"),ar(or(sr("Road labels"))),te("boundary"),L("measurement-line"),te("georeferenced-image"),L("cover-interactive-layers")],cr=Rn(null);function dr(n,e){return{id:e,beforeId:mr(n,e)}}function mr(n,e){let t=Bn(cr);if(!t){console.warn(`getBeforeId(${e}) called before map is ready. Z-ordering may be incorrect.`);return}let r,i=!1;for(let l=n.layerZorder.length-1;l>=0;l--){let o=n.layerZorder[l];if(o==e){i=!0;break}t.getLayer(o)&&(r=o)}if(!i)throw new Error(`Layer ID ${e} not defined in layerZorder`);return r}const Ji=["==",["geometry-type"],"Polygon"],Xi=["==",["geometry-type"],"LineString"],Yi=["==",["geometry-type"],"Point"];function ji(){return{type:"FeatureCollection",features:[]}}function xi(n,e,t){let r=["match",n];for(let[i,l]of Object.entries(e))r.push(i),r.push(l);return r.push(t),r}function gr(n){return In(n)}function $i(n){var t,r;let e={type:"FeatureCollection",features:[]};for(let i of n.features)if(e.features.push(i),i.geometry.type=="LineString"&&!((t=i.properties)!=null&&t.hide_while_editing))for(let l of[i.geometry.coordinates[0],i.geometry.coordinates[i.geometry.coordinates.length-1]])e.features.push({type:"Feature",properties:{endpoint:!0,scheme_reference:(r=i.properties)==null?void 0:r.scheme_reference},geometry:{type:"Point",coordinates:l}});return e}function el(n,e,t){let r=["step",n];for(let i=1;iTerms of Use and Privacy Policy`},m(t,r){T(t,e,r)},d(t){t&&C(e)}}}function hr(n){let e,t,r,i,l;function o(f){n[2](f)}let s={label:"Basemap",choices:Fn(),disabled:n[0]};n[1]!==void 0&&(s.value=n[1]),e=new ir({props:s}),Xe.push(()=>ft(e,"value",o));let a=n[1]=="google"&&zt();return{c(){x(e.$$.fragment),r=Q(),a&&a.c(),i=Ge()},m(f,u){$(e,f,u),T(f,r,u),a&&a.m(f,u),T(f,i,u),l=!0},p(f,[u]){const m={};u&1&&(m.disabled=f[0]),!t&&u&2&&(t=!0,m.value=f[1],ut(()=>t=!1)),e.$set(m),f[1]=="google"?a||(a=zt(),a.c(),a.m(i.parentNode,i)):a&&(a.d(1),a=null)},i(f){l||(I(e.$$.fragment,f),l=!0)},o(f){F(e.$$.fragment,f),l=!1},d(f){f&&(C(r),C(i)),ee(e,f),a&&a.d(f)}}}function _r(n,e,t){let r;Se(n,bt,o=>t(1,r=o));let{disabled:i=!1}=e;function l(o){r=o,bt.set(r)}return n.$$set=o=>{"disabled"in o&&t(0,i=o.disabled)},[i,r,l]}class rl extends K{constructor(e){super(),J(this,e,_r,hr,X,{disabled:0})}}function yr(n){let e,t;return{c(){e=_e("svg"),t=_e("path"),c(t,"d","M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"),c(e,"viewBox","0 0 14 14"),c(e,"width","13"),c(e,"height","13"),c(e,"class","svelte-en2qvf")},m(r,i){T(r,e,i),E(e,t)},p:N,i:N,o:N,d(r){r&&C(e)}}}class Kt extends K{constructor(e){super(),J(this,e,null,yr,X,{})}}function br(n){let e,t;return{c(){e=_e("svg"),t=_e("path"),c(t,"d","M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"),c(e,"viewBox","0 0 30 30"),c(e,"fill","none"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"class","svelte-d2loi5")},m(r,i){T(r,e,i),E(e,t)},p:N,i:N,o:N,d(r){r&&C(e)}}}class Jt extends K{constructor(e){super(),J(this,e,null,br,X,{})}}function vr(n){let e,t;return{c(){e=P("img"),ne(e.src,t=n[3]+"area.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,i){T(r,e,i)},p(r,i){i&8&&!ne(e.src,t=r[3]+"area.svg")&&c(e,"src",t),i&64&&c(e,"alt",r[6])},d(r){r&&C(e)}}}function wr(n){let e,t;return{c(){e=P("img"),ne(e.src,t=n[3]+"reverse.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,i){T(r,e,i)},p(r,i){i&8&&!ne(e.src,t=r[3]+"reverse.svg")&&c(e,"src",t),i&64&&c(e,"alt",r[6])},d(r){r&&C(e)}}}function kr(n){let e,t;return{c(){e=P("img"),ne(e.src,t=n[3]+"poi.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,i){T(r,e,i)},p(r,i){i&8&&!ne(e.src,t=r[3]+"poi.svg")&&c(e,"src",t),i&64&&c(e,"alt",r[6])},d(r){r&&C(e)}}}function pr(n){let e,t;return{c(){e=P("img"),ne(e.src,t=n[3]+"postal_code.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,i){T(r,e,i)},p(r,i){i&8&&!ne(e.src,t=r[3]+"postal_code.svg")&&c(e,"src",t),i&64&&c(e,"alt",r[6])},d(r){r&&C(e)}}}function Lr(n){let e,t;return{c(){e=P("img"),ne(e.src,t=n[3]+"street.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,i){T(r,e,i)},p(r,i){i&8&&!ne(e.src,t=r[3]+"street.svg")&&c(e,"src",t),i&64&&c(e,"alt",r[6])},d(r){r&&C(e)}}}function Mr(n){let e,t;return{c(){e=P("img"),ne(e.src,t=n[3]+"road.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,i){T(r,e,i)},p(r,i){i&8&&!ne(e.src,t=r[3]+"road.svg")&&c(e,"src",t),i&64&&c(e,"alt",r[6])},d(r){r&&C(e)}}}function Pr(n){let e,t;return{c(){e=P("img"),ne(e.src,t=n[3]+"housenumber.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,i){T(r,e,i)},p(r,i){i&8&&!ne(e.src,t=r[3]+"housenumber.svg")&&c(e,"src",t),i&64&&c(e,"alt",r[6])},d(r){r&&C(e)}}}function Tr(n){let e,t,r,i;return{c(){e=P("img"),ne(e.src,t=n[5])||c(e,"src",t),c(e,"alt",n[4]),c(e,"class","svelte-ltkwvy")},m(l,o){T(l,e,o),r||(i=V(e,"error",n[14]),r=!0)},p(l,o){o&32&&!ne(e.src,t=l[5])&&c(e,"src",t),o&16&&c(e,"alt",l[4])},d(l){l&&C(e),r=!1,i()}}}function Et(n){let e,t;return{c(){e=P("span"),t=de(n[6]),c(e,"class","secondary svelte-ltkwvy")},m(r,i){T(r,e,i),E(e,t)},p(r,i){i&64&&Me(t,r[6])},d(r){r&&C(e)}}}function Cr(n){var W,q;let e,t,r,i,l,o,s,a,f=(n[7]?n[0].place_name:n[0].place_name.replace(/,.*/,""))+"",u,m,_=n[2]==="always"||n[2]&&!n[0].address&&((W=n[0].properties)==null?void 0:W.kind)!=="road"&&((q=n[0].properties)==null?void 0:q.kind)!=="road_relation"&&!n[0].id.startsWith("address.")&&!n[0].id.startsWith("postal_code.")&&(!n[0].id.startsWith("poi.")||!n[5])&&!n[7],g,y,M=(n[7]?"":n[0].place_name.replace(/[^,]*,?\s*/,""))+"",b,p,U;function v(R,S){var oe,h;return S&1&&(t=null),S&1&&(r=null),S&1&&(i=null),R[5]?Tr:R[0].address?Pr:((oe=R[0].properties)==null?void 0:oe.kind)==="road"||((h=R[0].properties)==null?void 0:h.kind)==="road_relation"?Mr:(t==null&&(t=!!R[0].id.startsWith("address.")),t?Lr:(r==null&&(r=!!R[0].id.startsWith("postal_code.")),r?pr:(i==null&&(i=!!R[0].id.startsWith("poi.")),i?kr:R[7]?wr:vr)))}let z=v(n,-1),w=z(n),Z=_&&Et(n);return{c(){e=P("li"),w.c(),l=Q(),o=P("span"),s=P("span"),a=P("span"),u=de(f),m=Q(),Z&&Z.c(),g=Q(),y=P("span"),b=de(M),c(a,"class","primary svelte-ltkwvy"),c(s,"class","svelte-ltkwvy"),c(y,"class","line2 svelte-ltkwvy"),c(o,"class","texts svelte-ltkwvy"),c(e,"tabindex","0"),c(e,"data-selected",n[1]),c(e,"class","svelte-ltkwvy"),ve(e,"selected",n[1])},m(R,S){T(R,e,S),w.m(e,null),E(e,l),E(e,o),E(o,s),E(s,a),E(a,u),E(s,m),Z&&Z.m(s,null),E(o,g),E(o,y),E(y,b),p||(U=[V(e,"mouseenter",n[12]),V(e,"focus",n[13])],p=!0)},p(R,[S]){var oe,h;z===(z=v(R,S))&&w?w.p(R,S):(w.d(1),w=z(R),w&&(w.c(),w.m(e,l))),S&1&&f!==(f=(R[7]?R[0].place_name:R[0].place_name.replace(/,.*/,""))+"")&&Me(u,f),S&37&&(_=R[2]==="always"||R[2]&&!R[0].address&&((oe=R[0].properties)==null?void 0:oe.kind)!=="road"&&((h=R[0].properties)==null?void 0:h.kind)!=="road_relation"&&!R[0].id.startsWith("address.")&&!R[0].id.startsWith("postal_code.")&&(!R[0].id.startsWith("poi.")||!R[5])&&!R[7]),_?Z?Z.p(R,S):(Z=Et(R),Z.c(),Z.m(s,null)):Z&&(Z.d(1),Z=null),S&1&&M!==(M=(R[7]?"":R[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Me(b,M),S&2&&c(e,"data-selected",R[1]),S&2&&ve(e,"selected",R[1])},i:N,o:N,d(R){R&&C(e),w.d(),Z&&Z.d(),p=!1,Oe(U)}}}function Sr(n,e,t){var v;let r,i,{feature:l}=e,{selected:o=!1}=e,{showPlaceType:s}=e,{missingIconsCache:a}=e,{iconsBaseUrl:f}=e;const u=(v=l.properties)==null?void 0:v.categories;let m,_,g=0,y=l.place_type[0]==="reverse";function M(z){_&&a.add(_),t(10,g++,g)}function b(z){le.call(this,n,z)}function p(z){le.call(this,n,z)}const U=z=>M(z.currentTarget);return n.$$set=z=>{"feature"in z&&t(0,l=z.feature),"selected"in z&&t(1,o=z.selected),"showPlaceType"in z&&t(2,s=z.showPlaceType),"missingIconsCache"in z&&t(9,a=z.missingIconsCache),"iconsBaseUrl"in z&&t(3,f=z.iconsBaseUrl)},n.$$.update=()=>{var z,w,Z,W;if(n.$$.dirty&3640)do t(11,r--,r),t(4,m=u==null?void 0:u[r]),t(5,_=m?f+m.replace(/ /g,"_")+".svg":void 0);while(r>-1&&(!_||a.has(_)));n.$$.dirty&1&&t(6,i=l.id.startsWith("poi.")?(w=(z=l.properties)==null?void 0:z.categories)==null?void 0:w.join(", "):((W=(Z=l.properties)==null?void 0:Z.place_type_name)==null?void 0:W[0])??l.place_type[0])},t(11,r=(u==null?void 0:u.length)??0),[l,o,s,f,m,_,i,y,M,a,g,r,b,p,U]}class zr extends K{constructor(e){super(),J(this,e,Sr,Cr,X,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function Er(n){let e;return{c(){e=P("div"),e.innerHTML='',c(e,"class","svelte-7cmwmc")},m(t,r){T(t,e,r)},p:N,i:N,o:N,d(t){t&&C(e)}}}class Rr extends K{constructor(e){super(),J(this,e,null,Er,X,{})}}function Br(n){let e,t;return{c(){e=_e("svg"),t=_e("path"),c(t,"d","M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"),c(e,"viewBox","0 0 60.006 21.412"),c(e,"width","14"),c(e,"height","20"),c(e,"class","svelte-en2qvf")},m(r,i){T(r,e,i),E(e,t)},p:N,i:N,o:N,d(r){r&&C(e)}}}class Ir extends K{constructor(e){super(),J(this,e,null,Br,X,{})}}function Fr(n){let e,t,r;return{c(){e=_e("svg"),t=_e("circle"),r=_e("path"),c(t,"cx","4.789"),c(t,"cy","4.787"),c(t,"r","3.85"),Ce(t,"stroke-width","1.875"),Ce(t,"fill","none"),c(r,"d","M12.063 12.063 7.635 7.635"),Ce(r,"stroke-width","1.875"),Ce(r,"stroke-linecap","round"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"width","13"),c(e,"height","13"),c(e,"viewBox","0 0 13 13"),c(e,"class","svelte-1bpbt60")},m(i,l){T(i,e,l),E(e,t),E(e,r)},p:N,i:N,o:N,d(i){i&&C(e)}}}class Ar extends K{constructor(e){super(),J(this,e,null,Fr,X,{})}}function Or(n,e,t){const r=e[1],i=e[0],l=r-i;return n===r&&t?n:((n-i)%l+l)%l+i}function Rt(n){const e=[...n];return e[2]r[0]||i.maxZoom!=null&&i.maxZoomDate.now()){if(!Ze.coords)break e;return Ze.coords}let l;try{return l=await new Promise((o,s)=>{t.signal.addEventListener("abort",()=>{s(Error("aborted"))}),navigator.geolocation.getCurrentPosition(a=>{o([a.coords.longitude,a.coords.latitude].map(f=>f.toFixed(6)).join(","))},a=>{s(a)},i)}),l}catch{}finally{i.cachedLocationExpiry&&(Ze={time:Date.now(),coords:l})}if(t.signal.aborted)return}if(i.type==="server-geolocation")return"ip";if(r&&i.type==="map-center")return r[1].toFixed(6)+","+r[2].toFixed(6)}}function Bt(n,e,t){const r=n.slice();return r[81]=e[t],r[83]=t,r}function It(n){let e,t;return e=new Rr({}),{c(){x(e.$$.fragment)},m(r,i){$(e,r,i),t=!0},i(r){t||(I(e.$$.fragment,r),t=!0)},o(r){F(e.$$.fragment,r),t=!1},d(r){ee(e,r)}}}function Ft(n){let e,t,r,i,l;return t=new Ir({}),{c(){e=P("button"),x(t.$$.fragment),c(e,"type","button"),c(e,"title",n[9]),c(e,"class","svelte-zh3kmv"),ve(e,"active",n[0])},m(o,s){T(o,e,s),$(t,e,null),r=!0,i||(l=V(e,"click",n[67]),i=!0)},p(o,s){(!r||s[0]&512)&&c(e,"title",o[9]),(!r||s[0]&1)&&ve(e,"active",o[0])},i(o){r||(I(t.$$.fragment,o),r=!0)},o(o){F(t.$$.fragment,o),r=!1},d(o){o&&C(e),ee(t),i=!1,l()}}}function Ur(n){let e,t=[],r=new Map,i,l,o,s=Ke(n[14]);const a=f=>f[81].id+(f[81].address?","+f[81].address:"");for(let f=0;f{W=null}),Ee()),(!v||D[0]&2)&&ve(f,"displayable",B[1]!==""),B[5]===!0?q?(q.p(B,D),D[0]&32&&I(q,1)):(q=Ft(B),q.c(),I(q,1),q.m(r,y)):q&&(ze(),F(q,1,1,()=>{q=null}),Ee()),S&&S.p&&(!v||D[1]&134217728)&&ke(S,R,B,B[58],v?Le(R,B[58],D,null):pe(B[58]),null);let ie=b;b=ye(B),b===ie?~b&&h[b].p(B,D):(p&&(ze(),F(h[ie],1,1,()=>{h[ie]=null}),Ee()),~b?(p=h[b],p?p.p(B,D):(p=h[b]=oe[b](B),p.c()),I(p,1),p.m(t,null)):p=null),(!v||D[0]&4&&U!==(U=Je(B[2])+" svelte-zh3kmv"))&&c(t,"class",U),(!v||D[0]&22)&&ve(t,"can-collapse",B[4]&&B[1]==="")},i(B){v||(I(Z),I(l.$$.fragment,B),I(m.$$.fragment,B),I(W),I(q),I(S,B),I(p),v=!0)},o(B){F(Z),F(l.$$.fragment,B),F(m.$$.fragment,B),F(W),F(q),F(S,B),F(p),v=!1},d(B){B&&(C(e),C(t)),ee(l),n[61](null),ee(m),W&&W.d(),q&&q.d(),S&&S.d(B),~b&&h[b].d(),z=!1,Oe(w)}}}function Vr(n,e,t){let r,{$$slots:i={},$$scope:l}=e,{class:o=void 0}=e,{apiKey:s}=e,{bbox:a=void 0}=e,{clearButtonTitle:f="clear"}=e,{clearOnBlur:u=!1}=e,{collapsed:m=!1}=e,{country:_=void 0}=e,{debounceSearch:g=200}=e,{enableReverse:y=!1}=e,{errorMessage:M="Something went wrong…"}=e,{filter:b=()=>!0}=e,{flyTo:p=!0}=e,{fuzzyMatch:U=!0}=e,{language:v=void 0}=e,{limit:z=void 0}=e,{mapController:w=void 0}=e,{minLength:Z=2}=e,{noResultsMessage:W="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=e,{placeholder:q="Search"}=e,{proximity:R=[{type:"server-geolocation"}]}=e,{reverseActive:S=y==="always"}=e,{reverseButtonTitle:oe="toggle reverse geocoding"}=e,{searchValue:h=""}=e,{showFullGeometry:ye=!0}=e,{showPlaceType:B="ifNeeded"}=e,{showResultsWhileTyping:D=!0}=e,{selectFirst:ie=!0}=e,{flyToSelected:k=!1}=e,{markerOnSelected:ce=!0}=e,{types:se=void 0}=e,{excludeTypes:me=!1}=e,{zoom:Ue=16}=e,{maxZoom:Re=18}=e,{apiUrl:je="https://api.maptiler.com/geocoding"}=e,{fetchParameters:xe={}}=e,{iconsBaseUrl:mt="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.3/icons/"}=e,{adjustUrlQuery:$e=d=>{}}=e;function rn(){ge.focus()}function ln(){ge.blur()}function gt(d,j=!0,ae=!1){t(1,h=d),j?(t(15,H=-1),_t()):(rt(!ae,ae),setTimeout(()=>{ge.focus(),ge.select()}))}function on(){t(14,O=void 0),t(55,A=void 0),t(15,H=-1)}function sn(){t(54,Y=[]),t(55,A=void 0)}let Be=!1,O,Y,A,ht="",ge,H=-1,he,Ne=[],Te,Ie,Ve,et;const an=new Set,be=Wt();qt(()=>{w&&(w.setEventHandler(void 0),w.indicateReverse(!1),w.setSelectedMarker(-1),w.setMarkers(void 0,void 0))});function _t(d){if(Ie&&(clearTimeout(Ie),Ie=void 0),H>-1&&O)t(55,A=O[H]),t(1,h=A.place_type[0]==="reverse"?A.place_name:A.place_name.replace(/,.*/,"")),t(18,he=void 0),t(54,Y=void 0),t(15,H=-1);else if(h){const j=d||!tt(h);nt(h,{exact:!0}).then(()=>{t(54,Y=O),t(55,A=void 0),j&&fn()}).catch(ae=>t(18,he=ae))}}function tt(d){try{return On(d,6)}catch{return!1}}async function nt(d,{byId:j=!1,exact:ae=!1}={}){t(18,he=void 0),Te==null||Te.abort();const fe=new AbortController;t(19,Te=fe);try{const G=tt(d),ue=new URLSearchParams;if(v!==void 0&&ue.set("language",Array.isArray(v)?v.join(","):v??""),se&&ue.set("types",se.join(",")),me&&ue.set("excludeTypes",String(me)),a&&ue.set("bbox",a.map(He=>He.toFixed(6)).join(",")),_&&ue.set("country",Array.isArray(_)?_.join(","):_),!j&&!G){const He=await Gr(w,R,fe);He&&ue.set("proximity",He),(ae||!D)&&ue.set("autocomplete","false"),ue.set("fuzzyMatch",String(U))}z!==void 0&&(!G||(se==null?void 0:se.length)===1)&&ue.set("limit",String(z)),ue.set("key",s),$e(ue);const De=je+"/"+encodeURIComponent(G?G.decimalLongitude+","+G.decimalLatitude:d)+".json?"+ue.toString();if(De===ht){j?(t(14,O=void 0),t(55,A=Ne[0])):t(14,O=Ne);return}ht=De;const lt=await fetch(De,{signal:fe.signal,...xe});if(!lt.ok)throw new Error(await lt.text());const ot=await lt.json();be("response",{url:De,featureCollection:ot}),j?(t(14,O=void 0),t(55,A=ot.features[0]),Ne=[A]):(t(14,O=ot.features.filter(b)),G&&O.unshift({type:"Feature",properties:{},id:"reverse_"+G.decimalLongitude+"_"+G.decimalLatitude,text:G.decimalLatitude+", "+G.decimalLongitude,place_name:G.decimalLatitude+", "+G.decimalLongitude,place_type:["reverse"],center:[G.decimalLongitude,G.decimalLatitude],bbox:[G.decimalLongitude,G.decimalLatitude,G.decimalLongitude,G.decimalLatitude],geometry:{type:"Point",coordinates:[G.decimalLongitude,G.decimalLatitude]}}),Ne=O,G&&ge.focus())}catch(G){if(G&&typeof G=="object"&&"name"in G&&G.name==="AbortError")return;throw G}finally{fe===Te&&t(19,Te=void 0)}}function fn(){var ae;if(!(Y!=null&&Y.length)||!p)return;const d=[180,90,-180,-90],j=!Y.some(fe=>!fe.matching_text);for(const fe of Y)if(j||!fe.matching_text)for(const G of[0,1,2,3])d[G]=Math[G<2?"min":"max"](d[G],((ae=fe.bbox)==null?void 0:ae[G])??fe.center[G%2]);w&&Y.length>0&&(A&&d[0]===d[2]&&d[1]===d[3]?w.flyTo(A.center,Ue):w.fitBounds(Rt(d),50,Re))}function un(d){t(0,S=y==="always"),t(14,O=void 0),t(55,A=void 0),t(15,H=-1),gt(d[1].toFixed(6)+", "+Or(d[0],[-180,180],!0).toFixed(6),!1,!0)}function cn(d){if(!O)return;let j=d.key==="ArrowDown"?1:d.key==="ArrowUp"?-1:0;j&&(H===(ie?0:-1)&&j===-1&&t(15,H=O.length),t(15,H+=j),H>=O.length&&t(15,H=-1),H<0&&ie&&t(15,H=0),d.preventDefault())}function rt(d=!0,j=!1){if(t(18,he=void 0),D||j){if(Ie&&clearTimeout(Ie),h.length{nt(ae).catch(fe=>t(18,he=fe))},d?g:0)}else t(14,O=void 0),t(18,he=void 0)}function it(d){t(55,A=d),t(1,h=d.place_name),t(15,H=-1)}const dn=()=>ge.focus();function mn(d){Xe[d?"unshift":"push"](()=>{ge=d,t(17,ge)})}function gn(){h=this.value,t(1,h),t(13,Be),t(27,u)}const hn=()=>t(13,Be=!0),_n=()=>t(13,Be=!1),yn=()=>rt(),bn=()=>{t(1,h=""),ge.focus()},vn=()=>t(0,S=!S),wn=()=>t(18,he=void 0),kn=d=>t(15,H=d),pn=d=>it(d),Ln=()=>{ie||t(15,H=-1)},Mn=()=>{};return n.$$set=d=>{"class"in d&&t(2,o=d.class),"apiKey"in d&&t(25,s=d.apiKey),"bbox"in d&&t(26,a=d.bbox),"clearButtonTitle"in d&&t(3,f=d.clearButtonTitle),"clearOnBlur"in d&&t(27,u=d.clearOnBlur),"collapsed"in d&&t(4,m=d.collapsed),"country"in d&&t(28,_=d.country),"debounceSearch"in d&&t(29,g=d.debounceSearch),"enableReverse"in d&&t(5,y=d.enableReverse),"errorMessage"in d&&t(6,M=d.errorMessage),"filter"in d&&t(30,b=d.filter),"flyTo"in d&&t(31,p=d.flyTo),"fuzzyMatch"in d&&t(32,U=d.fuzzyMatch),"language"in d&&t(33,v=d.language),"limit"in d&&t(34,z=d.limit),"mapController"in d&&t(35,w=d.mapController),"minLength"in d&&t(36,Z=d.minLength),"noResultsMessage"in d&&t(7,W=d.noResultsMessage),"placeholder"in d&&t(8,q=d.placeholder),"proximity"in d&&t(37,R=d.proximity),"reverseActive"in d&&t(0,S=d.reverseActive),"reverseButtonTitle"in d&&t(9,oe=d.reverseButtonTitle),"searchValue"in d&&t(1,h=d.searchValue),"showFullGeometry"in d&&t(38,ye=d.showFullGeometry),"showPlaceType"in d&&t(10,B=d.showPlaceType),"showResultsWhileTyping"in d&&t(39,D=d.showResultsWhileTyping),"selectFirst"in d&&t(11,ie=d.selectFirst),"flyToSelected"in d&&t(40,k=d.flyToSelected),"markerOnSelected"in d&&t(41,ce=d.markerOnSelected),"types"in d&&t(42,se=d.types),"excludeTypes"in d&&t(43,me=d.excludeTypes),"zoom"in d&&t(44,Ue=d.zoom),"maxZoom"in d&&t(45,Re=d.maxZoom),"apiUrl"in d&&t(46,je=d.apiUrl),"fetchParameters"in d&&t(47,xe=d.fetchParameters),"iconsBaseUrl"in d&&t(12,mt=d.iconsBaseUrl),"adjustUrlQuery"in d&&t(48,$e=d.adjustUrlQuery),"$$scope"in d&&t(58,l=d.$$scope)},n.$$.update=()=>{if(n.$$.dirty[0]&134225920&&setTimeout(()=>{t(16,Ve=Be),u&&!Be&&t(1,h="")}),n.$$.dirty[0]&16386|n.$$.dirty[1]&32&&h.lengtht(18,he=d)),n.$$.dirty[1]&50356241&&(w&&A&&A.id!==et&&p&&(!A.bbox||A.bbox[0]===A.bbox[2]&&A.bbox[1]===A.bbox[3]?w.flyTo(A.center,A.id.startsWith("poi.")||A.id.startsWith("address.")?Re:Ue):w.fitBounds(Rt(A.bbox),50,Re),t(14,O=void 0),t(54,Y=void 0),t(15,H=-1)),t(56,et=A==null?void 0:A.id)),n.$$.dirty[0]&18432&&ie&&O!=null&&O.length&&t(15,H=0),n.$$.dirty[0]&2050&&(ie||t(15,H=-1)),n.$$.dirty[0]&16384|n.$$.dirty[1]&8388608&&Y!==O&&t(54,Y=void 0),n.$$.dirty[0]&81921|n.$$.dirty[1]&8388624&&w&&w.setEventHandler(d=>{switch(d.type){case"mapClick":S&&un(d.coordinates);break;case"markerClick":{const j=O==null?void 0:O.find(ae=>ae.id===d.id);j&&it(j)}break;case"markerMouseEnter":Y&&t(15,H=Ve?(O==null?void 0:O.findIndex(j=>j.id===d.id))??-1:-1);break;case"markerMouseLeave":Y&&t(15,H=-1);break}}),n.$$.dirty[0]&49152&&t(57,r=O==null?void 0:O[H]),n.$$.dirty[1]&67133969&&w&&r&&p&&k&&w.flyTo(r.center,r.id.startsWith("poi.")||r.id.startsWith("address.")?Re:Ue),n.$$.dirty[1]&1040&&(ce||w==null||w.setMarkers(void 0,void 0)),n.$$.dirty[1]&75498512&&w&&ce&&!Y&&(w.setMarkers(r?[r]:void 0,void 0),w.setSelectedMarker(r?0:-1)),n.$$.dirty[1]&25165840&&w&&w.setMarkers(Y,A),n.$$.dirty[0]&32768|n.$$.dirty[1]&8388624&&Y&&w&&w.setSelectedMarker(H),n.$$.dirty[0]&2|n.$$.dirty[1]&16&&w){const d=tt(h);w.setReverseMarker(d?[d.decimalLongitude,d.decimalLatitude]:void 0)}n.$$.dirty[1]&67108864&&be("select",r),n.$$.dirty[1]&16777216&&be("pick",A),n.$$.dirty[0]&81920&&be("optionsVisibilityChange",Ve&&!!O),n.$$.dirty[0]&16384&&be("featuresListed",O),n.$$.dirty[1]&8388608&&be("featuresMarked",Y),n.$$.dirty[0]&1&&be("reverseToggle",S),n.$$.dirty[0]&2&&be("queryChange",h),n.$$.dirty[0]&1|n.$$.dirty[1]&16&&w&&w.indicateReverse(S)},[S,h,o,f,m,y,M,W,q,oe,B,ie,mt,Be,O,H,Ve,ge,he,Te,an,_t,cn,rt,it,s,a,u,_,g,b,p,U,v,z,w,Z,R,ye,D,k,ce,se,me,Ue,Re,je,xe,$e,rn,ln,gt,on,sn,Y,A,et,r,l,i,dn,mn,gn,hn,_n,yn,bn,vn,wn,kn,pn,Ln,Mn]}class Dr extends K{constructor(e){super(),J(this,e,Vr,Nr,X,{class:2,apiKey:25,bbox:26,clearButtonTitle:3,clearOnBlur:27,collapsed:4,country:28,debounceSearch:29,enableReverse:5,errorMessage:6,filter:30,flyTo:31,fuzzyMatch:32,language:33,limit:34,mapController:35,minLength:36,noResultsMessage:7,placeholder:8,proximity:37,reverseActive:0,reverseButtonTitle:9,searchValue:1,showFullGeometry:38,showPlaceType:10,showResultsWhileTyping:39,selectFirst:11,flyToSelected:40,markerOnSelected:41,types:42,excludeTypes:43,zoom:44,maxZoom:45,apiUrl:46,fetchParameters:47,iconsBaseUrl:12,adjustUrlQuery:48,focus:49,blur:50,setQuery:51,clearList:52,clearMap:53},null,[-1,-1,-1])}get focus(){return this.$$.ctx[49]}get blur(){return this.$$.ctx[50]}get setQuery(){return this.$$.ctx[51]}get clearList(){return this.$$.ctx[52]}get clearMap(){return this.$$.ctx[53]}}function Ot(n){let e,t,r,i;return t=new Dr({props:{mapController:n[1],apiKey:"MZEJTanw3WpxRvt7qDfo",country:"gb"}}),{c(){e=P("div"),x(t.$$.fragment),c(e,"class",r=Je(n[0])+" svelte-189syb7")},m(l,o){T(l,e,o),$(t,e,null),i=!0},p(l,o){const s={};o&2&&(s.mapController=l[1]),t.$set(s),(!i||o&1&&r!==(r=Je(l[0])+" svelte-189syb7"))&&c(e,"class",r)},i(l){i||(I(t.$$.fragment,l),i=!0)},o(l){F(t.$$.fragment,l),i=!1},d(l){l&&C(e),ee(t)}}}function Hr(n){let e,t,r=n[1]&&Ot(n);return{c(){r&&r.c(),e=Ge()},m(i,l){r&&r.m(i,l),T(i,e,l),t=!0},p(i,[l]){i[1]?r?(r.p(i,l),l&2&&I(r,1)):(r=Ot(i),r.c(),I(r,1),r.m(e.parentNode,e)):r&&(ze(),F(r,1,1,()=>{r=null}),Ee())},i(i){t||(I(r),t=!0)},o(i){F(r),t=!1},d(i){i&&C(e),r&&r.d(i)}}}function Qr(n,e,t){let r;Se(n,Nt,o=>t(2,r=o));let{position:i="top-left"}=e,l;return Zn(()=>{t(1,l=Wn(r,Vt))}),n.$$set=o=>{"position"in o&&t(0,i=o.position)},[i,l]}class il extends K{constructor(e){super(),J(this,e,Qr,Hr,X,{position:0})}}function Kr(n){let e,t,r;return{c(){e=P("div"),e.innerHTML=`Active Travel England logo`,t=Q(),r=P("div"),c(e,"class","black-bar svelte-19t777m"),c(r,"class","green-bar svelte-19t777m")},m(i,l){T(i,e,l),T(i,t,l),T(i,r,l)},p:N,i:N,o:N,d(i){i&&(C(e),C(t),C(r))}}}class ll extends K{constructor(e){super(),J(this,e,null,Kr,X,{})}}function Jr(n){let e;return{c(){e=P("ul"),e.innerHTML=`
  • Click on the map to open a new tab with a 3rd-party imagery provider
  • Press Escape diff --git a/move_draw_controls/assets/index-7b4eed78.js b/move_draw_controls/assets/index-d36e2ea3.js similarity index 99% rename from move_draw_controls/assets/index-7b4eed78.js rename to move_draw_controls/assets/index-d36e2ea3.js index 4eeeabfb..b109ed32 100644 --- a/move_draw_controls/assets/index-7b4eed78.js +++ b/move_draw_controls/assets/index-d36e2ea3.js @@ -675,4 +675,4 @@ and limitations under the License. `}[t]};var es=function t(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],r=arguments[1];this.x=n,this.y=r,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var s=arguments[0],u=arguments[1];this.x=s.y*u.w-u.y*s.w,this.y=u.x*s.w-s.x*u.w,this.w=s.x*u.y-u.x*s.y}else if(arguments[0]instanceof yt&&arguments[1]instanceof yt){var p=arguments[0],c=arguments[1];this.x=p.y-c.y,this.y=c.x-p.x,this.w=p.x*c.y-c.x*p.y}}else if(arguments.length===3){var b=arguments[0],S=arguments[1],T=arguments[2];this.x=b,this.y=S,this.w=T}else if(arguments.length===4){var L=arguments[0],M=arguments[1],B=arguments[2],R=arguments[3],W=L.y-M.y,et=M.x-L.x,st=L.x*M.y-M.x*L.y,ut=B.y-R.y,gt=R.x-B.x,St=B.x*R.y-R.x*B.y;this.x=et*St-gt*st,this.y=ut*st-W*St,this.w=W*gt-ut*et}};es.prototype.getY=function(){var t=this.y/this.w;if(Pe.isNaN(t)||Pe.isInfinite(t))throw new Pp;return t};es.prototype.getX=function(){var t=this.x/this.w;if(Pe.isNaN(t)||Pe.isInfinite(t))throw new Pp;return t};es.prototype.getCoordinate=function(){var t=new yt;return t.x=this.getX(),t.y=this.getY(),t};es.prototype.interfaces_=function(){return[]};es.prototype.getClass=function(){return es};es.intersection=function(t,e,n,r){var s=t.y-e.y,u=e.x-t.x,p=t.x*e.y-e.x*t.y,c=n.y-r.y,b=r.x-n.x,S=n.x*r.y-r.x*n.y,T=u*S-b*p,L=c*p-s*S,M=s*b-c*u,B=T/M,R=L/M;if(Pe.isNaN(B)||Pe.isInfinite(B)||Pe.isNaN(R)||Pe.isInfinite(R))throw new Pp;return new yt(B,R)};var de=function t(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof yt){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];this.init(r.x,s.x,r.y,s.y)}else if(arguments.length===4){var u=arguments[0],p=arguments[1],c=arguments[2],b=arguments[3];this.init(u,p,c,b)}},PE={serialVersionUID:{configurable:!0}};de.prototype.getArea=function(){return this.getWidth()*this.getHeight()};de.prototype.equals=function(t){if(!(t instanceof de))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()};de.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new de;var e=this._minx>t._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,r=this._maxx=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}};de.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof de){var t=arguments[0];return this.isNull()||t.isNull()?!1:!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||nthis._maxy||rthis._maxx&&(this._maxx=e._maxx),e._minythis._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(nthis._maxx&&(this._maxx=n),rthis._maxy&&(this._maxy=r))}};de.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._maxy?1:0};de.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)};de.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};de.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};de.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};de.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e};de.prototype.expandBy=function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};de.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof de){var t=arguments[0];return this.covers(t)}else if(arguments[0]instanceof yt){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.covers(n,r)}};de.prototype.centre=function(){return this.isNull()?null:new yt((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};de.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof yt){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof de){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(arguments.length===4){var s=arguments[0],u=arguments[1],p=arguments[2],c=arguments[3];st._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxyt._maxy&&(n=this._miny-t._maxy),e===0?n:n===0?e:Math.sqrt(e*e+n*n)};de.prototype.hashCode=function(){var t=17;return t=37*t+yt.hashCode(this._minx),t=37*t+yt.hashCode(this._maxx),t=37*t+yt.hashCode(this._miny),t=37*t+yt.hashCode(this._maxy),t};de.prototype.interfaces_=function(){return[jo,Ho]};de.prototype.getClass=function(){return de};de.intersects=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.xe.x?t.x:e.x)&&n.y>=(t.ye.y?t.y:e.y)}else if(arguments.length===4){var r=arguments[0],s=arguments[1],u=arguments[2],p=arguments[3],c=Math.min(u.x,p.x),b=Math.max(u.x,p.x),S=Math.min(r.x,s.x),T=Math.max(r.x,s.x);return!(S>b||Tb)||Tn?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}};qn.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};qn.prototype.setPrecisionModel=function(t){this._precisionModel=t};qn.prototype.isInteriorIntersection=function(){var t=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var e=arguments[0],n=0;ns?u=r:u=s;else{var p=Math.abs(t.x-e.x),c=Math.abs(t.y-e.y);r>s?u=p:u=c,u===0&&!t.equals(e)&&(u=Math.max(p,c))}return Ne.isTrue(!(u===0&&!t.equals(e)),"Bad distance calculation"),u};qn.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,s=t.y-e.y,u=Math.sqrt(r*r+s*s);return Ne.isTrue(!(u===0&&!t.equals(e)),"Invalid distance calculation"),u};zc.DONT_INTERSECT.get=function(){return 0};zc.DO_INTERSECT.get=function(){return 1};zc.COLLINEAR.get=function(){return 2};zc.NO_INTERSECTION.get=function(){return 0};zc.POINT_INTERSECTION.get=function(){return 1};zc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(qn,zc);var Ru=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(n){var r=new de(this._inputLines[0][0],this._inputLines[0][1]),s=new de(this._inputLines[1][0],this._inputLines[1][1]);return r.contains(n)&&s.contains(n)},e.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],r=arguments[1],s=arguments[2];if(this._isProper=!1,de.intersects(r,s,n)&&ee.orientationIndex(r,s,n)===0&&ee.orientationIndex(s,r,n)===0)return this._isProper=!0,(n.equals(r)||n.equals(s))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION}else return t.prototype.computeIntersection.apply(this,arguments)},e.prototype.normalizeToMinimum=function(n,r,s,u,p){p.x=this.smallestInAbsValue(n.x,r.x,s.x,u.x),p.y=this.smallestInAbsValue(n.y,r.y,s.y,u.y),n.x-=p.x,n.y-=p.y,r.x-=p.x,r.y-=p.y,s.x-=p.x,s.y-=p.y,u.x-=p.x,u.y-=p.y},e.prototype.safeHCoordinateIntersection=function(n,r,s,u){var p=null;try{p=es.intersection(n,r,s,u)}catch(c){if(c instanceof Pp)p=e.nearestEndpoint(n,r,s,u);else throw c}finally{}return p},e.prototype.intersection=function(n,r,s,u){var p=this.intersectionWithNormalization(n,r,s,u);return this.isInSegmentEnvelopes(p)||(p=new yt(e.nearestEndpoint(n,r,s,u))),this._precisionModel!==null&&this._precisionModel.makePrecise(p),p},e.prototype.smallestInAbsValue=function(n,r,s,u){var p=n,c=Math.abs(p);return Math.abs(r)1e-4&&$r.out.println("Distance = "+p.distance(c))},e.prototype.intersectionWithNormalization=function(n,r,s,u){var p=new yt(n),c=new yt(r),b=new yt(s),S=new yt(u),T=new yt;this.normalizeToEnvCentre(p,c,b,S,T);var L=this.safeHCoordinateIntersection(p,c,b,S);return L.x+=T.x,L.y+=T.y,L},e.prototype.computeCollinearIntersection=function(n,r,s,u){var p=de.intersects(n,r,s),c=de.intersects(n,r,u),b=de.intersects(s,u,n),S=de.intersects(s,u,r);return p&&c?(this._intPt[0]=s,this._intPt[1]=u,t.COLLINEAR_INTERSECTION):b&&S?(this._intPt[0]=n,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):p&&b?(this._intPt[0]=s,this._intPt[1]=n,s.equals(n)&&!c&&!S?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):p&&S?(this._intPt[0]=s,this._intPt[1]=r,s.equals(r)&&!c&&!b?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):c&&b?(this._intPt[0]=u,this._intPt[1]=n,u.equals(n)&&!p&&!S?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):c&&S?(this._intPt[0]=u,this._intPt[1]=r,u.equals(r)&&!p&&!b?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(n,r,s,u,p){var c=n.xr.x?n.x:r.x,T=n.y>r.y?n.y:r.y,L=s.xu.x?s.x:u.x,R=s.y>u.y?s.y:u.y,W=c>L?c:L,et=SM?b:M,ut=T0&&c>0||p<0&&c<0)return t.NO_INTERSECTION;var b=ee.orientationIndex(s,u,n),S=ee.orientationIndex(s,u,r);if(b>0&&S>0||b<0&&S<0)return t.NO_INTERSECTION;var T=p===0&&c===0&&b===0&&S===0;return T?this.computeCollinearIntersection(n,r,s,u):(p===0||c===0||b===0||S===0?(this._isProper=!1,n.equals2D(s)||n.equals2D(u)?this._intPt[0]=n:r.equals2D(s)||r.equals2D(u)?this._intPt[0]=r:p===0?this._intPt[0]=new yt(s):c===0?this._intPt[0]=new yt(u):b===0?this._intPt[0]=new yt(n):S===0&&(this._intPt[0]=new yt(r))):(this._isProper=!0,this._intPt[0]=this.intersection(n,r,s,u)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(n,r,s,u){var p=n,c=ee.distancePointLine(n,s,u),b=ee.distancePointLine(r,s,u);return b0?n>0?-s:s:n>0?s:-s;if(e===0||n===0)return r>0?t>0?s:-s:t>0?-s:s;if(e>0?r>0?e<=r||(s=-s,u=t,t=n,n=u,u=e,e=r,r=u):e<=-r?(s=-s,n=-n,r=-r):(u=t,t=-n,n=u,u=e,e=-r,r=u):r>0?-e<=r?(s=-s,t=-t,e=-e):(u=-t,t=n,n=u,u=-e,e=r,r=u):e>=r?(t=-t,e=-e,n=-n,r=-r):(s=-s,u=-t,t=-n,n=u,u=-e,e=-r,r=u),t>0)if(n>0){if(!(t<=n))return s}else return s;else{if(n>0)return-s;if(t>=n)s=-s,t=-t,n=-n;else return-s}for(;;){if(p=Math.floor(n/t),n=n-p*t,r=r-p*e,r<0)return-s;if(r>e)return s;if(t>n+n){if(er+r)return-s;n=t-n,r=e-r,s=-s}if(r===0)return n===0?0:-s;if(n===0||(p=Math.floor(t/n),t=t-p*n,e=e-p*r,e<0))return s;if(e>r)return-s;if(n>t+t){if(re+e)return s;t=n-t,e=r-e,s=-s}if(e===0)return t===0?0:s;if(t===0)return-s}};var Es=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};Es.prototype.countSegment=function(t,e){if(t.xr&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var s=t.x-this._p.x,u=t.y-this._p.y,p=e.x-this._p.x,c=e.y-this._p.y,b=bc.signOfDet2x2(s,u,p,c);if(b===0)return this._isPointOnSegment=!0,null;c0&&this._crossingCount++}};Es.prototype.isPointInPolygon=function(){return this.getLocation()!==xt.EXTERIOR};Es.prototype.getLocation=function(){return this._isPointOnSegment?xt.BOUNDARY:this._crossingCount%2===1?xt.INTERIOR:xt.EXTERIOR};Es.prototype.isOnSegment=function(){return this._isPointOnSegment};Es.prototype.interfaces_=function(){return[]};Es.prototype.getClass=function(){return Es};Es.locatePointInRing=function(){if(arguments[0]instanceof yt&&Ie(arguments[1],Qe)){for(var t=arguments[0],e=arguments[1],n=new Es(t),r=new yt,s=new yt,u=1;u1||b<0||b>1)&&(s=!0)}}return s?Lo.min(ee.distancePointLine(t,n,r),ee.distancePointLine(e,n,r),ee.distancePointLine(n,t,e),ee.distancePointLine(r,t,e)):0};ee.isPointInRing=function(t,e){return ee.locatePointInRing(t,e)!==xt.EXTERIOR};ee.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new yt;t.getCoordinate(0,r);for(var s=r.x,u=r.y,p=1;pn.y&&(n=u,r=s)}var p=r;do p=p-1,p<0&&(p=e);while(t[p].equals2D(n)&&p!==r);var c=r;do c=(c+1)%e;while(t[c].equals2D(n)&&c!==r);var b=t[p],S=t[c];if(b.equals2D(n)||S.equals2D(n)||b.equals2D(S))return!1;var T=ee.computeOrientation(b,n,S),L=!1;return T===0?L=b.x>S.x:L=T>0,L};ee.locatePointInRing=function(t,e){return Es.locatePointInRing(t,e)};ee.distancePointLinePerpendicular=function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),s=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(s)*Math.sqrt(r)};ee.computeOrientation=function(t,e,n){return ee.orientationIndex(t,e,n)};ee.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new Fn("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r=1)return u.distance(c);var T=((p.y-u.y)*(c.x-p.x)-(p.x-u.x)*(c.y-p.y))/b;return Math.abs(T)*Math.sqrt(b)}};ee.isOnLine=function(t,e){for(var n=new Ru,r=1;r0};ap.prototype.interfaces_=function(){return[Vo]};ap.prototype.getClass=function(){return ap};var lp=function(){};lp.prototype.isInBoundary=function(t){return t>1};lp.prototype.interfaces_=function(){return[Vo]};lp.prototype.getClass=function(){return lp};var up=function(){};up.prototype.isInBoundary=function(t){return t===1};up.prototype.interfaces_=function(){return[Vo]};up.prototype.getClass=function(){return up};var gr=function(){};gr.prototype.add=function(){};gr.prototype.addAll=function(){};gr.prototype.isEmpty=function(){};gr.prototype.iterator=function(){};gr.prototype.size=function(){};gr.prototype.toArray=function(){};gr.prototype.remove=function(){};function _0(t){this.message=t||""}_0.prototype=new Error;_0.prototype.name="IndexOutOfBoundsException";var Mp=function(){};Mp.prototype.hasNext=function(){};Mp.prototype.next=function(){};Mp.prototype.remove=function(){};var ns=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(gr);function kp(t){this.message=t||""}kp.prototype=new Error;kp.prototype.name="NoSuchElementException";var Xt=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof gr&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,gr]},e.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(n){for(var r=this,s=n.iterator();s.hasNext();)r.add(s.next());return!0},e.prototype.set=function(n,r){var s=this.array_[n];return this.array_[n]=r,s},e.prototype.iterator=function(){return new CN(this)},e.prototype.get=function(n){if(n<0||n>=this.size())throw new _0;return this.array_[n]},e.prototype.isEmpty=function(){return this.array_.length===0},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var n=this,r=[],s=0,u=this.array_.length;s=1){var S=this.get(this.size()-1);if(S.equals2D(c))return null}t.prototype.add.call(this,c)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var T=arguments[0],L=arguments[1];return this.add(T,L),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var M=arguments[0],B=arguments[1],R=arguments[2];if(R)for(var W=0;W=0;et--)r.add(M[et],B);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof yt){var st=arguments[0],ut=arguments[1],gt=arguments[2];if(!gt){var St=this.size();if(St>0){if(st>0){var Bt=this.get(st-1);if(Bt.equals2D(ut))return null}if(stie&&(wt=-1);for(var se=Ut;se!==ie;se+=wt)r.add(Dt[se],Lt);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new yt(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(Xt),Ge=function(){},ny={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};ny.ForwardComparator.get=function(){return ad};ny.BidirectionalComparator.get=function(){return cp};ny.coordArrayType.get=function(){return new Array(0).fill(null)};Ge.prototype.interfaces_=function(){return[]};Ge.prototype.getClass=function(){return Ge};Ge.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))};Ge.ptNotInList=function(t,e){for(var n=0;n=t?e:[]};Ge.indexOf=function(t,e){for(var n=0;n0)&&(e=t[n]);return e};Ge.extract=function(t,e,n){e=Lo.clamp(e,0,t.length),n=Lo.clamp(n,-1,t.length);var r=n-e+1;n<0&&(r=0),e>=t.length&&(r=0),nr.length)return 1;if(n.length===0)return 0;var s=Ge.compare(n,r),u=Ge.isEqualReversed(n,r);return u?0:s};cp.prototype.OLDcompare=function(t,e){var n=t,r=e;if(n.lengthr.length)return 1;if(n.length===0)return 0;for(var s=Ge.increasingDirection(n),u=Ge.increasingDirection(r),p=s>0?0:n.length-1,c=u>0?0:n.length-1,b=0;b0)e=e.right;else return e.value}return null};ii.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:Na,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,r,s;do if(r=n,s=t.compareTo(n.key),s<0)n=n.left;else if(s>0)n=n.right;else{var u=n.value;return n.value=e,u}while(n!==null);var p={key:t,left:null,right:null,value:e,parent:r,color:Na,getValue:function(){return this.value},getKey:function(){return this.key}};return s<0?r.left=p:r.right=p,this.fixAfterInsertion(p),this.size_++,null};ii.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=uu;t!=null&&t!==this.root_&&t.parent.color===uu;)if(In(t)===q_(In(In(t)))){var n=fw(In(In(t)));pw(n)===uu?(Ma(In(t),Na),Ma(n,Na),Ma(In(In(t)),uu),t=In(In(t))):(t===fw(In(t))&&(t=In(t),e.rotateLeft(t)),Ma(In(t),Na),Ma(In(In(t)),uu),e.rotateRight(In(In(t))))}else{var r=q_(In(In(t)));pw(r)===uu?(Ma(In(t),Na),Ma(r,Na),Ma(In(In(t)),uu),t=In(In(t))):(t===q_(In(t))&&(t=In(t),e.rotateRight(t)),Ma(In(t),Na),Ma(In(In(t)),uu),e.rotateLeft(In(In(t))))}this.root_.color=Na};ii.prototype.values=function(){var t=new Xt,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=ii.successor(e))!==null;)t.add(e.value);return t};ii.prototype.entrySet=function(){var t=new v0,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=ii.successor(e))!==null;)t.add(e);return t};ii.prototype.rotateLeft=function(t){if(t!=null){var e=t.right;t.right=e.left,e.left!=null&&(e.left.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}};ii.prototype.rotateRight=function(t){if(t!=null){var e=t.left;t.left=e.right,e.right!=null&&(e.right.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}};ii.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t};ii.successor=function(t){if(t===null)return null;if(t.right!==null){for(var e=t.right;e.left!==null;)e=e.left;return e}else{for(var n=t.parent,r=t;n!==null&&r===n.right;)r=n,n=n.parent;return n}};ii.prototype.size=function(){return this.size_};var ld=function(){};ld.prototype.interfaces_=function(){return[]};ld.prototype.getClass=function(){return ld};function ME(){}ME.prototype=new ry;function Ls(){this.array_=[],arguments[0]instanceof gr&&this.addAll(arguments[0])}Ls.prototype=new ME;Ls.prototype.contains=function(t){for(var e=this,n=0,r=this.array_.length;n=0;){var p=s.substring(0,u);r.add(p),s=s.substring(u+n),u=s.indexOf(e)}s.length>0&&r.add(s);for(var c=new Array(r.size()).fill(null),b=0;b0)for(var u=s;u0&&r.append(" ");for(var u=0;u0&&r.append(","),r.append(Bo.toString(t.getOrdinate(s,u)))}return r.append(")"),r.toString()}};ir.ensureValidRing=function(t,e){var n=e.size();if(n===0)return e;if(n<=3)return ir.createClosedRing(t,e,4);var r=e.getOrdinate(0,Qe.X)===e.getOrdinate(n-1,Qe.X)&&e.getOrdinate(0,Qe.Y)===e.getOrdinate(n-1,Qe.Y);return r?e:ir.createClosedRing(t,e,n+1)};ir.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),s=e.size();ir.copy(e,0,r,0,s);for(var u=s;u0&&ir.reverse(r._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?sn.FALSE:0},e.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return ee.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var r=this._points.copy();ir.reverse(r);var s=this.getFactory().createLineString(r);return s},e.prototype.compareToSameClass=function(){var r=this;if(arguments.length===1){for(var s=arguments[0],u=s,p=0,c=0;p= 2)");this._points=r},e.prototype.isCoordinate=function(r){for(var s=this,u=0;u=1&&this.getCoordinateSequence().size()= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(Zn),aa=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Ee.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(arguments.length===2){var r=arguments[0],s=arguments[1];return this.isEquivalentClass(r)?t.prototype.equalsExact.call(this,r,s):!1}else return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var r=this,s=this._geometries.length,u=new Array(s).fill(null),p=0;p0?e.createPoint(n[0]):e.createPoint():t};hd.prototype.interfaces_=function(){return[Go.GeometryEditorOperation]};hd.prototype.getClass=function(){return hd};var pd=function(){};pd.prototype.edit=function(t,e){return t instanceof ca?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Zn?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof ao?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t};pd.prototype.interfaces_=function(){return[Go.GeometryEditorOperation]};pd.prototype.getClass=function(){return pd};var nr=function(){var t=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var n=0;n0){var e=new Hs(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var n=1;n3&&(r=3),r<2?new nr(n):new nr(n,r)}};ha.prototype.interfaces_=function(){return[op,Ho]};ha.prototype.getClass=function(){return ha};ha.instance=function(){return ha.instanceObject};b0.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};b0.instanceObject.get=function(){return new ha};Object.defineProperties(ha,b0);var DE=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(n){return this.map_.get(n)||null},e.prototype.put=function(n,r){return this.map_.set(n,r),r},e.prototype.values=function(){for(var n=new Xt,r=this.map_.values(),s=r.next();!s.done;)n.add(s.value),s=r.next();return n},e.prototype.entrySet=function(){var n=new v0;return this.map_.entries().forEach(function(r){return n.add(r)}),n},e.prototype.size=function(){return this.map_.size()},e}(Bc),un=function t(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=t.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Ps){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}}},w0={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};un.prototype.equals=function(t){if(!(t instanceof un))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale};un.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new Ts(n).compareTo(new Ts(r))};un.prototype.getScale=function(){return this._scale};un.prototype.isFloating=function(){return this._modelType===un.FLOATING||this._modelType===un.FLOATING_SINGLE};un.prototype.getType=function(){return this._modelType};un.prototype.toString=function(){var t="UNKNOWN";return this._modelType===un.FLOATING?t="Floating":this._modelType===un.FLOATING_SINGLE?t="Floating-Single":this._modelType===un.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t};un.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if(Pe.isNaN(t))return t;if(this._modelType===un.FLOATING_SINGLE){var e=t;return e}return this._modelType===un.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof yt){var n=arguments[0];if(this._modelType===un.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};un.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===un.FLOATING?t=16:this._modelType===un.FLOATING_SINGLE?t=6:this._modelType===un.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t};un.prototype.setScale=function(t){this._scale=Math.abs(t)};un.prototype.interfaces_=function(){return[Ho,jo]};un.prototype.getClass=function(){return un};un.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e};w0.serialVersionUID.get=function(){return 7777263578777804e3};w0.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(un,w0);var Ps=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},S0={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Ps.prototype.readResolve=function(){return Ps.nameToTypeMap.get(this._name)};Ps.prototype.toString=function(){return this._name};Ps.prototype.interfaces_=function(){return[Ho]};Ps.prototype.getClass=function(){return Ps};S0.serialVersionUID.get=function(){return-552860263173159e4};S0.nameToTypeMap.get=function(){return new DE};Object.defineProperties(Ps,S0);un.Type=Ps;un.FIXED=new Ps("FIXED");un.FLOATING=new Ps("FLOATING");un.FLOATING_SINGLE=new Ps("FLOATING SINGLE");var Ve=function t(){this._precisionModel=new un,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Ie(arguments[0],op)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof un&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},RE={serialVersionUID:{configurable:!0}};Ve.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new yt(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new yt(t.getMinX(),t.getMinY()),new yt(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new yt(t.getMinX(),t.getMinY()),new yt(t.getMinX(),t.getMaxY()),new yt(t.getMaxX(),t.getMaxY()),new yt(t.getMaxX(),t.getMinY()),new yt(t.getMinX(),t.getMinY())]),null)};Ve.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new Zn(this.getCoordinateSequenceFactory().create(t),this);if(Ie(t,Qe))return new Zn(t,this)}else return new Zn(this.getCoordinateSequenceFactory().create([]),this)};Ve.prototype.createMultiLineString=function(){if(arguments.length===0)return new vu(null,this);if(arguments.length===1){var t=arguments[0];return new vu(t,this)}};Ve.prototype.buildGeometry=function(t){for(var e=null,n=!1,r=!1,s=t.iterator();s.hasNext();){var u=s.next(),p=u.getClass();e===null&&(e=p),p!==e&&(n=!0),u.isGeometryCollectionOrDerived()&&(r=!0)}if(e===null)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(Ve.toGeometryArray(t));var c=t.iterator().next(),b=t.size()>1;if(b){if(c instanceof xr)return this.createMultiPolygon(Ve.toPolygonArray(t));if(c instanceof Zn)return this.createMultiLineString(Ve.toLineStringArray(t));if(c instanceof ao)return this.createMultiPoint(Ve.toPointArray(t));Ne.shouldNeverReachHere("Unhandled class: "+c.getClass().getName())}return c};Ve.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)};Ve.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof yt){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}else if(Ie(arguments[0],Qe)){var e=arguments[0];return new ao(e,this)}}};Ve.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};Ve.prototype.createPolygon=function(){if(arguments.length===0)return new xr(null,null,this);if(arguments.length===1){if(Ie(arguments[0],Qe)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof ca){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];return new xr(r,s,this)}};Ve.prototype.getSRID=function(){return this._SRID};Ve.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Si(null,this);if(arguments.length===1){var t=arguments[0];return new Si(t,this)}};Ve.prototype.createGeometry=function(t){var e=new Go(this);return e.edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};Ve.prototype.getPrecisionModel=function(){return this._precisionModel};Ve.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}else if(Ie(arguments[0],Qe)){var e=arguments[0];return new ca(e,this)}}};Ve.prototype.createMultiPolygon=function(){if(arguments.length===0)return new aa(null,this);if(arguments.length===1){var t=arguments[0];return new aa(t,this)}};Ve.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new hp(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new hp(e,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Ie(arguments[0],Qe)){var r=arguments[0];if(r===null)return this.createMultiPoint(new Array(0).fill(null));for(var s=new Array(r.size()).fill(null),u=0;u=this.size())throw new Error;return this.array_[t]};Ws.prototype.push=function(t){return this.array_.push(t),t};Ws.prototype.pop=function(t){if(this.array_.length===0)throw new ly;return this.array_.pop()};Ws.prototype.peek=function(){if(this.array_.length===0)throw new ly;return this.array_[this.array_.length-1]};Ws.prototype.empty=function(){return this.array_.length===0};Ws.prototype.isEmpty=function(){return this.empty()};Ws.prototype.search=function(t){return this.array_.indexOf(t)};Ws.prototype.size=function(){return this.array_.length};Ws.prototype.toArray=function(){for(var t=this,e=[],n=0,r=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&r===ee.CLOCKWISE)&&(s=!0),s&&(this._minIndex=this._minIndex-1)};Ms.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge(),r=n.getCoordinates();if(e<0||e+1>=r.length||r[e].y===r[e+1].y)return-1;var s=jt.LEFT;return r[e].ye._minCoord.x)&&(e._minDe=t,e._minIndex=r,e._minCoord=n[r])};Ms.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode(),e=t.getEdges();this._minDe=e.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};Ms.prototype.findEdge=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next();r.isForward()&&e.checkForRightmostCoordinate(r)}Ne.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var s=this.getRightmostSide(this._minDe,this._minIndex);s===jt.LEFT&&(this._orientedDe=this._minDe.getSym())};Ms.prototype.interfaces_=function(){return[]};Ms.prototype.getClass=function(){return Ms};var Ha=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new yt(r):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(n,r){return r?n:n+" [ "+r+" ]"},e}(qa),uy=function(){this.array_=[]};uy.prototype.addLast=function(t){this.array_.push(t)};uy.prototype.removeFirst=function(){return this.array_.shift()};uy.prototype.isEmpty=function(){return this.array_.length===0};var Ei=function(){this._finder=null,this._dirEdgeList=new Xt,this._nodes=new Xt,this._rightMostCoord=null,this._env=null,this._finder=new Ms};Ei.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.setVisited(!1)}};Ei.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};Ei.prototype.computeNodeDepth=function(t){for(var e=this,n=null,r=t.getEdges().iterator();r.hasNext();){var s=r.next();if(s.isVisited()||s.getSym().isVisited()){n=s;break}}if(n===null)throw new Ha("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(n);for(var u=t.getEdges().iterator();u.hasNext();){var p=u.next();p.setVisited(!0),e.copySymDepths(p)}};Ei.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(jt.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)};Ei.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};Ei.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(jt.RIGHT)>=1&&e.getDepth(jt.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}};Ei.prototype.computeDepths=function(t){var e=this,n=new v0,r=new uy,s=t.getNode();for(r.addLast(s),n.add(s),t.setVisited(!0);!r.isEmpty();){var u=r.removeFirst();n.add(u),e.computeNodeDepth(u);for(var p=u.getEdges().iterator();p.hasNext();){var c=p.next(),b=c.getSym();if(!b.isVisited()){var S=b.getNode();n.contains(S)||(r.addLast(S),n.add(S))}}}};Ei.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0};Ei.prototype.getEnvelope=function(){if(this._env===null){for(var t=new de,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next(),r=n.getEdge().getCoordinates(),s=0;sthis.location.length){var n=new Array(3).fill(null);n[jt.ON]=this.location[jt.ON],n[jt.LEFT]=xt.NONE,n[jt.RIGHT]=xt.NONE,this.location=n}for(var r=0;r1&&t.append(xt.toLocationSymbol(this.location[jt.LEFT])),t.append(xt.toLocationSymbol(this.location[jt.ON])),this.location.length>1&&t.append(xt.toLocationSymbol(this.location[jt.RIGHT])),t.toString()};Cn.prototype.setLocations=function(t,e,n){this.location[jt.ON]=t,this.location[jt.LEFT]=e,this.location[jt.RIGHT]=n};Cn.prototype.get=function(t){return t1};Cn.prototype.isAnyNull=function(){for(var t=this,e=0;et._maxNodeDegree&&(t._maxNodeDegree=r),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2};ur.prototype.addPoints=function(t,e,n){var r=this,s=t.getCoordinates();if(e){var u=1;n&&(u=0);for(var p=u;p=0;b--)r._pts.add(s[b])}};ur.prototype.isHole=function(){return this._isHole};ur.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)};ur.prototype.containsPoint=function(t){var e=this.getLinearRing(),n=e.getEnvelopeInternal();if(!n.contains(t)||!ee.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){var s=r.next();if(s.containsPoint(t))return!1}return!0};ur.prototype.addHole=function(t){this._holes.add(t)};ur.prototype.isShell=function(){return this._shell===null};ur.prototype.getLabel=function(){return this._label};ur.prototype.getEdges=function(){return this._edges};ur.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};ur.prototype.getShell=function(){return this._shell};ur.prototype.mergeLabel=function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=e.getLocation(n,jt.RIGHT);if(r===xt.NONE)return null;if(this._label.getLocation(n)===xt.NONE)return this._label.setLocation(n,r),null}};ur.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)};ur.prototype.toPolygon=function(t){for(var e=this,n=new Array(this._holes.size()).fill(null),r=0;r=2,"found partial label"),this.computeIM(t)};Ao.prototype.isInResult=function(){return this._isInResult};Ao.prototype.isVisited=function(){return this._isVisited};Ao.prototype.interfaces_=function(){return[]};Ao.prototype.getClass=function(){return Ao};var cy=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var n=arguments[0],r=arguments[1];this._coord=n,this._edges=r,this._label=new mn(0,xt.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var r=n.next();if(r.getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(n){},e.prototype.computeMergedLocation=function(n,r){var s=xt.NONE;if(s=this._label.getLocation(r),!n.isNull(r)){var u=n.getLocation(r);s!==xt.BOUNDARY&&(s=u)}return s},e.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this._label===null?this._label=new mn(n,r):this._label.setLocation(n,r)}else return t.prototype.setLabel.apply(this,arguments)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof mn)for(var s=arguments[0],u=0;u<2;u++){var p=n.computeMergedLocation(s,u),c=n._label.getLocation(u);c===xt.NONE&&n._label.setLocation(u,p)}},e.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},e.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var r=xt.NONE;this._label!==null&&(r=this._label.getLocation(n));var s=null;switch(r){case xt.BOUNDARY:s=xt.INTERIOR;break;case xt.INTERIOR:s=xt.BOUNDARY;break;default:s=xt.BOUNDARY;break}this._label.setLocation(n,s)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ao),ks=function(){this.nodeMap=new ii,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};ks.prototype.find=function(t){return this.nodeMap.get(t)};ks.prototype.addNode=function(){if(arguments[0]instanceof yt){var t=arguments[0],e=this.nodeMap.get(t);return e===null&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}else if(arguments[0]instanceof cy){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return r===null?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}};ks.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};ks.prototype.iterator=function(){return this.nodeMap.values().iterator()};ks.prototype.values=function(){return this.nodeMap.values()};ks.prototype.getBoundaryNodes=function(t){for(var e=new Xt,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===xt.BOUNDARY&&e.add(r)}return e};ks.prototype.add=function(t){var e=t.getCoordinate(),n=this.addNode(e);n.add(t)};ks.prototype.interfaces_=function(){return[]};ks.prototype.getClass=function(){return ks};var yn=function(){},Ld={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};yn.prototype.interfaces_=function(){return[]};yn.prototype.getClass=function(){return yn};yn.isNorthern=function(t){return t===yn.NE||t===yn.NW};yn.isOpposite=function(t,e){if(t===e)return!1;var n=(t-e+4)%4;return n===2};yn.commonHalfPlane=function(t,e){if(t===e)return t;var n=(t-e+4)%4;if(n===2)return-1;var r=te?t:e;return r===0&&s===3?3:r};yn.isInHalfPlane=function(t,e){return e===yn.SE?t===yn.SE||t===yn.SW:t===e||t===e+1};yn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new Fn("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?yn.NE:yn.SE:e>=0?yn.NW:yn.SW}else if(arguments[0]instanceof yt&&arguments[1]instanceof yt){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new Fn("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?yn.NE:yn.SE:r.y>=n.y?yn.NW:yn.SW}};Ld.NE.get=function(){return 0};Ld.NW.get=function(){return 1};Ld.SW.get=function(){return 2};Ld.SE.get=function(){return 3};Object.defineProperties(yn,Ld);var oi=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],s=null;this._edge=e,this.init(n,r),this._label=s}else if(arguments.length===4){var u=arguments[0],p=arguments[1],c=arguments[2],b=arguments[3];this._edge=u,this.init(p,c),this._label=b}};oi.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){p.linkDirectedEdgesForMinimalEdgeRings();var c=p.buildMinimalRings(),b=r.findShell(c);b!==null?(r.placePolygonHoles(b,c),e.add(b)):n.addAll(c)}else s.add(p)}return s};lo.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){var n=e.next();if(n.containsPoint(t))return!0}return!1};lo.prototype.buildMaximalEdgeRings=function(t){for(var e=this,n=new Xt,r=t.iterator();r.hasNext();){var s=r.next();if(s.isInResult()&&s.getLabel().isArea()&&s.getEdgeRing()===null){var u=new zN(s,e._geometryFactory);n.add(u),u.setInResult()}}return n};lo.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}};lo.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t};lo.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),s=n.getCoordinateN(0),u=null,p=null,c=e.iterator();c.hasNext();){var b=c.next(),S=b.getLinearRing(),T=S.getEnvelopeInternal();u!==null&&(p=u.getLinearRing().getEnvelopeInternal());var L=!1;T.contains(r)&&ee.isPointInRing(s,S.getCoordinates())&&(L=!0),L&&(u===null||p.contains(T))&&(u=b)}return u};lo.prototype.findShell=function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var s=r.next();s.isHole()||(n=s,e++)}return Ne.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n};lo.prototype.add=function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var e=arguments[0],n=arguments[1];jn.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),s=new Xt,u=this.buildMinimalEdgeRings(r,this._shellList,s);this.sortShellsAndHoles(u,this._shellList,s),this.placeFreeHoles(this._shellList,s)}};lo.prototype.interfaces_=function(){return[]};lo.prototype.getClass=function(){return lo};var fp=function(){};fp.prototype.getBounds=function(){};fp.prototype.interfaces_=function(){return[]};fp.prototype.getClass=function(){return fp};var os=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};os.prototype.getItem=function(){return this._item};os.prototype.getBounds=function(){return this._bounds};os.prototype.interfaces_=function(){return[fp,Ho]};os.prototype.getClass=function(){return os};var Wa=function(){this._size=null,this._items=null,this._size=0,this._items=new Xt,this._items.add(null)};Wa.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t};Wa.prototype.size=function(){return this._size};Wa.prototype.reorder=function(t){for(var e=this,n=null,r=this._items.get(t);t*2<=this._size&&(n=t*2,n!==e._size&&e._items.get(n+1).compareTo(e._items.get(n))<0&&n++,e._items.get(n).compareTo(r)<0);t=n)e._items.set(t,e._items.get(n));this._items.set(t,r)};Wa.prototype.clear=function(){this._size=0,this._items.clear()};Wa.prototype.isEmpty=function(){return this._size===0};Wa.prototype.add=function(t){var e=this;this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)e._items.set(n,e._items.get(Math.trunc(n/2)));this._items.set(n,t)};Wa.prototype.interfaces_=function(){return[]};Wa.prototype.getClass=function(){return Wa};var Pl=function(){};Pl.prototype.visitItem=function(t){};Pl.prototype.interfaces_=function(){return[]};Pl.prototype.getClass=function(){return Pl};var wc=function(){};wc.prototype.insert=function(t,e){};wc.prototype.remove=function(t,e){};wc.prototype.query=function(){};wc.prototype.interfaces_=function(){return[]};wc.prototype.getClass=function(){return wc};var vr=function(){if(this._childBoundables=new Xt,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var t=arguments[0];this._level=t}},OE={serialVersionUID:{configurable:!0}};vr.prototype.getLevel=function(){return this._level};vr.prototype.size=function(){return this._childBoundables.size()};vr.prototype.getChildBoundables=function(){return this._childBoundables};vr.prototype.addChildBoundable=function(t){Ne.isTrue(this._bounds===null),this._childBoundables.add(t)};vr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};vr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};vr.prototype.interfaces_=function(){return[fp,Ho]};vr.prototype.getClass=function(){return vr};OE.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(vr,OE);var ss=function(){};ss.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}};ss.min=function(t){return ss.sort(t),t.get(0)};ss.sort=function(t,e){var n=t.toArray();e?gu.sort(n,e):gu.sort(n);for(var r=t.iterator(),s=0,u=n.length;sar.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new Fn("neither boundable is composite")};ar.prototype.isLeaves=function(){return!(ar.isComposite(this._boundable1)||ar.isComposite(this._boundable2))};ar.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0};ar.prototype.expand=function(t,e,n,r){for(var s=this,u=t.getChildBoundables(),p=u.iterator();p.hasNext();){var c=p.next(),b=new ar(c,e,s._itemDistance);b.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},hy={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Vr.prototype.getNodeCapacity=function(){return this._nodeCapacity};Vr.prototype.lastNode=function(t){return t.get(t.size()-1)};Vr.prototype.size=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var e=arguments[0],n=0,r=e.getChildBoundables().iterator();r.hasNext();){var s=r.next();s instanceof vr?n+=t.size(s):s instanceof os&&(n+=1)}return n}};Vr.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var s=r.next();s instanceof os&&s.getItem()===e&&(n=s)}return n!==null?(t.getChildBoundables().remove(n),!0):!1};Vr.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new Xt:e}else if(arguments.length===1){for(var n=arguments[0],r=new Xt,s=n.getChildBoundables().iterator();s.hasNext();){var u=s.next();if(u instanceof vr){var p=t.itemsTree(u);p!==null&&r.add(p)}else u instanceof os?r.add(u.getItem()):Ne.shouldNeverReachHere()}return r.size()<=0?null:r}};Vr.prototype.insert=function(t,e){Ne.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new os(t,e))};Vr.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var e=arguments[0],n=new Xt;return this.boundablesAtLevel(e,this._root,n),n}else if(arguments.length===3){var r=arguments[0],s=arguments[1],u=arguments[2];if(Ne.isTrue(r>-2),s.getLevel()===r)return u.add(s),null;for(var p=s.getChildBoundables().iterator();p.hasNext();){var c=p.next();c instanceof vr?t.boundablesAtLevel(r,c,u):(Ne.isTrue(c instanceof os),r===-1&&u.add(c))}return null}};Vr.prototype.query=function(){var t=this;if(arguments.length===1){var e=arguments[0];this.build();var n=new Xt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,n),n}else if(arguments.length===2){var r=arguments[0],s=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,s)}else if(arguments.length===3){if(Ie(arguments[2],Pl)&&arguments[0]instanceof Object&&arguments[1]instanceof vr)for(var u=arguments[0],p=arguments[1],c=arguments[2],b=p.getChildBoundables(),S=0;Sn&&(n=u)}}return n+1}};Vr.prototype.createParentBoundables=function(t,e){var n=this;Ne.isTrue(!t.isEmpty());var r=new Xt;r.add(this.createNode(e));var s=new Xt(t);ss.sort(s,this.getComparator());for(var u=s.iterator();u.hasNext();){var p=u.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(e)),n.lastNode(r).addChildBoundable(p)}return r};Vr.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};Vr.prototype.interfaces_=function(){return[Ho]};Vr.prototype.getClass=function(){return Vr};Vr.compareDoubles=function(t,e){return t>e?1:t0);for(var p=new Xt,c=0;c0;){var R=B.poll(),W=R.getDistance();if(W>=L)break;R.isLeaves()?(L=W,M=R):R.expandToQueue(B,L)}return[M.getBoundable(0).getItem(),M.getBoundable(1).getItem()]}}else if(arguments.length===3){var et=arguments[0],st=arguments[1],ut=arguments[2],gt=new os(et,st),St=new ar(this.getRoot(),gt,ut);return this.nearestNeighbour(St)[0]}},e.prototype.interfaces_=function(){return[wc,Ho]},e.prototype.getClass=function(){return e},e.centreX=function(r){return e.avg(r.getMinX(),r.getMaxX())},e.avg=function(r,s){return(r+s)/2},e.centreY=function(r){return e.avg(r.getMinY(),r.getMaxY())},n.STRtreeNode.get=function(){return dw},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[ip]},compare:function(r,s){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(s.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[ip]},compare:function(r,s){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(s.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(r,s){return r.intersects(s)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,n),e}(Vr),dw=function(t){function e(){var n=arguments[0];t.call(this,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var n=null,r=this.getChildBoundables().iterator();r.hasNext();){var s=r.next();n===null?n=new de(s.getBounds()):n.expandToInclude(s.getBounds())}return n},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(vr),Bi=function(){};Bi.prototype.interfaces_=function(){return[]};Bi.prototype.getClass=function(){return Bi};Bi.relativeSign=function(t,e){return te?1:0};Bi.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=Bi.relativeSign(e.x,n.x),s=Bi.relativeSign(e.y,n.y);switch(t){case 0:return Bi.compareValue(r,s);case 1:return Bi.compareValue(s,r);case 2:return Bi.compareValue(s,-r);case 3:return Bi.compareValue(-r,s);case 4:return Bi.compareValue(-r,-s);case 5:return Bi.compareValue(-s,-r);case 6:return Bi.compareValue(-s,r);case 7:return Bi.compareValue(r,-s)}return Ne.shouldNeverReachHere("invalid octant value"),0};Bi.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var Ml=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._segString=t,this.coord=new yt(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};Ml.prototype.getCoordinate=function(){return this.coord};Ml.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)};Ml.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:Bi.compare(this._segmentOctant,this.coord,e.coord)};Ml.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t};Ml.prototype.isInterior=function(){return this._isInterior};Ml.prototype.interfaces_=function(){return[jo]};Ml.prototype.getClass=function(){return Ml};var Ii=function(){this._nodeMap=new ii,this._edge=null;var t=arguments[0];this._edge=t};Ii.prototype.getSplitCoordinates=function(){var t=this,e=new Cd;this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var s=n.next();t.addEdgeCoordinates(r,s,e),r=s}return e.toCoordinateArray()};Ii.prototype.addCollapsedNodes=function(){var t=this,e=new Xt;this.findCollapsesFromInsertedNodes(e),this.findCollapsesFromExistingVertices(e);for(var n=e.iterator();n.hasNext();){var r=n.next().intValue();t.add(t._edge.getCoordinate(r),r)}};Ii.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};Ii.prototype.findCollapsesFromExistingVertices=function(t){for(var e=this,n=0;n=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}else if(arguments[0]instanceof yt&&arguments[1]instanceof yt){var s=arguments[0],u=arguments[1],p=u.x-s.x,c=u.y-s.y;if(p===0&&c===0)throw new Fn("Cannot compute the octant for two identical points "+s);return Sc.octant(p,c)}};var pa=function(){};pa.prototype.getCoordinates=function(){};pa.prototype.size=function(){};pa.prototype.getCoordinate=function(t){};pa.prototype.isClosed=function(){};pa.prototype.setData=function(t){};pa.prototype.getData=function(){};pa.prototype.interfaces_=function(){return[]};pa.prototype.getClass=function(){return pa};var fd=function(){};fd.prototype.addIntersection=function(t,e){};fd.prototype.interfaces_=function(){return[pa]};fd.prototype.getClass=function(){return fd};var or=function(){this._nodeList=new Ii(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};or.prototype.getCoordinates=function(){return this._pts};or.prototype.size=function(){return this._pts.length};or.prototype.getCoordinate=function(t){return this._pts[t]};or.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};or.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))};or.prototype.setData=function(t){this._data=t};or.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Sc.octant(t,e)};or.prototype.getData=function(){return this._data};or.prototype.addIntersection=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var n=arguments[0],r=arguments[1],s=arguments[3],u=new yt(n.getIntersection(s));this.addIntersection(u,r)}};or.prototype.toString=function(){return rs.toLineString(new nr(this._pts))};or.prototype.getNodeList=function(){return this._nodeList};or.prototype.addIntersectionNode=function(t,e){var n=e,r=n+1;if(r=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}else if(arguments[0]instanceof yt){var r=arguments[0];return ee.orientationIndex(this.p0,this.p1,r)}};me.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])};me.prototype.isVertical=function(){return this.p0.x===this.p1.x};me.prototype.equals=function(t){if(!(t instanceof me))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)};me.prototype.intersection=function(t){var e=new Ru;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null};me.prototype.project=function(){if(arguments[0]instanceof yt){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new yt(t);var e=this.projectionFactor(t),n=new yt;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}else if(arguments[0]instanceof me){var r=arguments[0],s=this.projectionFactor(r.p0),u=this.projectionFactor(r.p1);if(s>=1&&u>=1||s<=0&&u<=0)return null;var p=this.project(r.p0);s<0&&(p=this.p0),s>1&&(p=this.p1);var c=this.project(r.p1);return u<0&&(c=this.p0),u>1&&(c=this.p1),new me(p,c)}};me.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};me.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};me.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1};me.prototype.distancePerpendicular=function(t){return ee.distancePointLinePerpendicular(t,this.p0,this.p1)};me.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};me.prototype.midPoint=function(){return me.midPoint(this.p0,this.p1)};me.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=e*e+n*n;if(r<=0)return Pe.NaN;var s=((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r;return s};me.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),r=Pe.MAX_VALUE,s=null,u=this.closestPoint(t.p0);r=u.distance(t.p0),n[0]=u,n[1]=t.p0;var p=this.closestPoint(t.p1);s=p.distance(t.p1),s0&&e<1)return this.project(t);var n=this.p0.distance(t),r=this.p1.distance(t);return n1||Pe.isNaN(e))&&(e=1),e};me.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};me.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};me.prototype.distance=function(){if(arguments[0]instanceof me){var t=arguments[0];return ee.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof yt){var e=arguments[0];return ee.distancePointLine(e,this.p0,this.p1)}};me.prototype.pointAlong=function(t){var e=new yt;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e};me.prototype.hashCode=function(){var t=Pe.doubleToLongBits(this.p0.x);t^=Pe.doubleToLongBits(this.p0.y)*31;var e=Math.trunc(t)^Math.trunc(t>>32),n=Pe.doubleToLongBits(this.p1.x);n^=Pe.doubleToLongBits(this.p1.y)*31;var r=Math.trunc(n)^Math.trunc(n>>32);return e^r};me.prototype.interfaces_=function(){return[jo,Ho]};me.prototype.getClass=function(){return me};me.midPoint=function(t,e){return new yt((t.x+e.x)/2,(t.y+e.y)/2)};FE.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(me,FE);var dd=function(){this.tempEnv1=new de,this.tempEnv2=new de,this._overlapSeg1=new me,this._overlapSeg2=new me};dd.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};dd.prototype.interfaces_=function(){return[]};dd.prototype.getClass=function(){return dd};var uo=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=r};uo.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]};uo.prototype.computeSelect=function(t,e,n,r){var s=this._pts[e],u=this._pts[n];if(r.tempEnv1.init(s,u),n-e===1)return r.select(this,e),null;if(!t.intersects(r.tempEnv1))return null;var p=Math.trunc((e+n)/2);e=t.length-1)return t.length-1;for(var r=yn.quadrant(t[n],t[n+1]),s=e+1;sp.getId()&&(p.computeOverlaps(S,s),r._nOverlaps++),r._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return mw},Object.defineProperties(e,n),e}(md),mw=function(t){function e(){t.call(this),this._si=null;var n=arguments[0];this._si=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],r=arguments[1],s=arguments[2],u=arguments[3],p=n.getContext(),c=s.getContext();this._si.processIntersections(p,r,c,u)}else return t.prototype.overlap.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(dd),ln=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(arguments.length===4){var s=arguments[0],u=arguments[1],p=arguments[2],c=arguments[3];this.setQuadrantSegments(s),this.setEndCapStyle(u),this.setJoinStyle(p),this.setMitreLimit(c)}}},tl={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};ln.prototype.getEndCapStyle=function(){return this._endCapStyle};ln.prototype.isSingleSided=function(){return this._isSingleSided};ln.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=ln.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=ln.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==ln.JOIN_ROUND&&(this._quadrantSegments=ln.DEFAULT_QUADRANT_SEGMENTS)};ln.prototype.getJoinStyle=function(){return this._joinStyle};ln.prototype.setJoinStyle=function(t){this._joinStyle=t};ln.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t};ln.prototype.getSimplifyFactor=function(){return this._simplifyFactor};ln.prototype.getQuadrantSegments=function(){return this._quadrantSegments};ln.prototype.setEndCapStyle=function(t){this._endCapStyle=t};ln.prototype.getMitreLimit=function(){return this._mitreLimit};ln.prototype.setMitreLimit=function(t){this._mitreLimit=t};ln.prototype.setSingleSided=function(t){this._isSingleSided=t};ln.prototype.interfaces_=function(){return[]};ln.prototype.getClass=function(){return ln};ln.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)};tl.CAP_ROUND.get=function(){return 1};tl.CAP_FLAT.get=function(){return 2};tl.CAP_SQUARE.get=function(){return 3};tl.JOIN_ROUND.get=function(){return 1};tl.JOIN_MITRE.get=function(){return 2};tl.JOIN_BEVEL.get=function(){return 3};tl.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};tl.DEFAULT_MITRE_LIMIT.get=function(){return 5};tl.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(ln,tl);var Xn=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ee.COUNTERCLOCKWISE,this._inputLine=t||null},Ad={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Xn.prototype.isDeletable=function(t,e,n,r){var s=this._inputLine[t],u=this._inputLine[e],p=this._inputLine[n];return!this.isConcave(s,u,p)||!this.isShallow(s,u,p,r)?!1:this.isShallowSampled(s,u,t,n,r)};Xn.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),r=this.findNextNonDeletedIndex(n),s=!1;r=0;s--)n.addPt(t[s])};Po.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1),n=t.distance(e);return nMath.PI;)t-=Ye.PI_TIMES_2;for(;t<=-Math.PI;)t+=Ye.PI_TIMES_2;return t};Ye.angle=function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=n.x-e.x,s=n.y-e.y;return Math.atan2(s,r)}};Ye.isAcute=function(t,e,n){var r=t.x-e.x,s=t.y-e.y,u=n.x-e.x,p=n.y-e.y,c=r*u+s*p;return c>0};Ye.isObtuse=function(t,e,n){var r=t.x-e.x,s=t.y-e.y,u=n.x-e.x,p=n.y-e.y,c=r*u+s*p;return c<0};Ye.interiorAngle=function(t,e,n){var r=Ye.angle(e,t),s=Ye.angle(e,n);return Math.abs(s-r)};Ye.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Ye.PI_TIMES_2;t>=Ye.PI_TIMES_2&&(t=0)}else{for(;t>=Ye.PI_TIMES_2;)t-=Ye.PI_TIMES_2;t<0&&(t=0)}return t};Ye.angleBetween=function(t,e,n){var r=Ye.angle(e,t),s=Ye.angle(e,n);return Ye.diff(r,s)};Ye.diff=function(t,e){var n=null;return tMath.PI&&(n=2*Math.PI-n),n};Ye.toRadians=function(t){return t*Math.PI/180};Ye.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?Ye.COUNTERCLOCKWISE:n<0?Ye.CLOCKWISE:Ye.NONE};Ye.angleBetweenOriented=function(t,e,n){var r=Ye.angle(e,t),s=Ye.angle(e,n),u=s-r;return u<=-Math.PI?u+Ye.PI_TIMES_2:u>Math.PI?u-Ye.PI_TIMES_2:u};Uc.PI_TIMES_2.get=function(){return 2*Math.PI};Uc.PI_OVER_2.get=function(){return Math.PI/2};Uc.PI_OVER_4.get=function(){return Math.PI/4};Uc.COUNTERCLOCKWISE.get=function(){return ee.COUNTERCLOCKWISE};Uc.CLOCKWISE.get=function(){return ee.CLOCKWISE};Uc.NONE.get=function(){return ee.COLLINEAR};Object.defineProperties(Ye,Uc);var Pn=function t(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new me,this._seg1=new me,this._offset0=new me,this._offset1=new me,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new Ru,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===ln.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},Pd={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};Pn.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=ee.computeOrientation(this._s0,this._s1,this._s2),r=n===ee.CLOCKWISE&&this._side===jt.LEFT||n===ee.COUNTERCLOCKWISE&&this._side===jt.RIGHT;n===0?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)};Pn.prototype.addLineEndCap=function(t,e){var n=new me(t,e),r=new me;this.computeOffsetSegment(n,jt.LEFT,this._distance,r);var s=new me;this.computeOffsetSegment(n,jt.RIGHT,this._distance,s);var u=e.x-t.x,p=e.y-t.y,c=Math.atan2(p,u);switch(this._bufParams.getEndCapStyle()){case ln.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,c+Math.PI/2,c-Math.PI/2,ee.CLOCKWISE,this._distance),this._segList.addPt(s.p1);break;case ln.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(s.p1);break;case ln.CAP_SQUARE:var b=new yt;b.x=Math.abs(this._distance)*Math.cos(c),b.y=Math.abs(this._distance)*Math.sin(c);var S=new yt(r.p1.x+b.x,r.p1.y+b.y),T=new yt(s.p1.x+b.x,s.p1.y+b.y);this._segList.addPt(S),this._segList.addPt(T);break}};Pn.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t};Pn.prototype.addMitreJoin=function(t,e,n,r){var s=!0,u=null;try{u=es.intersection(e.p0,e.p1,n.p0,n.p1);var p=r<=0?1:u.distance(t)/Math.abs(r);p>this._bufParams.getMitreLimit()&&(s=!1)}catch(c){if(c instanceof Pp)u=new yt(0,0),s=!1;else throw c}finally{}s?this._segList.addPt(u):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())};Pn.prototype.addFilletCorner=function(t,e,n,r,s){var u=e.x-t.x,p=e.y-t.y,c=Math.atan2(p,u),b=n.x-t.x,S=n.y-t.y,T=Math.atan2(S,b);r===ee.CLOCKWISE?c<=T&&(c+=2*Math.PI):c>=T&&(c-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,c,T,r,s),this._segList.addPt(n)};Pn.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new yt((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var r=new yt((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};Pn.prototype.createCircle=function(t){var e=new yt(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};Pn.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)};Pn.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Po,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*Pn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};Pn.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var e=this._li.getIntersectionNum();e>=2&&(this._bufParams.getJoinStyle()===ln.JOIN_BEVEL||this._bufParams.getJoinStyle()===ln.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,ee.CLOCKWISE,this._distance))};Pn.prototype.closeRing=function(){this._segList.closeRing()};Pn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};Pn.prototype.interfaces_=function(){return[]};Pn.prototype.getClass=function(){return Pn};Pd.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};Pd.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};Pd.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};Pd.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(Pn,Pd);var Gi=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};Gi.prototype.getOffsetCurve=function(t,e){if(this._distance=e,e===0)return null;var n=e<0,r=Math.abs(e),s=this.getSegGen(r);t.length<=1?this.computePointCurve(t[0],s):this.computeOffsetCurve(t,n,s);var u=s.getCoordinates();return n&&Ge.reverse(u),u};Gi.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var s=Xn.simplify(t,-r),u=s.length-1;n.initSideSegments(s[u],s[u-1],jt.LEFT),n.addFirstSegment();for(var p=u-2;p>=0;p--)n.addNextSegment(s[p],!0)}else{n.addSegments(t,!1);var c=Xn.simplify(t,r),b=c.length-1;n.initSideSegments(c[0],c[1],jt.LEFT),n.addFirstSegment();for(var S=2;S<=b;S++)n.addNextSegment(c[S],!0)}n.addLastSegment(),n.closeRing()};Gi.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===jt.RIGHT&&(r=-r);var s=Xn.simplify(t,r),u=s.length-1;n.initSideSegments(s[u-1],s[0],e);for(var p=1;p<=u;p++){var c=p!==1;n.addNextSegment(s[p],c)}n.closeRing()};Gi.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=Xn.simplify(t,n),s=r.length-1;e.initSideSegments(r[0],r[1],jt.LEFT);for(var u=2;u<=s;u++)e.addNextSegment(r[u],!0);e.addLastSegment(),e.addLineEndCap(r[s-1],r[s]);var p=Xn.simplify(t,-n),c=p.length-1;e.initSideSegments(p[c],p[c-1],jt.LEFT);for(var b=c-2;b>=0;b--)e.addNextSegment(p[b],!0);e.addLastSegment(),e.addLineEndCap(p[1],p[0]),e.closeRing()};Gi.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case ln.CAP_ROUND:e.createCircle(t);break;case ln.CAP_SQUARE:e.createSquare(t);break}};Gi.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided()||e===0)return null;var n=Math.abs(e),r=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],r);else if(this._bufParams.isSingleSided()){var s=e<0;this.computeSingleSidedBufferCurve(t,s,r)}else this.computeLineBufferCurve(t,r);var u=r.getCoordinates();return u};Gi.prototype.getBufferParameters=function(){return this._bufParams};Gi.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()};Gi.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return Gi.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()};Gi.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var s=Xn.simplify(t,-r),u=s.length-1;n.initSideSegments(s[u],s[u-1],jt.LEFT),n.addFirstSegment();for(var p=u-2;p>=0;p--)n.addNextSegment(s[p],!0)}else{var c=Xn.simplify(t,r),b=c.length-1;n.initSideSegments(c[0],c[1],jt.LEFT),n.addFirstSegment();for(var S=2;S<=b;S++)n.addNextSegment(c[S],!0)}n.addLastSegment()};Gi.prototype.getSegGen=function(t){return new Pn(this._precisionModel,this._bufParams,t)};Gi.prototype.interfaces_=function(){return[]};Gi.prototype.getClass=function(){return Gi};Gi.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;nu.getMaxY()||t.findStabbedSegments(e,s.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(Ie(arguments[2],ns)&&arguments[0]instanceof yt&&arguments[1]instanceof Dv)for(var p=arguments[0],c=arguments[1],b=arguments[2],S=c.getEdge().getCoordinates(),T=0;Tt._seg.p1.y&&t._seg.reverse();var L=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(Lt._seg.p1.y)&&ee.computeOrientation(t._seg.p0,t._seg.p1,p)!==ee.RIGHT){var M=c.getDepth(jt.LEFT);t._seg.p0.equals(S[T])||(M=c.getDepth(jt.RIGHT));var B=new bu(t._seg,M);b.add(B)}}else if(Ie(arguments[2],ns)&&arguments[0]instanceof yt&&Ie(arguments[1],ns))for(var R=arguments[0],W=arguments[1],et=arguments[2],st=W.iterator();st.hasNext();){var ut=st.next();ut.isForward()&&t.findStabbedSegments(R,ut,et)}}};Ec.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(e.size()===0)return 0;var n=ss.min(e);return n._leftDepth};Ec.prototype.interfaces_=function(){return[]};Ec.prototype.getClass=function(){return Ec};UE.DepthSegment.get=function(){return bu};Object.defineProperties(Ec,UE);var bu=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new me(t),this._leftDepth=e};bu.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return n!==0||(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(e._upwardSeg)};bu.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return n!==0?n:t.p1.compareTo(e.p1)};bu.prototype.toString=function(){return this._upwardSeg.toString()};bu.prototype.interfaces_=function(){return[jo]};bu.prototype.getClass=function(){return bu};var cn=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};cn.prototype.area=function(){return cn.area(this.p0,this.p1,this.p2)};cn.prototype.signedArea=function(){return cn.signedArea(this.p0,this.p1,this.p2)};cn.prototype.interpolateZ=function(t){if(t===null)throw new Fn("Supplied point is null.");return cn.interpolateZ(t,this.p0,this.p1,this.p2)};cn.prototype.longestSideLength=function(){return cn.longestSideLength(this.p0,this.p1,this.p2)};cn.prototype.isAcute=function(){return cn.isAcute(this.p0,this.p1,this.p2)};cn.prototype.circumcentre=function(){return cn.circumcentre(this.p0,this.p1,this.p2)};cn.prototype.area3D=function(){return cn.area3D(this.p0,this.p1,this.p2)};cn.prototype.centroid=function(){return cn.centroid(this.p0,this.p1,this.p2)};cn.prototype.inCentre=function(){return cn.inCentre(this.p0,this.p1,this.p2)};cn.prototype.interfaces_=function(){return[]};cn.prototype.getClass=function(){return cn};cn.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)};cn.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2};cn.det=function(t,e,n,r){return t*r-e*n};cn.interpolateZ=function(t,e,n,r){var s=e.x,u=e.y,p=n.x-s,c=r.x-s,b=n.y-u,S=r.y-u,T=p*S-c*b,L=t.x-s,M=t.y-u,B=(S*L-c*M)/T,R=(-b*L+p*M)/T,W=e.z+B*(n.z-e.z)+R*(r.z-e.z);return W};cn.longestSideLength=function(t,e,n){var r=t.distance(e),s=e.distance(n),u=n.distance(t),p=r;return s>p&&(p=s),u>p&&(p=u),p};cn.isAcute=function(t,e,n){return!(!Ye.isAcute(t,e,n)||!Ye.isAcute(e,n,t)||!Ye.isAcute(n,t,e))};cn.circumcentre=function(t,e,n){var r=n.x,s=n.y,u=t.x-r,p=t.y-s,c=e.x-r,b=e.y-s,S=2*cn.det(u,p,c,b),T=cn.det(p,u*u+p*p,b,c*c+b*b),L=cn.det(u,u*u+p*p,c,c*c+b*b),M=r-T/S,B=s+L/S;return new yt(M,B)};cn.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,s=new es(t.x+n/2,t.y+r/2,1),u=new es(t.x-r+n/2,t.y+n+r/2,1);return new es(s,u)};cn.angleBisector=function(t,e,n){var r=e.distance(t),s=e.distance(n),u=r/(r+s),p=n.x-t.x,c=n.y-t.y,b=new yt(t.x+u*p,t.y+u*c);return b};cn.area3D=function(t,e,n){var r=e.x-t.x,s=e.y-t.y,u=e.z-t.z,p=n.x-t.x,c=n.y-t.y,b=n.z-t.z,S=s*b-u*c,T=u*p-r*b,L=r*c-s*p,M=S*S+T*T+L*L,B=Math.sqrt(M)/2;return B};cn.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,s=(t.y+e.y+n.y)/3;return new yt(r,s)};cn.inCentre=function(t,e,n){var r=e.distance(n),s=t.distance(n),u=t.distance(e),p=r+s+u,c=(r*t.x+s*e.x+u*n.x)/p,b=(r*t.y+s*e.y+u*n.y)/p;return new yt(c,b)};var qo=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new Xt;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};qo.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,xt.EXTERIOR,xt.INTERIOR)};qo.prototype.addPolygon=function(t){var e=this,n=this._distance,r=jt.LEFT;this._distance<0&&(n=-this._distance,r=jt.RIGHT);var s=t.getExteriorRing(),u=Ge.removeRepeatedPoints(s.getCoordinates());if(this._distance<0&&this.isErodedCompletely(s,this._distance)||this._distance<=0&&u.length<3)return null;this.addPolygonRing(u,n,r,xt.EXTERIOR,xt.INTERIOR);for(var p=0;p0&&e.isErodedCompletely(c,-e._distance)||e.addPolygonRing(b,n,jt.opposite(r),xt.INTERIOR,xt.EXTERIOR)}};qo.prototype.isTriangleErodedCompletely=function(t,e){var n=new cn(t[0],t[1],t[2]),r=n.inCentre(),s=ee.distancePointLine(r,n.p0,n.p1);return s=ca.MINIMUM_VALID_SIZE&&ee.isCCW(t)&&(u=s,p=r,n=jt.opposite(n));var c=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(c,u,p)};qo.prototype.add=function(t){if(t.isEmpty())return null;t instanceof xr?this.addPolygon(t):t instanceof Zn?this.addLineString(t):t instanceof ao?this.addPoint(t):t instanceof hp?this.addCollection(t):t instanceof vu?this.addCollection(t):t instanceof aa?this.addCollection(t):t instanceof Si&&this.addCollection(t)};qo.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(n.length===4)return this.isTriangleErodedCompletely(n,e);var r=t.getEnvelopeInternal(),s=Math.min(r.getHeight(),r.getWidth());return e<0&&2*Math.abs(e)>s};qo.prototype.addCollection=function(t){for(var e=this,n=0;n=this._max)throw new kp;var t=this._parent.getGeometryN(this._index++);return t instanceof Si?(this._subcollectionIterator=new la(t),this._subcollectionIterator.next()):t};la.prototype.remove=function(){throw new Error(this.getClass().getName())};la.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)};la.prototype.interfaces_=function(){return[Mp]};la.prototype.getClass=function(){return la};la.isAtomic=function(t){return!(t instanceof Si)};var Co=function(){this._geom=null;var t=arguments[0];this._geom=t};Co.prototype.locate=function(t){return Co.locate(t,this._geom)};Co.prototype.interfaces_=function(){return[mp]};Co.prototype.getClass=function(){return Co};Co.isPointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?ee.isPointInRing(t,e.getCoordinates()):!1};Co.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!Co.isPointInRing(t,n))return!1;for(var r=0;r=0;u--){var p=n._edgeList.get(u),c=p.getSym();s===null&&(s=c),r!==null&&c.setNext(r),r=p}s.setNext(r)},e.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var r=arguments[0],s=this.findIndex(r),u=r.getDepth(jt.LEFT),p=r.getDepth(jt.RIGHT),c=this.computeDepths(s+1,this._edgeList.size(),u),b=this.computeDepths(0,s,c);if(b!==p)throw new Ha("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var S=arguments[0],T=arguments[1],L=arguments[2],M=L,B=S;B=0;c--){var b=r._resultAreaEdgeList.get(c),S=b.getSym();switch(s===null&&b.getEdgeRing()===n&&(s=b),p){case r._SCANNING_FOR_INCOMING:if(S.getEdgeRing()!==n)continue;u=S,p=r._LINKING_TO_OUTGOING;break;case r._LINKING_TO_OUTGOING:if(b.getEdgeRing()!==n)continue;u.setNextMin(b),p=r._SCANNING_FOR_INCOMING;break}}p===this._LINKING_TO_OUTGOING&&(Ne.isTrue(s!==null,"found null for first outgoing dirEdge"),Ne.isTrue(s.getEdgeRing()===n,"unable to link last incoming dirEdge"),u.setNextMin(s))},e.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,r=this.iterator();r.hasNext();){var s=r.next();s.isInResult()&&n++}return n}else if(arguments.length===1){for(var u=arguments[0],p=0,c=this.iterator();c.hasNext();){var b=c.next();b.getEdgeRing()===u&&p++}return p}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var n=xt.NONE,r=this.iterator();r.hasNext();){var s=r.next(),u=s.getSym();if(!s.isLineEdge()){if(s.isInResult()){n=xt.INTERIOR;break}if(u.isInResult()){n=xt.EXTERIOR;break}}}if(n===xt.NONE)return null;for(var p=n,c=this.iterator();c.hasNext();){var b=c.next(),S=b.getSym();b.isLineEdge()?b.getEdge().setCovered(p===xt.INTERIOR):(b.isInResult()&&(p=xt.EXTERIOR),S.isInResult()&&(p=xt.INTERIOR))}},e.prototype.computeLabelling=function(n){var r=this;t.prototype.computeLabelling.call(this,n),this._label=new mn(xt.NONE);for(var s=this.iterator();s.hasNext();)for(var u=s.next(),p=u.getEdge(),c=p.getLabel(),b=0;b<2;b++){var S=c.getLocation(b);(S===xt.INTERIOR||S===xt.BOUNDARY)&&r._label.setLocation(b,xt.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(si),VE=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(n){return new cy(n,new BN)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(pp),kl=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};kl.prototype.compareTo=function(t){var e=t,n=kl.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return n};kl.prototype.interfaces_=function(){return[jo]};kl.prototype.getClass=function(){return kl};kl.orientation=function(t){return Ge.increasingDirection(t)===1};kl.compareOriented=function(t,e,n,r){for(var s=e?1:-1,u=r?1:-1,p=e?t.length:-1,c=r?n.length:-1,b=e?0:t.length-1,S=r?0:n.length-1;;){var T=t[b].compareTo(n[S]);if(T!==0)return T;b+=s,S+=u;var L=b===p,M=S===c;if(L&&!M)return-1;if(!L&&M)return 1;if(L&&M)return 0}};var as=function(){this._edges=new Xt,this._ocaMap=new ii};as.prototype.print=function(t){var e=this;t.print("MULTILINESTRING ( ");for(var n=0;n0&&t.print(","),t.print("(");for(var s=r.getCoordinates(),u=0;u0&&t.print(","),t.print(s[u].x+" "+s[u].y);t.println(")")}t.print(") ")};as.prototype.addAll=function(t){for(var e=this,n=t.iterator();n.hasNext();)e.add(n.next())};as.prototype.findEdgeIndex=function(t){for(var e=this,n=0;n0||!e.coord.equals2D(s);u||r--;var p=new Array(r).fill(null),c=0;p[c++]=new yt(t.coord);for(var b=t.segmentIndex+1;b<=e.segmentIndex;b++)p[c++]=n.edge.pts[b];return u&&(p[c]=e.coord),new Rg(p,new mn(this.edge._label))};fa.prototype.add=function(t,e,n){var r=new Ds(t,e,n),s=this._nodeMap.get(r);return s!==null?s:(this._nodeMap.put(r,r),r)};fa.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();if(n.coord.equals(t))return!0}return!1};fa.prototype.interfaces_=function(){return[]};fa.prototype.getClass=function(){return fa};var Su=function(){};Su.prototype.getChainStartIndices=function(t){var e=this,n=0,r=new Xt;r.add(new Ts(n));do{var s=e.findChainEnd(t,n);r.add(new Ts(s)),n=s}while(nn?e:n};Za.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return en&&(s=1),t._depth[e][r]=s}}};Kr.prototype.getDelta=function(t){return this._depth[t][jt.RIGHT]-this._depth[t][jt.LEFT]};Kr.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?xt.EXTERIOR:xt.INTERIOR};Kr.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Kr.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var s=e.getLocation(n,r);(s===xt.EXTERIOR||s===xt.INTERIOR)&&(t.isNull(n,r)?t._depth[n][r]=Kr.depthAtLocation(s):t._depth[n][r]+=Kr.depthAtLocation(s))}else if(arguments.length===3){var u=arguments[0],p=arguments[1],c=arguments[2];c===xt.INTERIOR&&this._depth[u][p]++}};Kr.prototype.interfaces_=function(){return[]};Kr.prototype.getClass=function(){return Kr};Kr.depthAtLocation=function(t){return t===xt.EXTERIOR?0:t===xt.INTERIOR?1:Kr.NULL_VALUE};GE.NULL_VALUE.get=function(){return-1};Object.defineProperties(Kr,GE);var Rg=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new fa(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Kr,this._depthDelta=0,arguments.length===1){var n=arguments[0];e.call(this,n,null)}else if(arguments.length===2){var r=arguments[0],s=arguments[1];this.pts=r,this._label=s}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var r=new e(n,mn.toLineLabel(this._label));return r},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(n){this._isIsolated=n},e.prototype.setName=function(n){this._name=n},e.prototype.equals=function(n){var r=this;if(!(n instanceof e))return!1;var s=n;if(this.pts.length!==s.pts.length)return!1;for(var u=!0,p=!0,c=this.pts.length,b=0;b0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},e.prototype.print=function(n){var r=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var s=0;s0&&n.print(","),n.print(r.pts[s].x+" "+r.pts[s].y);n.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(n){e.updateIM(this._label,n)},e.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(n){var r=this;n.print("edge "+this._name+": ");for(var s=this.pts.length-1;s>=0;s--)n.print(r.pts[s]+" ");n.println("")},e.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new Za(this)),this._mce},e.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new de;for(var r=0;r0&&r.append(","),r.append(n.pts[s].x+" "+n.pts[s].y);return r.append(") "+this._label+" "+this._depthDelta),r.toString()},e.prototype.isPointwiseEqual=function(n){var r=this;if(this.pts.length!==n.pts.length)return!1;for(var s=0;sr||this._maxyu;if(p)return!1;var c=this.intersectsToleranceSquare(t,e);return Ne.isTrue(!(p&&c),"Found bad envelope test"),c};qi.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new yt(this._maxx,this._maxy),this._corner[1]=new yt(this._minx,this._maxy),this._corner[2]=new yt(this._minx,this._miny),this._corner[3]=new yt(this._maxx,this._miny)};qi.prototype.intersects=function(t,e){return this._scaleFactor===1?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};qi.prototype.scale=function(t){return Math.round(t*this._scaleFactor)};qi.prototype.getCoordinate=function(){return this._originalPt};qi.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)};qi.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=qi.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new de(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv};qi.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))};qi.prototype.intersectsToleranceSquare=function(t,e){var n=!1,r=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper())||n&&r||t.equals(this._pt)||e.equals(this._pt))};qi.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),r=t.getCoordinate(e+1);return this.intersects(n,r)?(t.addIntersection(this.getCoordinate(),e),!0):!1};qi.prototype.interfaces_=function(){return[]};qi.prototype.getClass=function(){return qi};jE.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(qi,jE);var gd=function(){this.tempEnv1=new de,this.selectedSegment=new me};gd.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}};gd.prototype.interfaces_=function(){return[]};gd.prototype.getClass=function(){return gd};var gp=function(){this._index=null;var t=arguments[0];this._index=t},HE={HotPixelSnapAction:{configurable:!0}};gp.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}else if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],s=e.getSafeEnvelope(),u=new WE(e,n,r);return this._index.query(s,{interfaces_:function(){return[Pl]},visitItem:function(p){var c=p;c.select(s,u)}}),u.isNodeAdded()}};gp.prototype.interfaces_=function(){return[]};gp.prototype.getClass=function(){return gp};HE.HotPixelSnapAction.get=function(){return WE};Object.defineProperties(gp,HE);var WE=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],r=arguments[1],s=arguments[2];this._hotPixel=n,this._parentEdge=r,this._hotPixelVertexIndex=s}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1],s=n.getContext();if(this._parentEdge!==null&&s===this._parentEdge&&r===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(s,r)}else return t.prototype.select.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(gd),Ic=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new Xt};Ic.prototype.processIntersections=function(t,e,n,r){var s=this;if(t===n&&e===r)return null;var u=t.getCoordinates()[e],p=t.getCoordinates()[e+1],c=n.getCoordinates()[r],b=n.getCoordinates()[r+1];if(this._li.computeIntersection(u,p,c,b),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var S=0;S=0;e--){try{t.bufferReducedPrecision(e)}catch(u){if(u instanceof Ha)t._saveException=u;else throw u}finally{}if(t._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],r=Yr.precisionScaleFactor(this._argGeom,this._distance,n),s=new un(r);this.bufferFixedPrecision(s)}};Yr.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===un.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()};Yr.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)};Yr.prototype.bufferOriginalPrecision=function(){try{var t=new wi(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof qa)this._saveException=e;else throw e}finally{}};Yr.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry};Yr.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)};Yr.prototype.interfaces_=function(){return[]};Yr.prototype.getClass=function(){return Yr};Yr.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new Yr(t),r=n.getResultGeometry(e);return r}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Ee&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1],p=arguments[2],c=new Yr(s);c.setQuadrantSegments(p);var b=c.getResultGeometry(u);return b}else if(arguments[2]instanceof ln&&arguments[0]instanceof Ee&&typeof arguments[1]=="number"){var S=arguments[0],T=arguments[1],L=arguments[2],M=new Yr(S,L),B=M.getResultGeometry(T);return B}}else if(arguments.length===4){var R=arguments[0],W=arguments[1],et=arguments[2],st=arguments[3],ut=new Yr(R);ut.setQuadrantSegments(et),ut.setEndCapStyle(st);var gt=ut.getResultGeometry(W);return gt}};Yr.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),s=Lo.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY())),u=e>0?e:0,p=s+2*u,c=Math.trunc(Math.log(p)/Math.log(10)+1),b=n-c,S=Math.pow(10,b);return S};Dp.CAP_ROUND.get=function(){return ln.CAP_ROUND};Dp.CAP_BUTT.get=function(){return ln.CAP_FLAT};Dp.CAP_FLAT.get=function(){return ln.CAP_FLAT};Dp.CAP_SQUARE.get=function(){return ln.CAP_SQUARE};Dp.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Yr,Dp);var vi=function(){this._pt=[new yt,new yt],this._distance=Pe.NaN,this._isNull=!0};vi.prototype.getCoordinates=function(){return this._pt};vi.prototype.getCoordinate=function(t){return this._pt[t]};vi.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);rthis._distance&&this.initialize(e,n,r)}};vi.prototype.interfaces_=function(){return[]};vi.prototype.getClass=function(){return vi};var ra=function(){};ra.prototype.interfaces_=function(){return[]};ra.prototype.getClass=function(){return ra};ra.computeDistance=function(){if(arguments[2]instanceof vi&&arguments[0]instanceof Zn&&arguments[1]instanceof yt)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getCoordinates(),s=new me,u=0;u0||this._isIn?xt.INTERIOR:xt.EXTERIOR)};ls.prototype.interfaces_=function(){return[]};ls.prototype.getClass=function(){return ls};var xi=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var e=arguments[0],n=arguments[1];t.call(this,e,t.INSIDE_AREA,n)}else if(arguments.length===3){var r=arguments[0],s=arguments[1],u=arguments[2];this._component=r,this._segIndex=s,this._pt=u}},ZE={INSIDE_AREA:{configurable:!0}};xi.prototype.isInsideArea=function(){return this._segIndex===xi.INSIDE_AREA};xi.prototype.getCoordinate=function(){return this._pt};xi.prototype.getGeometryComponent=function(){return this._component};xi.prototype.getSegmentIndex=function(){return this._segIndex};xi.prototype.interfaces_=function(){return[]};xi.prototype.getClass=function(){return xi};ZE.INSIDE_AREA.get=function(){return-1};Object.defineProperties(xi,ZE);var Il=function(t){this._pts=t||null};Il.prototype.filter=function(t){t instanceof ao&&this._pts.add(t)};Il.prototype.interfaces_=function(){return[As]};Il.prototype.getClass=function(){return Il};Il.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof ao?ss.singletonList(t):Il.getPoints(t,new Xt)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof ao?n.add(e):e instanceof Si&&e.apply(new Il(n)),n}};var Tc=function(){this._locations=null;var t=arguments[0];this._locations=t};Tc.prototype.filter=function(t){(t instanceof ao||t instanceof Zn||t instanceof xr)&&this._locations.add(new xi(t,0,t.getCoordinate()))};Tc.prototype.interfaces_=function(){return[As]};Tc.prototype.getClass=function(){return Tc};Tc.getLocations=function(t){var e=new Xt;return t.apply(new Tc(e)),e};var Jr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new ls,this._minDistanceLocation=null,this._minDistance=Pe.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],r=arguments[1],s=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=s}};Jr.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],s=1-n,u=Va.getPolygons(this._geom[n]);if(u.size()>0){var p=Tc.getLocations(this._geom[s]);if(this.computeContainmentDistance(p,u,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[s]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Ie(arguments[0],ns)&&Ie(arguments[1],ns)){for(var c=arguments[0],b=arguments[1],S=arguments[2],T=0;Tthis._minDistance)return null;for(var s=e.getCoordinates(),u=n.getCoordinate(),p=0;pthis._minDistance)return null;for(var B=T.getCoordinates(),R=L.getCoordinates(),W=0;Wthis._distance&&this.initialize(e,n,r)}};ri.prototype.interfaces_=function(){return[]};ri.prototype.getClass=function(){return ri};var Ss=function(){};Ss.prototype.interfaces_=function(){return[]};Ss.prototype.getClass=function(){return Ss};Ss.computeDistance=function(){if(arguments[2]instanceof ri&&arguments[0]instanceof Zn&&arguments[1]instanceof yt)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new me,s=t.getCoordinates(),u=0;u1||t<=0)throw new Fn("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t};Uo.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)};Uo.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};Uo.prototype.computeOrientedDistance=function(t,e,n){var r=new Lc(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var s=new Nl(e,this._densifyFrac);t.apply(s),n.setMaximum(s.getMaxPointDistance())}};Uo.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};Uo.prototype.interfaces_=function(){return[]};Uo.prototype.getClass=function(){return Uo};Uo.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new Uo(t,e);return n.distance()}else if(arguments.length===3){var r=arguments[0],s=arguments[1],u=arguments[2],p=new Uo(r,s);return p.setDensifyFraction(u),p.distance()}};T0.MaxPointDistanceFilter.get=function(){return Lc};T0.MaxDensifiedByFractionDistanceFilter.get=function(){return Nl};Object.defineProperties(Uo,T0);var Lc=function(){this._maxPtDist=new ri,this._minPtDist=new ri,this._euclideanDist=new Ss,this._geom=null;var t=arguments[0];this._geom=t};Lc.prototype.filter=function(t){this._minPtDist.initialize(),Ss.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};Lc.prototype.getMaxPointDistance=function(){return this._maxPtDist};Lc.prototype.interfaces_=function(){return[ua]};Lc.prototype.getClass=function(){return Lc};var Nl=function(){this._maxPtDist=new ri,this._minPtDist=new ri,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};Nl.prototype.filter=function(t,e){var n=this;if(e===0)return null;for(var r=t.getCoordinate(e-1),s=t.getCoordinate(e),u=(s.x-r.x)/this._numSubSegs,p=(s.y-r.y)/this._numSubSegs,c=0;cn){this._isValid=!1;var s=r.getCoordinates();this._errorLocation=s[1],this._errorIndicator=t.getFactory().createLineString(s),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+rs.toLineString(s[0],s[1])+")"}};oo.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=oo.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),oo.VERBOSE&&$r.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};oo.prototype.checkNegativeValid=function(){if(!(this._input instanceof xr||this._input instanceof aa||this._input instanceof Si))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)};oo.prototype.getErrorIndicator=function(){return this._errorIndicator};oo.prototype.checkMinimumDistance=function(t,e,n){var r=new Jr(t,e,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};Qr.prototype.report=function(t){if(!Qr.VERBOSE)return null;$r.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))};Qr.prototype.getErrorMessage=function(){return this._errorMsg};Qr.prototype.interfaces_=function(){return[]};Qr.prototype.getClass=function(){return Qr};Qr.isValidMsg=function(t,e,n){var r=new Qr(t,e,n);return r.isValid()?null:r.getErrorMessage()};Qr.isValid=function(t,e,n){var r=new Qr(t,e,n);return!!r.isValid()};A0.VERBOSE.get=function(){return!1};A0.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Qr,A0);var Ns=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Ns.prototype.getCoordinates=function(){return this._pts};Ns.prototype.size=function(){return this._pts.length};Ns.prototype.getCoordinate=function(t){return this._pts[t]};Ns.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Ns.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Sc.octant(this.getCoordinate(t),this.getCoordinate(t+1))};Ns.prototype.setData=function(t){this._data=t};Ns.prototype.getData=function(){return this._data};Ns.prototype.toString=function(){return rs.toLineString(new nr(this._pts))};Ns.prototype.interfaces_=function(){return[pa]};Ns.prototype.getClass=function(){return Ns};var Gr=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new Xt,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};Gr.prototype.getInteriorIntersection=function(){return this._interiorIntersection};Gr.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t};Gr.prototype.getIntersectionSegments=function(){return this._intSegments};Gr.prototype.count=function(){return this._intersectionCount};Gr.prototype.getIntersections=function(){return this._intersections};Gr.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};Gr.prototype.setKeepIntersections=function(t){this._keepIntersections=t};Gr.prototype.processIntersections=function(t,e,n,r){if(!this._findAllIntersections&&this.hasIntersection()||t===n&&e===r)return null;if(this._isCheckEndSegmentsOnly){var s=this.isEndSegment(t,e)||this.isEndSegment(n,r);if(!s)return null}var u=t.getCoordinates()[e],p=t.getCoordinates()[e+1],c=n.getCoordinates()[r],b=n.getCoordinates()[r+1];this._li.computeIntersection(u,p,c,b),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=u,this._intSegments[1]=p,this._intSegments[2]=c,this._intSegments[3]=b,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};Gr.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2};Gr.prototype.hasIntersection=function(){return this._interiorIntersection!==null};Gr.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};Gr.prototype.interfaces_=function(){return[wu]};Gr.prototype.getClass=function(){return Gr};Gr.createAllIntersectionsFinder=function(t){var e=new Gr(t);return e.setFindAllIntersections(!0),e};Gr.createAnyIntersectionFinder=function(t){return new Gr(t)};Gr.createIntersectionCounter=function(t){var e=new Gr(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var us=function(){this._li=new Ru,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};us.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};us.prototype.getIntersections=function(){return this._segInt.getIntersections()};us.prototype.isValid=function(){return this.execute(),this._isValid};us.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};us.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Gr(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new I0;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};us.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Ha(this.getErrorMessage(),this._segInt.getInteriorIntersection())};us.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+rs.toLineString(t[0],t[1])+" and "+rs.toLineString(t[2],t[3])};us.prototype.interfaces_=function(){return[]};us.prototype.getClass=function(){return us};us.computeIntersections=function(t){var e=new us(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Iu=function t(){this._nv=null;var e=arguments[0];this._nv=new us(t.toSegmentStrings(e))};Iu.prototype.checkValid=function(){this._nv.checkValid()};Iu.prototype.interfaces_=function(){return[]};Iu.prototype.getClass=function(){return Iu};Iu.toSegmentStrings=function(t){for(var e=new Xt,n=t.iterator();n.hasNext();){var r=n.next();e.add(new Ns(r.getCoordinates(),r))}return e};Iu.checkValid=function(t){var e=new Iu(t);e.checkValid()};var Ac=function(t){this._mapOp=t};Ac.prototype.map=function(t){for(var e=this,n=new Xt,r=0;r0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};ji.prototype.interfaces_=function(){return[]};ji.prototype.getClass=function(){return ji};var ma=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new me,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Zn&&typeof arguments[1]=="number"){var e=arguments[0],n=arguments[1];t.call(this,e.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var r=arguments[0],s=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=s}};ma.prototype.snapVertices=function(t,e){for(var n=this,r=this._isClosed?t.size()-1:t.size(),s=0;s=0&&t.add(p+1,new yt(u),!1)}};ma.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,r=Pe.MAX_VALUE,s=-1,u=0;ue&&(e=r)}return e}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return Math.min(rr.computeOverlaySnapTolerance(s),rr.computeOverlaySnapTolerance(u))}};rr.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),n=Math.min(e.getHeight(),e.getWidth()),r=n*rr.SNAP_PRECISION_FACTOR;return r};rr.snapToSelf=function(t,e,n){var r=new rr(t);return r.snapToSelf(e,n)};XE.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(rr,XE);var YE=function(t){function e(n,r,s){t.call(this),this._snapTolerance=n||null,this._snapPts=r||null,this._isSelfSnap=s!==void 0?s:!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(n,r){var s=new ma(n,this._snapTolerance);return s.setAllowSnappingToSourceVertices(this._isSelfSnap),s.snapTo(r)},e.prototype.transformCoordinates=function(n,r){var s=n.toCoordinateArray(),u=this.snapLine(s,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(u)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ji),_i=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};_i.prototype.getCommon=function(){return Pe.longBitsToDouble(this._commonBits)};_i.prototype.add=function(t){var e=Pe.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=_i.signExpBits(this._commonBits),this._isFirst=!1,null;var n=_i.signExpBits(e);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=_i.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=_i.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};_i.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=Pe.longBitsToDouble(t),n=Pe.toBinaryString(t),r="0000000000000000000000000000000000000000000000000000000000000000"+n,s=r.substring(r.length-64),u=s.substring(0,1)+" "+s.substring(1,12)+"(exp) "+s.substring(12)+" [ "+e+" ]";return u}};_i.prototype.interfaces_=function(){return[]};_i.prototype.getClass=function(){return _i};_i.getBit=function(t,e){var n=1<>52};_i.zeroLowerBits=function(t,e){var n=(1<=0;r--){if(_i.getBit(t,r)!==_i.getBit(e,r))return n;n++}return 52};var Ol=function(){this._commonCoord=null,this._ccFilter=new Mc},P0={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Ol.prototype.addCommonBits=function(t){var e=new zl(this._commonCoord);t.apply(e),t.geometryChanged()};Ol.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new yt(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new zl(e);return t.apply(n),t.geometryChanged(),t};Ol.prototype.getCommonCoordinate=function(){return this._commonCoord};Ol.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};Ol.prototype.interfaces_=function(){return[]};Ol.prototype.getClass=function(){return Ol};P0.CommonCoordinateFilter.get=function(){return Mc};P0.Translater.get=function(){return zl};Object.defineProperties(Ol,P0);var Mc=function(){this._commonBitsX=new _i,this._commonBitsY=new _i};Mc.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)};Mc.prototype.getCommonCoordinate=function(){return new yt(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Mc.prototype.interfaces_=function(){return[ua]};Mc.prototype.getClass=function(){return Mc};var zl=function(){this.trans=null;var t=arguments[0];this.trans=t};zl.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,r=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,r)};zl.prototype.isDone=function(){return!1};zl.prototype.isGeometryChanged=function(){return!0};zl.prototype.interfaces_=function(){return[is]};zl.prototype.getClass=function(){return zl};var qr=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};qr.prototype.selfSnap=function(t){var e=new rr(t),n=e.snapTo(t,this._snapTolerance);return n};qr.prototype.removeCommonBits=function(t){this._cbr=new Ol,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e};qr.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t};qr.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=ke.overlayOp(e[0],e[1],t);return this.prepareResult(n)};qr.prototype.checkValid=function(t){t.isValid()||$r.out.println("Snapped geometry is invalid")};qr.prototype.computeSnapTolerance=function(){this._snapTolerance=rr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};qr.prototype.snap=function(t){var e=this.removeCommonBits(t),n=rr.snap(e[0],e[1],this._snapTolerance);return n};qr.prototype.interfaces_=function(){return[]};qr.prototype.getClass=function(){return qr};qr.overlayOp=function(t,e,n){var r=new qr(t,e);return r.getResultGeometry(n)};qr.union=function(t,e){return qr.overlayOp(t,e,ke.UNION)};qr.intersection=function(t,e){return qr.overlayOp(t,e,ke.INTERSECTION)};qr.symDifference=function(t,e){return qr.overlayOp(t,e,ke.SYMDIFFERENCE)};qr.difference=function(t,e){return qr.overlayOp(t,e,ke.DIFFERENCE)};var Ci=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};Ci.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=ke.overlayOp(this._geom[0],this._geom[1],t);var s=!0;s&&(n=!0)}catch(u){if(u instanceof qa)r=u;else throw u}finally{}if(!n)try{e=qr.overlayOp(this._geom[0],this._geom[1],t)}catch(u){throw u instanceof qa?r:u}finally{}return e};Ci.prototype.interfaces_=function(){return[]};Ci.prototype.getClass=function(){return Ci};Ci.overlayOp=function(t,e,n){var r=new Ci(t,e);return r.getResultGeometry(n)};Ci.union=function(t,e){return Ci.overlayOp(t,e,ke.UNION)};Ci.intersection=function(t,e){return Ci.overlayOp(t,e,ke.INTERSECTION)};Ci.symDifference=function(t,e){return Ci.overlayOp(t,e,ke.SYMDIFFERENCE)};Ci.difference=function(t,e){return Ci.overlayOp(t,e,ke.DIFFERENCE)};var yd=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};yd.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)};yd.prototype.interfaces_=function(){return[]};yd.prototype.getClass=function(){return yd};var co=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(arguments.length===3){var r=arguments[0],s=arguments[1],u=arguments[2];this._eventType=t.INSERT,this._label=r,this._xValue=s,this._obj=u}},M0={INSERT:{configurable:!0},DELETE:{configurable:!0}};co.prototype.isDelete=function(){return this._eventType===co.DELETE};co.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t};co.prototype.getObject=function(){return this._obj};co.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0};co.prototype.getInsertEvent=function(){return this._insertEvent};co.prototype.isInsert=function(){return this._eventType===co.INSERT};co.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label};co.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};co.prototype.interfaces_=function(){return[jo]};co.prototype.getClass=function(){return co};M0.INSERT.get=function(){return 1};M0.DELETE.get=function(){return 2};Object.defineProperties(co,M0);var Ng=function(){};Ng.prototype.interfaces_=function(){return[]};Ng.prototype.getClass=function(){return Ng};var ti=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};ti.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&this._li.getIntersectionNum()===1){if(ti.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var s=t.getNumPoints()-1;if(e===0&&r===s||r===0&&e===s)return!0}}return!1};ti.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};ti.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t};ti.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};ti.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next(),s=r.getCoordinate();if(t.isIntersection(s))return!0}return!1};ti.prototype.hasProperIntersection=function(){return this._hasProper};ti.prototype.hasIntersection=function(){return this._hasIntersection};ti.prototype.isDone=function(){return this._isDone};ti.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))};ti.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e};ti.prototype.addIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var s=t.getCoordinates()[e],u=t.getCoordinates()[e+1],p=n.getCoordinates()[r],c=n.getCoordinates()[r+1];this._li.computeIntersection(s,u,p,c),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))};ti.prototype.interfaces_=function(){return[]};ti.prototype.getClass=function(){return ti};ti.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var UN=function(t){function e(){t.call(this),this.events=new Xt,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){var n=this;ss.sort(this.events);for(var r=0;re||this._maxu?1:0};_d.prototype.interfaces_=function(){return[ip]};_d.prototype.getClass=function(){return _d};var VN=function(t){function e(){t.call(this),this._item=null;var n=arguments[0],r=arguments[1],s=arguments[2];this._min=n,this._max=r,this._item=s}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(n,r,s){if(!this.intersects(n,r))return null;s.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ga),GN=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var n=arguments[0],r=arguments[1];this._node1=n,this._node2=r,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(n,r){this._min=Math.min(n._min,r._min),this._max=Math.max(n._max,r._max)},e.prototype.query=function(n,r,s){if(!this.intersects(n,r))return null;this._node1!==null&&this._node1.query(n,r,s),this._node2!==null&&this._node2.query(n,r,s)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ga),ya=function(){this._leaves=new Xt,this._root=null,this._level=0};ya.prototype.buildTree=function(){var t=this;ss.sort(this._leaves,new ga.NodeComparator);for(var e=this._leaves,n=null,r=new Xt;;){if(t.buildLevel(e,r),r.size()===1)return r.get(0);n=e,e=r,r=n}};ya.prototype.insert=function(t,e,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new VN(t,e,n))};ya.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)};ya.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};ya.prototype.printNode=function(t){$r.out.println(rs.toLineString(new yt(t._min,this._level),new yt(t._max,this._level)))};ya.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};ya.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,r[0]),this.insertBoundaryPoint(this._argIndex,r[r.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),r=new Array(n.size()).fill(null),s=0,u=n.iterator();u.hasNext();){var p=u.next();r[s++]=p.getCoordinate().copy()}return r},e.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(n,r,s){if(this.isBoundaryNode(n,r))return null;s===xt.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,r):this.insertPoint(n,r,s)},e.prototype.addPolygonRing=function(n,r,s){if(n.isEmpty())return null;var u=Ge.removeRepeatedPoints(n.getCoordinates());if(u.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=u[0],null;var p=r,c=s;ee.isCCW(u)&&(p=s,c=r);var b=new Rg(u,new mn(this._argIndex,xt.BOUNDARY,p,c));this._lineEdgeMap.put(n,b),this.insertEdge(b),this.insertPoint(this._argIndex,u[0],xt.BOUNDARY)},e.prototype.insertPoint=function(n,r,s){var u=this._nodes.addNode(r),p=u.getLabel();p===null?u._label=new mn(n,s):p.setLocation(n,s)},e.prototype.createEdgeSetIntersector=function(){return new UN},e.prototype.addSelfIntersectionNodes=function(n){for(var r=this,s=this._edges.iterator();s.hasNext();)for(var u=s.next(),p=u.getLabel().getLocation(n),c=u.eiList.iterator();c.hasNext();){var b=c.next();r.addSelfIntersectionNode(n,b.coord,p)}},e.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof aa&&(this._useBoundaryDeterminationRule=!1),n instanceof xr)this.addPolygon(n);else if(n instanceof Zn)this.addLineString(n);else if(n instanceof ao)this.addPoint(n);else if(n instanceof hp)this.addCollection(n);else if(n instanceof vu)this.addCollection(n);else if(n instanceof aa)this.addCollection(n);else if(n instanceof Si)this.addCollection(n);else throw new Error(n.getClass().getName())}else return t.prototype.add.apply(this,arguments)},e.prototype.addCollection=function(n){for(var r=this,s=0;s50?(this._areaPtLocator===null&&(this._areaPtLocator=new _p(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},e.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(n,r){return n.isInBoundary(r)?xt.BOUNDARY:xt.INTERIOR},e}(jn),xp=function(){if(this._li=new Ru,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Vf(0,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=Vo.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Vf(0,e,r),this._arg[1]=new Vf(1,n,r)}else if(arguments.length===3){var s=arguments[0],u=arguments[1],p=arguments[2];s.getPrecisionModel().compareTo(u.getPrecisionModel())>=0?this.setComputationPrecision(s.getPrecisionModel()):this.setComputationPrecision(u.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Vf(0,s,p),this._arg[1]=new Vf(1,u,p)}};xp.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()};xp.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)};xp.prototype.interfaces_=function(){return[]};xp.prototype.getClass=function(){return xp};var yu=function(){};yu.prototype.interfaces_=function(){return[]};yu.prototype.getClass=function(){return yu};yu.map=function(){if(arguments[0]instanceof Ee&&Ie(arguments[1],yu.MapOp)){for(var t=arguments[0],e=arguments[1],n=new Xt,r=0;r=t.size()?null:t.get(e)};lr.union=function(t){var e=new lr(t);return e.union()};JE.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(lr,JE);var Og=function(){};Og.prototype.interfaces_=function(){return[]};Og.prototype.getClass=function(){return Og};Og.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ke.createEmptyResult(ke.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Ci.overlayOp(t,e,ke.UNION)};function Nu(){return new zg}function zg(){this.reset()}zg.prototype={constructor:zg,reset:function(){this.s=this.t=0},add:function(t){gw(jm,t,this.t),gw(this,jm.s,this.s),this.s?this.t+=jm.t:this.s=jm.t},valueOf:function(){return this.s}};var jm=new zg;function gw(t,e,n){var r=t.s=e+n,s=r-e,u=r-s;t.t=e-u+(n-s)}var Wn=1e-6,xn=Math.PI,Fa=xn/2,yw=xn/4,Xa=xn*2,cu=180/xn,bs=xn/180,bi=Math.abs,qN=Math.atan,wp=Math.atan2,yr=Math.cos,_r=Math.sin,Rp=Math.sqrt;function QE(t){return t>1?0:t<-1?xn:Math.acos(t)}function kc(t){return t>1?Fa:t<-1?-Fa:Math.asin(t)}function Wf(){}function Fg(t,e){t&&vw.hasOwnProperty(t.type)&&vw[t.type](t,e)}var _w={Feature:function(t,e){Fg(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,s=n.length;++rxn?t-Xa:t<-xn?t+Xa:t,e]}zv.invert=zv;function HN(t,e,n){return(t%=Xa)?e||n?tI(ww(t),Sw(e,n)):ww(t):e||n?Sw(e,n):zv}function bw(t){return function(e,n){return e+=t,[e>xn?e-Xa:e<-xn?e+Xa:e,n]}}function ww(t){var e=bw(t);return e.invert=bw(-t),e}function Sw(t,e){var n=yr(t),r=_r(t),s=yr(e),u=_r(e);function p(c,b){var S=yr(b),T=yr(c)*S,L=_r(c)*S,M=_r(b),B=M*n+T*r;return[wp(L*s-B*u,T*n-M*r),kc(B*s+L*u)]}return p.invert=function(c,b){var S=yr(b),T=yr(c)*S,L=_r(c)*S,M=_r(b),B=M*s-L*u;return[wp(L*s+M*u,T*n+B*r),kc(B*n-T*r)]},p}function WN(t,e,n,r,s,u){if(n){var p=yr(e),c=_r(e),b=r*n;s==null?(s=e+r*Xa,u=e-b/2):(s=Ew(p,s),u=Ew(p,u),(r>0?su)&&(s+=r*Xa));for(var S,T=s;r>0?T>u:T1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function ZN(t,e,n,r,s,u){var p=t[0],c=t[1],b=e[0],S=e[1],T=0,L=1,M=b-p,B=S-c,R;if(R=n-p,!(!M&&R>0)){if(R/=M,M<0){if(R0){if(R>L)return;R>T&&(T=R)}if(R=s-p,!(!M&&R<0)){if(R/=M,M<0){if(R>L)return;R>T&&(T=R)}else if(M>0){if(R0)){if(R/=B,B<0){if(R0){if(R>L)return;R>T&&(T=R)}if(R=u-c,!(!B&&R<0)){if(R/=B,B<0){if(R>L)return;R>T&&(T=R)}else if(B>0){if(R0&&(t[0]=p+T*M,t[1]=c+T*B),L<1&&(e[0]=p+L*M,e[1]=c+L*B),!0}}}}}function sg(t,e){return bi(t[0]-e[0])=0;--c)s.point((L=T[c])[0],L[1]);else r(M.x,M.p.x,-1,s);M=M.p}M=M.o,T=M.z,B=!B}while(!M.v);s.lineEnd()}}}function Iw(t){if(e=t.length){for(var e,n=0,r=t[0],s;++ne?1:t>=e?0:NaN}function XN(t){return t.length===1&&(t=YN(t)),{left:function(e,n,r,s){for(r==null&&(r=0),s==null&&(s=e.length);r>>1;t(e[u],n)<0?r=u+1:s=u}return r},right:function(e,n,r,s){for(r==null&&(r=0),s==null&&(s=e.length);r>>1;t(e[u],n)>0?s=u:r=u+1}return r}}}function YN(t){return function(e,n){return rI(t(e),n)}}XN(rI);function iI(t){for(var e=t.length,n,r=-1,s=0,u,p;++r=0;)for(p=t[e],n=p.length;--n>=0;)u[--s]=p[n];return u}var Zf=1e9,Xm=-Zf;function KN(t,e,n,r){function s(S,T){return t<=S&&S<=n&&e<=T&&T<=r}function u(S,T,L,M){var B=0,R=0;if(S==null||(B=p(S,L))!==(R=p(T,L))||b(S,T)<0^L>0)do M.point(B===0||B===3?t:n,B>1?r:e);while((B=(B+L+4)%4)!==R);else M.point(T[0],T[1])}function p(S,T){return bi(S[0]-t)0?0:3:bi(S[0]-n)0?2:1:bi(S[1]-e)0?1:0:T>0?3:2}function c(S,T){return b(S.x,T.x)}function b(S,T){var L=p(S,1),M=p(T,1);return L!==M?L-M:L===0?T[1]-S[1]:L===1?S[0]-T[0]:L===2?S[1]-T[1]:T[0]-S[0]}return function(S){var T=S,L=eI(),M,B,R,W,et,st,ut,gt,St,Bt,zt,Dt={point:Lt,lineStart:se,lineEnd:ge,polygonStart:ie,polygonEnd:wt};function Lt(pe,be){s(pe,be)&&T.point(pe,be)}function Ut(){for(var pe=0,be=0,ae=B.length;ber&&(en-Me)*(r-Ze)>(pn-Ze)*(t-Me)&&++pe:pn<=r&&(en-Me)*(r-Ze)<(pn-Ze)*(t-Me)&&--pe;return pe}function ie(){T=L,M=[],B=[],zt=!0}function wt(){var pe=Ut(),be=zt&&pe,ae=(M=iI(M)).length;(be||ae)&&(S.polygonStart(),be&&(S.lineStart(),u(null,null,1,S),S.lineEnd()),ae&&nI(M,c,pe,u,S),S.polygonEnd()),T=S,M=B=R=null}function se(){Dt.point=Vt,B&&B.push(R=[]),Bt=!0,St=!1,ut=gt=NaN}function ge(){M&&(Vt(W,et),st&&St&&L.rejoin(),M.push(L.result())),Dt.point=Lt,St&&T.lineEnd()}function Vt(pe,be){var ae=s(pe,be);if(B&&R.push([pe,be]),Bt)W=pe,et=be,st=ae,Bt=!1,ae&&(T.lineStart(),T.point(pe,be));else if(ae&&St)T.point(pe,be);else{var Te=[ut=Math.max(Xm,Math.min(Zf,ut)),gt=Math.max(Xm,Math.min(Zf,gt))],tn=[pe=Math.max(Xm,Math.min(Zf,pe)),be=Math.max(Xm,Math.min(Zf,be))];ZN(Te,tn,t,e,n,r)?(St||(T.lineStart(),T.point(Te[0],Te[1])),T.point(tn[0],tn[1]),ae||T.lineEnd(),zt=!1):ae&&(T.lineStart(),T.point(pe,be),zt=!1)}ut=pe,gt=be,St=ae}return Dt}}var H_=Nu();function $N(t,e){var n=e[0],r=e[1],s=[_r(n),-yr(n),0],u=0,p=0;H_.reset();for(var c=0,b=t.length;c=0?1:-1,Lt=Dt*zt,Ut=Lt>xn,ie=R*St;if(H_.add(wp(ie*Dt*_r(Lt),W*Bt+ie*yr(Lt))),u+=Ut?zt+Dt*Xa:zt,Ut^M>=n^ut>=n){var wt=Bg(Sp(L),Sp(st));Ov(wt);var se=Bg(s,wt);Ov(se);var ge=(Ut^zt>=0?-1:1)*kc(se[2]);(r>ge||r===ge&&(wt[0]||wt[1]))&&(p+=Ut^zt>=0?1:-1)}}return(u<-Wn||uvd&&(vd=t),eVg&&(Vg=e)}Nu();function oI(t,e,n,r){return function(s,u){var p=e(u),c=s.invert(r[0],r[1]),b=eI(),S=e(b),T=!1,L,M,B,R={point:W,lineStart:st,lineEnd:ut,polygonStart:function(){R.point=gt,R.lineStart=St,R.lineEnd=Bt,M=[],L=[]},polygonEnd:function(){R.point=W,R.lineStart=st,R.lineEnd=ut,M=iI(M);var zt=$N(L,c);M.length?(T||(u.polygonStart(),T=!0),nI(M,tO,zt,n,u)):zt&&(T||(u.polygonStart(),T=!0),u.lineStart(),n(null,null,1,u),u.lineEnd()),T&&(u.polygonEnd(),T=!1),M=L=null},sphere:function(){u.polygonStart(),u.lineStart(),n(null,null,1,u),u.lineEnd(),u.polygonEnd()}};function W(zt,Dt){var Lt=s(zt,Dt);t(zt=Lt[0],Dt=Lt[1])&&u.point(zt,Dt)}function et(zt,Dt){var Lt=s(zt,Dt);p.point(Lt[0],Lt[1])}function st(){R.point=et,p.lineStart()}function ut(){R.point=W,p.lineEnd()}function gt(zt,Dt){B.push([zt,Dt]);var Lt=s(zt,Dt);S.point(Lt[0],Lt[1])}function St(){S.lineStart(),B=[]}function Bt(){gt(B[0][0],B[0][1]),S.lineEnd();var zt=S.clean(),Dt=b.result(),Lt,Ut=Dt.length,ie,wt,se;if(B.pop(),L.push(B),B=null,!!Ut){if(zt&1){if(wt=Dt[0],(ie=wt.length-1)>0){for(T||(u.polygonStart(),T=!0),u.lineStart(),Lt=0;Lt1&&zt&2&&Dt.push(Dt.pop().concat(Dt.shift())),M.push(Dt.filter(QN))}}return R}}function QN(t){return t.length>1}function tO(t,e){return((t=t.x)[0]<0?t[1]-Fa-Wn:Fa-t[1])-((e=e.x)[0]<0?e[1]-Fa-Wn:Fa-e[1])}const Lw=oI(function(){return!0},eO,rO,[-xn,-Fa]);function eO(t){var e=NaN,n=NaN,r=NaN,s;return{lineStart:function(){t.lineStart(),s=1},point:function(u,p){var c=u>0?xn:-xn,b=bi(u-e);bi(b-xn)0?Fa:-Fa),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(c,n),t.point(u,n),s=0):r!==c&&b>=xn&&(bi(e-r)Wn?qN((_r(e)*(u=yr(r))*_r(n)-_r(r)*(s=yr(e))*_r(t))/(s*u*p)):(e+r)/2}function rO(t,e,n,r){var s;if(t==null)s=n*Fa,r.point(-xn,s),r.point(0,s),r.point(xn,s),r.point(xn,0),r.point(xn,-s),r.point(0,-s),r.point(-xn,-s),r.point(-xn,0),r.point(-xn,s);else if(bi(t[0]-e[0])>Wn){var u=t[0]0,s=bi(n)>Wn;function u(T,L,M,B){WN(B,t,e,M,T,L)}function p(T,L){return yr(T)*yr(L)>n}function c(T){var L,M,B,R,W;return{lineStart:function(){R=B=!1,W=1},point:function(et,st){var ut=[et,st],gt,St=p(et,st),Bt=r?St?0:S(et,st):St?S(et+(et<0?xn:-xn),st):0;if(!L&&(R=B=St)&&T.lineStart(),St!==B&&(gt=b(L,ut),(!gt||sg(L,gt)||sg(ut,gt))&&(ut[0]+=Wn,ut[1]+=Wn,St=p(ut[0],ut[1]))),St!==B)W=0,St?(T.lineStart(),gt=b(ut,L),T.point(gt[0],gt[1])):(gt=b(L,ut),T.point(gt[0],gt[1]),T.lineEnd()),L=gt;else if(s&&L&&r^St){var zt;!(Bt&M)&&(zt=b(ut,L,!0))&&(W=0,r?(T.lineStart(),T.point(zt[0][0],zt[0][1]),T.point(zt[1][0],zt[1][1]),T.lineEnd()):(T.point(zt[1][0],zt[1][1]),T.lineEnd(),T.lineStart(),T.point(zt[0][0],zt[0][1])))}St&&(!L||!sg(L,ut))&&T.point(ut[0],ut[1]),L=ut,B=St,M=Bt},lineEnd:function(){B&&T.lineEnd(),L=null},clean:function(){return W|(R&&B)<<1}}}function b(T,L,M){var B=Sp(T),R=Sp(L),W=[1,0,0],et=Bg(B,R),st=Hm(et,et),ut=et[0],gt=st-ut*ut;if(!gt)return!M&&T;var St=n*st/gt,Bt=-n*ut/gt,zt=Bg(W,et),Dt=Wm(W,St),Lt=Wm(et,Bt);j_(Dt,Lt);var Ut=zt,ie=Hm(Dt,Ut),wt=Hm(Ut,Ut),se=ie*ie-wt*(Hm(Dt,Dt)-1);if(!(se<0)){var ge=Rp(se),Vt=Wm(Ut,(-ie-ge)/wt);if(j_(Vt,Dt),Vt=Nv(Vt),!M)return Vt;var pe=T[0],be=L[0],ae=T[1],Te=L[1],tn;be0^Vt[1]<(bi(Vt[0]-pe)xn^(pe<=Vt[0]&&Vt[0]<=be)){var Ze=Wm(Ut,(-ie+ge)/wt);return j_(Ze,Dt),[Vt,Nv(Ze)]}}}function S(T,L){var M=r?t:xn-t,B=0;return T<-M?B|=1:T>M&&(B|=2),L<-M?B|=4:L>M&&(B|=8),B}return oI(p,c,u,r?[0,-t]:[-xn,t-xn])}function sI(t){return function(e){var n=new Fv;for(var r in t)n[r]=t[r];return n.stream=e,n}}function Fv(){}Fv.prototype={constructor:Fv,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function aI(t,e,n){var r=e[1][0]-e[0][0],s=e[1][1]-e[0][1],u=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),u!=null&&t.clipExtent(null),jN(n,t.stream(Tw));var p=Tw.result(),c=Math.min(r/(p[1][0]-p[0][0]),s/(p[1][1]-p[0][1])),b=+e[0][0]+(r-c*(p[1][0]+p[0][0]))/2,S=+e[0][1]+(s-c*(p[1][1]+p[0][1]))/2;return u!=null&&t.clipExtent(u),t.scale(c*150).translate([b,S])}function oO(t,e,n){return aI(t,[[0,0],e],n)}var Aw=16,sO=yr(30*bs);function Pw(t,e){return+e?lO(t,e):aO(t)}function aO(t){return sI({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function lO(t,e){function n(r,s,u,p,c,b,S,T,L,M,B,R,W,et){var st=S-r,ut=T-s,gt=st*st+ut*ut;if(gt>4*e&&W--){var St=p+M,Bt=c+B,zt=b+R,Dt=Rp(St*St+Bt*Bt+zt*zt),Lt=kc(zt/=Dt),Ut=bi(bi(zt)-1)e||bi((st*ge+ut*Vt)/gt-.5)>.3||p*M+c*B+b*R2?Vt[2]%360*bs:0,se()):[S*cu,T*cu,L*cu]},Ut.precision=function(Vt){return arguments.length?(zt=Pw(wt,Bt=Vt*Vt),ge()):Rp(Bt)},Ut.fitExtent=function(Vt,pe){return aI(Ut,Vt,pe)},Ut.fitSize=function(Vt,pe){return oO(Ut,Vt,pe)};function se(){B=tI(M=HN(S,T,L),e);var Vt=e(c,b);return u=r-Vt[0]*n,p=s+Vt[1]*n,ge()}function ge(){return Dt=Lt=null,Ut}return function(){return e=t.apply(this,arguments),Ut.invert=e.invert&&ie,se()}}function lI(t){return function(e,n){var r=yr(e),s=yr(n),u=t(r*s);return[u*s*_r(e),u*_r(n)]}}function uI(t){return function(e,n){var r=Rp(e*e+n*n),s=t(r),u=_r(s),p=yr(s);return[wp(e*u,r*p),kc(r&&n*u/r)]}}var pO=lI(function(t){return Rp(2/(1+t))});pO.invert=uI(function(t){return 2*kc(t/2)});var cI=lI(function(t){return(t=QE(t))&&t/_r(t)});cI.invert=uI(function(t){return t});function fO(){return cO(cI).scale(79.4188).clipAngle(180-.001)}function Mw(t,e){return[t,e]}Mw.invert=Mw;function dO(t,e,n){n=n||{};var r=n.units||"kilometers",s=n.steps||8;if(!t)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof s!="number")throw new Error("steps must be an number");if(s<=0)throw new Error("steps must be greater than 0");var u=[];switch(t.type){case"GeometryCollection":return IE(t,function(p){var c=ag(p,e,r,s);c&&u.push(c)}),Mv(u);case"FeatureCollection":return hw(t,function(p){var c=ag(p,e,r,s);c&&hw(c,function(b){b&&u.push(b)})}),Mv(u)}return ag(t,e,r,s)}function ag(t,e,n,r){var s=t.properties||{},u=t.type==="Feature"?t.geometry:t;if(u.type==="GeometryCollection"){var p=[];return IE(t,function(W){var et=ag(W,e,n,r);et&&p.push(et)}),Mv(p)}var c=mO(u),b={type:u.type,coordinates:pI(u.coordinates,c)},S=new E0,T=S.read(b),L=wN(SN(e,n),"meters"),M=Yr.bufferOp(T,L,r),B=new NE;if(M=B.write(M),!hI(M.coordinates)){var R={type:M.type,coordinates:fI(M.coordinates,c)};return Qg(R,s)}}function hI(t){return Array.isArray(t[0])?hI(t[0]):isNaN(t[0])}function pI(t,e){return typeof t[0]!="object"?e(t):t.map(function(n){return pI(n,e)})}function fI(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(n){return fI(n,e)})}function mO(t){var e=IN(t).geometry.coordinates,n=[-e[0],-e[1]];return fO().rotate(n).scale(xo)}function gO(t,e){var n=Mg(t),r=Mg(e),s=t.properties||{},u=xE.difference(n.coordinates,r.coordinates);return u.length===0?null:u.length===1?wE(u[0],s):SE(u,s)}function kw(t){let e;for(const n of t)e&&n[0]-e[0]>=180?n[0]-=360:e&&n[0]-e[0]<-180&&(n[0]+=360),e=n}function Dw(t,e){const n=gO({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},t);if(!n)return;n.properties={isMask:"y"};const r=dO(t,0);if(r.geometry.type==="Polygon")for(const s of r.geometry.coordinates)kw(s);else for(const s of r.geometry.coordinates)for(const u of s)kw(u);e({type:"FeatureCollection",features:[r,n]})}let Rw={type:"FeatureCollection",features:[]};function sz(t,e,n=!0,r=!0,s={},u={},p={fill:{paint:{"fill-color":"#000","fill-opacity":.1},filter:["all",["==",["geometry-type"],"Polygon"],["has","isMask"]]},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"},filter:["!",["has","isMask"]]}}){let c,b=[],S,T;function L(){(p!=null&&p.fill||p!=null&&p.line)&&t.addSource("full-geom",{type:"geojson",data:Rw}),p!=null&&p.fill&&t.addLayer({...p==null?void 0:p.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),p!=null&&p.line&&t.addLayer({...p==null?void 0:p.line,id:"full-geom-line",type:"line",source:"full-geom"})}t.loaded()?L():t.once("load",()=>{L()});const M=R=>{c==null||c({type:"mapClick",coordinates:[R.lngLat.lng,R.lngLat.lat]})};function B(R=!1){if(!e)throw new Error;const W=document.createElement("div");return R&&W.classList.add("marker-interactive"),new WR({props:{displayIn:"maplibre"},target:W}),new e.Marker({element:W,offset:[1,-13]})}return{setEventHandler(R){R?(c=R,t.on("click",M)):(c=void 0,t.off("click",M))},flyTo(R,W){t.flyTo({center:R,zoom:W,...s})},fitBounds(R,W,et){t.fitBounds([[R[0],R[1]],[R[2],R[3]]],{padding:W,maxZoom:et,...u})},indicateReverse(R){t.getCanvasContainer().style.cursor=R?"crosshair":""},setReverseMarker(R){!e||!n||(T?R?T.setLngLat(R):(T.remove(),T=void 0):R&&(T=(typeof n=="object"?new e.Marker(n):B()).setLngLat(R).addTo(t),T.getElement().classList.add("marker-reverse")))},setMarkers(R,W){if(!n)return;function et(st){var ut;(ut=t.getSource("full-geom"))==null||ut.setData(st)}for(const st of b)st.remove();if(b.length=0,et(Rw),!!e){if(W){let st=!1;if(W.geometry.type==="GeometryCollection"){const ut=W.geometry.geometries.filter(gt=>gt.type==="Polygon"||gt.type==="MultiPolygon");if(ut.length>0){let gt=ut.pop();for(const St of ut)gt=EN(gt,St);Dw({...W,geometry:gt},et),st=!0}else{const gt=W.geometry.geometries.filter(St=>St.type==="LineString"||St.type==="MultiLineString");gt.length>0&&(et({...W,geometry:{type:"GeometryCollection",geometries:gt}}),st=!0)}}if(!st){if(W.geometry.type==="Polygon"||W.geometry.type==="MultiPolygon")Dw(W,et);else if(W.geometry.type==="LineString"||W.geometry.type==="MultiLineString"){et(W);return}}n&&b.push((typeof n=="object"?new e.Marker(n):B()).setLngLat(W.center).addTo(t))}if(r)for(const st of R??[]){if(st===W)continue;const ut=(typeof r=="object"?new e.Marker(r):B(!0)).setLngLat(st.center).setPopup(new e.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(st.place_type[0]==="reverse"?st.place_name:st.place_name.replace(/,.*/,""))).addTo(t),gt=ut.getElement();gt.addEventListener("click",St=>{St.stopPropagation(),c==null||c({type:"markerClick",id:st.id})}),gt.addEventListener("mouseenter",()=>{c==null||c({type:"markerMouseEnter",id:st.id}),ut.togglePopup()}),gt.addEventListener("mouseleave",()=>{c==null||c({type:"markerMouseLeave",id:st.id}),ut.togglePopup()}),b.push(ut)}}},setSelectedMarker(R){S&&S.getElement().classList.toggle("marker-selected",!1),S=R>-1?b[R]:void 0,S==null||S.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const R=t.getCenter();return[t.getZoom(),R.lng,R.lat]}}}const yO=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(EAST|WEST|[EW])?$/i,Nw=/^([+-]?[0-8]?[0-9])\s+([0-5]?[0-9]\.\d{3,})[\s,]{1,}([+-]?[0-1]?[0-9]?[0-9])\s+([0-5]?[0-9]\.\d{3,})$/,Ow=/^(NORTH|SOUTH|[NS])?[\s]*([+-]?[0-8]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(NORTH|SOUTH|[NS])?[\s]*[,/;]?[\s]*(EAST|WEST|[EW])?[\s]*([+-]?[0-1]?[0-9]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(EAST|WEST|[EW])?$/i,zw=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(EAST|WEST|[EW])?$/i,Fw=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)\s*(EAST|WEST|[EW])?$/i,Bw=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|’’|´´|["″”\.])?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|´´|’’|["″”\.])?\s*(EAST|WEST|[EW])?$/i;function _O(t){if(!["DMS","DM","DD"].includes(t))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){const e=this.decimalCoordinates.split(",").map(B=>Number(B.trim())),n=Number(e[0]),r=Number(e[1]),s=Math.abs(n),u=Math.abs(r),p=n>0?"N":"S",c=r>0?"E":"W";let b;t=="DD"&&(b=`${s}° ${p}, ${u}° ${c}`);const S=Math.floor(s),T=Math.floor(u),L=(s-S)*60,M=(u-T)*60;if(t=="DM"){let B=Uw(L,3).toFixed(3).padStart(6,"0"),R=Uw(M,3).toFixed(3).padStart(6,"0");B.endsWith(".000")&&R.endsWith(".000")&&(B=B.replace(/\.000$/,""),R=R.replace(/\.000$/,"")),b=`${S}° ${B}' ${p}, ${T}° ${R}' ${c}`}if(t=="DMS"){const B=Math.floor(L),R=Math.floor(M);let W=((L-B)*60).toFixed(1).padStart(4,"0"),et=((M-R)*60).toFixed(1).padStart(4,"0");const st=B.toString().padStart(2,"0"),ut=R.toString().padStart(2,"0");W.endsWith(".0")&&et.endsWith(".0")&&(W=W.replace(/\.0$/,""),et=et.replace(/\.0$/,"")),b=`${S}° ${st}' ${W}" ${p}, ${T}° ${ut}' ${et}" ${c}`}return b}else throw new Error("no decimal coordinates to convert")}function Uw(t,e){const n=Math.pow(10,e);return Math.round((t+Number.EPSILON)*n)/n}function D0(t,e){e||(e=5),t=t.replace(/\s+/g," ").trim();let n=null,r=null,s="",u="",p=null,c=[],b=!1;if(yO.test(t))throw new Error("invalid coordinate value");if(Nw.test(t))if(c=Nw.exec(t),b=Gf(c),b)n=Math.abs(c[1])+c[2]/60,Number(c[1])<0&&(n*=-1),r=Math.abs(c[3])+c[4]/60,Number(c[3])<0&&(r*=-1),p="DM";else throw new Error("invalid coordinate format");else if(Ow.test(t))if(c=Ow.exec(t),b=Gf(c),b){if(n=c[2],r=c[6],n.includes(",")&&(n=n.replace(",",".")),r.includes(",")&&(r=r.replace(",",".")),p="DD",Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");if(Number(Math.round(r))==Number(r))throw new Error("integer only coordinate provided");c[1]?(s=c[1],u=c[5]):c[4]&&(s=c[4],u=c[8])}else throw new Error("invalid decimal coordinate format");else if(zw.test(t))if(c=zw.exec(t),b=Gf(c),b)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60,p="DM"),c[6]&&(n+=c[6].replace(",",".")/3600,p="DMS"),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[9])),c[11]&&(r+=c[11]/60),c[13]&&(r+=c[13].replace(",",".")/3600),parseInt(c[9])<0&&(r=-1*r),c[1]?(s=c[1],u=c[8]):c[7]&&(s=c[7],u=c[14]);else throw new Error("invalid DMS coordinates format");else if(Fw.test(t))if(c=Fw.exec(t),b=Gf(c),b)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60,p="DM"),c[6]&&(n+=c[6]/3600,p="DMS"),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[10])),c[12]&&(r+=c[12]/60),c[14]&&(r+=c[14]/3600),parseInt(c[10])<0&&(r=-1*r),c[1]?(s=c[1],u=c[9]):c[8]&&(s=c[8],u=c[16]);else throw new Error("invalid DMS coordinates format");else if(Bw.test(t)){if(c=Bw.exec(t),b=Gf(c),c.filter(S=>S).length<=5)throw new Error("invalid coordinates format");if(b)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4].replace(",",".")/60,p="DM"),c[6]&&(n+=c[6].replace(",",".")/3600,p="DMS"),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[10])),c[12]&&(r+=c[12].replace(",",".")/60),c[14]&&(r+=c[14].replace(",",".")/3600),parseInt(c[10])<0&&(r=-1*r),c[1]?(s=c[1],u=c[9]):c[8]&&(s=c[8],u=c[16]);else throw new Error("invalid coordinates format")}if(b){if(Math.abs(r)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if(s&&!u||!s&&u)throw new Error("invalid coordinates value");if(s&&s==u)throw new Error("invalid coordinates format");n.toString().includes(",")&&(n=n.replace(",",".")),r.toString().includes(",")&&(r=r.replace(",","."));let S=/S|SOUTH/i;S.test(s)&&n>0&&(n=-1*n),S=/W|WEST/i,S.test(u)&&r>0&&(r=-1*r);const T=c[0].trim();let L,M;const B=/[,/;\u0020]/g,R=T.match(B);if(R==null){const st=Math.floor(t.length/2);L=T.substring(0,st).trim(),M=T.substring(st).trim()}else{let st;R.length%2==1?st=Math.floor(R.length/2):st=R.length/2-1;let ut=0;if(st==0)ut=T.indexOf(R[0]),L=T.substring(0,ut).trim(),M=T.substring(ut+1).trim();else{let gt=0,St=0;for(;gt<=st;)ut=T.indexOf(R[gt],St),St=ut+1,gt++;L=T.substring(0,ut).trim(),M=T.substring(ut+1).trim()}}const W=L.split(".");if(W.length==2&&W[1]==0&&W[1].length!=2)throw new Error("invalid coordinates format");const et=M.split(".");if(et.length==2&&et[1]==0&&et[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(L)||/^\d+$/.test(M))throw new Error("degree only coordinate/s provided");return n=Number(Number(n).toFixed(e)),r=Number(Number(r).toFixed(e)),Object.freeze({verbatimCoordinates:T,verbatimLatitude:L,verbatimLongitude:M,decimalLatitude:n,decimalLongitude:r,decimalCoordinates:`${n},${r}`,originalFormat:p,closeEnough:vO,toCoordinateFormat:_O})}else throw new Error("coordinates pattern match failed")}function Gf(t){if(!isNaN(t[0]))return!1;const e=[...t];if(e.shift(),e.length%2>0)return!1;const n=/^[-+]?\d+([\.,]\d+)?$/,r=/[eastsouthnorthwest]+/i,s=e.length/2;for(let u=0;u{e.decimalLatitude?t.push(e):t.push({...e,...wO})}),[...t,...SO,...EO]}const CO=IO();D0.formats=CO.map(t=>t.verbatimCoordinates);const az=D0;const lz="/atip/move_draw_controls/assets/ate_logo-5c8f1b25.png";function Gw(t){let e,n;return e=new dL({props:{$$slots:{default:[TO]},$$scope:{ctx:t}}}),e.$on("click",t[5]),{c(){Eo(e.$$.fragment)},m(r,s){ro(e,r,s),n=!0},p(r,s){const u={};s&128&&(u.$$scope={dirty:s,ctx:r}),e.$set(u)},i(r){n||(xe(e.$$.fragment,r),n=!0)},o(r){Ae(e.$$.fragment,r),n=!1},d(r){io(e,r)}}}function TO(t){let e;return{c(){e=Ka("X")},m(n,r){an(n,e,r)},d(n){n&&on(e)}}}function LO(t){let e,n,r,s,u,p,c,b,S,T,L=t[2]&&Gw(t);const M=t[4].default,B=zs(M,t,t[7],null);return{c(){e=An("div"),n=An("div"),r=An("div"),s=An("h1"),u=Ka(t[1]),p=yi(),L&&L.c(),c=yi(),B&&B.c(),We(s,"class","govuk-heading-l"),gx(r,"display","flex"),gx(r,"justify-content","space-between"),We(n,"class","content centered-fullscreen svelte-1st8ub0"),We(e,"class","background svelte-1st8ub0"),za(e,"open",t[0]),za(e,"closed",!t[0])},m(R,W){an(R,e,W),Gn(e,n),Gn(n,r),Gn(r,s),Gn(s,u),Gn(r,p),L&&L.m(r,null),Gn(n,c),B&&B.m(n,null),b=!0,S||(T=[Ba(n,"click",kT(AO)),Ba(e,"click",t[6])],S=!0)},p(R,[W]){(!b||W&2)&&Ip(u,R[1]),R[2]?L?(L.p(R,W),W&4&&xe(L,1)):(L=Gw(R),L.c(),xe(L,1),L.m(r,null)):L&&(_a(),Ae(L,1,1,()=>{L=null}),va()),B&&B.p&&(!b||W&128)&&Bs(B,M,R,R[7],b?Fs(M,R[7],W,null):Us(R[7]),null),(!b||W&1)&&za(e,"open",R[0]),(!b||W&1)&&za(e,"closed",!R[0])},i(R){b||(xe(L),xe(B,R),b=!0)},o(R){Ae(L),Ae(B,R),b=!1},d(R){R&&on(e),L&&L.d(),B&&B.d(R),S=!1,Ya(T)}}}const AO=()=>null;function PO(t,e,n){let{$$slots:r={},$$scope:s}=e,{title:u}=e,{open:p=!1}=e,{displayEscapeButton:c=!0}=e,{canCloseByClickingBackground:b=!0}=e;const S=()=>n(0,p=!1),T=()=>{b&&n(0,p=!1)};return t.$$set=L=>{"title"in L&&n(1,u=L.title),"open"in L&&n(0,p=L.open),"displayEscapeButton"in L&&n(2,c=L.displayEscapeButton),"canCloseByClickingBackground"in L&&n(3,b=L.canCloseByClickingBackground),"$$scope"in L&&n(7,s=L.$$scope)},[p,u,c,b,r,S,T,s]}class uz extends wr{constructor(e){super(),br(this,e,PO,LO,Yn,{title:1,open:0,displayEscapeButton:2,canCloseByClickingBackground:3})}}var Gg=MO;function MO(t){var e,n,r;if(t){if(Array.isArray(t)){for(e=[],n=t.length,r=0;rnew Promise((r,s)=>{var u=b=>{try{c(n.next(b))}catch(S){s(S)}},p=b=>{try{c(n.throw(b))}catch(S){s(S)}},c=b=>b.done?r(b.value):Promise.resolve(b.value).then(u,p);c((n=n.apply(t,e)).next())}),ts=Uint8Array,Yh=Uint16Array,RO=Int32Array,dI=new ts([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),mI=new ts([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),NO=new ts([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gI=function(t,e){for(var n=new Yh(31),r=0;r<31;++r)n[r]=e+=1<>1|(Tn&21845)<<1,wl=(wl&52428)>>2|(wl&13107)<<2,wl=(wl&61680)>>4|(wl&3855)<<4,Bv[Tn]=((wl&65280)>>8|(wl&255)<<8)>>1;var wl,Tn,td=function(t,e,n){for(var r=t.length,s=0,u=new Yh(e);s>b]=S}else for(c=new Yh(r),s=0;s>15-t[s]);return c},Md=new ts(288);for(Tn=0;Tn<144;++Tn)Md[Tn]=8;var Tn;for(Tn=144;Tn<256;++Tn)Md[Tn]=9;var Tn;for(Tn=256;Tn<280;++Tn)Md[Tn]=7;var Tn;for(Tn=280;Tn<288;++Tn)Md[Tn]=8;var Tn,vI=new ts(32);for(Tn=0;Tn<32;++Tn)vI[Tn]=5;var Tn,BO=td(Md,9,1),UO=td(vI,5,1),W_=function(t){for(var e=t[0],n=1;ne&&(e=t[n]);return e},ea=function(t,e,n){var r=e/8|0;return(t[r]|t[r+1]<<8)>>(e&7)&n},Z_=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(e&7)},VO=function(t){return(t+7)/8|0},GO=function(t,e,n){(e==null||e<0)&&(e=0),(n==null||n>t.length)&&(n=t.length);var r=new ts(n-e);return r.set(t.subarray(e,n)),r},qO=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Qo=function(t,e,n){var r=new Error(e||qO[t]);if(r.code=t,Error.captureStackTrace&&Error.captureStackTrace(r,Qo),!n)throw r;return r},N0=function(t,e,n,r){var s=t.length,u=r?r.length:0;if(!s||e.f&&!e.l)return n||new ts(0);var p=!n||e.i!=2,c=e.i;n||(n=new ts(s*3));var b=function(Kn){var cr=n.length;if(Kn>cr){var jr=new ts(Math.max(cr*2,Kn));jr.set(n),n=jr}},S=e.f||0,T=e.p||0,L=e.b||0,M=e.l,B=e.d,R=e.m,W=e.n,et=s*8;do{if(!M){S=ea(t,T,1);var st=ea(t,T+1,3);if(T+=3,st)if(st==1)M=BO,B=UO,R=9,W=5;else if(st==2){var Bt=ea(t,T,31)+257,zt=ea(t,T+10,15)+4,Dt=Bt+ea(t,T+5,31)+1;T+=14;for(var Lt=new ts(Dt),Ut=new ts(19),ie=0;ie>4;if(ut<16)Lt[ie++]=ut;else{var pe=0,be=0;for(ut==16?(be=3+ea(t,T,3),T+=2,pe=Lt[ie-1]):ut==17?(be=3+ea(t,T,7),T+=3):ut==18&&(be=11+ea(t,T,127),T+=7);be--;)Lt[ie++]=pe}}var ae=Lt.subarray(0,Bt),Te=Lt.subarray(Bt);R=W_(ae),W=W_(Te),M=td(ae,R,1),B=td(Te,W,1)}else Qo(1);else{var ut=VO(T)+4,gt=t[ut-4]|t[ut-3]<<8,St=ut+gt;if(St>s){c&&Qo(0);break}p&&b(L+gt),n.set(t.subarray(ut,St),L),e.b=L+=gt,e.p=T=St*8,e.f=S;continue}if(T>et){c&&Qo(0);break}}p&&b(L+131072);for(var tn=(1<>4;if(T+=pe&15,T>et){c&&Qo(0);break}if(pe||Qo(2),Me<256)n[L++]=Me;else if(Me==256){He=T,M=null;break}else{var Ze=Me-254;if(Me>264){var ie=Me-257,en=dI[ie];Ze=ea(t,T,(1<>4;pn||Qo(3),T+=pn&15;var Te=FO[gn];if(gn>3){var en=mI[gn];Te+=Z_(t,T)&(1<et){c&&Qo(0);break}p&&b(L+131072);var bn=L+Ze;if(L>3&1)+(e>>4&1);r>0;r-=!t[n++]);return n+(e&2)},WO=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},ZO=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&Qo(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&Qo(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2};function XO(t,e){return N0(t,{i:2},e&&e.out,e&&e.dictionary)}function YO(t,e){var n=HO(t);return n+8>t.length&&Qo(6,"invalid gzip data"),N0(t.subarray(n,-8),{i:2},e&&e.out||new ts(WO(t)),e&&e.dictionary)}function KO(t,e){return N0(t.subarray(ZO(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}function Uv(t,e){return t[0]==31&&t[1]==139&&t[2]==8?YO(t,e):(t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31?XO(t,e):KO(t,e)}var $O=typeof TextDecoder<"u"&&new TextDecoder,JO=0;try{$O.decode(jO,{stream:!0}),JO=1}catch{}var xI=(t,e)=>t*Qh(2,e),qf=(t,e)=>Math.floor(t/Qh(2,e)),qg=(t,e)=>xI(t.getUint16(e+1,!0),8)+t.getUint8(e),bI=(t,e)=>xI(t.getUint32(e+2,!0),16)+t.getUint16(e,!0),QO=(t,e,n,r,s)=>{if(t!==r.getUint8(s))return t-r.getUint8(s);const u=qg(r,s+1);if(e!==u)return e-u;const p=qg(r,s+4);return n!==p?n-p:0},t3=(t,e,n,r)=>{const s=wI(t,e|128,n,r);return s?{z:e,x:n,y:r,offset:s[0],length:s[1],isDir:!0}:null},jw=(t,e,n,r)=>{const s=wI(t,e,n,r);return s?{z:e,x:n,y:r,offset:s[0],length:s[1],isDir:!1}:null},wI=(t,e,n,r)=>{let s=0,u=t.byteLength/17-1;for(;s<=u;){const p=u+s>>1,c=QO(e,n,r,t,p*17);if(c>0)s=p+1;else if(c<0)u=p-1;else return[bI(t,p*17+7),t.getUint32(p*17+13,!0)]}return null},e3=(t,e)=>t.isDir&&!e.isDir?1:!t.isDir&&e.isDir?-1:t.z!==e.z?t.z-e.z:t.x!==e.x?t.x-e.x:t.y-e.y,SI=(t,e)=>{const n=t.getUint8(e*17);return{z:n&127,x:qg(t,e*17+1),y:qg(t,e*17+4),offset:bI(t,e*17+7),length:t.getUint32(e*17+13,!0),isDir:n>>7===1}},Hw=t=>{const e=[],n=new DataView(t);for(let r=0;r{t.sort(e3);const e=new ArrayBuffer(17*t.length),n=new Uint8Array(e);for(let r=0;r>8&255,n[r*17+3]=s.x>>16&255,n[r*17+4]=s.y&255,n[r*17+5]=s.y>>8&255,n[r*17+6]=s.y>>16&255,n[r*17+7]=s.offset&255,n[r*17+8]=qf(s.offset,8)&255,n[r*17+9]=qf(s.offset,16)&255,n[r*17+10]=qf(s.offset,24)&255,n[r*17+11]=qf(s.offset,32)&255,n[r*17+12]=qf(s.offset,48)&255,n[r*17+13]=s.length&255,n[r*17+14]=s.length>>8&255,n[r*17+15]=s.length>>16&255,n[r*17+16]=s.length>>24&255}return e},r3=(t,e)=>{if(t.byteLength<17)return null;const n=t.byteLength/17,r=SI(t,n-1);if(r.isDir){const s=r.z,u=e.z-s,p=Math.trunc(e.x/(1<(e,n)=>{if(n instanceof AbortController)return t(e,n);const r=new AbortController;return t(e,r).then(s=>n(void 0,s.data,s.cacheControl||"",s.expires||""),s=>n(s)).catch(s=>n(s)),{cancel:()=>r.abort()}},cz=class{constructor(){this.tilev4=(t,e)=>no(this,null,function*(){if(t.type==="json"){const L=t.url.substr(10);let M=this.tiles.get(L);M||(M=new Ww(L),this.tiles.set(L,M));const B=yield M.getHeader();return{data:{tiles:[`${t.url}/{z}/{x}/{y}`],minzoom:B.minZoom,maxzoom:B.maxZoom,bounds:[B.minLon,B.minLat,B.maxLon,B.maxLat]}}}const n=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),r=t.url.match(n);if(!r)throw new Error("Invalid PMTiles protocol URL");const s=r[1];let u=this.tiles.get(s);u||(u=new Ww(s),this.tiles.set(s,u));const p=r[2],c=r[3],b=r[4],S=yield u.getHeader(),T=yield u==null?void 0:u.getZxy(+p,+c,+b,e.signal);return T?{data:new Uint8Array(T.data),cacheControl:T.cacheControl,expires:T.expires}:S.tileType===1?{data:new Uint8Array}:{data:null}}),this.tile=s3(this.tilev4),this.tiles=new Map}add(t){this.tiles.set(t.source.getKey(),t)}get(t){return this.tiles.get(t)}};function qh(t,e){return(e>>>0)*4294967296+(t>>>0)}function a3(t,e){const n=e.buf;let r=n[e.pos++],s=(r&112)>>4;if(r<128||(r=n[e.pos++],s|=(r&127)<<3,r<128)||(r=n[e.pos++],s|=(r&127)<<10,r<128)||(r=n[e.pos++],s|=(r&127)<<17,r<128)||(r=n[e.pos++],s|=(r&127)<<24,r<128)||(r=n[e.pos++],s|=(r&1)<<31,r<128))return qh(t,s);throw new Error("Expected varint not more than 10 bytes")}function jf(t){const e=t.buf;let n=e[t.pos++],r=n&127;return n<128||(n=e[t.pos++],r|=(n&127)<<7,n<128)||(n=e[t.pos++],r|=(n&127)<<14,n<128)||(n=e[t.pos++],r|=(n&127)<<21,n<128)?r:(n=e[t.pos],r|=(n&15)<<28,a3(r,t))}function l3(t,e,n,r){if(r===0){n===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);const s=e[0];e[0]=e[1],e[1]=s}}var u3=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function c3(t,e,n){if(t>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(e>Qh(2,t)-1||n>Qh(2,t)-1)throw Error("tile x/y outside zoom level bounds");const r=u3[t],s=Qh(2,t);let u=0,p=0,c=0;const b=[e,n];let S=s/2;for(;S>0;)u=(b[0]&S)>0?1:0,p=(b[1]&S)>0?1:0,c+=S*S*(3*u^p),l3(S,b,u,p),S=S/2;return r+c}function II(t,e){return no(this,null,function*(){if(e===1||e===0)return t;if(e===2){if(typeof globalThis.DecompressionStream>"u")return Uv(new Uint8Array(t));const n=new Response(t).body;if(!n)throw Error("Failed to read response stream");const r=n.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(r).arrayBuffer()}throw Error("Compression method not supported")})}var h3=127;function p3(t,e){let n=0,r=t.length-1;for(;n<=r;){const s=r+n>>1,u=e-t[s].tileId;if(u>0)n=s+1;else if(u<0)r=s-1;else return t[s]}return r>=0&&(t[r].runLength===0||e-t[r].tileId=300)throw Error(`Bad response code: ${b.status}`);const T=b.headers.get("Content-Length");if(b.status===200&&(!T||+T>e))throw s&&s.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield b.arrayBuffer(),etag:S||void 0,cacheControl:b.headers.get("Cache-Control")||void 0,expires:b.headers.get("Expires")||void 0}})}};function na(t,e){const n=t.getUint32(e+4,!0),r=t.getUint32(e+0,!0);return n*Qh(2,32)+r}function d3(t,e){const n=new DataView(t),r=n.getUint8(7);if(r>3)throw Error(`Archive is spec version ${r} but this library supports up to spec version 3`);return{specVersion:r,rootDirectoryOffset:na(n,8),rootDirectoryLength:na(n,16),jsonMetadataOffset:na(n,24),jsonMetadataLength:na(n,32),leafDirectoryOffset:na(n,40),leafDirectoryLength:na(n,48),tileDataOffset:na(n,56),tileDataLength:na(n,64),numAddressedTiles:na(n,72),numTileEntries:na(n,80),numTileContents:na(n,88),clustered:n.getUint8(96)===1,internalCompression:n.getUint8(97),tileCompression:n.getUint8(98),tileType:n.getUint8(99),minZoom:n.getUint8(100),maxZoom:n.getUint8(101),minLon:n.getInt32(102,!0)/1e7,minLat:n.getInt32(106,!0)/1e7,maxLon:n.getInt32(110,!0)/1e7,maxLat:n.getInt32(114,!0)/1e7,centerZoom:n.getUint8(118),centerLon:n.getInt32(119,!0)/1e7,centerLat:n.getInt32(123,!0)/1e7,etag:e}}function CI(t){const e={buf:new Uint8Array(t),pos:0},n=jf(e),r=[];let s=0;for(let u=0;u0?r[u].offset=r[u-1].offset+r[u-1].length:r[u].offset=p-1}return r}function m3(t){const e=new DataView(t);return e.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):e.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var Vv=class extends Error{};function g3(t,e){return no(this,null,function*(){const n=yield t.getBytes(0,16384);if(new DataView(n.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(m3(n.data)<3)return[yield EI.getHeader(t)];const s=n.data.slice(0,h3),u=d3(s,n.etag),p=n.data.slice(u.rootDirectoryOffset,u.rootDirectoryOffset+u.rootDirectoryLength),c=`${t.getKey()}|${u.etag||""}|${u.rootDirectoryOffset}|${u.rootDirectoryLength}`,b=CI(yield e(p,u.internalCompression));return[u,[c,b.length,b]]})}function y3(t,e,n,r,s){return no(this,null,function*(){const u=yield t.getBytes(n,r,void 0,s.etag),p=yield e(u.data,s.internalCompression),c=CI(p);if(c.length===0)throw new Error("Empty directory is invalid");return c})}var _3=class{constructor(t=100,e=!0,n=II){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=t,this.counter=1,this.decompress=n}getHeader(t){return no(this,null,function*(){const e=t.getKey(),n=this.cache.get(e);if(n)return n.lastUsed=this.counter++,yield n.data;const r=new Promise((s,u)=>{g3(t,this.decompress).then(p=>{p[1]&&this.cache.set(p[1][0],{lastUsed:this.counter++,data:Promise.resolve(p[1][2])}),s(p[0]),this.prune()}).catch(p=>{u(p)})});return this.cache.set(e,{lastUsed:this.counter++,data:r}),r})}getDirectory(t,e,n,r){return no(this,null,function*(){const s=`${t.getKey()}|${r.etag||""}|${e}|${n}`,u=this.cache.get(s);if(u)return u.lastUsed=this.counter++,yield u.data;const p=new Promise((c,b)=>{y3(t,this.decompress,e,n,r).then(S=>{c(S),this.prune()}).catch(S=>{b(S)})});return this.cache.set(s,{lastUsed:this.counter++,data:p}),p})}getArrayBuffer(t,e,n,r){return no(this,null,function*(){const s=`${t.getKey()}|${r.etag||""}|${e}|${n}`,u=this.cache.get(s);if(u)return u.lastUsed=this.counter++,yield u.data;const p=new Promise((c,b)=>{t.getBytes(e,n,void 0,r.etag).then(S=>{c(S.data),this.cache.has(s),this.prune()}).catch(S=>{b(S)})});return this.cache.set(s,{lastUsed:this.counter++,data:p}),p})}prune(){if(this.cache.size>=this.maxCacheEntries){let t=1/0,e;this.cache.forEach((n,r)=>{n.lastUsed{this.getHeader(t).then(u=>{r(),this.invalidations.delete(e)}).catch(u=>{s(u)})});this.invalidations.set(e,n)})}},Ww=class{constructor(t,e,n){typeof t=="string"?this.source=new f3(t):this.source=t,n?this.decompress=n:this.decompress=II,e?this.cache=e:this.cache=new _3}getHeader(){return no(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(t,e,n,r){return no(this,null,function*(){const s=c3(t,e,n),u=yield this.cache.getHeader(this.source);if(u.specVersion<3)return EI.getZxy(u,this.source,this.cache,t,e,n,r);if(tu.maxZoom)return;let p=u.rootDirectoryOffset,c=u.rootDirectoryLength;for(let b=0;b<=3;b++){const S=yield this.cache.getDirectory(this.source,p,c,u),T=p3(S,s);if(T){if(T.runLength>0){const L=yield this.source.getBytes(u.tileDataOffset+T.offset,T.length,r,u.etag);return{data:yield this.decompress(L.data,u.tileCompression),cacheControl:L.cacheControl,expires:L.expires}}p=u.leafDirectoryOffset+T.offset,c=T.length}else return}throw Error("Maximum directory depth exceeded")})}getZxy(t,e,n,r){return no(this,null,function*(){try{return yield this.getZxyAttempt(t,e,n,r)}catch(s){if(s instanceof Vv)return this.cache.invalidate(this.source),yield this.getZxyAttempt(t,e,n,r);throw s}})}getMetadataAttempt(){return no(this,null,function*(){const t=yield this.cache.getHeader(this.source),e=yield this.source.getBytes(t.jsonMetadataOffset,t.jsonMetadataLength,void 0,t.etag),n=yield this.decompress(e.data,t.internalCompression),r=new TextDecoder("utf-8");return JSON.parse(r.decode(n))})}getMetadata(){return no(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(t){if(t instanceof Vv)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw t}})}};function v3(t){return t=="google"||t=="bing"}var Fi=[];for(var X_=0;X_<256;++X_)Fi.push((X_+256).toString(16).slice(1));function x3(t,e=0){return(Fi[t[e+0]]+Fi[t[e+1]]+Fi[t[e+2]]+Fi[t[e+3]]+"-"+Fi[t[e+4]]+Fi[t[e+5]]+"-"+Fi[t[e+6]]+Fi[t[e+7]]+"-"+Fi[t[e+8]]+Fi[t[e+9]]+"-"+Fi[t[e+10]]+Fi[t[e+11]]+Fi[t[e+12]]+Fi[t[e+13]]+Fi[t[e+14]]+Fi[t[e+15]]).toLowerCase()}var Ym,b3=new Uint8Array(16);function w3(){if(!Ym&&(Ym=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ym))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ym(b3)}var S3=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Zw={randomUUID:S3};function E3(t,e,n){if(Zw.randomUUID&&!e&&!t)return Zw.randomUUID();t=t||{};var r=t.random||(t.rng||w3)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(var s=0;s<16;++s)e[n+s]=r[s];return e}return x3(r)}const hz={hovering:"black",lineEndpointColor:"black"},pz=10,fz=10;function I3(){return C3(["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"])}function C3(t){return t[Math.floor(Math.random()*t.length)]}const dz=Tr(null),mz=Tr(null),gz=Tr(null),yz=Tr(new Set),T3=Tr(null),L3=Tr({mode:"list"});function _z(t){let e=new Set;for(let r of t.features)e.add(r.id);let n=e.size+1;for(;e.has(n);)n++;return n}function vz(t,e){console.log(`Deleting intervention ${e}`),t.update(n=>(n.features=n.features.filter(r=>r.id!=e),n)),T3.set(null),L3.set({mode:"list"})}function xz(t){return Object.values(t.schemes)[0].scheme_reference}function bz(t){return[Math.round(t[0]*1e7)/1e7,Math.round(t[1]*1e7)/1e7]}const A3=Tr(P3());A3.subscribe(t=>window.localStorage.setItem("userSettings",JSON.stringify(t)));function P3(){let t={streetViewImagery:"google",avoidDoublingBack:!1};try{let e=JSON.parse(window.localStorage.getItem("userSettings")||"{}");v3(e.streetViewImagery)&&(t.streetViewImagery=e.streetViewImagery),typeof e.avoidDoublingBack=="boolean"&&(t.avoidDoublingBack=e.avoidDoublingBack)}catch(e){console.log(`Couldn't parse userSettings from local storage: ${e}`)}return t}function wz(t){let e={type:"FeatureCollection",features:[],schemes:{}};return M3(t,e),e}function M3(t,e){let n=E3(),r=t.initializeEmptyScheme({scheme_reference:n,color:I3()});e.schemes[n]=r}let k3=Date.now();function py(t){return`${t}-${k3++}`}const O0=Symbol.for("svelte-maplibre");function Vc(){return FT(O0)}function D3(t){let e=new WeakMap;return n=>{var p;let r=e.get(n.originalEvent);if(r!==void 0)return r;let u=(p=n.target.queryRenderedFeatures(n.point).find(c=>{var b;return(b=t.get(c.layer.id))==null?void 0:b.interactive}))==null?void 0:p.layer.id;return e.set(n.originalEvent,u),u}}function R3(){let t=new Map;return jv(O0,{map:Tr(null),source:U_(null),layer:U_(null),popupTarget:U_(null),cluster:Tr(),loadedImages:Tr(new Set),minzoom:Tr(0),maxzoom:Tr(24),layerEvent:Tr(null),layerInfo:t,eventTopMost:D3(t)})}function Xw(t){return{subscribe:t.subscribe}}function z0({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let s=Vc(),u=Tr(null),p=Xw(u),c={...s,[t]:Xw(u)};if(e&&(c.popupTarget=p),r){let b=Tr(null);c.layerEvent=b,s.layerEvent=b}return n&&(c.cluster=Tr()),jv(O0,c),{...s,self:u}}function N3(){return z0({key:"source",setCluster:!0})}function O3(t=!0){return z0({key:"layer",setPopupTarget:t,setMouseEvent:t})}function Sz(){return z0({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function z3(t){return"layerType"in t&&t.layerType==="deckgl"}function Yw(t){let e;return n=>{if(n)for(let r in n){let s=e==null?void 0:e[r],u=n[r];s!==u&&t(r,u,s)}else if(e)for(let r in e)t(r,void 0,e[r]);e=n}}function F3(t,...e){let n=[t];for(let r of e)if(r)Array.isArray(r)&&r[0]===t?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function B3(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function Ez(t,e){return["case",["boolean",["feature-state","hover"],!1],e,t]}function Kw(t){let e=t[0],n,r,s=$w(t);return{c(){s.c(),n=Fl()},m(u,p){s.m(u,p),an(u,n,p),r=!0},p(u,p){p[0]&1&&Yn(e,e=u[0])?(_a(),Ae(s,1,1,Ur),va(),s=$w(u),s.c(),xe(s,1),s.m(n.parentNode,n)):s.p(u,p)},i(u){r||(xe(s),r=!0)},o(u){Ae(s),r=!1},d(u){u&&on(n),s.d(u)}}}function $w(t){let e;const n=t[36].default,r=zs(n,t,t[35],null);return{c(){r&&r.c()},m(s,u){r&&r.m(s,u),e=!0},p(s,u){r&&r.p&&(!e||u[1]&16)&&Bs(r,n,s,s[35],e?Fs(n,s[35],u,null):Us(s[35]),null)},i(s){e||(xe(r,s),e=!0)},o(s){Ae(r,s),e=!1},d(s){r&&r.d(s)}}}function U3(t){let e,n,r=t[0]&&Kw(t);return{c(){r&&r.c(),e=Fl()},m(s,u){r&&r.m(s,u),an(s,e,u),n=!0},p(s,u){s[0]?r?(r.p(s,u),u[0]&1&&xe(r,1)):(r=Kw(s),r.c(),xe(r,1),r.m(e.parentNode,e)):r&&(_a(),Ae(r,1,1,()=>{r=null}),va())},i(s){n||(xe(r),n=!0)},o(s){Ae(r),n=!1},d(s){s&&on(e),r&&r.d(s)}}}function V3(t,e,n){let r,s,u,p,c,b,S,T,L,M,B,R,{$$slots:W={},$$scope:et}=e,{id:st=py("layer")}=e,{source:ut=void 0}=e,{sourceLayer:gt=void 0}=e,{beforeId:St=void 0}=e,{beforeLayerType:Bt=void 0}=e,{type:zt}=e,{paint:Dt=void 0}=e,{layout:Lt=void 0}=e,{filter:Ut=void 0}=e,{applyToClusters:ie=void 0}=e,{minzoom:wt=void 0}=e,{maxzoom:se=void 0}=e,{manageHoverState:ge=!1}=e,{hovered:Vt=null}=e,{interactive:pe=!0}=e,{hoverCursor:be=void 0}=e,{eventsIfTopMost:ae=!1}=e;const Te=jg(),{map:tn,source:hn,self:He,minzoom:Me,maxzoom:Ze,eventTopMost:en,layerInfo:pn}=O3();Br(t,tn,ft=>n(31,L=ft)),Br(t,hn,ft=>n(32,M=ft)),Br(t,He,ft=>n(0,T=ft)),Br(t,Me,ft=>n(34,R=ft)),Br(t,Ze,ft=>n(33,B=ft)),Tl(()=>{T&&L&&(pn.delete(T),L==null||L.removeLayer(T))});let gn;function bn(ft){var Tt,li;if(!pe||!T||!L||ae&&en(ft)!==T)return;let Ct=ft.features??[],Ce=(li=(Tt=Ct[0])==null?void 0:Tt.properties)==null?void 0:li.cluster_id,kn={event:ft,map:L,clusterId:Ce,layer:T,source:c,features:Ct};Te(ft.type,kn)}function Bn(ft){var Tt,li;if(!pe||!T||!L||ae&&en(ft)!==T)return;be&&(L.getCanvas().style.cursor=be);let Ct=ft.features??[];n(6,Vt=Ct[0]??null);let Ce=(li=(Tt=Ct[0])==null?void 0:Tt.properties)==null?void 0:li.cluster_id;Te("mouseenter",{event:ft,map:L,clusterId:Ce,layer:T,source:c,features:Ct})}function ai(ft){var Tt,li,ba;if(!pe||!L)return;if(ae&&en(ft)!==T){n(6,Vt=null),ge&&gn!==void 0&&(L==null||L.setFeatureState({source:c,sourceLayer:gt,id:gn},{hover:!1}),gn=void 0);return}L.getCanvas().style.cursor=be;let Ct=ft.features??[],Ce=(li=(Tt=Ct[0])==null?void 0:Tt.properties)==null?void 0:li.cluster_id,kn=(ba=Ct[0])==null?void 0:ba.id;kn!==gn&&(ge&&(gn!==void 0&&(L==null||L.setFeatureState({source:c,id:gn,sourceLayer:gt},{hover:!1})),L==null||L.setFeatureState({source:c,id:kn,sourceLayer:gt},{hover:!0})),gn=kn,n(6,Vt=Ct[0]??null)),Te("mousemove",{event:ft,map:L,clusterId:Ce,layer:T,source:c,features:Ct})}function Kn(ft){if(!(!pe||!T||!L)){if(be&&(L.getCanvas().style.cursor=""),n(6,Vt=null),ge&&gn!==void 0){const Ct={source:c,id:gn,sourceLayer:gt};L==null||L.setFeatureState(Ct,{hover:!1}),gn=void 0}Te("mouseleave",{map:L,layer:T,source:c})}}let cr=!0;function jr(ft){L&&(L.off("click",ft,bn),L.off("dblclick",ft,bn),L.off("contextmenu",ft,bn),L.off("mouseenter",ft,Bn),L.off("mousemove",ft,ai),L.off("mouseleave",ft,Kn))}return Tl(()=>{L&&T&&jr(T)}),t.$$set=ft=>{"id"in ft&&n(7,st=ft.id),"source"in ft&&n(8,ut=ft.source),"sourceLayer"in ft&&n(9,gt=ft.sourceLayer),"beforeId"in ft&&n(10,St=ft.beforeId),"beforeLayerType"in ft&&n(11,Bt=ft.beforeLayerType),"type"in ft&&n(12,zt=ft.type),"paint"in ft&&n(13,Dt=ft.paint),"layout"in ft&&n(14,Lt=ft.layout),"filter"in ft&&n(15,Ut=ft.filter),"applyToClusters"in ft&&n(16,ie=ft.applyToClusters),"minzoom"in ft&&n(17,wt=ft.minzoom),"maxzoom"in ft&&n(18,se=ft.maxzoom),"manageHoverState"in ft&&n(19,ge=ft.manageHoverState),"hovered"in ft&&n(6,Vt=ft.hovered),"interactive"in ft&&n(20,pe=ft.interactive),"hoverCursor"in ft&&n(21,be=ft.hoverCursor),"eventsIfTopMost"in ft&&n(22,ae=ft.eventsIfTopMost),"$$scope"in ft&&n(35,et=ft.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=B3(ie)),t.$$.dirty[0]&1073774592&&n(24,s=F3("all",r,Ut)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,u=wt??R),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,p=se??B),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,c=ut||M),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&L&&T!==st&&c){T&&(jr(T),pn.delete(T));let ft=St;if(!St&&Bt){let Ct=L.getStyle().layers,Ce=typeof Bt=="function"?Bt:Tt=>Tt.type===Bt,kn=Ct==null?void 0:Ct.find(Ce);kn&&(ft=kn.id)}El(He,T=st,T),L.addLayer(Gg({id:T,type:zt,source:c,"source-layer":gt,filter:s,paint:Dt,layout:Lt,minzoom:u,maxzoom:p}),ft),n(23,cr=!0),L.on("click",T,bn),L.on("dblclick",T,bn),L.on("contextmenu",T,bn),L.on("mouseenter",T,Bn),L.on("mousemove",T,ai),L.on("mouseleave",T,Kn)}t.$$.dirty[0]&1048577&&T&&pn.set(T,{interactive:pe}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,b=T?Yw((ft,Ct)=>L==null?void 0:L.setPaintProperty(T,ft,Ct)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,S=T?Yw((ft,Ct)=>L==null?void 0:L.setLayoutProperty(T,ft,Ct)):void 0),t.$$.dirty[0]&268443648&&(b==null||b(Dt)),t.$$.dirty[0]&134234112&&(S==null||S(Lt)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&T&&(L==null||L.setLayerZoomRange(T,u,p)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&T&&(cr?n(23,cr=!1):L==null||L.setFilter(T,s))},[T,tn,hn,He,Me,Ze,Vt,st,ut,gt,St,Bt,zt,Dt,Lt,Ut,ie,wt,se,ge,pe,be,ae,cr,s,p,u,S,b,c,r,L,M,B,R,et,W]}class TI extends wr{constructor(e){super(),br(this,e,V3,U3,Yn,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}}function G3(t){let e;const n=t[15].default,r=zs(n,t,t[23],null);return{c(){r&&r.c()},m(s,u){r&&r.m(s,u),e=!0},p(s,u){r&&r.p&&(!e||u&8388608)&&Bs(r,n,s,s[23],e?Fs(n,s[23],u,null):Us(s[23]),null)},i(s){e||(xe(r,s),e=!0)},o(s){Ae(r,s),e=!1},d(s){r&&r.d(s)}}}function q3(t){let e,n,r;function s(p){t[16](p)}let u={id:t[1],type:"fill",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[G3]},$$scope:{ctx:t}};return t[0]!==void 0&&(u.hovered=t[0]),e=new TI({props:u}),Ll.push(()=>hg(e,"hovered",s)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){Eo(e.$$.fragment)},m(p,c){ro(e,p,c),r=!0},p(p,[c]){const b={};c&2&&(b.id=p[1]),c&4&&(b.source=p[2]),c&8&&(b.sourceLayer=p[3]),c&16&&(b.beforeId=p[4]),c&32&&(b.beforeLayerType=p[5]),c&64&&(b.paint=p[6]),c&128&&(b.layout=p[7]),c&256&&(b.filter=p[8]),c&512&&(b.minzoom=p[9]),c&1024&&(b.maxzoom=p[10]),c&2048&&(b.hoverCursor=p[11]),c&4096&&(b.manageHoverState=p[12]),c&8192&&(b.eventsIfTopMost=p[13]),c&16384&&(b.interactive=p[14]),c&8388608&&(b.$$scope={dirty:c,ctx:p}),!n&&c&1&&(n=!0,b.hovered=p[0],cg(()=>n=!1)),e.$set(b)},i(p){r||(xe(e.$$.fragment,p),r=!0)},o(p){Ae(e.$$.fragment,p),r=!1},d(p){io(e,p)}}}function j3(t,e,n){let{$$slots:r={},$$scope:s}=e,{id:u=py("fill")}=e,{source:p=void 0}=e,{sourceLayer:c=void 0}=e,{beforeId:b=void 0}=e,{beforeLayerType:S=void 0}=e,{paint:T}=e,{layout:L=void 0}=e,{filter:M=void 0}=e,{minzoom:B=void 0}=e,{maxzoom:R=void 0}=e,{hoverCursor:W=void 0}=e,{manageHoverState:et=!1}=e,{hovered:st=null}=e,{eventsIfTopMost:ut=!1}=e,{interactive:gt=!0}=e;function St(wt){st=wt,n(0,st)}function Bt(wt){Ui.call(this,t,wt)}function zt(wt){Ui.call(this,t,wt)}function Dt(wt){Ui.call(this,t,wt)}function Lt(wt){Ui.call(this,t,wt)}function Ut(wt){Ui.call(this,t,wt)}function ie(wt){Ui.call(this,t,wt)}return t.$$set=wt=>{"id"in wt&&n(1,u=wt.id),"source"in wt&&n(2,p=wt.source),"sourceLayer"in wt&&n(3,c=wt.sourceLayer),"beforeId"in wt&&n(4,b=wt.beforeId),"beforeLayerType"in wt&&n(5,S=wt.beforeLayerType),"paint"in wt&&n(6,T=wt.paint),"layout"in wt&&n(7,L=wt.layout),"filter"in wt&&n(8,M=wt.filter),"minzoom"in wt&&n(9,B=wt.minzoom),"maxzoom"in wt&&n(10,R=wt.maxzoom),"hoverCursor"in wt&&n(11,W=wt.hoverCursor),"manageHoverState"in wt&&n(12,et=wt.manageHoverState),"hovered"in wt&&n(0,st=wt.hovered),"eventsIfTopMost"in wt&&n(13,ut=wt.eventsIfTopMost),"interactive"in wt&&n(14,gt=wt.interactive),"$$scope"in wt&&n(23,s=wt.$$scope)},[st,u,p,c,b,S,T,L,M,B,R,W,et,ut,gt,r,St,Bt,zt,Dt,Lt,Ut,ie,s]}class Iz extends wr{constructor(e){super(),br(this,e,j3,q3,Yn,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function H3(t,e,n){let r;const{map:s}=Vc();Br(t,s,b=>n(4,r=b));let{position:u="top-left"}=e,{container:p=void 0}=e,c=null;return Tl(()=>{r!=null&&r.loaded()&&c&&r.removeControl(c)}),t.$$set=b=>{"position"in b&&n(1,u=b.position),"container"in b&&n(2,p=b.container)},t.$$.update=()=>{if(t.$$.dirty&30&&r&&!c){let b;typeof p=="string"?b=document.querySelector(p)??void 0:b=p,n(3,c=new ia.FullscreenControl({container:b})),r.addControl(c,u)}},[s,u,p,c,r]}class W3 extends wr{constructor(e){super(),br(this,e,H3,null,Yn,{position:1,container:2})}}function Z3(t,e,n,r,s){let u=!1;t.getSource(e)&&(u=!0,t.removeSource(e));const p=()=>{r(e)&&(t.addSource(e,n),s())};if(u){const c=()=>{e&&(t.getSource(e)?setTimeout(c,1):p())};c()}else p()}function X3(t,e,n){BT().then(()=>{let r=h2(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function Jw(t){let e=t[0],n,r,s=Qw(t);return{c(){s.c(),n=Fl()},m(u,p){s.m(u,p),an(u,n,p),r=!0},p(u,p){p&1&&Yn(e,e=u[0])?(_a(),Ae(s,1,1,Ur),va(),s=Qw(u),s.c(),xe(s,1),s.m(n.parentNode,n)):s.p(u,p)},i(u){r||(xe(s),r=!0)},o(u){Ae(s),r=!1},d(u){u&&on(n),s.d(u)}}}function Qw(t){let e;const n=t[19].default,r=zs(n,t,t[18],null);return{c(){r&&r.c()},m(s,u){r&&r.m(s,u),e=!0},p(s,u){r&&r.p&&(!e||u&262144)&&Bs(r,n,s,s[18],e?Fs(n,s[18],u,null):Us(s[18]),null)},i(s){e||(xe(r,s),e=!0)},o(s){Ae(r,s),e=!1},d(s){r&&r.d(s)}}}function Y3(t){let e,n,r=t[0]&&Jw(t);return{c(){r&&r.c(),e=Fl()},m(s,u){r&&r.m(s,u),an(s,e,u),n=!0},p(s,[u]){s[0]?r?(r.p(s,u),u&1&&xe(r,1)):(r=Jw(s),r.c(),xe(r,1),r.m(e.parentNode,e)):r&&(_a(),Ae(r,1,1,()=>{r=null}),va())},i(s){n||(xe(r),n=!0)},o(s){Ae(r),n=!1},d(s){s&&on(e),r&&r.d(s)}}}function K3(t,e,n){let r,s,u,{$$slots:p={},$$scope:c}=e,{id:b=py("geojson")}=e,{data:S}=e,{generateId:T=!1}=e,{promoteId:L=void 0}=e,{filter:M=void 0}=e,{lineMetrics:B=void 0}=e,{cluster:R=void 0}=e,{maxzoom:W=void 0}=e,{attribution:et=void 0}=e,{buffer:st=void 0}=e,{tolerance:ut=void 0}=e;const{map:gt,cluster:St,self:Bt}=N3();Br(t,gt,Lt=>n(17,s=Lt)),Br(t,St,Lt=>n(20,u=Lt)),Br(t,Bt,Lt=>n(0,r=Lt));let zt,Dt=!0;return Tl(()=>{r&&zt&&s&&(X3(gt,r,zt),El(Bt,r=null,r),n(15,zt=void 0))}),t.$$set=Lt=>{"id"in Lt&&n(4,b=Lt.id),"data"in Lt&&n(5,S=Lt.data),"generateId"in Lt&&n(6,T=Lt.generateId),"promoteId"in Lt&&n(7,L=Lt.promoteId),"filter"in Lt&&n(8,M=Lt.filter),"lineMetrics"in Lt&&n(9,B=Lt.lineMetrics),"cluster"in Lt&&n(10,R=Lt.cluster),"maxzoom"in Lt&&n(11,W=Lt.maxzoom),"attribution"in Lt&&n(12,et=Lt.attribution),"buffer"in Lt&&n(13,st=Lt.buffer),"tolerance"in Lt&&n(14,ut=Lt.tolerance),"$$scope"in Lt&&n(18,c=Lt.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&El(St,u=R,u),t.$$.dirty&196593&&s&&r!==b&&(El(Bt,r=b,r),Z3(s,r,Gg({type:"geojson",data:S,filter:M,lineMetrics:B,generateId:T,promoteId:L,cluster:!!R,clusterMinPoints:R==null?void 0:R.minPoints,clusterMaxZoom:R==null?void 0:R.maxZoom,clusterRadius:R==null?void 0:R.radius,clusterProperties:R==null?void 0:R.properties,maxzoom:W,attribution:et,buffer:st,tolerance:ut}),Lt=>s&&Lt===r,()=>{r&&(n(15,zt=s==null?void 0:s.getSource(r)),n(16,Dt=!0))})),t.$$.dirty&131088&&(s==null||s.on("style.load",()=>{n(15,zt=s==null?void 0:s.getSource(b))})),t.$$.dirty&98336&&zt&&(Dt?n(16,Dt=!1):zt.setData(S)),t.$$.dirty&33792&&(zt==null||zt.setClusterOptions(Gg({cluster:!!R,clusterMaxZoom:R==null?void 0:R.maxZoom,clusterRadius:R==null?void 0:R.radius})))},[r,gt,St,Bt,b,S,T,L,M,B,R,W,et,st,ut,zt,Dt,s,c,p]}class Cz extends wr{constructor(e){super(),br(this,e,K3,Y3,Yn,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10,maxzoom:11,attribution:12,buffer:13,tolerance:14})}}function $3(t,e,n){let r;const{map:s}=Vc();Br(t,s,M=>n(8,r=M));let{position:u="top-left"}=e,{positionOptions:p=void 0}=e,{fitBoundsOptions:c=void 0}=e,{trackUserLocation:b=!1}=e,{showAccuracyCircle:S=!0}=e,{showUserLocation:T=!0}=e,{control:L=null}=e;return Tl(()=>{r!=null&&r.loaded()&&L&&r.removeControl(L)}),t.$$set=M=>{"position"in M&&n(2,u=M.position),"positionOptions"in M&&n(3,p=M.positionOptions),"fitBoundsOptions"in M&&n(4,c=M.fitBoundsOptions),"trackUserLocation"in M&&n(5,b=M.trackUserLocation),"showAccuracyCircle"in M&&n(6,S=M.showAccuracyCircle),"showUserLocation"in M&&n(7,T=M.showUserLocation),"control"in M&&n(1,L=M.control)},t.$$.update=()=>{t.$$.dirty&510&&r&&!L&&(n(1,L=new ia.GeolocateControl({positionOptions:p,fitBoundsOptions:c,trackUserLocation:b,showAccuracyCircle:S,showUserLocation:T})),r.addControl(L,u))},[s,L,u,p,c,b,S,T,r]}class J3 extends wr{constructor(e){super(),br(this,e,$3,null,Yn,{position:2,positionOptions:3,fitBoundsOptions:4,trackUserLocation:5,showAccuracyCircle:6,showUserLocation:7,control:1})}}function Q3(t){let e;const n=t[15].default,r=zs(n,t,t[23],null);return{c(){r&&r.c()},m(s,u){r&&r.m(s,u),e=!0},p(s,u){r&&r.p&&(!e||u&8388608)&&Bs(r,n,s,s[23],e?Fs(n,s[23],u,null):Us(s[23]),null)},i(s){e||(xe(r,s),e=!0)},o(s){Ae(r,s),e=!1},d(s){r&&r.d(s)}}}function t4(t){let e,n,r;function s(p){t[16](p)}let u={id:t[1],type:"line",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[Q3]},$$scope:{ctx:t}};return t[0]!==void 0&&(u.hovered=t[0]),e=new TI({props:u}),Ll.push(()=>hg(e,"hovered",s)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){Eo(e.$$.fragment)},m(p,c){ro(e,p,c),r=!0},p(p,[c]){const b={};c&2&&(b.id=p[1]),c&4&&(b.source=p[2]),c&8&&(b.sourceLayer=p[3]),c&16&&(b.beforeId=p[4]),c&32&&(b.beforeLayerType=p[5]),c&64&&(b.paint=p[6]),c&128&&(b.layout=p[7]),c&256&&(b.filter=p[8]),c&512&&(b.minzoom=p[9]),c&1024&&(b.maxzoom=p[10]),c&2048&&(b.hoverCursor=p[11]),c&4096&&(b.manageHoverState=p[12]),c&8192&&(b.eventsIfTopMost=p[13]),c&16384&&(b.interactive=p[14]),c&8388608&&(b.$$scope={dirty:c,ctx:p}),!n&&c&1&&(n=!0,b.hovered=p[0],cg(()=>n=!1)),e.$set(b)},i(p){r||(xe(e.$$.fragment,p),r=!0)},o(p){Ae(e.$$.fragment,p),r=!1},d(p){io(e,p)}}}function e4(t,e,n){let{$$slots:r={},$$scope:s}=e,{id:u=py("line")}=e,{source:p=void 0}=e,{sourceLayer:c=void 0}=e,{beforeId:b=void 0}=e,{beforeLayerType:S=void 0}=e,{paint:T}=e,{layout:L=void 0}=e,{filter:M=void 0}=e,{minzoom:B=void 0}=e,{maxzoom:R=void 0}=e,{hoverCursor:W=void 0}=e,{manageHoverState:et=!1}=e,{hovered:st=null}=e,{eventsIfTopMost:ut=!1}=e,{interactive:gt=!0}=e;function St(wt){st=wt,n(0,st)}function Bt(wt){Ui.call(this,t,wt)}function zt(wt){Ui.call(this,t,wt)}function Dt(wt){Ui.call(this,t,wt)}function Lt(wt){Ui.call(this,t,wt)}function Ut(wt){Ui.call(this,t,wt)}function ie(wt){Ui.call(this,t,wt)}return t.$$set=wt=>{"id"in wt&&n(1,u=wt.id),"source"in wt&&n(2,p=wt.source),"sourceLayer"in wt&&n(3,c=wt.sourceLayer),"beforeId"in wt&&n(4,b=wt.beforeId),"beforeLayerType"in wt&&n(5,S=wt.beforeLayerType),"paint"in wt&&n(6,T=wt.paint),"layout"in wt&&n(7,L=wt.layout),"filter"in wt&&n(8,M=wt.filter),"minzoom"in wt&&n(9,B=wt.minzoom),"maxzoom"in wt&&n(10,R=wt.maxzoom),"hoverCursor"in wt&&n(11,W=wt.hoverCursor),"manageHoverState"in wt&&n(12,et=wt.manageHoverState),"hovered"in wt&&n(0,st=wt.hovered),"eventsIfTopMost"in wt&&n(13,ut=wt.eventsIfTopMost),"interactive"in wt&&n(14,gt=wt.interactive),"$$scope"in wt&&n(23,s=wt.$$scope)},[st,u,p,c,b,S,T,L,M,B,R,W,et,ut,gt,r,St,Bt,zt,Dt,Lt,Ut,ie,s]}class Tz extends wr{constructor(e){super(),br(this,e,e4,t4,Yn,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function n4(t,e,n){let r;const s=jg();let{layer:u=void 0}=e;const{map:p}=Vc();Br(t,p,T=>n(2,r=T));function c(T){s(T.type,{...T,map:p})}const b=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","contextmenu","mouseover","mouseout"],S=["click","dblclick","contextmenu","mousemove","movestart","moveend","zoomstart","zoom","zoomend"];return Tl(()=>{if(r)if(u)for(const T of b)r.off(T,u,c);else for(const T of S)r.off(T,c)}),t.$$set=T=>{"layer"in T&&n(1,u=T.layer)},t.$$.update=()=>{if(t.$$.dirty&6&&r)if(u)for(const T of b)r.on(T,u,c);else for(const T of S)r.on(T,c)},[p,u,r]}class r4 extends wr{constructor(e){super(),br(this,e,n4,null,Yn,{layer:1})}}function i4(t){let e=t.getCenter(),n=Math.round(t.getZoom()*100)/100,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),s=Math.pow(10,r),u=Math.round(e.lat*s)/s,p=Math.round(e.lng*s)/s,c=`${n}/${u}/${p}`,b=t.getBearing(),S=t.getPitch();return(b||S)&&(c+=`/${Math.round(b*10)/10}`),S&&(c+=`/${Math.round(S)}`),`#${c}`}function o4(t){return t.replace("#","").split("/").map(parseFloat)}function s4(t,e,n){let r;const{map:s}=Vc();Br(t,s,T=>n(6,r=T));let{position:u="top-left"}=e,{showCompass:p=!0}=e,{showZoom:c=!0}=e,{visualizePitch:b=!1}=e,S=null;return Tl(()=>{r!=null&&r.loaded()&&S&&r.removeControl(S)}),t.$$set=T=>{"position"in T&&n(1,u=T.position),"showCompass"in T&&n(2,p=T.showCompass),"showZoom"in T&&n(3,c=T.showZoom),"visualizePitch"in T&&n(4,b=T.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&r&&!S&&(n(5,S=new ia.NavigationControl({showCompass:p,showZoom:c,visualizePitch:b})),r.addControl(S,u))},[s,u,p,c,b,S,r]}class LI extends wr{constructor(e){super(),br(this,e,s4,null,Yn,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function a4(t,e,n){let r;const{map:s}=Vc();Br(t,s,S=>n(5,r=S));let{position:u="bottom-left"}=e,{maxWidth:p=void 0}=e,{unit:c="metric"}=e,b=null;return Tl(()=>{r!=null&&r.loaded()&&b&&r.removeControl(b)}),t.$$set=S=>{"position"in S&&n(1,u=S.position),"maxWidth"in S&&n(2,p=S.maxWidth),"unit"in S&&n(3,c=S.unit)},t.$$.update=()=>{t.$$.dirty&62&&r&&!b&&(n(4,b=new ia.ScaleControl({maxWidth:p,unit:c})),r.addControl(b,u))},[s,u,p,c,b,r]}class AI extends wr{constructor(e){super(),br(this,e,a4,null,Yn,{position:1,maxWidth:2,unit:3})}}const{window:l4}=AT,u4=t=>({map:t[0]&16,loadedImages:t[0]&32,allImagesLoaded:t[0]&64}),t2=t=>({map:t[4],loadedImages:t[5],allImagesLoaded:t[6]});function e2(t){let e,n,r=t[3]&&n2(t);const s=t[40].default,u=zs(s,t,t[39],t2);return{c(){r&&r.c(),e=yi(),u&&u.c()},m(p,c){r&&r.m(p,c),an(p,e,c),u&&u.m(p,c),n=!0},p(p,c){p[3]?r?(r.p(p,c),c[0]&8&&xe(r,1)):(r=n2(p),r.c(),xe(r,1),r.m(e.parentNode,e)):r&&(_a(),Ae(r,1,1,()=>{r=null}),va()),u&&u.p&&(!n||c[0]&112|c[1]&256)&&Bs(u,s,p,p[39],n?Fs(s,p[39],c,u4):Us(p[39]),t2)},i(p){n||(xe(r),xe(u,p),n=!0)},o(p){Ae(r),Ae(u,p),n=!1},d(p){p&&on(e),r&&r.d(p),u&&u.d(p)}}}function n2(t){let e,n,r,s,u,p,c,b;return e=new LI({props:{position:t[7]}}),r=new J3({props:{position:t[7],fitBoundsOptions:{maxZoom:12}}}),u=new W3({props:{position:t[7]}}),c=new AI({props:{position:t[7]}}),{c(){Eo(e.$$.fragment),n=yi(),Eo(r.$$.fragment),s=yi(),Eo(u.$$.fragment),p=yi(),Eo(c.$$.fragment)},m(S,T){ro(e,S,T),an(S,n,T),ro(r,S,T),an(S,s,T),ro(u,S,T),an(S,p,T),ro(c,S,T),b=!0},p(S,T){const L={};T[0]&128&&(L.position=S[7]),e.$set(L);const M={};T[0]&128&&(M.position=S[7]),r.$set(M);const B={};T[0]&128&&(B.position=S[7]),u.$set(B);const R={};T[0]&128&&(R.position=S[7]),c.$set(R)},i(S){b||(xe(e.$$.fragment,S),xe(r.$$.fragment,S),xe(u.$$.fragment,S),xe(c.$$.fragment,S),b=!0)},o(S){Ae(e.$$.fragment,S),Ae(r.$$.fragment,S),Ae(u.$$.fragment,S),Ae(c.$$.fragment,S),b=!1},d(S){S&&(on(n),on(s),on(p)),io(e,S),io(r,S),io(u,S),io(c,S)}}}function c4(t){let e,n,r,s,u,p=t[4]&&t[0]&&e2(t);return{c(){e=An("div"),p&&p.c(),We(e,"class",n=dx(t[2])+" svelte-p00lfq"),We(e,"data-testid","map-container"),za(e,"expand-map",!t[2])},m(c,b){an(c,e,b),p&&p.m(e,null),t[41](e),r=!0,s||(u=[Ba(l4,"hashchange",t[11]),LT(t[10].call(null,e))],s=!0)},p(c,b){c[4]&&c[0]?p?(p.p(c,b),b[0]&17&&xe(p,1)):(p=e2(c),p.c(),xe(p,1),p.m(e,null)):p&&(_a(),Ae(p,1,1,()=>{p=null}),va()),(!r||b[0]&4&&n!==(n=dx(c[2])+" svelte-p00lfq"))&&We(e,"class",n),(!r||b[0]&4)&&za(e,"expand-map",!c[2])},i(c){r||(xe(p),r=!0)},o(c){Ae(p),r=!1},d(c){c&&on(e),p&&p.d(),t[41](null),s=!1,Ya(u)}}}function h4(t,e,n){let r,s,u,p,{$$slots:c={},$$scope:b}=e,{map:S=null}=e,{mapContainer:T=void 0}=e,{class:L=void 0}=e,{style:M}=e,{diffStyleUpdates:B=!1}=e,{center:R=void 0}=e,{zoom:W=void 0}=e,{pitch:et=0}=e,{bearing:st=0}=e,{bounds:ut=void 0}=e,{hash:gt=!1}=e,{updateHash:St=ft=>{window.history.replaceState(window.history.state,"",ft)}}=e,{loaded:Bt=!1}=e,{minZoom:zt=0}=e,{maxZoom:Dt=22}=e,{antialias:Lt=void 0}=e,{zoomOnDoubleClick:Ut=!0}=e,{locale:ie=void 0}=e,{interactive:wt=!0}=e,{attributionControl:se=!0}=e,{cooperativeGestures:ge=!1}=e,{preserveDrawingBuffer:Vt=!1}=e,{maxBounds:pe=void 0}=e,{images:be=[]}=e,{standardControls:ae=!1}=e,{filterLayers:Te=void 0}=e,{transformRequest:tn=void 0}=e;const hn=jg(),{map:He,loadedImages:Me}=R3();Br(t,He,ft=>n(4,u=ft)),Br(t,Me,ft=>n(5,p=ft));let Ze=new Set;async function en(ft,Ct=!1){if(u&&!(!u.loaded()&&!Ct))if("url"in ft){Ze.add(ft.id);try{let Ce=await u.loadImage(ft.url);u==null||u.addImage(ft.id,Ce.data,ft.options),p.add(ft.id),Me.set(p)}catch(Ce){hn("error",Ce)}finally{Ze.delete(ft.id)}}else u.addImage(ft.id,ft.data,ft.options),p.add(ft.id),Me.set(p)}let pn,gn,bn,Bn;function ai(ft){return cr(),El(He,u=new ia.Map(Gg({container:ft,style:M,locale:ie,center:R,zoom:W,pitch:et,bearing:st,minZoom:zt,maxZoom:Dt,antialias:Lt,interactive:wt,preserveDrawingBuffer:Vt,maxBounds:pe,bounds:ut,attributionControl:se,transformRequest:tn,cooperativeGestures:ge})),u),u.on("load",Ct=>{Ct.target.getContainer().setAttribute("data-testid","map"),Ct.target.getCanvas().setAttribute("data-testid","map-canvas"),n(0,Bt=!0),hn("load",u)}),u.on("error",Ct=>hn("error",{...Ct,map:u})),u.on("movestart",Ct=>hn("movestart",{...Ct,map:u})),u.on("moveend",Ct=>{if(n(12,R=Ct.target.getCenter()),n(13,W=Ct.target.getZoom()),n(14,et=Ct.target.getPitch()),n(15,st=Ct.target.getBearing()),n(16,ut=Ct.target.getBounds()),hn("moveend",{...Ct,map:u}),gt){let Ce=new URL(window.location.href.replace(/(#.+)?$/,i4(u)));St(Ce)}}),u.on("click",Ct=>hn("click",{...Ct,map:u})),u.on("dblclick",Ct=>hn("dblclick",{...Ct,map:u})),u.on("contextmenu",Ct=>hn("contextmenu",{...Ct,map:u})),u.on("zoomstart",Ct=>hn("zoomstart",{...Ct,map:u})),u.on("zoom",Ct=>{hn("zoom",{...Ct,map:u})}),u.on("zoomend",Ct=>{hn("zoomend",{...Ct,map:u})}),u.on("style.load",()=>{if(u){const Ct=u.getStyle();if(n(36,pn=Ct.layers.map(Ce=>Ce.id)),n(37,gn=Object.keys(Ct.sources)),Bn)for(const[Ce,kn]of Object.entries(Bn))u.addSource(Ce,kn);if(bn)for(const Ce of bn)u.addLayer(Ce);for(const Ce of be)en(Ce,!0)}}),u.on("styledata",Ct=>{if(u&&Te){const Ce=u.getStyle().layers;if(Ce)for(let kn of Ce)Te(kn)||u.setLayoutProperty(kn.id,"visibility","none")}hn("styledata",{...Ct,map:u})}),{destroy(){n(0,Bt=!1),u==null||u.remove(),El(He,u=null,u)}}}let Kn=M;function cr(){if(gt){let ft=o4(window.location.hash);ft.length>=3&&(n(13,W=ft[0]),n(12,R=[ft[2],ft[1]])),ft.length==5&&(n(15,st=ft[3]),n(14,et=ft[4]))}}function jr(ft){Ll[ft?"unshift":"push"](()=>{T=ft,n(1,T)})}return t.$$set=ft=>{"map"in ft&&n(17,S=ft.map),"mapContainer"in ft&&n(1,T=ft.mapContainer),"class"in ft&&n(2,L=ft.class),"style"in ft&&n(18,M=ft.style),"diffStyleUpdates"in ft&&n(19,B=ft.diffStyleUpdates),"center"in ft&&n(12,R=ft.center),"zoom"in ft&&n(13,W=ft.zoom),"pitch"in ft&&n(14,et=ft.pitch),"bearing"in ft&&n(15,st=ft.bearing),"bounds"in ft&&n(16,ut=ft.bounds),"hash"in ft&&n(20,gt=ft.hash),"updateHash"in ft&&n(21,St=ft.updateHash),"loaded"in ft&&n(0,Bt=ft.loaded),"minZoom"in ft&&n(22,zt=ft.minZoom),"maxZoom"in ft&&n(23,Dt=ft.maxZoom),"antialias"in ft&&n(24,Lt=ft.antialias),"zoomOnDoubleClick"in ft&&n(25,Ut=ft.zoomOnDoubleClick),"locale"in ft&&n(26,ie=ft.locale),"interactive"in ft&&n(27,wt=ft.interactive),"attributionControl"in ft&&n(28,se=ft.attributionControl),"cooperativeGestures"in ft&&n(29,ge=ft.cooperativeGestures),"preserveDrawingBuffer"in ft&&n(30,Vt=ft.preserveDrawingBuffer),"maxBounds"in ft&&n(31,pe=ft.maxBounds),"images"in ft&&n(32,be=ft.images),"standardControls"in ft&&n(3,ae=ft.standardControls),"filterLayers"in ft&&n(33,Te=ft.filterLayers),"transformRequest"in ft&&n(34,tn=ft.transformRequest),"$$scope"in ft&&n(39,b=ft.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&8&&n(7,r=typeof ae=="boolean"?void 0:ae),t.$$.dirty[0]&16&&n(17,S=u),t.$$.dirty[0]&786448|t.$$.dirty[1]&224&&u&&!Gh(M,Kn)){const ft=u.getStyle();if(pn&&(bn=ft.layers.filter(Ct=>!pn.includes(Ct.id))),gn){const Ct=Object.keys(ft.sources).filter(Ce=>!gn.includes(Ce));Bn={};for(const Ce of Ct)Bn[Ce]=ft.sources[Ce]}n(38,Kn=M),u.setStyle(M,{diff:B}),El(Me,p=new Set,p),n(35,Ze=new Set)}if(t.$$.dirty[0]&49|t.$$.dirty[1]&18&&Bt&&u!=null&&u.loaded())for(let ft of be)!p.has(ft.id)&&!Ze.has(ft.id)&&!u.hasImage(ft.id)&&en(ft);if(t.$$.dirty[0]&32|t.$$.dirty[1]&2&&n(6,s=be.every(ft=>p.has(ft.id))),t.$$.dirty[0]&61456&&u){let ft={};R!=null&&!Gh(R,u==null?void 0:u.getCenter())&&(ft.center=R),W!=null&&!Gh(W,u==null?void 0:u.getZoom())&&(ft.zoom=W),st!=null&&!Gh(st,u==null?void 0:u.getBearing())&&(ft.bearing=st),et!=null&&!Gh(et,u==null?void 0:u.getPitch())&&(ft.pitch=et),Object.keys(ft).length&&u.easeTo(ft)}t.$$.dirty[0]&65552&&ut&&!Gh(ut,u==null?void 0:u.getBounds())&&(u==null||u.fitBounds(ut)),t.$$.dirty[0]&33554448&&(Ut?u==null||u.doubleClickZoom.enable():u==null||u.doubleClickZoom.disable())},[Bt,T,L,ae,u,p,s,r,He,Me,ai,cr,R,W,et,st,ut,S,M,B,gt,St,zt,Dt,Lt,Ut,ie,wt,se,ge,Vt,pe,be,Te,tn,Ze,pn,gn,Kn,b,c,jr]}class p4 extends wr{constructor(e){super(),br(this,e,h4,c4,Yn,{map:17,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:14,bearing:15,bounds:16,hash:20,updateHash:21,loaded:0,minZoom:22,maxZoom:23,antialias:24,zoomOnDoubleClick:25,locale:26,interactive:27,attributionControl:28,cooperativeGestures:29,preserveDrawingBuffer:30,maxBounds:31,images:32,standardControls:3,filterLayers:33,transformRequest:34},null,[-1,-1])}}const f4=t=>({features:t[0]&16,data:t[0]&16,map:t[0]&4,close:t[0]&1}),r2=t=>{var e;return{features:t[4],data:(e=t[4])==null?void 0:e[0],map:t[2],close:t[31]}};function i2(t){let e,n,r=(t[4]||t[3]instanceof ia.Marker)&&o2(t);return{c(){e=An("div"),r&&r.c()},m(s,u){an(s,e,u),r&&r.m(e,null),t[32](e),n=!0},p(s,u){s[4]||s[3]instanceof ia.Marker?r?(r.p(s,u),u[0]&24&&xe(r,1)):(r=o2(s),r.c(),xe(r,1),r.m(e,null)):r&&(_a(),Ae(r,1,1,()=>{r=null}),va())},i(s){n||(xe(r),n=!0)},o(s){Ae(r),n=!1},d(s){s&&on(e),r&&r.d(),t[32](null)}}}function o2(t){let e;const n=t[30].default,r=zs(n,t,t[29],r2);return{c(){r&&r.c()},m(s,u){r&&r.m(s,u),e=!0},p(s,u){r&&r.p&&(!e||u[0]&536870933)&&Bs(r,n,s,s[29],e?Fs(n,s[29],u,f4):Us(s[29]),r2)},i(s){e||(xe(r,s),e=!0)},o(s){Ae(r,s),e=!1},d(s){r&&r.d(s)}}}function d4(t){let e,n,r=t[9].default&&i2(t);return{c(){r&&r.c(),e=Fl()},m(s,u){r&&r.m(s,u),an(s,e,u),n=!0},p(s,u){s[9].default?r?(r.p(s,u),u[0]&512&&xe(r,1)):(r=i2(s),r.c(),xe(r,1),r.m(e.parentNode,e)):r&&(_a(),Ae(r,1,1,()=>{r=null}),va())},i(s){n||(xe(r),n=!0)},o(s){Ae(r),n=!1},d(s){s&&on(e),r&&r.d(s)}}}function m4(t,e,n){let r,s,u,p,c,b,{$$slots:S={},$$scope:T}=e;const L=TT(S);let{closeButton:M=void 0}=e,{closeOnClickOutside:B=!0}=e,{closeOnClickInside:R=!1}=e,{closeOnMove:W=!1}=e,{openOn:et="click"}=e,{openIfTopMost:st=!0}=e,{focusAfterOpen:ut=!0}=e,{anchor:gt=void 0}=e,{offset:St=void 0}=e,{popupClass:Bt=void 0}=e,{maxWidth:zt=void 0}=e,{lngLat:Dt=void 0}=e,{html:Lt=void 0}=e,{open:Ut=!1}=e;const ie=jg(),{map:wt,popupTarget:se,layerEvent:ge,layer:Vt,eventTopMost:pe}=Vc();Br(t,wt,Ct=>n(2,u=Ct)),Br(t,se,Ct=>n(3,c=Ct)),Br(t,ge,Ct=>n(28,p=Ct)),Br(t,Vt,Ct=>n(35,b=Ct));const be=["click","dblclick","contextmenu"];let ae,Te=!1,tn;function hn(){if(!ae)return;let Ct=ae.getElement();!Ct||Ct===tn||(tn=Ct,et==="hover"&&(tn.style.pointerEvents="none"),tn.addEventListener("mouseenter",()=>{n(24,Te=!0)},{passive:!0}),tn.addEventListener("mouseleave",()=>{n(24,Te=!1)},{passive:!0}),tn.addEventListener("click",()=>{R&&n(0,Ut=!1)},{passive:!0}))}f2(()=>{if(u)return u.on("click",Kn),u.on("contextmenu",Kn),typeof c=="string"&&(u.on("click",c,en),u.on("dblclick",c,en),u.on("contextmenu",c,en),u.on("mousemove",c,ai),u.on("mouseleave",c,Bn),u.on("touchstart",c,gn),u.on("touchend",c,bn)),()=>{u!=null&&u.loaded()&&(ae==null||ae.remove(),u.off("click",Kn),u.off("contextmenu",Kn),c instanceof ia.Marker?c.getPopup()===ae&&c.setPopup(void 0):typeof c=="string"&&(u.off("click",c,en),u.off("dblclick",c,en),u.off("contextmenu",c,en),u.off("mousemove",c,ai),u.off("mouseleave",c,Bn),u.off("touchstart",c,gn),u.off("touchend",c,bn)))}});function He(Ct){return st?!("marker"in Ct)&&!z3(Ct)&&pe(Ct)!==b:!1}let Me=null,Ze="normal";function en(Ct){Ct.type===et&&(He(Ct)||("layerType"in Ct?Ct.layerType==="deckgl"?(n(10,Dt=Ct.coordinate),n(4,Me=Ct.object?[Ct.object]:null)):(n(10,Dt=Ct.lngLat),n(4,Me=Ct.features??[])):(n(10,Dt=Ct.lngLat),n(4,Me=Ct.features??[])),setTimeout(()=>n(0,Ut=!0))))}let pn=null;function gn(Ct){pn=Ct.point}function bn(Ct){if(!pn||et!=="hover")return;let Ce=pn.dist(Ct.point);pn=null,Ce<3&&(n(10,Dt=Ct.lngLat),n(4,Me=Ct.features??[]),ae.isOpen()?n(25,Ze="justOpened"):(n(25,Ze="opening"),n(0,Ut=!0)))}function Bn(Ct){et!=="hover"||pn||Ze!=="normal"||(n(0,Ut=!1),n(4,Me=null))}function ai(Ct){if(!(et!=="hover"||pn||Ze!=="normal")){if(He(Ct)){n(0,Ut=!1),n(4,Me=null);return}n(0,Ut=!0),n(4,Me=Ct.features??[]),n(10,Dt=Ct.lngLat)}}function Kn(Ct){if(Ze==="justOpened"){n(25,Ze="normal");return}if(!B)return;let Ce=[tn,c instanceof ia.Marker?c==null?void 0:c.getElement():null];Ut&&ae.isOpen()&&!Ce.some(kn=>kn==null?void 0:kn.contains(Ct.originalEvent.target))&&(Ct.type==="contextmenu"&&et==="contextmenu"||Ct.type!=="contextmenu")&&n(0,Ut=!1)}Tl(()=>{u&&(ae!=null&&ae.isOpen())&&ae.remove()});let cr;const jr=()=>n(0,Ut=!1);function ft(Ct){Ll[Ct?"unshift":"push"](()=>{cr=Ct,n(1,cr)})}return t.$$set=Ct=>{"closeButton"in Ct&&n(11,M=Ct.closeButton),"closeOnClickOutside"in Ct&&n(12,B=Ct.closeOnClickOutside),"closeOnClickInside"in Ct&&n(13,R=Ct.closeOnClickInside),"closeOnMove"in Ct&&n(14,W=Ct.closeOnMove),"openOn"in Ct&&n(15,et=Ct.openOn),"openIfTopMost"in Ct&&n(16,st=Ct.openIfTopMost),"focusAfterOpen"in Ct&&n(17,ut=Ct.focusAfterOpen),"anchor"in Ct&&n(18,gt=Ct.anchor),"offset"in Ct&&n(19,St=Ct.offset),"popupClass"in Ct&&n(20,Bt=Ct.popupClass),"maxWidth"in Ct&&n(21,zt=Ct.maxWidth),"lngLat"in Ct&&n(10,Dt=Ct.lngLat),"html"in Ct&&n(22,Lt=Ct.html),"open"in Ct&&n(0,Ut=Ct.open),"$$scope"in Ct&&n(29,T=Ct.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&14336&&n(27,r=M??(!B&&!R)),t.$$.dirty[0]&146685952&&(ae||(n(23,ae=new ia.Popup({closeButton:r,closeOnClick:!1,closeOnMove:W,focusAfterOpen:ut,maxWidth:zt,className:Bt,anchor:gt,offset:St})),tn=ae.getElement(),ae.on("open",()=>{n(0,Ut=!0),hn(),ie("open",ae)}),ae.on("close",()=>{n(0,Ut=!1),ie("close",ae)}),ae.on("hover",()=>{ie("hover",ae)}))),t.$$.dirty[0]&8421384&&ae&&c instanceof ia.Marker&&(et==="click"?c.setPopup(ae):c.getPopup()===ae&&c.setPopup(void 0)),t.$$.dirty[0]&268468224&&be.includes(et)&&(p==null?void 0:p.type)===et&&(en(p),El(ge,p=null,p)),t.$$.dirty[0]&268468224&&n(26,s=et==="hover"&&((p==null?void 0:p.type)==="mousemove"||(p==null?void 0:p.type)==="mouseenter")),t.$$.dirty[0]&352354304&&et==="hover"&&ge&&(s&&p&&(p.layerType==="deckgl"?(n(10,Dt=p.coordinate),n(4,Me=p.object?[p.object]:null)):(n(10,Dt=p.lngLat),n(4,Me=p.features??[]))),n(0,Ut=(s||Te)??!1)),t.$$.dirty[0]&12582914&&(cr?ae.setDOMContent(cr):Lt&&ae.setHTML(Lt)),t.$$.dirty[0]&8389632&&Dt&&ae.setLngLat(Dt),t.$$.dirty[0]&41943045&&u){let Ct=ae.isOpen();Ut&&!Ct?(ae.addTo(u),Ze==="opening"&&n(25,Ze="justOpened")):!Ut&&Ct&&ae.remove()}},[Ut,cr,u,c,Me,wt,se,ge,Vt,L,Dt,M,B,R,W,et,st,ut,gt,St,Bt,zt,Lt,ae,Te,Ze,s,r,p,T,S,jr,ft]}class Lz extends wr{constructor(e){super(),br(this,e,m4,d4,Yn,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}/*! js-cookie v3.0.5 | MIT */function Km(t){for(var e=1;e"u")){p=Km({},e,p),typeof p.expires=="number"&&(p.expires=new Date(Date.now()+p.expires*864e5)),p.expires&&(p.expires=p.expires.toUTCString()),s=encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var b in p)p[b]&&(c+="; "+b,p[b]!==!0&&(c+="="+p[b].split(";")[0]));return document.cookie=s+"="+t.write(u,s)+c}}function r(s){if(!(typeof document>"u"||arguments.length&&!s)){for(var u=document.cookie?document.cookie.split("; "):[],p={},c=0;c{"attribution"in s&&n(0,r=s.attribution)},[r]}class A4 extends wr{constructor(e){super(),br(this,e,L4,T4,Yn,{attribution:0})}}function s2(t){let e,n,r,s;function u(b){t[9](b)}function p(b){t[10](b)}let c={style:t[4],bounds:t[0],hash:!0,images:[{id:"chevron",url:E4},{id:"cycle_parking",url:S4},{id:"railway_station",url:I4}],attributionControl:!1,$$slots:{default:[P4]},$$scope:{ctx:t}};return t[3]!==void 0&&(c.loaded=t[3]),t[2]!==void 0&&(c.map=t[2]),e=new p4({props:c}),Ll.push(()=>hg(e,"loaded",u)),Ll.push(()=>hg(e,"map",p)),e.$on("error",k4),{c(){Eo(e.$$.fragment)},m(b,S){ro(e,b,S),s=!0},p(b,S){const T={};S&16&&(T.style=b[4]),S&1&&(T.bounds=b[0]),S&2146&&(T.$$scope={dirty:S,ctx:b}),!n&&S&8&&(n=!0,T.loaded=b[3],cg(()=>n=!1)),!r&&S&4&&(r=!0,T.map=b[2],cg(()=>r=!1)),e.$set(T)},i(b){s||(xe(e.$$.fragment,b),s=!0)},o(b){Ae(e.$$.fragment,b),s=!1},d(b){io(e,b)}}}function a2(t){let e,n,r,s,u,p,c,b,S,T;e=new r4({}),e.$on("zoomend",t[7]),e.$on("moveend",t[7]),r=new A4({props:{attribution:t[6]}}),u=new AI({}),c=new LI({props:{position:"bottom-left",visualizePitch:!0}});let L=t[1]=="google"&&l2();const M=t[8].default,B=zs(M,t,t[11],null);return{c(){Eo(e.$$.fragment),n=yi(),Eo(r.$$.fragment),s=yi(),Eo(u.$$.fragment),p=yi(),Eo(c.$$.fragment),b=yi(),L&&L.c(),S=yi(),B&&B.c()},m(R,W){ro(e,R,W),an(R,n,W),ro(r,R,W),an(R,s,W),ro(u,R,W),an(R,p,W),ro(c,R,W),an(R,b,W),L&&L.m(R,W),an(R,S,W),B&&B.m(R,W),T=!0},p(R,W){const et={};W&64&&(et.attribution=R[6]),r.$set(et),R[1]=="google"?L||(L=l2(),L.c(),L.m(S.parentNode,S)):L&&(L.d(1),L=null),B&&B.p&&(!T||W&2048)&&Bs(B,M,R,R[11],T?Fs(M,R[11],W,null):Us(R[11]),null)},i(R){T||(xe(e.$$.fragment,R),xe(r.$$.fragment,R),xe(u.$$.fragment,R),xe(c.$$.fragment,R),xe(B,R),T=!0)},o(R){Ae(e.$$.fragment,R),Ae(r.$$.fragment,R),Ae(u.$$.fragment,R),Ae(c.$$.fragment,R),Ae(B,R),T=!1},d(R){R&&(on(n),on(s),on(p),on(b),on(S)),io(e,R),io(r,R),io(u,R),io(c,R),L&&L.d(R),B&&B.d(R)}}}function l2(t){let e,n;return{c(){e=An("img"),IT(e.src,n=C4)||We(e,"src",n),We(e,"alt","Google logo"),We(e,"class","svelte-81xaz8")},m(r,s){an(r,e,s)},d(r){r&&on(e)}}}function P4(t){let e,n,r=t[5]&&a2(t);return{c(){r&&r.c(),e=Fl()},m(s,u){r&&r.m(s,u),an(s,e,u),n=!0},p(s,u){s[5]?r?(r.p(s,u),u&32&&xe(r,1)):(r=a2(s),r.c(),xe(r,1),r.m(e.parentNode,e)):r&&(_a(),Ae(r,1,1,()=>{r=null}),va())},i(s){n||(xe(r),n=!0)},o(s){Ae(r),n=!1},d(s){s&&on(e),r&&r.d(s)}}}function M4(t){let e,n,r=t[4]&&s2(t);return{c(){e=An("div"),r&&r.c(),We(e,"class","map svelte-81xaz8")},m(s,u){an(s,e,u),r&&r.m(e,null),n=!0},p(s,[u]){s[4]?r?(r.p(s,u),u&16&&xe(r,1)):(r=s2(s),r.c(),xe(r,1),r.m(e,null)):r&&(_a(),Ae(r,1,1,()=>{r=null}),va())},i(s){n||(xe(r),n=!0)},o(s){Ae(r),n=!1},d(s){s&&on(e),r&&r.d()}}}function k4(t){console.error(`MapLibre error: ${t.detail.error}`)}function D4(t,e,n){let r,s;Br(t,Xb,et=>n(5,r=et)),Br(t,Lg,et=>n(6,s=et));let{$$slots:u={},$$scope:p}=e,{style:c}=e,{startBounds:b=void 0}=e,S=null,T,L=!1;jv("setCamera",!window.location.hash),window.location.hash&&(b=void 0),f2(async()=>{n(4,S=await Zb(c))});async function M(et){n(4,S=await Zb(c));let st=new URL(window.location.href);st.searchParams.set("style",et),window.history.replaceState(null,"",st.toString())}async function B(){c=="google"&&r&&El(Lg,s=await vR(r),s)}function R(et){L=et,n(3,L)}function W(et){T=et,n(2,T)}return t.$$set=et=>{"style"in et&&n(1,c=et.style),"startBounds"in et&&n(0,b=et.startBounds),"$$scope"in et&&n(11,p=et.$$scope)},t.$$.update=()=>{t.$$.dirty&12&&L&&Xb.set(T),t.$$.dirty&2&&M(c)},[b,c,T,L,S,r,s,B,u,R,W,p]}class Pz extends wr{constructor(e){super(),br(this,e,D4,M4,Yn,{style:1,startBounds:0})}}const R4="Unable to save because the local storage quota has been exceeded: you may need to clear out your web browser's local storage for this app, or run in private mode before you can save again. Specific error here: ";function N4(){return{isQuotaError:!1,message:"",storedStrings:[]}}function Mz(t,e){try{return window.localStorage.setItem(t,e),N4()}catch(n){return{isQuotaError:!0,message:R4+n,storedStrings:PI()}}}function PI(){let t=[];for(let e=0;en.storageUsedInMB-e.storageUsedInMB),t}function O4(t){return t.length/(1024*1024)}function kz(){window.localStorage.clear()}function Dz(t){return window.localStorage.removeItem(t),PI()}async function Rz(){let e=await(await fetch(yR)).json();return mR(e)}function MI(){if(window.location.hostname=="localhost")return"Local development";if(window.location.hostname=="acteng.github.io"){let t=window.location.pathname.split("/");if(t.length==3&&t[0]==""&&t[1]=="atip")return"Public (development)";if(t.length==4&&t[0]==""&&t[1]=="atip")return`Public (dev branch: ${t[2]})`}else if(window.location.hostname.endsWith(".appspot.com"))return"Private (development)";return"Unknown"}async function Nz(t,e){let n=await fetch(t),r=n.body.getReader(),s=n.headers.get("Content-Length");if(!s)throw new Error(`No Content-Length header from ${t}`);let u=parseInt(s),p=0,c=[];for(;;){let{done:T,value:L}=await r.read();if(T)break;L&&(c.push(L),p+=L.length,e(100*p/u))}let b=new Uint8Array(p),S=0;for(let T of c)b.set(T,S),S+=T.length;return b}function Oz(){return"https://atip.uk/layers"}function z4(){return"https://atip.uk/private_layers"}export{Ya as $,ez as A,X4 as B,Rz as C,Y4 as D,A2 as E,K4 as F,Cz as G,tz as H,Mz as I,Iz as J,Ez as K,Az as L,Pz as M,Tz as N,rz as O,Ip as P,zs as Q,$4 as R,wr as S,Bs as T,Us as U,Fs as V,Ui as W,uL as X,L2 as Y,mx as Z,Ba as _,yi as a,kz as a$,pc as a0,ug as a1,y2 as a2,lg as a3,bz as a4,nd as a5,mL as a6,Q4 as a7,P2 as a8,Tr as a9,L3 as aA,T3 as aB,hz as aC,fz as aD,pz as aE,c2 as aF,yz as aG,Lz as aH,Ga as aI,mD as aJ,NS as aK,RS as aL,c0 as aM,wo as aN,Cs as aO,Zg as aP,Io as aQ,bd as aR,r4 as aS,_z as aT,A3 as aU,U4 as aV,xz as aW,IT as aX,h2 as aY,iz as aZ,Dz as a_,Fl as aa,py as ab,N3 as ac,Tl as ad,X3 as ae,El as af,Z3 as ag,Gg as ah,Vc as ai,jg as aj,F3 as ak,B3 as al,yx as am,W4 as an,H4 as ao,AT as ap,DS as aq,u0 as ar,FT as as,Z4 as at,uz as au,qv as av,mz as aw,PT as ax,gz as ay,dz as az,We as b,wz as b0,q4 as b1,vz as b2,M3 as b3,Xb as b4,oz as b5,dx as b6,TI as b7,ia as b8,cz as b9,Oz as ba,z4 as bb,zT as bc,E4 as bd,S4 as be,I4 as bf,Nz as bg,j4 as bh,TT as bi,$_ as bj,V4 as bk,G4 as bl,HD as bm,nz as bn,MT as bo,za as bp,B4 as bq,az as br,sz as bs,LT as bt,kT as bu,Sz as bv,an as c,on as d,An as e,dL as f,Ll as g,hg as h,br as i,Eo as j,MI as k,lz as l,gx as m,Ur as n,Gn as o,ro as p,Ae as q,va as r,Yn as s,xe as t,cg as u,io as v,Br as w,f2 as x,Ka as y,_a as z}; + `),s=An("a"),s.textContent="MapLibre",n.a=r,We(s,"href","https://maplibre.org/"),We(s,"target","_blank"),We(e,"class","svelte-1yeu1m4")},m(u,p){an(u,e,p),n.m(t[0],e),Gn(e,r),Gn(e,s)},p(u,[p]){p&1&&n.p(u[0])},i:Ur,o:Ur,d(u){u&&on(e)}}}function L4(t,e,n){let{attribution:r}=e;return t.$$set=s=>{"attribution"in s&&n(0,r=s.attribution)},[r]}class A4 extends wr{constructor(e){super(),br(this,e,L4,T4,Yn,{attribution:0})}}function s2(t){let e,n,r,s;function u(b){t[9](b)}function p(b){t[10](b)}let c={style:t[4],bounds:t[0],hash:!0,images:[{id:"chevron",url:E4},{id:"cycle_parking",url:S4},{id:"railway_station",url:I4}],attributionControl:!1,$$slots:{default:[P4]},$$scope:{ctx:t}};return t[3]!==void 0&&(c.loaded=t[3]),t[2]!==void 0&&(c.map=t[2]),e=new p4({props:c}),Ll.push(()=>hg(e,"loaded",u)),Ll.push(()=>hg(e,"map",p)),e.$on("error",k4),{c(){Eo(e.$$.fragment)},m(b,S){ro(e,b,S),s=!0},p(b,S){const T={};S&16&&(T.style=b[4]),S&1&&(T.bounds=b[0]),S&2146&&(T.$$scope={dirty:S,ctx:b}),!n&&S&8&&(n=!0,T.loaded=b[3],cg(()=>n=!1)),!r&&S&4&&(r=!0,T.map=b[2],cg(()=>r=!1)),e.$set(T)},i(b){s||(xe(e.$$.fragment,b),s=!0)},o(b){Ae(e.$$.fragment,b),s=!1},d(b){io(e,b)}}}function a2(t){let e,n,r,s,u,p,c,b,S,T;e=new r4({}),e.$on("zoomend",t[7]),e.$on("moveend",t[7]),r=new A4({props:{attribution:t[6]}}),u=new AI({}),c=new LI({props:{position:"bottom-left",visualizePitch:!0}});let L=t[1]=="google"&&l2();const M=t[8].default,B=zs(M,t,t[11],null);return{c(){Eo(e.$$.fragment),n=yi(),Eo(r.$$.fragment),s=yi(),Eo(u.$$.fragment),p=yi(),Eo(c.$$.fragment),b=yi(),L&&L.c(),S=yi(),B&&B.c()},m(R,W){ro(e,R,W),an(R,n,W),ro(r,R,W),an(R,s,W),ro(u,R,W),an(R,p,W),ro(c,R,W),an(R,b,W),L&&L.m(R,W),an(R,S,W),B&&B.m(R,W),T=!0},p(R,W){const et={};W&64&&(et.attribution=R[6]),r.$set(et),R[1]=="google"?L||(L=l2(),L.c(),L.m(S.parentNode,S)):L&&(L.d(1),L=null),B&&B.p&&(!T||W&2048)&&Bs(B,M,R,R[11],T?Fs(M,R[11],W,null):Us(R[11]),null)},i(R){T||(xe(e.$$.fragment,R),xe(r.$$.fragment,R),xe(u.$$.fragment,R),xe(c.$$.fragment,R),xe(B,R),T=!0)},o(R){Ae(e.$$.fragment,R),Ae(r.$$.fragment,R),Ae(u.$$.fragment,R),Ae(c.$$.fragment,R),Ae(B,R),T=!1},d(R){R&&(on(n),on(s),on(p),on(b),on(S)),io(e,R),io(r,R),io(u,R),io(c,R),L&&L.d(R),B&&B.d(R)}}}function l2(t){let e,n;return{c(){e=An("img"),IT(e.src,n=C4)||We(e,"src",n),We(e,"alt","Google logo"),We(e,"class","svelte-81xaz8")},m(r,s){an(r,e,s)},d(r){r&&on(e)}}}function P4(t){let e,n,r=t[5]&&a2(t);return{c(){r&&r.c(),e=Fl()},m(s,u){r&&r.m(s,u),an(s,e,u),n=!0},p(s,u){s[5]?r?(r.p(s,u),u&32&&xe(r,1)):(r=a2(s),r.c(),xe(r,1),r.m(e.parentNode,e)):r&&(_a(),Ae(r,1,1,()=>{r=null}),va())},i(s){n||(xe(r),n=!0)},o(s){Ae(r),n=!1},d(s){s&&on(e),r&&r.d(s)}}}function M4(t){let e,n,r=t[4]&&s2(t);return{c(){e=An("div"),r&&r.c(),We(e,"class","map svelte-81xaz8")},m(s,u){an(s,e,u),r&&r.m(e,null),n=!0},p(s,[u]){s[4]?r?(r.p(s,u),u&16&&xe(r,1)):(r=s2(s),r.c(),xe(r,1),r.m(e,null)):r&&(_a(),Ae(r,1,1,()=>{r=null}),va())},i(s){n||(xe(r),n=!0)},o(s){Ae(r),n=!1},d(s){s&&on(e),r&&r.d()}}}function k4(t){console.error(`MapLibre error: ${t.detail.error}`)}function D4(t,e,n){let r,s;Br(t,Xb,et=>n(5,r=et)),Br(t,Lg,et=>n(6,s=et));let{$$slots:u={},$$scope:p}=e,{style:c}=e,{startBounds:b=void 0}=e,S=null,T,L=!1;jv("setCamera",!window.location.hash),window.location.hash&&(b=void 0),f2(async()=>{n(4,S=await Zb(c))});async function M(et){n(4,S=await Zb(c));let st=new URL(window.location.href);st.searchParams.set("style",et),window.history.replaceState(null,"",st.toString())}async function B(){c=="google"&&r&&El(Lg,s=await vR(r),s)}function R(et){L=et,n(3,L)}function W(et){T=et,n(2,T)}return t.$$set=et=>{"style"in et&&n(1,c=et.style),"startBounds"in et&&n(0,b=et.startBounds),"$$scope"in et&&n(11,p=et.$$scope)},t.$$.update=()=>{t.$$.dirty&12&&L&&Xb.set(T),t.$$.dirty&2&&M(c)},[b,c,T,L,S,r,s,B,u,R,W,p]}class Pz extends wr{constructor(e){super(),br(this,e,D4,M4,Yn,{style:1,startBounds:0})}}const R4="Unable to save because the local storage quota has been exceeded: you may need to clear out your web browser's local storage for this app, or run in private mode before you can save again. Specific error here: ";function N4(){return{isQuotaError:!1,message:"",storedStrings:[]}}function Mz(t,e){try{return window.localStorage.setItem(t,e),N4()}catch(n){return{isQuotaError:!0,message:R4+n,storedStrings:PI()}}}function PI(){let t=[];for(let e=0;en.storageUsedInMB-e.storageUsedInMB),t}function O4(t){return t.length/(1024*1024)}function kz(){window.localStorage.clear()}function Dz(t){return window.localStorage.removeItem(t),PI()}async function Rz(){let e=await(await fetch(yR)).json();return mR(e)}function MI(){if(window.location.hostname=="localhost")return"Local development";if(window.location.hostname=="acteng.github.io"){let t=window.location.pathname.split("/");if(t.length==3&&t[0]==""&&t[1]=="atip")return"Public (development)";if(t.length==4&&t[0]==""&&t[1]=="atip")return`Public (dev branch: ${t[2]})`}else if(window.location.hostname.endsWith(".appspot.com"))return"Private (development)";return"Unknown"}async function Nz(t,e){let n=await fetch(t),r=n.body.getReader(),s=n.headers.get("Content-Length");if(!s)throw new Error(`No Content-Length header from ${t}`);let u=parseInt(s),p=0,c=[];for(;;){let{done:T,value:L}=await r.read();if(T)break;L&&(c.push(L),p+=L.length,e(100*p/u))}let b=new Uint8Array(p),S=0;for(let T of c)b.set(T,S),S+=T.length;return b}function Oz(){return"https://atip.uk/layers"}function z4(){return"https://atip.uk/private_layers"}export{Ui as $,ez as A,X4 as B,Rz as C,Y4 as D,A2 as E,K4 as F,Cz as G,tz as H,Mz as I,Iz as J,Ez as K,Az as L,Pz as M,Tz as N,rz as O,Ip as P,zs as Q,$4 as R,wr as S,Bs as T,Us as U,Fs as V,uL as W,L2 as X,mx as Y,Ba as Z,Ya as _,yi as a,Dz as a$,pc as a0,ug as a1,y2 as a2,lg as a3,bz as a4,nd as a5,mL as a6,Q4 as a7,P2 as a8,Tr as a9,L3 as aA,T3 as aB,hz as aC,fz as aD,pz as aE,c2 as aF,yz as aG,Lz as aH,Ga as aI,mD as aJ,NS as aK,RS as aL,c0 as aM,wo as aN,Cs as aO,Zg as aP,Io as aQ,bd as aR,r4 as aS,_z as aT,A3 as aU,U4 as aV,xz as aW,za as aX,IT as aY,h2 as aZ,iz as a_,Fl as aa,py as ab,N3 as ac,Tl as ad,X3 as ae,El as af,Z3 as ag,Gg as ah,Vc as ai,jg as aj,F3 as ak,B3 as al,yx as am,W4 as an,H4 as ao,AT as ap,DS as aq,u0 as ar,FT as as,Z4 as at,uz as au,qv as av,mz as aw,PT as ax,gz as ay,dz as az,We as b,kz as b0,wz as b1,q4 as b2,vz as b3,M3 as b4,Xb as b5,oz as b6,dx as b7,TI as b8,ia as b9,cz as ba,Oz as bb,z4 as bc,zT as bd,E4 as be,S4 as bf,I4 as bg,Nz as bh,j4 as bi,TT as bj,$_ as bk,V4 as bl,G4 as bm,HD as bn,nz as bo,MT as bp,B4 as bq,az as br,sz as bs,LT as bt,kT as bu,Sz as bv,an as c,on as d,An as e,dL as f,Ll as g,hg as h,br as i,Eo as j,MI as k,lz as l,gx as m,Ur as n,Gn as o,ro as p,Ae as q,va as r,Yn as s,xe as t,cg as u,io as v,Br as w,f2 as x,Ka as y,_a as z}; diff --git a/move_draw_controls/assets/main-b8e5cd81.js b/move_draw_controls/assets/main-a3341c39.js similarity index 97% rename from move_draw_controls/assets/main-b8e5cd81.js rename to move_draw_controls/assets/main-a3341c39.js index 1808dc66..a1ed8184 100644 --- a/move_draw_controls/assets/main-b8e5cd81.js +++ b/move_draw_controls/assets/main-a3341c39.js @@ -1 +1 @@ -import{S as he,i as _e,s as ve,e as A,l as Ae,a as g,b as E,c as L,n as Y,d as C,A as ye,L as Se,f as ke,E as me,D as Le,R as Ce,g as Z,h as x,F as Me,M as Ee,j as h,k as Te,m as Ie,o as i,p as _,t as p,q as m,r as He,u as ee,v,w as Oe,x as Be,y as J,G as Fe,z as Je,B as Ne,C as je,H as De,I as Ge,J as Pe,K as Re,N as qe,O as Ue,P as ce}from"./index-7b4eed78.js";import{A as Ve,P as ze}from"./Popup-b9aeab86.js";import{A as Ke}from"./About-3be1e6da.js";function Qe(r){let t,a,n;return{c(){t=A("div"),t.innerHTML=`Active Travel England logo`,a=g(),n=A("div"),E(t,"class","black-bar svelte-13flgp1"),E(n,"class","green-bar svelte-13flgp1")},m(l,e){L(l,t,e),L(l,a,e),L(l,n,e)},p:Y,i:Y,o:Y,d(l){l&&(C(t),C(a),C(n))}}}class We extends he{constructor(t){super(),_e(this,t,null,Qe,ve,{})}}function Xe(r){let t;return{c(){t=J("About")},m(a,n){L(a,t,n)},d(a){a&&C(t)}}}function ge(r){let t,a,n;function l(o){r[10](o)}let e={label:"Select Transport Authority or Local Authority District",options:r[1].features.map(de)};return r[0]!==void 0&&(e.value=r[0]),t=new Ve({props:e}),Z.push(()=>x(t,"value",l)),{c(){h(t.$$.fragment)},m(o,b){_(t,o,b),n=!0},p(o,b){const f={};b&2&&(f.options=o[1].features.map(de)),!a&&b&1&&(a=!0,f.value=o[0],ee(()=>a=!1)),t.$set(f)},i(o){n||(p(t.$$.fragment,o),n=!0)},o(o){m(t.$$.fragment,o),n=!1},d(o){v(t,o)}}}function Ye(r){let t;return{c(){t=J("Start")},m(a,n){L(a,t,n)},d(a){a&&C(t)}}}function Ze(r){let t,a=r[17].name+"",n,l,e=r[17].level+"",o,b;return{c(){t=A("p"),n=J(a),l=J(" ("),o=J(e),b=J(")")},m(f,c){L(f,t,c),i(t,n),i(t,l),i(t,o),i(t,b)},p(f,c){c&131072&&a!==(a=f[17].name+"")&&ce(n,a),c&131072&&e!==(e=f[17].level+"")&&ce(o,e)},d(f){f&&C(t)}}}function xe(r){let t,a;return t=new ze({props:{$$slots:{default:[Ze,({props:n})=>({17:n}),({props:n})=>n?131072:0]},$$scope:{ctx:r}}}),{c(){h(t.$$.fragment)},m(n,l){_(t,n,l),a=!0},p(n,l){const e={};l&393216&&(e.$$scope={dirty:l,ctx:n}),t.$set(e)},i(n){a||(p(t.$$.fragment,n),a=!0)},o(n){m(t.$$.fragment,n),a=!1},d(n){v(t,n)}}}function et(r){let t,a,n,l;return t=new Pe({props:{id:"boundaries",filter:["==",["get","level"],r[4]],paint:{"fill-color":"rgb(200, 100, 240)","fill-outline-color":"rgb(200, 100, 240)","fill-opacity":Re(0,.5)},manageHoverState:!0,hoverCursor:"pointer",$$slots:{default:[xe]},$$scope:{ctx:r}}}),t.$on("click",r[7]),n=new qe({props:{id:"boundaries-outline",filter:["==",["get","level"],r[4]],paint:{"line-color":"rgb(200, 100, 240)","line-width":2.5},manageHoverState:!0}}),{c(){h(t.$$.fragment),a=g(),h(n.$$.fragment)},m(e,o){_(t,e,o),L(e,a,o),_(n,e,o),l=!0},p(e,o){const b={};o&16&&(b.filter=["==",["get","level"],e[4]]),o&262144&&(b.$$scope={dirty:o,ctx:e}),t.$set(b);const f={};o&16&&(f.filter=["==",["get","level"],e[4]]),n.$set(f)},i(e){l||(p(t.$$.fragment,e),p(n.$$.fragment,e),l=!0)},o(e){m(t.$$.fragment,e),m(n.$$.fragment,e),l=!1},d(e){e&&C(a),v(t,e),v(n,e)}}}function tt(r){let t,a;return t=new Fe({props:{data:r[1],generateId:!0,$$slots:{default:[et]},$$scope:{ctx:r}}}),{c(){h(t.$$.fragment)},m(n,l){_(t,n,l),a=!0},p(n,l){const e={};l&2&&(e.data=n[1]),l&262160&&(e.$$scope={dirty:l,ctx:n}),t.$set(e)},i(n){a||(p(t.$$.fragment,n),a=!0)},o(n){m(t.$$.fragment,n),a=!1},d(n){v(t,n)}}}function nt(r){let t,a,n,l,e,o,b,f,c,N,T,R,j,q,S,U,k,V,D,u,I,w,G,y,H,te,ne,ae,B,re,F,se,z,P,O,Q,M,W,K;n=new We({}),o=new ye({}),c=new Se({}),S=new ke({props:{$$slots:{default:[Xe]},$$scope:{ctx:r}}}),S.$on("click",r[9]),k=new me({props:{errorMessage:r[3]}});let $=r[1].features.length>0&&ge(r);u=new Le({props:{disabled:!r[5],$$slots:{default:[Ye]},$$scope:{ctx:r}}}),u.$on("click",r[8]);function be(s){r[11](s)}let oe={label:"Or pick from the map",choices:[["TA","Transport Authorities"],["LAD","Local Authority Districts"]],inlineSmall:!0};r[4]!==void 0&&(oe.value=r[4]),y=new Ce({props:oe}),Z.push(()=>x(y,"value",be)),B=new me({props:{errorMessage:at}}),F=new Me({props:{label:"Or upload an ATIP GeoJSON file",onLoad:r[6]}}),O=new Ee({props:{style:"streets",startBounds:[-5.96,49.89,2.31,55.94],$$slots:{default:[tt]},$$scope:{ctx:r}}});function we(s){r[12](s)}let le={};return r[2]!==void 0&&(le.open=r[2]),M=new Ke({props:le}),Z.push(()=>x(M,"open",we)),{c(){t=A("div"),a=A("div"),h(n.$$.fragment),l=g(),e=A("div"),h(o.$$.fragment),b=g(),f=A("div"),h(c.$$.fragment),N=g(),T=A("p"),T.textContent=`App version: ${Te()}`,R=g(),j=A("h1"),j.textContent="Scheme Sketcher",q=g(),h(S.$$.fragment),U=g(),h(k.$$.fragment),V=g(),$&&$.c(),D=g(),h(u.$$.fragment),I=g(),w=A("hr"),G=g(),h(y.$$.fragment),te=g(),ne=A("hr"),ae=g(),h(B.$$.fragment),re=g(),h(F.$$.fragment),se=g(),z=A("div"),P=A("div"),h(O.$$.fragment),Q=g(),h(M.$$.fragment),Ie(f,"border-bottom","1px solid #b1b4b6"),E(e,"class","left svelte-lyn11h"),E(a,"class","govuk-grid-column-one-half govuk-prose"),E(P,"id","map"),E(P,"class","svelte-lyn11h"),E(z,"class","govuk-grid-column-one-half"),E(t,"class","govuk-grid-row")},m(s,d){L(s,t,d),i(t,a),_(n,a,null),i(a,l),i(a,e),_(o,e,null),i(e,b),i(e,f),_(c,f,null),i(f,N),i(f,T),i(e,R),i(e,j),i(e,q),_(S,e,null),i(e,U),_(k,e,null),i(e,V),$&&$.m(e,null),i(e,D),_(u,e,null),i(e,I),i(e,w),i(e,G),_(y,e,null),i(e,te),i(e,ne),i(e,ae),_(B,e,null),i(e,re),_(F,e,null),i(t,se),i(t,z),i(z,P),_(O,P,null),L(s,Q,d),_(M,s,d),K=!0},p(s,[d]){const ie={};d&262144&&(ie.$$scope={dirty:d,ctx:s}),S.$set(ie);const ue={};d&8&&(ue.errorMessage=s[3]),k.$set(ue),s[1].features.length>0?$?($.p(s,d),d&2&&p($,1)):($=ge(s),$.c(),p($,1),$.m(e,D)):$&&(Je(),m($,1,1,()=>{$=null}),He());const X={};d&32&&(X.disabled=!s[5]),d&262144&&(X.$$scope={dirty:d,ctx:s}),u.$set(X);const fe={};!H&&d&16&&(H=!0,fe.value=s[4],ee(()=>H=!1)),y.$set(fe);const pe={};d&262162&&(pe.$$scope={dirty:d,ctx:s}),O.$set(pe);const $e={};!W&&d&4&&(W=!0,$e.open=s[2],ee(()=>W=!1)),M.$set($e)},i(s){K||(p(n.$$.fragment,s),p(o.$$.fragment,s),p(c.$$.fragment,s),p(S.$$.fragment,s),p(k.$$.fragment,s),p($),p(u.$$.fragment,s),p(y.$$.fragment,s),p(B.$$.fragment,s),p(F.$$.fragment,s),p(O.$$.fragment,s),p(M.$$.fragment,s),K=!0)},o(s){m(n.$$.fragment,s),m(o.$$.fragment,s),m(c.$$.fragment,s),m(S.$$.fragment,s),m(k.$$.fragment,s),m($),m(u.$$.fragment,s),m(y.$$.fragment,s),m(B.$$.fragment,s),m(F.$$.fragment,s),m(O.$$.fragment,s),m(M.$$.fragment,s),K=!1},d(s){s&&(C(t),C(Q)),v(n),v(o),v(c),v(S),v(k),$&&$.d(),v(u),v(y),v(B),v(F),v(O),v(M,s)}}}let at="";const de=r=>[r.properties.full_name,`${r.properties.name} (${r.properties.level})`];function rt(r,t,a){let n,l;Oe(r,Ue,u=>a(13,l=u));let e={type:"FeatureCollection",features:[]},o=!1,f=new URLSearchParams(window.location.search).get("error")||"",c,N=new Set,T="TA";Be(async()=>{Ne(),a(1,e=await je());for(let u of e.features)N.add(u.properties.full_name)});function R(u,I){try{let w=JSON.parse(I),G=De(w.features,e);if(!G)throw new Error("Can't figure out the authority boundary that fully contains this scheme");w.authority=G;let y=w.authority,H=j(w);H!="v1"&&(y+=`_${H}`),Ge(y,JSON.stringify(w)),window.location.href=`scheme.html?authority=${w.authority}&schema=${H}`}catch(w){a(3,f=`Couldn't load scheme from a file: ${w}`)}}function j(u){if(u.features.length>0){let I=u.features[0].properties;for(let w of["pipeline"])if(I&&w in I)return w}return l}function q(u){window.location.href=`scheme.html?authority=${u.detail.features[0].properties.full_name}&schema=${l}`}function S(){window.location.href=`scheme.html?authority=${c}&schema=${l}`}const U=()=>a(2,o=!o);function k(u){c=u,a(0,c)}function V(u){T=u,a(4,T)}function D(u){o=u,a(2,o)}return r.$$.update=()=>{r.$$.dirty&1&&a(5,n=N.has(c))},[c,e,o,f,T,n,R,q,S,U,k,V,D]}class st extends he{constructor(t){super(),_e(this,t,rt,nt,ve,{})}}document.body.className+=" js-enabled"+("noModule"in HTMLScriptElement.prototype?" govuk-frontend-supported":"");new st({target:document.getElementById("app")}); +import{S as he,i as _e,s as ve,e as A,l as Ae,a as g,b as E,c as L,n as Y,d as C,A as ye,L as Se,f as ke,E as me,D as Le,R as Ce,g as Z,h as x,F as Me,M as Ee,j as h,k as Te,m as Ie,o as i,p as _,t as p,q as m,r as He,u as ee,v,w as Oe,x as Be,y as J,G as Fe,z as Je,B as Ne,C as je,H as De,I as Ge,J as Pe,K as Re,N as qe,O as Ue,P as ce}from"./index-d36e2ea3.js";import{A as Ve,P as ze}from"./Popup-61834b7b.js";import{A as Ke}from"./About-469acba2.js";function Qe(r){let t,a,n;return{c(){t=A("div"),t.innerHTML=`Active Travel England logo`,a=g(),n=A("div"),E(t,"class","black-bar svelte-13flgp1"),E(n,"class","green-bar svelte-13flgp1")},m(l,e){L(l,t,e),L(l,a,e),L(l,n,e)},p:Y,i:Y,o:Y,d(l){l&&(C(t),C(a),C(n))}}}class We extends he{constructor(t){super(),_e(this,t,null,Qe,ve,{})}}function Xe(r){let t;return{c(){t=J("About")},m(a,n){L(a,t,n)},d(a){a&&C(t)}}}function ge(r){let t,a,n;function l(o){r[10](o)}let e={label:"Select Transport Authority or Local Authority District",options:r[1].features.map(de)};return r[0]!==void 0&&(e.value=r[0]),t=new Ve({props:e}),Z.push(()=>x(t,"value",l)),{c(){h(t.$$.fragment)},m(o,b){_(t,o,b),n=!0},p(o,b){const f={};b&2&&(f.options=o[1].features.map(de)),!a&&b&1&&(a=!0,f.value=o[0],ee(()=>a=!1)),t.$set(f)},i(o){n||(p(t.$$.fragment,o),n=!0)},o(o){m(t.$$.fragment,o),n=!1},d(o){v(t,o)}}}function Ye(r){let t;return{c(){t=J("Start")},m(a,n){L(a,t,n)},d(a){a&&C(t)}}}function Ze(r){let t,a=r[17].name+"",n,l,e=r[17].level+"",o,b;return{c(){t=A("p"),n=J(a),l=J(" ("),o=J(e),b=J(")")},m(f,c){L(f,t,c),i(t,n),i(t,l),i(t,o),i(t,b)},p(f,c){c&131072&&a!==(a=f[17].name+"")&&ce(n,a),c&131072&&e!==(e=f[17].level+"")&&ce(o,e)},d(f){f&&C(t)}}}function xe(r){let t,a;return t=new ze({props:{$$slots:{default:[Ze,({props:n})=>({17:n}),({props:n})=>n?131072:0]},$$scope:{ctx:r}}}),{c(){h(t.$$.fragment)},m(n,l){_(t,n,l),a=!0},p(n,l){const e={};l&393216&&(e.$$scope={dirty:l,ctx:n}),t.$set(e)},i(n){a||(p(t.$$.fragment,n),a=!0)},o(n){m(t.$$.fragment,n),a=!1},d(n){v(t,n)}}}function et(r){let t,a,n,l;return t=new Pe({props:{id:"boundaries",filter:["==",["get","level"],r[4]],paint:{"fill-color":"rgb(200, 100, 240)","fill-outline-color":"rgb(200, 100, 240)","fill-opacity":Re(0,.5)},manageHoverState:!0,hoverCursor:"pointer",$$slots:{default:[xe]},$$scope:{ctx:r}}}),t.$on("click",r[7]),n=new qe({props:{id:"boundaries-outline",filter:["==",["get","level"],r[4]],paint:{"line-color":"rgb(200, 100, 240)","line-width":2.5},manageHoverState:!0}}),{c(){h(t.$$.fragment),a=g(),h(n.$$.fragment)},m(e,o){_(t,e,o),L(e,a,o),_(n,e,o),l=!0},p(e,o){const b={};o&16&&(b.filter=["==",["get","level"],e[4]]),o&262144&&(b.$$scope={dirty:o,ctx:e}),t.$set(b);const f={};o&16&&(f.filter=["==",["get","level"],e[4]]),n.$set(f)},i(e){l||(p(t.$$.fragment,e),p(n.$$.fragment,e),l=!0)},o(e){m(t.$$.fragment,e),m(n.$$.fragment,e),l=!1},d(e){e&&C(a),v(t,e),v(n,e)}}}function tt(r){let t,a;return t=new Fe({props:{data:r[1],generateId:!0,$$slots:{default:[et]},$$scope:{ctx:r}}}),{c(){h(t.$$.fragment)},m(n,l){_(t,n,l),a=!0},p(n,l){const e={};l&2&&(e.data=n[1]),l&262160&&(e.$$scope={dirty:l,ctx:n}),t.$set(e)},i(n){a||(p(t.$$.fragment,n),a=!0)},o(n){m(t.$$.fragment,n),a=!1},d(n){v(t,n)}}}function nt(r){let t,a,n,l,e,o,b,f,c,N,T,R,j,q,S,U,k,V,D,u,I,w,G,y,H,te,ne,ae,B,re,F,se,z,P,O,Q,M,W,K;n=new We({}),o=new ye({}),c=new Se({}),S=new ke({props:{$$slots:{default:[Xe]},$$scope:{ctx:r}}}),S.$on("click",r[9]),k=new me({props:{errorMessage:r[3]}});let $=r[1].features.length>0&&ge(r);u=new Le({props:{disabled:!r[5],$$slots:{default:[Ye]},$$scope:{ctx:r}}}),u.$on("click",r[8]);function be(s){r[11](s)}let oe={label:"Or pick from the map",choices:[["TA","Transport Authorities"],["LAD","Local Authority Districts"]],inlineSmall:!0};r[4]!==void 0&&(oe.value=r[4]),y=new Ce({props:oe}),Z.push(()=>x(y,"value",be)),B=new me({props:{errorMessage:at}}),F=new Me({props:{label:"Or upload an ATIP GeoJSON file",onLoad:r[6]}}),O=new Ee({props:{style:"streets",startBounds:[-5.96,49.89,2.31,55.94],$$slots:{default:[tt]},$$scope:{ctx:r}}});function we(s){r[12](s)}let le={};return r[2]!==void 0&&(le.open=r[2]),M=new Ke({props:le}),Z.push(()=>x(M,"open",we)),{c(){t=A("div"),a=A("div"),h(n.$$.fragment),l=g(),e=A("div"),h(o.$$.fragment),b=g(),f=A("div"),h(c.$$.fragment),N=g(),T=A("p"),T.textContent=`App version: ${Te()}`,R=g(),j=A("h1"),j.textContent="Scheme Sketcher",q=g(),h(S.$$.fragment),U=g(),h(k.$$.fragment),V=g(),$&&$.c(),D=g(),h(u.$$.fragment),I=g(),w=A("hr"),G=g(),h(y.$$.fragment),te=g(),ne=A("hr"),ae=g(),h(B.$$.fragment),re=g(),h(F.$$.fragment),se=g(),z=A("div"),P=A("div"),h(O.$$.fragment),Q=g(),h(M.$$.fragment),Ie(f,"border-bottom","1px solid #b1b4b6"),E(e,"class","left svelte-lyn11h"),E(a,"class","govuk-grid-column-one-half govuk-prose"),E(P,"id","map"),E(P,"class","svelte-lyn11h"),E(z,"class","govuk-grid-column-one-half"),E(t,"class","govuk-grid-row")},m(s,d){L(s,t,d),i(t,a),_(n,a,null),i(a,l),i(a,e),_(o,e,null),i(e,b),i(e,f),_(c,f,null),i(f,N),i(f,T),i(e,R),i(e,j),i(e,q),_(S,e,null),i(e,U),_(k,e,null),i(e,V),$&&$.m(e,null),i(e,D),_(u,e,null),i(e,I),i(e,w),i(e,G),_(y,e,null),i(e,te),i(e,ne),i(e,ae),_(B,e,null),i(e,re),_(F,e,null),i(t,se),i(t,z),i(z,P),_(O,P,null),L(s,Q,d),_(M,s,d),K=!0},p(s,[d]){const ie={};d&262144&&(ie.$$scope={dirty:d,ctx:s}),S.$set(ie);const ue={};d&8&&(ue.errorMessage=s[3]),k.$set(ue),s[1].features.length>0?$?($.p(s,d),d&2&&p($,1)):($=ge(s),$.c(),p($,1),$.m(e,D)):$&&(Je(),m($,1,1,()=>{$=null}),He());const X={};d&32&&(X.disabled=!s[5]),d&262144&&(X.$$scope={dirty:d,ctx:s}),u.$set(X);const fe={};!H&&d&16&&(H=!0,fe.value=s[4],ee(()=>H=!1)),y.$set(fe);const pe={};d&262162&&(pe.$$scope={dirty:d,ctx:s}),O.$set(pe);const $e={};!W&&d&4&&(W=!0,$e.open=s[2],ee(()=>W=!1)),M.$set($e)},i(s){K||(p(n.$$.fragment,s),p(o.$$.fragment,s),p(c.$$.fragment,s),p(S.$$.fragment,s),p(k.$$.fragment,s),p($),p(u.$$.fragment,s),p(y.$$.fragment,s),p(B.$$.fragment,s),p(F.$$.fragment,s),p(O.$$.fragment,s),p(M.$$.fragment,s),K=!0)},o(s){m(n.$$.fragment,s),m(o.$$.fragment,s),m(c.$$.fragment,s),m(S.$$.fragment,s),m(k.$$.fragment,s),m($),m(u.$$.fragment,s),m(y.$$.fragment,s),m(B.$$.fragment,s),m(F.$$.fragment,s),m(O.$$.fragment,s),m(M.$$.fragment,s),K=!1},d(s){s&&(C(t),C(Q)),v(n),v(o),v(c),v(S),v(k),$&&$.d(),v(u),v(y),v(B),v(F),v(O),v(M,s)}}}let at="";const de=r=>[r.properties.full_name,`${r.properties.name} (${r.properties.level})`];function rt(r,t,a){let n,l;Oe(r,Ue,u=>a(13,l=u));let e={type:"FeatureCollection",features:[]},o=!1,f=new URLSearchParams(window.location.search).get("error")||"",c,N=new Set,T="TA";Be(async()=>{Ne(),a(1,e=await je());for(let u of e.features)N.add(u.properties.full_name)});function R(u,I){try{let w=JSON.parse(I),G=De(w.features,e);if(!G)throw new Error("Can't figure out the authority boundary that fully contains this scheme");w.authority=G;let y=w.authority,H=j(w);H!="v1"&&(y+=`_${H}`),Ge(y,JSON.stringify(w)),window.location.href=`scheme.html?authority=${w.authority}&schema=${H}`}catch(w){a(3,f=`Couldn't load scheme from a file: ${w}`)}}function j(u){if(u.features.length>0){let I=u.features[0].properties;for(let w of["pipeline"])if(I&&w in I)return w}return l}function q(u){window.location.href=`scheme.html?authority=${u.detail.features[0].properties.full_name}&schema=${l}`}function S(){window.location.href=`scheme.html?authority=${c}&schema=${l}`}const U=()=>a(2,o=!o);function k(u){c=u,a(0,c)}function V(u){T=u,a(4,T)}function D(u){o=u,a(2,o)}return r.$$.update=()=>{r.$$.dirty&1&&a(5,n=N.has(c))},[c,e,o,f,T,n,R,q,S,U,k,V,D]}class st extends he{constructor(t){super(),_e(this,t,rt,nt,ve,{})}}document.body.className+=" js-enabled"+("noModule"in HTMLScriptElement.prototype?" govuk-frontend-supported":"");new st({target:document.getElementById("app")}); diff --git a/move_draw_controls/assets/nested-4f4d7911.js b/move_draw_controls/assets/nested-4f4d7911.js new file mode 100644 index 00000000..f20eebab --- /dev/null +++ b/move_draw_controls/assets/nested-4f4d7911.js @@ -0,0 +1,80 @@ +var Qs=Object.defineProperty;var xs=(r,e,n)=>e in r?Qs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n;var de=(r,e,n)=>(xs(r,typeof e!="symbol"?e+"":e,n),n);import{S as re,i as ie,s as te,Q as At,e as D,b as z,c as w,T as Ft,U as Nt,V as Rt,t as b,q as y,d as k,W as Ot,j as M,p as P,v as L,X as It,E as Ye,f as ge,a as N,Y as Pe,Z as _e,y as q,o as U,P as he,_ as xn,$ as To,a0 as $e,a1 as Qr,a2 as ke,a3 as xr,a4 as Uo,a5 as el,a6 as Do,a7 as tl,a8 as nl,a9 as at,aa as ce,z as se,r as le,ab as zo,ac as rl,w as H,ad as Xe,ae as il,af as Be,ag as ol,ah as sl,n as Q,J as mn,ai as ll,aj as al,ak as ul,al as fl,am as Ie,an as jr,ao as Br,ap as cl,aq as pl,ar as ml,G as Mt,as as dl,at as Se,au as _t,g as V,h as ee,u as ne,av as Pt,aw as un,D as ut,ax as er,ay as rt,R as Lt,m as Fe,az as Rn,x as it,aA as ue,aB as tn,aC as nn,aD as kt,N as zt,aE as On,aF as We,aG as rn,aH as qr,aI as ei,aJ as Ue,aK as dr,aL as gl,aM as hl,aN as Ge,aO as In,aP as ti,aQ as pt,aR as Jo,aS as _l,aT as dn,aU as ni,aV as bl,aW as tr,aX as ri,aY as ot,O as xe,aZ as Et,a_ as gr,a$ as vl,b0 as $l,I as yl,F as Yo,b1 as Gr,b2 as jn,b3 as ii,b4 as wl,M as kl,A as Sl,L as El,k as Ml,B as Pl,C as Ll,b5 as Cl}from"./index-d36e2ea3.js";import{M as hr,m as Je,b as Xo,l as ae,e as Jt,C as Wo,a as Ct,R as Al,i as St,c as fn,d as cn,f as Yt,g as Fl,h as Zt,S as Nl,j as Rl,k as nr,p as Bn,n as Ol,o as Il,t as jl,r as oi,W as Ko,q as Bl,H as ql,B as Gl,Z as Tl,G as Ul}from"./ZoomOutMap-9b4ebb28.js";import{A as Dl}from"./About-469acba2.js";function zl(r){let e,n;const t=r[1].default,i=At(t,r,r[0],null);return{c(){e=D("div"),i&&i.c(),z(e,"class","govuk-button-group")},m(o,s){w(o,e,s),i&&i.m(e,null),n=!0},p(o,[s]){i&&i.p&&(!n||s&1)&&Ft(i,t,o,o[0],n?Rt(t,o[0],s,null):Nt(o[0]),null)},i(o){n||(b(i,o),n=!0)},o(o){y(i,o),n=!1},d(o){o&&k(e),i&&i.d(o)}}}function Jl(r,e,n){let{$$slots:t={},$$scope:i}=e;return r.$$set=o=>{"$$scope"in o&&n(0,i=o.$$scope)},[i,t]}class Ke extends re{constructor(e){super(),ie(this,e,Jl,zl,te,{})}}function si(r){let e,n,t=qn(r[0])+"",i;return{c(){e=D("div"),n=q("£"),i=q(t),z(e,"class","govuk-hint")},m(o,s){w(o,e,s),U(e,n),U(e,i)},p(o,s){s&1&&t!==(t=qn(o[0])+"")&&he(i,t)},d(o){o&&k(e)}}}function Yl(r){let e;return{c(){e=q("multiply by 1 million")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Xl(r){let e,n,t,i,o,s,a,l,u;e=new Ye({props:{errorMessage:li(r[2])}});let f=r[0]!=null&&si(r);return s=new ge({props:{disabled:r[0]==null||r[0]>1e3,$$slots:{default:[Yl]},$$scope:{ctx:r}}}),s.$on("click",r[4]),{c(){M(e.$$.fragment),n=N(),f&&f.c(),t=N(),i=D("input"),o=N(),M(s.$$.fragment),z(i,"type","text"),z(i,"inputmode","numeric"),z(i,"class","govuk-input govuk-input--width-10"),z(i,"id",r[3])},m(c,p){P(e,c,p),w(c,n,p),f&&f.m(c,p),w(c,t,p),w(c,i,p),Pe(i,r[2]),w(c,o,p),P(s,c,p),a=!0,l||(u=_e(i,"input",r[5]),l=!0)},p(c,p){const m={};p&4&&(m.errorMessage=li(c[2])),e.$set(m),c[0]!=null?f?f.p(c,p):(f=si(c),f.c(),f.m(t.parentNode,t)):f&&(f.d(1),f=null),p&4&&i.value!==c[2]&&Pe(i,c[2]);const h={};p&1&&(h.disabled=c[0]==null||c[0]>1e3),p&128&&(h.$$scope={dirty:p,ctx:c}),s.$set(h)},i(c){a||(b(e.$$.fragment,c),b(s.$$.fragment,c),a=!0)},o(c){y(e.$$.fragment,c),y(s.$$.fragment,c),a=!1},d(c){c&&(k(n),k(t),k(i),k(o)),L(e,c),f&&f.d(c),L(s,c),l=!1,u()}}}function Wl(r){let e,n;return e=new Ot({props:{label:r[1],id:r[3],$$slots:{default:[Xl]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,[i]){const o={};i&2&&(o.label=t[1]),i&133&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Ho(r){if(r!="")return parseFloat(r.replaceAll(",",""))}function li(r){let e=Ho(r);return e==null?"":isNaN(e)?"Please enter a valid number":e<0?"Please enter a positive number":""}function qn(r){return r.toLocaleString()}function Kl(r,e,n){let{label:t}=e,{value:i}=e,o=It(),s=i==null?"":qn(i);function a(f){n(0,i=Ho(f))}function l(){n(2,s=qn(i*1e6))}function u(){s=this.value,n(2,s)}return r.$$set=f=>{"label"in f&&n(1,t=f.label),"value"in f&&n(0,i=f.value)},r.$$.update=()=>{r.$$.dirty&4&&a(s)},[i,t,s,o,l,u]}class Hl extends re{constructor(e){super(),ie(this,e,Kl,Wl,te,{label:1,value:0})}}function Zl(r){let e,n,t,i,o,s,a;return e=new Ye({props:{errorMessage:r[5](r[2])}}),{c(){M(e.$$.fragment),n=N(),t=D("input"),z(t,"type","text"),z(t,"inputmode","numeric"),z(t,"class",i=`govuk-input govuk-input--width-${r[1]}`),z(t,"id",r[3])},m(l,u){P(e,l,u),w(l,n,u),w(l,t,u),Pe(t,r[2]),o=!0,s||(a=[_e(t,"input",r[9]),_e(t,"change",r[4])],s=!0)},p(l,u){const f={};u&4&&(f.errorMessage=l[5](l[2])),e.$set(f),(!o||u&2&&i!==(i=`govuk-input govuk-input--width-${l[1]}`))&&z(t,"class",i),u&4&&t.value!==l[2]&&Pe(t,l[2])},i(l){o||(b(e.$$.fragment,l),o=!0)},o(l){y(e.$$.fragment,l),o=!1},d(l){l&&(k(n),k(t)),L(e,l),s=!1,xn(a)}}}function Vl(r){let e,n;return e=new Ot({props:{label:r[0],id:r[3],$$slots:{default:[Zl]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,[i]){const o={};i&1&&(o.label=t[0]),i&1030&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Ql(r,e,n){let{label:t}=e,{value:i}=e,{width:o}=e,{min:s=void 0}=e,{max:a=void 0}=e,l=i==null?void 0:i.toString(),u=It();function f(){n(6,i=l==null?void 0:parseInt(l,10))}function c(m){if(m==""||m==null)return"";if(m.includes("."))return"Please enter a number without decimals";let h=Number(m);return isNaN(h)?"Please enter a valid number":s!=null&&ha?`Please enter a number that's at most ${a};`:""}function p(){l=this.value,n(2,l)}return r.$$set=m=>{"label"in m&&n(0,t=m.label),"value"in m&&n(6,i=m.value),"width"in m&&n(1,o=m.width),"min"in m&&n(7,s=m.min),"max"in m&&n(8,a=m.max)},[t,o,l,u,f,c,i,s,a,p]}class or extends re{constructor(e){super(),ie(this,e,Ql,Vl,te,{label:0,value:6,width:1,min:7,max:8})}}function ai(r){let e,n;return{c(){e=D("div"),n=q(r[2]),z(e,"class","govuk-hint")},m(t,i){w(t,e,i),U(e,n)},p(t,i){i&4&&he(n,t[2])},d(t){t&&k(e)}}}function xl(r){let e,n,t,i,o,s,a;e=new Ye({props:{errorMessage:r[4]}});let l=r[2]&&ai(r);return{c(){M(e.$$.fragment),n=N(),l&&l.c(),t=N(),i=D("textarea"),z(i,"class","govuk-textarea"),z(i,"id",r[5]),z(i,"rows",r[3])},m(u,f){P(e,u,f),w(u,n,f),l&&l.m(u,f),w(u,t,f),w(u,i,f),Pe(i,r[0]),o=!0,s||(a=_e(i,"input",r[6]),s=!0)},p(u,f){const c={};f&16&&(c.errorMessage=u[4]),e.$set(c),u[2]?l?l.p(u,f):(l=ai(u),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null),(!o||f&8)&&z(i,"rows",u[3]),f&1&&Pe(i,u[0])},i(u){o||(b(e.$$.fragment,u),o=!0)},o(u){y(e.$$.fragment,u),o=!1},d(u){u&&(k(n),k(t),k(i)),L(e,u),l&&l.d(u),s=!1,a()}}}function ea(r){let e,n;return e=new Ot({props:{label:r[1],id:r[5],$$slots:{default:[xl]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,[i]){const o={};i&2&&(o.label=t[1]),i&157&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function ta(r,e,n){let{label:t}=e,{hint:i=""}=e,{value:o}=e,{rows:s=5}=e,{errorMessage:a=""}=e,l=It();function u(){o=this.value,n(0,o)}return r.$$set=f=>{"label"in f&&n(1,t=f.label),"hint"in f&&n(2,i=f.hint),"value"in f&&n(0,o=f.value),"rows"in f&&n(3,s=f.rows),"errorMessage"in f&&n(4,a=f.errorMessage)},[o,t,i,s,a,l,u]}class Tr extends re{constructor(e){super(),ie(this,e,ta,ea,te,{label:1,hint:2,value:0,rows:3,errorMessage:4})}}function na(r){let e,n,t,i,o,s;return e=new Ye({props:{errorMessage:r[2]}}),{c(){M(e.$$.fragment),n=N(),t=D("input"),z(t,"type","text"),z(t,"class","govuk-input"),z(t,"id",r[3])},m(a,l){P(e,a,l),w(a,n,l),w(a,t,l),Pe(t,r[0]),i=!0,o||(s=[_e(t,"input",r[6]),_e(t,"change",r[5])],o=!0)},p(a,l){const u={};l&4&&(u.errorMessage=a[2]),e.$set(u),l&1&&t.value!==a[0]&&Pe(t,a[0])},i(a){i||(b(e.$$.fragment,a),i=!0)},o(a){y(e.$$.fragment,a),i=!1},d(a){a&&(k(n),k(t)),L(e,a),o=!1,xn(s)}}}function ra(r){let e,n;return e=new Ot({props:{label:r[1],id:r[3],$$slots:{default:[na]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,[i]){const o={};i&2&&(o.label=t[1]),i&133&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function ia(r,e,n){let t,{label:i}=e,{value:o}=e,{required:s=!1}=e,a=It();function l(f){To.call(this,r,f)}function u(){o=this.value,n(0,o)}return r.$$set=f=>{"label"in f&&n(1,i=f.label),"value"in f&&n(0,o=f.value),"required"in f&&n(4,s=f.required)},r.$$.update=()=>{r.$$.dirty&17&&n(2,t=s&&(o==null||o=="")?"Required":"")},[o,i,t,a,s,l,u]}class rr extends re{constructor(e){super(),ie(this,e,ia,ra,te,{label:1,value:0,required:4})}}function oa(r){let e,n,t,i;const o=r[2].default,s=At(o,r,r[1],null);let a=[{type:"button"},{class:"govuk-button govuk-button--warning"},{"data-module":"govuk-button"},r[0]],l={};for(let u=0;u{n(0,e=$e($e({},e),xr(s))),"$$scope"in s&&n(1,i=s.$$scope)},e=xr(e),[e,i,t,o]}class bt extends re{constructor(e){super(),ie(this,e,sa,oa,te,{})}}class la{constructor(e){de(this,"map");de(this,"active");de(this,"eventListenersSuccess");de(this,"eventListenersFailure");de(this,"cursor");de(this,"onMouseMove",e=>{this.active&&(this.cursor={type:"Feature",properties:{},geometry:{type:"Point",coordinates:Uo(e.lngLat.toArray())}})});de(this,"onClick",()=>{if(this.active&&this.cursor){for(let e of this.eventListenersSuccess)e(this.cursor);this.stop()}});de(this,"onKeyDown",e=>{this.active&&e.key=="Escape"&&(e.stopPropagation(),this.cancel())});this.map=e,this.active=!1,this.eventListenersSuccess=[],this.eventListenersFailure=[],this.cursor=null,this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),document.removeEventListener("keydown",this.onKeyDown)}cancel(){for(let e of this.eventListenersFailure)e();this.stop()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersFailure=[]}start(){this.map.getCanvas().style.cursor="crosshair",this.active=!0}stop(){this.map.getCanvas().style.cursor="inherit",this.cursor=null,this.active=!1}}function aa(r){var e=r%(2*Math.PI);return e*180/Math.PI}function vn(r){var e=r%360;return e*Math.PI/180}function gt(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return r.geometry.coordinates;if(r.type==="Point")return r.coordinates}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return r;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Qe(r){if(Array.isArray(r))return r;if(r.type==="Feature"){if(r.geometry!==null)return r.geometry.coordinates}else if(r.coordinates)return r.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function _r(r,e){return r.type==="FeatureCollection"?"FeatureCollection":r.type==="GeometryCollection"?"GeometryCollection":r.type==="Feature"&&r.geometry!==null?r.geometry.type:r.type}function Zo(r,e,n){if(n===void 0&&(n={}),n.final===!0)return ua(r,e);var t=gt(r),i=gt(e),o=vn(t[0]),s=vn(i[0]),a=vn(t[1]),l=vn(i[1]),u=Math.sin(s-o)*Math.cos(l),f=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(s-o);return aa(Math.atan2(u,f))}function ua(r,e){var n=Zo(e,r);return n=(n+180)%360,n}var Re=63710088e-1,fa={centimeters:Re*100,centimetres:Re*100,degrees:Re/111325,feet:Re*3.28084,inches:Re*39.37,kilometers:Re/1e3,kilometres:Re/1e3,meters:Re,metres:Re,miles:Re/1609.344,millimeters:Re*1e3,millimetres:Re*1e3,nauticalmiles:Re/1852,radians:1,yards:Re*1.0936};function ca(r,e){e===void 0&&(e="kilometers");var n=fa[e];if(!n)throw new Error(e+" units is invalid");return r*n}function $n(r){var e=r%360;return e*Math.PI/180}function ft(r,e,n){n===void 0&&(n={});var t=gt(r),i=gt(e),o=$n(i[1]-t[1]),s=$n(i[0]-t[0]),a=$n(t[1]),l=$n(i[1]),u=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(l);return ca(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),n.units)}var Oe=63710088e-1,pa={centimeters:Oe*100,centimetres:Oe*100,degrees:Oe/111325,feet:Oe*3.28084,inches:Oe*39.37,kilometers:Oe/1e3,kilometres:Oe/1e3,meters:Oe,metres:Oe,miles:Oe/1609.344,millimeters:Oe*1e3,millimetres:Oe*1e3,nauticalmiles:Oe/1852,radians:1,yards:Oe*1.0936};function ma(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function da(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!fi(r[0])||!fi(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return ma(t,e,n)}function ga(r,e){e===void 0&&(e="kilometers");var n=pa[e];if(!n)throw new Error(e+" units is invalid");return r/n}function ui(r){var e=r%(2*Math.PI);return e*180/Math.PI}function sr(r){var e=r%360;return e*Math.PI/180}function fi(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function ci(r,e,n,t){t===void 0&&(t={});var i=gt(r),o=sr(i[0]),s=sr(i[1]),a=sr(n),l=ga(e,t.units),u=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(a)),f=o+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(u)),c=ui(f),p=ui(u);return da([c,p],t.properties)}function br(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function ha(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!mi(r[0])||!mi(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return br(t,e,n)}function pi(r,e){e===void 0&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=r,n}function mi(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function _a(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function ba(r,e,n){if(n===void 0&&(n={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:r};return _a(t,e,n)}function va(r,e){e===void 0&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=r,n}function Gn(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function Gt(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!di(r[0])||!di(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return Gn(t,e,n)}function Dt(r,e,n){if(n===void 0&&(n={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:r};return Gn(t,e,n)}function di(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function Vo(r){return!!r&&r.constructor===Object}function jt(r,e,n){if(r!==null)for(var t,i,o,s,a,l,u,f=0,c=0,p,m=r.type,h=m==="FeatureCollection",v=m==="Feature",$=h?r.features.length:1,C=0;C<$;C++){u=h?r.features[C].geometry:v?r.geometry:r,p=u?u.type==="GeometryCollection":!1,a=p?u.geometries.length:1;for(var g=0;gl||h>u||v>f){a=c,l=t,u=h,f=v,o=0;return}var $=Dt([a,c],n.properties);if(e($,t,i,v,o)===!1)return!1;o++,a=c})===!1)return!1}}})}function ts(r,e,n){var t=n,i=!1;return es(r,function(o,s,a,l,u){i===!1&&n===void 0?t=o:t=e(t,o,s,a,l,u),i=!0}),t}function ns(r,e){if(!r)throw new Error("geojson is required");Bt(r,function(n,t,i){if(n.geometry!==null){var o=n.geometry.type,s=n.geometry.coordinates;switch(o){case"LineString":if(e(n,t,i,0,0)===!1)return!1;break;case"Polygon":for(var a=0;ai?n:i,u=t>o?t:o;return[s,a,l,u]}var Dr={exports:{}},rs={exports:{}};(function(r,e){(function(n,t){r.exports=t()})(el,function(){function n(g,_,E,d,S){(function R(j,T,B,O,A){for(;O>B;){if(O-B>600){var F=O-B+1,I=T-B+1,X=Math.log(F),J=.5*Math.exp(2*X/3),x=.5*Math.sqrt(X*J*(F-J)/F)*(I-F/2<0?-1:1),G=Math.max(B,Math.floor(T-I*J/F+x)),fe=Math.min(O,Math.floor(T+(F-I)*J/F+x));R(j,T,G,fe,A)}var me=j[T],be=B,ve=O;for(t(j,B,T),A(j[O],me)>0&&t(j,B,O);be0;)ve--}A(j[B],me)===0?t(j,B,ve):t(j,++ve,O),ve<=T&&(B=ve+1),T<=ve&&(O=ve-1)}})(g,_,E||0,d||g.length-1,S||i)}function t(g,_,E){var d=g[_];g[_]=g[E],g[E]=d}function i(g,_){return g<_?-1:g>_?1:0}var o=function(g){g===void 0&&(g=9),this._maxEntries=Math.max(4,g),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(g,_,E){if(!E)return _.indexOf(g);for(var d=0;d<_.length;d++)if(E(g,_[d]))return d;return-1}function a(g,_){l(g,0,g.children.length,_,g)}function l(g,_,E,d,S){S||(S=$(null)),S.minX=1/0,S.minY=1/0,S.maxX=-1/0,S.maxY=-1/0;for(var R=_;R=g.minX&&_.maxY>=g.minY}function $(g){return{children:g,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function C(g,_,E,d,S){for(var R=[_,E];R.length;)if(!((E=R.pop())-(_=R.pop())<=d)){var j=_+Math.ceil((E-_)/d/2)*d;n(g,j,_,E,S),R.push(_,j,j,E)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(g){var _=this.data,E=[];if(!v(g,_))return E;for(var d=this.toBBox,S=[];_;){for(var R=0;R<_.children.length;R++){var j=_.children[R],T=_.leaf?d(j):j;v(g,T)&&(_.leaf?E.push(j):h(g,T)?this._all(j,E):S.push(j))}_=S.pop()}return E},o.prototype.collides=function(g){var _=this.data;if(!v(g,_))return!1;for(var E=[];_;){for(var d=0;d<_.children.length;d++){var S=_.children[d],R=_.leaf?this.toBBox(S):S;if(v(g,R)){if(_.leaf||h(g,R))return!0;E.push(S)}}_=E.pop()}return!1},o.prototype.load=function(g){if(!g||!g.length)return this;if(g.length=0&&S[_].children.length>this._maxEntries;)this._split(S,_),_--;this._adjustParentBBoxes(d,S,_)},o.prototype._split=function(g,_){var E=g[_],d=E.children.length,S=this._minEntries;this._chooseSplitAxis(E,S,d);var R=this._chooseSplitIndex(E,S,d),j=$(E.children.splice(R,E.children.length-R));j.height=E.height,j.leaf=E.leaf,a(E,this.toBBox),a(j,this.toBBox),_?g[_-1].children.push(j):this._splitRoot(E,j)},o.prototype._splitRoot=function(g,_){this.data=$([g,_]),this.data.height=g.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(g,_,E){for(var d,S,R,j,T,B,O,A=1/0,F=1/0,I=_;I<=E-_;I++){var X=l(g,0,I,this.toBBox),J=l(g,I,E,this.toBBox),x=(S=X,R=J,j=void 0,T=void 0,B=void 0,O=void 0,j=Math.max(S.minX,R.minX),T=Math.max(S.minY,R.minY),B=Math.min(S.maxX,R.maxX),O=Math.min(S.maxY,R.maxY),Math.max(0,B-j)*Math.max(0,O-T)),G=p(X)+p(J);x=_;A--){var F=g.children[A];u(j,g.leaf?S(F):F),T+=m(j)}return T},o.prototype._adjustParentBBoxes=function(g,_,E){for(var d=E;d>=0;d--)u(_[d],g)},o.prototype._condense=function(g){for(var _=g.length-1,E=void 0;_>=0;_--)g[_].children.length===0?_>0?(E=g[_-1].children).splice(E.indexOf(g[_]),1):this.clear():a(g[_],this.toBBox)},o})})(rs);var Na=rs.exports,is={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.earthRadius=63710088e-1,r.factors={centimeters:r.earthRadius*100,centimetres:r.earthRadius*100,degrees:r.earthRadius/111325,feet:r.earthRadius*3.28084,inches:r.earthRadius*39.37,kilometers:r.earthRadius/1e3,kilometres:r.earthRadius/1e3,meters:r.earthRadius,metres:r.earthRadius,miles:r.earthRadius/1609.344,millimeters:r.earthRadius*1e3,millimetres:r.earthRadius*1e3,nauticalmiles:r.earthRadius/1852,radians:1,yards:r.earthRadius*1.0936},r.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/r.earthRadius,yards:1.0936133},r.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function e(O,A,F){F===void 0&&(F={});var I={type:"Feature"};return(F.id===0||F.id)&&(I.id=F.id),F.bbox&&(I.bbox=F.bbox),I.properties=A||{},I.geometry=O,I}r.feature=e;function n(O,A,F){switch(O){case"Point":return t(A).geometry;case"LineString":return a(A).geometry;case"Polygon":return o(A).geometry;case"MultiPoint":return c(A).geometry;case"MultiLineString":return f(A).geometry;case"MultiPolygon":return p(A).geometry;default:throw new Error(O+" is invalid")}}r.geometry=n;function t(O,A,F){if(F===void 0&&(F={}),!O)throw new Error("coordinates is required");if(!Array.isArray(O))throw new Error("coordinates must be an Array");if(O.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!R(O[0])||!R(O[1]))throw new Error("coordinates must contain numbers");var I={type:"Point",coordinates:O};return e(I,A,F)}r.point=t;function i(O,A,F){return F===void 0&&(F={}),u(O.map(function(I){return t(I,A)}),F)}r.points=i;function o(O,A,F){F===void 0&&(F={});for(var I=0,X=O;I=0))throw new Error("precision must be a positive number");var F=Math.pow(10,A||0);return Math.round(O*F)/F}r.round=h;function v(O,A){A===void 0&&(A="kilometers");var F=r.factors[A];if(!F)throw new Error(A+" units is invalid");return O*F}r.radiansToLength=v;function $(O,A){A===void 0&&(A="kilometers");var F=r.factors[A];if(!F)throw new Error(A+" units is invalid");return O/F}r.lengthToRadians=$;function C(O,A){return _($(O,A))}r.lengthToDegrees=C;function g(O){var A=O%360;return A<0&&(A+=360),A}r.bearingToAzimuth=g;function _(O){var A=O%(2*Math.PI);return A*180/Math.PI}r.radiansToDegrees=_;function E(O){var A=O%360;return A*Math.PI/180}r.degreesToRadians=E;function d(O,A,F){if(A===void 0&&(A="kilometers"),F===void 0&&(F="kilometers"),!(O>=0))throw new Error("length must be a positive number");return v($(O,A),F)}r.convertLength=d;function S(O,A,F){if(A===void 0&&(A="meters"),F===void 0&&(F="kilometers"),!(O>=0))throw new Error("area must be a positive number");var I=r.areaFactors[A];if(!I)throw new Error("invalid original units");var X=r.areaFactors[F];if(!X)throw new Error("invalid final units");return O/I*X}r.convertArea=S;function R(O){return!isNaN(O)&&O!==null&&!Array.isArray(O)}r.isNumber=R;function j(O){return!!O&&O.constructor===Object}r.isObject=j;function T(O){if(!O)throw new Error("bbox is required");if(!Array.isArray(O))throw new Error("bbox must be an Array");if(O.length!==4&&O.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");O.forEach(function(A){if(!R(A))throw new Error("bbox must only contain numbers")})}r.validateBBox=T;function B(O){if(!O)throw new Error("id is required");if(["string","number"].indexOf(typeof O)===-1)throw new Error("id must be a number or a string")}r.validateId=B})(is);const Ra=Do(La),Oa=Do(tl);var He=Na,os=is,ss=Ra,Tt=Oa.default,Ia=ss.featureEach;ss.coordEach;os.polygon;var gi=os.featureCollection;function ls(r){var e=new He(r);return e.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Tt(n),He.prototype.insert.call(this,n)},e.load=function(n){var t=[];return Array.isArray(n)?n.forEach(function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:Tt(i),t.push(i)}):Ia(n,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:Tt(i),t.push(i)}),He.prototype.load.call(this,t)},e.remove=function(n,t){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Tt(n),He.prototype.remove.call(this,n,t)},e.clear=function(){return He.prototype.clear.call(this)},e.search=function(n){var t=He.prototype.search.call(this,this.toBBox(n));return gi(t)},e.collides=function(n){return He.prototype.collides.call(this,this.toBBox(n))},e.all=function(){var n=He.prototype.all.call(this);return gi(n)},e.toJSON=function(){return He.prototype.toJSON.call(this)},e.fromJSON=function(n){return He.prototype.fromJSON.call(this,n)},e.toBBox=function(n){var t;if(n.bbox)t=n.bbox;else if(Array.isArray(n)&&n.length===4)t=n;else if(Array.isArray(n)&&n.length===6)t=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")t=Tt(n);else if(n.type==="FeatureCollection")t=Tt(n);else throw new Error("invalid geojson");return{minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]}},e}Dr.exports=ls;Dr.exports.default=ls;var ja=Dr.exports;const zr=nl(ja);function as(r,e){var n={},t=[];if(r.type==="LineString"&&(r=br(r)),e.type==="LineString"&&(e=br(e)),r.type==="Feature"&&e.type==="Feature"&&r.geometry!==null&&e.geometry!==null&&r.geometry.type==="LineString"&&e.geometry.type==="LineString"&&r.geometry.coordinates.length===2&&e.geometry.coordinates.length===2){var i=hi(r,e);return i&&t.push(i),pi(t)}var o=zr();return o.load(vr(e)),Xt(vr(r),function(s){Xt(o.search(s),function(a){var l=hi(s,a);if(l){var u=Qe(l).join(",");n[u]||(n[u]=!0,t.push(l))}})}),pi(t)}function hi(r,e){var n=Qe(r),t=Qe(e);if(n.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(t.length!==2)throw new Error(" line2 must only contain 2 coordinates");var i=n[0][0],o=n[0][1],s=n[1][0],a=n[1][1],l=t[0][0],u=t[0][1],f=t[1][0],c=t[1][1],p=(c-u)*(s-i)-(f-l)*(a-o),m=(f-l)*(o-u)-(c-u)*(i-l),h=(s-i)*(o-u)-(a-o)*(i-l);if(p===0)return null;var v=m/p,$=h/p;if(v>=0&&v<=1&&$>=0&&$<=1){var C=i+v*(s-i),g=o+v*(a-o);return ha([C,g])}return null}function us(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function lr(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!bi(r[0])||!bi(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return us(t,e,n)}function _i(r,e,n){if(n===void 0&&(n={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:r};return us(t,e,n)}function bi(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function Tn(r,e,n){n===void 0&&(n={});var t=lr([1/0,1/0],{dist:1/0}),i=0;return Bt(r,function(o){for(var s=Qe(o),a=0;a0&&($=v.features[0],$.properties.dist=ft(e,$,n),$.properties.location=i+ft(l,$,n)),l.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(e);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let n=this.dragFrom[0]-e.lngLat.lng,t=this.dragFrom[1]-e.lngLat.lat;for(let i of this.points)i[0]-=n,i[1]-=t}else this.points[this.hover]=e.lngLat.toArray();this.dragFrom=e.lngLat.toArray(),this.redraw()}});de(this,"onClick",e=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(vi(this.points).forEach((t,i)=>{n.push([i+1,Tn(t,this.cursor).properties.dist])}),n.sort((t,i)=>t[1]-i[1]),n.length>0){let t=n[0][0];this.points.splice(t,0,this.cursor.geometry.coordinates),this.hover=t}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(e))});de(this,"onDoubleClick",e=>{this.active&&(e.preventDefault(),this.cursor=ar(e.lngLat.toArray()),this.onClick(e),this.finish())});de(this,"onMouseDown",e=>{this.active&&!this.dragFrom&&this.hover!=null&&(e.preventDefault(),this.cursor=null,this.dragFrom=e.lngLat.toArray(),this.beforeUpdate(),this.redraw())});de(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});de(this,"onKeypress",e=>{this.active&&(e.key=="Enter"?(e.stopPropagation(),this.finish()):e.key=="z"&&e.ctrlKey&&this.undo())});de(this,"onKeyDown",e=>{this.active&&e.key=="Escape"&&(e.stopPropagation(),this.cancel())});this.map=e,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let e=this.polygonFeature();if(e)for(let n of this.eventListenersSuccess)n(e);else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){for(let e of this.eventListenersFailure)e();this.stop()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(e){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(e.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let e=fs();this.points.forEach((i,o)=>{let s=ar(i);s.properties.hover=this.hover==o,s.properties.idx=o,e.features.push(s)}),e.features=e.features.concat(vi(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",e.features.push(n)),ps.set(e);let t="crosshair";this.hover!=null&&(t=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=t,ms.set(this.previousStates.length)}pointsUpdated(){let e=this.polygonFeature();if(e)for(let n of this.eventListenersUpdated)n(e)}recalculateHovering(e){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(e.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(n.geometry.type=="Polygon"){this.hover="polygon";break}else if(n.geometry.type=="Point"&&Object.hasOwn(n.properties,"idx")){this.hover=n.properties.idx;break}this.hover==null&&(this.cursor=ar(e.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let e=this.points.map(cs),n=[JSON.parse(JSON.stringify(e))];return n[0].push(JSON.parse(JSON.stringify(n[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:n},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>Ba&&this.previousStates.shift()}}function vi(r){let e=[];for(let n=0;n=3&&e.push({type:"Feature",geometry:{type:"LineString",coordinates:[r[r.length-1],r[0]]},properties:{}}),e}class ur{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const n=this._partials;let t=0;for(let i=0;i0){for(s=e[--n];n>0&&(t=s,i=e[--n],s=t+i,o=i-(s-t),!o););n>0&&(o<0&&e[n-1]<0||o>0&&e[n-1]>0)&&(i=o*2,t=s+i,i==t-s&&(s=t))}return s}}var Ga=1e-6,$i=1e-12,Jr=Math.PI,yi=Jr/2,wi=180/Jr,et=Jr/180,ds=Math.atan2,tt=Math.cos,$r=Math.hypot,nt=Math.sin,Ta=Math.sqrt;function gs(r){return r>1?yi:r<-1?-yi:Math.asin(r)}function Ua(){}function Un(r,e){r&&Si.hasOwnProperty(r.type)&&Si[r.type](r,e)}var ki={Feature:function(r,e){Un(r.geometry,e)},FeatureCollection:function(r,e){for(var n=r.features,t=-1,i=n.length;++t{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&vs.decode();let Qt=null;function on(){return(Qt===null||Qt.byteLength===0)&&(Qt=new Uint8Array(K.memory.buffer)),Qt}function Ve(r,e){return r=r>>>0,vs.decode(on().subarray(r,r+e))}const lt=new Array(128).fill(void 0);lt.push(void 0,null,!0,!1);let sn=lt.length;function ye(r){sn===lt.length&<.push(lt.length+1);const e=sn;return sn=lt[e],lt[e]=r,e}function oe(r){return lt[r]}function Ha(r){r<132||(lt[r]=sn,sn=r)}function Mn(r){const e=oe(r);return Ha(r),e}function fr(r){return r==null}let xt=null;function Za(){return(xt===null||xt.byteLength===0)&&(xt=new Float64Array(K.memory.buffer)),xt}let en=null;function pe(){return(en===null||en.byteLength===0)&&(en=new Int32Array(K.memory.buffer)),en}let mt=0;const Pn=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Va=typeof Pn.encodeInto=="function"?function(r,e){return Pn.encodeInto(r,e)}:function(r,e){const n=Pn.encode(r);return e.set(n),{read:r.length,written:n.length}};function yn(r,e,n){if(n===void 0){const a=Pn.encode(r),l=e(a.length,1)>>>0;return on().subarray(l,l+a.length).set(a),mt=a.length,l}let t=r.length,i=e(t,1)>>>0;const o=on();let s=0;for(;s127)break;o[i+s]=a}if(s!==t){s!==0&&(r=r.slice(s)),i=n(i,t,t=s+r.length*3,1)>>>0;const a=on().subarray(i+s,i+t),l=Va(r,a);s+=l.written}return mt=s,i}function Er(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const i=r.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){const i=r.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(r)){const i=r.length;let o="[";i>0&&(o+=Er(r[0]));for(let s=1;s1)t=n[1];else return toString.call(r);if(t=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message} +${r.stack}`:t}function Qa(r,e){const n=e(r.length*1,1)>>>0;return on().set(r,n/1),mt=r.length,n}function cr(r,e){try{return r.apply(this,e)}catch(n){K.__wbindgen_exn_store(ye(n))}}class Hn{static __wrap(e){e=e>>>0;const n=Object.create(Hn.prototype);return n.__wbg_ptr=e,n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();K.__wbg_jsroutesnapper_free(e)}constructor(e){try{const o=K.__wbindgen_add_to_stack_pointer(-16),s=Qa(e,K.__wbindgen_malloc),a=mt;K.jsroutesnapper_new(o,s,a);var n=pe()[o/4+0],t=pe()[o/4+1],i=pe()[o/4+2];if(i)throw Mn(t);return Hn.__wrap(n)}finally{K.__wbindgen_add_to_stack_pointer(16)}}setRouteConfig(e){K.jsroutesnapper_setRouteConfig(this.__wbg_ptr,ye(e))}setAreaMode(){K.jsroutesnapper_setAreaMode(this.__wbg_ptr)}getConfig(){let e,n;try{const o=K.__wbindgen_add_to_stack_pointer(-16);K.jsroutesnapper_getConfig(o,this.__wbg_ptr);var t=pe()[o/4+0],i=pe()[o/4+1];return e=t,n=i,Ve(t,i)}finally{K.__wbindgen_add_to_stack_pointer(16),K.__wbindgen_free(e,n,1)}}toFinalFeature(){try{const t=K.__wbindgen_add_to_stack_pointer(-16);K.jsroutesnapper_toFinalFeature(t,this.__wbg_ptr);var e=pe()[t/4+0],n=pe()[t/4+1];let i;return e!==0&&(i=Ve(e,n).slice(),K.__wbindgen_free(e,n*1)),i}finally{K.__wbindgen_add_to_stack_pointer(16)}}renderGeojson(){let e,n;try{const o=K.__wbindgen_add_to_stack_pointer(-16);K.jsroutesnapper_renderGeojson(o,this.__wbg_ptr);var t=pe()[o/4+0],i=pe()[o/4+1];return e=t,n=i,Ve(t,i)}finally{K.__wbindgen_add_to_stack_pointer(16),K.__wbindgen_free(e,n,1)}}toggleSnapMode(){K.jsroutesnapper_toggleSnapMode(this.__wbg_ptr)}onMouseMove(e,n,t){return K.jsroutesnapper_onMouseMove(this.__wbg_ptr,e,n,t)!==0}onClick(){K.jsroutesnapper_onClick(this.__wbg_ptr)}onDragStart(){return K.jsroutesnapper_onDragStart(this.__wbg_ptr)!==0}onMouseUp(){return K.jsroutesnapper_onMouseUp(this.__wbg_ptr)!==0}clearState(){K.jsroutesnapper_clearState(this.__wbg_ptr)}editExisting(e){try{const i=K.__wbindgen_add_to_stack_pointer(-16);K.jsroutesnapper_editExisting(i,this.__wbg_ptr,ye(e));var n=pe()[i/4+0],t=pe()[i/4+1];if(t)throw Mn(n)}finally{K.__wbindgen_add_to_stack_pointer(16)}}debugRenderGraph(){let e,n;try{const o=K.__wbindgen_add_to_stack_pointer(-16);K.jsroutesnapper_debugRenderGraph(o,this.__wbg_ptr);var t=pe()[o/4+0],i=pe()[o/4+1];return e=t,n=i,Ve(t,i)}finally{K.__wbindgen_add_to_stack_pointer(16),K.__wbindgen_free(e,n,1)}}debugSnappableNodes(){let e,n;try{const o=K.__wbindgen_add_to_stack_pointer(-16);K.jsroutesnapper_debugSnappableNodes(o,this.__wbg_ptr);var t=pe()[o/4+0],i=pe()[o/4+1];return e=t,n=i,Ve(t,i)}finally{K.__wbindgen_add_to_stack_pointer(16),K.__wbindgen_free(e,n,1)}}routeNameForWaypoints(e){let n,t;try{const f=K.__wbindgen_add_to_stack_pointer(-16);K.jsroutesnapper_routeNameForWaypoints(f,this.__wbg_ptr,ye(e));var i=pe()[f/4+0],o=pe()[f/4+1],s=pe()[f/4+2],a=pe()[f/4+3],l=i,u=o;if(a)throw l=0,u=0,Mn(s);return n=l,t=u,Ve(l,u)}finally{K.__wbindgen_add_to_stack_pointer(16),K.__wbindgen_free(n,t,1)}}addSnappedWaypoint(e,n){K.jsroutesnapper_addSnappedWaypoint(this.__wbg_ptr,e,n)}undo(){K.jsroutesnapper_undo(this.__wbg_ptr)}}async function xa(r,e){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(t){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t);else throw t}const n=await r.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(r,e);return n instanceof WebAssembly.Instance?{instance:n,module:r}:n}}function eu(){const r={};return r.wbg={},r.wbg.__wbindgen_string_new=function(e,n){const t=Ve(e,n);return ye(t)},r.wbg.__wbindgen_object_drop_ref=function(e){Mn(e)},r.wbg.__wbindgen_error_new=function(e,n){const t=new Error(Ve(e,n));return ye(t)},r.wbg.__wbindgen_is_object=function(e){const n=oe(e);return typeof n=="object"&&n!==null},r.wbg.__wbindgen_is_undefined=function(e){return oe(e)===void 0},r.wbg.__wbindgen_in=function(e,n){return oe(e)in oe(n)},r.wbg.__wbindgen_number_get=function(e,n){const t=oe(n),i=typeof t=="number"?t:void 0;Za()[e/8+1]=fr(i)?0:i,pe()[e/4+0]=!fr(i)},r.wbg.__wbindgen_boolean_get=function(e){const n=oe(e);return typeof n=="boolean"?n?1:0:2},r.wbg.__wbindgen_jsval_loose_eq=function(e,n){return oe(e)==oe(n)},r.wbg.__wbindgen_string_get=function(e,n){const t=oe(n),i=typeof t=="string"?t:void 0;var o=fr(i)?0:yn(i,K.__wbindgen_malloc,K.__wbindgen_realloc),s=mt;pe()[e/4+1]=s,pe()[e/4+0]=o},r.wbg.__wbg_getwithrefkey_d1f0d12f1f1b63ea=function(e,n){const t=oe(e)[oe(n)];return ye(t)},r.wbg.__wbindgen_object_clone_ref=function(e){const n=oe(e);return ye(n)},r.wbg.__wbg_String_4370c5505c674d30=function(e,n){const t=String(oe(n)),i=yn(t,K.__wbindgen_malloc,K.__wbindgen_realloc),o=mt;pe()[e/4+1]=o,pe()[e/4+0]=i},r.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return ye(e)},r.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const t=oe(n).stack,i=yn(t,K.__wbindgen_malloc,K.__wbindgen_realloc),o=mt;pe()[e/4+1]=o,pe()[e/4+0]=i},r.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let t,i;try{t=e,i=n,console.error(Ve(e,n))}finally{K.__wbindgen_free(t,i,1)}},r.wbg.__wbg_debug_9a6b3243fbbebb61=function(e){console.debug(oe(e))},r.wbg.__wbg_error_788ae33f81d3b84b=function(e){console.error(oe(e))},r.wbg.__wbg_info_2e30e8204b29d91d=function(e){console.info(oe(e))},r.wbg.__wbg_log_1d3ae0273d8f4f8a=function(e){console.log(oe(e))},r.wbg.__wbg_warn_d60e832f9882c1b2=function(e){console.warn(oe(e))},r.wbg.__wbg_get_44be0491f933a435=function(e,n){const t=oe(e)[n>>>0];return ye(t)},r.wbg.__wbg_length_fff51ee6522a1a18=function(e){return oe(e).length},r.wbg.__wbindgen_is_function=function(e){return typeof oe(e)=="function"},r.wbg.__wbg_next_526fc47e980da008=function(e){const n=oe(e).next;return ye(n)},r.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return cr(function(e){const n=oe(e).next();return ye(n)},arguments)},r.wbg.__wbg_done_5c1f01fb660d73b5=function(e){return oe(e).done},r.wbg.__wbg_value_1695675138684bd5=function(e){const n=oe(e).value;return ye(n)},r.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return ye(Symbol.iterator)},r.wbg.__wbg_get_97b561fb56f034b5=function(){return cr(function(e,n){const t=Reflect.get(oe(e),oe(n));return ye(t)},arguments)},r.wbg.__wbg_call_cb65541d95d71282=function(){return cr(function(e,n){const t=oe(e).call(oe(n));return ye(t)},arguments)},r.wbg.__wbg_isArray_4c24b343cb13cfb1=function(e){return Array.isArray(oe(e))},r.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(e){let n;try{n=oe(e)instanceof ArrayBuffer}catch{n=!1}return n},r.wbg.__wbg_buffer_085ec1f694018c4f=function(e){const n=oe(e).buffer;return ye(n)},r.wbg.__wbg_new_8125e318e6245eed=function(e){const n=new Uint8Array(oe(e));return ye(n)},r.wbg.__wbg_set_5cf90238115182c3=function(e,n,t){oe(e).set(oe(n),t>>>0)},r.wbg.__wbg_length_72e2208bbc0efc61=function(e){return oe(e).length},r.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(e){let n;try{n=oe(e)instanceof Uint8Array}catch{n=!1}return n},r.wbg.__wbindgen_debug_string=function(e,n){const t=Er(oe(n)),i=yn(t,K.__wbindgen_malloc,K.__wbindgen_realloc),o=mt;pe()[e/4+1]=o,pe()[e/4+0]=i},r.wbg.__wbindgen_throw=function(e,n){throw new Error(Ve(e,n))},r.wbg.__wbindgen_memory=function(){const e=K.memory;return ye(e)},r}function tu(r,e){return K=r.exports,$s.__wbindgen_wasm_module=e,xt=null,en=null,Qt=null,K}async function $s(r){if(K!==void 0)return K;typeof r>"u"&&(r="/atip/move_draw_controls/assets/route_snapper_bg.wasm");const e=eu();(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:n,module:t}=await xa(await r,e);return tu(n,t)}function nu(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function ru(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Li(r[0])||!Li(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return nu(t,e,n)}function Li(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function Mr(r,e){return e===void 0&&(e={}),ts(r,function(n,t){var i=t.geometry.coordinates;return n+ft(i[0],i[1],e)},0)}function iu(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function ou(r,e,n){if(n===void 0&&(n={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:r};return iu(t,e,n)}function su(r,e,n){var t=Qe(n);if(_r(n)!=="LineString")throw new Error("line must be a LineString");var i=Tn(n,r),o=Tn(n,e),s;i.properties.index<=o.properties.index?s=[i,o]:s=[o,i];for(var a=[s[0].geometry.coordinates],l=s[0].properties.index+1;l=s){var a=(n+i)/2;return[e,a-(t-e)/2,t,a+(t-e)/2]}else{var l=(e+t)/2;return[l-(i-n)/2,n,l+(i-n)/2,i]}}function Pr(r){var e=[1/0,1/0,-1/0,-1/0];return jt(r,function(n){e[0]>n[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2] is required");if(typeof n!="number")throw new Error(" must be a number");if(typeof t!="number")throw new Error(" must be a number");(i===!1||i===void 0)&&(r=JSON.parse(JSON.stringify(r)));var o=Math.pow(10,n);return jt(r,function(s){uu(s,o,t)}),r}function uu(r,e,n){r.length>n&&r.splice(n,r.length);for(var t=0;t1&&n.push(Ci(f)),ln(n)}function ys(r,e){if(!e.features.length)throw new Error("lines must contain features");if(e.features.length===1)return e.features[0];var n,t=1/0;return Xt(e,function(i){var o=Tn(i,r),s=o.properties.dist;s{if(!this.active)return;const a=[s.point.x-du,s.point.y],l=this.map.unproject(s.point).distanceTo(this.map.unproject(a));this.inner.onMouseMove(s.lngLat.lng,s.lngLat.lat,l)&&(this.redraw(),this.dataUpdated())},this.onClick=()=>{this.active&&(this.inner.onClick(),this.redraw(),this.dataUpdated())},this.onDoubleClick=s=>{this.active&&(s.preventDefault(),this.inner.onClick(),this.finish())},this.onDragStart=()=>{this.active&&this.inner.onDragStart()&&this.map.dragPan.disable()},this.onMouseUp=()=>{this.active&&this.inner.onMouseUp()&&this.map.dragPan.enable()},this.onKeyDown=s=>{this.active&&s.key=="Escape"&&(s.stopPropagation(),this.cancel())},this.onKeyPress=s=>{this.active&&s.target.tagName!="INPUT"&&(s.key=="Enter"?(s.stopPropagation(),this.finish()):s.key=="s"||s.key=="S"?(s.stopPropagation(),this.inner.toggleSnapMode(),this.redraw()):s.key=="z"&&s.ctrlKey&&this.undo())},this.map=e,console.time("Deserialize and setup JsRouteSnapper"),this.inner=new Hn(n),console.timeEnd("Deserialize and setup JsRouteSnapper"),this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.routeToolGj=t,this.snapMode=i,this.undoLength=o,this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("dragstart",this.onDragStart),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keypress",this.onKeyPress)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("dragstart",this.onDragStart),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keypress",this.onKeyPress)}startRoute(){this.active||(this.active=!0,this.map.boxZoom.disable(),this.map.doubleClickZoom.disable())}startArea(){this.active||(this.inner.setAreaMode(),this.active=!0,this.map.boxZoom.disable(),this.map.doubleClickZoom.disable())}stop(){this.active=!1,this.inner.clearState(),this.redraw(),this.map.boxZoom.enable(),this.map.doubleClickZoom.enable()}editExistingRoute(e){this.active&&window.alert("Bug: editExistingRoute called when tool is already active"),e.properties.waypoints||(e.properties.waypoints=[{lon:e.geometry.coordinates[0][0],lat:e.geometry.coordinates[0][1],snapped:!0},{lon:e.geometry.coordinates[e.geometry.coordinates.length-1][0],lat:e.geometry.coordinates[e.geometry.coordinates.length-1][1],snapped:!0}]),this.startRoute(),this.inner.editExisting(e.properties.waypoints),this.redraw()}editExistingArea(e){this.active&&window.alert("Bug: editExistingArea called when tool is already active"),e.properties.waypoints||window.alert("Bug: editExistingArea called for a polygon not produced by the route-snapper"),this.startArea(),this.inner.editExisting(e.properties.waypoints),this.redraw()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}isActive(){return this.active}finish(){let e=this.inner.toFinalFeature();if(e)for(let n of this.eventListenersSuccess)n(JSON.parse(e));else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){this.inner.clearState(),this.finish()}setRouteConfig(e){this.inner.setRouteConfig(e),this.redraw()}addSnappedWaypoint(e){this.inner.addSnappedWaypoint(e[0],e[1]),this.redraw()}undo(){this.inner.undo(),this.redraw()}toggleSnapMode(){this.inner.toggleSnapMode(),this.redraw()}redraw(){let e=JSON.parse(this.inner.renderGeojson());this.routeToolGj.set(e),this.map.getCanvas().style.cursor=e.cursor,this.snapMode.set(e.snap_mode),this.undoLength.set(e.undo_length)}dataUpdated(){let e=this.inner.toFinalFeature();if(e)for(let n of this.eventListenersUpdated)n(JSON.parse(e))}}async function hu(r,e){let n=await fetch(r),t=n.body.getReader(),i=n.headers.get("Content-Length");if(!i)throw new Error(`No Content-Length header from ${r}`);let o=parseInt(i),s=0,a=[];for(;;){let{done:f,value:c}=await t.read();if(f)break;c&&(a.push(c),s+=c.length,e(100*s/o))}let l=new Uint8Array(s),u=0;for(let f of a)l.set(f,u),u+=f.length;return l}function Ri(r){let e=r[0],n,t,i=Oi(r);return{c(){i.c(),n=ce()},m(o,s){i.m(o,s),w(o,n,s),t=!0},p(o,s){s&1&&te(e,e=o[0])?(se(),y(i,1,1,Q),le(),i=Oi(o),i.c(),b(i,1),i.m(n.parentNode,n)):i.p(o,s)},i(o){t||(b(i),t=!0)},o(o){y(i),t=!1},d(o){o&&k(n),i.d(o)}}}function Oi(r){let e;const n=r[10].default,t=At(n,r,r[9],null);return{c(){t&&t.c()},m(i,o){t&&t.m(i,o),e=!0},p(i,o){t&&t.p&&(!e||o&512)&&Ft(t,n,i,i[9],e?Rt(n,i[9],o,null):Nt(i[9]),null)},i(i){e||(b(t,i),e=!0)},o(i){y(t,i),e=!1},d(i){t&&t.d(i)}}}function _u(r){let e,n,t=r[0]&&Ri(r);return{c(){t&&t.c(),e=ce()},m(i,o){t&&t.m(i,o),w(i,e,o),n=!0},p(i,[o]){i[0]?t?(t.p(i,o),o&1&&b(t,1)):(t=Ri(i),t.c(),b(t,1),t.m(e.parentNode,e)):t&&(se(),y(t,1,1,()=>{t=null}),le())},i(i){n||(b(t),n=!0)},o(i){y(t),n=!1},d(i){i&&k(e),t&&t.d(i)}}}function bu(r,e,n){let t,i,{$$slots:o={},$$scope:s}=e,{id:a=zo("image")}=e,{url:l}=e,{coordinates:u}=e;const{map:f,self:c}=rl();H(r,f,h=>n(8,i=h)),H(r,c,h=>n(0,t=h));let p,m=!0;return Xe(()=>{t&&i&&(il(f,t,p),Be(c,t=null,t),n(6,p=void 0))}),r.$$set=h=>{"id"in h&&n(3,a=h.id),"url"in h&&n(4,l=h.url),"coordinates"in h&&n(5,u=h.coordinates),"$$scope"in h&&n(9,s=h.$$scope)},r.$$.update=()=>{r.$$.dirty&313&&i&&t!==a&&(Be(c,t=a,t),ol(i,t,sl({type:"image",url:l,coordinates:u}),h=>i&&h===t,()=>{t&&(n(6,p=i==null?void 0:i.getSource(t)),n(7,m=!0))})),r.$$.dirty&264&&(i==null||i.on("style.load",()=>{n(6,p=i==null?void 0:i.getSource(a))})),r.$$.dirty&224&&p&&(m?n(7,m=!1):p.setCoordinates(u))},[t,f,c,a,l,u,p,m,i,s,o]}class vu extends re{constructor(e){super(),ie(this,e,bu,_u,te,{id:3,url:4,coordinates:5})}}const{Map:$u}=cl;function Ii(r,e,n){const t=r.slice();t[40]=e[n];const i=t[1](t[40]);t[41]=i;const o=typeof t[7]=="function"?t[7](t[40]):t[7];return t[42]=o,t}const yu=r=>({feature:r[0]&1024,position:r[0]&1026}),ji=r=>({feature:r[40],position:r[41]});function Bi(r){let e=[],n=new $u,t,i,o=Ie(r[10]);const s=a=>a[40].id;for(let a=0;a=r[13]&&r[11]<=r[12]&&Bi(r);return{c(){M(e.$$.fragment),n=N(),o&&o.c(),t=ce()},m(s,a){P(e,s,a),w(s,n,a),o&&o.m(s,a),w(s,t,a),i=!0},p(s,a){const l={};a[0]&32&&(l.minzoom=s[5]),a[0]&64&&(l.maxzoom=s[6]),e.$set(l),s[11]>=s[13]&&s[11]<=s[12]?o?(o.p(s,a),a[0]&14336&&b(o,1)):(o=Bi(s),o.c(),b(o,1),o.m(t.parentNode,t)):o&&(se(),y(o,1,1,()=>{o=null}),le())},i(s){i||(b(e.$$.fragment,s),b(o),i=!0)},o(s){y(e.$$.fragment,s),y(o),i=!1},d(s){s&&(k(n),k(t)),L(e,s),o&&o.d(s)}}}function Su(r,e,n){let t,i,o,s,a,l,u,{$$slots:f={},$$scope:c}=e;const{map:p,source:m,minzoom:h,maxzoom:v}=ll();H(r,p,W=>n(21,s=W)),H(r,m,W=>n(9,a=W)),H(r,h,W=>n(23,u=W)),H(r,v,W=>n(22,l=W));const $=al();let{applyToClusters:C=void 0}=e,{filter:g=void 0}=e,{markerLngLat:_=Ka}=e,{interactive:E=!0}=e,{asButton:d=!1}=e,{draggable:S=!1}=e,{minzoom:R=void 0}=e,{maxzoom:j=void 0}=e,{hovered:T=null}=e,{zIndex:B=void 0}=e,{class:O=void 0}=e,A=!1;function F(){s&&(A=!0,s.on("zoom",G),s.on("move",J),s.on("moveend",J),s.loaded()?s.once("load",J):J())}function I(W){W.sourceId===a&&W.isSourceLoaded&&(A?J():F())}Xe(()=>{s&&(s.off("zoom",G),s.off("move",J),s.off("moveend",J),s.off("sourcedata",I))});let X=[];function J(){var qt;if(!s||!a)return;let W=s.querySourceFeatures(a,{filter:o}),we=new Map;for(let Me of W)Me.id||((qt=Me.properties)!=null&&qt.cluster_id?Me.id="autocluster_"+Me.properties.cluster_id:Me.id=zo("autofeat")),we.set(Me.id,Me);n(10,X=[...we.values()].sort((Me,Vs)=>Me.id.toString().localeCompare(Vs.id.toString())))}let x=(s==null?void 0:s.getZoom())??0;function G(W){n(11,x=s.getZoom()),J()}const fe=W=>{n(0,T=W)},me=W=>{(T==null?void 0:T.id)===W.id&&n(0,T=null)},be=(W,we)=>$("dragstart",{...we.detail,source:a,feature:W}),ve=(W,we)=>$("drag",{...we.detail,source:a,feature:W}),bn=(W,we)=>$("dragend",{...we.detail,source:a,feature:W}),Y=(W,we)=>$("click",{...we.detail,source:a,feature:W}),Z=(W,we)=>$("dblclick",{...we.detail,source:a,feature:W}),je=(W,we)=>$("contextmenu",{...we.detail,source:a,feature:W});return r.$$set=W=>{"applyToClusters"in W&&n(19,C=W.applyToClusters),"filter"in W&&n(20,g=W.filter),"markerLngLat"in W&&n(1,_=W.markerLngLat),"interactive"in W&&n(2,E=W.interactive),"asButton"in W&&n(3,d=W.asButton),"draggable"in W&&n(4,S=W.draggable),"minzoom"in W&&n(5,R=W.minzoom),"maxzoom"in W&&n(6,j=W.maxzoom),"hovered"in W&&n(0,T=W.hovered),"zIndex"in W&&n(7,B=W.zIndex),"class"in W&&n(8,O=W.class),"$$scope"in W&&n(33,c=W.$$scope)},r.$$.update=()=>{if(r.$$.dirty[0]&8388640&&n(13,t=R??u),r.$$.dirty[0]&4194368&&n(12,i=j??l),r.$$.dirty[0]&1572864&&(o=ul("all",fl(C),g)),r.$$.dirty[0]&2097664&&s&&a){let W=s.getSource(a);W!=null&&W.loaded()?F():s.on("sourcedata",I)}},[T,_,E,d,S,R,j,B,O,a,X,x,i,t,p,m,h,v,$,C,g,s,l,u,f,fe,me,be,ve,bn,Y,Z,je,c]}class Eu extends re{constructor(e){super(),ie(this,e,Su,ku,te,{applyToClusters:19,filter:20,markerLngLat:1,interactive:2,asButton:3,draggable:4,minzoom:5,maxzoom:6,hovered:0,zIndex:7,class:8},null,[-1,-1])}}/** + * splaytree v3.1.1 + * Fast Splay tree for Node and browser + * + * @author Alexander Milevski + * @license MIT + * @preserve + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */function Mu(r,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},t,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(f){return l([u,f])}}function l(u){if(t)throw new TypeError("Generator is already executing.");for(;n;)try{if(t=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]e?1:r0){if(e.right===null)break;if(n(r,e.right.key)>0){var a=e.right;if(e.right=a.left,a.left=e,e=a,e.right===null)break}i.right=e,i=e,e=e.right}else break}return i.right=e.left,o.left=e.right,e.left=t.right,e.right=t.left,e}function mr(r,e,n,t){var i=new ht(r,e);if(n===null)return i.left=i.right=null,i;n=ct(r,n,t);var o=t(r,n.key);return o<0?(i.left=n.left,i.right=n,n.left=null):o>=0&&(i.right=n.right,i.left=n,n.right=null),i}function Gi(r,e,n){var t=null,i=null;if(e){e=ct(r,e,n);var o=n(e.key,r);o===0?(t=e.left,i=e.right):o<0?(i=e.right,e.right=null,t=e):(t=e.left,e.left=null,i=e)}return{left:t,right:i}}function Lu(r,e,n){return e===null?r:(r===null||(e=ct(r.key,e,n),e.left=r),e)}function Cr(r,e,n,t,i){if(r){t(""+e+(n?"└── ":"├── ")+i(r)+` +`);var o=e+(n?" ":"│ ");r.left&&Cr(r.left,o,!1,t,i),r.right&&Cr(r.right,o,!0,t,i)}}var Xr=function(){function r(e){e===void 0&&(e=Pu),this._root=null,this._size=0,this._comparator=e}return r.prototype.insert=function(e,n){return this._size++,this._root=mr(e,n,this._root,this._comparator)},r.prototype.add=function(e,n){var t=new ht(e,n);this._root===null&&(t.left=t.right=null,this._size++,this._root=t);var i=this._comparator,o=ct(e,this._root,i),s=i(e,o.key);return s===0?this._root=o:(s<0?(t.left=o.left,t.right=o,o.left=null):s>0&&(t.right=o.right,t.left=o,o.right=null),this._size++,this._root=t),this._root},r.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},r.prototype._remove=function(e,n,t){var i;if(n===null)return null;n=ct(e,n,t);var o=t(e,n.key);return o===0?(n.left===null?i=n.right:(i=ct(e,n.left,t),i.right=n.right),this._size--,i):n},r.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=ct(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},r.prototype.findStatic=function(e){for(var n=this._root,t=this._comparator;n;){var i=t(e,n.key);if(i===0)return n;i<0?n=n.left:n=n.right}return null},r.prototype.find=function(e){return this._root&&(this._root=ct(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},r.prototype.contains=function(e){for(var n=this._root,t=this._comparator;n;){var i=t(e,n.key);if(i===0)return!0;i<0?n=n.left:n=n.right}return!1},r.prototype.forEach=function(e,n){for(var t=this._root,i=[],o=!1;!o;)t!==null?(i.push(t),t=t.left):i.length!==0?(t=i.pop(),e.call(n,t),t=t.right):o=!0;return this},r.prototype.range=function(e,n,t,i){for(var o=[],s=this._comparator,a=this._root,l;o.length!==0||a;)if(a)o.push(a),a=a.left;else{if(a=o.pop(),l=s(a.key,n),l>0)break;if(s(a.key,e)>=0&&t.call(i,a))return this;a=a.right}return this},r.prototype.keys=function(){var e=[];return this.forEach(function(n){var t=n.key;return e.push(t)}),e},r.prototype.values=function(){var e=[];return this.forEach(function(n){var t=n.data;return e.push(t)}),e},r.prototype.min=function(){return this._root?this.minNode(this._root).key:null},r.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},r.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},r.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},r.prototype.at=function(e){for(var n=this._root,t=!1,i=0,o=[];!t;)if(n)o.push(n),n=n.left;else if(o.length>0){if(n=o.pop(),i===e)return n;i++,n=n.right}else t=!0;return null},r.prototype.next=function(e){var n=this._root,t=null;if(e.right){for(t=e.right;t.left;)t=t.left;return t}for(var i=this._comparator;n;){var o=i(e.key,n.key);if(o===0)break;o<0?(t=n,n=n.left):n=n.right}return t},r.prototype.prev=function(e){var n=this._root,t=null;if(e.left!==null){for(t=e.left;t.right;)t=t.right;return t}for(var i=this._comparator;n;){var o=i(e.key,n.key);if(o===0)break;o<0?n=n.left:(t=n,n=n.right)}return t},r.prototype.clear=function(){return this._root=null,this._size=0,this},r.prototype.toList=function(){return Au(this._root)},r.prototype.load=function(e,n,t){n===void 0&&(n=[]),t===void 0&&(t=!1);var i=e.length,o=this._comparator;if(t&&Nr(e,n,0,i-1,o),this._root===null)this._root=Ar(e,n,0,i),this._size=i;else{var s=Fu(this.toList(),Cu(e,n),o);i=this._size+i,this._root=Fr({head:s},0,i)}return this},r.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(r.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),r.prototype.toString=function(e){e===void 0&&(e=function(t){return String(t.key)});var n=[];return Cr(this._root,"",!0,function(t){return n.push(t)},e),n.join("")},r.prototype.update=function(e,n,t){var i=this._comparator,o=Gi(e,this._root,i),s=o.left,a=o.right;i(e,n)<0?a=mr(n,t,a,i):s=mr(n,t,s,i),this._root=Lu(s,a,i)},r.prototype.split=function(e){return Gi(e,this._root,this._comparator)},r.prototype[Symbol.iterator]=function(){var e;return Mu(this,function(n){switch(n.label){case 0:e=this.minNode(),n.label=1;case 1:return e?[4,e]:[3,3];case 2:return n.sent(),e=this.next(e),[3,1];case 3:return[2]}})},r}();function Ar(r,e,n,t){var i=t-n;if(i>0){var o=n+Math.floor(i/2),s=r[o],a=e[o],l=new ht(s,a);return l.left=Ar(r,e,n,o),l.right=Ar(r,e,o+1,t),l}return null}function Cu(r,e){for(var n=new ht(null,null),t=n,i=0;i0?(e=o=o.next=n.pop(),e=e.right):t=!0;return o.next=null,i.next}function Fr(r,e,n){var t=n-e;if(t>0){var i=e+Math.floor(t/2),o=Fr(r,e,i),s=r.head;return s.left=o,r.head=r.head.next,s.right=Fr(r,i+1,n),s}return null}function Fu(r,e,n){for(var t=new ht(null,null),i=t,o=r,s=e;o!==null&&s!==null;)n(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;return o!==null?i.next=o:s!==null&&(i.next=s),t.next}function Nr(r,e,n,t,i){if(!(n>=t)){for(var o=r[n+t>>1],s=n-1,a=t+1;;){do s++;while(i(r[s],o)<0);do a--;while(i(r[a],o)>0);if(s>=a)break;var l=r[s];r[s]=r[a],r[a]=l,l=e[s],e[s]=e[a],e[a]=l}Nr(r,e,n,a,i),Nr(r,e,a+1,t,i)}}function qe(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Ti(r,e){for(var n=0;nt.x?1:n.yt.y?1:0}}]);function r(e,n){qe(this,r),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return Ne(r,[{key:"link",value:function(n){if(n.point===this.point)throw new Error("Tried to link already linked events");for(var t=n.point.events,i=0,o=t.length;i=0&&p>=0?fm?-1:0:u<0&&p<0?fm?1:0:pu?1:0}}}]),r}(),Bu=0,Vn=function(){Ne(r,null,[{key:"compare",value:function(n,t){var i=n.leftSE.point.x,o=t.leftSE.point.x,s=n.rightSE.point.x,a=t.rightSE.point.x;if(al&&u>f)return-1;var p=n.comparePoint(t.leftSE.point);if(p<0)return 1;if(p>0)return-1;var m=t.comparePoint(n.rightSE.point);return m!==0?m:-1}if(i>o){if(lu&&l>c)return 1;var h=t.comparePoint(n.leftSE.point);if(h!==0)return h;var v=n.comparePoint(t.rightSE.point);return v<0?1:v>0?-1:1}if(lu)return 1;if(sa){var C=n.comparePoint(t.rightSE.point);if(C<0)return 1;if(C>0)return-1}if(s!==a){var g=f-l,_=s-i,E=c-u,d=a-o;if(g>_&&Ed)return-1}return s>a?1:sc?1:n.idt.id?1:0}}]);function r(e,n,t,i){qe(this,r),this.id=++Bu,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=t,this.windings=i}return Ne(r,[{key:"replaceRightSE",value:function(n){this.rightSE=n,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var n=this.leftSE.point.y,t=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:nt?n:t}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(n){return n.x===this.leftSE.point.x&&n.y===this.leftSE.point.y||n.x===this.rightSE.point.x&&n.y===this.rightSE.point.y}},{key:"comparePoint",value:function(n){if(this.isAnEndpoint(n))return 0;var t=this.leftSE.point,i=this.rightSE.point,o=this.vector();if(t.x===i.x)return n.x===t.x?0:n.x0&&l.swapEvents(),Ze.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),i&&(o.checkForConsuming(),s.checkForConsuming()),t}},{key:"swapEvents",value:function(){var n=this.rightSE;this.rightSE=this.leftSE,this.leftSE=n,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var t=0,i=this.windings.length;t0){var s=t;t=i,i=s}if(t.prev===i){var a=t;t=i,i=a}for(var l=0,u=i.rings.length;l0)o=t,s=n,a=-1;else throw new Error("Tried to create degenerate segment at [".concat(n.x,", ").concat(n.y,"]"));var u=new Ze(o,!0),f=new Ze(s,!1);return new r(u,f,[i],[a])}}]),r}(),Yi=function(){function r(e,n,t){if(qe(this,r),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=t,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=pn.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,s=1,a=e.length;sthis.bbox.ur.x&&(this.bbox.ur.x=l.x),l.y>this.bbox.ur.y&&(this.bbox.ur.y=l.y),o=l)}(i.x!==o.x||i.y!==o.y)&&this.segments.push(Vn.fromRing(o,i,this))}return Ne(r,[{key:"getSweepEvents",value:function(){for(var n=[],t=0,i=this.segments.length;tthis.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=n}return Ne(r,[{key:"getSweepEvents",value:function(){for(var n=this.exteriorRing.getSweepEvents(),t=0,i=this.interiorRings.length;tthis.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=n}return Ne(r,[{key:"getSweepEvents",value:function(){for(var n=[],t=0,i=this.polys.length;t0&&(n=o)}for(var s=n.segment.prevInResult(),a=s?s.prevInResult():null;;){if(!s)return null;if(!a)return s.ringOut;if(a.ringOut!==s.ringOut)return a.ringOut.enclosingRing()!==s.ringOut?s.ringOut:s.ringOut.enclosingRing();s=a.prevInResult(),a=s?s.prevInResult():null}}}]),r}(),Wi=function(){function r(e){qe(this,r),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Ne(r,[{key:"addInterior",value:function(n){this.interiorRings.push(n),n.poly=this}},{key:"getGeom",value:function(){var n=[this.exteriorRing.getGeom()];if(n[0]===null)return null;for(var t=0,i=this.interiorRings.length;t1&&arguments[1]!==void 0?arguments[1]:Vn.compare;qe(this,r),this.queue=e,this.tree=new Xr(n),this.segments=[]}return Ne(r,[{key:"process",value:function(n){var t=n.segment,i=[];if(n.consumedBy)return n.isLeft?this.queue.remove(n.otherSE):this.tree.remove(t),i;var o=n.isLeft?this.tree.insert(t):this.tree.find(t);if(!o)throw new Error("Unable to find segment #".concat(t.id," ")+"[".concat(t.leftSE.point.x,", ").concat(t.leftSE.point.y,"] -> ")+"[".concat(t.rightSE.point.x,", ").concat(t.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var s=o,a=o,l=void 0,u=void 0;l===void 0;)s=this.tree.prev(s),s===null?l=null:s.key.consumedBy===void 0&&(l=s.key);for(;u===void 0;)a=this.tree.next(a),a===null?u=null:a.key.consumedBy===void 0&&(u=a.key);if(n.isLeft){var f=null;if(l){var c=l.getIntersection(t);if(c!==null&&(t.isAnEndpoint(c)||(f=c),!l.isAnEndpoint(c)))for(var p=this._splitSafely(l,c),m=0,h=p.length;m0?(this.tree.remove(t),i.push(n)):(this.segments.push(t),t.prev=l)}else{if(l&&u){var T=l.getIntersection(u);if(T!==null){if(!l.isAnEndpoint(T))for(var B=this._splitSafely(l,T),O=0,A=B.length;OKi)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var d=new Uu(v),S=v.size,R=v.pop();R;){var j=R.key;if(v.size===S){var T=j.segment;throw new Error("Unable to pop() ".concat(j.isLeft?"left":"right"," SweepEvent ")+"[".concat(j.point.x,", ").concat(j.point.y,"] from segment #").concat(T.id," ")+"[".concat(T.leftSE.point.x,", ").concat(T.leftSE.point.y,"] -> ")+"[".concat(T.rightSE.point.x,", ").concat(T.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(v.size>Ki)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(d.segments.length>Du)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var B=d.process(j),O=0,A=B.length;O1?n-1:0),i=1;i1?n-1:0),i=1;i1?n-1:0),i=1;i1?n-1:0),i=1;iKu(r,"name",{value:e,configurable:!0});function ks(r,e){var n=Es(e),t=null;return r.type==="FeatureCollection"?t=Ss(r):t=Wr(Ln.union(r.geometry.coordinates)),t.geometry.coordinates.forEach(function(i){n.geometry.coordinates.push(i[0])}),n}ir(ks,"mask");function Ss(r){var e=r.features.length===2?Ln.union(r.features[0].geometry.coordinates,r.features[1].geometry.coordinates):Ln.union.apply(Ln,r.features.map(function(n){return n.geometry.coordinates}));return Wr(e)}ir(Ss,"unionFc");function Wr(r){return pl(r)}ir(Wr,"createGeomFromPolygonClippingOutput");function Es(r){var e=[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]],n=r&&r.geometry.coordinates||e;return ml(n)}ir(Es,"createMask");var Hi=ks;function Hu(r){let e,n;const t=[ae(r[0],"boundary"),{paint:{"fill-color":"black","fill-opacity":.5}}];let i={};for(let o=0;on(3,t=a));let{cfg:i}=e,{boundaryGeojson:o}=e,{fitBoundsAtStart:s=!1}=e;return(dl("setCamera")||s)&&(t==null||t.fitBounds(Xo(o),{padding:20,animate:!1})),r.$$set=a=>{"cfg"in a&&n(0,i=a.cfg),"boundaryGeojson"in a&&n(1,o=a.boundaryGeojson),"fitBoundsAtStart"in a&&n(2,s=a.fitBoundsAtStart)},[i,o,s]}class Qu extends re{constructor(e){super(),ie(this,e,Vu,Zu,te,{cfg:0,boundaryGeojson:1,fitBoundsAtStart:2})}}function xu(r){let e;const n=r[1].default,t=At(n,r,r[4],null);return{c(){t&&t.c()},m(i,o){t&&t.m(i,o),e=!0},p(i,o){t&&t.p&&(!e||o&16)&&Ft(t,n,i,i[4],e?Rt(n,i[4],o,null):Nt(i[4]),null)},i(i){e||(b(t,i),e=!0)},o(i){y(t,i),e=!1},d(i){t&&t.d(i)}}}function ef(r){let e;return{c(){e=q("Help")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function tf(r){let e,n,t,i,o;function s(l){r[2](l)}let a={title:"Help",$$slots:{default:[xu]},$$scope:{ctx:r}};return r[0]!==void 0&&(a.open=r[0]),e=new _t({props:a}),V.push(()=>ee(e,"open",s)),i=new ge({props:{$$slots:{default:[ef]},$$scope:{ctx:r}}}),i.$on("click",r[3]),{c(){M(e.$$.fragment),t=N(),M(i.$$.fragment)},m(l,u){P(e,l,u),w(l,t,u),P(i,l,u),o=!0},p(l,[u]){const f={};u&16&&(f.$$scope={dirty:u,ctx:l}),!n&&u&1&&(n=!0,f.open=l[0],ne(()=>n=!1)),e.$set(f);const c={};u&16&&(c.$$scope={dirty:u,ctx:l}),i.$set(c)},i(l){o||(b(e.$$.fragment,l),b(i.$$.fragment,l),o=!0)},o(l){y(e.$$.fragment,l),y(i.$$.fragment,l),o=!1},d(l){l&&k(t),L(e,l),L(i,l)}}}function nf(r,e,n){let{$$slots:t={},$$scope:i}=e,o=!1;function s(l){o=l,n(0,o)}const a=()=>n(0,o=!0);return r.$$set=l=>{"$$scope"in l&&n(4,i=l.$$scope)},[o,t,s,a,i]}class Kt extends re{constructor(e){super(),ie(this,e,nf,tf,te,{})}}function rf(r){let e;return{c(){e=q("Cancel")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function of(r){let e;return{c(){e=D("li"),e.textContent="Click to add a new point"},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function sf(r){let e;return{c(){e=D("li"),e.textContent="Click to move the point here"},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function lf(r){let e,n,t;function i(a,l){return a[0]?sf:of}let o=i(r),s=o(r);return{c(){e=D("ul"),s.c(),n=N(),t=D("li"),t.innerHTML=`Press Escape + to cancel`},m(a,l){w(a,e,l),s.m(e,null),U(e,n),U(e,t)},p(a,l){o!==(o=i(a))&&(s.d(1),s=o(a),s&&(s.c(),s.m(e,n)))},d(a){a&&k(e),s.d()}}}function af(r){let e,n,t,i;return e=new ge({props:{$$slots:{default:[rf]},$$scope:{ctx:r}}}),e.$on("click",function(){Pt(r[1])&&r[1].apply(this,arguments)}),t=new Kt({props:{$$slots:{default:[lf]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment)},m(o,s){P(e,o,s),w(o,n,s),P(t,o,s),i=!0},p(o,s){r=o;const a={};s&4&&(a.$$scope={dirty:s,ctx:r}),e.$set(a);const l={};s&5&&(l.$$scope={dirty:s,ctx:r}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),L(e,o),L(t,o)}}}function uf(r){let e,n;return e=new Ke({props:{$$slots:{default:[af]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,[i]){const o={};i&7&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function ff(r,e,n){let{editingExisting:t}=e,{cancel:i}=e;return r.$$set=o=>{"editingExisting"in o&&n(0,t=o.editingExisting),"cancel"in o&&n(1,i=o.cancel)},[t,i]}class Ms extends re{constructor(e){super(),ie(this,e,ff,uf,te,{editingExisting:0,cancel:1})}}function cf(r){let e;return{c(){e=q("Finish")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function pf(r){let e,n,t;return{c(){e=q("Undo ("),n=q(r[2]),t=q(")")},m(i,o){w(i,e,o),w(i,n,o),w(i,t,o)},p(i,o){o&4&&he(n,i[2])},d(i){i&&(k(e),k(n),k(t))}}}function mf(r){let e;return{c(){e=q("Undo")},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function df(r){let e;function n(o,s){return o[2]==0?mf:pf}let t=n(r),i=t(r);return{c(){i.c(),e=ce()},m(o,s){i.m(o,s),w(o,e,s)},p(o,s){t===(t=n(o))&&i?i.p(o,s):(i.d(1),i=t(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){o&&k(e),i.d(o)}}}function gf(r){let e;return{c(){e=q("Cancel")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function hf(r){let e;return{c(){e=D("ul"),e.innerHTML=`
  • Click + the map to add a vertex
  • Click + a vertex to delete it
  • Drag + a vertex or the polygon to move it
  • Press Control+Z + to undo your last change
  • Press Enter + or + double click + to finish
  • Press Escape + to cancel
  • `},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function _f(r){let e,n,t,i,o,s,a,l;return e=new ut({props:{$$slots:{default:[cf]},$$scope:{ctx:r}}}),e.$on("click",function(){Pt(r[0])&&r[0].apply(this,arguments)}),t=new ge({props:{disabled:r[2]==0,$$slots:{default:[df]},$$scope:{ctx:r}}}),t.$on("click",r[3]),o=new ge({props:{$$slots:{default:[gf]},$$scope:{ctx:r}}}),o.$on("click",function(){Pt(r[1])&&r[1].apply(this,arguments)}),a=new Kt({props:{$$slots:{default:[hf]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment),i=N(),M(o.$$.fragment),s=N(),M(a.$$.fragment)},m(u,f){P(e,u,f),w(u,n,f),P(t,u,f),w(u,i,f),P(o,u,f),w(u,s,f),P(a,u,f),l=!0},p(u,f){r=u;const c={};f&32&&(c.$$scope={dirty:f,ctx:r}),e.$set(c);const p={};f&4&&(p.disabled=r[2]==0),f&36&&(p.$$scope={dirty:f,ctx:r}),t.$set(p);const m={};f&32&&(m.$$scope={dirty:f,ctx:r}),o.$set(m);const h={};f&32&&(h.$$scope={dirty:f,ctx:r}),a.$set(h)},i(u){l||(b(e.$$.fragment,u),b(t.$$.fragment,u),b(o.$$.fragment,u),b(a.$$.fragment,u),l=!0)},o(u){y(e.$$.fragment,u),y(t.$$.fragment,u),y(o.$$.fragment,u),y(a.$$.fragment,u),l=!1},d(u){u&&(k(n),k(i),k(s)),L(e,u),L(t,u),L(o,u),L(a,u)}}}function bf(r){let e,n;return e=new Ke({props:{$$slots:{default:[_f]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,[i]){const o={};i&39&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function vf(r,e,n){let t,i;H(r,un,l=>n(4,t=l)),H(r,ms,l=>n(2,i=l));let{finish:o}=e,{cancel:s}=e;function a(){t.undo()}return r.$$set=l=>{"finish"in l&&n(0,o=l.finish),"cancel"in l&&n(1,s=l.cancel)},[o,s,i,a]}class Ps extends re{constructor(e){super(),ie(this,e,vf,bf,te,{finish:0,cancel:1})}}const Ls=at(Jt()),Cn=at(Jt()),Cs=at(!0),Kr=at(0);function Zi(r,e,n){const t=r.slice();return t[9]=e[n],t}function Vi(r){let e,n,t=r[9].place_name+"",i,o,s;function a(...l){return r[5](r[9],...l)}return{c(){e=D("li"),n=D("a"),i=q(t),z(n,"href","#")},m(l,u){w(l,e,u),U(e,n),U(n,i),o||(s=_e(n,"click",a),o=!0)},p(l,u){r=l,u&2&&t!==(t=r[9].place_name+"")&&he(i,t)},d(l){l&&k(e),o=!1,s()}}}function $f(r){let e,n,t,i,o;function s(f){r[4](f)}let a={label:"Add waypoint by search"};r[0]!==void 0&&(a.value=r[0]),e=new rr({props:a}),V.push(()=>ee(e,"value",s));let l=Ie(r[1].features),u=[];for(let f=0;fn=!1)),e.$set(p),c&6){l=Ie(f[1].features);let m;for(m=0;mn(6,t=p)),H(r,Cn,p=>n(1,i=p)),H(r,Je,p=>n(7,o=p));let{maptilerApiKey:s}=e,a="";async function l(p){if(!p){Be(Cn,i=Jt(),i);return}let m=new URLSearchParams({country:"gb",proximity:o.getCenter().toArray().join(","),fuzzyMatch:"true",key:s}).toString(),h=`https://api.maptiler.com/geocoding/${p}.json?${m}`,$=await(await fetch(h)).json(),C=1;for(let g of $.features)g.properties.number=C++;Be(Cn,i=$,i)}function u(p,m){p.preventDefault(),t.addSnappedWaypoint(m),n(0,a="")}function f(p){a=p,n(0,a)}const c=(p,m)=>u(m,p.center);return r.$$set=p=>{"maptilerApiKey"in p&&n(3,s=p.maptilerApiKey)},r.$$.update=()=>{r.$$.dirty&1&&l(a)},[a,i,u,s,f,c]}class wf extends re{constructor(e){super(),ie(this,e,yf,$f,te,{maptilerApiKey:3})}}function kf(r){let e;return{c(){e=q("Finish")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Sf(r){let e,n,t;return{c(){e=q("Undo ("),n=q(r[4]),t=q(")")},m(i,o){w(i,e,o),w(i,n,o),w(i,t,o)},p(i,o){o&16&&he(n,i[4])},d(i){i&&(k(e),k(n),k(t))}}}function Ef(r){let e;return{c(){e=q("Undo")},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function Mf(r){let e;function n(o,s){return o[4]==0?Ef:Sf}let t=n(r),i=t(r);return{c(){i.c(),e=ce()},m(o,s){i.m(o,s),w(o,e,s)},p(o,s){t===(t=n(o))&&i?i.p(o,s):(i.d(1),i=t(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){o&&k(e),i.d(o)}}}function Pf(r){let e;return{c(){e=q("Cancel")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Lf(r){let e;return{c(){e=D("ul"),e.innerHTML=`
  • Click + the map to add points
  • Press s + to switch between snapping points to existing roads and drawing anywhere
  • Click and drag + any point to move it
  • Click + a waypoint to delete it
  • Press Control+Z + to undo your last change
  • Press Enter + or + double click + to finish
  • Press Escape + to cancel
  • `},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function Cf(r){let e,n,t,i,o,s,a,l;return e=new ut({props:{$$slots:{default:[kf]},$$scope:{ctx:r}}}),e.$on("click",function(){Pt(r[2])&&r[2].apply(this,arguments)}),t=new ge({props:{disabled:r[4]==0,$$slots:{default:[Mf]},$$scope:{ctx:r}}}),t.$on("click",r[6]),o=new ge({props:{$$slots:{default:[Pf]},$$scope:{ctx:r}}}),o.$on("click",function(){Pt(r[3])&&r[3].apply(this,arguments)}),a=new Kt({props:{$$slots:{default:[Lf]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment),i=N(),M(o.$$.fragment),s=N(),M(a.$$.fragment)},m(u,f){P(e,u,f),w(u,n,f),P(t,u,f),w(u,i,f),P(o,u,f),w(u,s,f),P(a,u,f),l=!0},p(u,f){r=u;const c={};f&1024&&(c.$$scope={dirty:f,ctx:r}),e.$set(c);const p={};f&16&&(p.disabled=r[4]==0),f&1040&&(p.$$scope={dirty:f,ctx:r}),t.$set(p);const m={};f&1024&&(m.$$scope={dirty:f,ctx:r}),o.$set(m);const h={};f&1024&&(h.$$scope={dirty:f,ctx:r}),a.$set(h)},i(u){l||(b(e.$$.fragment,u),b(t.$$.fragment,u),b(o.$$.fragment,u),b(a.$$.fragment,u),l=!0)},o(u){y(e.$$.fragment,u),y(t.$$.fragment,u),y(o.$$.fragment,u),y(a.$$.fragment,u),l=!1},d(u){u&&(k(n),k(i),k(s)),L(e,u),L(t,u),L(o,u),L(a,u)}}}function Af(r){let e;return{c(){e=q("Add points to end")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Ff(r){let e,n,t;function i(s){r[9](s)}let o={hint:"Keep clicking to add more points to the end of the route",$$slots:{default:[Af]},$$scope:{ctx:r}};return r[0]!==void 0&&(o.checked=r[0]),e=new Ct({props:o}),V.push(()=>ee(e,"checked",i)),{c(){M(e.$$.fragment)},m(s,a){P(e,s,a),t=!0},p(s,a){const l={};a&1024&&(l.$$scope={dirty:a,ctx:s}),!n&&a&1&&(n=!0,l.checked=s[0],ne(()=>n=!1)),e.$set(l)},i(s){t||(b(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){L(e,s)}}}function Qi(r){let e,n;return e=new wf({props:{maptilerApiKey:r[1]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&2&&(o.maptilerApiKey=t[1]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Nf(r){let e,n,t,i,o,s,a,l;e=new Ke({props:{$$slots:{default:[Cf]},$$scope:{ctx:r}}}),i=new Lt({props:{label:"Draw",choices:[["snap","Snap to roads"],["free","Draw anywhere"]],value:r[5]?"snap":"free"}}),i.$on("change",r[7]),s=new Wo({props:{small:!0,$$slots:{default:[Ff]},$$scope:{ctx:r}}});let u=r[1]&&Qi(r);return{c(){M(e.$$.fragment),n=N(),t=D("div"),M(i.$$.fragment),o=N(),M(s.$$.fragment),a=N(),u&&u.c(),Fe(t,"display","flex")},m(f,c){P(e,f,c),w(f,n,c),w(f,t,c),P(i,t,null),U(t,o),P(s,t,null),U(t,a),u&&u.m(t,null),l=!0},p(f,[c]){const p={};c&1052&&(p.$$scope={dirty:c,ctx:f}),e.$set(p);const m={};c&32&&(m.value=f[5]?"snap":"free"),i.$set(m);const h={};c&1025&&(h.$$scope={dirty:c,ctx:f}),s.$set(h),f[1]?u?(u.p(f,c),c&2&&b(u,1)):(u=Qi(f),u.c(),b(u,1),u.m(t,null)):u&&(se(),y(u,1,1,()=>{u=null}),le())},i(f){l||(b(e.$$.fragment,f),b(i.$$.fragment,f),b(s.$$.fragment,f),b(u),l=!0)},o(f){y(e.$$.fragment,f),y(i.$$.fragment,f),y(s.$$.fragment,f),y(u),l=!1},d(f){f&&(k(n),k(t)),L(e,f),L(i),L(s),u&&u.d()}}}function Rf(r,e,n){let t,i,o;H(r,rt,m=>n(8,t=m)),H(r,Kr,m=>n(4,i=m)),H(r,Cs,m=>n(5,o=m));let{maptilerApiKey:s}=e,{extendRoute:a}=e,{finish:l}=e,{cancel:u}=e;function f(){t.undo()}function c(){t.toggleSnapMode()}function p(m){a=m,n(0,a)}return r.$$set=m=>{"maptilerApiKey"in m&&n(1,s=m.maptilerApiKey),"extendRoute"in m&&n(0,a=m.extendRoute),"finish"in m&&n(2,l=m.finish),"cancel"in m&&n(3,u=m.cancel)},r.$$.update=()=>{r.$$.dirty&257&&t.setRouteConfig({avoid_doubling_back:!1,extend_route:a})},[a,s,l,u,i,o,f,c,t,p]}class As extends re{constructor(e){super(),ie(this,e,Rf,Nf,te,{maptilerApiKey:1,extendRoute:0,finish:2,cancel:3})}}function Of(r){let e;return{c(){e=q("Finish")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function If(r){let e,n,t;return{c(){e=q("Undo ("),n=q(r[2]),t=q(")")},m(i,o){w(i,e,o),w(i,n,o),w(i,t,o)},p(i,o){o&4&&he(n,i[2])},d(i){i&&(k(e),k(n),k(t))}}}function jf(r){let e;return{c(){e=q("Undo")},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function Bf(r){let e;function n(o,s){return o[2]==0?jf:If}let t=n(r),i=t(r);return{c(){i.c(),e=ce()},m(o,s){i.m(o,s),w(o,e,s)},p(o,s){t===(t=n(o))&&i?i.p(o,s):(i.d(1),i=t(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){o&&k(e),i.d(o)}}}function qf(r){let e;return{c(){e=q("Cancel")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Gf(r){let e;return{c(){e=D("ul"),e.innerHTML=`
  • Click + the map to add points
  • Click and drag + any point to move it
  • Click + a waypoint to delete it
  • Press Control+Z + to undo your last change
  • Press Enter + or + double click + to finish
  • Press Escape + to cancel
  • `},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function Tf(r){let e,n,t,i,o,s,a,l;return e=new ut({props:{$$slots:{default:[Of]},$$scope:{ctx:r}}}),e.$on("click",function(){Pt(r[0])&&r[0].apply(this,arguments)}),t=new ge({props:{disabled:r[2]==0,$$slots:{default:[Bf]},$$scope:{ctx:r}}}),t.$on("click",r[3]),o=new ge({props:{$$slots:{default:[qf]},$$scope:{ctx:r}}}),o.$on("click",function(){Pt(r[1])&&r[1].apply(this,arguments)}),a=new Kt({props:{$$slots:{default:[Gf]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment),i=N(),M(o.$$.fragment),s=N(),M(a.$$.fragment)},m(u,f){P(e,u,f),w(u,n,f),P(t,u,f),w(u,i,f),P(o,u,f),w(u,s,f),P(a,u,f),l=!0},p(u,f){r=u;const c={};f&32&&(c.$$scope={dirty:f,ctx:r}),e.$set(c);const p={};f&4&&(p.disabled=r[2]==0),f&36&&(p.$$scope={dirty:f,ctx:r}),t.$set(p);const m={};f&32&&(m.$$scope={dirty:f,ctx:r}),o.$set(m);const h={};f&32&&(h.$$scope={dirty:f,ctx:r}),a.$set(h)},i(u){l||(b(e.$$.fragment,u),b(t.$$.fragment,u),b(o.$$.fragment,u),b(a.$$.fragment,u),l=!0)},o(u){y(e.$$.fragment,u),y(t.$$.fragment,u),y(o.$$.fragment,u),y(a.$$.fragment,u),l=!1},d(u){u&&(k(n),k(i),k(s)),L(e,u),L(t,u),L(o,u),L(a,u)}}}function Uf(r){let e,n;return e=new Ke({props:{$$slots:{default:[Tf]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,[i]){const o={};i&39&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Df(r,e,n){let t,i;H(r,rt,l=>n(4,t=l)),H(r,Kr,l=>n(2,i=l));let{finish:o}=e,{cancel:s}=e;function a(){t.undo()}return r.$$set=l=>{"finish"in l&&n(0,o=l.finish),"cancel"in l&&n(1,s=l.cancel)},[o,s,i,a]}class Fs extends re{constructor(e){super(),ie(this,e,Df,Uf,te,{finish:0,cancel:1})}}function zf(r){let e,n;return e=new Fs({props:{finish:r[3],cancel:r[4]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Jf(r){let e,n;return e=new Ps({props:{finish:r[3],cancel:r[4]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Yf(r){let e,n;return e=new As({props:{maptilerApiKey:r[0].maptilerApiKey,extendRoute:!1,finish:r[3],cancel:r[4]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.maptilerApiKey=t[0].maptilerApiKey),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Xf(r){let e,n;return e=new Ms({props:{editingExisting:!0,cancel:r[4]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Wf(r){let e,n,t,i,o,s,a,l;const u=[Xf,Yf,Jf,zf],f=[];function c(p,m){return p[2]=="point"?0:p[2]=="route"?1:p[2]=="freehand-polygon"?2:p[2]=="snapped-polygon"?3:-1}return~(o=c(r))&&(s=f[o]=u[o](r)),{c(){e=D("h2"),n=q("Editing "),t=q(r[1]),i=N(),s&&s.c(),a=ce()},m(p,m){w(p,e,m),U(e,n),U(e,t),w(p,i,m),~o&&f[o].m(p,m),w(p,a,m),l=!0},p(p,[m]){(!l||m&2)&&he(t,p[1]);let h=o;o=c(p),o===h?~o&&f[o].p(p,m):(s&&(se(),y(f[h],1,1,()=>{f[h]=null}),le()),~o?(s=f[o],s?s.p(p,m):(s=f[o]=u[o](p),s.c()),b(s,1),s.m(a.parentNode,a)):s=null)},i(p){l||(b(s),l=!0)},o(p){y(s),l=!1},d(p){p&&(k(e),k(i),k(a)),~o&&f[o].d(p)}}}function Kf(r,e,n){let t,i,o;H(r,un,g=>n(8,t=g)),H(r,rt,g=>n(9,i=g)),H(r,Rn,g=>n(10,o=g));let{cfg:s}=e,{gjSchemes:a}=e,{id:l}=e,u="",f="",c=null;it(()=>{let g=null;a.update(E=>(g=E.features.find(d=>d.id==l),g.properties.hide_while_editing=!0,E));let _=g;n(1,u=s.interventionName(_)),_.geometry.type=="LineString"?(i==null||i.editExistingRoute(_),i==null||i.addEventListenerSuccess(p),i==null||i.addEventListenerUpdated(m),i==null||i.addEventListenerFailure(h),n(2,f="route")):_.geometry.type=="Polygon"?_.properties.waypoints?(i==null||i.editExistingArea(_),i==null||i.addEventListenerSuccess(p),i==null||i.addEventListenerUpdated(m),i==null||i.addEventListenerFailure(h),n(2,f="snapped-polygon")):(t==null||t.editExisting(_),t==null||t.addEventListenerSuccess(p),t==null||t.addEventListenerUpdated(m),t==null||t.addEventListenerFailure(h),n(2,f="freehand-polygon")):_.geometry.type=="Point"&&(o==null||o.start(),o==null||o.addEventListenerSuccess(p),o==null||o.addEventListenerFailure(h),n(2,f="point"))}),Xe(()=>{o==null||o.stop(),o==null||o.clearEventListeners(),i==null||i.stop(),i==null||i.clearEventListeners(),t==null||t.stop(),t==null||t.clearEventListeners(),a.update(g=>{let _=g.features.find(E=>E.id==l);return delete _.properties.hide_while_editing,c&&v(_,c),g})});function p(g){g.properties??(g.properties={}),c=g,ue.set({mode:"edit-form",id:l})}function m(g){c=g}function h(){c=null,ue.set({mode:"edit-form",id:l})}function v(g,_){g.geometry=_.geometry,_.properties.length_meters&&(g.properties.length_meters=_.properties.length_meters),_.properties.waypoints&&(g.properties.waypoints=_.properties.waypoints),s.updateFeature(g,_)}function $(){ue.set({mode:"edit-form",id:l})}function C(){c=null,ue.set({mode:"edit-form",id:l})}return r.$$set=g=>{"cfg"in g&&n(0,s=g.cfg),"gjSchemes"in g&&n(5,a=g.gjSchemes),"id"in g&&n(6,l=g.id)},[s,u,f,$,C,a,l]}class Hf extends re{constructor(e){super(),ie(this,e,Kf,Wf,te,{cfg:0,gjSchemes:5,id:6})}}const An=at(null),Fn=at(100);function xi(r){let e,n;return e=new vu({props:{url:r[3],coordinates:[[r[1].lng,r[1].lat],[r[4].lng,r[1].lat],[r[4].lng,r[4].lat],[r[1].lng,r[4].lat]],$$slots:{default:[Zf]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&8&&(o.url=t[3]),i&18&&(o.coordinates=[[t[1].lng,t[1].lat],[t[4].lng,t[1].lat],[t[4].lng,t[4].lat],[t[1].lng,t[4].lat]]),i&545&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Zf(r){let e,n;const t=[ae(r[0],"georeferenced-image"),{paint:{"raster-fade-duration":0,"raster-opacity":r[5]/100}}];let i={};for(let o=0;oee(e,"lngLat",a));function u(c){r[8](c)}let f={draggable:!0,$$slots:{default:[Qf]},$$scope:{ctx:r}};return r[4]!==void 0&&(f.lngLat=r[4]),i=new hr({props:f}),V.push(()=>ee(i,"lngLat",u)),{c(){M(e.$$.fragment),t=N(),M(i.$$.fragment)},m(c,p){P(e,c,p),w(c,t,p),P(i,c,p),s=!0},p(c,p){const m={};p&512&&(m.$$scope={dirty:p,ctx:c}),!n&&p&2&&(n=!0,m.lngLat=c[1],ne(()=>n=!1)),e.$set(m);const h={};p&512&&(h.$$scope={dirty:p,ctx:c}),!o&&p&16&&(o=!0,h.lngLat=c[4],ne(()=>o=!1)),i.$set(h)},i(c){s||(b(e.$$.fragment,c),b(i.$$.fragment,c),s=!0)},o(c){y(e.$$.fragment,c),y(i.$$.fragment,c),s=!1},d(c){c&&k(t),L(e,c),L(i,c)}}}function Vf(r){let e;return{c(){e=D("span"),z(e,"class","dot svelte-1tmbx1c"),Fe(e,"background-color","red")},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function Qf(r){let e;return{c(){e=D("span"),z(e,"class","dot svelte-1tmbx1c"),Fe(e,"background-color","blue")},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function xf(r){let e,n,t,i=r[3]&&xi(r),o=r[3]&&r[2].mode=="set-image"&&eo(r);return{c(){i&&i.c(),e=N(),o&&o.c(),n=ce()},m(s,a){i&&i.m(s,a),w(s,e,a),o&&o.m(s,a),w(s,n,a),t=!0},p(s,[a]){s[3]?i?(i.p(s,a),a&8&&b(i,1)):(i=xi(s),i.c(),b(i,1),i.m(e.parentNode,e)):i&&(se(),y(i,1,1,()=>{i=null}),le()),s[3]&&s[2].mode=="set-image"?o?(o.p(s,a),a&12&&b(o,1)):(o=eo(s),o.c(),b(o,1),o.m(n.parentNode,n)):o&&(se(),y(o,1,1,()=>{o=null}),le())},i(s){t||(b(i),b(o),t=!0)},o(s){y(i),y(o),t=!1},d(s){s&&(k(e),k(n)),i&&i.d(s),o&&o.d(s)}}}function ec(r,e,n){let t,i,o,s;H(r,Je,p=>n(6,t=p)),H(r,ue,p=>n(2,i=p)),H(r,An,p=>n(3,o=p)),H(r,Fn,p=>n(5,s=p));let{cfg:a}=e,l={lng:0,lat:0},u={lng:0,lat:0};function f(p){l=p,n(1,l),n(6,t),n(3,o),n(2,i)}function c(p){u=p,n(4,u),n(6,t),n(3,o),n(2,i),n(1,l)}return r.$$set=p=>{"cfg"in p&&n(0,a=p.cfg)},r.$$.update=()=>{if(r.$$.dirty&78&&t&&o&&i.mode=="set-image"&&l.lng==0&&l.lat==0){let p=t.getBounds();n(1,l.lng=p.getWest()+.4*(p.getEast()-p.getWest()),l),n(4,u.lng=p.getWest()+.6*(p.getEast()-p.getWest()),u),n(1,l.lat=p.getNorth()+.4*(p.getSouth()-p.getNorth()),l),n(4,u.lat=p.getNorth()+.6*(p.getSouth()-p.getNorth()),u)}},[a,l,i,o,u,s,t,f,c]}class tc extends re{constructor(e){super(),ie(this,e,ec,xf,te,{cfg:0})}}function nc(r){let e,n,t,i,o,s;const a=[ae(r[0],"hover-polygons"),{filter:St},{paint:{"line-color":nn.hovering,"line-width":.5*kt}}];let l={};for(let m=0;m(s(),s=We(u,f=>n(4,o=f)),u);H(r,tn,f=>n(3,i=f)),r.$$.on_destroy.push(()=>s());let{cfg:l}=e,{gjSchemes:u}=e;return a(),r.$$set=f=>{"cfg"in f&&n(0,l=f.cfg),"gjSchemes"in f&&a(n(1,u=f.gjSchemes))},r.$$.update=()=>{r.$$.dirty&24&&n(2,t=i==null?Jt():o.features.find(f=>f.id==i))},[l,u,t,i,o]}class oc extends re{constructor(e){super(),ie(this,e,ic,rc,te,{cfg:0,gjSchemes:1})}}function to(r){let e,n;return e=new qr({props:{openOn:"hover",openIfTopMost:!0,$$slots:{default:[sc,({features:t})=>({16:t}),({features:t})=>t?65536:0]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&196608&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function sc(r){let e,n,t=r[9](r[16])+"",i;return{c(){e=D("div"),n=D("p"),i=q(t),z(e,"class","govuk-prose")},m(o,s){w(o,e,s),U(e,n),U(n,i)},p(o,s){s&65536&&t!==(t=o[9](o[16])+"")&&he(i,t)},d(o){o&&k(e)}}}function lc(r){let e,n,t=r[4]&&to(r);return{c(){t&&t.c(),e=ce()},m(i,o){t&&t.m(i,o),w(i,e,o),n=!0},p(i,o){i[4]?t?(t.p(i,o),o&16&&b(t,1)):(t=to(i),t.c(),b(t,1),t.m(e.parentNode,e)):t&&(se(),y(t,1,1,()=>{t=null}),le())},i(i){n||(b(t),n=!0)},o(i){y(t),n=!1},d(i){i&&k(e),t&&t.d(i)}}}function no(r){let e,n;return e=new qr({props:{openOn:"hover",openIfTopMost:!0,$$slots:{default:[ac,({features:t})=>({16:t}),({features:t})=>t?65536:0]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&196608&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function ac(r){let e,n,t=r[9](r[16])+"",i;return{c(){e=D("div"),n=D("p"),i=q(t),z(e,"class","govuk-prose")},m(o,s){w(o,e,s),U(e,n),U(n,i)},p(o,s){s&65536&&t!==(t=o[9](o[16])+"")&&he(i,t)},d(o){o&&k(e)}}}function uc(r){let e,n,t=r[4]&&no(r);return{c(){t&&t.c(),e=ce()},m(i,o){t&&t.m(i,o),w(i,e,o),n=!0},p(i,o){i[4]?t?(t.p(i,o),o&16&&b(t,1)):(t=no(i),t.c(),b(t,1),t.m(e.parentNode,e)):t&&(se(),y(t,1,1,()=>{t=null}),le())},i(i){n||(b(t),n=!0)},o(i){y(t),n=!1},d(i){i&&k(e),t&&t.d(i)}}}function ro(r){let e,n;return e=new qr({props:{openOn:"hover",openIfTopMost:!0,$$slots:{default:[fc,({features:t})=>({16:t}),({features:t})=>t?65536:0]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&196608&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function fc(r){let e,n,t=r[9](r[16])+"",i;return{c(){e=D("div"),n=D("p"),i=q(t),z(e,"class","govuk-prose")},m(o,s){w(o,e,s),U(e,n),U(n,i)},p(o,s){s&65536&&t!==(t=o[9](o[16])+"")&&he(i,t)},d(o){o&&k(e)}}}function cc(r){let e,n,t=r[4]&&ro(r);return{c(){t&&t.c(),e=ce()},m(i,o){t&&t.m(i,o),w(i,e,o),n=!0},p(i,o){i[4]?t?(t.p(i,o),o&16&&b(t,1)):(t=ro(i),t.c(),b(t,1),t.m(e.parentNode,e)):t&&(se(),y(t,1,1,()=>{t=null}),le())},i(i){n||(b(t),n=!0)},o(i){y(t),n=!1},d(i){i&&k(e),t&&t.d(i)}}}function pc(r){let e,n,t,i,o,s,a,l,u,f;const c=[ae(r[0],"interventions-points"),{filter:["all",cn,r[6],r[7],r[3]]},{paint:{"circle-color":r[2],"circle-radius":On}},{hoverCursor:r[4]?"pointer":void 0},{manageHoverState:r[4]}];let p={$$slots:{default:[lc]},$$scope:{ctx:r}};for(let d=0;d(l(),l=We(h,d=>n(11,a=d)),h),f,c,p;H(r,Je,d=>n(14,f=d)),H(r,ue,d=>n(12,c=d)),H(r,rn,d=>n(13,p=d)),r.$$.on_destroy.push(()=>l());let{cfg:m}=e,{gjSchemes:h}=e;u();const v=["!=",["get","hide_while_editing"],!0],$=["!=",["get","endpoint"],!0];let C;function g(d){return Zt(["get","scheme_reference"],Object.fromEntries(Object.values(d.schemes).map(S=>[S.scheme_reference,S.color])),"black")}function _(d){c.mode!="list"||!f||d.detail.features[0]&&(f.getCanvas().style.cursor="inherit",ue.set({mode:"edit-form",id:d.detail.features[0].id}))}function E(d){if(d){let S=d[0],R=m.interventionName(S),j=m.schemeName(a.schemes[S.properties.scheme_reference]);return`${R} (${j})`}return"Tooltip bug"}return r.$$set=d=>{"cfg"in d&&n(0,m=d.cfg),"gjSchemes"in d&&u(n(1,h=d.gjSchemes))},r.$$.update=()=>{if(r.$$.dirty&2048&&n(5,t=Fl(a)),r.$$.dirty&4096&&n(4,i=c.mode=="list"),r.$$.dirty&8192&&n(3,o=dc(p)),r.$$.dirty&2048&&n(10,s=g(a)),r.$$.dirty&5120){let d="grey";c.mode=="edit-form"?n(2,C=["case",["==",["id"],c.id],s,d]):c.mode=="list"?n(2,C=s):c.mode=="split-route"?n(2,C=["case",["==","intervention_type","route"],s,d]):n(2,C=d)}},[m,h,C,o,i,t,v,$,_,E,s,a,c,p]}class hc extends re{constructor(e){super(),ie(this,e,gc,mc,te,{cfg:0,gjSchemes:1})}}function _c(r){let e,n,t,i,o,s;const a=[ae(r[0],"edit-polygon-fill"),{filter:St},{paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}];let l={};for(let m=0;mn(1,t=o));let{cfg:i}=e;return r.$$set=o=>{"cfg"in o&&n(0,i=o.cfg)},[i,t]}class $c extends re{constructor(e){super(),ie(this,e,vc,bc,te,{cfg:0})}}function yc(r){let e,n,t,i,o,s;const a=[ae(r[0],"route-points"),{filter:cn},{paint:{"circle-color":Zt(["get","type"],{"snapped-waypoint":"red","free-waypoint":"blue"},"black"),"circle-opacity":["case",["has","hovered"],.5,1],"circle-radius":Zt(["get","type"],{node:wn/2},wn)}}];let l={};for(let m=0;m({3:t}),({feature:t})=>t?8:0]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&24&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Sc(r){let e,n,t,i;return e=new Mt({props:{data:r[1],$$slots:{default:[yc]},$$scope:{ctx:r}}}),t=new Mt({props:{data:r[2],$$slots:{default:[kc]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment)},m(o,s){P(e,o,s),w(o,n,s),P(t,o,s),i=!0},p(o,[s]){const a={};s&2&&(a.data=o[1]),s&17&&(a.$$scope={dirty:s,ctx:o}),e.$set(a);const l={};s&4&&(l.data=o[2]),s&16&&(l.$$scope={dirty:s,ctx:o}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),L(e,o),L(t,o)}}}const wn=10;function io(r){var e;return(e=r.properties)==null?void 0:e.number}function Ec(r,e,n){let t,i;H(r,Ls,s=>n(1,t=s)),H(r,Cn,s=>n(2,i=s));let{cfg:o}=e;return r.$$set=s=>{"cfg"in s&&n(0,o=s.cfg)},[o,t,i]}class Mc extends re{constructor(e){super(),ie(this,e,Ec,Sc,te,{cfg:0})}}var Pc=Object.defineProperty,vt=(r,e)=>Pc(r,"name",{value:e,configurable:!0});function Wt(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return[...r.geometry.coordinates];if(r.type==="Point")return[...r.coordinates]}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return[...r];throw new Error("coord must be GeoJSON Point or an Array of numbers")}vt(Wt,"getCoord");function Ns(r){if(Array.isArray(r))return r;if(r.type==="Feature"){if(r.geometry!==null)return r.geometry.coordinates}else if(r.coordinates)return r.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}vt(Ns,"getCoords");function Rs(r){if(r.length>1&&ei(r[0])&&ei(r[1]))return!0;if(Array.isArray(r[0])&&r[0].length)return Rs(r[0]);throw new Error("coordinates must only contain numbers")}vt(Rs,"containsNumber");function Lc(r,e,n){if(!e||!n)throw new Error("type and name required");if(!r||r.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+r.type)}vt(Lc,"geojsonType");function Cc(r,e,n){if(!r)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!r.geometry||r.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+r.geometry.type)}vt(Cc,"featureOf");function Ac(r,e,n){if(!r)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!r||r.type!=="FeatureCollection")throw new Error("Invalid input to "+n+", FeatureCollection required");for(const t of r.features){if(!t||t.type!=="Feature"||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}}vt(Ac,"collectionOf");function Fc(r){return r.type==="Feature"?r.geometry:r}vt(Fc,"getGeom");function Nc(r,e){return r.type==="FeatureCollection"?"FeatureCollection":r.type==="GeometryCollection"?"GeometryCollection":r.type==="Feature"&&r.geometry!==null?r.geometry.type:r.type}vt(Nc,"getType");var Rc=Object.defineProperty,Os=(r,e)=>Rc(r,"name",{value:e,configurable:!0});function Hr(r,e,n={}){if(n.final===!0)return Is(r,e);const t=Wt(r),i=Wt(e),o=Ue(t[0]),s=Ue(i[0]),a=Ue(t[1]),l=Ue(i[1]),u=Math.sin(s-o)*Math.cos(l),f=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(s-o);return dr(Math.atan2(u,f))}Os(Hr,"bearing");function Is(r,e){let n=Hr(e,r);return n=(n+180)%360,n}Os(Is,"calculateFinalBearing");var Oc=Object.defineProperty,Ic=(r,e)=>Oc(r,"name",{value:e,configurable:!0});function Ut(r,e,n={}){var t=Wt(r),i=Wt(e),o=Ue(i[1]-t[1]),s=Ue(i[0]-t[0]),a=Ue(t[1]),l=Ue(i[1]),u=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(l);return gl(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),n.units)}Ic(Ut,"distance");var jc=Object.defineProperty,Bc=(r,e)=>jc(r,"name",{value:e,configurable:!0});function Ir(r,e,n,t={}){const i=Wt(r),o=Ue(i[0]),s=Ue(i[1]),a=Ue(n),l=hl(e,t.units),u=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(a)),f=o+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(u)),c=dr(f),p=dr(u);return Ge([c,p],t.properties)}Bc(Ir,"destination");class js{constructor(e=[],n=qc){if(this.data=e,this.length=this.data.length,this.compare=n,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:n,compare:t}=this,i=n[e];for(;e>0;){const o=e-1>>1,s=n[o];if(t(i,s)>=0)break;n[e]=s,e=o}n[e]=i}_down(e){const{data:n,compare:t}=this,i=this.length>>1,o=n[e];for(;e=0)break;n[e]=a,e=s}n[e]=o}}function qc(r,e){return re?1:0}function Bs(r,e){return r.p.x>e.p.x?1:r.p.xe.p.y?1:-1:1}function Gc(r,e){return r.rightSweepEvent.p.x>e.rightSweepEvent.p.x?1:r.rightSweepEvent.p.x0?(f.isLeftEndpoint=!0,u.isLeftEndpoint=!1):(u.isLeftEndpoint=!0,f.isLeftEndpoint=!1),e.push(u),e.push(f),s=a,En=En+1}}kn=kn+1}class Uc{constructor(e){this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}}function Dc(r,e){if(r===null||e===null||r.leftSweepEvent.ringId===e.leftSweepEvent.ringId&&(r.rightSweepEvent.isSamePoint(e.leftSweepEvent)||r.rightSweepEvent.isSamePoint(e.leftSweepEvent)||r.rightSweepEvent.isSamePoint(e.rightSweepEvent)||r.leftSweepEvent.isSamePoint(e.leftSweepEvent)||r.leftSweepEvent.isSamePoint(e.rightSweepEvent)))return!1;const n=r.leftSweepEvent.p.x,t=r.leftSweepEvent.p.y,i=r.rightSweepEvent.p.x,o=r.rightSweepEvent.p.y,s=e.leftSweepEvent.p.x,a=e.leftSweepEvent.p.y,l=e.rightSweepEvent.p.x,u=e.rightSweepEvent.p.y,f=(u-a)*(i-n)-(l-s)*(o-t),c=(l-s)*(t-a)-(u-a)*(n-s),p=(i-n)*(t-a)-(o-t)*(n-s);if(f===0)return!1;const m=c/f,h=p/f;if(m>=0&&m<=1&&h>=0&&h<=1){const v=n+m*(i-n),$=t+m*(o-t);return[v,$]}return!1}function zc(r,e){e=e||!1;const n=[],t=new js([],Gc);for(;r.length;){const i=r.pop();if(i.isLeftEndpoint){const o=new Uc(i);for(let s=0;sYc(r,"name",{value:e,configurable:!0}),Wc=Jc;function qs(r,e,n={}){const{removeDuplicates:t=!0,ignoreSelfIntersections:i=!1}=n;let o=[];r.type==="FeatureCollection"?o=o.concat(r.features):r.type==="Feature"?o.push(r):(r.type==="LineString"||r.type==="Polygon"||r.type==="MultiLineString"||r.type==="MultiPolygon")&&o.push(In(r)),e.type==="FeatureCollection"?o=o.concat(e.features):e.type==="Feature"?o.push(e):(e.type==="LineString"||e.type==="Polygon"||e.type==="MultiLineString"||e.type==="MultiPolygon")&&o.push(In(e));const s=Wc(ti(o),i);let a=[];if(t){const l={};s.forEach(u=>{const f=u.join(",");l[f]||(l[f]=!0,a.push(u))})}else a=s;return ti(a.map(l=>Ge(l)))}Xc(qs,"lineIntersect");var Kc=Object.defineProperty,Ee=(r,e)=>Kc(r,"name",{value:e,configurable:!0});function hn(r,e,n){if(r!==null)for(var t,i,o,s,a,l,u,f=0,c=0,p,m=r.type,h=m==="FeatureCollection",v=m==="Feature",$=h?r.features.length:1,C=0;C<$;C++){u=h?r.features[C].geometry:v?r.geometry:r,p=u?u.type==="GeometryCollection":!1,a=p?u.geometries.length:1;for(var g=0;gl||h>u||v>f){a=c,l=t,u=h,f=v,o=0;return}var $=pt([a,c],n.properties);if(e($,t,i,v,o)===!1)return!1;o++,a=c})===!1)return!1}}})}Ee(Us,"segmentEach");function tp(r,e,n){var t=n,i=!1;return Us(r,function(o,s,a,l,u){i===!1&&n===void 0?t=o:t=e(t,o,s,a,l,u),i=!0}),t}Ee(tp,"segmentReduce");function Ds(r,e){if(!r)throw new Error("geojson is required");_n(r,function(n,t,i){if(n.geometry!==null){var o=n.geometry.type,s=n.geometry.coordinates;switch(o){case"LineString":if(e(n,t,i,0,0)===!1)return!1;break;case"Polygon":for(var a=0;ae in r?zs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n,$t=(r,e)=>{for(var n in e||(e={}))lp.call(e,n)&&ao(r,n,e[n]);if(lo)for(var n of lo(e))ap.call(e,n)&&ao(r,n,e[n]);return r},yt=(r,e)=>op(r,sp(e)),up=(r,e)=>zs(r,"name",{value:e,configurable:!0});function Js(r,e,n={}){if(!r||!e)throw new Error("lines and pt are required arguments");let t=Ge([1/0,1/0],{dist:1/0,index:-1,location:-1}),i=0;return _n(r,function(o){const s=Ns(o);for(let a=0;a0&&v.features[0]&&($=yt($t({},v.features[0]),{properties:{dist:Ut(e,v.features[0],n),location:i+Ut(l,v.features[0],n)}})),l.properties.dist(i(),i=We(l,$=>n(8,t=$)),l),s;H(r,Je,$=>n(9,s=$)),r.$$.on_destroy.push(()=>i());let{cfg:a}=e,{gjSchemes:l}=e;o(),it(()=>{s&&(s.getCanvas().style.cursor=`url(${Ys}), crosshair`)}),Xe(()=>{s&&(s.getCanvas().style.cursor="inherit")});let u=null,f=null,c=Jt();function p($){if(!s)return;n(6,u=null),f=null;let C=v($.detail.lngLat.toArray());const g=[$.detail.point.x-mp,$.detail.point.y],_=s.unproject($.detail.point).distanceTo(s.unproject(g))/1e3;let E=[];for(let[d,S]of t.features.entries())if(S.geometry.type=="LineString"){let R=fp(S.geometry,C,{units:"kilometers"});R.properties.dist!=null&&R.properties.dist<=_&&E.push([d,R.geometry.coordinates,R.properties.dist])}E.sort((d,S)=>d[2]-S[2]),E.length>0&&(n(6,u=v(E[0][1])),f=E[0][0])}function m(){if(f==null){ue.set({mode:"list"});return}let $=pu(t.features[f],u);if($!=null){let[C,g]=$;l.update(_=>(C.id=_.features[f].id,g.id=dn(_),_.features.splice(f,1,C,g),_))}n(6,u=null),f=null}function h($){$.key=="Escape"&&($.stopPropagation(),ue.set({mode:"list"}))}function v($){return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:Uo($)}}}return r.$$set=$=>{"cfg"in $&&n(0,a=$.cfg),"gjSchemes"in $&&o(n(1,l=$.gjSchemes))},r.$$.update=()=>{if(r.$$.dirty&64){let $=Jt();u&&$.features.push(u),n(2,c=$)}},[a,l,c,p,m,h,u]}class gp extends re{constructor(e){super(),ie(this,e,dp,pp,te,{cfg:0,gjSchemes:1})}}function hp(r){let e;return{c(){e=q("Finish")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function _p(r){let e,n;return e=new Rl({}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function bp(r){let e,n,t,i,o,s,a,l,u,f,c;function p($){r[4]($)}let m={cfg:r[0],map:r[2],showControls:!1};r[1]!==void 0&&(m.enabled=r[1]),e=new Nl({props:m}),V.push(()=>ee(e,"enabled",p)),o=new ut({props:{$$slots:{default:[hp]},$$scope:{ctx:r}}}),o.$on("click",r[5]);function h($){r[6]($)}let v={label:"Source",choices:[["google","Google Street View"],["bing","Bing Streetside"]],inlineSmall:!0};return r[3].streetViewImagery!==void 0&&(v.value=r[3].streetViewImagery),a=new Lt({props:v}),V.push(()=>ee(a,"value",h)),f=new Kt({props:{$$slots:{default:[_p]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment),t=N(),i=D("div"),M(o.$$.fragment),s=N(),M(a.$$.fragment),u=N(),M(f.$$.fragment),Fe(i,"display","flex")},m($,C){P(e,$,C),w($,t,C),w($,i,C),P(o,i,null),U(i,s),P(a,i,null),U(i,u),P(f,i,null),c=!0},p($,[C]){const g={};C&1&&(g.cfg=$[0]),C&4&&(g.map=$[2]),!n&&C&2&&(n=!0,g.enabled=$[1],ne(()=>n=!1)),e.$set(g);const _={};C&128&&(_.$$scope={dirty:C,ctx:$}),o.$set(_);const E={};!l&&C&8&&(l=!0,E.value=$[3].streetViewImagery,ne(()=>l=!1)),a.$set(E);const d={};C&128&&(d.$$scope={dirty:C,ctx:$}),f.$set(d)},i($){c||(b(e.$$.fragment,$),b(o.$$.fragment,$),b(a.$$.fragment,$),b(f.$$.fragment,$),c=!0)},o($){y(e.$$.fragment,$),y(o.$$.fragment,$),y(a.$$.fragment,$),y(f.$$.fragment,$),c=!1},d($){$&&(k(t),k(i)),L(e,$),L(o),L(a),L(f)}}}function vp(r,e,n){let t,i;H(r,Je,f=>n(2,t=f)),H(r,ni,f=>n(3,i=f));let{cfg:o}=e,s=!0;function a(f){s=f,n(1,s)}const l=()=>n(1,s=!1);function u(f){r.$$.not_equal(i.streetViewImagery,f)&&(i.streetViewImagery=f,ni.set(i))}return r.$$set=f=>{"cfg"in f&&n(0,o=f.cfg)},r.$$.update=()=>{r.$$.dirty&2&&(s||ue.set({mode:"list"}))},[o,s,t,i,a,l,u]}class $p extends re{constructor(e){super(),ie(this,e,vp,bp,te,{cfg:0})}}const yp="/atip/move_draw_controls/assets/image-3e3a13e8.svg",wp="/atip/move_draw_controls/assets/point-276f4055.svg",kp="/atip/move_draw_controls/assets/polygon_freehand-cf965967.svg",Sp="/atip/move_draw_controls/assets/polygon_snapped-18efbbea.svg",Ep="/atip/move_draw_controls/assets/route-d3c0ebad.svg",Mp="/atip/move_draw_controls/assets/street_view-48580b6a.svg";function Pp(r){let e;return{c(){e=q("Save")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Lp(r){let e;return{c(){e=q("Delete")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Cp(r){let e,n,t,i;return e=new ut({props:{$$slots:{default:[Pp]},$$scope:{ctx:r}}}),e.$on("click",r[6]),t=new bt({props:{disabled:!r[2],$$slots:{default:[Lp]},$$scope:{ctx:r}}}),t.$on("click",r[4]),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment)},m(o,s){P(e,o,s),w(o,n,s),P(t,o,s),i=!0},p(o,s){const a={};s&512&&(a.$$scope={dirty:s,ctx:o}),e.$set(a);const l={};s&4&&(l.disabled=!o[2]),s&512&&(l.$$scope={dirty:s,ctx:o}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),L(e,o),L(t,o)}}}function Ap(r){let e,n,t;return{c(){e=D("input"),z(e,"class","govuk-file-upload"),z(e,"id","load-image"),z(e,"type","file")},m(i,o){w(i,e,o),r[7](e),n||(t=_e(e,"change",r[3]),n=!0)},p:Q,d(i){i&&k(e),r[7](null),n=!1,t()}}}function fo(r){let e,n,t,i,o,s,a,l;return{c(){e=D("div"),n=D("label"),t=D("input"),i=q(` + Opacity: `),o=q(r[1]),s=q("%"),z(t,"type","range"),z(t,"min","0"),z(t,"max","100")},m(u,f){w(u,e,f),U(e,n),U(n,t),Pe(t,r[1]),U(n,i),U(n,o),U(n,s),a||(l=[_e(t,"change",r[8]),_e(t,"input",r[8])],a=!0)},p(u,f){f&2&&Pe(t,u[1]),f&2&&he(o,u[1])},d(u){u&&k(e),a=!1,xn(l)}}}function Fp(r){let e,n,t,i,o,s,a,l,u;e=new Ke({props:{$$slots:{default:[Cp]},$$scope:{ctx:r}}}),t=new Ot({props:{label:"Load an image",id:"load-image",$$slots:{default:[Ap]},$$scope:{ctx:r}}});let f=r[2]&&fo(r);return{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment),i=N(),f&&f.c(),o=N(),s=D("p"),s.textContent=`Note this image isn't saved as part of this scheme. When you close this page, + it'll be lost.`},m(c,p){P(e,c,p),w(c,n,p),P(t,c,p),w(c,i,p),f&&f.m(c,p),w(c,o,p),w(c,s,p),a=!0,l||(u=_e(window,"keydown",r[5]),l=!0)},p(c,[p]){const m={};p&516&&(m.$$scope={dirty:p,ctx:c}),e.$set(m);const h={};p&513&&(h.$$scope={dirty:p,ctx:c}),t.$set(h),c[2]?f?f.p(c,p):(f=fo(c),f.c(),f.m(o.parentNode,o)):f&&(f.d(1),f=null)},i(c){a||(b(e.$$.fragment,c),b(t.$$.fragment,c),a=!0)},o(c){y(e.$$.fragment,c),y(t.$$.fragment,c),a=!1},d(c){c&&(k(n),k(i),k(o),k(s)),L(e,c),L(t,c),f&&f.d(c),l=!1,u()}}}function Np(r,e,n){let t,i;H(r,Fn,p=>n(1,t=p)),H(r,An,p=>n(2,i=p));let o;async function s(p){let m=await o.files[0].arrayBuffer(),h=new Blob([new Uint8Array(m)]);Be(An,i=URL.createObjectURL(h),i)}function a(){Be(An,i=null,i),Be(Fn,t=100,t)}function l(p){p.key=="Escape"&&(p.stopPropagation(),ue.set({mode:"list"}))}const u=()=>ue.set({mode:"list"});function f(p){V[p?"unshift":"push"](()=>{o=p,n(0,o)})}function c(){t=bl(this.value),Fn.set(t)}return[o,t,i,s,a,l,u,f,c]}class Rp extends re{constructor(e){super(),ie(this,e,Np,Fp,te,{})}}function Op(r){let e,n;return e=new Ms({props:{editingExisting:!1,cancel:r[0]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Ip(r,e,n){let t;H(r,Rn,l=>n(3,t=l));let{cfg:i}=e,{gjSchemes:o}=e;it(()=>{t.start(),t.addEventListenerSuccess(s),t.addEventListenerFailure(a)}),Xe(()=>{t.stop(),t.clearEventListeners()});function s(l){l.properties||(l.properties={});let u=l;o.update(f=>(u.id=dn(f),u.properties.scheme_reference=tr(f),i.newPointFeature(u),f.features.push(u),f)),ue.set({mode:"edit-form",id:u.id})}function a(){ue.set({mode:"list"})}return r.$$set=l=>{"cfg"in l&&n(1,i=l.cfg),"gjSchemes"in l&&n(2,o=l.gjSchemes)},[a,i,o]}class jp extends re{constructor(e){super(),ie(this,e,Ip,Op,te,{cfg:1,gjSchemes:2})}}function Bp(r){let e,n;return e=new Ps({props:{finish:r[1],cancel:r[0]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function qp(r,e,n){let t;H(r,un,u=>n(4,t=u));let{cfg:i}=e,{gjSchemes:o}=e;it(()=>{t.startNew(),t.addEventListenerSuccess(s),t.addEventListenerFailure(a)}),Xe(()=>{t.stop(),t.clearEventListeners()});function s(u){u.properties||(u.properties={});let f=u;o.update(c=>(f.id=dn(c),f.properties.scheme_reference=tr(c),i.newPolygonFeature(f),c.features.push(f),c)),ue.set({mode:"edit-form",id:f.id})}function a(){ue.set({mode:"list"})}function l(){t.finish()}return r.$$set=u=>{"cfg"in u&&n(2,i=u.cfg),"gjSchemes"in u&&n(3,o=u.gjSchemes)},[a,l,i,o]}class Gp extends re{constructor(e){super(),ie(this,e,qp,Bp,te,{cfg:2,gjSchemes:3})}}function Tp(r){let e,n;return e=new As({props:{maptilerApiKey:r[0].maptilerApiKey,extendRoute:!0,finish:r[2],cancel:r[1]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,[i]){const o={};i&1&&(o.maptilerApiKey=t[0].maptilerApiKey),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Up(r,e,n){let t;H(r,rt,u=>n(4,t=u));let{cfg:i}=e,{gjSchemes:o}=e;it(()=>{t.startRoute(),t.addEventListenerSuccess(s),t.addEventListenerFailure(a)}),Xe(()=>{t.stop(),t.clearEventListeners()});function s(u){let f=u;o.update(c=>(f.id=dn(c),f.properties.scheme_reference=tr(c),i.newLineStringFeature(f),c.features.push(f),c)),ue.set({mode:"edit-form",id:f.id})}function a(){ue.set({mode:"list"})}function l(){t.finish()}return r.$$set=u=>{"cfg"in u&&n(0,i=u.cfg),"gjSchemes"in u&&n(3,o=u.gjSchemes)},[i,a,l,o]}class Dp extends re{constructor(e){super(),ie(this,e,Up,Tp,te,{cfg:0,gjSchemes:3})}}function zp(r){let e,n;return e=new Fs({props:{finish:r[1],cancel:r[0]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Jp(r,e,n){let t;H(r,rt,u=>n(4,t=u));let{cfg:i}=e,{gjSchemes:o}=e;it(()=>{t.startArea(),t.addEventListenerSuccess(s),t.addEventListenerFailure(a)}),Xe(()=>{t.stop(),t.clearEventListeners()});function s(u){let f=u;o.update(c=>(f.id=dn(c),f.properties.scheme_reference=tr(c),i.newPolygonFeature(f),c.features.push(f),c)),ue.set({mode:"edit-form",id:f.id})}function a(){ue.set({mode:"list"})}function l(){t.finish()}return r.$$set=u=>{"cfg"in u&&n(2,i=u.cfg),"gjSchemes"in u&&n(3,o=u.gjSchemes)},[a,l,i,o]}class Yp extends re{constructor(e){super(),ie(this,e,Jp,zp,te,{cfg:2,gjSchemes:3})}}function Xp(r){let e,n;return e=new Ye({props:{errorMessage:"Failed to load route snapper"}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Wp(r){let e,n,t;return{c(){e=D("label"),e.textContent="Route data unpacking",n=N(),t=D("progress"),z(e,"for","route-unpacking"),z(t,"id","route-unpacking"),z(t,"class","svelte-q3473n")},m(i,o){w(i,e,o),w(i,n,o),w(i,t,o)},p:Q,i:Q,o:Q,d(i){i&&(k(e),k(n),k(t))}}}function Kp(r){let e,n,t;return{c(){e=D("label"),e.textContent="Route tool loading",n=N(),t=D("progress"),z(e,"for","route-loading"),z(t,"id","route-loading"),t.value=r[0],z(t,"class","svelte-q3473n")},m(i,o){w(i,e,o),w(i,n,o),w(i,t,o)},p(i,o){o&1&&(t.value=i[0])},i:Q,o:Q,d(i){i&&(k(e),k(n),k(t))}}}function Hp(r){let e,n,t,i;const o=[Kp,Wp,Xp],s=[];function a(l,u){return!l[1]&&!l[2]&&!l[3]?0:l[3]&&!l[1]&&!l[2]?1:l[2]?2:-1}return~(e=a(r))&&(n=s[e]=o[e](r)),{c(){n&&n.c(),t=ce()},m(l,u){~e&&s[e].m(l,u),w(l,t,u),i=!0},p(l,[u]){let f=e;e=a(l),e===f?~e&&s[e].p(l,u):(n&&(se(),y(s[f],1,1,()=>{s[f]=null}),le()),~e?(n=s[e],n?n.p(l,u):(n=s[e]=o[e](l),n.c()),b(n,1),n.m(t.parentNode,t)):n=null)},i(l){i||(b(n),i=!0)},o(l){y(n),i=!1},d(l){l&&k(t),~e&&s[e].d(l)}}}function Zp(r,e,n){let t,{map:i}=e,{url:o}=e,s=0,a=!1,l=!1;return it(async()=>{await $s(),console.log(`Grabbing ${o}`);try{const u=await hu(o,f=>{n(0,s=f)});rt.set(new gu(i,u,Ls,Cs,Kr)),n(0,s=100),n(1,a=!0)}catch(u){console.log(`Route tool broke: ${u}`),n(2,l=!0)}}),r.$$set=u=>{"map"in u&&n(4,i=u.map),"url"in u&&n(5,o=u.url)},r.$$.update=()=>{r.$$.dirty&1&&n(3,t=s>=100)},[s,a,l,t,i,o]}class Vp extends re{constructor(e){super(),ie(this,e,Zp,Hp,te,{map:4,url:5})}}function Qp(r){let e,n,t,i,o;const s=r[4].default,a=At(s,r,r[3],null);return{c(){e=D("button"),a&&a.c(),z(e,"type","button"),z(e,"class","govuk-button govuk-button--secondary svelte-11kph2l"),z(e,"data-module","govuk-button"),e.disabled=n=r[1]||r[2].mode!="list",ri(e,"focused",r[2]==r[0]),Fe(e,"margin-bottom",r[2].mode=="list"?"0px":void 0)},m(l,u){w(l,e,u),a&&a.m(e,null),t=!0,i||(o=_e(e,"click",r[5]),i=!0)},p(l,[u]){a&&a.p&&(!t||u&8)&&Ft(a,s,l,l[3],t?Rt(s,l[3],u,null):Nt(l[3]),null),(!t||u&6&&n!==(n=l[1]||l[2].mode!="list"))&&(e.disabled=n),(!t||u&5)&&ri(e,"focused",l[2]==l[0]),u&4&&Fe(e,"margin-bottom",l[2].mode=="list"?"0px":void 0)},i(l){t||(b(a,l),t=!0)},o(l){y(a,l),t=!1},d(l){l&&k(e),a&&a.d(l),i=!1,o()}}}function xp(r,e,n){let t;H(r,ue,u=>n(2,t=u));let{$$slots:i={},$$scope:o}=e,{setMode:s}=e,{disabled:a=!1}=e;const l=()=>ue.set(s);return r.$$set=u=>{"setMode"in u&&n(0,s=u.setMode),"disabled"in u&&n(1,a=u.disabled),"$$scope"in u&&n(3,o=u.$$scope)},[s,a,t,o,i,l]}class wt extends re{constructor(e){super(),ie(this,e,xp,Qp,te,{setMode:0,disabled:1})}}function co(r){let e,n;return e=new Vp({props:{map:r[5],url:r[2]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&32&&(o.map=t[5]),i&4&&(o.url=t[2]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function em(r){let e,n,t;return{c(){e=D("img"),t=q(` + New point`),ot(e.src,n=wp)||z(e,"src",n),z(e,"alt","New point")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function tm(r){let e,n,t;return{c(){e=D("img"),t=q(` + New route`),ot(e.src,n=Ep)||z(e,"src",n),z(e,"alt","New route")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function nm(r){let e,n,t;return{c(){e=D("img"),t=q(` + New polygon (freehand)`),ot(e.src,n=kp)||z(e,"src",n),z(e,"alt","New polygon (freehand)")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function rm(r){let e,n,t;return{c(){e=D("img"),t=q(` + New polygon (snapped)`),ot(e.src,n=Sp)||z(e,"src",n),z(e,"alt","New polygon (snapped)")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function im(r){let e,n,t;return{c(){e=D("img"),t=q(` + Split route`),ot(e.src,n=Ys)||z(e,"src",n),z(e,"alt","Split route")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function om(r){let e,n,t;return{c(){e=D("img"),t=q(` + Georeference image`),ot(e.src,n=yp)||z(e,"src",n),z(e,"alt","Georeference image")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function sm(r){let e,n,t;return{c(){e=D("img"),t=q(` + StreetView`),ot(e.src,n=Mp)||z(e,"src",n),z(e,"alt","StreetView")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function lm(r){let e,n;return e=new $p({props:{cfg:r[0]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.cfg=t[0]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function am(r){let e,n;return e=new Rp({}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function um(r){let e,n,t,i;return e=new ut({props:{$$slots:{default:[gm]},$$scope:{ctx:r}}}),e.$on("click",r[8]),t=new Kt({props:{$$slots:{default:[hm]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment)},m(o,s){P(e,o,s),w(o,n,s),P(t,o,s),i=!0},p(o,s){const a={};s&512&&(a.$$scope={dirty:s,ctx:o}),e.$set(a);const l={};s&512&&(l.$$scope={dirty:s,ctx:o}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),L(e,o),L(t,o)}}}function fm(r){let e,n;return e=new Yp({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.cfg=t[0]),i&2&&(o.gjSchemes=t[1]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function cm(r){let e,n;return e=new Gp({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.cfg=t[0]),i&2&&(o.gjSchemes=t[1]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function pm(r){let e,n;return e=new Dp({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.cfg=t[0]),i&2&&(o.gjSchemes=t[1]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function mm(r){let e,n;return e=new jp({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.cfg=t[0]),i&2&&(o.gjSchemes=t[1]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function dm(r){let e,n;return e=new Hf({props:{cfg:r[0],gjSchemes:r[1],id:r[7].id}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.cfg=t[0]),i&2&&(o.gjSchemes=t[1]),i&128&&(o.id=t[7].id),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function gm(r){let e;return{c(){e=q("Finish")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function hm(r){let e;return{c(){e=D("ul"),e.innerHTML=`
  • Click + on a route to split it
  • Click + on the map or press + Escape + to cancel
  • `},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function _m(r){let e,n,t,i,o,s,a,l,u,f,c,p,m,h,v,$,C,g,_,E,d,S,R;e=new oc({props:{cfg:r[0],gjSchemes:r[1]}});let j=r[5]&&co(r);a=new wt({props:{setMode:{mode:"new-point"},disabled:!r[4],$$slots:{default:[em]},$$scope:{ctx:r}}}),u=new wt({props:{setMode:{mode:"new-route"},disabled:!r[6],$$slots:{default:[tm]},$$scope:{ctx:r}}}),c=new wt({props:{setMode:{mode:"new-freehand-polygon"},disabled:!r[3],$$slots:{default:[nm]},$$scope:{ctx:r}}}),m=new wt({props:{setMode:{mode:"new-snapped-polygon"},disabled:!r[6],$$slots:{default:[rm]},$$scope:{ctx:r}}}),v=new wt({props:{setMode:{mode:"split-route"},$$slots:{default:[im]},$$scope:{ctx:r}}}),C=new wt({props:{setMode:{mode:"set-image"},$$slots:{default:[om]},$$scope:{ctx:r}}}),_=new wt({props:{setMode:{mode:"streetview"},$$slots:{default:[sm]},$$scope:{ctx:r}}});const T=[dm,mm,pm,cm,fm,um,am,lm],B=[];function O(A,F){return A[7].mode=="edit-geometry"?0:A[7].mode=="new-point"?1:A[7].mode=="new-route"?2:A[7].mode=="new-freehand-polygon"?3:A[7].mode=="new-snapped-polygon"?4:A[7].mode=="split-route"?5:A[7].mode=="set-image"?6:A[7].mode=="streetview"?7:-1}return~(d=O(r))&&(S=B[d]=T[d](r)),{c(){M(e.$$.fragment),n=N(),t=D("div"),i=D("div"),j&&j.c(),o=N(),s=D("div"),M(a.$$.fragment),l=N(),M(u.$$.fragment),f=N(),M(c.$$.fragment),p=N(),M(m.$$.fragment),h=N(),M(v.$$.fragment),$=N(),M(C.$$.fragment),g=N(),M(_.$$.fragment),E=N(),S&&S.c(),Fe(i,"visibility",r[7].mode=="list"?"visible":"hidden"),z(s,"class","toolbar svelte-njynco"),z(t,"class","top govuk-prose svelte-njynco")},m(A,F){P(e,A,F),w(A,n,F),w(A,t,F),U(t,i),j&&j.m(i,null),U(t,o),U(t,s),P(a,s,null),U(s,l),P(u,s,null),U(s,f),P(c,s,null),U(s,p),P(m,s,null),U(s,h),P(v,s,null),U(s,$),P(C,s,null),U(s,g),P(_,s,null),U(t,E),~d&&B[d].m(t,null),R=!0},p(A,[F]){const I={};F&1&&(I.cfg=A[0]),F&2&&(I.gjSchemes=A[1]),e.$set(I),A[5]?j?(j.p(A,F),F&32&&b(j,1)):(j=co(A),j.c(),b(j,1),j.m(i,null)):j&&(se(),y(j,1,1,()=>{j=null}),le()),F&128&&Fe(i,"visibility",A[7].mode=="list"?"visible":"hidden");const X={};F&16&&(X.disabled=!A[4]),F&512&&(X.$$scope={dirty:F,ctx:A}),a.$set(X);const J={};F&64&&(J.disabled=!A[6]),F&512&&(J.$$scope={dirty:F,ctx:A}),u.$set(J);const x={};F&8&&(x.disabled=!A[3]),F&512&&(x.$$scope={dirty:F,ctx:A}),c.$set(x);const G={};F&64&&(G.disabled=!A[6]),F&512&&(G.$$scope={dirty:F,ctx:A}),m.$set(G);const fe={};F&512&&(fe.$$scope={dirty:F,ctx:A}),v.$set(fe);const me={};F&512&&(me.$$scope={dirty:F,ctx:A}),C.$set(me);const be={};F&512&&(be.$$scope={dirty:F,ctx:A}),_.$set(be);let ve=d;d=O(A),d===ve?~d&&B[d].p(A,F):(S&&(se(),y(B[ve],1,1,()=>{B[ve]=null}),le()),~d?(S=B[d],S?S.p(A,F):(S=B[d]=T[d](A),S.c()),b(S,1),S.m(t,null)):S=null)},i(A){R||(b(e.$$.fragment,A),b(j),b(a.$$.fragment,A),b(u.$$.fragment,A),b(c.$$.fragment,A),b(m.$$.fragment,A),b(v.$$.fragment,A),b(C.$$.fragment,A),b(_.$$.fragment,A),b(S),R=!0)},o(A){y(e.$$.fragment,A),y(j),y(a.$$.fragment,A),y(u.$$.fragment,A),y(c.$$.fragment,A),y(m.$$.fragment,A),y(v.$$.fragment,A),y(C.$$.fragment,A),y(_.$$.fragment,A),y(S),R=!1},d(A){A&&(k(n),k(t)),L(e,A),j&&j.d(),L(a),L(u),L(c),L(m),L(v),L(C),L(_),~d&&B[d].d()}}}function bm(r,e,n){let t,i,o,s,a;H(r,rt,p=>n(6,t=p)),H(r,un,p=>n(3,i=p)),H(r,Rn,p=>n(4,o=p)),H(r,Je,p=>n(5,s=p)),H(r,ue,p=>n(7,a=p));let{cfg:l}=e,{gjSchemes:u}=e,{routeSnapperUrl:f}=e;Xe(()=>{o==null||o.tearDown(),i==null||i.tearDown(),t==null||t.tearDown()});const c=()=>ue.set({mode:"list"});return r.$$set=p=>{"cfg"in p&&n(0,l=p.cfg),"gjSchemes"in p&&n(1,u=p.gjSchemes),"routeSnapperUrl"in p&&n(2,f=p.routeSnapperUrl)},r.$$.update=()=>{r.$$.dirty&48&&s&&!o&&Rn.set(new la(s)),r.$$.dirty&40&&s&&!i&&un.set(new qa(s))},[l,u,f,i,o,s,t,a,c]}class vm extends re{constructor(e){super(),ie(this,e,bm,_m,te,{cfg:0,gjSchemes:1,routeSnapperUrl:2})}}const $m="/atip/move_draw_controls/assets/delete-3c023172.svg",ym="/atip/move_draw_controls/assets/save-74d8f3c2.svg";function po(r){let e,n;return e=new ge({props:{disabled:!r[2],$$slots:{default:[wm]},$$scope:{ctx:r}}}),e.$on("click",r[7]),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&4&&(o.disabled=!t[2]),i&4096&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function wm(r){let e;return{c(){e=q("Auto-fill")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function km(r){let e,n,t,i,o,s,a=r[0].length_meters&&po(r);return{c(){e=D("input"),n=N(),a&&a.c(),t=ce(),z(e,"type","text"),z(e,"class","govuk-input"),z(e,"id",r[5])},m(l,u){w(l,e,u),Pe(e,r[0].name),w(l,n,u),a&&a.m(l,u),w(l,t,u),i=!0,o||(s=_e(e,"input",r[6]),o=!0)},p(l,u){u&1&&e.value!==l[0].name&&Pe(e,l[0].name),l[0].length_meters?a?(a.p(l,u),u&1&&b(a,1)):(a=po(l),a.c(),b(a,1),a.m(t.parentNode,t)):a&&(se(),y(a,1,1,()=>{a=null}),le())},i(l){i||(b(a),i=!0)},o(l){y(a),i=!1},d(l){l&&(k(e),k(n),k(t)),a&&a.d(l),o=!1,s()}}}function mo(r){let e,n,t=Bn(r[0].length_meters)+"",i;return{c(){e=D("p"),n=q("Length: "),i=q(t)},m(o,s){w(o,e,s),U(e,n),U(e,i)},p(o,s){s&1&&t!==(t=Bn(o[0].length_meters)+"")&&he(i,t)},d(o){o&&k(e)}}}function Sm(r){let e,n,t,i,o,s,a,l,u,f,c,p,m;e=new Ot({props:{label:"Name",id:r[5],$$slots:{default:[km]},$$scope:{ctx:r}}});function h(d){r[9](d)}let v={label:"Scheme",choices:Object.values(r[3].schemes).map(r[8])};r[0].scheme_reference!==void 0&&(v.value=r[0].scheme_reference),t=new nr({props:v}),V.push(()=>ee(t,"value",h));function $(d){r[10](d)}let C={label:"Type",choices:[["area","Area"],["route","Route"],["crossing","Crossing"],["other","Other"]],inlineSmall:!0,required:!0};r[0].intervention_type!==void 0&&(C.value=r[0].intervention_type),s=new Lt({props:C}),V.push(()=>ee(s,"value",$));function g(d){r[11](d)}let _={label:"Description"};r[0].description!==void 0&&(_.value=r[0].description),u=new Tr({props:_}),V.push(()=>ee(u,"value",g));let E=r[0].length_meters&&mo(r);return{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment),o=N(),M(s.$$.fragment),l=N(),M(u.$$.fragment),c=N(),E&&E.c(),p=ce()},m(d,S){P(e,d,S),w(d,n,S),P(t,d,S),w(d,o,S),P(s,d,S),w(d,l,S),P(u,d,S),w(d,c,S),E&&E.m(d,S),w(d,p,S),m=!0},p(d,[S]){const R={};S&4101&&(R.$$scope={dirty:S,ctx:d}),e.$set(R);const j={};S&8&&(j.choices=Object.values(d[3].schemes).map(d[8])),!i&&S&1&&(i=!0,j.value=d[0].scheme_reference,ne(()=>i=!1)),t.$set(j);const T={};!a&&S&1&&(a=!0,T.value=d[0].intervention_type,ne(()=>a=!1)),s.$set(T);const B={};!f&&S&1&&(f=!0,B.value=d[0].description,ne(()=>f=!1)),u.$set(B),d[0].length_meters?E?E.p(d,S):(E=mo(d),E.c(),E.m(p.parentNode,p)):E&&(E.d(1),E=null)},i(d){m||(b(e.$$.fragment,d),b(t.$$.fragment,d),b(s.$$.fragment,d),b(u.$$.fragment,d),m=!0)},o(d){y(e.$$.fragment,d),y(t.$$.fragment,d),y(s.$$.fragment,d),y(u.$$.fragment,d),m=!1},d(d){d&&(k(n),k(o),k(l),k(c),k(p)),L(e,d),L(t,d),L(s,d),L(u,d),E&&E.d(d)}}}function Em(r,e,n){let t,i,o=Q,s=()=>(o(),o=We(a,C=>n(3,i=C)),a);H(r,rt,C=>n(2,t=C)),r.$$.on_destroy.push(()=>o());let{gjSchemes:a}=e;s();let{props:l}=e;function u(){try{n(0,l.name=t.inner.routeNameForWaypoints(l.waypoints),l)}catch(C){window.alert(`Couldn't auto-name route: ${C}`)}}let f=It();function c(){l.name=this.value,n(0,l)}const p=()=>u(),m=C=>[C.scheme_reference,Vr(C)];function h(C){r.$$.not_equal(l.scheme_reference,C)&&(l.scheme_reference=C,n(0,l))}function v(C){r.$$.not_equal(l.intervention_type,C)&&(l.intervention_type=C,n(0,l))}function $(C){r.$$.not_equal(l.description,C)&&(l.description=C,n(0,l))}return r.$$set=C=>{"gjSchemes"in C&&s(n(1,a=C.gjSchemes)),"props"in C&&n(0,l=C.props)},[l,a,t,i,u,f,c,p,m,h,v,$]}class Mm extends re{constructor(e){super(),ie(this,e,Em,Sm,te,{gjSchemes:1,props:0})}}function Pm(r){let e,n,t;function i(s){r[2](s)}let o={label:r[1],choices:[st("New segregated cycling facility"),st("New junction treatment"),st("New permanent footway"),["New shared use facilities","New shared use (walking and cycling) facilities"],["Improvements to existing route","Improvements to make an existing walking/cycle route safer"],["Area-wide traffic management","Area-wide traffic management (including by TROs - both permanent and experimental)"],["Bus priority measures","Bus priority measures that also enable active travel (for example, bus gates)"],["Secure cycle parking","Provision of secure cycle parking facilities"],st("New road crossings"),st("Restriction or reduction of car parking availability"),st("School streets"),st("Quiet mixed traffic streets"),st("Traffic free routes"),st("Not specified in LCWIP")],emptyOption:!0};return r[0]!==void 0&&(o.value=r[0]),e=new nr({props:o}),V.push(()=>ee(e,"value",i)),{c(){M(e.$$.fragment)},m(s,a){P(e,s,a),t=!0},p(s,[a]){const l={};a&2&&(l.label=s[1]),!n&&a&1&&(n=!0,l.value=s[0],ne(()=>n=!1)),e.$set(l)},i(s){t||(b(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){L(e,s)}}}function st(r){return[r,r]}function Lm(r,e,n){let{label:t}=e,{value:i}=e;function o(s){i=s,n(0,i)}return r.$$set=s=>{"label"in s&&n(1,t=s.label),"value"in s&&n(0,i=s.value)},[i,t,o]}class Xs extends re{constructor(e){super(),ie(this,e,Lm,Pm,te,{label:1,value:0})}}function Cm(r){let e,n,t,i,o,s,a,l,u,f,c,p,m,h,v,$,C,g;function _(F){r[3](F)}let E={label:"Status",choices:[["","Unknown"],["aspiration","Aspiration"],["planned","Planned"],["in development","In development"],["in construction","In construction"],["completed","Completed"]],inlineSmall:!0,required:r[1]};r[0].status!==void 0&&(E.value=r[0].status),i=new Lt({props:E}),V.push(()=>ee(i,"value",_));function d(F){r[4](F)}let S={label:"Timescale",choices:[["","Unknown"],["short","Short (1-3 years)"],["medium","Medium (3-6 years)"],["long","Long (6-10 years)"]],inlineSmall:!0,required:r[1]};r[0].timescale!==void 0&&(S.value=r[0].timescale),a=new Lt({props:S}),V.push(()=>ee(a,"value",d));function R(F){r[5](F)}let j={label:"Estimated completion year (if known)",width:4,min:2010,max:2100};r[0].timescale_year!==void 0&&(j.value=r[0].timescale_year),f=new or({props:j}),V.push(()=>ee(f,"value",R));function T(F){r[6](F)}let B={label:"What year was this scheme most recently published?",width:4,min:2010,max:2100};r[0].year_published!==void 0&&(B.value=r[0].year_published),m=new or({props:B}),V.push(()=>ee(m,"value",T));function O(F){r[7](F)}let A={label:"What year was this scheme most recently consulted on?",width:4,min:2010,max:2100};return r[0].year_consulted!==void 0&&(A.value=r[0].year_consulted),$=new or({props:A}),V.push(()=>ee($,"value",O)),{c(){e=D("fieldset"),n=D("legend"),n.textContent="Timing and status",t=N(),M(i.$$.fragment),s=N(),M(a.$$.fragment),u=N(),M(f.$$.fragment),p=N(),M(m.$$.fragment),v=N(),M($.$$.fragment),z(n,"class","govuk-fieldset__legend"),z(e,"class","govuk-fieldset svelte-1bxyfcq")},m(F,I){w(F,e,I),U(e,n),U(e,t),P(i,e,null),U(e,s),P(a,e,null),U(e,u),P(f,e,null),U(e,p),P(m,e,null),U(e,v),P($,e,null),g=!0},p(F,[I]){const X={};I&2&&(X.required=F[1]),!o&&I&1&&(o=!0,X.value=F[0].status,ne(()=>o=!1)),i.$set(X);const J={};I&2&&(J.required=F[1]),!l&&I&1&&(l=!0,J.value=F[0].timescale,ne(()=>l=!1)),a.$set(J);const x={};!c&&I&1&&(c=!0,x.value=F[0].timescale_year,ne(()=>c=!1)),f.$set(x);const G={};!h&&I&1&&(h=!0,G.value=F[0].year_published,ne(()=>h=!1)),m.$set(G);const fe={};!C&&I&1&&(C=!0,fe.value=F[0].year_consulted,ne(()=>C=!1)),$.$set(fe)},i(F){g||(b(i.$$.fragment,F),b(a.$$.fragment,F),b(f.$$.fragment,F),b(m.$$.fragment,F),b($.$$.fragment,F),g=!0)},o(F){y(i.$$.fragment,F),y(a.$$.fragment,F),y(f.$$.fragment,F),y(m.$$.fragment,F),y($.$$.fragment,F),g=!1},d(F){F&&k(e),L(i),L(a),L(f),L(m),L($)}}}function Am(r,e,n){let{data:t}=e,{required:i}=e,{onUpdate:o}=e;function s(p){o()}function a(p){r.$$.not_equal(t.status,p)&&(t.status=p,n(0,t))}function l(p){r.$$.not_equal(t.timescale,p)&&(t.timescale=p,n(0,t))}function u(p){r.$$.not_equal(t.timescale_year,p)&&(t.timescale_year=p,n(0,t))}function f(p){r.$$.not_equal(t.year_published,p)&&(t.year_published=p,n(0,t))}function c(p){r.$$.not_equal(t.year_consulted,p)&&(t.year_consulted=p,n(0,t))}return r.$$set=p=>{"data"in p&&n(0,t=p.data),"required"in p&&n(1,i=p.required),"onUpdate"in p&&n(2,o=p.onUpdate)},r.$$.update=()=>{r.$$.dirty&1&&s()},[t,i,o,a,l,u,f,c]}class Ws extends re{constructor(e){super(),ie(this,e,Am,Cm,te,{data:0,required:1,onUpdate:2})}}function go(r,e,n){const t=r.slice();return t[9]=e[n],t[10]=e,t[11]=n,t}function Fm(r){let e;return{c(){e=q("Is the development fully funded?")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Nm(r){let e;return{c(){e=q("Is the construction fully funded?")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Rm(r){let e,n,t;function i(s){r[6](s,r[9])}let o={$$slots:{default:[Om]},$$scope:{ctx:r}};return r[0].funding_sources[r[9]]!==void 0&&(o.checked=r[0].funding_sources[r[9]]),e=new Ct({props:o}),V.push(()=>ee(e,"checked",i)),{c(){M(e.$$.fragment)},m(s,a){P(e,s,a),t=!0},p(s,a){r=s;const l={};a&4096&&(l.$$scope={dirty:a,ctx:r}),!n&&a&3&&(n=!0,l.checked=r[0].funding_sources[r[9]],ne(()=>n=!1)),e.$set(l)},i(s){t||(b(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){L(e,s)}}}function Om(r){let e=r[9].toUpperCase()+"",n,t;return{c(){n=q(e),t=N()},m(i,o){w(i,n,o),w(i,t,o)},p:Q,d(i){i&&(k(n),k(t))}}}function ho(r){let e,n,t=r[9]!="other"&&Rm(r);return{c(){t&&t.c(),e=ce()},m(i,o){t&&t.m(i,o),w(i,e,o),n=!0},p(i,o){i[9]!="other"&&t.p(i,o)},i(i){n||(b(t),n=!0)},o(i){y(t),n=!1},d(i){i&&k(e),t&&t.d(i)}}}function Im(r){let e,n,t=Ie(r[1]),i=[];for(let s=0;sy(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;see(i,"value",E));function S(A){r[4](A)}let R={$$slots:{default:[Fm]},$$scope:{ctx:r}};r[0].development_funded!==void 0&&(R.checked=r[0].development_funded),a=new Ct({props:R}),V.push(()=>ee(a,"checked",S));function j(A){r[5](A)}let T={$$slots:{default:[Nm]},$$scope:{ctx:r}};r[0].construction_funded!==void 0&&(T.checked=r[0].construction_funded),f=new Ct({props:T}),V.push(()=>ee(f,"checked",j)),v=new Wo({props:{$$slots:{default:[Im]},$$scope:{ctx:r}}});function B(A){r[7](A)}let O={label:"Other funding sources"};return r[0].funding_sources.other!==void 0&&(O.value=r[0].funding_sources.other),C=new rr({props:O}),V.push(()=>ee(C,"value",B)),{c(){e=D("fieldset"),n=D("legend"),n.textContent="Budget",t=N(),M(i.$$.fragment),s=N(),M(a.$$.fragment),u=N(),M(f.$$.fragment),p=N(),m=D("p"),m.textContent="Funding sources",h=N(),M(v.$$.fragment),$=N(),M(C.$$.fragment),z(n,"class","govuk-fieldset__legend"),z(e,"class","govuk-fieldset svelte-1bxyfcq")},m(A,F){w(A,e,F),U(e,n),U(e,t),P(i,e,null),U(e,s),P(a,e,null),U(e,u),P(f,e,null),U(e,p),U(e,m),U(e,h),P(v,e,null),U(e,$),P(C,e,null),_=!0},p(A,[F]){const I={};!o&&F&1&&(o=!0,I.value=A[0].budget,ne(()=>o=!1)),i.$set(I);const X={};F&4096&&(X.$$scope={dirty:F,ctx:A}),!l&&F&1&&(l=!0,X.checked=A[0].development_funded,ne(()=>l=!1)),a.$set(X);const J={};F&4096&&(J.$$scope={dirty:F,ctx:A}),!c&&F&1&&(c=!0,J.checked=A[0].construction_funded,ne(()=>c=!1)),f.$set(J);const x={};F&4097&&(x.$$scope={dirty:F,ctx:A}),v.$set(x);const G={};!g&&F&1&&(g=!0,G.value=A[0].funding_sources.other,ne(()=>g=!1)),C.$set(G)},i(A){_||(b(i.$$.fragment,A),b(a.$$.fragment,A),b(f.$$.fragment,A),b(v.$$.fragment,A),b(C.$$.fragment,A),_=!0)},o(A){y(i.$$.fragment,A),y(a.$$.fragment,A),y(f.$$.fragment,A),y(v.$$.fragment,A),y(C.$$.fragment,A),_=!1},d(A){A&&k(e),L(i),L(a),L(f),L(v),L(C)}}}function Bm(r,e,n){let{data:t}=e,{onUpdate:i}=e;function o(p){i()}let s=["atf2","atf3","atf4","atf4e","crsts","luf"];function a(p){r.$$.not_equal(t.budget,p)&&(t.budget=p,n(0,t))}function l(p){r.$$.not_equal(t.development_funded,p)&&(t.development_funded=p,n(0,t))}function u(p){r.$$.not_equal(t.construction_funded,p)&&(t.construction_funded=p,n(0,t))}function f(p,m){r.$$.not_equal(t.funding_sources[m],p)&&(t.funding_sources[m]=p,n(0,t))}function c(p){r.$$.not_equal(t.funding_sources.other,p)&&(t.funding_sources.other=p,n(0,t))}return r.$$set=p=>{"data"in p&&n(0,t=p.data),"onUpdate"in p&&n(2,i=p.onUpdate)},r.$$.update=()=>{r.$$.dirty&1&&o()},[t,s,i,a,l,u,f,c]}class Ks extends re{constructor(e){super(),ie(this,e,Bm,jm,te,{data:0,onUpdate:2})}}function _o(r){let e,n;return e=new ge({props:{disabled:!r[2],$$slots:{default:[qm]},$$scope:{ctx:r}}}),e.$on("click",r[8]),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&4&&(o.disabled=!t[2]),i&65536&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function qm(r){let e;return{c(){e=q("Auto-fill with street names")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Gm(r){let e,n,t,i,o,s,a,l,u=r[0].length_meters&&_o(r);return{c(){e=D("div"),e.textContent="Use the name from the LCWIP if possible",n=N(),t=D("input"),i=N(),u&&u.c(),o=ce(),z(e,"class","govuk-hint"),z(t,"type","text"),z(t,"class","govuk-input"),z(t,"id",r[6])},m(f,c){w(f,e,c),w(f,n,c),w(f,t,c),Pe(t,r[0].name),w(f,i,c),u&&u.m(f,c),w(f,o,c),s=!0,a||(l=_e(t,"input",r[7]),a=!0)},p(f,c){c&1&&t.value!==f[0].name&&Pe(t,f[0].name),f[0].length_meters?u?(u.p(f,c),c&1&&b(u,1)):(u=_o(f),u.c(),b(u,1),u.m(o.parentNode,o)):u&&(se(),y(u,1,1,()=>{u=null}),le())},i(f){s||(b(u),s=!0)},o(f){y(u),s=!1},d(f){f&&(k(e),k(n),k(t),k(i),k(o)),u&&u.d(f),a=!1,l()}}}function bo(r){let e,n,t=Bn(r[0].length_meters)+"",i;return{c(){e=D("p"),n=q("Length: "),i=q(t)},m(o,s){w(o,e,s),U(e,n),U(e,i)},p(o,s){s&1&&t!==(t=Bn(o[0].length_meters)+"")&&he(i,t)},d(o){o&&k(e)}}}function vo(r){let e,n,t,i,o,s,a,l,u,f,c,p,m,h;function v(S){r[12](S)}let $={label:"Type"};r[0].pipeline.atf4_type!==void 0&&($.value=r[0].pipeline.atf4_type),e=new Xs({props:$}),V.push(()=>ee(e,"value",v));function C(S){r[13](S)}let g={label:"Accuracy of mapped data",choices:[["high","High"],["medium","Medium"],["low","Low"]],required:!0,inlineSmall:!0};r[0].pipeline.accuracy!==void 0&&(g.value=r[0].pipeline.accuracy),i=new Lt({props:g}),V.push(()=>ee(i,"value",C));function _(S){r[14](S)}let E={$$slots:{default:[Tm]},$$scope:{ctx:r}};r[0].pipeline.is_alternative!==void 0&&(E.checked=r[0].pipeline.is_alternative),a=new Ct({props:E}),V.push(()=>ee(a,"checked",_));let d=r[4]&&r[0].is_coverage_polygon!==void 0&&$o(r);return c=new Ws({props:{data:r[0].pipeline,required:!1,onUpdate:zm}}),m=new Ks({props:{data:r[0].pipeline,onUpdate:Jm}}),{c(){M(e.$$.fragment),t=N(),M(i.$$.fragment),s=N(),M(a.$$.fragment),u=N(),d&&d.c(),f=N(),M(c.$$.fragment),p=N(),M(m.$$.fragment)},m(S,R){P(e,S,R),w(S,t,R),P(i,S,R),w(S,s,R),P(a,S,R),w(S,u,R),d&&d.m(S,R),w(S,f,R),P(c,S,R),w(S,p,R),P(m,S,R),h=!0},p(S,R){const j={};!n&&R&1&&(n=!0,j.value=S[0].pipeline.atf4_type,ne(()=>n=!1)),e.$set(j);const T={};!o&&R&1&&(o=!0,T.value=S[0].pipeline.accuracy,ne(()=>o=!1)),i.$set(T);const B={};R&65536&&(B.$$scope={dirty:R,ctx:S}),!l&&R&1&&(l=!0,B.checked=S[0].pipeline.is_alternative,ne(()=>l=!1)),a.$set(B),S[4]&&S[0].is_coverage_polygon!==void 0?d?(d.p(S,R),R&1&&b(d,1)):(d=$o(S),d.c(),b(d,1),d.m(f.parentNode,f)):d&&(se(),y(d,1,1,()=>{d=null}),le());const O={};R&1&&(O.data=S[0].pipeline),c.$set(O);const A={};R&1&&(A.data=S[0].pipeline),m.$set(A)},i(S){h||(b(e.$$.fragment,S),b(i.$$.fragment,S),b(a.$$.fragment,S),b(d),b(c.$$.fragment,S),b(m.$$.fragment,S),h=!0)},o(S){y(e.$$.fragment,S),y(i.$$.fragment,S),y(a.$$.fragment,S),y(d),y(c.$$.fragment,S),y(m.$$.fragment,S),h=!1},d(S){S&&(k(t),k(s),k(u),k(f),k(p)),L(e,S),L(i,S),L(a,S),d&&d.d(S),L(c,S),L(m,S)}}}function Tm(r){let e;return{c(){e=q("Is this an alternative route and not the default option?")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function $o(r){let e,n,t;function i(s){r[15](s)}let o={$$slots:{default:[Um]},$$scope:{ctx:r}};return r[0].is_coverage_polygon!==void 0&&(o.checked=r[0].is_coverage_polygon),e=new Ct({props:o}),V.push(()=>ee(e,"checked",i)),{c(){M(e.$$.fragment)},m(s,a){P(e,s,a),t=!0},p(s,a){const l={};a&65536&&(l.$$scope={dirty:a,ctx:s}),!n&&a&1&&(n=!0,l.checked=s[0].is_coverage_polygon,ne(()=>n=!1)),e.$set(l)},i(s){t||(b(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){L(e,s)}}}function Um(r){let e;return{c(){e=q(`Does this polygon show the coverage of the scheme? (All area considered + while making the scheme)`)},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Dm(r){let e,n,t,i,o,s,a,l,u,f,c;e=new Ot({props:{label:"Name",id:r[6],$$slots:{default:[Gm]},$$scope:{ctx:r}}});function p(g){r[10](g)}let m={label:"Scheme",choices:Object.values(r[3].schemes).map(r[9])};r[0].scheme_reference!==void 0&&(m.value=r[0].scheme_reference),t=new nr({props:m}),V.push(()=>ee(t,"value",p));function h(g){r[11](g)}let v={label:"Description"};r[0].description!==void 0&&(v.value=r[0].description),s=new Tr({props:v}),V.push(()=>ee(s,"value",h));let $=r[0].length_meters&&bo(r),C=r[0].pipeline&&vo(r);return{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment),o=N(),M(s.$$.fragment),l=N(),$&&$.c(),u=N(),C&&C.c(),f=ce()},m(g,_){P(e,g,_),w(g,n,_),P(t,g,_),w(g,o,_),P(s,g,_),w(g,l,_),$&&$.m(g,_),w(g,u,_),C&&C.m(g,_),w(g,f,_),c=!0},p(g,[_]){const E={};_&65541&&(E.$$scope={dirty:_,ctx:g}),e.$set(E);const d={};_&8&&(d.choices=Object.values(g[3].schemes).map(g[9])),!i&&_&1&&(i=!0,d.value=g[0].scheme_reference,ne(()=>i=!1)),t.$set(d);const S={};!a&&_&1&&(a=!0,S.value=g[0].description,ne(()=>a=!1)),s.$set(S),g[0].length_meters?$?$.p(g,_):($=bo(g),$.c(),$.m(u.parentNode,u)):$&&($.d(1),$=null),g[0].pipeline?C?(C.p(g,_),_&1&&b(C,1)):(C=vo(g),C.c(),b(C,1),C.m(f.parentNode,f)):C&&(se(),y(C,1,1,()=>{C=null}),le())},i(g){c||(b(e.$$.fragment,g),b(t.$$.fragment,g),b(s.$$.fragment,g),b(C),c=!0)},o(g){y(e.$$.fragment,g),y(t.$$.fragment,g),y(s.$$.fragment,g),y(C),c=!1},d(g){g&&(k(n),k(o),k(l),k(u),k(f)),L(e,g),L(t,g),L(s,g),$&&$.d(g),C&&C.d(g)}}}const zm=()=>{},Jm=()=>{};function Ym(r,e,n){let t,i,o=Q,s=()=>(o(),o=We(a,d=>n(3,i=d)),a);H(r,rt,d=>n(2,t=d)),r.$$.on_destroy.push(()=>o());let{gjSchemes:a}=e;s();let{props:l}=e;l.pipeline||(l.pipeline={atf4_type:"",accuracy:"",is_alternative:!1,development_funded:!1,construction_funded:!1,funding_sources:Qn(),status:"",timescale:""}),l.is_coverage_polygon||(l.is_coverage_polygon=!1);const u=(i.features.filter(d=>d.properties.is_coverage_polygon).length==0||l.is_coverage_polygon===!0)&&l.intervention_type==="area";function f(){try{n(0,l.name=t.inner.routeNameForWaypoints(l.waypoints),l)}catch(d){window.alert(`Couldn't auto-name route: ${d}`)}}let c=It();function p(){l.name=this.value,n(0,l)}const m=()=>f(),h=d=>[d.scheme_reference,Vr(d)];function v(d){r.$$.not_equal(l.scheme_reference,d)&&(l.scheme_reference=d,n(0,l))}function $(d){r.$$.not_equal(l.description,d)&&(l.description=d,n(0,l))}function C(d){r.$$.not_equal(l.pipeline.atf4_type,d)&&(l.pipeline.atf4_type=d,n(0,l))}function g(d){r.$$.not_equal(l.pipeline.accuracy,d)&&(l.pipeline.accuracy=d,n(0,l))}function _(d){r.$$.not_equal(l.pipeline.is_alternative,d)&&(l.pipeline.is_alternative=d,n(0,l))}function E(d){r.$$.not_equal(l.is_coverage_polygon,d)&&(l.is_coverage_polygon=d,n(0,l))}return r.$$set=d=>{"gjSchemes"in d&&s(n(1,a=d.gjSchemes)),"props"in d&&n(0,l=d.props)},[l,a,t,i,u,f,c,p,m,h,v,$,C,g,_,E]}class Xm extends re{constructor(e){super(),ie(this,e,Ym,Dm,te,{gjSchemes:1,props:0})}}function yo(r,e,n){const t=r.slice();return t[9]=e[n][0],t[10]=e[n][1],t}function wo(r){let e,n;return e=new ge({props:{$$slots:{default:[Wm]},$$scope:{ctx:r}}}),e.$on("click",r[6]),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&8192&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Wm(r){let e;return{c(){e=q("Handle extra GeoJSON properties")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function ko(r){let e,n,t=r[9]+"",i,o,s=JSON.stringify(r[10])+"",a,l;return{c(){e=D("li"),n=D("b"),i=q(t),o=q(` + = `),a=q(s),l=N()},m(u,f){w(u,e,f),U(e,n),U(n,i),U(e,o),U(e,a),U(e,l)},p(u,f){f&2&&t!==(t=u[9]+"")&&he(i,t),f&2&&s!==(s=JSON.stringify(u[10])+"")&&he(a,s)},d(u){u&&k(e)}}}function Km(r){let e;return{c(){e=q("Remove these properties")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Hm(r){let e;return{c(){e=q("Cancel")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Zm(r){let e,n,t,i;return e=new bt({props:{$$slots:{default:[Km]},$$scope:{ctx:r}}}),e.$on("click",r[2]),t=new ge({props:{$$slots:{default:[Hm]},$$scope:{ctx:r}}}),t.$on("click",r[7]),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment)},m(o,s){P(e,o,s),w(o,n,s),P(t,o,s),i=!0},p(o,s){const a={};s&8192&&(a.$$scope={dirty:s,ctx:o}),e.$set(a);const l={};s&8192&&(l.$$scope={dirty:s,ctx:o}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),L(e,o),L(t,o)}}}function Vm(r){let e,n,t,i,o,s,a=Ie(Object.entries(r[1])),l=[];for(let u=0;u0,n,t,i,o,s=e&&wo(r);function a(u){r[8](u)}let l={title:"This imported GeoJSON feature has unexpected properties",$$slots:{default:[Vm]},$$scope:{ctx:r}};return r[0]!==void 0&&(l.open=r[0]),t=new _t({props:l}),V.push(()=>ee(t,"open",a)),{c(){s&&s.c(),n=N(),M(t.$$.fragment)},m(u,f){s&&s.m(u,f),w(u,n,f),P(t,u,f),o=!0},p(u,[f]){f&2&&(e=Object.entries(u[1]).length>0),e?s?(s.p(u,f),f&2&&b(s,1)):(s=wo(u),s.c(),b(s,1),s.m(n.parentNode,n)):s&&(se(),y(s,1,1,()=>{s=null}),le());const c={};f&8195&&(c.$$scope={dirty:f,ctx:u}),!i&&f&1&&(i=!0,c.open=u[0],ne(()=>i=!1)),t.$set(c)},i(u){o||(b(s),b(t.$$.fragment,u),o=!0)},o(u){y(s),y(t.$$.fragment,u),o=!1},d(u){u&&k(n),s&&s.d(u),L(t,u)}}}function xm(r,e,n){let t,{gjSchemes:i}=e,{id:o}=e,{props:s}=e,a=!1;function l(){n(0,a=!1),i.update(p=>{let m=p.features.find(h=>h.id==o);for(let h of Object.keys(t))delete m.properties[h];return p})}const u=()=>n(0,a=!0),f=()=>n(0,a=!1);function c(p){a=p,n(0,a)}return r.$$set=p=>{"gjSchemes"in p&&n(3,i=p.gjSchemes),"id"in p&&n(4,o=p.id),"props"in p&&n(5,s=p.props)},r.$$.update=()=>{r.$$.dirty&32&&n(1,t=Zs(s))},[a,t,l,i,o,s,u,f,c]}class ed extends re{constructor(e){super(),ie(this,e,xm,Qm,te,{gjSchemes:3,id:4,props:5})}}function td(r){let e,n,t;function i(s){r[6](s)}let o={gjSchemes:r[1]};return r[0]!==void 0&&(o.props=r[0]),e=new Xm({props:o}),V.push(()=>ee(e,"props",i)),{c(){M(e.$$.fragment)},m(s,a){P(e,s,a),t=!0},p(s,a){const l={};a&2&&(l.gjSchemes=s[1]),!n&&a&1&&(n=!0,l.props=s[0],ne(()=>n=!1)),e.$set(l)},i(s){t||(b(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){L(e,s)}}}function nd(r){let e,n,t;function i(s){r[5](s)}let o={gjSchemes:r[1]};return r[0]!==void 0&&(o.props=r[0]),e=new Mm({props:o}),V.push(()=>ee(e,"props",i)),{c(){M(e.$$.fragment)},m(s,a){P(e,s,a),t=!0},p(s,a){const l={};a&2&&(l.gjSchemes=s[1]),!n&&a&1&&(n=!0,l.props=s[0],ne(()=>n=!1)),e.$set(l)},i(s){t||(b(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){L(e,s)}}}function rd(r){let e,n,t,i,o,s;e=new ed({props:{gjSchemes:r[1],id:r[2],props:r[0]}});const a=[nd,td],l=[];function u(f,c){return f[3]=="v1"?0:f[3]=="pipeline"?1:-1}return~(t=u(r))&&(i=l[t]=a[t](r)),{c(){M(e.$$.fragment),n=N(),i&&i.c(),o=ce()},m(f,c){P(e,f,c),w(f,n,c),~t&&l[t].m(f,c),w(f,o,c),s=!0},p(f,[c]){const p={};c&2&&(p.gjSchemes=f[1]),c&4&&(p.id=f[2]),c&1&&(p.props=f[0]),e.$set(p);let m=t;t=u(f),t===m?~t&&l[t].p(f,c):(i&&(se(),y(l[m],1,1,()=>{l[m]=null}),le()),~t?(i=l[t],i?i.p(f,c):(i=l[t]=a[t](f),i.c()),b(i,1),i.m(o.parentNode,o)):i=null)},i(f){s||(b(e.$$.fragment,f),b(i),s=!0)},o(f){y(e.$$.fragment,f),y(i),s=!1},d(f){f&&(k(n),k(o)),L(e,f),~t&&l[t].d(f)}}}function id(r,e,n){let t;H(r,xe,f=>n(3,t=f));let{cfg:i}=e,{gjSchemes:o}=e,{id:s}=e,{props:a}=e;function l(f){a=f,n(0,a)}function u(f){a=f,n(0,a)}return r.$$set=f=>{"cfg"in f&&n(4,i=f.cfg),"gjSchemes"in f&&n(1,o=f.gjSchemes),"id"in f&&n(2,s=f.id),"props"in f&&n(0,a=f.props)},[a,o,s,t,i,l,u]}class od extends re{constructor(e){super(),ie(this,e,id,rd,te,{cfg:4,gjSchemes:1,id:2,props:0})}}function sd(r){let e;return{c(){e=q("Scheme details")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function ld(r){let e;return{c(){e=q("Save")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function ad(r){let e,n,t,i,o;function s(l){r[6](l)}let a={label:"Scheme name",required:!0};return r[3].schemes[r[1]].scheme_name!==void 0&&(a.value=r[3].schemes[r[1]].scheme_name),e=new rr({props:a}),V.push(()=>ee(e,"value",s)),i=new ut({props:{$$slots:{default:[ld]},$$scope:{ctx:r}}}),i.$on("click",r[7]),{c(){M(e.$$.fragment),t=N(),M(i.$$.fragment)},m(l,u){P(e,l,u),w(l,t,u),P(i,l,u),o=!0},p(l,u){const f={};!n&&u&10&&(n=!0,f.value=l[3].schemes[l[1]].scheme_name,ne(()=>n=!1)),e.$set(f);const c={};u&512&&(c.$$scope={dirty:u,ctx:l}),i.$set(c)},i(l){o||(b(e.$$.fragment,l),b(i.$$.fragment,l),o=!0)},o(l){y(e.$$.fragment,l),y(i.$$.fragment,l),o=!1},d(l){l&&k(t),L(e,l),L(i,l)}}}function ud(r){let e,n,t,i,o,s,a;e=new ge({props:{$$slots:{default:[sd]},$$scope:{ctx:r}}}),e.$on("click",r[5]);function l(f){r[8](f)}let u={title:"Scheme details",$$slots:{default:[ad]},$$scope:{ctx:r}};return r[2]!==void 0&&(u.open=r[2]),t=new _t({props:u}),V.push(()=>ee(t,"open",l)),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment)},m(f,c){P(e,f,c),w(f,n,c),P(t,f,c),o=!0,s||(a=_e(window,"keydown",r[4]),s=!0)},p(f,[c]){const p={};c&512&&(p.$$scope={dirty:c,ctx:f}),e.$set(p);const m={};c&526&&(m.$$scope={dirty:c,ctx:f}),!i&&c&4&&(i=!0,m.open=f[2],ne(()=>i=!1)),t.$set(m)},i(f){o||(b(e.$$.fragment,f),b(t.$$.fragment,f),o=!0)},o(f){y(e.$$.fragment,f),y(t.$$.fragment,f),o=!1},d(f){f&&k(n),L(e,f),L(t,f),s=!1,a()}}}function fd(r,e,n){let t,i=Q,o=()=>(i(),i=We(s,h=>n(3,t=h)),s);r.$$.on_destroy.push(()=>i());let{gjSchemes:s}=e;o();let{scheme_reference:a}=e,l=!1;function u(h){l&&h.key=="Escape"&&(h.stopPropagation(),n(2,l=!1))}const f=()=>n(2,l=!0);function c(h){r.$$.not_equal(t.schemes[a].scheme_name,h)&&(t.schemes[a].scheme_name=h,s.set(t))}const p=()=>n(2,l=!1);function m(h){l=h,n(2,l)}return r.$$set=h=>{"gjSchemes"in h&&o(n(0,s=h.gjSchemes)),"scheme_reference"in h&&n(1,a=h.scheme_reference)},[s,a,l,t,u,f,c,p,m]}class cd extends re{constructor(e){super(),ie(this,e,fd,ud,te,{gjSchemes:0,scheme_reference:1})}}function pd(r){let e;return{c(){e=q("Scheme details")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function md(r){let e;return{c(){e=q("Save")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function dd(r){let e,n,t,i,o,s,a,l,u,f,c,p,m,h,v,$,C,g,_,E,d;function S(I){r[9](I)}let R={label:"Scheme name",required:!0};r[6].schemes[r[1]].scheme_name!==void 0&&(R.value=r[6].schemes[r[1]].scheme_name),e=new rr({props:R}),V.push(()=>ee(e,"value",S));function j(I){r[10](I)}let T={label:"Scheme type",choices:[["cycling route","Cycling route"],["walking route","Walking route"],["shared-use route","Shared-use route"],["cycling and walking route","Cycling and walking route, not shared use"],["area-based scheme","Area-based scheme"],["intersection","Intersection/junction scheme"]],inlineSmall:!0,required:!0};r[3].scheme_type!==void 0&&(T.value=r[3].scheme_type),a=new Lt({props:T}),V.push(()=>ee(a,"value",j));function B(I){r[11](I)}let O={label:"Type of the main intervention"};r[3].atf4_lead_type!==void 0&&(O.value=r[3].atf4_lead_type),f=new Xs({props:O}),V.push(()=>ee(f,"value",B));function A(I){r[12](I)}let F={label:"Scheme description (150 words max)"};return r[3].scheme_description!==void 0&&(F.value=r[3].scheme_description),m=new Tr({props:F}),V.push(()=>ee(m,"value",A)),$=new Ws({props:{data:r[3],required:!0,onUpdate:r[13]}}),g=new Ks({props:{data:r[3],onUpdate:r[14]}}),E=new ut({props:{$$slots:{default:[md]},$$scope:{ctx:r}}}),E.$on("click",r[15]),{c(){M(e.$$.fragment),t=N(),i=D("fieldset"),o=D("legend"),o.textContent="Basic information",s=N(),M(a.$$.fragment),u=N(),M(f.$$.fragment),p=N(),M(m.$$.fragment),v=N(),M($.$$.fragment),C=N(),M(g.$$.fragment),_=N(),M(E.$$.fragment),z(o,"class","govuk-fieldset__legend"),z(i,"class","govuk-fieldset svelte-1bxyfcq")},m(I,X){P(e,I,X),w(I,t,X),w(I,i,X),U(i,o),U(i,s),P(a,i,null),U(i,u),P(f,i,null),U(i,p),P(m,i,null),w(I,v,X),P($,I,X),w(I,C,X),P(g,I,X),w(I,_,X),P(E,I,X),d=!0},p(I,X){const J={};!n&&X&66&&(n=!0,J.value=I[6].schemes[I[1]].scheme_name,ne(()=>n=!1)),e.$set(J);const x={};!l&&X&8&&(l=!0,x.value=I[3].scheme_type,ne(()=>l=!1)),a.$set(x);const G={};!c&&X&8&&(c=!0,G.value=I[3].atf4_lead_type,ne(()=>c=!1)),f.$set(G);const fe={};!h&&X&8&&(h=!0,fe.value=I[3].scheme_description,ne(()=>h=!1)),m.$set(fe);const me={};X&8&&(me.data=I[3]),X&16&&(me.onUpdate=I[13]),$.$set(me);const be={};X&8&&(be.data=I[3]),X&16&&(be.onUpdate=I[14]),g.$set(be);const ve={};X&524288&&(ve.$$scope={dirty:X,ctx:I}),E.$set(ve)},i(I){d||(b(e.$$.fragment,I),b(a.$$.fragment,I),b(f.$$.fragment,I),b(m.$$.fragment,I),b($.$$.fragment,I),b(g.$$.fragment,I),b(E.$$.fragment,I),d=!0)},o(I){y(e.$$.fragment,I),y(a.$$.fragment,I),y(f.$$.fragment,I),y(m.$$.fragment,I),y($.$$.fragment,I),y(g.$$.fragment,I),y(E.$$.fragment,I),d=!1},d(I){I&&(k(t),k(i),k(v),k(C),k(_)),L(e,I),L(a),L(f),L(m),L($,I),L(g,I),L(E,I)}}}function gd(r){let e,n,t,i,o,s,a,l,u;e=new Ye({props:{errorMessage:r[5]}}),t=new ge({props:{$$slots:{default:[pd]},$$scope:{ctx:r}}}),t.$on("click",r[8]);function f(p){r[16](p)}let c={title:"Scheme details",$$slots:{default:[dd]},$$scope:{ctx:r}};return r[2]!==void 0&&(c.open=r[2]),o=new _t({props:c}),V.push(()=>ee(o,"open",f)),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment),i=N(),M(o.$$.fragment)},m(p,m){P(e,p,m),w(p,n,m),P(t,p,m),w(p,i,m),P(o,p,m),a=!0,l||(u=_e(window,"keydown",r[7]),l=!0)},p(p,[m]){const h={};m&32&&(h.errorMessage=p[5]),e.$set(h);const v={};m&524288&&(v.$$scope={dirty:m,ctx:p}),t.$set(v);const $={};m&524382&&($.$$scope={dirty:m,ctx:p}),!s&&m&4&&(s=!0,$.open=p[2],ne(()=>s=!1)),o.$set($)},i(p){a||(b(e.$$.fragment,p),b(t.$$.fragment,p),b(o.$$.fragment,p),a=!0)},o(p){y(e.$$.fragment,p),y(t.$$.fragment,p),y(o.$$.fragment,p),a=!1},d(p){p&&(k(n),k(i)),L(e,p),L(t,p),L(o,p),l=!1,u()}}}function hd(r,e,n){let t,i,o=Q,s=()=>(o(),o=We(a,j=>n(6,i=j)),a);r.$$.on_destroy.push(()=>o());let{gjSchemes:a}=e;s();let{scheme_reference:l}=e,u=!1,f=i.schemes[l].pipeline,c=0;function p(j,T){return f.scheme_type&&f.status&&f.timescale?"":"Missing some required data"}function m(j){u&&j.key=="Escape"&&(j.stopPropagation(),n(2,u=!1))}function h(){Be(a,i.schemes[l].pipeline=f,i),a.set(i)}const v=()=>n(2,u=!0);function $(j){r.$$.not_equal(i.schemes[l].scheme_name,j)&&(i.schemes[l].scheme_name=j,a.set(i))}function C(j){r.$$.not_equal(f.scheme_type,j)&&(f.scheme_type=j,n(3,f))}function g(j){r.$$.not_equal(f.atf4_lead_type,j)&&(f.atf4_lead_type=j,n(3,f))}function _(j){r.$$.not_equal(f.scheme_description,j)&&(f.scheme_description=j,n(3,f))}const E=()=>n(4,c++,c),d=()=>n(4,c++,c),S=()=>n(2,u=!1);function R(j){u=j,n(2,u)}return r.$$set=j=>{"gjSchemes"in j&&s(n(0,a=j.gjSchemes)),"scheme_reference"in j&&n(1,l=j.scheme_reference)},r.$$.update=()=>{r.$$.dirty&24&&n(5,t=p()),r.$$.dirty&4&&(u||h())},[a,l,u,f,c,t,i,m,v,$,C,g,_,E,d,S,R]}class _d extends re{constructor(e){super(),ie(this,e,hd,gd,te,{gjSchemes:0,scheme_reference:1})}}function bd(r){let e,n;return e=new cd({props:{gjSchemes:r[0],scheme_reference:r[1]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.gjSchemes=t[0]),i&2&&(o.scheme_reference=t[1]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function vd(r){let e,n;return e=new _d({props:{gjSchemes:r[0],scheme_reference:r[1]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.gjSchemes=t[0]),i&2&&(o.scheme_reference=t[1]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function $d(r){let e,n,t,i;const o=[vd,bd],s=[];function a(l,u){return l[2]=="pipeline"?0:1}return e=a(r),n=s[e]=o[e](r),{c(){n.c(),t=ce()},m(l,u){s[e].m(l,u),w(l,t,u),i=!0},p(l,[u]){let f=e;e=a(l),e===f?s[e].p(l,u):(se(),y(s[f],1,1,()=>{s[f]=null}),le(),n=s[e],n?n.p(l,u):(n=s[e]=o[e](l),n.c()),b(n,1),n.m(t.parentNode,t))},i(l){i||(b(n),i=!0)},o(l){y(n),i=!1},d(l){l&&k(t),s[e].d(l)}}}function yd(r,e,n){let t;H(r,xe,s=>n(2,t=s));let{gjSchemes:i}=e,{scheme_reference:o}=e;return r.$$set=s=>{"gjSchemes"in s&&n(0,i=s.gjSchemes),"scheme_reference"in s&&n(1,o=s.scheme_reference)},[i,o,t]}class wd extends re{constructor(e){super(),ie(this,e,yd,$d,te,{gjSchemes:0,scheme_reference:1})}}let Te={interventionName:Sd,schemeName:Vr,backfill:Nn,initializeEmptyScheme:kd,interventionWarning:Ed,editFeatureForm:od,editSchemeForm:wd,newPointFeature:r=>{r.properties.intervention_type="other"},newPolygonFeature:r=>{r.properties.intervention_type="area",r.properties.is_coverage_polygon=!1},newLineStringFeature:r=>{r.properties.intervention_type="route",r.properties.route_name&&(Et(xe)!="pipeline"&&(r.properties.name=r.properties.route_name),delete r.properties.route_name)},updateFeature:(r,e)=>{e.properties.route_name&&!r.properties.name&&Et(xe)!="pipeline"&&(r.properties.name=e.properties.route_name)},maptilerApiKey:"MZEJTanw3WpxRvt7qDfo",getStreetViewRoadLayerNames:r=>Ol(r,Et(gr)),layerZorder:Il};function Nn(r){var t,i,o,s,a,l,u,f;let e=Et(xe),n=1;for(let c of r.features)c.properties||(c.properties={name:"",scheme_reference:"",description:"",intervention_type:"other",is_coverage_polygon:!1}),e=="pipeline"&&!c.properties.intervention_type&&(c.properties.intervention_type=new Map([["LineString","route"],["Polygon","area"]]).get(c.geometry.type)??"other"),c.geometry.type=="LineString"&&!c.properties.length_meters&&(c.properties.length_meters=jl(c,{units:"kilometers"})*1e3),c.id=n++;if(!r.schemes){let c=It();r.schemes={},r.schemes[c]={scheme_reference:c,color:oi()},r.scheme_name&&(r.schemes[c].scheme_name=r.scheme_name,delete r.scheme_name),r.pipeline&&(r.schemes[c].pipeline=r.pipeline,delete r.pipeline);for(let p of r.features)p.properties.scheme_reference=c}for(let c of Object.values(r.schemes)){let p=c;if(p.color??(p.color=oi()),e=="pipeline"){p.pipeline??(p.pipeline=Hs()),(t=p.pipeline).development_funded??(t.development_funded=!1),(i=p.pipeline).construction_funded??(i.construction_funded=!1),(o=p.pipeline).funding_sources??(o.funding_sources=Qn()),delete p.pipeline.budget_funded,delete p.pipeline.budget_unfunded,delete p.pipeline.funding_source,delete p.pipeline.funded;for(let m of r.features)m.properties.pipeline&&((s=m.properties.pipeline).development_funded??(s.development_funded=!1),(a=m.properties.pipeline).construction_funded??(a.construction_funded=!1),(l=m.properties.pipeline).funding_sources??(l.funding_sources=Qn()),(u=m.properties.pipeline).status??(u.status=""),(f=m.properties.pipeline).timescale??(f.timescale=""))}}return r}function kd(r){let e=r;return Et(xe)=="pipeline"&&(e.pipeline=Hs()),e}function Hs(){return{scheme_type:"",atf4_lead_type:"",scheme_description:"",status:"",timescale:"",development_funded:!1,construction_funded:!1,funding_sources:Qn()}}function Qn(){return{atf2:!1,atf3:!1,atf4:!1,atf4e:!1,crsts:!1,luf:!1,other:""}}function Sd(r){if(r.properties.name)return r.properties.name;var e=r.properties.intervention_type;return e=="other"&&(r.geometry.type=="Point"?e="point":r.geometry.type=="LineString"?e="line":e="polygon"),`Untitled ${e}`}function Vr(r){return r.scheme_name??"Untitled scheme"}function Ed(r){var t;let e=Et(xe);if(!r.properties.name)return"No name";if(!new Set(["route","area","crossing","other"]).has(r.properties.intervention_type))return"No intervention type";if(e=="pipeline"&&!((t=r.properties.pipeline)!=null&&t.accuracy))return"Accuracy not specified";let n=Zs(r.properties);return Object.entries(n).length>0?`Extra GeoJSON properties: ${Object.keys(n).join(", ")}`:null}function Zs(r){let e=Et(xe),n=JSON.parse(JSON.stringify(r));for(let t of["name","description","intervention_type","length_meters","waypoints","hide_while_editing","is_coverage_polygon","scheme_reference"])delete n[t];if(e=="pipeline"&&n.pipeline){for(let t of["atf4_type","accuracy","is_alternative","budget","development_funded","construction_funded","funding_sources","status","timescale","timescale_year","year_published","year_consulted"])delete n.pipeline[t];Object.entries(n.pipeline).length==0&&delete n.pipeline}return n}function So(r,e,n){const t=r.slice();return t[8]=e[n],t}function Md(r){let e;return{c(){e=q("Delete all sketch data from browser")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Eo(r){let e,n,t,i,o=Ie(r[1].storedStrings),s=[];for(let l=0;ly(s[l],1,1,()=>{s[l]=null});return{c(){e=D("p"),e.textContent=`Otherwise here is a breakdown of what is currently stored locally. You can + delete individual items (normally storage quota is 5MB or 10MB):`,n=N();for(let l=0;l{i=null}),le());const l={};a&2050&&(l.$$scope={dirty:a,ctx:r}),n.$set(l)},i(s){t||(b(i),b(n.$$.fragment,s),t=!0)},o(s){y(i),y(n.$$.fragment,s),t=!1},d(s){s&&k(e),i&&i.d(s),L(n,s)}}}function Ld(r){var p;let e,n=((p=r[1])==null?void 0:p.message)+"",t,i,o,s,a,l,u,f;a=new bt({props:{$$slots:{default:[Md]},$$scope:{ctx:r}}}),a.$on("click",r[4]);let c=r[1]&&Eo(r);return{c(){e=D("p"),t=q(n),i=N(),o=D("p"),o.textContent=`If you have saved your work locally to a geojson file recently, you can + delete all files stored in the browser for all authorities to free up space. + Be sure that you're not losing anything important before doing this!`,s=N(),M(a.$$.fragment),l=N(),c&&c.c(),u=ce()},m(m,h){w(m,e,h),U(e,t),w(m,i,h),w(m,o,h),w(m,s,h),P(a,m,h),w(m,l,h),c&&c.m(m,h),w(m,u,h),f=!0},p(m,h){var $;(!f||h&2)&&n!==(n=(($=m[1])==null?void 0:$.message)+"")&&he(t,n);const v={};h&2048&&(v.$$scope={dirty:h,ctx:m}),a.$set(v),m[1]?c?(c.p(m,h),h&2&&b(c,1)):(c=Eo(m),c.c(),b(c,1),c.m(u.parentNode,u)):c&&(se(),y(c,1,1,()=>{c=null}),le())},i(m){f||(b(a.$$.fragment,m),b(c),f=!0)},o(m){y(a.$$.fragment,m),y(c),f=!1},d(m){m&&(k(e),k(i),k(o),k(s),k(l),k(u)),L(a,m),c&&c.d(m)}}}function Cd(r){let e,n,t;function i(s){r[7](s)}let o={title:"Local Storage Quota Exceeded",$$slots:{default:[Ld]},$$scope:{ctx:r}};return r[0]!==void 0&&(o.open=r[0]),e=new _t({props:o}),V.push(()=>ee(e,"open",i)),{c(){M(e.$$.fragment)},m(s,a){P(e,s,a),t=!0},p(s,[a]){const l={};a&2054&&(l.$$scope={dirty:a,ctx:s}),!n&&a&1&&(n=!0,l.open=s[0],ne(()=>n=!1)),e.$set(l)},i(s){t||(b(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){L(e,s)}}}function Ad(r,e,n){let{show:t}=e,{setStorageError:i}=e,{clearCurrentSketch:o}=e,{currentAuthority:s}=e;function a(c){let p=vl(c);i&&n(1,i.storedStrings=p,i),c===s&&o()}function l(){o(),$l(),n(0,t=!1),n(1,i=void 0)}const u=c=>a(c.key);function f(c){t=c,n(0,t)}return r.$$set=c=>{"show"in c&&n(0,t=c.show),"setStorageError"in c&&n(1,i=c.setStorageError),"clearCurrentSketch"in c&&n(5,o=c.clearCurrentSketch),"currentAuthority"in c&&n(2,s=c.currentAuthority)},[t,i,s,a,l,o,u,f]}class Fd extends re{constructor(e){super(),ie(this,e,Ad,Cd,te,{show:0,setStorageError:1,clearCurrentSketch:5,currentAuthority:2})}}function Lo(r){let e,n;return e=new Bl({props:{label:"Manage files",$$slots:{default:[Gd]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&2097164&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Nd(r){let e,n,t;return{c(){e=D("img"),t=q(` + Save`),ot(e.src,n=ym)||z(e,"src",n),z(e,"alt","Save as GeoJSON file")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function Rd(r){let e,n,t;return{c(){e=D("img"),t=q(` + Clear all`),ot(e.src,n=$m)||z(e,"src",n),z(e,"alt","Clear all")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function Od(r){let e,n,t,i;return e=new ge({props:{$$slots:{default:[Nd]},$$scope:{ctx:r}}}),e.$on("click",r[8]),t=new bt({props:{$$slots:{default:[Rd]},$$scope:{ctx:r}}}),t.$on("click",r[14]),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment)},m(o,s){P(e,o,s),w(o,n,s),P(t,o,s),i=!0},p(o,s){const a={};s&2097152&&(a.$$scope={dirty:s,ctx:o}),e.$set(a);const l={};s&2097152&&(l.$$scope={dirty:s,ctx:o}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),L(e,o),L(t,o)}}}function Id(r){let e;return{c(){e=q("Clear all work")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function jd(r){let e;return{c(){e=q("Cancel")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Bd(r){let e,n,t,i;return e=new bt({props:{$$slots:{default:[Id]},$$scope:{ctx:r}}}),e.$on("click",r[7]),t=new ge({props:{$$slots:{default:[jd]},$$scope:{ctx:r}}}),t.$on("click",r[15]),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment)},m(o,s){P(e,o,s),w(o,n,s),P(t,o,s),i=!0},p(o,s){const a={};s&2097152&&(a.$$scope={dirty:s,ctx:o}),e.$set(a);const l={};s&2097152&&(l.$$scope={dirty:s,ctx:o}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),L(e,o),L(t,o)}}}function qd(r){let e,n,t,i;return t=new Ke({props:{$$slots:{default:[Bd]},$$scope:{ctx:r}}}),{c(){e=D("p"),e.textContent="This will delete everything for all schemes.",n=N(),M(t.$$.fragment)},m(o,s){w(o,e,s),w(o,n,s),P(t,o,s),i=!0},p(o,s){const a={};s&2097160&&(a.$$scope={dirty:s,ctx:o}),t.$set(a)},i(o){i||(b(t.$$.fragment,o),i=!0)},o(o){y(t.$$.fragment,o),i=!1},d(o){o&&(k(e),k(n)),L(t,o)}}}function Gd(r){let e,n,t,i,o,s,a,l,u;e=new Yo({props:{label:"Load GeoJSON file",onLoad:r[9]}}),t=new Ke({props:{$$slots:{default:[Od]},$$scope:{ctx:r}}}),o=new Ye({props:{errorMessage:r[2]}});function f(p){r[16](p)}let c={title:"Would you like to clear your work?",displayEscapeButton:!1,$$slots:{default:[qd]},$$scope:{ctx:r}};return r[3]!==void 0&&(c.open=r[3]),a=new _t({props:c}),V.push(()=>ee(a,"open",f)),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment),i=N(),M(o.$$.fragment),s=N(),M(a.$$.fragment)},m(p,m){P(e,p,m),w(p,n,m),P(t,p,m),w(p,i,m),P(o,p,m),w(p,s,m),P(a,p,m),u=!0},p(p,m){const h={};m&2097160&&(h.$$scope={dirty:m,ctx:p}),t.$set(h);const v={};m&4&&(v.errorMessage=p[2]),o.$set(v);const $={};m&2097160&&($.$$scope={dirty:m,ctx:p}),!l&&m&8&&(l=!0,$.open=p[3],ne(()=>l=!1)),a.$set($)},i(p){u||(b(e.$$.fragment,p),b(t.$$.fragment,p),b(o.$$.fragment,p),b(a.$$.fragment,p),u=!0)},o(p){y(e.$$.fragment,p),y(t.$$.fragment,p),y(o.$$.fragment,p),y(a.$$.fragment,p),u=!1},d(p){p&&(k(n),k(i),k(s)),L(e,p),L(t,p),L(o,p),L(a,p)}}}function Td(r){let e,n,t,i,o,s=r[6].mode=="list"&&Lo(r);function a(f){r[17](f)}function l(f){r[18](f)}let u={clearCurrentSketch:r[7],currentAuthority:r[1]};return r[4]!==void 0&&(u.show=r[4]),r[5]!==void 0&&(u.setStorageError=r[5]),n=new Fd({props:u}),V.push(()=>ee(n,"show",a)),V.push(()=>ee(n,"setStorageError",l)),{c(){s&&s.c(),e=N(),M(n.$$.fragment)},m(f,c){s&&s.m(f,c),w(f,e,c),P(n,f,c),o=!0},p(f,[c]){f[6].mode=="list"?s?(s.p(f,c),c&64&&b(s,1)):(s=Lo(f),s.c(),b(s,1),s.m(e.parentNode,e)):s&&(se(),y(s,1,1,()=>{s=null}),le());const p={};c&2&&(p.currentAuthority=f[1]),!t&&c&16&&(t=!0,p.show=f[4],ne(()=>t=!1)),!i&&c&32&&(i=!0,p.setStorageError=f[5],ne(()=>i=!1)),n.$set(p)},i(f){o||(b(s),b(n.$$.fragment,f),o=!0)},o(f){y(s),y(n.$$.fragment,f),o=!1},d(f){f&&k(e),s&&s.d(f),L(n,f)}}}function Ud(r,e){var n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8, "+encodeURIComponent(e)),n.setAttribute("download",r),document.body.appendChild(n),n.click(),document.body.removeChild(n)}function Dd(r,e,n){let t,i=Q,o=()=>(i(),i=We(u,B=>n(13,t=B)),u),s,a;H(r,ue,B=>n(6,s=B)),H(r,xe,B=>n(19,a=B)),r.$$.on_destroy.push(()=>i());let{cfg:l}=e,{gjSchemes:u}=e;o();let{authorityName:f}=e,c="",p=f;a!="v1"&&(p+=`_${a}`);let m=!1,h=!1;it(async()=>{let O=new URLSearchParams(window.location.search).get("geojsonUrl"),A=window.localStorage.getItem(p);if(O){console.log(`Loading GeoJSON from ${O}`);try{let I=await(await fetch(O)).text();u.set(Nn(JSON.parse(I)))}catch(F){console.log(`Failed to load from URL: ${F}`)}}else if(A)try{u.set(Nn(JSON.parse(A)))}catch(F){console.log(`Failed to load from local storage: ${F}`)}n(12,m=!0)});let v=!1,$;function C(){n(3,h=!1),u.update(B=>{let O=Gr(l);return O.origin=B.origin,O.authority=B.authority,O}),tn.set(null),rn.set(new Set),Be(ue,s.mode="list",s)}function g(){const B=JSON.parse(JSON.stringify(t));for(let O of B.features)delete O.properties.hide_while_editing;return B}function _(){let B=g();B.authority=f,B.origin="atip-v2",Ud(`${p}.geojson`,JSON.stringify(B,null," "))}function E(B,O){try{u.set(Nn(JSON.parse(O))),n(2,c="")}catch(A){n(2,c=`Couldn't load scheme from a file: ${A}`)}}const d=()=>n(3,h=!0),S=()=>n(3,h=!1);function R(B){h=B,n(3,h)}function j(B){v=B,n(4,v),n(12,m),n(13,t),n(11,p)}function T(B){$=B,n(5,$),n(12,m),n(13,t),n(11,p)}return r.$$set=B=>{"cfg"in B&&n(10,l=B.cfg),"gjSchemes"in B&&o(n(0,u=B.gjSchemes)),"authorityName"in B&&n(1,f=B.authorityName)},r.$$.update=()=>{if(r.$$.dirty&14336&&m&&t){console.log("GJ changed, saving to local storage");const B=yl(p,JSON.stringify(g()));B.isQuotaError&&(n(4,v=!0),n(5,$=B))}},[u,f,c,h,v,$,s,C,_,E,l,p,m,t,d,S,R,j,T]}class zd extends re{constructor(e){super(),ie(this,e,Dd,Td,te,{cfg:10,gjSchemes:0,authorityName:1})}}function Jd(r){let e;return{c(){e=D("div"),e.innerHTML=`

    Saving files

    ATIP does not send any data over the network or store your data in the + cloud. The current file you're editing will be saved in your browser's + local storage and automatically resume when you return to the page. Click Edit scheme + , then + Export to GeoJSON + or + Load from GeoJSON + to save or load a file to your computer. You can share these files with others + to collaborate on designs.

    `,z(e,"class","govuk-prose")},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function Yd(r){let e,n,t;function i(s){r[1](s)}let o={title:"Instructions",$$slots:{default:[Jd]},$$scope:{ctx:r}};return r[0]!==void 0&&(o.open=r[0]),e=new _t({props:o}),V.push(()=>ee(e,"open",i)),{c(){M(e.$$.fragment)},m(s,a){P(e,s,a),t=!0},p(s,[a]){const l={};a&4&&(l.$$scope={dirty:a,ctx:s}),!n&&a&1&&(n=!0,l.open=s[0],ne(()=>n=!1)),e.$set(l)},i(s){t||(b(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){L(e,s)}}}function Xd(r,e,n){let{open:t}=e;function i(o){t=o,n(0,t)}return r.$$set=o=>{"open"in o&&n(0,t=o.open)},[t,i]}class Wd extends re{constructor(e){super(),ie(this,e,Xd,Yd,te,{open:0})}}function Kd(r){let e;return{c(){e=q("Save")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Hd(r){let e;return{c(){e=q("Edit geometry")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Zd(r){let e;return{c(){e=q("Delete")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Vd(r){let e,n,t,i,o,s;return e=new ut({props:{$$slots:{default:[Kd]},$$scope:{ctx:r}}}),e.$on("click",r[5]),t=new ge({props:{$$slots:{default:[Hd]},$$scope:{ctx:r}}}),t.$on("click",r[6]),o=new bt({props:{$$slots:{default:[Zd]},$$scope:{ctx:r}}}),o.$on("click",r[7]),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment),i=N(),M(o.$$.fragment)},m(a,l){P(e,a,l),w(a,n,l),P(t,a,l),w(a,i,l),P(o,a,l),s=!0},p(a,l){const u={};l&8192&&(u.$$scope={dirty:l,ctx:a}),e.$set(u);const f={};l&8192&&(f.$$scope={dirty:l,ctx:a}),t.$set(f);const c={};l&8192&&(c.$$scope={dirty:l,ctx:a}),o.$set(c)},i(a){s||(b(e.$$.fragment,a),b(t.$$.fragment,a),b(o.$$.fragment,a),s=!0)},o(a){y(e.$$.fragment,a),y(t.$$.fragment,a),y(o.$$.fragment,a),s=!1},d(a){a&&(k(n),k(i)),L(e,a),L(t,a),L(o,a)}}}function Qd(r){let e,n,t=r[0].interventionName(r[3])+"",i,o,s,a,l,u,f,c,p,m,h,v;s=new Ke({props:{$$slots:{default:[Vd]},$$scope:{ctx:r}}}),l=new Ye({props:{errorMessage:r[0].interventionWarning(r[3])}});function $(_){r[8](_)}var C=r[0].editFeatureForm;function g(_,E){let d={cfg:_[0],gjSchemes:_[1],id:_[2]};return _[3].properties!==void 0&&(d.props=_[3].properties),{props:d}}return C&&(f=jn(C,g(r)),V.push(()=>ee(f,"props",$))),{c(){e=D("h2"),n=q("Editing "),i=q(t),o=N(),M(s.$$.fragment),a=N(),M(l.$$.fragment),u=N(),f&&M(f.$$.fragment),p=ce()},m(_,E){w(_,e,E),U(e,n),U(e,i),w(_,o,E),P(s,_,E),w(_,a,E),P(l,_,E),w(_,u,E),f&&P(f,_,E),w(_,p,E),m=!0,h||(v=_e(window,"keydown",r[4]),h=!0)},p(_,[E]){(!m||E&9)&&t!==(t=_[0].interventionName(_[3])+"")&&he(i,t);const d={};E&8198&&(d.$$scope={dirty:E,ctx:_}),s.$set(d);const S={};if(E&9&&(S.errorMessage=_[0].interventionWarning(_[3])),l.$set(S),E&1&&C!==(C=_[0].editFeatureForm)){if(f){se();const R=f;y(R.$$.fragment,1,0,()=>{L(R,1)}),le()}C?(f=jn(C,g(_)),V.push(()=>ee(f,"props",$)),M(f.$$.fragment),b(f.$$.fragment,1),P(f,p.parentNode,p)):f=null}else if(C){const R={};E&1&&(R.cfg=_[0]),E&2&&(R.gjSchemes=_[1]),E&4&&(R.id=_[2]),!c&&E&8&&(c=!0,R.props=_[3].properties,ne(()=>c=!1)),f.$set(R)}},i(_){m||(b(s.$$.fragment,_),b(l.$$.fragment,_),f&&b(f.$$.fragment,_),m=!0)},o(_){y(s.$$.fragment,_),y(l.$$.fragment,_),f&&y(f.$$.fragment,_),m=!1},d(_){_&&(k(e),k(o),k(a),k(u),k(p)),L(s,_),L(l,_),f&&L(f,_),h=!1,v()}}}function xd(r,e,n){let t,i,o=Q,s=()=>(o(),o=We(l,g=>n(10,i=g)),l);H(r,Je,g=>n(9,t=g)),r.$$.on_destroy.push(()=>o());let{cfg:a}=e,{gjSchemes:l}=e;s();let{id:u}=e,f=i.features.find(g=>g.id==u);function c(g){l.set(i)}it(()=>{t==null||t.on("click",p)}),Xe(()=>{t==null||t.off("click",p)});function p(g){for(let _ of t.queryRenderedFeatures(g.point,{layers:["interventions-points","interventions-lines","interventions-polygons"]}))if(_.id==u)return;ue.set({mode:"list"})}function m(g){if(g.key=="Escape"){g.stopPropagation(),ue.set({mode:"list"});return}if(g.key=="Delete"){const _=g.target.tagName;if(_=="INPUT"||_=="TEXTAREA")return;g.stopPropagation(),ii(l,u)}if(g.key=="e"){const _=g.target.tagName;if(_=="INPUT"||_=="TEXTAREA")return;g.stopPropagation(),ue.set({mode:"edit-geometry",id:u})}}const h=()=>ue.set({mode:"list"}),v=()=>ue.set({mode:"edit-geometry",id:u}),$=()=>ii(l,u);function C(g){r.$$.not_equal(f.properties,g)&&(f.properties=g,n(3,f))}return r.$$set=g=>{"cfg"in g&&n(0,a=g.cfg),"gjSchemes"in g&&s(n(1,l=g.gjSchemes)),"id"in g&&n(2,u=g.id)},r.$$.update=()=>{r.$$.dirty&8&&c()},[a,l,u,f,m,h,v,$,C]}class eg extends re{constructor(e){super(),ie(this,e,xd,Qd,te,{cfg:0,gjSchemes:1,id:2})}}const tg="/atip/move_draw_controls/assets/delete-3c023172.svg";function Co(r,e,n){const t=r.slice();t[29]=e[n];const i=t[0].interventionWarning(t[29]);return t[30]=i,t}function ng(r){let e,n,t;return{c(){e=D("img"),t=q(` + Delete`),ot(e.src,n=tg)||z(e,"src",n),z(e,"alt","Delete scheme")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function rg(r){let e;return{c(){e=q("Show")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function ig(r){let e,n;return e=new Ye({props:{errorMessage:"There's a problem with "+r[8]+" interventions below"}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i[0]&256&&(o.errorMessage="There's a problem with "+t[8]+" interventions below"),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function og(r){let e,n;return e=new Ye({props:{errorMessage:"There's a problem with one intervention below"}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Ao(r){let e,n;return e=new Ko({props:{text:r[30]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i[0]&13&&(o.text=t[30]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Fo(r,e){let n,t,i,o=e[0].interventionName(e[29])+"",s,a,l,u,f,c=e[30]&&Ao(e);function p(...v){return e[20](e[29],...v)}function m(){return e[21](e[29])}function h(){return e[22](e[29])}return{key:r,first:null,c(){n=D("li"),t=D("a"),c&&c.c(),i=N(),s=q(o),a=N(),z(t,"href","#"),this.first=n},m(v,$){w(v,n,$),U(n,t),c&&c.m(t,null),U(t,i),U(t,s),U(n,a),l=!0,u||(f=[_e(t,"click",p),_e(t,"mouseenter",m),_e(t,"mouseleave",h)],u=!0)},p(v,$){e=v,e[30]?c?(c.p(e,$),$[0]&13&&b(c,1)):(c=Ao(e),c.c(),b(c,1),c.m(t,i)):c&&(se(),y(c,1,1,()=>{c=null}),le()),(!l||$[0]&13)&&o!==(o=e[0].interventionName(e[29])+"")&&he(s,o)},i(v){l||(b(c),l=!0)},o(v){y(c),l=!1},d(v){v&&k(n),c&&c.d(),u=!1,xn(f)}}}function No(r){let e,n,t,i,o=r[7]==1?"intervention":"interventions",s,a,l,u,f,c;function p(h){r[23](h)}let m={label:"Move interventions to another scheme",choices:r[13]()};return r[5]!==void 0&&(m.value=r[5]),u=new nr({props:m}),V.push(()=>ee(u,"value",p)),u.$on("change",r[12]),{c(){e=D("p"),n=q("Do you want to first move "),t=q(r[7]),i=N(),s=q(o),a=q(" to another scheme?"),l=N(),M(u.$$.fragment)},m(h,v){w(h,e,v),U(e,n),U(e,t),U(e,i),U(e,s),U(e,a),w(h,l,v),P(u,h,v),c=!0},p(h,v){(!c||v[0]&128)&&he(t,h[7]),(!c||v[0]&128)&&o!==(o=h[7]==1?"intervention":"interventions")&&he(s,o);const $={};!f&&v[0]&32&&(f=!0,$.value=h[5],ne(()=>f=!1)),u.$set($)},i(h){c||(b(u.$$.fragment,h),c=!0)},o(h){y(u.$$.fragment,h),c=!1},d(h){h&&(k(e),k(l)),L(u,h)}}}function sg(r){let e;return{c(){e=q("Delete scheme")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function lg(r){let e;return{c(){e=q("Cancel")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function ag(r){let e,n,t,i;return e=new bt({props:{$$slots:{default:[sg]},$$scope:{ctx:r}}}),e.$on("click",r[11]),t=new ge({props:{$$slots:{default:[lg]},$$scope:{ctx:r}}}),t.$on("click",r[24]),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment)},m(o,s){P(e,o,s),w(o,n,s),P(t,o,s),i=!0},p(o,s){const a={};s[0]&67108864&&(a.$$scope={dirty:s,ctx:o}),e.$set(a);const l={};s[0]&67108864&&(l.$$scope={dirty:s,ctx:o}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),L(e,o),L(t,o)}}}function ug(r){let e=r[7]>0&&r[13]().length>0,n,t,i,o=e&&No(r);return t=new Ke({props:{$$slots:{default:[ag]},$$scope:{ctx:r}}}),{c(){o&&o.c(),n=N(),M(t.$$.fragment)},m(s,a){o&&o.m(s,a),w(s,n,a),P(t,s,a),i=!0},p(s,a){a[0]&128&&(e=s[7]>0&&s[13]().length>0),e?o?(o.p(s,a),a[0]&128&&b(o,1)):(o=No(s),o.c(),b(o,1),o.m(n.parentNode,n)):o&&(se(),y(o,1,1,()=>{o=null}),le());const l={};a[0]&67108880&&(l.$$scope={dirty:a,ctx:s}),t.$set(l)},i(s){i||(b(o),b(t.$$.fragment,s),i=!0)},o(s){y(o),y(t.$$.fragment,s),i=!1},d(s){s&&k(n),o&&o.d(s),L(t,s)}}}function fg(r){let e,n=r[0].schemeName(r[3].schemes[r[2]])+"",t,i,o,s,a,l,u,f,c,p,m,h,v,$,C,g,_=[],E=new Map,d,S,R,j,T,B;a=new bt({props:{$$slots:{default:[ng]},$$scope:{ctx:r}}}),a.$on("click",r[17]);function O(Y){r[18](Y)}let A={$$slots:{default:[rg]},$$scope:{ctx:r}};r[6]!==void 0&&(A.checked=r[6]),u=new Ct({props:A}),V.push(()=>ee(u,"checked",O)),u.$on("change",r[14]);const F=r[15].default,I=At(F,r,r[26],null);var X=r[0].editSchemeForm;function J(Y,Z){return{props:{gjSchemes:Y[1],scheme_reference:Y[2]}}}X&&(m=jn(X,J(r)));const x=[og,ig],G=[];function fe(Y,Z){return Y[8]==1?0:Y[8]>0?1:-1}~(v=fe(r))&&($=G[v]=x[v](r));let me=Ie(r[3].features.filter(r[19]));const be=Y=>Y[29].id;for(let Y=0;Yee(S,"open",ve)),{c(){e=D("h3"),t=q(n),i=N(),o=D("input"),s=N(),M(a.$$.fragment),l=N(),M(u.$$.fragment),c=N(),I&&I.c(),p=N(),m&&M(m.$$.fragment),h=N(),$&&$.c(),C=N(),g=D("ol");for(let Y=0;Y<_.length;Y+=1)_[Y].c();d=N(),M(S.$$.fragment),z(o,"type","color"),z(g,"class","govuk-list govuk-list--number")},m(Y,Z){w(Y,e,Z),U(e,t),U(e,i),U(e,o),Pe(o,r[3].schemes[r[2]].color),U(e,s),P(a,e,null),w(Y,l,Z),P(u,Y,Z),w(Y,c,Z),I&&I.m(Y,Z),w(Y,p,Z),m&&P(m,Y,Z),w(Y,h,Z),~v&&G[v].m(Y,Z),w(Y,C,Z),w(Y,g,Z);for(let je=0;je<_.length;je+=1)_[je]&&_[je].m(g,null);w(Y,d,Z),P(S,Y,Z),j=!0,T||(B=_e(o,"input",r[16]),T=!0)},p(Y,Z){(!j||Z[0]&13)&&n!==(n=Y[0].schemeName(Y[3].schemes[Y[2]])+"")&&he(t,n),Z[0]&12&&Pe(o,Y[3].schemes[Y[2]].color);const je={};Z[0]&67108864&&(je.$$scope={dirty:Z,ctx:Y}),a.$set(je);const W={};if(Z[0]&67108864&&(W.$$scope={dirty:Z,ctx:Y}),!f&&Z[0]&64&&(f=!0,W.checked=Y[6],ne(()=>f=!1)),u.$set(W),I&&I.p&&(!j||Z[0]&67108864)&&Ft(I,F,Y,Y[26],j?Rt(F,Y[26],Z,null):Nt(Y[26]),null),Z[0]&1&&X!==(X=Y[0].editSchemeForm)){if(m){se();const Me=m;y(Me.$$.fragment,1,0,()=>{L(Me,1)}),le()}X?(m=jn(X,J(Y)),M(m.$$.fragment),b(m.$$.fragment,1),P(m,h.parentNode,h)):m=null}else if(X){const Me={};Z[0]&2&&(Me.gjSchemes=Y[1]),Z[0]&4&&(Me.scheme_reference=Y[2]),m.$set(Me)}let we=v;v=fe(Y),v===we?~v&&G[v].p(Y,Z):($&&(se(),y(G[we],1,1,()=>{G[we]=null}),le()),~v?($=G[v],$?$.p(Y,Z):($=G[v]=x[v](Y),$.c()),b($,1),$.m(C.parentNode,C)):$=null),Z[0]&1549&&(me=Ie(Y[3].features.filter(Y[19])),se(),_=jr(_,Z,be,1,Y,me,E,g,Br,Fo,null,Co),le());const qt={};Z[0]&67109040&&(qt.$$scope={dirty:Z,ctx:Y}),!R&&Z[0]&16&&(R=!0,qt.open=Y[4],ne(()=>R=!1)),S.$set(qt)},i(Y){if(!j){b(a.$$.fragment,Y),b(u.$$.fragment,Y),b(I,Y),m&&b(m.$$.fragment,Y),b($);for(let Z=0;Z(a(),a=We(m,G=>n(3,s=G)),m),u;H(r,rn,G=>n(27,o=G)),H(r,Je,G=>n(28,u=G)),r.$$.on_destroy.push(()=>a());let{$$slots:f={},$$scope:c}=e,{cfg:p}=e,{gjSchemes:m}=e;l();let{scheme_reference:h}=e,v=!1;Xe(()=>{tn.set(null)});function $(G,fe){G.preventDefault();let me=s.features.find(be=>be.id==fe);me.geometry.type=="Point"?u==null||u.flyTo({center:me.geometry.coordinates,duration:500}):u==null||u.fitBounds(Xo(me),{padding:200,duration:500}),ue.set({mode:"edit-form",id:fe})}function C(G){tn.update(fe=>fe==G?null:fe)}function g(){m.update(G=>(G.features=G.features.filter(fe=>fe.properties.scheme_reference!=h),delete G.schemes[h],Object.keys(G.schemes).length==0&&(G=Gr(p)),G)),rn.update(G=>(G.delete(h),G)),n(4,v=!1)}let _="";function E(){_&&m.update(G=>{for(let fe of G.features)fe.properties.scheme_reference==h&&(fe.properties.scheme_reference=_);return G})}function d(){return Object.values(s.schemes).filter(G=>G.scheme_reference!=h).map(G=>[G.scheme_reference,p.schemeName(G)])}let S=!o.has(h);function R(){rn.update(G=>(S?G.delete(h):G.add(h),G))}function j(){s.schemes[h].color=this.value,m.set(s)}const T=()=>n(4,v=!0);function B(G){S=G,n(6,S)}const O=G=>G.properties.scheme_reference==h,A=(G,fe)=>$(fe,G.id),F=G=>tn.set(G.id),I=G=>C(G.id);function X(G){_=G,n(5,_)}const J=()=>n(4,v=!1);function x(G){v=G,n(4,v)}return r.$$set=G=>{"cfg"in G&&n(0,p=G.cfg),"gjSchemes"in G&&l(n(1,m=G.gjSchemes)),"scheme_reference"in G&&n(2,h=G.scheme_reference),"$$scope"in G&&n(26,c=G.$$scope)},r.$$.update=()=>{r.$$.dirty[0]&13&&n(8,t=s.features.filter(G=>G.properties.scheme_reference==h&&p.interventionWarning(G)!=null).length),r.$$.dirty[0]&12&&n(7,i=s.features.filter(G=>G.properties.scheme_reference==h).length)},[p,m,h,s,v,_,S,i,t,$,C,g,E,d,R,f,j,T,B,O,A,F,I,X,J,x,c]}class pg extends re{constructor(e){super(),ie(this,e,cg,fg,te,{cfg:0,gjSchemes:1,scheme_reference:2},null,[-1,-1])}}function Ro(r,e,n){const t=r.slice();return t[9]=e[n],t[11]=n,t}function mg(r){let e;return{c(){e=q("Add new blank scheme")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Oo(r){let e,n,t,i;function o(){return r[7](r[9])}e=new ge({props:{disabled:r[11]==0,$$slots:{default:[dg]},$$scope:{ctx:r}}}),e.$on("click",o);function s(){return r[8](r[9])}return t=new ge({props:{disabled:r[11]==Object.keys(r[3].schemes).length-1,$$slots:{default:[gg]},$$scope:{ctx:r}}}),t.$on("click",s),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment)},m(a,l){P(e,a,l),w(a,n,l),P(t,a,l),i=!0},p(a,l){r=a;const u={};l&8&&(u.disabled=r[11]==0),l&4096&&(u.$$scope={dirty:l,ctx:r}),e.$set(u);const f={};l&8&&(f.disabled=r[11]==Object.keys(r[3].schemes).length-1),l&4096&&(f.$$scope={dirty:l,ctx:r}),t.$set(f)},i(a){i||(b(e.$$.fragment,a),b(t.$$.fragment,a),i=!0)},o(a){y(e.$$.fragment,a),y(t.$$.fragment,a),i=!1},d(a){a&&k(n),L(e,a),L(t,a)}}}function dg(r){let e;return{c(){e=q("Move up")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function gg(r){let e;return{c(){e=q("Move down")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function hg(r){let e=Object.keys(r[3].schemes).length>1,n,t,i=e&&Oo(r);return{c(){i&&i.c(),n=ce()},m(o,s){i&&i.m(o,s),w(o,n,s),t=!0},p(o,s){s&8&&(e=Object.keys(o[3].schemes).length>1),e?i?(i.p(o,s),s&8&&b(i,1)):(i=Oo(o),i.c(),b(i,1),i.m(n.parentNode,n)):i&&(se(),y(i,1,1,()=>{i=null}),le())},i(o){t||(b(i),t=!0)},o(o){y(i),t=!1},d(o){o&&k(n),i&&i.d(o)}}}function Io(r,e){let n,t,i,o,s;return t=new pg({props:{cfg:e[0],gjSchemes:e[1],scheme_reference:e[9],$$slots:{default:[hg]},$$scope:{ctx:e}}}),{key:r,first:null,c(){n=ce(),M(t.$$.fragment),i=N(),o=D("hr"),this.first=n},m(a,l){w(a,n,l),P(t,a,l),w(a,i,l),w(a,o,l),s=!0},p(a,l){e=a;const u={};l&1&&(u.cfg=e[0]),l&2&&(u.gjSchemes=e[1]),l&8&&(u.scheme_reference=e[9]),l&4104&&(u.$$scope={dirty:l,ctx:e}),t.$set(u)},i(a){s||(b(t.$$.fragment,a),s=!0)},o(a){y(t.$$.fragment,a),s=!1},d(a){a&&(k(n),k(i),k(o)),L(t,a)}}}function _g(r){let e,n,t,i,o,s,a,l,u=[],f=new Map,c,p;e=new ge({props:{$$slots:{default:[mg]},$$scope:{ctx:r}}}),e.$on("click",r[4]),t=new Yo({props:{label:"Add scheme from file",onLoad:r[5]}}),o=new Ye({props:{errorMessage:r[2]}});let m=Ie(Object.keys(r[3].schemes));const h=v=>v[9];for(let v=0;v{n[t]=e[t]}),n}function $g(r,e,n){let t,i=Q,o=()=>(i(),i=We(a,h=>n(3,t=h)),a);r.$$.on_destroy.push(()=>i());let{cfg:s}=e,{gjSchemes:a}=e;o();function l(){wl(s,t),a.set(t)}let u="";function f(h,v){try{let $=s.backfill(JSON.parse(v));for(let g of Object.values($.schemes)){if(g.scheme_reference in t.schemes)throw new Error("The file you're loading seems to contain duplicate data. Are you merging in the same file accidentally?");Be(a,t.schemes[g.scheme_reference]=g,t)}Be(a,t.features=t.features.concat($.features),t);let C=1;t.features.forEach(g=>{g.id=C++}),a.set(t),n(2,u="")}catch($){n(2,u=`Couldn't load scheme from a file: ${$}`)}}function c(h,v){const $=JSON.parse(JSON.stringify(Object.keys(t.schemes))),C=$.indexOf(h);if(C+v>=0&&C+v<$.length){bg($,C,C+v);const g=vg($,t.schemes);Be(a,t.schemes=g,t),a.set(t)}}const p=h=>c(h,-1),m=h=>c(h,1);return r.$$set=h=>{"cfg"in h&&n(0,s=h.cfg),"gjSchemes"in h&&o(n(1,a=h.gjSchemes))},[s,a,u,t,l,f,c,p,m]}class yg extends re{constructor(e){super(),ie(this,e,$g,_g,te,{cfg:0,gjSchemes:1})}}function jo(r){let e,n,t,i,o,s,a,l,u,f,c,p,m,h,v,$,C,g;return e=new Sl({}),i=new El({}),v=new Tl({props:{boundaryGeojson:r[2]}}),C=new Ke({props:{$$slots:{default:[Sg]},$$scope:{ctx:r}}}),{c(){M(e.$$.fragment),n=N(),t=D("div"),M(i.$$.fragment),o=N(),s=D("p"),s.textContent=`App version: ${Ml()}`,a=N(),l=D("div"),u=D("p"),u.textContent=`${r[12]()}`,f=N(),c=D("a"),p=q("Change area"),h=N(),M(v.$$.fragment),$=N(),M(C.$$.fragment),z(s,"class","svelte-1750ds5"),Fe(t,"border-bottom","1px solid #b1b4b6"),z(t,"class","svelte-1750ds5"),z(u,"class","svelte-1750ds5"),z(c,"href",m=`index.html?schema=${r[4]}`),z(c,"class","svelte-1750ds5"),Fe(l,"display","flex"),Fe(l,"justify-content","space-between"),z(l,"class","svelte-1750ds5")},m(_,E){P(e,_,E),w(_,n,E),w(_,t,E),P(i,t,null),U(t,o),U(t,s),w(_,a,E),w(_,l,E),U(l,u),U(l,f),U(l,c),U(c,p),U(l,h),P(v,l,null),w(_,$,E),P(C,_,E),g=!0},p(_,E){(!g||E&16&&m!==(m=`index.html?schema=${_[4]}`))&&z(c,"href",m);const d={};E&4&&(d.boundaryGeojson=_[2]),v.$set(d);const S={};E&262144&&(S.$$scope={dirty:E,ctx:_}),C.$set(S)},i(_){g||(b(e.$$.fragment,_),b(i.$$.fragment,_),b(v.$$.fragment,_),b(C.$$.fragment,_),g=!0)},o(_){y(e.$$.fragment,_),y(i.$$.fragment,_),y(v.$$.fragment,_),y(C.$$.fragment,_),g=!1},d(_){_&&(k(n),k(t),k(a),k(l),k($)),L(e,_),L(i),L(v),L(C,_)}}}function wg(r){let e;return{c(){e=q("About")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function kg(r){let e;return{c(){e=q("Instructions")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Sg(r){let e,n,t,i;return e=new ge({props:{$$slots:{default:[wg]},$$scope:{ctx:r}}}),e.$on("click",r[10]),t=new ge({props:{$$slots:{default:[kg]},$$scope:{ctx:r}}}),t.$on("click",r[11]),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment)},m(o,s){P(e,o,s),w(o,n,s),P(t,o,s),i=!0},p(o,s){const a={};s&262144&&(a.$$scope={dirty:s,ctx:o}),e.$set(a);const l={};s&262144&&(l.$$scope={dirty:s,ctx:o}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),L(e,o),L(t,o)}}}function Eg(r){let e,n;return e=new eg({props:{cfg:Te,gjSchemes:r[7],id:r[3].id}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p(t,i){const o={};i&8&&(o.id=t[3].id),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Mg(r){let e,n;return e=new yg({props:{cfg:Te,gjSchemes:r[7]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Bo(r){let e;return{c(){e=D("hr"),z(e,"class","svelte-1750ds5")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function qo(r){let e,n,t,i,o,s,a,l,u,f,c,p,m;e=new Qu({props:{cfg:Te,boundaryGeojson:r[2]}}),t=new hc({props:{cfg:Te,gjSchemes:r[7]}}),o=new tc({props:{cfg:Te}}),a=new vm({props:{cfg:Te,gjSchemes:r[7],routeSnapperUrl:r[9]}});let h=r[3].mode=="split-route"&&Go(r);return f=new Mc({props:{cfg:Te}}),p=new $c({props:{cfg:Te}}),{c(){M(e.$$.fragment),n=N(),M(t.$$.fragment),i=N(),M(o.$$.fragment),s=N(),M(a.$$.fragment),l=N(),h&&h.c(),u=N(),M(f.$$.fragment),c=N(),M(p.$$.fragment)},m(v,$){P(e,v,$),w(v,n,$),P(t,v,$),w(v,i,$),P(o,v,$),w(v,s,$),P(a,v,$),w(v,l,$),h&&h.m(v,$),w(v,u,$),P(f,v,$),w(v,c,$),P(p,v,$),m=!0},p(v,$){const C={};$&4&&(C.boundaryGeojson=v[2]),e.$set(C),v[3].mode=="split-route"?h?(h.p(v,$),$&8&&b(h,1)):(h=Go(v),h.c(),b(h,1),h.m(u.parentNode,u)):h&&(se(),y(h,1,1,()=>{h=null}),le())},i(v){m||(b(e.$$.fragment,v),b(t.$$.fragment,v),b(o.$$.fragment,v),b(a.$$.fragment,v),b(h),b(f.$$.fragment,v),b(p.$$.fragment,v),m=!0)},o(v){y(e.$$.fragment,v),y(t.$$.fragment,v),y(o.$$.fragment,v),y(a.$$.fragment,v),y(h),y(f.$$.fragment,v),y(p.$$.fragment,v),m=!1},d(v){v&&(k(n),k(i),k(s),k(l),k(u),k(c)),L(e,v),L(t,v),L(o,v),L(a,v),h&&h.d(v),L(f,v),L(p,v)}}}function Go(r){let e,n;return e=new gp({props:{cfg:Te,gjSchemes:r[7]}}),{c(){M(e.$$.fragment)},m(t,i){P(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Pg(r){let e,n,t,i;e=new Ul({props:{position:"top-right"}});let o=r[6]&&qo(r);return{c(){M(e.$$.fragment),n=N(),o&&o.c(),t=ce()},m(s,a){P(e,s,a),w(s,n,a),o&&o.m(s,a),w(s,t,a),i=!0},p(s,a){s[6]?o?(o.p(s,a),a&64&&b(o,1)):(o=qo(s),o.c(),b(o,1),o.m(t.parentNode,t)):o&&(se(),y(o,1,1,()=>{o=null}),le())},i(s){i||(b(e.$$.fragment,s),b(o),i=!0)},o(s){y(e.$$.fragment,s),y(o),i=!1},d(s){s&&(k(n),k(t)),L(e,s),o&&o.d(s)}}}function Lg(r){let e,n,t,i,o,s,a,l,u,f,c,p,m,h,v,$,C,g,_,E,d,S;t=new ql({});let R=r[3].mode=="list"&&jo(r);s=new zd({props:{cfg:Te,gjSchemes:r[7],authorityName:r[8]}});const j=[Mg,Eg],T=[];function B(J,x){return J[3].mode=="list"?0:J[3].mode=="edit-form"?1:-1}~(l=B(r))&&(u=T[l]=j[l](r));let O=r[3].mode!="list"&&Bo();p=new Gl({}),v=new kl({props:{style:r[5],$$slots:{default:[Pg]},$$scope:{ctx:r}}});function A(J){r[14](J)}let F={};r[0]!==void 0&&(F.open=r[0]),C=new Dl({props:F}),V.push(()=>ee(C,"open",A));function I(J){r[15](J)}let X={};return r[1]!==void 0&&(X.open=r[1]),E=new Wd({props:X}),V.push(()=>ee(E,"open",I)),{c(){e=D("div"),n=D("div"),M(t.$$.fragment),i=N(),R&&R.c(),o=N(),M(s.$$.fragment),a=N(),u&&u.c(),f=N(),O&&O.c(),c=N(),M(p.$$.fragment),m=N(),h=D("div"),M(v.$$.fragment),$=N(),M(C.$$.fragment),_=N(),M(E.$$.fragment),z(n,"class","sidebar govuk-prose svelte-1750ds5"),z(h,"class","main svelte-1750ds5"),z(e,"class","overall-layout svelte-1750ds5")},m(J,x){w(J,e,x),U(e,n),P(t,n,null),U(n,i),R&&R.m(n,null),U(n,o),P(s,n,null),U(n,a),~l&&T[l].m(n,null),U(n,f),O&&O.m(n,null),U(n,c),P(p,n,null),U(e,m),U(e,h),P(v,h,null),w(J,$,x),P(C,J,x),w(J,_,x),P(E,J,x),S=!0},p(J,[x]){J[3].mode=="list"?R?(R.p(J,x),x&8&&b(R,1)):(R=jo(J),R.c(),b(R,1),R.m(n,o)):R&&(se(),y(R,1,1,()=>{R=null}),le());let G=l;l=B(J),l===G?~l&&T[l].p(J,x):(u&&(se(),y(T[G],1,1,()=>{T[G]=null}),le()),~l?(u=T[l],u?u.p(J,x):(u=T[l]=j[l](J),u.c()),b(u,1),u.m(n,f)):u=null),J[3].mode!="list"?O||(O=Bo(),O.c(),O.m(n,c)):O&&(O.d(1),O=null);const fe={};x&32&&(fe.style=J[5]),x&262220&&(fe.$$scope={dirty:x,ctx:J}),v.$set(fe);const me={};!g&&x&1&&(g=!0,me.open=J[0],ne(()=>g=!1)),C.$set(me);const be={};!d&&x&2&&(d=!0,be.open=J[1],ne(()=>d=!1)),E.$set(be)},i(J){S||(b(t.$$.fragment,J),b(R),b(s.$$.fragment,J),b(u),b(p.$$.fragment,J),b(v.$$.fragment,J),b(C.$$.fragment,J),b(E.$$.fragment,J),S=!0)},o(J){y(t.$$.fragment,J),y(R),y(s.$$.fragment,J),y(u),y(p.$$.fragment,J),y(v.$$.fragment,J),y(C.$$.fragment,J),y(E.$$.fragment,J),S=!1},d(J){J&&(k(e),k($),k(_)),L(t),R&&R.d(),L(s),~l&&T[l].d(),O&&O.d(),L(p),L(v),L(C,J),L(E,J)}}}function Cg(r,e,n){let t,i,o,s,a;H(r,Cl,d=>n(13,t=d)),H(r,ue,d=>n(3,i=d)),H(r,xe,d=>n(4,o=d)),H(r,gr,d=>n(5,s=d)),H(r,Je,d=>n(6,a=d));let l=at(Gr(Te)),u=!1,f=!1,c=new URLSearchParams(window.location.search),p=c.get("authority");gr.set(c.get("style")||"streets");let m=`https://atip.uk/route-snappers/v3/${p}.bin.gz`;function h(){n(0,u=!u),n(1,f=!1)}function v(){n(1,f=!f),n(0,u=!1)}let $;it(async()=>{Pl(),n(2,$=await C())});async function C(){let d=await Ll();return d.features=d.features.filter(S=>S.properties.full_name==p),d.features.length===0&&(window.location.href=`index.html?error=Authority name not found: ${p}`),d}function g(){let d=p.split("_");if(d.length==2){if(d[0]=="LAD")return`${d[1]} (LAD)`;if(d[0]=="TA")return`${d[1]} (Transport Authority)`}return p}function _(d){u=d,n(0,u)}function E(d){f=d,n(1,f)}return r.$$.update=()=>{r.$$.dirty&8192&&t&&Je.set(t)},[u,f,$,i,o,s,a,l,p,m,h,v,g,t,_,E]}class Ag extends re{constructor(e){super(),ie(this,e,Cg,Lg,te,{})}}document.body.className+=" js-enabled"+("noModule"in HTMLScriptElement.prototype?" govuk-frontend-supported":"");new Ag({target:document.getElementById("app")}); diff --git a/move_draw_controls/assets/nested-a50f2b6d.js b/move_draw_controls/assets/nested-a50f2b6d.js deleted file mode 100644 index fa6ac09f..00000000 --- a/move_draw_controls/assets/nested-a50f2b6d.js +++ /dev/null @@ -1,80 +0,0 @@ -var Vs=Object.defineProperty;var Qs=(r,e,n)=>e in r?Vs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n;var de=(r,e,n)=>(Qs(r,typeof e!="symbol"?e+"":e,n),n);import{S as ne,i as re,s as x,Q as at,e as D,b as z,c as w,T as ut,U as ft,V as ct,t as b,q as y,d as k,f as ge,j as P,p as L,v as C,W as jr,X as Ot,Y as It,E as Ye,a as N,Z as Pe,_ as $e,y as q,o as U,P as he,$ as xn,a0 as ve,a1 as xr,a2 as ke,a3 as ei,a4 as To,a5 as xs,a6 as Uo,a7 as el,a8 as tl,a9 as pt,aa as ce,z as se,r as le,ab as Do,ac as nl,w as H,ad as Xe,ae as rl,af as Be,ag as il,ah as ol,n as Q,J as mn,ai as sl,aj as ll,ak as al,al as ul,am as Ie,an as Br,ao as qr,ap as fl,aq as cl,ar as pl,G as At,as as ml,at as Se,au as yt,g as V,h as te,u as ie,av as Ft,aw as un,D as mt,ax as er,ay as rt,R as Nt,m as Oe,az as Rn,x as it,aA as ue,aB as tn,aC as nn,aD as Pt,N as zt,aE as On,aF as We,aG as rn,aH as Gr,aI as ti,aJ as Ue,aK as dr,aL as dl,aM as gl,aN as Ge,aO as In,aP as ni,aQ as ht,aR as zo,aS as hl,aT as dn,aU as ri,aV as _l,aW as tr,aX as ot,O as xe,aY as Ct,aZ as gr,a_ as bl,a$ as $l,I as vl,F as Jo,b0 as Tr,b1 as jn,b2 as ii,b3 as yl,M as wl,A as kl,L as Sl,k as El,B as Ml,C as Pl,b4 as Ll}from"./index-7b4eed78.js";import{M as hr,m as Je,b as Yo,l as ae,e as Jt,C as Xo,a as Rt,R as Cl,i as Lt,c as fn,d as cn,f as Yt,g as Al,h as Zt,S as Fl,j as Nl,k as nr,p as Bn,n as Rl,o as Ol,t as Il,r as oi,W as Wo,q as jl,H as Bl,B as ql,Z as Gl,G as Tl}from"./ZoomOutMap-aaf9f888.js";import{A as Ul}from"./About-3be1e6da.js";function Dl(r){let e,n;const t=r[1].default,i=at(t,r,r[0],null);return{c(){e=D("div"),i&&i.c(),z(e,"class","govuk-button-group")},m(o,s){w(o,e,s),i&&i.m(e,null),n=!0},p(o,[s]){i&&i.p&&(!n||s&1)&&ut(i,t,o,o[0],n?ct(t,o[0],s,null):ft(o[0]),null)},i(o){n||(b(i,o),n=!0)},o(o){y(i,o),n=!1},d(o){o&&k(e),i&&i.d(o)}}}function zl(r,e,n){let{$$slots:t={},$$scope:i}=e;return r.$$set=o=>{"$$scope"in o&&n(0,i=o.$$scope)},[i,t]}class Ke extends ne{constructor(e){super(),re(this,e,zl,Dl,x,{})}}function Jl(r){let e;const n=r[1].default,t=at(n,r,r[3],null);return{c(){t&&t.c()},m(i,o){t&&t.m(i,o),e=!0},p(i,o){t&&t.p&&(!e||o&8)&&ut(t,n,i,i[3],e?ct(n,i[3],o,null):ft(i[3]),null)},i(i){e||(b(t,i),e=!0)},o(i){y(t,i),e=!1},d(i){t&&t.d(i)}}}function Yl(r){let e,n;return e=new ge({props:{style:"margin-bottom: 0px",disabled:r[0],$$slots:{default:[Jl]},$$scope:{ctx:r}}}),e.$on("click",r[2]),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,[i]){const o={};i&1&&(o.disabled=t[0]),i&8&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Xl(r,e,n){let{$$slots:t={},$$scope:i}=e,{disabled:o=!1}=e;function s(a){jr.call(this,r,a)}return r.$$set=a=>{"disabled"in a&&n(0,o=a.disabled),"$$scope"in a&&n(3,i=a.$$scope)},[o,t,s,i]}class Wl extends ne{constructor(e){super(),re(this,e,Xl,Yl,x,{disabled:0})}}function si(r){let e,n,t=qn(r[0])+"",i;return{c(){e=D("div"),n=q("£"),i=q(t),z(e,"class","govuk-hint")},m(o,s){w(o,e,s),U(e,n),U(e,i)},p(o,s){s&1&&t!==(t=qn(o[0])+"")&&he(i,t)},d(o){o&&k(e)}}}function Kl(r){let e;return{c(){e=q("multiply by 1 million")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Hl(r){let e,n,t,i,o,s,a,l,u;e=new Ye({props:{errorMessage:li(r[2])}});let f=r[0]!=null&&si(r);return s=new ge({props:{disabled:r[0]==null||r[0]>1e3,$$slots:{default:[Kl]},$$scope:{ctx:r}}}),s.$on("click",r[4]),{c(){P(e.$$.fragment),n=N(),f&&f.c(),t=N(),i=D("input"),o=N(),P(s.$$.fragment),z(i,"type","text"),z(i,"inputmode","numeric"),z(i,"class","govuk-input govuk-input--width-10"),z(i,"id",r[3])},m(c,p){L(e,c,p),w(c,n,p),f&&f.m(c,p),w(c,t,p),w(c,i,p),Pe(i,r[2]),w(c,o,p),L(s,c,p),a=!0,l||(u=$e(i,"input",r[5]),l=!0)},p(c,p){const m={};p&4&&(m.errorMessage=li(c[2])),e.$set(m),c[0]!=null?f?f.p(c,p):(f=si(c),f.c(),f.m(t.parentNode,t)):f&&(f.d(1),f=null),p&4&&i.value!==c[2]&&Pe(i,c[2]);const h={};p&1&&(h.disabled=c[0]==null||c[0]>1e3),p&128&&(h.$$scope={dirty:p,ctx:c}),s.$set(h)},i(c){a||(b(e.$$.fragment,c),b(s.$$.fragment,c),a=!0)},o(c){y(e.$$.fragment,c),y(s.$$.fragment,c),a=!1},d(c){c&&(k(n),k(t),k(i),k(o)),C(e,c),f&&f.d(c),C(s,c),l=!1,u()}}}function Zl(r){let e,n;return e=new Ot({props:{label:r[1],id:r[3],$$slots:{default:[Hl]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,[i]){const o={};i&2&&(o.label=t[1]),i&133&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Ko(r){if(r!="")return parseFloat(r.replaceAll(",",""))}function li(r){let e=Ko(r);return e==null?"":isNaN(e)?"Please enter a valid number":e<0?"Please enter a positive number":""}function qn(r){return r.toLocaleString()}function Vl(r,e,n){let{label:t}=e,{value:i}=e,o=It(),s=i==null?"":qn(i);function a(f){n(0,i=Ko(f))}function l(){n(2,s=qn(i*1e6))}function u(){s=this.value,n(2,s)}return r.$$set=f=>{"label"in f&&n(1,t=f.label),"value"in f&&n(0,i=f.value)},r.$$.update=()=>{r.$$.dirty&4&&a(s)},[i,t,s,o,l,u]}class Ql extends ne{constructor(e){super(),re(this,e,Vl,Zl,x,{label:1,value:0})}}function xl(r){let e,n,t,i,o,s,a;return e=new Ye({props:{errorMessage:r[5](r[2])}}),{c(){P(e.$$.fragment),n=N(),t=D("input"),z(t,"type","text"),z(t,"inputmode","numeric"),z(t,"class",i=`govuk-input govuk-input--width-${r[1]}`),z(t,"id",r[3])},m(l,u){L(e,l,u),w(l,n,u),w(l,t,u),Pe(t,r[2]),o=!0,s||(a=[$e(t,"input",r[9]),$e(t,"change",r[4])],s=!0)},p(l,u){const f={};u&4&&(f.errorMessage=l[5](l[2])),e.$set(f),(!o||u&2&&i!==(i=`govuk-input govuk-input--width-${l[1]}`))&&z(t,"class",i),u&4&&t.value!==l[2]&&Pe(t,l[2])},i(l){o||(b(e.$$.fragment,l),o=!0)},o(l){y(e.$$.fragment,l),o=!1},d(l){l&&(k(n),k(t)),C(e,l),s=!1,xn(a)}}}function ea(r){let e,n;return e=new Ot({props:{label:r[0],id:r[3],$$slots:{default:[xl]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,[i]){const o={};i&1&&(o.label=t[0]),i&1030&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function ta(r,e,n){let{label:t}=e,{value:i}=e,{width:o}=e,{min:s=void 0}=e,{max:a=void 0}=e,l=i==null?void 0:i.toString(),u=It();function f(){n(6,i=l==null?void 0:parseInt(l,10))}function c(m){if(m==""||m==null)return"";if(m.includes("."))return"Please enter a number without decimals";let h=Number(m);return isNaN(h)?"Please enter a valid number":s!=null&&ha?`Please enter a number that's at most ${a};`:""}function p(){l=this.value,n(2,l)}return r.$$set=m=>{"label"in m&&n(0,t=m.label),"value"in m&&n(6,i=m.value),"width"in m&&n(1,o=m.width),"min"in m&&n(7,s=m.min),"max"in m&&n(8,a=m.max)},[t,o,l,u,f,c,i,s,a,p]}class or extends ne{constructor(e){super(),re(this,e,ta,ea,x,{label:0,value:6,width:1,min:7,max:8})}}function ai(r){let e,n;return{c(){e=D("div"),n=q(r[2]),z(e,"class","govuk-hint")},m(t,i){w(t,e,i),U(e,n)},p(t,i){i&4&&he(n,t[2])},d(t){t&&k(e)}}}function na(r){let e,n,t,i,o,s,a;e=new Ye({props:{errorMessage:r[4]}});let l=r[2]&&ai(r);return{c(){P(e.$$.fragment),n=N(),l&&l.c(),t=N(),i=D("textarea"),z(i,"class","govuk-textarea"),z(i,"id",r[5]),z(i,"rows",r[3])},m(u,f){L(e,u,f),w(u,n,f),l&&l.m(u,f),w(u,t,f),w(u,i,f),Pe(i,r[0]),o=!0,s||(a=$e(i,"input",r[6]),s=!0)},p(u,f){const c={};f&16&&(c.errorMessage=u[4]),e.$set(c),u[2]?l?l.p(u,f):(l=ai(u),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null),(!o||f&8)&&z(i,"rows",u[3]),f&1&&Pe(i,u[0])},i(u){o||(b(e.$$.fragment,u),o=!0)},o(u){y(e.$$.fragment,u),o=!1},d(u){u&&(k(n),k(t),k(i)),C(e,u),l&&l.d(u),s=!1,a()}}}function ra(r){let e,n;return e=new Ot({props:{label:r[1],id:r[5],$$slots:{default:[na]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,[i]){const o={};i&2&&(o.label=t[1]),i&157&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function ia(r,e,n){let{label:t}=e,{hint:i=""}=e,{value:o}=e,{rows:s=5}=e,{errorMessage:a=""}=e,l=It();function u(){o=this.value,n(0,o)}return r.$$set=f=>{"label"in f&&n(1,t=f.label),"hint"in f&&n(2,i=f.hint),"value"in f&&n(0,o=f.value),"rows"in f&&n(3,s=f.rows),"errorMessage"in f&&n(4,a=f.errorMessage)},[o,t,i,s,a,l,u]}class Ur extends ne{constructor(e){super(),re(this,e,ia,ra,x,{label:1,hint:2,value:0,rows:3,errorMessage:4})}}function oa(r){let e,n,t,i,o,s;return e=new Ye({props:{errorMessage:r[2]}}),{c(){P(e.$$.fragment),n=N(),t=D("input"),z(t,"type","text"),z(t,"class","govuk-input"),z(t,"id",r[3])},m(a,l){L(e,a,l),w(a,n,l),w(a,t,l),Pe(t,r[0]),i=!0,o||(s=[$e(t,"input",r[6]),$e(t,"change",r[5])],o=!0)},p(a,l){const u={};l&4&&(u.errorMessage=a[2]),e.$set(u),l&1&&t.value!==a[0]&&Pe(t,a[0])},i(a){i||(b(e.$$.fragment,a),i=!0)},o(a){y(e.$$.fragment,a),i=!1},d(a){a&&(k(n),k(t)),C(e,a),o=!1,xn(s)}}}function sa(r){let e,n;return e=new Ot({props:{label:r[1],id:r[3],$$slots:{default:[oa]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,[i]){const o={};i&2&&(o.label=t[1]),i&133&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function la(r,e,n){let t,{label:i}=e,{value:o}=e,{required:s=!1}=e,a=It();function l(f){jr.call(this,r,f)}function u(){o=this.value,n(0,o)}return r.$$set=f=>{"label"in f&&n(1,i=f.label),"value"in f&&n(0,o=f.value),"required"in f&&n(4,s=f.required)},r.$$.update=()=>{r.$$.dirty&17&&n(2,t=s&&(o==null||o=="")?"Required":"")},[o,i,t,a,s,l,u]}class rr extends ne{constructor(e){super(),re(this,e,la,sa,x,{label:1,value:0,required:4})}}function aa(r){let e,n,t,i;const o=r[2].default,s=at(o,r,r[1],null);let a=[{type:"button"},{class:"govuk-button govuk-button--warning"},{"data-module":"govuk-button"},r[0]],l={};for(let u=0;u{n(0,e=ve(ve({},e),ei(s))),"$$scope"in s&&n(1,i=s.$$scope)},e=ei(e),[e,i,t,o]}class wt extends ne{constructor(e){super(),re(this,e,ua,aa,x,{})}}class fa{constructor(e){de(this,"map");de(this,"active");de(this,"eventListenersSuccess");de(this,"eventListenersFailure");de(this,"cursor");de(this,"onMouseMove",e=>{this.active&&(this.cursor={type:"Feature",properties:{},geometry:{type:"Point",coordinates:To(e.lngLat.toArray())}})});de(this,"onClick",()=>{if(this.active&&this.cursor){for(let e of this.eventListenersSuccess)e(this.cursor);this.stop()}});de(this,"onKeyDown",e=>{this.active&&e.key=="Escape"&&(e.stopPropagation(),this.cancel())});this.map=e,this.active=!1,this.eventListenersSuccess=[],this.eventListenersFailure=[],this.cursor=null,this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),document.removeEventListener("keydown",this.onKeyDown)}cancel(){for(let e of this.eventListenersFailure)e();this.stop()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersFailure=[]}start(){this.map.getCanvas().style.cursor="crosshair",this.active=!0}stop(){this.map.getCanvas().style.cursor="inherit",this.cursor=null,this.active=!1}}function ca(r){var e=r%(2*Math.PI);return e*180/Math.PI}function $n(r){var e=r%360;return e*Math.PI/180}function $t(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return r.geometry.coordinates;if(r.type==="Point")return r.coordinates}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return r;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Qe(r){if(Array.isArray(r))return r;if(r.type==="Feature"){if(r.geometry!==null)return r.geometry.coordinates}else if(r.coordinates)return r.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function _r(r,e){return r.type==="FeatureCollection"?"FeatureCollection":r.type==="GeometryCollection"?"GeometryCollection":r.type==="Feature"&&r.geometry!==null?r.geometry.type:r.type}function Ho(r,e,n){if(n===void 0&&(n={}),n.final===!0)return pa(r,e);var t=$t(r),i=$t(e),o=$n(t[0]),s=$n(i[0]),a=$n(t[1]),l=$n(i[1]),u=Math.sin(s-o)*Math.cos(l),f=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(s-o);return ca(Math.atan2(u,f))}function pa(r,e){var n=Ho(e,r);return n=(n+180)%360,n}var Ne=63710088e-1,ma={centimeters:Ne*100,centimetres:Ne*100,degrees:Ne/111325,feet:Ne*3.28084,inches:Ne*39.37,kilometers:Ne/1e3,kilometres:Ne/1e3,meters:Ne,metres:Ne,miles:Ne/1609.344,millimeters:Ne*1e3,millimetres:Ne*1e3,nauticalmiles:Ne/1852,radians:1,yards:Ne*1.0936};function da(r,e){e===void 0&&(e="kilometers");var n=ma[e];if(!n)throw new Error(e+" units is invalid");return r*n}function vn(r){var e=r%360;return e*Math.PI/180}function dt(r,e,n){n===void 0&&(n={});var t=$t(r),i=$t(e),o=vn(i[1]-t[1]),s=vn(i[0]-t[0]),a=vn(t[1]),l=vn(i[1]),u=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(l);return da(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),n.units)}var Re=63710088e-1,ga={centimeters:Re*100,centimetres:Re*100,degrees:Re/111325,feet:Re*3.28084,inches:Re*39.37,kilometers:Re/1e3,kilometres:Re/1e3,meters:Re,metres:Re,miles:Re/1609.344,millimeters:Re*1e3,millimetres:Re*1e3,nauticalmiles:Re/1852,radians:1,yards:Re*1.0936};function ha(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function _a(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!fi(r[0])||!fi(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return ha(t,e,n)}function ba(r,e){e===void 0&&(e="kilometers");var n=ga[e];if(!n)throw new Error(e+" units is invalid");return r/n}function ui(r){var e=r%(2*Math.PI);return e*180/Math.PI}function sr(r){var e=r%360;return e*Math.PI/180}function fi(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function ci(r,e,n,t){t===void 0&&(t={});var i=$t(r),o=sr(i[0]),s=sr(i[1]),a=sr(n),l=ba(e,t.units),u=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(a)),f=o+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(u)),c=ui(f),p=ui(u);return _a([c,p],t.properties)}function br(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function $a(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!mi(r[0])||!mi(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return br(t,e,n)}function pi(r,e){e===void 0&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=r,n}function mi(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function va(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function ya(r,e,n){if(n===void 0&&(n={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:r};return va(t,e,n)}function wa(r,e){e===void 0&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=r,n}function Gn(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function Gt(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!di(r[0])||!di(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return Gn(t,e,n)}function Dt(r,e,n){if(n===void 0&&(n={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:r};return Gn(t,e,n)}function di(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function Zo(r){return!!r&&r.constructor===Object}function jt(r,e,n){if(r!==null)for(var t,i,o,s,a,l,u,f=0,c=0,p,m=r.type,h=m==="FeatureCollection",$=m==="Feature",v=h?r.features.length:1,M=0;Ml||h>u||$>f){a=c,l=t,u=h,f=$,o=0;return}var v=Dt([a,c],n.properties);if(e(v,t,i,$,o)===!1)return!1;o++,a=c})===!1)return!1}}})}function es(r,e,n){var t=n,i=!1;return xo(r,function(o,s,a,l,u){i===!1&&n===void 0?t=o:t=e(t,o,s,a,l,u),i=!0}),t}function ts(r,e){if(!r)throw new Error("geojson is required");Bt(r,function(n,t,i){if(n.geometry!==null){var o=n.geometry.type,s=n.geometry.coordinates;switch(o){case"LineString":if(e(n,t,i,0,0)===!1)return!1;break;case"Polygon":for(var a=0;ai?n:i,u=t>o?t:o;return[s,a,l,u]}var zr={exports:{}},ns={exports:{}};(function(r,e){(function(n,t){r.exports=t()})(xs,function(){function n(g,_,E,d,S){(function R(j,T,B,O,A){for(;O>B;){if(O-B>600){var F=O-B+1,I=T-B+1,X=Math.log(F),J=.5*Math.exp(2*X/3),ee=.5*Math.sqrt(X*J*(F-J)/F)*(I-F/2<0?-1:1),G=Math.max(B,Math.floor(T-I*J/F+ee)),fe=Math.min(O,Math.floor(T+(F-I)*J/F+ee));R(j,T,G,fe,A)}var me=j[T],_e=B,be=O;for(t(j,B,T),A(j[O],me)>0&&t(j,B,O);_e0;)be--}A(j[B],me)===0?t(j,B,be):t(j,++be,O),be<=T&&(B=be+1),T<=be&&(O=be-1)}})(g,_,E||0,d||g.length-1,S||i)}function t(g,_,E){var d=g[_];g[_]=g[E],g[E]=d}function i(g,_){return g<_?-1:g>_?1:0}var o=function(g){g===void 0&&(g=9),this._maxEntries=Math.max(4,g),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(g,_,E){if(!E)return _.indexOf(g);for(var d=0;d<_.length;d++)if(E(g,_[d]))return d;return-1}function a(g,_){l(g,0,g.children.length,_,g)}function l(g,_,E,d,S){S||(S=v(null)),S.minX=1/0,S.minY=1/0,S.maxX=-1/0,S.maxY=-1/0;for(var R=_;R=g.minX&&_.maxY>=g.minY}function v(g){return{children:g,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function M(g,_,E,d,S){for(var R=[_,E];R.length;)if(!((E=R.pop())-(_=R.pop())<=d)){var j=_+Math.ceil((E-_)/d/2)*d;n(g,j,_,E,S),R.push(_,j,j,E)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(g){var _=this.data,E=[];if(!$(g,_))return E;for(var d=this.toBBox,S=[];_;){for(var R=0;R<_.children.length;R++){var j=_.children[R],T=_.leaf?d(j):j;$(g,T)&&(_.leaf?E.push(j):h(g,T)?this._all(j,E):S.push(j))}_=S.pop()}return E},o.prototype.collides=function(g){var _=this.data;if(!$(g,_))return!1;for(var E=[];_;){for(var d=0;d<_.children.length;d++){var S=_.children[d],R=_.leaf?this.toBBox(S):S;if($(g,R)){if(_.leaf||h(g,R))return!0;E.push(S)}}_=E.pop()}return!1},o.prototype.load=function(g){if(!g||!g.length)return this;if(g.length=0&&S[_].children.length>this._maxEntries;)this._split(S,_),_--;this._adjustParentBBoxes(d,S,_)},o.prototype._split=function(g,_){var E=g[_],d=E.children.length,S=this._minEntries;this._chooseSplitAxis(E,S,d);var R=this._chooseSplitIndex(E,S,d),j=v(E.children.splice(R,E.children.length-R));j.height=E.height,j.leaf=E.leaf,a(E,this.toBBox),a(j,this.toBBox),_?g[_-1].children.push(j):this._splitRoot(E,j)},o.prototype._splitRoot=function(g,_){this.data=v([g,_]),this.data.height=g.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(g,_,E){for(var d,S,R,j,T,B,O,A=1/0,F=1/0,I=_;I<=E-_;I++){var X=l(g,0,I,this.toBBox),J=l(g,I,E,this.toBBox),ee=(S=X,R=J,j=void 0,T=void 0,B=void 0,O=void 0,j=Math.max(S.minX,R.minX),T=Math.max(S.minY,R.minY),B=Math.min(S.maxX,R.maxX),O=Math.min(S.maxY,R.maxY),Math.max(0,B-j)*Math.max(0,O-T)),G=p(X)+p(J);ee=_;A--){var F=g.children[A];u(j,g.leaf?S(F):F),T+=m(j)}return T},o.prototype._adjustParentBBoxes=function(g,_,E){for(var d=E;d>=0;d--)u(_[d],g)},o.prototype._condense=function(g){for(var _=g.length-1,E=void 0;_>=0;_--)g[_].children.length===0?_>0?(E=g[_-1].children).splice(E.indexOf(g[_]),1):this.clear():a(g[_],this.toBBox)},o})})(ns);var Ia=ns.exports,rs={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.earthRadius=63710088e-1,r.factors={centimeters:r.earthRadius*100,centimetres:r.earthRadius*100,degrees:r.earthRadius/111325,feet:r.earthRadius*3.28084,inches:r.earthRadius*39.37,kilometers:r.earthRadius/1e3,kilometres:r.earthRadius/1e3,meters:r.earthRadius,metres:r.earthRadius,miles:r.earthRadius/1609.344,millimeters:r.earthRadius*1e3,millimetres:r.earthRadius*1e3,nauticalmiles:r.earthRadius/1852,radians:1,yards:r.earthRadius*1.0936},r.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/r.earthRadius,yards:1.0936133},r.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function e(O,A,F){F===void 0&&(F={});var I={type:"Feature"};return(F.id===0||F.id)&&(I.id=F.id),F.bbox&&(I.bbox=F.bbox),I.properties=A||{},I.geometry=O,I}r.feature=e;function n(O,A,F){switch(O){case"Point":return t(A).geometry;case"LineString":return a(A).geometry;case"Polygon":return o(A).geometry;case"MultiPoint":return c(A).geometry;case"MultiLineString":return f(A).geometry;case"MultiPolygon":return p(A).geometry;default:throw new Error(O+" is invalid")}}r.geometry=n;function t(O,A,F){if(F===void 0&&(F={}),!O)throw new Error("coordinates is required");if(!Array.isArray(O))throw new Error("coordinates must be an Array");if(O.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!R(O[0])||!R(O[1]))throw new Error("coordinates must contain numbers");var I={type:"Point",coordinates:O};return e(I,A,F)}r.point=t;function i(O,A,F){return F===void 0&&(F={}),u(O.map(function(I){return t(I,A)}),F)}r.points=i;function o(O,A,F){F===void 0&&(F={});for(var I=0,X=O;I=0))throw new Error("precision must be a positive number");var F=Math.pow(10,A||0);return Math.round(O*F)/F}r.round=h;function $(O,A){A===void 0&&(A="kilometers");var F=r.factors[A];if(!F)throw new Error(A+" units is invalid");return O*F}r.radiansToLength=$;function v(O,A){A===void 0&&(A="kilometers");var F=r.factors[A];if(!F)throw new Error(A+" units is invalid");return O/F}r.lengthToRadians=v;function M(O,A){return _(v(O,A))}r.lengthToDegrees=M;function g(O){var A=O%360;return A<0&&(A+=360),A}r.bearingToAzimuth=g;function _(O){var A=O%(2*Math.PI);return A*180/Math.PI}r.radiansToDegrees=_;function E(O){var A=O%360;return A*Math.PI/180}r.degreesToRadians=E;function d(O,A,F){if(A===void 0&&(A="kilometers"),F===void 0&&(F="kilometers"),!(O>=0))throw new Error("length must be a positive number");return $(v(O,A),F)}r.convertLength=d;function S(O,A,F){if(A===void 0&&(A="meters"),F===void 0&&(F="kilometers"),!(O>=0))throw new Error("area must be a positive number");var I=r.areaFactors[A];if(!I)throw new Error("invalid original units");var X=r.areaFactors[F];if(!X)throw new Error("invalid final units");return O/I*X}r.convertArea=S;function R(O){return!isNaN(O)&&O!==null&&!Array.isArray(O)}r.isNumber=R;function j(O){return!!O&&O.constructor===Object}r.isObject=j;function T(O){if(!O)throw new Error("bbox is required");if(!Array.isArray(O))throw new Error("bbox must be an Array");if(O.length!==4&&O.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");O.forEach(function(A){if(!R(A))throw new Error("bbox must only contain numbers")})}r.validateBBox=T;function B(O){if(!O)throw new Error("id is required");if(["string","number"].indexOf(typeof O)===-1)throw new Error("id must be a number or a string")}r.validateId=B})(rs);const ja=Uo(Fa),Ba=Uo(el);var He=Ia,is=rs,os=ja,Tt=Ba.default,qa=os.featureEach;os.coordEach;is.polygon;var gi=is.featureCollection;function ss(r){var e=new He(r);return e.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Tt(n),He.prototype.insert.call(this,n)},e.load=function(n){var t=[];return Array.isArray(n)?n.forEach(function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:Tt(i),t.push(i)}):qa(n,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:Tt(i),t.push(i)}),He.prototype.load.call(this,t)},e.remove=function(n,t){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Tt(n),He.prototype.remove.call(this,n,t)},e.clear=function(){return He.prototype.clear.call(this)},e.search=function(n){var t=He.prototype.search.call(this,this.toBBox(n));return gi(t)},e.collides=function(n){return He.prototype.collides.call(this,this.toBBox(n))},e.all=function(){var n=He.prototype.all.call(this);return gi(n)},e.toJSON=function(){return He.prototype.toJSON.call(this)},e.fromJSON=function(n){return He.prototype.fromJSON.call(this,n)},e.toBBox=function(n){var t;if(n.bbox)t=n.bbox;else if(Array.isArray(n)&&n.length===4)t=n;else if(Array.isArray(n)&&n.length===6)t=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")t=Tt(n);else if(n.type==="FeatureCollection")t=Tt(n);else throw new Error("invalid geojson");return{minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]}},e}zr.exports=ss;zr.exports.default=ss;var Ga=zr.exports;const Jr=tl(Ga);function ls(r,e){var n={},t=[];if(r.type==="LineString"&&(r=br(r)),e.type==="LineString"&&(e=br(e)),r.type==="Feature"&&e.type==="Feature"&&r.geometry!==null&&e.geometry!==null&&r.geometry.type==="LineString"&&e.geometry.type==="LineString"&&r.geometry.coordinates.length===2&&e.geometry.coordinates.length===2){var i=hi(r,e);return i&&t.push(i),pi(t)}var o=Jr();return o.load($r(e)),Xt($r(r),function(s){Xt(o.search(s),function(a){var l=hi(s,a);if(l){var u=Qe(l).join(",");n[u]||(n[u]=!0,t.push(l))}})}),pi(t)}function hi(r,e){var n=Qe(r),t=Qe(e);if(n.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(t.length!==2)throw new Error(" line2 must only contain 2 coordinates");var i=n[0][0],o=n[0][1],s=n[1][0],a=n[1][1],l=t[0][0],u=t[0][1],f=t[1][0],c=t[1][1],p=(c-u)*(s-i)-(f-l)*(a-o),m=(f-l)*(o-u)-(c-u)*(i-l),h=(s-i)*(o-u)-(a-o)*(i-l);if(p===0)return null;var $=m/p,v=h/p;if($>=0&&$<=1&&v>=0&&v<=1){var M=i+$*(s-i),g=o+$*(a-o);return $a([M,g])}return null}function as(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function lr(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!bi(r[0])||!bi(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return as(t,e,n)}function _i(r,e,n){if(n===void 0&&(n={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:r};return as(t,e,n)}function bi(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function Tn(r,e,n){n===void 0&&(n={});var t=lr([1/0,1/0],{dist:1/0}),i=0;return Bt(r,function(o){for(var s=Qe(o),a=0;a0&&(v=$.features[0],v.properties.dist=dt(e,v,n),v.properties.location=i+dt(l,v,n)),l.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(e);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let n=this.dragFrom[0]-e.lngLat.lng,t=this.dragFrom[1]-e.lngLat.lat;for(let i of this.points)i[0]-=n,i[1]-=t}else this.points[this.hover]=e.lngLat.toArray();this.dragFrom=e.lngLat.toArray(),this.redraw()}});de(this,"onClick",e=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if($i(this.points).forEach((t,i)=>{n.push([i+1,Tn(t,this.cursor).properties.dist])}),n.sort((t,i)=>t[1]-i[1]),n.length>0){let t=n[0][0];this.points.splice(t,0,this.cursor.geometry.coordinates),this.hover=t}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(e))});de(this,"onDoubleClick",e=>{this.active&&(e.preventDefault(),this.cursor=ar(e.lngLat.toArray()),this.onClick(e),this.finish())});de(this,"onMouseDown",e=>{this.active&&!this.dragFrom&&this.hover!=null&&(e.preventDefault(),this.cursor=null,this.dragFrom=e.lngLat.toArray(),this.beforeUpdate(),this.redraw())});de(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});de(this,"onKeypress",e=>{this.active&&(e.key=="Enter"?(e.stopPropagation(),this.finish()):e.key=="z"&&e.ctrlKey&&this.undo())});de(this,"onKeyDown",e=>{this.active&&e.key=="Escape"&&(e.stopPropagation(),this.cancel())});this.map=e,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let e=this.polygonFeature();if(e)for(let n of this.eventListenersSuccess)n(e);else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){for(let e of this.eventListenersFailure)e();this.stop()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(e){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(e.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let e=us();this.points.forEach((i,o)=>{let s=ar(i);s.properties.hover=this.hover==o,s.properties.idx=o,e.features.push(s)}),e.features=e.features.concat($i(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",e.features.push(n)),cs.set(e);let t="crosshair";this.hover!=null&&(t=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=t,ps.set(this.previousStates.length)}pointsUpdated(){let e=this.polygonFeature();if(e)for(let n of this.eventListenersUpdated)n(e)}recalculateHovering(e){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(e.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(n.geometry.type=="Polygon"){this.hover="polygon";break}else if(n.geometry.type=="Point"&&Object.hasOwn(n.properties,"idx")){this.hover=n.properties.idx;break}this.hover==null&&(this.cursor=ar(e.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let e=this.points.map(fs),n=[JSON.parse(JSON.stringify(e))];return n[0].push(JSON.parse(JSON.stringify(n[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:n},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>Ta&&this.previousStates.shift()}}function $i(r){let e=[];for(let n=0;n=3&&e.push({type:"Feature",geometry:{type:"LineString",coordinates:[r[r.length-1],r[0]]},properties:{}}),e}class ur{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const n=this._partials;let t=0;for(let i=0;i0){for(s=e[--n];n>0&&(t=s,i=e[--n],s=t+i,o=i-(s-t),!o););n>0&&(o<0&&e[n-1]<0||o>0&&e[n-1]>0)&&(i=o*2,t=s+i,i==t-s&&(s=t))}return s}}var Da=1e-6,vi=1e-12,Yr=Math.PI,yi=Yr/2,wi=180/Yr,et=Yr/180,ms=Math.atan2,tt=Math.cos,vr=Math.hypot,nt=Math.sin,za=Math.sqrt;function ds(r){return r>1?yi:r<-1?-yi:Math.asin(r)}function Ja(){}function Un(r,e){r&&Si.hasOwnProperty(r.type)&&Si[r.type](r,e)}var ki={Feature:function(r,e){Un(r.geometry,e)},FeatureCollection:function(r,e){for(var n=r.features,t=-1,i=n.length;++t{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&bs.decode();let Qt=null;function on(){return(Qt===null||Qt.byteLength===0)&&(Qt=new Uint8Array(K.memory.buffer)),Qt}function Ve(r,e){return r=r>>>0,bs.decode(on().subarray(r,r+e))}const lt=new Array(128).fill(void 0);lt.push(void 0,null,!0,!1);let sn=lt.length;function ye(r){sn===lt.length&<.push(lt.length+1);const e=sn;return sn=lt[e],lt[e]=r,e}function oe(r){return lt[r]}function Qa(r){r<132||(lt[r]=sn,sn=r)}function Mn(r){const e=oe(r);return Qa(r),e}function fr(r){return r==null}let xt=null;function xa(){return(xt===null||xt.byteLength===0)&&(xt=new Float64Array(K.memory.buffer)),xt}let en=null;function pe(){return(en===null||en.byteLength===0)&&(en=new Int32Array(K.memory.buffer)),en}let _t=0;const Pn=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},eu=typeof Pn.encodeInto=="function"?function(r,e){return Pn.encodeInto(r,e)}:function(r,e){const n=Pn.encode(r);return e.set(n),{read:r.length,written:n.length}};function yn(r,e,n){if(n===void 0){const a=Pn.encode(r),l=e(a.length,1)>>>0;return on().subarray(l,l+a.length).set(a),_t=a.length,l}let t=r.length,i=e(t,1)>>>0;const o=on();let s=0;for(;s127)break;o[i+s]=a}if(s!==t){s!==0&&(r=r.slice(s)),i=n(i,t,t=s+r.length*3,1)>>>0;const a=on().subarray(i+s,i+t),l=eu(r,a);s+=l.written}return _t=s,i}function Er(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const i=r.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){const i=r.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(r)){const i=r.length;let o="[";i>0&&(o+=Er(r[0]));for(let s=1;s1)t=n[1];else return toString.call(r);if(t=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message} -${r.stack}`:t}function tu(r,e){const n=e(r.length*1,1)>>>0;return on().set(r,n/1),_t=r.length,n}function cr(r,e){try{return r.apply(this,e)}catch(n){K.__wbindgen_exn_store(ye(n))}}class Hn{static __wrap(e){e=e>>>0;const n=Object.create(Hn.prototype);return n.__wbg_ptr=e,n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();K.__wbg_jsroutesnapper_free(e)}constructor(e){try{const o=K.__wbindgen_add_to_stack_pointer(-16),s=tu(e,K.__wbindgen_malloc),a=_t;K.jsroutesnapper_new(o,s,a);var n=pe()[o/4+0],t=pe()[o/4+1],i=pe()[o/4+2];if(i)throw Mn(t);return Hn.__wrap(n)}finally{K.__wbindgen_add_to_stack_pointer(16)}}setRouteConfig(e){K.jsroutesnapper_setRouteConfig(this.__wbg_ptr,ye(e))}setAreaMode(){K.jsroutesnapper_setAreaMode(this.__wbg_ptr)}getConfig(){let e,n;try{const o=K.__wbindgen_add_to_stack_pointer(-16);K.jsroutesnapper_getConfig(o,this.__wbg_ptr);var t=pe()[o/4+0],i=pe()[o/4+1];return e=t,n=i,Ve(t,i)}finally{K.__wbindgen_add_to_stack_pointer(16),K.__wbindgen_free(e,n,1)}}toFinalFeature(){try{const t=K.__wbindgen_add_to_stack_pointer(-16);K.jsroutesnapper_toFinalFeature(t,this.__wbg_ptr);var e=pe()[t/4+0],n=pe()[t/4+1];let i;return e!==0&&(i=Ve(e,n).slice(),K.__wbindgen_free(e,n*1)),i}finally{K.__wbindgen_add_to_stack_pointer(16)}}renderGeojson(){let e,n;try{const o=K.__wbindgen_add_to_stack_pointer(-16);K.jsroutesnapper_renderGeojson(o,this.__wbg_ptr);var t=pe()[o/4+0],i=pe()[o/4+1];return e=t,n=i,Ve(t,i)}finally{K.__wbindgen_add_to_stack_pointer(16),K.__wbindgen_free(e,n,1)}}toggleSnapMode(){K.jsroutesnapper_toggleSnapMode(this.__wbg_ptr)}onMouseMove(e,n,t){return K.jsroutesnapper_onMouseMove(this.__wbg_ptr,e,n,t)!==0}onClick(){K.jsroutesnapper_onClick(this.__wbg_ptr)}onDragStart(){return K.jsroutesnapper_onDragStart(this.__wbg_ptr)!==0}onMouseUp(){return K.jsroutesnapper_onMouseUp(this.__wbg_ptr)!==0}clearState(){K.jsroutesnapper_clearState(this.__wbg_ptr)}editExisting(e){try{const i=K.__wbindgen_add_to_stack_pointer(-16);K.jsroutesnapper_editExisting(i,this.__wbg_ptr,ye(e));var n=pe()[i/4+0],t=pe()[i/4+1];if(t)throw Mn(n)}finally{K.__wbindgen_add_to_stack_pointer(16)}}debugRenderGraph(){let e,n;try{const o=K.__wbindgen_add_to_stack_pointer(-16);K.jsroutesnapper_debugRenderGraph(o,this.__wbg_ptr);var t=pe()[o/4+0],i=pe()[o/4+1];return e=t,n=i,Ve(t,i)}finally{K.__wbindgen_add_to_stack_pointer(16),K.__wbindgen_free(e,n,1)}}debugSnappableNodes(){let e,n;try{const o=K.__wbindgen_add_to_stack_pointer(-16);K.jsroutesnapper_debugSnappableNodes(o,this.__wbg_ptr);var t=pe()[o/4+0],i=pe()[o/4+1];return e=t,n=i,Ve(t,i)}finally{K.__wbindgen_add_to_stack_pointer(16),K.__wbindgen_free(e,n,1)}}routeNameForWaypoints(e){let n,t;try{const f=K.__wbindgen_add_to_stack_pointer(-16);K.jsroutesnapper_routeNameForWaypoints(f,this.__wbg_ptr,ye(e));var i=pe()[f/4+0],o=pe()[f/4+1],s=pe()[f/4+2],a=pe()[f/4+3],l=i,u=o;if(a)throw l=0,u=0,Mn(s);return n=l,t=u,Ve(l,u)}finally{K.__wbindgen_add_to_stack_pointer(16),K.__wbindgen_free(n,t,1)}}addSnappedWaypoint(e,n){K.jsroutesnapper_addSnappedWaypoint(this.__wbg_ptr,e,n)}undo(){K.jsroutesnapper_undo(this.__wbg_ptr)}}async function nu(r,e){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(t){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t);else throw t}const n=await r.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(r,e);return n instanceof WebAssembly.Instance?{instance:n,module:r}:n}}function ru(){const r={};return r.wbg={},r.wbg.__wbindgen_string_new=function(e,n){const t=Ve(e,n);return ye(t)},r.wbg.__wbindgen_object_drop_ref=function(e){Mn(e)},r.wbg.__wbindgen_error_new=function(e,n){const t=new Error(Ve(e,n));return ye(t)},r.wbg.__wbindgen_is_object=function(e){const n=oe(e);return typeof n=="object"&&n!==null},r.wbg.__wbindgen_is_undefined=function(e){return oe(e)===void 0},r.wbg.__wbindgen_in=function(e,n){return oe(e)in oe(n)},r.wbg.__wbindgen_number_get=function(e,n){const t=oe(n),i=typeof t=="number"?t:void 0;xa()[e/8+1]=fr(i)?0:i,pe()[e/4+0]=!fr(i)},r.wbg.__wbindgen_boolean_get=function(e){const n=oe(e);return typeof n=="boolean"?n?1:0:2},r.wbg.__wbindgen_jsval_loose_eq=function(e,n){return oe(e)==oe(n)},r.wbg.__wbindgen_string_get=function(e,n){const t=oe(n),i=typeof t=="string"?t:void 0;var o=fr(i)?0:yn(i,K.__wbindgen_malloc,K.__wbindgen_realloc),s=_t;pe()[e/4+1]=s,pe()[e/4+0]=o},r.wbg.__wbg_getwithrefkey_d1f0d12f1f1b63ea=function(e,n){const t=oe(e)[oe(n)];return ye(t)},r.wbg.__wbindgen_object_clone_ref=function(e){const n=oe(e);return ye(n)},r.wbg.__wbg_String_4370c5505c674d30=function(e,n){const t=String(oe(n)),i=yn(t,K.__wbindgen_malloc,K.__wbindgen_realloc),o=_t;pe()[e/4+1]=o,pe()[e/4+0]=i},r.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return ye(e)},r.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const t=oe(n).stack,i=yn(t,K.__wbindgen_malloc,K.__wbindgen_realloc),o=_t;pe()[e/4+1]=o,pe()[e/4+0]=i},r.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let t,i;try{t=e,i=n,console.error(Ve(e,n))}finally{K.__wbindgen_free(t,i,1)}},r.wbg.__wbg_debug_9a6b3243fbbebb61=function(e){console.debug(oe(e))},r.wbg.__wbg_error_788ae33f81d3b84b=function(e){console.error(oe(e))},r.wbg.__wbg_info_2e30e8204b29d91d=function(e){console.info(oe(e))},r.wbg.__wbg_log_1d3ae0273d8f4f8a=function(e){console.log(oe(e))},r.wbg.__wbg_warn_d60e832f9882c1b2=function(e){console.warn(oe(e))},r.wbg.__wbg_get_44be0491f933a435=function(e,n){const t=oe(e)[n>>>0];return ye(t)},r.wbg.__wbg_length_fff51ee6522a1a18=function(e){return oe(e).length},r.wbg.__wbindgen_is_function=function(e){return typeof oe(e)=="function"},r.wbg.__wbg_next_526fc47e980da008=function(e){const n=oe(e).next;return ye(n)},r.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return cr(function(e){const n=oe(e).next();return ye(n)},arguments)},r.wbg.__wbg_done_5c1f01fb660d73b5=function(e){return oe(e).done},r.wbg.__wbg_value_1695675138684bd5=function(e){const n=oe(e).value;return ye(n)},r.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return ye(Symbol.iterator)},r.wbg.__wbg_get_97b561fb56f034b5=function(){return cr(function(e,n){const t=Reflect.get(oe(e),oe(n));return ye(t)},arguments)},r.wbg.__wbg_call_cb65541d95d71282=function(){return cr(function(e,n){const t=oe(e).call(oe(n));return ye(t)},arguments)},r.wbg.__wbg_isArray_4c24b343cb13cfb1=function(e){return Array.isArray(oe(e))},r.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(e){let n;try{n=oe(e)instanceof ArrayBuffer}catch{n=!1}return n},r.wbg.__wbg_buffer_085ec1f694018c4f=function(e){const n=oe(e).buffer;return ye(n)},r.wbg.__wbg_new_8125e318e6245eed=function(e){const n=new Uint8Array(oe(e));return ye(n)},r.wbg.__wbg_set_5cf90238115182c3=function(e,n,t){oe(e).set(oe(n),t>>>0)},r.wbg.__wbg_length_72e2208bbc0efc61=function(e){return oe(e).length},r.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(e){let n;try{n=oe(e)instanceof Uint8Array}catch{n=!1}return n},r.wbg.__wbindgen_debug_string=function(e,n){const t=Er(oe(n)),i=yn(t,K.__wbindgen_malloc,K.__wbindgen_realloc),o=_t;pe()[e/4+1]=o,pe()[e/4+0]=i},r.wbg.__wbindgen_throw=function(e,n){throw new Error(Ve(e,n))},r.wbg.__wbindgen_memory=function(){const e=K.memory;return ye(e)},r}function iu(r,e){return K=r.exports,$s.__wbindgen_wasm_module=e,xt=null,en=null,Qt=null,K}async function $s(r){if(K!==void 0)return K;typeof r>"u"&&(r="/atip/move_draw_controls/assets/route_snapper_bg.wasm");const e=ru();(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:n,module:t}=await nu(await r,e);return iu(n,t)}function ou(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function su(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Li(r[0])||!Li(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return ou(t,e,n)}function Li(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function Mr(r,e){return e===void 0&&(e={}),es(r,function(n,t){var i=t.geometry.coordinates;return n+dt(i[0],i[1],e)},0)}function lu(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function au(r,e,n){if(n===void 0&&(n={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:r};return lu(t,e,n)}function uu(r,e,n){var t=Qe(n);if(_r(n)!=="LineString")throw new Error("line must be a LineString");var i=Tn(n,r),o=Tn(n,e),s;i.properties.index<=o.properties.index?s=[i,o]:s=[o,i];for(var a=[s[0].geometry.coordinates],l=s[0].properties.index+1;l=s){var a=(n+i)/2;return[e,a-(t-e)/2,t,a+(t-e)/2]}else{var l=(e+t)/2;return[l-(i-n)/2,n,l+(i-n)/2,i]}}function Pr(r){var e=[1/0,1/0,-1/0,-1/0];return jt(r,function(n){e[0]>n[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2] is required");if(typeof n!="number")throw new Error(" must be a number");if(typeof t!="number")throw new Error(" must be a number");(i===!1||i===void 0)&&(r=JSON.parse(JSON.stringify(r)));var o=Math.pow(10,n);return jt(r,function(s){pu(s,o,t)}),r}function pu(r,e,n){r.length>n&&r.splice(n,r.length);for(var t=0;t1&&n.push(Ci(f)),ln(n)}function vs(r,e){if(!e.features.length)throw new Error("lines must contain features");if(e.features.length===1)return e.features[0];var n,t=1/0;return Xt(e,function(i){var o=Tn(i,r),s=o.properties.dist;s{if(!this.active)return;const a=[s.point.x-_u,s.point.y],l=this.map.unproject(s.point).distanceTo(this.map.unproject(a));this.inner.onMouseMove(s.lngLat.lng,s.lngLat.lat,l)&&(this.redraw(),this.dataUpdated())},this.onClick=()=>{this.active&&(this.inner.onClick(),this.redraw(),this.dataUpdated())},this.onDoubleClick=s=>{this.active&&(s.preventDefault(),this.inner.onClick(),this.finish())},this.onDragStart=()=>{this.active&&this.inner.onDragStart()&&this.map.dragPan.disable()},this.onMouseUp=()=>{this.active&&this.inner.onMouseUp()&&this.map.dragPan.enable()},this.onKeyDown=s=>{this.active&&s.key=="Escape"&&(s.stopPropagation(),this.cancel())},this.onKeyPress=s=>{this.active&&s.target.tagName!="INPUT"&&(s.key=="Enter"?(s.stopPropagation(),this.finish()):s.key=="s"||s.key=="S"?(s.stopPropagation(),this.inner.toggleSnapMode(),this.redraw()):s.key=="z"&&s.ctrlKey&&this.undo())},this.map=e,console.time("Deserialize and setup JsRouteSnapper"),this.inner=new Hn(n),console.timeEnd("Deserialize and setup JsRouteSnapper"),this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.routeToolGj=t,this.snapMode=i,this.undoLength=o,this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("dragstart",this.onDragStart),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keypress",this.onKeyPress)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("dragstart",this.onDragStart),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keypress",this.onKeyPress)}startRoute(){this.active||(this.active=!0,this.map.boxZoom.disable(),this.map.doubleClickZoom.disable())}startArea(){this.active||(this.inner.setAreaMode(),this.active=!0,this.map.boxZoom.disable(),this.map.doubleClickZoom.disable())}stop(){this.active=!1,this.inner.clearState(),this.redraw(),this.map.boxZoom.enable(),this.map.doubleClickZoom.enable()}editExistingRoute(e){this.active&&window.alert("Bug: editExistingRoute called when tool is already active"),e.properties.waypoints||(e.properties.waypoints=[{lon:e.geometry.coordinates[0][0],lat:e.geometry.coordinates[0][1],snapped:!0},{lon:e.geometry.coordinates[e.geometry.coordinates.length-1][0],lat:e.geometry.coordinates[e.geometry.coordinates.length-1][1],snapped:!0}]),this.startRoute(),this.inner.editExisting(e.properties.waypoints),this.redraw()}editExistingArea(e){this.active&&window.alert("Bug: editExistingArea called when tool is already active"),e.properties.waypoints||window.alert("Bug: editExistingArea called for a polygon not produced by the route-snapper"),this.startArea(),this.inner.editExisting(e.properties.waypoints),this.redraw()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}isActive(){return this.active}finish(){let e=this.inner.toFinalFeature();if(e)for(let n of this.eventListenersSuccess)n(JSON.parse(e));else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){this.inner.clearState(),this.finish()}setRouteConfig(e){this.inner.setRouteConfig(e),this.redraw()}addSnappedWaypoint(e){this.inner.addSnappedWaypoint(e[0],e[1]),this.redraw()}undo(){this.inner.undo(),this.redraw()}toggleSnapMode(){this.inner.toggleSnapMode(),this.redraw()}redraw(){let e=JSON.parse(this.inner.renderGeojson());this.routeToolGj.set(e),this.map.getCanvas().style.cursor=e.cursor,this.snapMode.set(e.snap_mode),this.undoLength.set(e.undo_length)}dataUpdated(){let e=this.inner.toFinalFeature();if(e)for(let n of this.eventListenersUpdated)n(JSON.parse(e))}}async function $u(r,e){let n=await fetch(r),t=n.body.getReader(),i=n.headers.get("Content-Length");if(!i)throw new Error(`No Content-Length header from ${r}`);let o=parseInt(i),s=0,a=[];for(;;){let{done:f,value:c}=await t.read();if(f)break;c&&(a.push(c),s+=c.length,e(100*s/o))}let l=new Uint8Array(s),u=0;for(let f of a)l.set(f,u),u+=f.length;return l}function Ri(r){let e=r[0],n,t,i=Oi(r);return{c(){i.c(),n=ce()},m(o,s){i.m(o,s),w(o,n,s),t=!0},p(o,s){s&1&&x(e,e=o[0])?(se(),y(i,1,1,Q),le(),i=Oi(o),i.c(),b(i,1),i.m(n.parentNode,n)):i.p(o,s)},i(o){t||(b(i),t=!0)},o(o){y(i),t=!1},d(o){o&&k(n),i.d(o)}}}function Oi(r){let e;const n=r[10].default,t=at(n,r,r[9],null);return{c(){t&&t.c()},m(i,o){t&&t.m(i,o),e=!0},p(i,o){t&&t.p&&(!e||o&512)&&ut(t,n,i,i[9],e?ct(n,i[9],o,null):ft(i[9]),null)},i(i){e||(b(t,i),e=!0)},o(i){y(t,i),e=!1},d(i){t&&t.d(i)}}}function vu(r){let e,n,t=r[0]&&Ri(r);return{c(){t&&t.c(),e=ce()},m(i,o){t&&t.m(i,o),w(i,e,o),n=!0},p(i,[o]){i[0]?t?(t.p(i,o),o&1&&b(t,1)):(t=Ri(i),t.c(),b(t,1),t.m(e.parentNode,e)):t&&(se(),y(t,1,1,()=>{t=null}),le())},i(i){n||(b(t),n=!0)},o(i){y(t),n=!1},d(i){i&&k(e),t&&t.d(i)}}}function yu(r,e,n){let t,i,{$$slots:o={},$$scope:s}=e,{id:a=Do("image")}=e,{url:l}=e,{coordinates:u}=e;const{map:f,self:c}=nl();H(r,f,h=>n(8,i=h)),H(r,c,h=>n(0,t=h));let p,m=!0;return Xe(()=>{t&&i&&(rl(f,t,p),Be(c,t=null,t),n(6,p=void 0))}),r.$$set=h=>{"id"in h&&n(3,a=h.id),"url"in h&&n(4,l=h.url),"coordinates"in h&&n(5,u=h.coordinates),"$$scope"in h&&n(9,s=h.$$scope)},r.$$.update=()=>{r.$$.dirty&313&&i&&t!==a&&(Be(c,t=a,t),il(i,t,ol({type:"image",url:l,coordinates:u}),h=>i&&h===t,()=>{t&&(n(6,p=i==null?void 0:i.getSource(t)),n(7,m=!0))})),r.$$.dirty&264&&(i==null||i.on("style.load",()=>{n(6,p=i==null?void 0:i.getSource(a))})),r.$$.dirty&224&&p&&(m?n(7,m=!1):p.setCoordinates(u))},[t,f,c,a,l,u,p,m,i,s,o]}class wu extends ne{constructor(e){super(),re(this,e,yu,vu,x,{id:3,url:4,coordinates:5})}}const{Map:ku}=fl;function Ii(r,e,n){const t=r.slice();t[40]=e[n];const i=t[1](t[40]);t[41]=i;const o=typeof t[7]=="function"?t[7](t[40]):t[7];return t[42]=o,t}const Su=r=>({feature:r[0]&1024,position:r[0]&1026}),ji=r=>({feature:r[40],position:r[41]});function Bi(r){let e=[],n=new ku,t,i,o=Ie(r[10]);const s=a=>a[40].id;for(let a=0;a=r[13]&&r[11]<=r[12]&&Bi(r);return{c(){P(e.$$.fragment),n=N(),o&&o.c(),t=ce()},m(s,a){L(e,s,a),w(s,n,a),o&&o.m(s,a),w(s,t,a),i=!0},p(s,a){const l={};a[0]&32&&(l.minzoom=s[5]),a[0]&64&&(l.maxzoom=s[6]),e.$set(l),s[11]>=s[13]&&s[11]<=s[12]?o?(o.p(s,a),a[0]&14336&&b(o,1)):(o=Bi(s),o.c(),b(o,1),o.m(t.parentNode,t)):o&&(se(),y(o,1,1,()=>{o=null}),le())},i(s){i||(b(e.$$.fragment,s),b(o),i=!0)},o(s){y(e.$$.fragment,s),y(o),i=!1},d(s){s&&(k(n),k(t)),C(e,s),o&&o.d(s)}}}function Pu(r,e,n){let t,i,o,s,a,l,u,{$$slots:f={},$$scope:c}=e;const{map:p,source:m,minzoom:h,maxzoom:$}=sl();H(r,p,W=>n(21,s=W)),H(r,m,W=>n(9,a=W)),H(r,h,W=>n(23,u=W)),H(r,$,W=>n(22,l=W));const v=ll();let{applyToClusters:M=void 0}=e,{filter:g=void 0}=e,{markerLngLat:_=Va}=e,{interactive:E=!0}=e,{asButton:d=!1}=e,{draggable:S=!1}=e,{minzoom:R=void 0}=e,{maxzoom:j=void 0}=e,{hovered:T=null}=e,{zIndex:B=void 0}=e,{class:O=void 0}=e,A=!1;function F(){s&&(A=!0,s.on("zoom",G),s.on("move",J),s.on("moveend",J),s.loaded()?s.once("load",J):J())}function I(W){W.sourceId===a&&W.isSourceLoaded&&(A?J():F())}Xe(()=>{s&&(s.off("zoom",G),s.off("move",J),s.off("moveend",J),s.off("sourcedata",I))});let X=[];function J(){var qt;if(!s||!a)return;let W=s.querySourceFeatures(a,{filter:o}),we=new Map;for(let Me of W)Me.id||((qt=Me.properties)!=null&&qt.cluster_id?Me.id="autocluster_"+Me.properties.cluster_id:Me.id=Do("autofeat")),we.set(Me.id,Me);n(10,X=[...we.values()].sort((Me,Zs)=>Me.id.toString().localeCompare(Zs.id.toString())))}let ee=(s==null?void 0:s.getZoom())??0;function G(W){n(11,ee=s.getZoom()),J()}const fe=W=>{n(0,T=W)},me=W=>{(T==null?void 0:T.id)===W.id&&n(0,T=null)},_e=(W,we)=>v("dragstart",{...we.detail,source:a,feature:W}),be=(W,we)=>v("drag",{...we.detail,source:a,feature:W}),bn=(W,we)=>v("dragend",{...we.detail,source:a,feature:W}),Y=(W,we)=>v("click",{...we.detail,source:a,feature:W}),Z=(W,we)=>v("dblclick",{...we.detail,source:a,feature:W}),je=(W,we)=>v("contextmenu",{...we.detail,source:a,feature:W});return r.$$set=W=>{"applyToClusters"in W&&n(19,M=W.applyToClusters),"filter"in W&&n(20,g=W.filter),"markerLngLat"in W&&n(1,_=W.markerLngLat),"interactive"in W&&n(2,E=W.interactive),"asButton"in W&&n(3,d=W.asButton),"draggable"in W&&n(4,S=W.draggable),"minzoom"in W&&n(5,R=W.minzoom),"maxzoom"in W&&n(6,j=W.maxzoom),"hovered"in W&&n(0,T=W.hovered),"zIndex"in W&&n(7,B=W.zIndex),"class"in W&&n(8,O=W.class),"$$scope"in W&&n(33,c=W.$$scope)},r.$$.update=()=>{if(r.$$.dirty[0]&8388640&&n(13,t=R??u),r.$$.dirty[0]&4194368&&n(12,i=j??l),r.$$.dirty[0]&1572864&&(o=al("all",ul(M),g)),r.$$.dirty[0]&2097664&&s&&a){let W=s.getSource(a);W!=null&&W.loaded()?F():s.on("sourcedata",I)}},[T,_,E,d,S,R,j,B,O,a,X,ee,i,t,p,m,h,$,v,M,g,s,l,u,f,fe,me,_e,be,bn,Y,Z,je,c]}class Lu extends ne{constructor(e){super(),re(this,e,Pu,Mu,x,{applyToClusters:19,filter:20,markerLngLat:1,interactive:2,asButton:3,draggable:4,minzoom:5,maxzoom:6,hovered:0,zIndex:7,class:8},null,[-1,-1])}}/** - * splaytree v3.1.1 - * Fast Splay tree for Node and browser - * - * @author Alexander Milevski - * @license MIT - * @preserve - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */function Cu(r,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},t,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(f){return l([u,f])}}function l(u){if(t)throw new TypeError("Generator is already executing.");for(;n;)try{if(t=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]e?1:r0){if(e.right===null)break;if(n(r,e.right.key)>0){var a=e.right;if(e.right=a.left,a.left=e,e=a,e.right===null)break}i.right=e,i=e,e=e.right}else break}return i.right=e.left,o.left=e.right,e.left=t.right,e.right=t.left,e}function mr(r,e,n,t){var i=new vt(r,e);if(n===null)return i.left=i.right=null,i;n=gt(r,n,t);var o=t(r,n.key);return o<0?(i.left=n.left,i.right=n,n.left=null):o>=0&&(i.right=n.right,i.left=n,n.right=null),i}function Gi(r,e,n){var t=null,i=null;if(e){e=gt(r,e,n);var o=n(e.key,r);o===0?(t=e.left,i=e.right):o<0?(i=e.right,e.right=null,t=e):(t=e.left,e.left=null,i=e)}return{left:t,right:i}}function Fu(r,e,n){return e===null?r:(r===null||(e=gt(r.key,e,n),e.left=r),e)}function Cr(r,e,n,t,i){if(r){t(""+e+(n?"└── ":"├── ")+i(r)+` -`);var o=e+(n?" ":"│ ");r.left&&Cr(r.left,o,!1,t,i),r.right&&Cr(r.right,o,!0,t,i)}}var Wr=function(){function r(e){e===void 0&&(e=Au),this._root=null,this._size=0,this._comparator=e}return r.prototype.insert=function(e,n){return this._size++,this._root=mr(e,n,this._root,this._comparator)},r.prototype.add=function(e,n){var t=new vt(e,n);this._root===null&&(t.left=t.right=null,this._size++,this._root=t);var i=this._comparator,o=gt(e,this._root,i),s=i(e,o.key);return s===0?this._root=o:(s<0?(t.left=o.left,t.right=o,o.left=null):s>0&&(t.right=o.right,t.left=o,o.right=null),this._size++,this._root=t),this._root},r.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},r.prototype._remove=function(e,n,t){var i;if(n===null)return null;n=gt(e,n,t);var o=t(e,n.key);return o===0?(n.left===null?i=n.right:(i=gt(e,n.left,t),i.right=n.right),this._size--,i):n},r.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=gt(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},r.prototype.findStatic=function(e){for(var n=this._root,t=this._comparator;n;){var i=t(e,n.key);if(i===0)return n;i<0?n=n.left:n=n.right}return null},r.prototype.find=function(e){return this._root&&(this._root=gt(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},r.prototype.contains=function(e){for(var n=this._root,t=this._comparator;n;){var i=t(e,n.key);if(i===0)return!0;i<0?n=n.left:n=n.right}return!1},r.prototype.forEach=function(e,n){for(var t=this._root,i=[],o=!1;!o;)t!==null?(i.push(t),t=t.left):i.length!==0?(t=i.pop(),e.call(n,t),t=t.right):o=!0;return this},r.prototype.range=function(e,n,t,i){for(var o=[],s=this._comparator,a=this._root,l;o.length!==0||a;)if(a)o.push(a),a=a.left;else{if(a=o.pop(),l=s(a.key,n),l>0)break;if(s(a.key,e)>=0&&t.call(i,a))return this;a=a.right}return this},r.prototype.keys=function(){var e=[];return this.forEach(function(n){var t=n.key;return e.push(t)}),e},r.prototype.values=function(){var e=[];return this.forEach(function(n){var t=n.data;return e.push(t)}),e},r.prototype.min=function(){return this._root?this.minNode(this._root).key:null},r.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},r.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},r.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},r.prototype.at=function(e){for(var n=this._root,t=!1,i=0,o=[];!t;)if(n)o.push(n),n=n.left;else if(o.length>0){if(n=o.pop(),i===e)return n;i++,n=n.right}else t=!0;return null},r.prototype.next=function(e){var n=this._root,t=null;if(e.right){for(t=e.right;t.left;)t=t.left;return t}for(var i=this._comparator;n;){var o=i(e.key,n.key);if(o===0)break;o<0?(t=n,n=n.left):n=n.right}return t},r.prototype.prev=function(e){var n=this._root,t=null;if(e.left!==null){for(t=e.left;t.right;)t=t.right;return t}for(var i=this._comparator;n;){var o=i(e.key,n.key);if(o===0)break;o<0?n=n.left:(t=n,n=n.right)}return t},r.prototype.clear=function(){return this._root=null,this._size=0,this},r.prototype.toList=function(){return Ru(this._root)},r.prototype.load=function(e,n,t){n===void 0&&(n=[]),t===void 0&&(t=!1);var i=e.length,o=this._comparator;if(t&&Nr(e,n,0,i-1,o),this._root===null)this._root=Ar(e,n,0,i),this._size=i;else{var s=Ou(this.toList(),Nu(e,n),o);i=this._size+i,this._root=Fr({head:s},0,i)}return this},r.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(r.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),r.prototype.toString=function(e){e===void 0&&(e=function(t){return String(t.key)});var n=[];return Cr(this._root,"",!0,function(t){return n.push(t)},e),n.join("")},r.prototype.update=function(e,n,t){var i=this._comparator,o=Gi(e,this._root,i),s=o.left,a=o.right;i(e,n)<0?a=mr(n,t,a,i):s=mr(n,t,s,i),this._root=Fu(s,a,i)},r.prototype.split=function(e){return Gi(e,this._root,this._comparator)},r.prototype[Symbol.iterator]=function(){var e;return Cu(this,function(n){switch(n.label){case 0:e=this.minNode(),n.label=1;case 1:return e?[4,e]:[3,3];case 2:return n.sent(),e=this.next(e),[3,1];case 3:return[2]}})},r}();function Ar(r,e,n,t){var i=t-n;if(i>0){var o=n+Math.floor(i/2),s=r[o],a=e[o],l=new vt(s,a);return l.left=Ar(r,e,n,o),l.right=Ar(r,e,o+1,t),l}return null}function Nu(r,e){for(var n=new vt(null,null),t=n,i=0;i0?(e=o=o.next=n.pop(),e=e.right):t=!0;return o.next=null,i.next}function Fr(r,e,n){var t=n-e;if(t>0){var i=e+Math.floor(t/2),o=Fr(r,e,i),s=r.head;return s.left=o,r.head=r.head.next,s.right=Fr(r,i+1,n),s}return null}function Ou(r,e,n){for(var t=new vt(null,null),i=t,o=r,s=e;o!==null&&s!==null;)n(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;return o!==null?i.next=o:s!==null&&(i.next=s),t.next}function Nr(r,e,n,t,i){if(!(n>=t)){for(var o=r[n+t>>1],s=n-1,a=t+1;;){do s++;while(i(r[s],o)<0);do a--;while(i(r[a],o)>0);if(s>=a)break;var l=r[s];r[s]=r[a],r[a]=l,l=e[s],e[s]=e[a],e[a]=l}Nr(r,e,n,a,i),Nr(r,e,a+1,t,i)}}function qe(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Ti(r,e){for(var n=0;nt.x?1:n.yt.y?1:0}}]);function r(e,n){qe(this,r),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return Fe(r,[{key:"link",value:function(n){if(n.point===this.point)throw new Error("Tried to link already linked events");for(var t=n.point.events,i=0,o=t.length;i=0&&p>=0?fm?-1:0:u<0&&p<0?fm?1:0:pu?1:0}}}]),r}(),Tu=0,Vn=function(){Fe(r,null,[{key:"compare",value:function(n,t){var i=n.leftSE.point.x,o=t.leftSE.point.x,s=n.rightSE.point.x,a=t.rightSE.point.x;if(al&&u>f)return-1;var p=n.comparePoint(t.leftSE.point);if(p<0)return 1;if(p>0)return-1;var m=t.comparePoint(n.rightSE.point);return m!==0?m:-1}if(i>o){if(lu&&l>c)return 1;var h=t.comparePoint(n.leftSE.point);if(h!==0)return h;var $=n.comparePoint(t.rightSE.point);return $<0?1:$>0?-1:1}if(lu)return 1;if(sa){var M=n.comparePoint(t.rightSE.point);if(M<0)return 1;if(M>0)return-1}if(s!==a){var g=f-l,_=s-i,E=c-u,d=a-o;if(g>_&&Ed)return-1}return s>a?1:sc?1:n.idt.id?1:0}}]);function r(e,n,t,i){qe(this,r),this.id=++Tu,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=t,this.windings=i}return Fe(r,[{key:"replaceRightSE",value:function(n){this.rightSE=n,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var n=this.leftSE.point.y,t=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:nt?n:t}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(n){return n.x===this.leftSE.point.x&&n.y===this.leftSE.point.y||n.x===this.rightSE.point.x&&n.y===this.rightSE.point.y}},{key:"comparePoint",value:function(n){if(this.isAnEndpoint(n))return 0;var t=this.leftSE.point,i=this.rightSE.point,o=this.vector();if(t.x===i.x)return n.x===t.x?0:n.x0&&l.swapEvents(),Ze.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),i&&(o.checkForConsuming(),s.checkForConsuming()),t}},{key:"swapEvents",value:function(){var n=this.rightSE;this.rightSE=this.leftSE,this.leftSE=n,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var t=0,i=this.windings.length;t0){var s=t;t=i,i=s}if(t.prev===i){var a=t;t=i,i=a}for(var l=0,u=i.rings.length;l0)o=t,s=n,a=-1;else throw new Error("Tried to create degenerate segment at [".concat(n.x,", ").concat(n.y,"]"));var u=new Ze(o,!0),f=new Ze(s,!1);return new r(u,f,[i],[a])}}]),r}(),Yi=function(){function r(e,n,t){if(qe(this,r),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=t,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=pn.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,s=1,a=e.length;sthis.bbox.ur.x&&(this.bbox.ur.x=l.x),l.y>this.bbox.ur.y&&(this.bbox.ur.y=l.y),o=l)}(i.x!==o.x||i.y!==o.y)&&this.segments.push(Vn.fromRing(o,i,this))}return Fe(r,[{key:"getSweepEvents",value:function(){for(var n=[],t=0,i=this.segments.length;tthis.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=n}return Fe(r,[{key:"getSweepEvents",value:function(){for(var n=this.exteriorRing.getSweepEvents(),t=0,i=this.interiorRings.length;tthis.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=n}return Fe(r,[{key:"getSweepEvents",value:function(){for(var n=[],t=0,i=this.polys.length;t0&&(n=o)}for(var s=n.segment.prevInResult(),a=s?s.prevInResult():null;;){if(!s)return null;if(!a)return s.ringOut;if(a.ringOut!==s.ringOut)return a.ringOut.enclosingRing()!==s.ringOut?s.ringOut:s.ringOut.enclosingRing();s=a.prevInResult(),a=s?s.prevInResult():null}}}]),r}(),Wi=function(){function r(e){qe(this,r),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Fe(r,[{key:"addInterior",value:function(n){this.interiorRings.push(n),n.poly=this}},{key:"getGeom",value:function(){var n=[this.exteriorRing.getGeom()];if(n[0]===null)return null;for(var t=0,i=this.interiorRings.length;t1&&arguments[1]!==void 0?arguments[1]:Vn.compare;qe(this,r),this.queue=e,this.tree=new Wr(n),this.segments=[]}return Fe(r,[{key:"process",value:function(n){var t=n.segment,i=[];if(n.consumedBy)return n.isLeft?this.queue.remove(n.otherSE):this.tree.remove(t),i;var o=n.isLeft?this.tree.insert(t):this.tree.find(t);if(!o)throw new Error("Unable to find segment #".concat(t.id," ")+"[".concat(t.leftSE.point.x,", ").concat(t.leftSE.point.y,"] -> ")+"[".concat(t.rightSE.point.x,", ").concat(t.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var s=o,a=o,l=void 0,u=void 0;l===void 0;)s=this.tree.prev(s),s===null?l=null:s.key.consumedBy===void 0&&(l=s.key);for(;u===void 0;)a=this.tree.next(a),a===null?u=null:a.key.consumedBy===void 0&&(u=a.key);if(n.isLeft){var f=null;if(l){var c=l.getIntersection(t);if(c!==null&&(t.isAnEndpoint(c)||(f=c),!l.isAnEndpoint(c)))for(var p=this._splitSafely(l,c),m=0,h=p.length;m0?(this.tree.remove(t),i.push(n)):(this.segments.push(t),t.prev=l)}else{if(l&&u){var T=l.getIntersection(u);if(T!==null){if(!l.isAnEndpoint(T))for(var B=this._splitSafely(l,T),O=0,A=B.length;OKi)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var d=new Ju($),S=$.size,R=$.pop();R;){var j=R.key;if($.size===S){var T=j.segment;throw new Error("Unable to pop() ".concat(j.isLeft?"left":"right"," SweepEvent ")+"[".concat(j.point.x,", ").concat(j.point.y,"] from segment #").concat(T.id," ")+"[".concat(T.leftSE.point.x,", ").concat(T.leftSE.point.y,"] -> ")+"[".concat(T.rightSE.point.x,", ").concat(T.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if($.size>Ki)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(d.segments.length>Yu)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var B=d.process(j),O=0,A=B.length;O1?n-1:0),i=1;i1?n-1:0),i=1;i1?n-1:0),i=1;i1?n-1:0),i=1;iVu(r,"name",{value:e,configurable:!0});function ws(r,e){var n=Ss(e),t=null;return r.type==="FeatureCollection"?t=ks(r):t=Kr(Ln.union(r.geometry.coordinates)),t.geometry.coordinates.forEach(function(i){n.geometry.coordinates.push(i[0])}),n}ir(ws,"mask");function ks(r){var e=r.features.length===2?Ln.union(r.features[0].geometry.coordinates,r.features[1].geometry.coordinates):Ln.union.apply(Ln,r.features.map(function(n){return n.geometry.coordinates}));return Kr(e)}ir(ks,"unionFc");function Kr(r){return cl(r)}ir(Kr,"createGeomFromPolygonClippingOutput");function Ss(r){var e=[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]],n=r&&r.geometry.coordinates||e;return pl(n)}ir(Ss,"createMask");var Hi=ws;function Qu(r){let e,n;const t=[ae(r[0],"boundary"),{paint:{"fill-color":"black","fill-opacity":.5}}];let i={};for(let o=0;on(3,t=a));let{cfg:i}=e,{boundaryGeojson:o}=e,{fitBoundsAtStart:s=!1}=e;return(ml("setCamera")||s)&&(t==null||t.fitBounds(Yo(o),{padding:20,animate:!1})),r.$$set=a=>{"cfg"in a&&n(0,i=a.cfg),"boundaryGeojson"in a&&n(1,o=a.boundaryGeojson),"fitBoundsAtStart"in a&&n(2,s=a.fitBoundsAtStart)},[i,o,s]}class tf extends ne{constructor(e){super(),re(this,e,ef,xu,x,{cfg:0,boundaryGeojson:1,fitBoundsAtStart:2})}}function nf(r){let e;const n=r[1].default,t=at(n,r,r[4],null);return{c(){t&&t.c()},m(i,o){t&&t.m(i,o),e=!0},p(i,o){t&&t.p&&(!e||o&16)&&ut(t,n,i,i[4],e?ct(n,i[4],o,null):ft(i[4]),null)},i(i){e||(b(t,i),e=!0)},o(i){y(t,i),e=!1},d(i){t&&t.d(i)}}}function rf(r){let e;return{c(){e=q("Help")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function of(r){let e,n,t,i,o;function s(l){r[2](l)}let a={title:"Help",$$slots:{default:[nf]},$$scope:{ctx:r}};return r[0]!==void 0&&(a.open=r[0]),e=new yt({props:a}),V.push(()=>te(e,"open",s)),i=new ge({props:{$$slots:{default:[rf]},$$scope:{ctx:r}}}),i.$on("click",r[3]),{c(){P(e.$$.fragment),t=N(),P(i.$$.fragment)},m(l,u){L(e,l,u),w(l,t,u),L(i,l,u),o=!0},p(l,[u]){const f={};u&16&&(f.$$scope={dirty:u,ctx:l}),!n&&u&1&&(n=!0,f.open=l[0],ie(()=>n=!1)),e.$set(f);const c={};u&16&&(c.$$scope={dirty:u,ctx:l}),i.$set(c)},i(l){o||(b(e.$$.fragment,l),b(i.$$.fragment,l),o=!0)},o(l){y(e.$$.fragment,l),y(i.$$.fragment,l),o=!1},d(l){l&&k(t),C(e,l),C(i,l)}}}function sf(r,e,n){let{$$slots:t={},$$scope:i}=e,o=!1;function s(l){o=l,n(0,o)}const a=()=>n(0,o=!0);return r.$$set=l=>{"$$scope"in l&&n(4,i=l.$$scope)},[o,t,s,a,i]}class Kt extends ne{constructor(e){super(),re(this,e,sf,of,x,{})}}function lf(r){let e;return{c(){e=q("Cancel")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function af(r){let e;return{c(){e=D("li"),e.textContent="Click to add a new point"},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function uf(r){let e;return{c(){e=D("li"),e.textContent="Click to move the point here"},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function ff(r){let e,n,t;function i(a,l){return a[0]?uf:af}let o=i(r),s=o(r);return{c(){e=D("ul"),s.c(),n=N(),t=D("li"),t.innerHTML=`Press Escape - to cancel`},m(a,l){w(a,e,l),s.m(e,null),U(e,n),U(e,t)},p(a,l){o!==(o=i(a))&&(s.d(1),s=o(a),s&&(s.c(),s.m(e,n)))},d(a){a&&k(e),s.d()}}}function cf(r){let e,n,t,i;return e=new ge({props:{$$slots:{default:[lf]},$$scope:{ctx:r}}}),e.$on("click",function(){Ft(r[1])&&r[1].apply(this,arguments)}),t=new Kt({props:{$$slots:{default:[ff]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment)},m(o,s){L(e,o,s),w(o,n,s),L(t,o,s),i=!0},p(o,s){r=o;const a={};s&4&&(a.$$scope={dirty:s,ctx:r}),e.$set(a);const l={};s&5&&(l.$$scope={dirty:s,ctx:r}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),C(e,o),C(t,o)}}}function pf(r){let e,n;return e=new Ke({props:{$$slots:{default:[cf]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,[i]){const o={};i&7&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function mf(r,e,n){let{editingExisting:t}=e,{cancel:i}=e;return r.$$set=o=>{"editingExisting"in o&&n(0,t=o.editingExisting),"cancel"in o&&n(1,i=o.cancel)},[t,i]}class Es extends ne{constructor(e){super(),re(this,e,mf,pf,x,{editingExisting:0,cancel:1})}}function df(r){let e;return{c(){e=q("Finish")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function gf(r){let e,n,t;return{c(){e=q("Undo ("),n=q(r[2]),t=q(")")},m(i,o){w(i,e,o),w(i,n,o),w(i,t,o)},p(i,o){o&4&&he(n,i[2])},d(i){i&&(k(e),k(n),k(t))}}}function hf(r){let e;return{c(){e=q("Undo")},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function _f(r){let e;function n(o,s){return o[2]==0?hf:gf}let t=n(r),i=t(r);return{c(){i.c(),e=ce()},m(o,s){i.m(o,s),w(o,e,s)},p(o,s){t===(t=n(o))&&i?i.p(o,s):(i.d(1),i=t(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){o&&k(e),i.d(o)}}}function bf(r){let e;return{c(){e=q("Cancel")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function $f(r){let e;return{c(){e=D("ul"),e.innerHTML=`
  • Click - the map to add a vertex
  • Click - a vertex to delete it
  • Drag - a vertex or the polygon to move it
  • Press Control+Z - to undo your last change
  • Press Enter - or - double click - to finish
  • Press Escape - to cancel
  • `},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function vf(r){let e,n,t,i,o,s,a,l;return e=new mt({props:{$$slots:{default:[df]},$$scope:{ctx:r}}}),e.$on("click",function(){Ft(r[0])&&r[0].apply(this,arguments)}),t=new ge({props:{disabled:r[2]==0,$$slots:{default:[_f]},$$scope:{ctx:r}}}),t.$on("click",r[3]),o=new ge({props:{$$slots:{default:[bf]},$$scope:{ctx:r}}}),o.$on("click",function(){Ft(r[1])&&r[1].apply(this,arguments)}),a=new Kt({props:{$$slots:{default:[$f]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment),i=N(),P(o.$$.fragment),s=N(),P(a.$$.fragment)},m(u,f){L(e,u,f),w(u,n,f),L(t,u,f),w(u,i,f),L(o,u,f),w(u,s,f),L(a,u,f),l=!0},p(u,f){r=u;const c={};f&32&&(c.$$scope={dirty:f,ctx:r}),e.$set(c);const p={};f&4&&(p.disabled=r[2]==0),f&36&&(p.$$scope={dirty:f,ctx:r}),t.$set(p);const m={};f&32&&(m.$$scope={dirty:f,ctx:r}),o.$set(m);const h={};f&32&&(h.$$scope={dirty:f,ctx:r}),a.$set(h)},i(u){l||(b(e.$$.fragment,u),b(t.$$.fragment,u),b(o.$$.fragment,u),b(a.$$.fragment,u),l=!0)},o(u){y(e.$$.fragment,u),y(t.$$.fragment,u),y(o.$$.fragment,u),y(a.$$.fragment,u),l=!1},d(u){u&&(k(n),k(i),k(s)),C(e,u),C(t,u),C(o,u),C(a,u)}}}function yf(r){let e,n;return e=new Ke({props:{$$slots:{default:[vf]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,[i]){const o={};i&39&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function wf(r,e,n){let t,i;H(r,un,l=>n(4,t=l)),H(r,ps,l=>n(2,i=l));let{finish:o}=e,{cancel:s}=e;function a(){t.undo()}return r.$$set=l=>{"finish"in l&&n(0,o=l.finish),"cancel"in l&&n(1,s=l.cancel)},[o,s,i,a]}class Ms extends ne{constructor(e){super(),re(this,e,wf,yf,x,{finish:0,cancel:1})}}const Ps=pt(Jt()),Cn=pt(Jt()),Ls=pt(!0),Hr=pt(0);function Zi(r,e,n){const t=r.slice();return t[9]=e[n],t}function Vi(r){let e,n,t=r[9].place_name+"",i,o,s;function a(...l){return r[5](r[9],...l)}return{c(){e=D("li"),n=D("a"),i=q(t),z(n,"href","#")},m(l,u){w(l,e,u),U(e,n),U(n,i),o||(s=$e(n,"click",a),o=!0)},p(l,u){r=l,u&2&&t!==(t=r[9].place_name+"")&&he(i,t)},d(l){l&&k(e),o=!1,s()}}}function kf(r){let e,n,t,i,o;function s(f){r[4](f)}let a={label:"Add waypoint by search"};r[0]!==void 0&&(a.value=r[0]),e=new rr({props:a}),V.push(()=>te(e,"value",s));let l=Ie(r[1].features),u=[];for(let f=0;fn=!1)),e.$set(p),c&6){l=Ie(f[1].features);let m;for(m=0;mn(6,t=p)),H(r,Cn,p=>n(1,i=p)),H(r,Je,p=>n(7,o=p));let{maptilerApiKey:s}=e,a="";async function l(p){if(!p){Be(Cn,i=Jt(),i);return}let m=new URLSearchParams({country:"gb",proximity:o.getCenter().toArray().join(","),fuzzyMatch:"true",key:s}).toString(),h=`https://api.maptiler.com/geocoding/${p}.json?${m}`,v=await(await fetch(h)).json(),M=1;for(let g of v.features)g.properties.number=M++;Be(Cn,i=v,i)}function u(p,m){p.preventDefault(),t.addSnappedWaypoint(m),n(0,a="")}function f(p){a=p,n(0,a)}const c=(p,m)=>u(m,p.center);return r.$$set=p=>{"maptilerApiKey"in p&&n(3,s=p.maptilerApiKey)},r.$$.update=()=>{r.$$.dirty&1&&l(a)},[a,i,u,s,f,c]}class Ef extends ne{constructor(e){super(),re(this,e,Sf,kf,x,{maptilerApiKey:3})}}function Mf(r){let e;return{c(){e=q("Finish")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Pf(r){let e,n,t;return{c(){e=q("Undo ("),n=q(r[4]),t=q(")")},m(i,o){w(i,e,o),w(i,n,o),w(i,t,o)},p(i,o){o&16&&he(n,i[4])},d(i){i&&(k(e),k(n),k(t))}}}function Lf(r){let e;return{c(){e=q("Undo")},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function Cf(r){let e;function n(o,s){return o[4]==0?Lf:Pf}let t=n(r),i=t(r);return{c(){i.c(),e=ce()},m(o,s){i.m(o,s),w(o,e,s)},p(o,s){t===(t=n(o))&&i?i.p(o,s):(i.d(1),i=t(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){o&&k(e),i.d(o)}}}function Af(r){let e;return{c(){e=q("Cancel")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Ff(r){let e,n,t,i,o,s;return e=new mt({props:{$$slots:{default:[Mf]},$$scope:{ctx:r}}}),e.$on("click",function(){Ft(r[2])&&r[2].apply(this,arguments)}),t=new ge({props:{disabled:r[4]==0,$$slots:{default:[Cf]},$$scope:{ctx:r}}}),t.$on("click",r[6]),o=new ge({props:{$$slots:{default:[Af]},$$scope:{ctx:r}}}),o.$on("click",function(){Ft(r[3])&&r[3].apply(this,arguments)}),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment),i=N(),P(o.$$.fragment)},m(a,l){L(e,a,l),w(a,n,l),L(t,a,l),w(a,i,l),L(o,a,l),s=!0},p(a,l){r=a;const u={};l&1024&&(u.$$scope={dirty:l,ctx:r}),e.$set(u);const f={};l&16&&(f.disabled=r[4]==0),l&1040&&(f.$$scope={dirty:l,ctx:r}),t.$set(f);const c={};l&1024&&(c.$$scope={dirty:l,ctx:r}),o.$set(c)},i(a){s||(b(e.$$.fragment,a),b(t.$$.fragment,a),b(o.$$.fragment,a),s=!0)},o(a){y(e.$$.fragment,a),y(t.$$.fragment,a),y(o.$$.fragment,a),s=!1},d(a){a&&(k(n),k(i)),C(e,a),C(t,a),C(o,a)}}}function Nf(r){let e;return{c(){e=q("Add points to end")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Rf(r){let e,n,t;function i(s){r[9](s)}let o={hint:"Keep clicking to add more points to the end of the route",$$slots:{default:[Nf]},$$scope:{ctx:r}};return r[0]!==void 0&&(o.checked=r[0]),e=new Rt({props:o}),V.push(()=>te(e,"checked",i)),{c(){P(e.$$.fragment)},m(s,a){L(e,s,a),t=!0},p(s,a){const l={};a&1024&&(l.$$scope={dirty:a,ctx:s}),!n&&a&1&&(n=!0,l.checked=s[0],ie(()=>n=!1)),e.$set(l)},i(s){t||(b(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function Qi(r){let e,n;return e=new Ef({props:{maptilerApiKey:r[1]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&2&&(o.maptilerApiKey=t[1]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Of(r){let e;return{c(){e=D("ul"),e.innerHTML=`
  • Click - the map to add points
  • Press s - to switch between snapping points to existing roads and drawing anywhere
  • Click and drag - any point to move it
  • Click - a waypoint to delete it
  • Press Control+Z - to undo your last change
  • Press Enter - or - double click - to finish
  • Press Escape - to cancel
  • `},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function If(r){let e,n,t,i,o,s,a,l,u,f;e=new Ke({props:{$$slots:{default:[Ff]},$$scope:{ctx:r}}}),i=new Nt({props:{label:"Draw",choices:[["snap","Snap to roads"],["free","Draw anywhere"]],value:r[5]?"snap":"free"}}),i.$on("change",r[7]),s=new Xo({props:{small:!0,$$slots:{default:[Rf]},$$scope:{ctx:r}}});let c=r[1]&&Qi(r);return u=new Kt({props:{$$slots:{default:[Of]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment),n=N(),t=D("div"),P(i.$$.fragment),o=N(),P(s.$$.fragment),a=N(),c&&c.c(),l=N(),P(u.$$.fragment),Oe(t,"display","flex"),Oe(t,"justify-content","space-between")},m(p,m){L(e,p,m),w(p,n,m),w(p,t,m),L(i,t,null),U(t,o),L(s,t,null),U(t,a),c&&c.m(t,null),U(t,l),L(u,t,null),f=!0},p(p,[m]){const h={};m&1052&&(h.$$scope={dirty:m,ctx:p}),e.$set(h);const $={};m&32&&($.value=p[5]?"snap":"free"),i.$set($);const v={};m&1025&&(v.$$scope={dirty:m,ctx:p}),s.$set(v),p[1]?c?(c.p(p,m),m&2&&b(c,1)):(c=Qi(p),c.c(),b(c,1),c.m(t,l)):c&&(se(),y(c,1,1,()=>{c=null}),le());const M={};m&1024&&(M.$$scope={dirty:m,ctx:p}),u.$set(M)},i(p){f||(b(e.$$.fragment,p),b(i.$$.fragment,p),b(s.$$.fragment,p),b(c),b(u.$$.fragment,p),f=!0)},o(p){y(e.$$.fragment,p),y(i.$$.fragment,p),y(s.$$.fragment,p),y(c),y(u.$$.fragment,p),f=!1},d(p){p&&(k(n),k(t)),C(e,p),C(i),C(s),c&&c.d(),C(u)}}}function jf(r,e,n){let t,i,o;H(r,rt,m=>n(8,t=m)),H(r,Hr,m=>n(4,i=m)),H(r,Ls,m=>n(5,o=m));let{maptilerApiKey:s}=e,{extendRoute:a}=e,{finish:l}=e,{cancel:u}=e;function f(){t.undo()}function c(){t.toggleSnapMode()}function p(m){a=m,n(0,a)}return r.$$set=m=>{"maptilerApiKey"in m&&n(1,s=m.maptilerApiKey),"extendRoute"in m&&n(0,a=m.extendRoute),"finish"in m&&n(2,l=m.finish),"cancel"in m&&n(3,u=m.cancel)},r.$$.update=()=>{r.$$.dirty&257&&t.setRouteConfig({avoid_doubling_back:!1,extend_route:a})},[a,s,l,u,i,o,f,c,t,p]}class Cs extends ne{constructor(e){super(),re(this,e,jf,If,x,{maptilerApiKey:1,extendRoute:0,finish:2,cancel:3})}}function Bf(r){let e;return{c(){e=q("Finish")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function qf(r){let e,n,t;return{c(){e=q("Undo ("),n=q(r[2]),t=q(")")},m(i,o){w(i,e,o),w(i,n,o),w(i,t,o)},p(i,o){o&4&&he(n,i[2])},d(i){i&&(k(e),k(n),k(t))}}}function Gf(r){let e;return{c(){e=q("Undo")},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function Tf(r){let e;function n(o,s){return o[2]==0?Gf:qf}let t=n(r),i=t(r);return{c(){i.c(),e=ce()},m(o,s){i.m(o,s),w(o,e,s)},p(o,s){t===(t=n(o))&&i?i.p(o,s):(i.d(1),i=t(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){o&&k(e),i.d(o)}}}function Uf(r){let e;return{c(){e=q("Cancel")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Df(r){let e;return{c(){e=D("ul"),e.innerHTML=`
  • Click - the map to add points
  • Click and drag - any point to move it
  • Click - a waypoint to delete it
  • Press Control+Z - to undo your last change
  • Press Enter - or - double click - to finish
  • Press Escape - to cancel
  • `},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function zf(r){let e,n,t,i,o,s,a,l;return e=new mt({props:{$$slots:{default:[Bf]},$$scope:{ctx:r}}}),e.$on("click",function(){Ft(r[0])&&r[0].apply(this,arguments)}),t=new ge({props:{disabled:r[2]==0,$$slots:{default:[Tf]},$$scope:{ctx:r}}}),t.$on("click",r[3]),o=new ge({props:{$$slots:{default:[Uf]},$$scope:{ctx:r}}}),o.$on("click",function(){Ft(r[1])&&r[1].apply(this,arguments)}),a=new Kt({props:{$$slots:{default:[Df]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment),i=N(),P(o.$$.fragment),s=N(),P(a.$$.fragment)},m(u,f){L(e,u,f),w(u,n,f),L(t,u,f),w(u,i,f),L(o,u,f),w(u,s,f),L(a,u,f),l=!0},p(u,f){r=u;const c={};f&32&&(c.$$scope={dirty:f,ctx:r}),e.$set(c);const p={};f&4&&(p.disabled=r[2]==0),f&36&&(p.$$scope={dirty:f,ctx:r}),t.$set(p);const m={};f&32&&(m.$$scope={dirty:f,ctx:r}),o.$set(m);const h={};f&32&&(h.$$scope={dirty:f,ctx:r}),a.$set(h)},i(u){l||(b(e.$$.fragment,u),b(t.$$.fragment,u),b(o.$$.fragment,u),b(a.$$.fragment,u),l=!0)},o(u){y(e.$$.fragment,u),y(t.$$.fragment,u),y(o.$$.fragment,u),y(a.$$.fragment,u),l=!1},d(u){u&&(k(n),k(i),k(s)),C(e,u),C(t,u),C(o,u),C(a,u)}}}function Jf(r){let e,n;return e=new Ke({props:{$$slots:{default:[zf]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,[i]){const o={};i&39&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Yf(r,e,n){let t,i;H(r,rt,l=>n(4,t=l)),H(r,Hr,l=>n(2,i=l));let{finish:o}=e,{cancel:s}=e;function a(){t.undo()}return r.$$set=l=>{"finish"in l&&n(0,o=l.finish),"cancel"in l&&n(1,s=l.cancel)},[o,s,i,a]}class As extends ne{constructor(e){super(),re(this,e,Yf,Jf,x,{finish:0,cancel:1})}}function Xf(r){let e,n;return e=new As({props:{finish:r[3],cancel:r[4]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Wf(r){let e,n;return e=new Ms({props:{finish:r[3],cancel:r[4]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Kf(r){let e,n;return e=new Cs({props:{maptilerApiKey:r[0].maptilerApiKey,extendRoute:!1,finish:r[3],cancel:r[4]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.maptilerApiKey=t[0].maptilerApiKey),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Hf(r){let e,n;return e=new Es({props:{editingExisting:!0,cancel:r[4]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Zf(r){let e,n,t,i,o,s,a,l;const u=[Hf,Kf,Wf,Xf],f=[];function c(p,m){return p[2]=="point"?0:p[2]=="route"?1:p[2]=="freehand-polygon"?2:p[2]=="snapped-polygon"?3:-1}return~(o=c(r))&&(s=f[o]=u[o](r)),{c(){e=D("h2"),n=q("Editing "),t=q(r[1]),i=N(),s&&s.c(),a=ce()},m(p,m){w(p,e,m),U(e,n),U(e,t),w(p,i,m),~o&&f[o].m(p,m),w(p,a,m),l=!0},p(p,[m]){(!l||m&2)&&he(t,p[1]);let h=o;o=c(p),o===h?~o&&f[o].p(p,m):(s&&(se(),y(f[h],1,1,()=>{f[h]=null}),le()),~o?(s=f[o],s?s.p(p,m):(s=f[o]=u[o](p),s.c()),b(s,1),s.m(a.parentNode,a)):s=null)},i(p){l||(b(s),l=!0)},o(p){y(s),l=!1},d(p){p&&(k(e),k(i),k(a)),~o&&f[o].d(p)}}}function Vf(r,e,n){let t,i,o;H(r,un,g=>n(8,t=g)),H(r,rt,g=>n(9,i=g)),H(r,Rn,g=>n(10,o=g));let{cfg:s}=e,{gjSchemes:a}=e,{id:l}=e,u="",f="",c=null;it(()=>{let g=null;a.update(E=>(g=E.features.find(d=>d.id==l),g.properties.hide_while_editing=!0,E));let _=g;n(1,u=s.interventionName(_)),_.geometry.type=="LineString"?(i==null||i.editExistingRoute(_),i==null||i.addEventListenerSuccess(p),i==null||i.addEventListenerUpdated(m),i==null||i.addEventListenerFailure(h),n(2,f="route")):_.geometry.type=="Polygon"?_.properties.waypoints?(i==null||i.editExistingArea(_),i==null||i.addEventListenerSuccess(p),i==null||i.addEventListenerUpdated(m),i==null||i.addEventListenerFailure(h),n(2,f="snapped-polygon")):(t==null||t.editExisting(_),t==null||t.addEventListenerSuccess(p),t==null||t.addEventListenerUpdated(m),t==null||t.addEventListenerFailure(h),n(2,f="freehand-polygon")):_.geometry.type=="Point"&&(o==null||o.start(),o==null||o.addEventListenerSuccess(p),o==null||o.addEventListenerFailure(h),n(2,f="point"))}),Xe(()=>{o==null||o.stop(),o==null||o.clearEventListeners(),i==null||i.stop(),i==null||i.clearEventListeners(),t==null||t.stop(),t==null||t.clearEventListeners(),a.update(g=>{let _=g.features.find(E=>E.id==l);return delete _.properties.hide_while_editing,c&&$(_,c),g})});function p(g){g.properties??(g.properties={}),c=g,ue.set({mode:"edit-form",id:l})}function m(g){c=g}function h(){c=null,ue.set({mode:"edit-form",id:l})}function $(g,_){g.geometry=_.geometry,_.properties.length_meters&&(g.properties.length_meters=_.properties.length_meters),_.properties.waypoints&&(g.properties.waypoints=_.properties.waypoints),s.updateFeature(g,_)}function v(){ue.set({mode:"edit-form",id:l})}function M(){c=null,ue.set({mode:"edit-form",id:l})}return r.$$set=g=>{"cfg"in g&&n(0,s=g.cfg),"gjSchemes"in g&&n(5,a=g.gjSchemes),"id"in g&&n(6,l=g.id)},[s,u,f,v,M,a,l]}class Qf extends ne{constructor(e){super(),re(this,e,Vf,Zf,x,{cfg:0,gjSchemes:5,id:6})}}const An=pt(null),Fn=pt(100);function xi(r){let e,n;return e=new wu({props:{url:r[3],coordinates:[[r[1].lng,r[1].lat],[r[4].lng,r[1].lat],[r[4].lng,r[4].lat],[r[1].lng,r[4].lat]],$$slots:{default:[xf]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&8&&(o.url=t[3]),i&18&&(o.coordinates=[[t[1].lng,t[1].lat],[t[4].lng,t[1].lat],[t[4].lng,t[4].lat],[t[1].lng,t[4].lat]]),i&545&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function xf(r){let e,n;const t=[ae(r[0],"georeferenced-image"),{paint:{"raster-fade-duration":0,"raster-opacity":r[5]/100}}];let i={};for(let o=0;ote(e,"lngLat",a));function u(c){r[8](c)}let f={draggable:!0,$$slots:{default:[tc]},$$scope:{ctx:r}};return r[4]!==void 0&&(f.lngLat=r[4]),i=new hr({props:f}),V.push(()=>te(i,"lngLat",u)),{c(){P(e.$$.fragment),t=N(),P(i.$$.fragment)},m(c,p){L(e,c,p),w(c,t,p),L(i,c,p),s=!0},p(c,p){const m={};p&512&&(m.$$scope={dirty:p,ctx:c}),!n&&p&2&&(n=!0,m.lngLat=c[1],ie(()=>n=!1)),e.$set(m);const h={};p&512&&(h.$$scope={dirty:p,ctx:c}),!o&&p&16&&(o=!0,h.lngLat=c[4],ie(()=>o=!1)),i.$set(h)},i(c){s||(b(e.$$.fragment,c),b(i.$$.fragment,c),s=!0)},o(c){y(e.$$.fragment,c),y(i.$$.fragment,c),s=!1},d(c){c&&k(t),C(e,c),C(i,c)}}}function ec(r){let e;return{c(){e=D("span"),z(e,"class","dot svelte-1tmbx1c"),Oe(e,"background-color","red")},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function tc(r){let e;return{c(){e=D("span"),z(e,"class","dot svelte-1tmbx1c"),Oe(e,"background-color","blue")},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function nc(r){let e,n,t,i=r[3]&&xi(r),o=r[3]&&r[2].mode=="set-image"&&eo(r);return{c(){i&&i.c(),e=N(),o&&o.c(),n=ce()},m(s,a){i&&i.m(s,a),w(s,e,a),o&&o.m(s,a),w(s,n,a),t=!0},p(s,[a]){s[3]?i?(i.p(s,a),a&8&&b(i,1)):(i=xi(s),i.c(),b(i,1),i.m(e.parentNode,e)):i&&(se(),y(i,1,1,()=>{i=null}),le()),s[3]&&s[2].mode=="set-image"?o?(o.p(s,a),a&12&&b(o,1)):(o=eo(s),o.c(),b(o,1),o.m(n.parentNode,n)):o&&(se(),y(o,1,1,()=>{o=null}),le())},i(s){t||(b(i),b(o),t=!0)},o(s){y(i),y(o),t=!1},d(s){s&&(k(e),k(n)),i&&i.d(s),o&&o.d(s)}}}function rc(r,e,n){let t,i,o,s;H(r,Je,p=>n(6,t=p)),H(r,ue,p=>n(2,i=p)),H(r,An,p=>n(3,o=p)),H(r,Fn,p=>n(5,s=p));let{cfg:a}=e,l={lng:0,lat:0},u={lng:0,lat:0};function f(p){l=p,n(1,l),n(6,t),n(3,o),n(2,i)}function c(p){u=p,n(4,u),n(6,t),n(3,o),n(2,i),n(1,l)}return r.$$set=p=>{"cfg"in p&&n(0,a=p.cfg)},r.$$.update=()=>{if(r.$$.dirty&78&&t&&o&&i.mode=="set-image"&&l.lng==0&&l.lat==0){let p=t.getBounds();n(1,l.lng=p.getWest()+.4*(p.getEast()-p.getWest()),l),n(4,u.lng=p.getWest()+.6*(p.getEast()-p.getWest()),u),n(1,l.lat=p.getNorth()+.4*(p.getSouth()-p.getNorth()),l),n(4,u.lat=p.getNorth()+.6*(p.getSouth()-p.getNorth()),u)}},[a,l,i,o,u,s,t,f,c]}class ic extends ne{constructor(e){super(),re(this,e,rc,nc,x,{cfg:0})}}function oc(r){let e,n,t,i,o,s;const a=[ae(r[0],"hover-polygons"),{filter:Lt},{paint:{"line-color":nn.hovering,"line-width":.5*Pt}}];let l={};for(let m=0;m(s(),s=We(u,f=>n(4,o=f)),u);H(r,tn,f=>n(3,i=f)),r.$$.on_destroy.push(()=>s());let{cfg:l}=e,{gjSchemes:u}=e;return a(),r.$$set=f=>{"cfg"in f&&n(0,l=f.cfg),"gjSchemes"in f&&a(n(1,u=f.gjSchemes))},r.$$.update=()=>{r.$$.dirty&24&&n(2,t=i==null?Jt():o.features.find(f=>f.id==i))},[l,u,t,i,o]}class ac extends ne{constructor(e){super(),re(this,e,lc,sc,x,{cfg:0,gjSchemes:1})}}function to(r){let e,n;return e=new Gr({props:{openOn:"hover",openIfTopMost:!0,$$slots:{default:[uc,({features:t})=>({16:t}),({features:t})=>t?65536:0]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&196608&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function uc(r){let e,n,t=r[9](r[16])+"",i;return{c(){e=D("div"),n=D("p"),i=q(t),z(e,"class","govuk-prose")},m(o,s){w(o,e,s),U(e,n),U(n,i)},p(o,s){s&65536&&t!==(t=o[9](o[16])+"")&&he(i,t)},d(o){o&&k(e)}}}function fc(r){let e,n,t=r[4]&&to(r);return{c(){t&&t.c(),e=ce()},m(i,o){t&&t.m(i,o),w(i,e,o),n=!0},p(i,o){i[4]?t?(t.p(i,o),o&16&&b(t,1)):(t=to(i),t.c(),b(t,1),t.m(e.parentNode,e)):t&&(se(),y(t,1,1,()=>{t=null}),le())},i(i){n||(b(t),n=!0)},o(i){y(t),n=!1},d(i){i&&k(e),t&&t.d(i)}}}function no(r){let e,n;return e=new Gr({props:{openOn:"hover",openIfTopMost:!0,$$slots:{default:[cc,({features:t})=>({16:t}),({features:t})=>t?65536:0]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&196608&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function cc(r){let e,n,t=r[9](r[16])+"",i;return{c(){e=D("div"),n=D("p"),i=q(t),z(e,"class","govuk-prose")},m(o,s){w(o,e,s),U(e,n),U(n,i)},p(o,s){s&65536&&t!==(t=o[9](o[16])+"")&&he(i,t)},d(o){o&&k(e)}}}function pc(r){let e,n,t=r[4]&&no(r);return{c(){t&&t.c(),e=ce()},m(i,o){t&&t.m(i,o),w(i,e,o),n=!0},p(i,o){i[4]?t?(t.p(i,o),o&16&&b(t,1)):(t=no(i),t.c(),b(t,1),t.m(e.parentNode,e)):t&&(se(),y(t,1,1,()=>{t=null}),le())},i(i){n||(b(t),n=!0)},o(i){y(t),n=!1},d(i){i&&k(e),t&&t.d(i)}}}function ro(r){let e,n;return e=new Gr({props:{openOn:"hover",openIfTopMost:!0,$$slots:{default:[mc,({features:t})=>({16:t}),({features:t})=>t?65536:0]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&196608&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function mc(r){let e,n,t=r[9](r[16])+"",i;return{c(){e=D("div"),n=D("p"),i=q(t),z(e,"class","govuk-prose")},m(o,s){w(o,e,s),U(e,n),U(n,i)},p(o,s){s&65536&&t!==(t=o[9](o[16])+"")&&he(i,t)},d(o){o&&k(e)}}}function dc(r){let e,n,t=r[4]&&ro(r);return{c(){t&&t.c(),e=ce()},m(i,o){t&&t.m(i,o),w(i,e,o),n=!0},p(i,o){i[4]?t?(t.p(i,o),o&16&&b(t,1)):(t=ro(i),t.c(),b(t,1),t.m(e.parentNode,e)):t&&(se(),y(t,1,1,()=>{t=null}),le())},i(i){n||(b(t),n=!0)},o(i){y(t),n=!1},d(i){i&&k(e),t&&t.d(i)}}}function gc(r){let e,n,t,i,o,s,a,l,u,f;const c=[ae(r[0],"interventions-points"),{filter:["all",cn,r[6],r[7],r[3]]},{paint:{"circle-color":r[2],"circle-radius":On}},{hoverCursor:r[4]?"pointer":void 0},{manageHoverState:r[4]}];let p={$$slots:{default:[fc]},$$scope:{ctx:r}};for(let d=0;d(l(),l=We(h,d=>n(11,a=d)),h),f,c,p;H(r,Je,d=>n(14,f=d)),H(r,ue,d=>n(12,c=d)),H(r,rn,d=>n(13,p=d)),r.$$.on_destroy.push(()=>l());let{cfg:m}=e,{gjSchemes:h}=e;u();const $=["!=",["get","hide_while_editing"],!0],v=["!=",["get","endpoint"],!0];let M;function g(d){return Zt(["get","scheme_reference"],Object.fromEntries(Object.values(d.schemes).map(S=>[S.scheme_reference,S.color])),"black")}function _(d){c.mode!="list"||!f||d.detail.features[0]&&(f.getCanvas().style.cursor="inherit",ue.set({mode:"edit-form",id:d.detail.features[0].id}))}function E(d){if(d){let S=d[0],R=m.interventionName(S),j=m.schemeName(a.schemes[S.properties.scheme_reference]);return`${R} (${j})`}return"Tooltip bug"}return r.$$set=d=>{"cfg"in d&&n(0,m=d.cfg),"gjSchemes"in d&&u(n(1,h=d.gjSchemes))},r.$$.update=()=>{if(r.$$.dirty&2048&&n(5,t=Al(a)),r.$$.dirty&4096&&n(4,i=c.mode=="list"),r.$$.dirty&8192&&n(3,o=_c(p)),r.$$.dirty&2048&&n(10,s=g(a)),r.$$.dirty&5120){let d="grey";c.mode=="edit-form"?n(2,M=["case",["==",["id"],c.id],s,d]):c.mode=="list"?n(2,M=s):c.mode=="split-route"?n(2,M=["case",["==","intervention_type","route"],s,d]):n(2,M=d)}},[m,h,M,o,i,t,$,v,_,E,s,a,c,p]}class $c extends ne{constructor(e){super(),re(this,e,bc,hc,x,{cfg:0,gjSchemes:1})}}function vc(r){let e,n,t,i,o,s;const a=[ae(r[0],"edit-polygon-fill"),{filter:Lt},{paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}];let l={};for(let m=0;mn(1,t=o));let{cfg:i}=e;return r.$$set=o=>{"cfg"in o&&n(0,i=o.cfg)},[i,t]}class kc extends ne{constructor(e){super(),re(this,e,wc,yc,x,{cfg:0})}}function Sc(r){let e,n,t,i,o,s;const a=[ae(r[0],"route-points"),{filter:cn},{paint:{"circle-color":Zt(["get","type"],{"snapped-waypoint":"red","free-waypoint":"blue"},"black"),"circle-opacity":["case",["has","hovered"],.5,1],"circle-radius":Zt(["get","type"],{node:wn/2},wn)}}];let l={};for(let m=0;m({3:t}),({feature:t})=>t?8:0]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&24&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Pc(r){let e,n,t,i;return e=new At({props:{data:r[1],$$slots:{default:[Sc]},$$scope:{ctx:r}}}),t=new At({props:{data:r[2],$$slots:{default:[Mc]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment)},m(o,s){L(e,o,s),w(o,n,s),L(t,o,s),i=!0},p(o,[s]){const a={};s&2&&(a.data=o[1]),s&17&&(a.$$scope={dirty:s,ctx:o}),e.$set(a);const l={};s&4&&(l.data=o[2]),s&16&&(l.$$scope={dirty:s,ctx:o}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),C(e,o),C(t,o)}}}const wn=10;function io(r){var e;return(e=r.properties)==null?void 0:e.number}function Lc(r,e,n){let t,i;H(r,Ps,s=>n(1,t=s)),H(r,Cn,s=>n(2,i=s));let{cfg:o}=e;return r.$$set=s=>{"cfg"in s&&n(0,o=s.cfg)},[o,t,i]}class Cc extends ne{constructor(e){super(),re(this,e,Lc,Pc,x,{cfg:0})}}var Ac=Object.defineProperty,kt=(r,e)=>Ac(r,"name",{value:e,configurable:!0});function Wt(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return[...r.geometry.coordinates];if(r.type==="Point")return[...r.coordinates]}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return[...r];throw new Error("coord must be GeoJSON Point or an Array of numbers")}kt(Wt,"getCoord");function Fs(r){if(Array.isArray(r))return r;if(r.type==="Feature"){if(r.geometry!==null)return r.geometry.coordinates}else if(r.coordinates)return r.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}kt(Fs,"getCoords");function Ns(r){if(r.length>1&&ti(r[0])&&ti(r[1]))return!0;if(Array.isArray(r[0])&&r[0].length)return Ns(r[0]);throw new Error("coordinates must only contain numbers")}kt(Ns,"containsNumber");function Fc(r,e,n){if(!e||!n)throw new Error("type and name required");if(!r||r.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+r.type)}kt(Fc,"geojsonType");function Nc(r,e,n){if(!r)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!r.geometry||r.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+r.geometry.type)}kt(Nc,"featureOf");function Rc(r,e,n){if(!r)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!r||r.type!=="FeatureCollection")throw new Error("Invalid input to "+n+", FeatureCollection required");for(const t of r.features){if(!t||t.type!=="Feature"||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}}kt(Rc,"collectionOf");function Oc(r){return r.type==="Feature"?r.geometry:r}kt(Oc,"getGeom");function Ic(r,e){return r.type==="FeatureCollection"?"FeatureCollection":r.type==="GeometryCollection"?"GeometryCollection":r.type==="Feature"&&r.geometry!==null?r.geometry.type:r.type}kt(Ic,"getType");var jc=Object.defineProperty,Rs=(r,e)=>jc(r,"name",{value:e,configurable:!0});function Zr(r,e,n={}){if(n.final===!0)return Os(r,e);const t=Wt(r),i=Wt(e),o=Ue(t[0]),s=Ue(i[0]),a=Ue(t[1]),l=Ue(i[1]),u=Math.sin(s-o)*Math.cos(l),f=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(s-o);return dr(Math.atan2(u,f))}Rs(Zr,"bearing");function Os(r,e){let n=Zr(e,r);return n=(n+180)%360,n}Rs(Os,"calculateFinalBearing");var Bc=Object.defineProperty,qc=(r,e)=>Bc(r,"name",{value:e,configurable:!0});function Ut(r,e,n={}){var t=Wt(r),i=Wt(e),o=Ue(i[1]-t[1]),s=Ue(i[0]-t[0]),a=Ue(t[1]),l=Ue(i[1]),u=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(l);return dl(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),n.units)}qc(Ut,"distance");var Gc=Object.defineProperty,Tc=(r,e)=>Gc(r,"name",{value:e,configurable:!0});function Ir(r,e,n,t={}){const i=Wt(r),o=Ue(i[0]),s=Ue(i[1]),a=Ue(n),l=gl(e,t.units),u=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(a)),f=o+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(u)),c=dr(f),p=dr(u);return Ge([c,p],t.properties)}Tc(Ir,"destination");class Is{constructor(e=[],n=Uc){if(this.data=e,this.length=this.data.length,this.compare=n,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:n,compare:t}=this,i=n[e];for(;e>0;){const o=e-1>>1,s=n[o];if(t(i,s)>=0)break;n[e]=s,e=o}n[e]=i}_down(e){const{data:n,compare:t}=this,i=this.length>>1,o=n[e];for(;e=0)break;n[e]=a,e=s}n[e]=o}}function Uc(r,e){return re?1:0}function js(r,e){return r.p.x>e.p.x?1:r.p.xe.p.y?1:-1:1}function Dc(r,e){return r.rightSweepEvent.p.x>e.rightSweepEvent.p.x?1:r.rightSweepEvent.p.x0?(f.isLeftEndpoint=!0,u.isLeftEndpoint=!1):(u.isLeftEndpoint=!0,f.isLeftEndpoint=!1),e.push(u),e.push(f),s=a,En=En+1}}kn=kn+1}class Jc{constructor(e){this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}}function Yc(r,e){if(r===null||e===null||r.leftSweepEvent.ringId===e.leftSweepEvent.ringId&&(r.rightSweepEvent.isSamePoint(e.leftSweepEvent)||r.rightSweepEvent.isSamePoint(e.leftSweepEvent)||r.rightSweepEvent.isSamePoint(e.rightSweepEvent)||r.leftSweepEvent.isSamePoint(e.leftSweepEvent)||r.leftSweepEvent.isSamePoint(e.rightSweepEvent)))return!1;const n=r.leftSweepEvent.p.x,t=r.leftSweepEvent.p.y,i=r.rightSweepEvent.p.x,o=r.rightSweepEvent.p.y,s=e.leftSweepEvent.p.x,a=e.leftSweepEvent.p.y,l=e.rightSweepEvent.p.x,u=e.rightSweepEvent.p.y,f=(u-a)*(i-n)-(l-s)*(o-t),c=(l-s)*(t-a)-(u-a)*(n-s),p=(i-n)*(t-a)-(o-t)*(n-s);if(f===0)return!1;const m=c/f,h=p/f;if(m>=0&&m<=1&&h>=0&&h<=1){const $=n+m*(i-n),v=t+m*(o-t);return[$,v]}return!1}function Xc(r,e){e=e||!1;const n=[],t=new Is([],Dc);for(;r.length;){const i=r.pop();if(i.isLeftEndpoint){const o=new Jc(i);for(let s=0;sKc(r,"name",{value:e,configurable:!0}),Zc=Wc;function Bs(r,e,n={}){const{removeDuplicates:t=!0,ignoreSelfIntersections:i=!1}=n;let o=[];r.type==="FeatureCollection"?o=o.concat(r.features):r.type==="Feature"?o.push(r):(r.type==="LineString"||r.type==="Polygon"||r.type==="MultiLineString"||r.type==="MultiPolygon")&&o.push(In(r)),e.type==="FeatureCollection"?o=o.concat(e.features):e.type==="Feature"?o.push(e):(e.type==="LineString"||e.type==="Polygon"||e.type==="MultiLineString"||e.type==="MultiPolygon")&&o.push(In(e));const s=Zc(ni(o),i);let a=[];if(t){const l={};s.forEach(u=>{const f=u.join(",");l[f]||(l[f]=!0,a.push(u))})}else a=s;return ni(a.map(l=>Ge(l)))}Hc(Bs,"lineIntersect");var Vc=Object.defineProperty,Ee=(r,e)=>Vc(r,"name",{value:e,configurable:!0});function hn(r,e,n){if(r!==null)for(var t,i,o,s,a,l,u,f=0,c=0,p,m=r.type,h=m==="FeatureCollection",$=m==="Feature",v=h?r.features.length:1,M=0;Ml||h>u||$>f){a=c,l=t,u=h,f=$,o=0;return}var v=ht([a,c],n.properties);if(e(v,t,i,$,o)===!1)return!1;o++,a=c})===!1)return!1}}})}Ee(Ts,"segmentEach");function ip(r,e,n){var t=n,i=!1;return Ts(r,function(o,s,a,l,u){i===!1&&n===void 0?t=o:t=e(t,o,s,a,l,u),i=!0}),t}Ee(ip,"segmentReduce");function Us(r,e){if(!r)throw new Error("geojson is required");_n(r,function(n,t,i){if(n.geometry!==null){var o=n.geometry.type,s=n.geometry.coordinates;switch(o){case"LineString":if(e(n,t,i,0,0)===!1)return!1;break;case"Polygon":for(var a=0;ae in r?Ds(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n,St=(r,e)=>{for(var n in e||(e={}))fp.call(e,n)&&ao(r,n,e[n]);if(lo)for(var n of lo(e))cp.call(e,n)&&ao(r,n,e[n]);return r},Et=(r,e)=>ap(r,up(e)),pp=(r,e)=>Ds(r,"name",{value:e,configurable:!0});function zs(r,e,n={}){if(!r||!e)throw new Error("lines and pt are required arguments");let t=Ge([1/0,1/0],{dist:1/0,index:-1,location:-1}),i=0;return _n(r,function(o){const s=Fs(o);for(let a=0;a0&&$.features[0]&&(v=Et(St({},$.features[0]),{properties:{dist:Ut(e,$.features[0],n),location:i+Ut(l,$.features[0],n)}})),l.properties.dist(i(),i=We(l,v=>n(8,t=v)),l),s;H(r,Je,v=>n(9,s=v)),r.$$.on_destroy.push(()=>i());let{cfg:a}=e,{gjSchemes:l}=e;o(),it(()=>{s&&(s.getCanvas().style.cursor=`url(${Js}), crosshair`)}),Xe(()=>{s&&(s.getCanvas().style.cursor="inherit")});let u=null,f=null,c=Jt();function p(v){if(!s)return;n(6,u=null),f=null;let M=$(v.detail.lngLat.toArray());const g=[v.detail.point.x-hp,v.detail.point.y],_=s.unproject(v.detail.point).distanceTo(s.unproject(g))/1e3;let E=[];for(let[d,S]of t.features.entries())if(S.geometry.type=="LineString"){let R=mp(S.geometry,M,{units:"kilometers"});R.properties.dist!=null&&R.properties.dist<=_&&E.push([d,R.geometry.coordinates,R.properties.dist])}E.sort((d,S)=>d[2]-S[2]),E.length>0&&(n(6,u=$(E[0][1])),f=E[0][0])}function m(){if(f==null){ue.set({mode:"list"});return}let v=gu(t.features[f],u);if(v!=null){let[M,g]=v;l.update(_=>(M.id=_.features[f].id,g.id=dn(_),_.features.splice(f,1,M,g),_))}n(6,u=null),f=null}function h(v){v.key=="Escape"&&(v.stopPropagation(),ue.set({mode:"list"}))}function $(v){return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:To(v)}}}return r.$$set=v=>{"cfg"in v&&n(0,a=v.cfg),"gjSchemes"in v&&o(n(1,l=v.gjSchemes))},r.$$.update=()=>{if(r.$$.dirty&64){let v=Jt();u&&v.features.push(u),n(2,c=v)}},[a,l,c,p,m,h,u]}class bp extends ne{constructor(e){super(),re(this,e,_p,gp,x,{cfg:0,gjSchemes:1})}}function $p(r){let e;return{c(){e=q("Finish")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function vp(r){let e,n;return e=new Nl({}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function yp(r){let e,n,t,i,o,s,a,l,u,f,c;function p(v){r[4](v)}let m={cfg:r[0],map:r[2],showControls:!1};r[1]!==void 0&&(m.enabled=r[1]),e=new Fl({props:m}),V.push(()=>te(e,"enabled",p)),o=new mt({props:{$$slots:{default:[$p]},$$scope:{ctx:r}}}),o.$on("click",r[5]);function h(v){r[6](v)}let $={label:"Source",choices:[["google","Google Street View"],["bing","Bing Streetside"]],inlineSmall:!0};return r[3].streetViewImagery!==void 0&&($.value=r[3].streetViewImagery),a=new Nt({props:$}),V.push(()=>te(a,"value",h)),f=new Kt({props:{$$slots:{default:[vp]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment),t=N(),i=D("div"),P(o.$$.fragment),s=N(),P(a.$$.fragment),u=N(),P(f.$$.fragment),Oe(i,"display","flex")},m(v,M){L(e,v,M),w(v,t,M),w(v,i,M),L(o,i,null),U(i,s),L(a,i,null),U(i,u),L(f,i,null),c=!0},p(v,[M]){const g={};M&1&&(g.cfg=v[0]),M&4&&(g.map=v[2]),!n&&M&2&&(n=!0,g.enabled=v[1],ie(()=>n=!1)),e.$set(g);const _={};M&128&&(_.$$scope={dirty:M,ctx:v}),o.$set(_);const E={};!l&&M&8&&(l=!0,E.value=v[3].streetViewImagery,ie(()=>l=!1)),a.$set(E);const d={};M&128&&(d.$$scope={dirty:M,ctx:v}),f.$set(d)},i(v){c||(b(e.$$.fragment,v),b(o.$$.fragment,v),b(a.$$.fragment,v),b(f.$$.fragment,v),c=!0)},o(v){y(e.$$.fragment,v),y(o.$$.fragment,v),y(a.$$.fragment,v),y(f.$$.fragment,v),c=!1},d(v){v&&(k(t),k(i)),C(e,v),C(o),C(a),C(f)}}}function wp(r,e,n){let t,i;H(r,Je,f=>n(2,t=f)),H(r,ri,f=>n(3,i=f));let{cfg:o}=e,s=!0;function a(f){s=f,n(1,s)}const l=()=>n(1,s=!1);function u(f){r.$$.not_equal(i.streetViewImagery,f)&&(i.streetViewImagery=f,ri.set(i))}return r.$$set=f=>{"cfg"in f&&n(0,o=f.cfg)},r.$$.update=()=>{r.$$.dirty&2&&(s||ue.set({mode:"list"}))},[o,s,t,i,a,l,u]}class kp extends ne{constructor(e){super(),re(this,e,wp,yp,x,{cfg:0})}}const Sp="/atip/move_draw_controls/assets/image-3e3a13e8.svg",Ep="/atip/move_draw_controls/assets/point-276f4055.svg",Mp="/atip/move_draw_controls/assets/polygon_freehand-cf965967.svg",Pp="/atip/move_draw_controls/assets/polygon_snapped-18efbbea.svg",Lp="/atip/move_draw_controls/assets/route-d3c0ebad.svg",Cp="/atip/move_draw_controls/assets/street_view-48580b6a.svg";function Ap(r){let e;return{c(){e=q("Save")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Fp(r){let e;return{c(){e=q("Delete")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Np(r){let e,n,t,i;return e=new mt({props:{$$slots:{default:[Ap]},$$scope:{ctx:r}}}),e.$on("click",r[6]),t=new wt({props:{disabled:!r[2],$$slots:{default:[Fp]},$$scope:{ctx:r}}}),t.$on("click",r[4]),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment)},m(o,s){L(e,o,s),w(o,n,s),L(t,o,s),i=!0},p(o,s){const a={};s&512&&(a.$$scope={dirty:s,ctx:o}),e.$set(a);const l={};s&4&&(l.disabled=!o[2]),s&512&&(l.$$scope={dirty:s,ctx:o}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),C(e,o),C(t,o)}}}function Rp(r){let e,n,t;return{c(){e=D("input"),z(e,"class","govuk-file-upload"),z(e,"id","load-image"),z(e,"type","file")},m(i,o){w(i,e,o),r[7](e),n||(t=$e(e,"change",r[3]),n=!0)},p:Q,d(i){i&&k(e),r[7](null),n=!1,t()}}}function fo(r){let e,n,t,i,o,s,a,l;return{c(){e=D("div"),n=D("label"),t=D("input"),i=q(` - Opacity: `),o=q(r[1]),s=q("%"),z(t,"type","range"),z(t,"min","0"),z(t,"max","100")},m(u,f){w(u,e,f),U(e,n),U(n,t),Pe(t,r[1]),U(n,i),U(n,o),U(n,s),a||(l=[$e(t,"change",r[8]),$e(t,"input",r[8])],a=!0)},p(u,f){f&2&&Pe(t,u[1]),f&2&&he(o,u[1])},d(u){u&&k(e),a=!1,xn(l)}}}function Op(r){let e,n,t,i,o,s,a,l,u;e=new Ke({props:{$$slots:{default:[Np]},$$scope:{ctx:r}}}),t=new Ot({props:{label:"Load an image",id:"load-image",$$slots:{default:[Rp]},$$scope:{ctx:r}}});let f=r[2]&&fo(r);return{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment),i=N(),f&&f.c(),o=N(),s=D("p"),s.textContent=`Note this image isn't saved as part of this scheme. When you close this page, - it'll be lost.`},m(c,p){L(e,c,p),w(c,n,p),L(t,c,p),w(c,i,p),f&&f.m(c,p),w(c,o,p),w(c,s,p),a=!0,l||(u=$e(window,"keydown",r[5]),l=!0)},p(c,[p]){const m={};p&516&&(m.$$scope={dirty:p,ctx:c}),e.$set(m);const h={};p&513&&(h.$$scope={dirty:p,ctx:c}),t.$set(h),c[2]?f?f.p(c,p):(f=fo(c),f.c(),f.m(o.parentNode,o)):f&&(f.d(1),f=null)},i(c){a||(b(e.$$.fragment,c),b(t.$$.fragment,c),a=!0)},o(c){y(e.$$.fragment,c),y(t.$$.fragment,c),a=!1},d(c){c&&(k(n),k(i),k(o),k(s)),C(e,c),C(t,c),f&&f.d(c),l=!1,u()}}}function Ip(r,e,n){let t,i;H(r,Fn,p=>n(1,t=p)),H(r,An,p=>n(2,i=p));let o;async function s(p){let m=await o.files[0].arrayBuffer(),h=new Blob([new Uint8Array(m)]);Be(An,i=URL.createObjectURL(h),i)}function a(){Be(An,i=null,i),Be(Fn,t=100,t)}function l(p){p.key=="Escape"&&(p.stopPropagation(),ue.set({mode:"list"}))}const u=()=>ue.set({mode:"list"});function f(p){V[p?"unshift":"push"](()=>{o=p,n(0,o)})}function c(){t=_l(this.value),Fn.set(t)}return[o,t,i,s,a,l,u,f,c]}class jp extends ne{constructor(e){super(),re(this,e,Ip,Op,x,{})}}function Bp(r){let e,n;return e=new Es({props:{editingExisting:!1,cancel:r[0]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function qp(r,e,n){let t;H(r,Rn,l=>n(3,t=l));let{cfg:i}=e,{gjSchemes:o}=e;it(()=>{t.start(),t.addEventListenerSuccess(s),t.addEventListenerFailure(a)}),Xe(()=>{t.stop(),t.clearEventListeners()});function s(l){l.properties||(l.properties={});let u=l;o.update(f=>(u.id=dn(f),u.properties.scheme_reference=tr(f),i.newPointFeature(u),f.features.push(u),f)),ue.set({mode:"edit-form",id:u.id})}function a(){ue.set({mode:"list"})}return r.$$set=l=>{"cfg"in l&&n(1,i=l.cfg),"gjSchemes"in l&&n(2,o=l.gjSchemes)},[a,i,o]}class Gp extends ne{constructor(e){super(),re(this,e,qp,Bp,x,{cfg:1,gjSchemes:2})}}function Tp(r){let e,n;return e=new Ms({props:{finish:r[1],cancel:r[0]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Up(r,e,n){let t;H(r,un,u=>n(4,t=u));let{cfg:i}=e,{gjSchemes:o}=e;it(()=>{t.startNew(),t.addEventListenerSuccess(s),t.addEventListenerFailure(a)}),Xe(()=>{t.stop(),t.clearEventListeners()});function s(u){u.properties||(u.properties={});let f=u;o.update(c=>(f.id=dn(c),f.properties.scheme_reference=tr(c),i.newPolygonFeature(f),c.features.push(f),c)),ue.set({mode:"edit-form",id:f.id})}function a(){ue.set({mode:"list"})}function l(){t.finish()}return r.$$set=u=>{"cfg"in u&&n(2,i=u.cfg),"gjSchemes"in u&&n(3,o=u.gjSchemes)},[a,l,i,o]}class Dp extends ne{constructor(e){super(),re(this,e,Up,Tp,x,{cfg:2,gjSchemes:3})}}function zp(r){let e,n;return e=new Cs({props:{maptilerApiKey:r[0].maptilerApiKey,extendRoute:!0,finish:r[2],cancel:r[1]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,[i]){const o={};i&1&&(o.maptilerApiKey=t[0].maptilerApiKey),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Jp(r,e,n){let t;H(r,rt,u=>n(4,t=u));let{cfg:i}=e,{gjSchemes:o}=e;it(()=>{t.startRoute(),t.addEventListenerSuccess(s),t.addEventListenerFailure(a)}),Xe(()=>{t.stop(),t.clearEventListeners()});function s(u){let f=u;o.update(c=>(f.id=dn(c),f.properties.scheme_reference=tr(c),i.newLineStringFeature(f),c.features.push(f),c)),ue.set({mode:"edit-form",id:f.id})}function a(){ue.set({mode:"list"})}function l(){t.finish()}return r.$$set=u=>{"cfg"in u&&n(0,i=u.cfg),"gjSchemes"in u&&n(3,o=u.gjSchemes)},[i,a,l,o]}class Yp extends ne{constructor(e){super(),re(this,e,Jp,zp,x,{cfg:0,gjSchemes:3})}}function Xp(r){let e,n;return e=new As({props:{finish:r[1],cancel:r[0]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Wp(r,e,n){let t;H(r,rt,u=>n(4,t=u));let{cfg:i}=e,{gjSchemes:o}=e;it(()=>{t.startArea(),t.addEventListenerSuccess(s),t.addEventListenerFailure(a)}),Xe(()=>{t.stop(),t.clearEventListeners()});function s(u){let f=u;o.update(c=>(f.id=dn(c),f.properties.scheme_reference=tr(c),i.newPolygonFeature(f),c.features.push(f),c)),ue.set({mode:"edit-form",id:f.id})}function a(){ue.set({mode:"list"})}function l(){t.finish()}return r.$$set=u=>{"cfg"in u&&n(2,i=u.cfg),"gjSchemes"in u&&n(3,o=u.gjSchemes)},[a,l,i,o]}class Kp extends ne{constructor(e){super(),re(this,e,Wp,Xp,x,{cfg:2,gjSchemes:3})}}function Hp(r){let e,n;return e=new Ye({props:{errorMessage:"Failed to load route snapper"}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Zp(r){let e,n,t;return{c(){e=D("label"),e.textContent="Route data unpacking",n=N(),t=D("progress"),z(e,"for","route-unpacking"),z(t,"id","route-unpacking"),z(t,"class","svelte-q3473n")},m(i,o){w(i,e,o),w(i,n,o),w(i,t,o)},p:Q,i:Q,o:Q,d(i){i&&(k(e),k(n),k(t))}}}function Vp(r){let e,n,t;return{c(){e=D("label"),e.textContent="Route tool loading",n=N(),t=D("progress"),z(e,"for","route-loading"),z(t,"id","route-loading"),t.value=r[0],z(t,"class","svelte-q3473n")},m(i,o){w(i,e,o),w(i,n,o),w(i,t,o)},p(i,o){o&1&&(t.value=i[0])},i:Q,o:Q,d(i){i&&(k(e),k(n),k(t))}}}function Qp(r){let e,n,t,i;const o=[Vp,Zp,Hp],s=[];function a(l,u){return!l[1]&&!l[2]&&!l[3]?0:l[3]&&!l[1]&&!l[2]?1:l[2]?2:-1}return~(e=a(r))&&(n=s[e]=o[e](r)),{c(){n&&n.c(),t=ce()},m(l,u){~e&&s[e].m(l,u),w(l,t,u),i=!0},p(l,[u]){let f=e;e=a(l),e===f?~e&&s[e].p(l,u):(n&&(se(),y(s[f],1,1,()=>{s[f]=null}),le()),~e?(n=s[e],n?n.p(l,u):(n=s[e]=o[e](l),n.c()),b(n,1),n.m(t.parentNode,t)):n=null)},i(l){i||(b(n),i=!0)},o(l){y(n),i=!1},d(l){l&&k(t),~e&&s[e].d(l)}}}function xp(r,e,n){let t,{map:i}=e,{url:o}=e,s=0,a=!1,l=!1;return it(async()=>{await $s(),console.log(`Grabbing ${o}`);try{const u=await $u(o,f=>{n(0,s=f)});rt.set(new bu(i,u,Ps,Ls,Hr)),n(0,s=100),n(1,a=!0)}catch(u){console.log(`Route tool broke: ${u}`),n(2,l=!0)}}),r.$$set=u=>{"map"in u&&n(4,i=u.map),"url"in u&&n(5,o=u.url)},r.$$.update=()=>{r.$$.dirty&1&&n(3,t=s>=100)},[s,a,l,t,i,o]}class em extends ne{constructor(e){super(),re(this,e,xp,Qp,x,{map:4,url:5})}}function tm(r){let e;const n=r[3].default,t=at(n,r,r[5],null);return{c(){t&&t.c()},m(i,o){t&&t.m(i,o),e=!0},p(i,o){t&&t.p&&(!e||o&32)&&ut(t,n,i,i[5],e?ct(n,i[5],o,null):ft(i[5]),null)},i(i){e||(b(t,i),e=!0)},o(i){y(t,i),e=!1},d(i){t&&t.d(i)}}}function nm(r){let e,n;const t=r[3].default,i=at(t,r,r[5],null);return{c(){e=D("b"),i&&i.c()},m(o,s){w(o,e,s),i&&i.m(e,null),n=!0},p(o,s){i&&i.p&&(!n||s&32)&&ut(i,t,o,o[5],n?ct(t,o[5],s,null):ft(o[5]),null)},i(o){n||(b(i,o),n=!0)},o(o){y(i,o),n=!1},d(o){o&&k(e),i&&i.d(o)}}}function rm(r){let e,n,t,i;const o=[nm,tm],s=[];function a(l,u){return l[2]==l[0]?0:1}return e=a(r),n=s[e]=o[e](r),{c(){n.c(),t=ce()},m(l,u){s[e].m(l,u),w(l,t,u),i=!0},p(l,u){let f=e;e=a(l),e===f?s[e].p(l,u):(se(),y(s[f],1,1,()=>{s[f]=null}),le(),n=s[e],n?n.p(l,u):(n=s[e]=o[e](l),n.c()),b(n,1),n.m(t.parentNode,t))},i(l){i||(b(n),i=!0)},o(l){y(n),i=!1},d(l){l&&k(t),s[e].d(l)}}}function im(r){let e,n;return e=new Wl({props:{disabled:r[1]||r[2].mode!="list",$$slots:{default:[rm]},$$scope:{ctx:r}}}),e.$on("click",r[4]),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,[i]){const o={};i&6&&(o.disabled=t[1]||t[2].mode!="list"),i&37&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function om(r,e,n){let t;H(r,ue,u=>n(2,t=u));let{$$slots:i={},$$scope:o}=e,{setMode:s}=e,{disabled:a=!1}=e;const l=()=>ue.set(s);return r.$$set=u=>{"setMode"in u&&n(0,s=u.setMode),"disabled"in u&&n(1,a=u.disabled),"$$scope"in u&&n(5,o=u.$$scope)},[s,a,t,i,l,o]}class Mt extends ne{constructor(e){super(),re(this,e,om,im,x,{setMode:0,disabled:1})}}function co(r){let e,n;return e=new em({props:{map:r[5],url:r[2]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&32&&(o.map=t[5]),i&4&&(o.url=t[2]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function sm(r){let e,n,t;return{c(){e=D("img"),t=q(` - New point`),ot(e.src,n=Ep)||z(e,"src",n),z(e,"alt","New point")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function lm(r){let e,n,t;return{c(){e=D("img"),t=q(` - New route`),ot(e.src,n=Lp)||z(e,"src",n),z(e,"alt","New route")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function am(r){let e,n,t;return{c(){e=D("img"),t=q(` - New polygon (freehand)`),ot(e.src,n=Mp)||z(e,"src",n),z(e,"alt","New polygon (freehand)")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function um(r){let e,n,t;return{c(){e=D("img"),t=q(` - New polygon (snapped)`),ot(e.src,n=Pp)||z(e,"src",n),z(e,"alt","New polygon (snapped)")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function fm(r){let e,n,t;return{c(){e=D("img"),t=q(` - Split route`),ot(e.src,n=Js)||z(e,"src",n),z(e,"alt","Split route")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function cm(r){let e,n,t;return{c(){e=D("img"),t=q(` - Georeference image`),ot(e.src,n=Sp)||z(e,"src",n),z(e,"alt","Georeference image")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function pm(r){let e,n,t;return{c(){e=D("img"),t=q(` - StreetView`),ot(e.src,n=Cp)||z(e,"src",n),z(e,"alt","StreetView")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function mm(r){let e,n;return e=new kp({props:{cfg:r[0]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.cfg=t[0]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function dm(r){let e,n;return e=new jp({}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function gm(r){let e,n,t,i;return e=new mt({props:{$$slots:{default:[ym]},$$scope:{ctx:r}}}),e.$on("click",r[8]),t=new Kt({props:{$$slots:{default:[wm]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment)},m(o,s){L(e,o,s),w(o,n,s),L(t,o,s),i=!0},p(o,s){const a={};s&512&&(a.$$scope={dirty:s,ctx:o}),e.$set(a);const l={};s&512&&(l.$$scope={dirty:s,ctx:o}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),C(e,o),C(t,o)}}}function hm(r){let e,n;return e=new Kp({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.cfg=t[0]),i&2&&(o.gjSchemes=t[1]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function _m(r){let e,n;return e=new Dp({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.cfg=t[0]),i&2&&(o.gjSchemes=t[1]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function bm(r){let e,n;return e=new Yp({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.cfg=t[0]),i&2&&(o.gjSchemes=t[1]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function $m(r){let e,n;return e=new Gp({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.cfg=t[0]),i&2&&(o.gjSchemes=t[1]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function vm(r){let e,n;return e=new Qf({props:{cfg:r[0],gjSchemes:r[1],id:r[7].id}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.cfg=t[0]),i&2&&(o.gjSchemes=t[1]),i&128&&(o.id=t[7].id),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function ym(r){let e;return{c(){e=q("Finish")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function wm(r){let e;return{c(){e=D("ul"),e.innerHTML=`
  • Click - on a route to split it
  • Click - on the map or press - Escape - to cancel
  • `},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function km(r){let e,n,t,i,o,s,a,l,u,f,c,p,m,h,$,v,M,g,_,E,d,S,R;e=new ac({props:{cfg:r[0],gjSchemes:r[1]}});let j=r[5]&&co(r);a=new Mt({props:{setMode:{mode:"new-point"},disabled:!r[4],$$slots:{default:[sm]},$$scope:{ctx:r}}}),u=new Mt({props:{setMode:{mode:"new-route"},disabled:!r[6],$$slots:{default:[lm]},$$scope:{ctx:r}}}),c=new Mt({props:{setMode:{mode:"new-freehand-polygon"},disabled:!r[3],$$slots:{default:[am]},$$scope:{ctx:r}}}),m=new Mt({props:{setMode:{mode:"new-snapped-polygon"},disabled:!r[6],$$slots:{default:[um]},$$scope:{ctx:r}}}),$=new Mt({props:{setMode:{mode:"split-route"},$$slots:{default:[fm]},$$scope:{ctx:r}}}),M=new Mt({props:{setMode:{mode:"set-image"},$$slots:{default:[cm]},$$scope:{ctx:r}}}),_=new Mt({props:{setMode:{mode:"streetview"},$$slots:{default:[pm]},$$scope:{ctx:r}}});const T=[vm,$m,bm,_m,hm,gm,dm,mm],B=[];function O(A,F){return A[7].mode=="edit-geometry"?0:A[7].mode=="new-point"?1:A[7].mode=="new-route"?2:A[7].mode=="new-freehand-polygon"?3:A[7].mode=="new-snapped-polygon"?4:A[7].mode=="split-route"?5:A[7].mode=="set-image"?6:A[7].mode=="streetview"?7:-1}return~(d=O(r))&&(S=B[d]=T[d](r)),{c(){P(e.$$.fragment),n=N(),t=D("div"),i=D("div"),j&&j.c(),o=N(),s=D("div"),P(a.$$.fragment),l=N(),P(u.$$.fragment),f=N(),P(c.$$.fragment),p=N(),P(m.$$.fragment),h=N(),P($.$$.fragment),v=N(),P(M.$$.fragment),g=N(),P(_.$$.fragment),E=N(),S&&S.c(),Oe(i,"visibility",r[7].mode=="list"?"visible":"hidden"),z(s,"class","toolbar svelte-13k6o8k"),z(t,"class","top govuk-prose svelte-13k6o8k")},m(A,F){L(e,A,F),w(A,n,F),w(A,t,F),U(t,i),j&&j.m(i,null),U(t,o),U(t,s),L(a,s,null),U(s,l),L(u,s,null),U(s,f),L(c,s,null),U(s,p),L(m,s,null),U(s,h),L($,s,null),U(s,v),L(M,s,null),U(s,g),L(_,s,null),U(t,E),~d&&B[d].m(t,null),R=!0},p(A,[F]){const I={};F&1&&(I.cfg=A[0]),F&2&&(I.gjSchemes=A[1]),e.$set(I),A[5]?j?(j.p(A,F),F&32&&b(j,1)):(j=co(A),j.c(),b(j,1),j.m(i,null)):j&&(se(),y(j,1,1,()=>{j=null}),le()),F&128&&Oe(i,"visibility",A[7].mode=="list"?"visible":"hidden");const X={};F&16&&(X.disabled=!A[4]),F&512&&(X.$$scope={dirty:F,ctx:A}),a.$set(X);const J={};F&64&&(J.disabled=!A[6]),F&512&&(J.$$scope={dirty:F,ctx:A}),u.$set(J);const ee={};F&8&&(ee.disabled=!A[3]),F&512&&(ee.$$scope={dirty:F,ctx:A}),c.$set(ee);const G={};F&64&&(G.disabled=!A[6]),F&512&&(G.$$scope={dirty:F,ctx:A}),m.$set(G);const fe={};F&512&&(fe.$$scope={dirty:F,ctx:A}),$.$set(fe);const me={};F&512&&(me.$$scope={dirty:F,ctx:A}),M.$set(me);const _e={};F&512&&(_e.$$scope={dirty:F,ctx:A}),_.$set(_e);let be=d;d=O(A),d===be?~d&&B[d].p(A,F):(S&&(se(),y(B[be],1,1,()=>{B[be]=null}),le()),~d?(S=B[d],S?S.p(A,F):(S=B[d]=T[d](A),S.c()),b(S,1),S.m(t,null)):S=null)},i(A){R||(b(e.$$.fragment,A),b(j),b(a.$$.fragment,A),b(u.$$.fragment,A),b(c.$$.fragment,A),b(m.$$.fragment,A),b($.$$.fragment,A),b(M.$$.fragment,A),b(_.$$.fragment,A),b(S),R=!0)},o(A){y(e.$$.fragment,A),y(j),y(a.$$.fragment,A),y(u.$$.fragment,A),y(c.$$.fragment,A),y(m.$$.fragment,A),y($.$$.fragment,A),y(M.$$.fragment,A),y(_.$$.fragment,A),y(S),R=!1},d(A){A&&(k(n),k(t)),C(e,A),j&&j.d(),C(a),C(u),C(c),C(m),C($),C(M),C(_),~d&&B[d].d()}}}function Sm(r,e,n){let t,i,o,s,a;H(r,rt,p=>n(6,t=p)),H(r,un,p=>n(3,i=p)),H(r,Rn,p=>n(4,o=p)),H(r,Je,p=>n(5,s=p)),H(r,ue,p=>n(7,a=p));let{cfg:l}=e,{gjSchemes:u}=e,{routeSnapperUrl:f}=e;Xe(()=>{o==null||o.tearDown(),i==null||i.tearDown(),t==null||t.tearDown()});const c=()=>ue.set({mode:"list"});return r.$$set=p=>{"cfg"in p&&n(0,l=p.cfg),"gjSchemes"in p&&n(1,u=p.gjSchemes),"routeSnapperUrl"in p&&n(2,f=p.routeSnapperUrl)},r.$$.update=()=>{r.$$.dirty&48&&s&&!o&&Rn.set(new fa(s)),r.$$.dirty&40&&s&&!i&&un.set(new Ua(s))},[l,u,f,i,o,s,t,a,c]}class Em extends ne{constructor(e){super(),re(this,e,Sm,km,x,{cfg:0,gjSchemes:1,routeSnapperUrl:2})}}const Mm="/atip/move_draw_controls/assets/delete-3c023172.svg",Pm="/atip/move_draw_controls/assets/save-74d8f3c2.svg";function po(r){let e,n;return e=new ge({props:{disabled:!r[2],$$slots:{default:[Lm]},$$scope:{ctx:r}}}),e.$on("click",r[7]),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&4&&(o.disabled=!t[2]),i&4096&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Lm(r){let e;return{c(){e=q("Auto-fill")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Cm(r){let e,n,t,i,o,s,a=r[0].length_meters&&po(r);return{c(){e=D("input"),n=N(),a&&a.c(),t=ce(),z(e,"type","text"),z(e,"class","govuk-input"),z(e,"id",r[5])},m(l,u){w(l,e,u),Pe(e,r[0].name),w(l,n,u),a&&a.m(l,u),w(l,t,u),i=!0,o||(s=$e(e,"input",r[6]),o=!0)},p(l,u){u&1&&e.value!==l[0].name&&Pe(e,l[0].name),l[0].length_meters?a?(a.p(l,u),u&1&&b(a,1)):(a=po(l),a.c(),b(a,1),a.m(t.parentNode,t)):a&&(se(),y(a,1,1,()=>{a=null}),le())},i(l){i||(b(a),i=!0)},o(l){y(a),i=!1},d(l){l&&(k(e),k(n),k(t)),a&&a.d(l),o=!1,s()}}}function mo(r){let e,n,t=Bn(r[0].length_meters)+"",i;return{c(){e=D("p"),n=q("Length: "),i=q(t)},m(o,s){w(o,e,s),U(e,n),U(e,i)},p(o,s){s&1&&t!==(t=Bn(o[0].length_meters)+"")&&he(i,t)},d(o){o&&k(e)}}}function Am(r){let e,n,t,i,o,s,a,l,u,f,c,p,m;e=new Ot({props:{label:"Name",id:r[5],$$slots:{default:[Cm]},$$scope:{ctx:r}}});function h(d){r[9](d)}let $={label:"Scheme",choices:Object.values(r[3].schemes).map(r[8])};r[0].scheme_reference!==void 0&&($.value=r[0].scheme_reference),t=new nr({props:$}),V.push(()=>te(t,"value",h));function v(d){r[10](d)}let M={label:"Type",choices:[["area","Area"],["route","Route"],["crossing","Crossing"],["other","Other"]],inlineSmall:!0,required:!0};r[0].intervention_type!==void 0&&(M.value=r[0].intervention_type),s=new Nt({props:M}),V.push(()=>te(s,"value",v));function g(d){r[11](d)}let _={label:"Description"};r[0].description!==void 0&&(_.value=r[0].description),u=new Ur({props:_}),V.push(()=>te(u,"value",g));let E=r[0].length_meters&&mo(r);return{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment),o=N(),P(s.$$.fragment),l=N(),P(u.$$.fragment),c=N(),E&&E.c(),p=ce()},m(d,S){L(e,d,S),w(d,n,S),L(t,d,S),w(d,o,S),L(s,d,S),w(d,l,S),L(u,d,S),w(d,c,S),E&&E.m(d,S),w(d,p,S),m=!0},p(d,[S]){const R={};S&4101&&(R.$$scope={dirty:S,ctx:d}),e.$set(R);const j={};S&8&&(j.choices=Object.values(d[3].schemes).map(d[8])),!i&&S&1&&(i=!0,j.value=d[0].scheme_reference,ie(()=>i=!1)),t.$set(j);const T={};!a&&S&1&&(a=!0,T.value=d[0].intervention_type,ie(()=>a=!1)),s.$set(T);const B={};!f&&S&1&&(f=!0,B.value=d[0].description,ie(()=>f=!1)),u.$set(B),d[0].length_meters?E?E.p(d,S):(E=mo(d),E.c(),E.m(p.parentNode,p)):E&&(E.d(1),E=null)},i(d){m||(b(e.$$.fragment,d),b(t.$$.fragment,d),b(s.$$.fragment,d),b(u.$$.fragment,d),m=!0)},o(d){y(e.$$.fragment,d),y(t.$$.fragment,d),y(s.$$.fragment,d),y(u.$$.fragment,d),m=!1},d(d){d&&(k(n),k(o),k(l),k(c),k(p)),C(e,d),C(t,d),C(s,d),C(u,d),E&&E.d(d)}}}function Fm(r,e,n){let t,i,o=Q,s=()=>(o(),o=We(a,M=>n(3,i=M)),a);H(r,rt,M=>n(2,t=M)),r.$$.on_destroy.push(()=>o());let{gjSchemes:a}=e;s();let{props:l}=e;function u(){try{n(0,l.name=t.inner.routeNameForWaypoints(l.waypoints),l)}catch(M){window.alert(`Couldn't auto-name route: ${M}`)}}let f=It();function c(){l.name=this.value,n(0,l)}const p=()=>u(),m=M=>[M.scheme_reference,Qr(M)];function h(M){r.$$.not_equal(l.scheme_reference,M)&&(l.scheme_reference=M,n(0,l))}function $(M){r.$$.not_equal(l.intervention_type,M)&&(l.intervention_type=M,n(0,l))}function v(M){r.$$.not_equal(l.description,M)&&(l.description=M,n(0,l))}return r.$$set=M=>{"gjSchemes"in M&&s(n(1,a=M.gjSchemes)),"props"in M&&n(0,l=M.props)},[l,a,t,i,u,f,c,p,m,h,$,v]}class Nm extends ne{constructor(e){super(),re(this,e,Fm,Am,x,{gjSchemes:1,props:0})}}function Rm(r){let e,n,t;function i(s){r[2](s)}let o={label:r[1],choices:[st("New segregated cycling facility"),st("New junction treatment"),st("New permanent footway"),["New shared use facilities","New shared use (walking and cycling) facilities"],["Improvements to existing route","Improvements to make an existing walking/cycle route safer"],["Area-wide traffic management","Area-wide traffic management (including by TROs - both permanent and experimental)"],["Bus priority measures","Bus priority measures that also enable active travel (for example, bus gates)"],["Secure cycle parking","Provision of secure cycle parking facilities"],st("New road crossings"),st("Restriction or reduction of car parking availability"),st("School streets"),st("Quiet mixed traffic streets"),st("Traffic free routes"),st("Not specified in LCWIP")],emptyOption:!0};return r[0]!==void 0&&(o.value=r[0]),e=new nr({props:o}),V.push(()=>te(e,"value",i)),{c(){P(e.$$.fragment)},m(s,a){L(e,s,a),t=!0},p(s,[a]){const l={};a&2&&(l.label=s[1]),!n&&a&1&&(n=!0,l.value=s[0],ie(()=>n=!1)),e.$set(l)},i(s){t||(b(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function st(r){return[r,r]}function Om(r,e,n){let{label:t}=e,{value:i}=e;function o(s){i=s,n(0,i)}return r.$$set=s=>{"label"in s&&n(1,t=s.label),"value"in s&&n(0,i=s.value)},[i,t,o]}class Ys extends ne{constructor(e){super(),re(this,e,Om,Rm,x,{label:1,value:0})}}function Im(r){let e,n,t,i,o,s,a,l,u,f,c,p,m,h,$,v,M,g;function _(F){r[3](F)}let E={label:"Status",choices:[["","Unknown"],["aspiration","Aspiration"],["planned","Planned"],["in development","In development"],["in construction","In construction"],["completed","Completed"]],inlineSmall:!0,required:r[1]};r[0].status!==void 0&&(E.value=r[0].status),i=new Nt({props:E}),V.push(()=>te(i,"value",_));function d(F){r[4](F)}let S={label:"Timescale",choices:[["","Unknown"],["short","Short (1-3 years)"],["medium","Medium (3-6 years)"],["long","Long (6-10 years)"]],inlineSmall:!0,required:r[1]};r[0].timescale!==void 0&&(S.value=r[0].timescale),a=new Nt({props:S}),V.push(()=>te(a,"value",d));function R(F){r[5](F)}let j={label:"Estimated completion year (if known)",width:4,min:2010,max:2100};r[0].timescale_year!==void 0&&(j.value=r[0].timescale_year),f=new or({props:j}),V.push(()=>te(f,"value",R));function T(F){r[6](F)}let B={label:"What year was this scheme most recently published?",width:4,min:2010,max:2100};r[0].year_published!==void 0&&(B.value=r[0].year_published),m=new or({props:B}),V.push(()=>te(m,"value",T));function O(F){r[7](F)}let A={label:"What year was this scheme most recently consulted on?",width:4,min:2010,max:2100};return r[0].year_consulted!==void 0&&(A.value=r[0].year_consulted),v=new or({props:A}),V.push(()=>te(v,"value",O)),{c(){e=D("fieldset"),n=D("legend"),n.textContent="Timing and status",t=N(),P(i.$$.fragment),s=N(),P(a.$$.fragment),u=N(),P(f.$$.fragment),p=N(),P(m.$$.fragment),$=N(),P(v.$$.fragment),z(n,"class","govuk-fieldset__legend"),z(e,"class","govuk-fieldset svelte-1bxyfcq")},m(F,I){w(F,e,I),U(e,n),U(e,t),L(i,e,null),U(e,s),L(a,e,null),U(e,u),L(f,e,null),U(e,p),L(m,e,null),U(e,$),L(v,e,null),g=!0},p(F,[I]){const X={};I&2&&(X.required=F[1]),!o&&I&1&&(o=!0,X.value=F[0].status,ie(()=>o=!1)),i.$set(X);const J={};I&2&&(J.required=F[1]),!l&&I&1&&(l=!0,J.value=F[0].timescale,ie(()=>l=!1)),a.$set(J);const ee={};!c&&I&1&&(c=!0,ee.value=F[0].timescale_year,ie(()=>c=!1)),f.$set(ee);const G={};!h&&I&1&&(h=!0,G.value=F[0].year_published,ie(()=>h=!1)),m.$set(G);const fe={};!M&&I&1&&(M=!0,fe.value=F[0].year_consulted,ie(()=>M=!1)),v.$set(fe)},i(F){g||(b(i.$$.fragment,F),b(a.$$.fragment,F),b(f.$$.fragment,F),b(m.$$.fragment,F),b(v.$$.fragment,F),g=!0)},o(F){y(i.$$.fragment,F),y(a.$$.fragment,F),y(f.$$.fragment,F),y(m.$$.fragment,F),y(v.$$.fragment,F),g=!1},d(F){F&&k(e),C(i),C(a),C(f),C(m),C(v)}}}function jm(r,e,n){let{data:t}=e,{required:i}=e,{onUpdate:o}=e;function s(p){o()}function a(p){r.$$.not_equal(t.status,p)&&(t.status=p,n(0,t))}function l(p){r.$$.not_equal(t.timescale,p)&&(t.timescale=p,n(0,t))}function u(p){r.$$.not_equal(t.timescale_year,p)&&(t.timescale_year=p,n(0,t))}function f(p){r.$$.not_equal(t.year_published,p)&&(t.year_published=p,n(0,t))}function c(p){r.$$.not_equal(t.year_consulted,p)&&(t.year_consulted=p,n(0,t))}return r.$$set=p=>{"data"in p&&n(0,t=p.data),"required"in p&&n(1,i=p.required),"onUpdate"in p&&n(2,o=p.onUpdate)},r.$$.update=()=>{r.$$.dirty&1&&s()},[t,i,o,a,l,u,f,c]}class Xs extends ne{constructor(e){super(),re(this,e,jm,Im,x,{data:0,required:1,onUpdate:2})}}function go(r,e,n){const t=r.slice();return t[9]=e[n],t[10]=e,t[11]=n,t}function Bm(r){let e;return{c(){e=q("Is the development fully funded?")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function qm(r){let e;return{c(){e=q("Is the construction fully funded?")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Gm(r){let e,n,t;function i(s){r[6](s,r[9])}let o={$$slots:{default:[Tm]},$$scope:{ctx:r}};return r[0].funding_sources[r[9]]!==void 0&&(o.checked=r[0].funding_sources[r[9]]),e=new Rt({props:o}),V.push(()=>te(e,"checked",i)),{c(){P(e.$$.fragment)},m(s,a){L(e,s,a),t=!0},p(s,a){r=s;const l={};a&4096&&(l.$$scope={dirty:a,ctx:r}),!n&&a&3&&(n=!0,l.checked=r[0].funding_sources[r[9]],ie(()=>n=!1)),e.$set(l)},i(s){t||(b(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function Tm(r){let e=r[9].toUpperCase()+"",n,t;return{c(){n=q(e),t=N()},m(i,o){w(i,n,o),w(i,t,o)},p:Q,d(i){i&&(k(n),k(t))}}}function ho(r){let e,n,t=r[9]!="other"&&Gm(r);return{c(){t&&t.c(),e=ce()},m(i,o){t&&t.m(i,o),w(i,e,o),n=!0},p(i,o){i[9]!="other"&&t.p(i,o)},i(i){n||(b(t),n=!0)},o(i){y(t),n=!1},d(i){i&&k(e),t&&t.d(i)}}}function Um(r){let e,n,t=Ie(r[1]),i=[];for(let s=0;sy(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;ste(i,"value",E));function S(A){r[4](A)}let R={$$slots:{default:[Bm]},$$scope:{ctx:r}};r[0].development_funded!==void 0&&(R.checked=r[0].development_funded),a=new Rt({props:R}),V.push(()=>te(a,"checked",S));function j(A){r[5](A)}let T={$$slots:{default:[qm]},$$scope:{ctx:r}};r[0].construction_funded!==void 0&&(T.checked=r[0].construction_funded),f=new Rt({props:T}),V.push(()=>te(f,"checked",j)),$=new Xo({props:{$$slots:{default:[Um]},$$scope:{ctx:r}}});function B(A){r[7](A)}let O={label:"Other funding sources"};return r[0].funding_sources.other!==void 0&&(O.value=r[0].funding_sources.other),M=new rr({props:O}),V.push(()=>te(M,"value",B)),{c(){e=D("fieldset"),n=D("legend"),n.textContent="Budget",t=N(),P(i.$$.fragment),s=N(),P(a.$$.fragment),u=N(),P(f.$$.fragment),p=N(),m=D("p"),m.textContent="Funding sources",h=N(),P($.$$.fragment),v=N(),P(M.$$.fragment),z(n,"class","govuk-fieldset__legend"),z(e,"class","govuk-fieldset svelte-1bxyfcq")},m(A,F){w(A,e,F),U(e,n),U(e,t),L(i,e,null),U(e,s),L(a,e,null),U(e,u),L(f,e,null),U(e,p),U(e,m),U(e,h),L($,e,null),U(e,v),L(M,e,null),_=!0},p(A,[F]){const I={};!o&&F&1&&(o=!0,I.value=A[0].budget,ie(()=>o=!1)),i.$set(I);const X={};F&4096&&(X.$$scope={dirty:F,ctx:A}),!l&&F&1&&(l=!0,X.checked=A[0].development_funded,ie(()=>l=!1)),a.$set(X);const J={};F&4096&&(J.$$scope={dirty:F,ctx:A}),!c&&F&1&&(c=!0,J.checked=A[0].construction_funded,ie(()=>c=!1)),f.$set(J);const ee={};F&4097&&(ee.$$scope={dirty:F,ctx:A}),$.$set(ee);const G={};!g&&F&1&&(g=!0,G.value=A[0].funding_sources.other,ie(()=>g=!1)),M.$set(G)},i(A){_||(b(i.$$.fragment,A),b(a.$$.fragment,A),b(f.$$.fragment,A),b($.$$.fragment,A),b(M.$$.fragment,A),_=!0)},o(A){y(i.$$.fragment,A),y(a.$$.fragment,A),y(f.$$.fragment,A),y($.$$.fragment,A),y(M.$$.fragment,A),_=!1},d(A){A&&k(e),C(i),C(a),C(f),C($),C(M)}}}function zm(r,e,n){let{data:t}=e,{onUpdate:i}=e;function o(p){i()}let s=["atf2","atf3","atf4","atf4e","crsts","luf"];function a(p){r.$$.not_equal(t.budget,p)&&(t.budget=p,n(0,t))}function l(p){r.$$.not_equal(t.development_funded,p)&&(t.development_funded=p,n(0,t))}function u(p){r.$$.not_equal(t.construction_funded,p)&&(t.construction_funded=p,n(0,t))}function f(p,m){r.$$.not_equal(t.funding_sources[m],p)&&(t.funding_sources[m]=p,n(0,t))}function c(p){r.$$.not_equal(t.funding_sources.other,p)&&(t.funding_sources.other=p,n(0,t))}return r.$$set=p=>{"data"in p&&n(0,t=p.data),"onUpdate"in p&&n(2,i=p.onUpdate)},r.$$.update=()=>{r.$$.dirty&1&&o()},[t,s,i,a,l,u,f,c]}class Ws extends ne{constructor(e){super(),re(this,e,zm,Dm,x,{data:0,onUpdate:2})}}function _o(r){let e,n;return e=new ge({props:{disabled:!r[2],$$slots:{default:[Jm]},$$scope:{ctx:r}}}),e.$on("click",r[8]),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&4&&(o.disabled=!t[2]),i&65536&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Jm(r){let e;return{c(){e=q("Auto-fill with street names")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Ym(r){let e,n,t,i,o,s,a,l,u=r[0].length_meters&&_o(r);return{c(){e=D("div"),e.textContent="Use the name from the LCWIP if possible",n=N(),t=D("input"),i=N(),u&&u.c(),o=ce(),z(e,"class","govuk-hint"),z(t,"type","text"),z(t,"class","govuk-input"),z(t,"id",r[6])},m(f,c){w(f,e,c),w(f,n,c),w(f,t,c),Pe(t,r[0].name),w(f,i,c),u&&u.m(f,c),w(f,o,c),s=!0,a||(l=$e(t,"input",r[7]),a=!0)},p(f,c){c&1&&t.value!==f[0].name&&Pe(t,f[0].name),f[0].length_meters?u?(u.p(f,c),c&1&&b(u,1)):(u=_o(f),u.c(),b(u,1),u.m(o.parentNode,o)):u&&(se(),y(u,1,1,()=>{u=null}),le())},i(f){s||(b(u),s=!0)},o(f){y(u),s=!1},d(f){f&&(k(e),k(n),k(t),k(i),k(o)),u&&u.d(f),a=!1,l()}}}function bo(r){let e,n,t=Bn(r[0].length_meters)+"",i;return{c(){e=D("p"),n=q("Length: "),i=q(t)},m(o,s){w(o,e,s),U(e,n),U(e,i)},p(o,s){s&1&&t!==(t=Bn(o[0].length_meters)+"")&&he(i,t)},d(o){o&&k(e)}}}function $o(r){let e,n,t,i,o,s,a,l,u,f,c,p,m,h;function $(S){r[12](S)}let v={label:"Type"};r[0].pipeline.atf4_type!==void 0&&(v.value=r[0].pipeline.atf4_type),e=new Ys({props:v}),V.push(()=>te(e,"value",$));function M(S){r[13](S)}let g={label:"Accuracy of mapped data",choices:[["high","High"],["medium","Medium"],["low","Low"]],required:!0,inlineSmall:!0};r[0].pipeline.accuracy!==void 0&&(g.value=r[0].pipeline.accuracy),i=new Nt({props:g}),V.push(()=>te(i,"value",M));function _(S){r[14](S)}let E={$$slots:{default:[Xm]},$$scope:{ctx:r}};r[0].pipeline.is_alternative!==void 0&&(E.checked=r[0].pipeline.is_alternative),a=new Rt({props:E}),V.push(()=>te(a,"checked",_));let d=r[4]&&r[0].is_coverage_polygon!==void 0&&vo(r);return c=new Xs({props:{data:r[0].pipeline,required:!1,onUpdate:Hm}}),m=new Ws({props:{data:r[0].pipeline,onUpdate:Zm}}),{c(){P(e.$$.fragment),t=N(),P(i.$$.fragment),s=N(),P(a.$$.fragment),u=N(),d&&d.c(),f=N(),P(c.$$.fragment),p=N(),P(m.$$.fragment)},m(S,R){L(e,S,R),w(S,t,R),L(i,S,R),w(S,s,R),L(a,S,R),w(S,u,R),d&&d.m(S,R),w(S,f,R),L(c,S,R),w(S,p,R),L(m,S,R),h=!0},p(S,R){const j={};!n&&R&1&&(n=!0,j.value=S[0].pipeline.atf4_type,ie(()=>n=!1)),e.$set(j);const T={};!o&&R&1&&(o=!0,T.value=S[0].pipeline.accuracy,ie(()=>o=!1)),i.$set(T);const B={};R&65536&&(B.$$scope={dirty:R,ctx:S}),!l&&R&1&&(l=!0,B.checked=S[0].pipeline.is_alternative,ie(()=>l=!1)),a.$set(B),S[4]&&S[0].is_coverage_polygon!==void 0?d?(d.p(S,R),R&1&&b(d,1)):(d=vo(S),d.c(),b(d,1),d.m(f.parentNode,f)):d&&(se(),y(d,1,1,()=>{d=null}),le());const O={};R&1&&(O.data=S[0].pipeline),c.$set(O);const A={};R&1&&(A.data=S[0].pipeline),m.$set(A)},i(S){h||(b(e.$$.fragment,S),b(i.$$.fragment,S),b(a.$$.fragment,S),b(d),b(c.$$.fragment,S),b(m.$$.fragment,S),h=!0)},o(S){y(e.$$.fragment,S),y(i.$$.fragment,S),y(a.$$.fragment,S),y(d),y(c.$$.fragment,S),y(m.$$.fragment,S),h=!1},d(S){S&&(k(t),k(s),k(u),k(f),k(p)),C(e,S),C(i,S),C(a,S),d&&d.d(S),C(c,S),C(m,S)}}}function Xm(r){let e;return{c(){e=q("Is this an alternative route and not the default option?")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function vo(r){let e,n,t;function i(s){r[15](s)}let o={$$slots:{default:[Wm]},$$scope:{ctx:r}};return r[0].is_coverage_polygon!==void 0&&(o.checked=r[0].is_coverage_polygon),e=new Rt({props:o}),V.push(()=>te(e,"checked",i)),{c(){P(e.$$.fragment)},m(s,a){L(e,s,a),t=!0},p(s,a){const l={};a&65536&&(l.$$scope={dirty:a,ctx:s}),!n&&a&1&&(n=!0,l.checked=s[0].is_coverage_polygon,ie(()=>n=!1)),e.$set(l)},i(s){t||(b(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function Wm(r){let e;return{c(){e=q(`Does this polygon show the coverage of the scheme? (All area considered - while making the scheme)`)},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Km(r){let e,n,t,i,o,s,a,l,u,f,c;e=new Ot({props:{label:"Name",id:r[6],$$slots:{default:[Ym]},$$scope:{ctx:r}}});function p(g){r[10](g)}let m={label:"Scheme",choices:Object.values(r[3].schemes).map(r[9])};r[0].scheme_reference!==void 0&&(m.value=r[0].scheme_reference),t=new nr({props:m}),V.push(()=>te(t,"value",p));function h(g){r[11](g)}let $={label:"Description"};r[0].description!==void 0&&($.value=r[0].description),s=new Ur({props:$}),V.push(()=>te(s,"value",h));let v=r[0].length_meters&&bo(r),M=r[0].pipeline&&$o(r);return{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment),o=N(),P(s.$$.fragment),l=N(),v&&v.c(),u=N(),M&&M.c(),f=ce()},m(g,_){L(e,g,_),w(g,n,_),L(t,g,_),w(g,o,_),L(s,g,_),w(g,l,_),v&&v.m(g,_),w(g,u,_),M&&M.m(g,_),w(g,f,_),c=!0},p(g,[_]){const E={};_&65541&&(E.$$scope={dirty:_,ctx:g}),e.$set(E);const d={};_&8&&(d.choices=Object.values(g[3].schemes).map(g[9])),!i&&_&1&&(i=!0,d.value=g[0].scheme_reference,ie(()=>i=!1)),t.$set(d);const S={};!a&&_&1&&(a=!0,S.value=g[0].description,ie(()=>a=!1)),s.$set(S),g[0].length_meters?v?v.p(g,_):(v=bo(g),v.c(),v.m(u.parentNode,u)):v&&(v.d(1),v=null),g[0].pipeline?M?(M.p(g,_),_&1&&b(M,1)):(M=$o(g),M.c(),b(M,1),M.m(f.parentNode,f)):M&&(se(),y(M,1,1,()=>{M=null}),le())},i(g){c||(b(e.$$.fragment,g),b(t.$$.fragment,g),b(s.$$.fragment,g),b(M),c=!0)},o(g){y(e.$$.fragment,g),y(t.$$.fragment,g),y(s.$$.fragment,g),y(M),c=!1},d(g){g&&(k(n),k(o),k(l),k(u),k(f)),C(e,g),C(t,g),C(s,g),v&&v.d(g),M&&M.d(g)}}}const Hm=()=>{},Zm=()=>{};function Vm(r,e,n){let t,i,o=Q,s=()=>(o(),o=We(a,d=>n(3,i=d)),a);H(r,rt,d=>n(2,t=d)),r.$$.on_destroy.push(()=>o());let{gjSchemes:a}=e;s();let{props:l}=e;l.pipeline||(l.pipeline={atf4_type:"",accuracy:"",is_alternative:!1,development_funded:!1,construction_funded:!1,funding_sources:Qn(),status:"",timescale:""}),l.is_coverage_polygon||(l.is_coverage_polygon=!1);const u=(i.features.filter(d=>d.properties.is_coverage_polygon).length==0||l.is_coverage_polygon===!0)&&l.intervention_type==="area";function f(){try{n(0,l.name=t.inner.routeNameForWaypoints(l.waypoints),l)}catch(d){window.alert(`Couldn't auto-name route: ${d}`)}}let c=It();function p(){l.name=this.value,n(0,l)}const m=()=>f(),h=d=>[d.scheme_reference,Qr(d)];function $(d){r.$$.not_equal(l.scheme_reference,d)&&(l.scheme_reference=d,n(0,l))}function v(d){r.$$.not_equal(l.description,d)&&(l.description=d,n(0,l))}function M(d){r.$$.not_equal(l.pipeline.atf4_type,d)&&(l.pipeline.atf4_type=d,n(0,l))}function g(d){r.$$.not_equal(l.pipeline.accuracy,d)&&(l.pipeline.accuracy=d,n(0,l))}function _(d){r.$$.not_equal(l.pipeline.is_alternative,d)&&(l.pipeline.is_alternative=d,n(0,l))}function E(d){r.$$.not_equal(l.is_coverage_polygon,d)&&(l.is_coverage_polygon=d,n(0,l))}return r.$$set=d=>{"gjSchemes"in d&&s(n(1,a=d.gjSchemes)),"props"in d&&n(0,l=d.props)},[l,a,t,i,u,f,c,p,m,h,$,v,M,g,_,E]}class Qm extends ne{constructor(e){super(),re(this,e,Vm,Km,x,{gjSchemes:1,props:0})}}function yo(r,e,n){const t=r.slice();return t[9]=e[n][0],t[10]=e[n][1],t}function wo(r){let e,n;return e=new ge({props:{$$slots:{default:[xm]},$$scope:{ctx:r}}}),e.$on("click",r[6]),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&8192&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function xm(r){let e;return{c(){e=q("Handle extra GeoJSON properties")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function ko(r){let e,n,t=r[9]+"",i,o,s=JSON.stringify(r[10])+"",a,l;return{c(){e=D("li"),n=D("b"),i=q(t),o=q(` - = `),a=q(s),l=N()},m(u,f){w(u,e,f),U(e,n),U(n,i),U(e,o),U(e,a),U(e,l)},p(u,f){f&2&&t!==(t=u[9]+"")&&he(i,t),f&2&&s!==(s=JSON.stringify(u[10])+"")&&he(a,s)},d(u){u&&k(e)}}}function ed(r){let e;return{c(){e=q("Remove these properties")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function td(r){let e;return{c(){e=q("Cancel")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function nd(r){let e,n,t,i;return e=new wt({props:{$$slots:{default:[ed]},$$scope:{ctx:r}}}),e.$on("click",r[2]),t=new ge({props:{$$slots:{default:[td]},$$scope:{ctx:r}}}),t.$on("click",r[7]),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment)},m(o,s){L(e,o,s),w(o,n,s),L(t,o,s),i=!0},p(o,s){const a={};s&8192&&(a.$$scope={dirty:s,ctx:o}),e.$set(a);const l={};s&8192&&(l.$$scope={dirty:s,ctx:o}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),C(e,o),C(t,o)}}}function rd(r){let e,n,t,i,o,s,a=Ie(Object.entries(r[1])),l=[];for(let u=0;u0,n,t,i,o,s=e&&wo(r);function a(u){r[8](u)}let l={title:"This imported GeoJSON feature has unexpected properties",$$slots:{default:[rd]},$$scope:{ctx:r}};return r[0]!==void 0&&(l.open=r[0]),t=new yt({props:l}),V.push(()=>te(t,"open",a)),{c(){s&&s.c(),n=N(),P(t.$$.fragment)},m(u,f){s&&s.m(u,f),w(u,n,f),L(t,u,f),o=!0},p(u,[f]){f&2&&(e=Object.entries(u[1]).length>0),e?s?(s.p(u,f),f&2&&b(s,1)):(s=wo(u),s.c(),b(s,1),s.m(n.parentNode,n)):s&&(se(),y(s,1,1,()=>{s=null}),le());const c={};f&8195&&(c.$$scope={dirty:f,ctx:u}),!i&&f&1&&(i=!0,c.open=u[0],ie(()=>i=!1)),t.$set(c)},i(u){o||(b(s),b(t.$$.fragment,u),o=!0)},o(u){y(s),y(t.$$.fragment,u),o=!1},d(u){u&&k(n),s&&s.d(u),C(t,u)}}}function od(r,e,n){let t,{gjSchemes:i}=e,{id:o}=e,{props:s}=e,a=!1;function l(){n(0,a=!1),i.update(p=>{let m=p.features.find(h=>h.id==o);for(let h of Object.keys(t))delete m.properties[h];return p})}const u=()=>n(0,a=!0),f=()=>n(0,a=!1);function c(p){a=p,n(0,a)}return r.$$set=p=>{"gjSchemes"in p&&n(3,i=p.gjSchemes),"id"in p&&n(4,o=p.id),"props"in p&&n(5,s=p.props)},r.$$.update=()=>{r.$$.dirty&32&&n(1,t=Hs(s))},[a,t,l,i,o,s,u,f,c]}class sd extends ne{constructor(e){super(),re(this,e,od,id,x,{gjSchemes:3,id:4,props:5})}}function ld(r){let e,n,t;function i(s){r[6](s)}let o={gjSchemes:r[1]};return r[0]!==void 0&&(o.props=r[0]),e=new Qm({props:o}),V.push(()=>te(e,"props",i)),{c(){P(e.$$.fragment)},m(s,a){L(e,s,a),t=!0},p(s,a){const l={};a&2&&(l.gjSchemes=s[1]),!n&&a&1&&(n=!0,l.props=s[0],ie(()=>n=!1)),e.$set(l)},i(s){t||(b(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function ad(r){let e,n,t;function i(s){r[5](s)}let o={gjSchemes:r[1]};return r[0]!==void 0&&(o.props=r[0]),e=new Nm({props:o}),V.push(()=>te(e,"props",i)),{c(){P(e.$$.fragment)},m(s,a){L(e,s,a),t=!0},p(s,a){const l={};a&2&&(l.gjSchemes=s[1]),!n&&a&1&&(n=!0,l.props=s[0],ie(()=>n=!1)),e.$set(l)},i(s){t||(b(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function ud(r){let e,n,t,i,o,s;e=new sd({props:{gjSchemes:r[1],id:r[2],props:r[0]}});const a=[ad,ld],l=[];function u(f,c){return f[3]=="v1"?0:f[3]=="pipeline"?1:-1}return~(t=u(r))&&(i=l[t]=a[t](r)),{c(){P(e.$$.fragment),n=N(),i&&i.c(),o=ce()},m(f,c){L(e,f,c),w(f,n,c),~t&&l[t].m(f,c),w(f,o,c),s=!0},p(f,[c]){const p={};c&2&&(p.gjSchemes=f[1]),c&4&&(p.id=f[2]),c&1&&(p.props=f[0]),e.$set(p);let m=t;t=u(f),t===m?~t&&l[t].p(f,c):(i&&(se(),y(l[m],1,1,()=>{l[m]=null}),le()),~t?(i=l[t],i?i.p(f,c):(i=l[t]=a[t](f),i.c()),b(i,1),i.m(o.parentNode,o)):i=null)},i(f){s||(b(e.$$.fragment,f),b(i),s=!0)},o(f){y(e.$$.fragment,f),y(i),s=!1},d(f){f&&(k(n),k(o)),C(e,f),~t&&l[t].d(f)}}}function fd(r,e,n){let t;H(r,xe,f=>n(3,t=f));let{cfg:i}=e,{gjSchemes:o}=e,{id:s}=e,{props:a}=e;function l(f){a=f,n(0,a)}function u(f){a=f,n(0,a)}return r.$$set=f=>{"cfg"in f&&n(4,i=f.cfg),"gjSchemes"in f&&n(1,o=f.gjSchemes),"id"in f&&n(2,s=f.id),"props"in f&&n(0,a=f.props)},[a,o,s,t,i,l,u]}class cd extends ne{constructor(e){super(),re(this,e,fd,ud,x,{cfg:4,gjSchemes:1,id:2,props:0})}}function pd(r){let e;return{c(){e=q("Scheme details")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function md(r){let e;return{c(){e=q("Save")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function dd(r){let e,n,t,i,o;function s(l){r[6](l)}let a={label:"Scheme name",required:!0};return r[3].schemes[r[1]].scheme_name!==void 0&&(a.value=r[3].schemes[r[1]].scheme_name),e=new rr({props:a}),V.push(()=>te(e,"value",s)),i=new mt({props:{$$slots:{default:[md]},$$scope:{ctx:r}}}),i.$on("click",r[7]),{c(){P(e.$$.fragment),t=N(),P(i.$$.fragment)},m(l,u){L(e,l,u),w(l,t,u),L(i,l,u),o=!0},p(l,u){const f={};!n&&u&10&&(n=!0,f.value=l[3].schemes[l[1]].scheme_name,ie(()=>n=!1)),e.$set(f);const c={};u&512&&(c.$$scope={dirty:u,ctx:l}),i.$set(c)},i(l){o||(b(e.$$.fragment,l),b(i.$$.fragment,l),o=!0)},o(l){y(e.$$.fragment,l),y(i.$$.fragment,l),o=!1},d(l){l&&k(t),C(e,l),C(i,l)}}}function gd(r){let e,n,t,i,o,s,a;e=new ge({props:{$$slots:{default:[pd]},$$scope:{ctx:r}}}),e.$on("click",r[5]);function l(f){r[8](f)}let u={title:"Scheme details",$$slots:{default:[dd]},$$scope:{ctx:r}};return r[2]!==void 0&&(u.open=r[2]),t=new yt({props:u}),V.push(()=>te(t,"open",l)),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment)},m(f,c){L(e,f,c),w(f,n,c),L(t,f,c),o=!0,s||(a=$e(window,"keydown",r[4]),s=!0)},p(f,[c]){const p={};c&512&&(p.$$scope={dirty:c,ctx:f}),e.$set(p);const m={};c&526&&(m.$$scope={dirty:c,ctx:f}),!i&&c&4&&(i=!0,m.open=f[2],ie(()=>i=!1)),t.$set(m)},i(f){o||(b(e.$$.fragment,f),b(t.$$.fragment,f),o=!0)},o(f){y(e.$$.fragment,f),y(t.$$.fragment,f),o=!1},d(f){f&&k(n),C(e,f),C(t,f),s=!1,a()}}}function hd(r,e,n){let t,i=Q,o=()=>(i(),i=We(s,h=>n(3,t=h)),s);r.$$.on_destroy.push(()=>i());let{gjSchemes:s}=e;o();let{scheme_reference:a}=e,l=!1;function u(h){l&&h.key=="Escape"&&(h.stopPropagation(),n(2,l=!1))}const f=()=>n(2,l=!0);function c(h){r.$$.not_equal(t.schemes[a].scheme_name,h)&&(t.schemes[a].scheme_name=h,s.set(t))}const p=()=>n(2,l=!1);function m(h){l=h,n(2,l)}return r.$$set=h=>{"gjSchemes"in h&&o(n(0,s=h.gjSchemes)),"scheme_reference"in h&&n(1,a=h.scheme_reference)},[s,a,l,t,u,f,c,p,m]}class _d extends ne{constructor(e){super(),re(this,e,hd,gd,x,{gjSchemes:0,scheme_reference:1})}}function bd(r){let e;return{c(){e=q("Scheme details")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function $d(r){let e;return{c(){e=q("Save")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function vd(r){let e,n,t,i,o,s,a,l,u,f,c,p,m,h,$,v,M,g,_,E,d;function S(I){r[9](I)}let R={label:"Scheme name",required:!0};r[6].schemes[r[1]].scheme_name!==void 0&&(R.value=r[6].schemes[r[1]].scheme_name),e=new rr({props:R}),V.push(()=>te(e,"value",S));function j(I){r[10](I)}let T={label:"Scheme type",choices:[["cycling route","Cycling route"],["walking route","Walking route"],["shared-use route","Shared-use route"],["cycling and walking route","Cycling and walking route, not shared use"],["area-based scheme","Area-based scheme"],["intersection","Intersection/junction scheme"]],inlineSmall:!0,required:!0};r[3].scheme_type!==void 0&&(T.value=r[3].scheme_type),a=new Nt({props:T}),V.push(()=>te(a,"value",j));function B(I){r[11](I)}let O={label:"Type of the main intervention"};r[3].atf4_lead_type!==void 0&&(O.value=r[3].atf4_lead_type),f=new Ys({props:O}),V.push(()=>te(f,"value",B));function A(I){r[12](I)}let F={label:"Scheme description (150 words max)"};return r[3].scheme_description!==void 0&&(F.value=r[3].scheme_description),m=new Ur({props:F}),V.push(()=>te(m,"value",A)),v=new Xs({props:{data:r[3],required:!0,onUpdate:r[13]}}),g=new Ws({props:{data:r[3],onUpdate:r[14]}}),E=new mt({props:{$$slots:{default:[$d]},$$scope:{ctx:r}}}),E.$on("click",r[15]),{c(){P(e.$$.fragment),t=N(),i=D("fieldset"),o=D("legend"),o.textContent="Basic information",s=N(),P(a.$$.fragment),u=N(),P(f.$$.fragment),p=N(),P(m.$$.fragment),$=N(),P(v.$$.fragment),M=N(),P(g.$$.fragment),_=N(),P(E.$$.fragment),z(o,"class","govuk-fieldset__legend"),z(i,"class","govuk-fieldset svelte-1bxyfcq")},m(I,X){L(e,I,X),w(I,t,X),w(I,i,X),U(i,o),U(i,s),L(a,i,null),U(i,u),L(f,i,null),U(i,p),L(m,i,null),w(I,$,X),L(v,I,X),w(I,M,X),L(g,I,X),w(I,_,X),L(E,I,X),d=!0},p(I,X){const J={};!n&&X&66&&(n=!0,J.value=I[6].schemes[I[1]].scheme_name,ie(()=>n=!1)),e.$set(J);const ee={};!l&&X&8&&(l=!0,ee.value=I[3].scheme_type,ie(()=>l=!1)),a.$set(ee);const G={};!c&&X&8&&(c=!0,G.value=I[3].atf4_lead_type,ie(()=>c=!1)),f.$set(G);const fe={};!h&&X&8&&(h=!0,fe.value=I[3].scheme_description,ie(()=>h=!1)),m.$set(fe);const me={};X&8&&(me.data=I[3]),X&16&&(me.onUpdate=I[13]),v.$set(me);const _e={};X&8&&(_e.data=I[3]),X&16&&(_e.onUpdate=I[14]),g.$set(_e);const be={};X&524288&&(be.$$scope={dirty:X,ctx:I}),E.$set(be)},i(I){d||(b(e.$$.fragment,I),b(a.$$.fragment,I),b(f.$$.fragment,I),b(m.$$.fragment,I),b(v.$$.fragment,I),b(g.$$.fragment,I),b(E.$$.fragment,I),d=!0)},o(I){y(e.$$.fragment,I),y(a.$$.fragment,I),y(f.$$.fragment,I),y(m.$$.fragment,I),y(v.$$.fragment,I),y(g.$$.fragment,I),y(E.$$.fragment,I),d=!1},d(I){I&&(k(t),k(i),k($),k(M),k(_)),C(e,I),C(a),C(f),C(m),C(v,I),C(g,I),C(E,I)}}}function yd(r){let e,n,t,i,o,s,a,l,u;e=new Ye({props:{errorMessage:r[5]}}),t=new ge({props:{$$slots:{default:[bd]},$$scope:{ctx:r}}}),t.$on("click",r[8]);function f(p){r[16](p)}let c={title:"Scheme details",$$slots:{default:[vd]},$$scope:{ctx:r}};return r[2]!==void 0&&(c.open=r[2]),o=new yt({props:c}),V.push(()=>te(o,"open",f)),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment),i=N(),P(o.$$.fragment)},m(p,m){L(e,p,m),w(p,n,m),L(t,p,m),w(p,i,m),L(o,p,m),a=!0,l||(u=$e(window,"keydown",r[7]),l=!0)},p(p,[m]){const h={};m&32&&(h.errorMessage=p[5]),e.$set(h);const $={};m&524288&&($.$$scope={dirty:m,ctx:p}),t.$set($);const v={};m&524382&&(v.$$scope={dirty:m,ctx:p}),!s&&m&4&&(s=!0,v.open=p[2],ie(()=>s=!1)),o.$set(v)},i(p){a||(b(e.$$.fragment,p),b(t.$$.fragment,p),b(o.$$.fragment,p),a=!0)},o(p){y(e.$$.fragment,p),y(t.$$.fragment,p),y(o.$$.fragment,p),a=!1},d(p){p&&(k(n),k(i)),C(e,p),C(t,p),C(o,p),l=!1,u()}}}function wd(r,e,n){let t,i,o=Q,s=()=>(o(),o=We(a,j=>n(6,i=j)),a);r.$$.on_destroy.push(()=>o());let{gjSchemes:a}=e;s();let{scheme_reference:l}=e,u=!1,f=i.schemes[l].pipeline,c=0;function p(j,T){return f.scheme_type&&f.status&&f.timescale?"":"Missing some required data"}function m(j){u&&j.key=="Escape"&&(j.stopPropagation(),n(2,u=!1))}function h(){Be(a,i.schemes[l].pipeline=f,i),a.set(i)}const $=()=>n(2,u=!0);function v(j){r.$$.not_equal(i.schemes[l].scheme_name,j)&&(i.schemes[l].scheme_name=j,a.set(i))}function M(j){r.$$.not_equal(f.scheme_type,j)&&(f.scheme_type=j,n(3,f))}function g(j){r.$$.not_equal(f.atf4_lead_type,j)&&(f.atf4_lead_type=j,n(3,f))}function _(j){r.$$.not_equal(f.scheme_description,j)&&(f.scheme_description=j,n(3,f))}const E=()=>n(4,c++,c),d=()=>n(4,c++,c),S=()=>n(2,u=!1);function R(j){u=j,n(2,u)}return r.$$set=j=>{"gjSchemes"in j&&s(n(0,a=j.gjSchemes)),"scheme_reference"in j&&n(1,l=j.scheme_reference)},r.$$.update=()=>{r.$$.dirty&24&&n(5,t=p()),r.$$.dirty&4&&(u||h())},[a,l,u,f,c,t,i,m,$,v,M,g,_,E,d,S,R]}class kd extends ne{constructor(e){super(),re(this,e,wd,yd,x,{gjSchemes:0,scheme_reference:1})}}function Sd(r){let e,n;return e=new _d({props:{gjSchemes:r[0],scheme_reference:r[1]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.gjSchemes=t[0]),i&2&&(o.scheme_reference=t[1]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Ed(r){let e,n;return e=new kd({props:{gjSchemes:r[0],scheme_reference:r[1]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&1&&(o.gjSchemes=t[0]),i&2&&(o.scheme_reference=t[1]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Md(r){let e,n,t,i;const o=[Ed,Sd],s=[];function a(l,u){return l[2]=="pipeline"?0:1}return e=a(r),n=s[e]=o[e](r),{c(){n.c(),t=ce()},m(l,u){s[e].m(l,u),w(l,t,u),i=!0},p(l,[u]){let f=e;e=a(l),e===f?s[e].p(l,u):(se(),y(s[f],1,1,()=>{s[f]=null}),le(),n=s[e],n?n.p(l,u):(n=s[e]=o[e](l),n.c()),b(n,1),n.m(t.parentNode,t))},i(l){i||(b(n),i=!0)},o(l){y(n),i=!1},d(l){l&&k(t),s[e].d(l)}}}function Pd(r,e,n){let t;H(r,xe,s=>n(2,t=s));let{gjSchemes:i}=e,{scheme_reference:o}=e;return r.$$set=s=>{"gjSchemes"in s&&n(0,i=s.gjSchemes),"scheme_reference"in s&&n(1,o=s.scheme_reference)},[i,o,t]}class Ld extends ne{constructor(e){super(),re(this,e,Pd,Md,x,{gjSchemes:0,scheme_reference:1})}}let Te={interventionName:Ad,schemeName:Qr,backfill:Nn,initializeEmptyScheme:Cd,interventionWarning:Fd,editFeatureForm:cd,editSchemeForm:Ld,newPointFeature:r=>{r.properties.intervention_type="other"},newPolygonFeature:r=>{r.properties.intervention_type="area",r.properties.is_coverage_polygon=!1},newLineStringFeature:r=>{r.properties.intervention_type="route",r.properties.route_name&&(Ct(xe)!="pipeline"&&(r.properties.name=r.properties.route_name),delete r.properties.route_name)},updateFeature:(r,e)=>{e.properties.route_name&&!r.properties.name&&Ct(xe)!="pipeline"&&(r.properties.name=e.properties.route_name)},maptilerApiKey:"MZEJTanw3WpxRvt7qDfo",getStreetViewRoadLayerNames:r=>Rl(r,Ct(gr)),layerZorder:Ol};function Nn(r){var t,i,o,s,a,l,u,f;let e=Ct(xe),n=1;for(let c of r.features)c.properties||(c.properties={name:"",scheme_reference:"",description:"",intervention_type:"other",is_coverage_polygon:!1}),e=="pipeline"&&!c.properties.intervention_type&&(c.properties.intervention_type=new Map([["LineString","route"],["Polygon","area"]]).get(c.geometry.type)??"other"),c.geometry.type=="LineString"&&!c.properties.length_meters&&(c.properties.length_meters=Il(c,{units:"kilometers"})*1e3),c.id=n++;if(!r.schemes){let c=It();r.schemes={},r.schemes[c]={scheme_reference:c,color:oi()},r.scheme_name&&(r.schemes[c].scheme_name=r.scheme_name,delete r.scheme_name),r.pipeline&&(r.schemes[c].pipeline=r.pipeline,delete r.pipeline);for(let p of r.features)p.properties.scheme_reference=c}for(let c of Object.values(r.schemes)){let p=c;if(p.color??(p.color=oi()),e=="pipeline"){p.pipeline??(p.pipeline=Ks()),(t=p.pipeline).development_funded??(t.development_funded=!1),(i=p.pipeline).construction_funded??(i.construction_funded=!1),(o=p.pipeline).funding_sources??(o.funding_sources=Qn()),delete p.pipeline.budget_funded,delete p.pipeline.budget_unfunded,delete p.pipeline.funding_source,delete p.pipeline.funded;for(let m of r.features)m.properties.pipeline&&((s=m.properties.pipeline).development_funded??(s.development_funded=!1),(a=m.properties.pipeline).construction_funded??(a.construction_funded=!1),(l=m.properties.pipeline).funding_sources??(l.funding_sources=Qn()),(u=m.properties.pipeline).status??(u.status=""),(f=m.properties.pipeline).timescale??(f.timescale=""))}}return r}function Cd(r){let e=r;return Ct(xe)=="pipeline"&&(e.pipeline=Ks()),e}function Ks(){return{scheme_type:"",atf4_lead_type:"",scheme_description:"",status:"",timescale:"",development_funded:!1,construction_funded:!1,funding_sources:Qn()}}function Qn(){return{atf2:!1,atf3:!1,atf4:!1,atf4e:!1,crsts:!1,luf:!1,other:""}}function Ad(r){if(r.properties.name)return r.properties.name;var e=r.properties.intervention_type;return e=="other"&&(r.geometry.type=="Point"?e="point":r.geometry.type=="LineString"?e="line":e="polygon"),`Untitled ${e}`}function Qr(r){return r.scheme_name??"Untitled scheme"}function Fd(r){var t;let e=Ct(xe);if(!r.properties.name)return"No name";if(!new Set(["route","area","crossing","other"]).has(r.properties.intervention_type))return"No intervention type";if(e=="pipeline"&&!((t=r.properties.pipeline)!=null&&t.accuracy))return"Accuracy not specified";let n=Hs(r.properties);return Object.entries(n).length>0?`Extra GeoJSON properties: ${Object.keys(n).join(", ")}`:null}function Hs(r){let e=Ct(xe),n=JSON.parse(JSON.stringify(r));for(let t of["name","description","intervention_type","length_meters","waypoints","hide_while_editing","is_coverage_polygon","scheme_reference"])delete n[t];if(e=="pipeline"&&n.pipeline){for(let t of["atf4_type","accuracy","is_alternative","budget","development_funded","construction_funded","funding_sources","status","timescale","timescale_year","year_published","year_consulted"])delete n.pipeline[t];Object.entries(n.pipeline).length==0&&delete n.pipeline}return n}function So(r,e,n){const t=r.slice();return t[8]=e[n],t}function Nd(r){let e;return{c(){e=q("Delete all sketch data from browser")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Eo(r){let e,n,t,i,o=Ie(r[1].storedStrings),s=[];for(let l=0;ly(s[l],1,1,()=>{s[l]=null});return{c(){e=D("p"),e.textContent=`Otherwise here is a breakdown of what is currently stored locally. You can - delete individual items (normally storage quota is 5MB or 10MB):`,n=N();for(let l=0;l{i=null}),le());const l={};a&2050&&(l.$$scope={dirty:a,ctx:r}),n.$set(l)},i(s){t||(b(i),b(n.$$.fragment,s),t=!0)},o(s){y(i),y(n.$$.fragment,s),t=!1},d(s){s&&k(e),i&&i.d(s),C(n,s)}}}function Od(r){var p;let e,n=((p=r[1])==null?void 0:p.message)+"",t,i,o,s,a,l,u,f;a=new wt({props:{$$slots:{default:[Nd]},$$scope:{ctx:r}}}),a.$on("click",r[4]);let c=r[1]&&Eo(r);return{c(){e=D("p"),t=q(n),i=N(),o=D("p"),o.textContent=`If you have saved your work locally to a geojson file recently, you can - delete all files stored in the browser for all authorities to free up space. - Be sure that you're not losing anything important before doing this!`,s=N(),P(a.$$.fragment),l=N(),c&&c.c(),u=ce()},m(m,h){w(m,e,h),U(e,t),w(m,i,h),w(m,o,h),w(m,s,h),L(a,m,h),w(m,l,h),c&&c.m(m,h),w(m,u,h),f=!0},p(m,h){var v;(!f||h&2)&&n!==(n=((v=m[1])==null?void 0:v.message)+"")&&he(t,n);const $={};h&2048&&($.$$scope={dirty:h,ctx:m}),a.$set($),m[1]?c?(c.p(m,h),h&2&&b(c,1)):(c=Eo(m),c.c(),b(c,1),c.m(u.parentNode,u)):c&&(se(),y(c,1,1,()=>{c=null}),le())},i(m){f||(b(a.$$.fragment,m),b(c),f=!0)},o(m){y(a.$$.fragment,m),y(c),f=!1},d(m){m&&(k(e),k(i),k(o),k(s),k(l),k(u)),C(a,m),c&&c.d(m)}}}function Id(r){let e,n,t;function i(s){r[7](s)}let o={title:"Local Storage Quota Exceeded",$$slots:{default:[Od]},$$scope:{ctx:r}};return r[0]!==void 0&&(o.open=r[0]),e=new yt({props:o}),V.push(()=>te(e,"open",i)),{c(){P(e.$$.fragment)},m(s,a){L(e,s,a),t=!0},p(s,[a]){const l={};a&2054&&(l.$$scope={dirty:a,ctx:s}),!n&&a&1&&(n=!0,l.open=s[0],ie(()=>n=!1)),e.$set(l)},i(s){t||(b(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function jd(r,e,n){let{show:t}=e,{setStorageError:i}=e,{clearCurrentSketch:o}=e,{currentAuthority:s}=e;function a(c){let p=bl(c);i&&n(1,i.storedStrings=p,i),c===s&&o()}function l(){o(),$l(),n(0,t=!1),n(1,i=void 0)}const u=c=>a(c.key);function f(c){t=c,n(0,t)}return r.$$set=c=>{"show"in c&&n(0,t=c.show),"setStorageError"in c&&n(1,i=c.setStorageError),"clearCurrentSketch"in c&&n(5,o=c.clearCurrentSketch),"currentAuthority"in c&&n(2,s=c.currentAuthority)},[t,i,s,a,l,o,u,f]}class Bd extends ne{constructor(e){super(),re(this,e,jd,Id,x,{show:0,setStorageError:1,clearCurrentSketch:5,currentAuthority:2})}}function Lo(r){let e,n;return e=new jl({props:{label:"Manage files",$$slots:{default:[Yd]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&2097164&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function qd(r){let e,n,t;return{c(){e=D("img"),t=q(` - Save`),ot(e.src,n=Pm)||z(e,"src",n),z(e,"alt","Save as GeoJSON file")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function Gd(r){let e,n,t;return{c(){e=D("img"),t=q(` - Clear all`),ot(e.src,n=Mm)||z(e,"src",n),z(e,"alt","Clear all")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function Td(r){let e,n,t,i;return e=new ge({props:{$$slots:{default:[qd]},$$scope:{ctx:r}}}),e.$on("click",r[8]),t=new wt({props:{$$slots:{default:[Gd]},$$scope:{ctx:r}}}),t.$on("click",r[14]),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment)},m(o,s){L(e,o,s),w(o,n,s),L(t,o,s),i=!0},p(o,s){const a={};s&2097152&&(a.$$scope={dirty:s,ctx:o}),e.$set(a);const l={};s&2097152&&(l.$$scope={dirty:s,ctx:o}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),C(e,o),C(t,o)}}}function Ud(r){let e;return{c(){e=q("Clear all work")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Dd(r){let e;return{c(){e=q("Cancel")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function zd(r){let e,n,t,i;return e=new wt({props:{$$slots:{default:[Ud]},$$scope:{ctx:r}}}),e.$on("click",r[7]),t=new ge({props:{$$slots:{default:[Dd]},$$scope:{ctx:r}}}),t.$on("click",r[15]),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment)},m(o,s){L(e,o,s),w(o,n,s),L(t,o,s),i=!0},p(o,s){const a={};s&2097152&&(a.$$scope={dirty:s,ctx:o}),e.$set(a);const l={};s&2097152&&(l.$$scope={dirty:s,ctx:o}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),C(e,o),C(t,o)}}}function Jd(r){let e,n,t,i;return t=new Ke({props:{$$slots:{default:[zd]},$$scope:{ctx:r}}}),{c(){e=D("p"),e.textContent="This will delete everything for all schemes.",n=N(),P(t.$$.fragment)},m(o,s){w(o,e,s),w(o,n,s),L(t,o,s),i=!0},p(o,s){const a={};s&2097160&&(a.$$scope={dirty:s,ctx:o}),t.$set(a)},i(o){i||(b(t.$$.fragment,o),i=!0)},o(o){y(t.$$.fragment,o),i=!1},d(o){o&&(k(e),k(n)),C(t,o)}}}function Yd(r){let e,n,t,i,o,s,a,l,u;e=new Jo({props:{label:"Load GeoJSON file",onLoad:r[9]}}),t=new Ke({props:{$$slots:{default:[Td]},$$scope:{ctx:r}}}),o=new Ye({props:{errorMessage:r[2]}});function f(p){r[16](p)}let c={title:"Would you like to clear your work?",displayEscapeButton:!1,$$slots:{default:[Jd]},$$scope:{ctx:r}};return r[3]!==void 0&&(c.open=r[3]),a=new yt({props:c}),V.push(()=>te(a,"open",f)),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment),i=N(),P(o.$$.fragment),s=N(),P(a.$$.fragment)},m(p,m){L(e,p,m),w(p,n,m),L(t,p,m),w(p,i,m),L(o,p,m),w(p,s,m),L(a,p,m),u=!0},p(p,m){const h={};m&2097160&&(h.$$scope={dirty:m,ctx:p}),t.$set(h);const $={};m&4&&($.errorMessage=p[2]),o.$set($);const v={};m&2097160&&(v.$$scope={dirty:m,ctx:p}),!l&&m&8&&(l=!0,v.open=p[3],ie(()=>l=!1)),a.$set(v)},i(p){u||(b(e.$$.fragment,p),b(t.$$.fragment,p),b(o.$$.fragment,p),b(a.$$.fragment,p),u=!0)},o(p){y(e.$$.fragment,p),y(t.$$.fragment,p),y(o.$$.fragment,p),y(a.$$.fragment,p),u=!1},d(p){p&&(k(n),k(i),k(s)),C(e,p),C(t,p),C(o,p),C(a,p)}}}function Xd(r){let e,n,t,i,o,s=r[6].mode=="list"&&Lo(r);function a(f){r[17](f)}function l(f){r[18](f)}let u={clearCurrentSketch:r[7],currentAuthority:r[1]};return r[4]!==void 0&&(u.show=r[4]),r[5]!==void 0&&(u.setStorageError=r[5]),n=new Bd({props:u}),V.push(()=>te(n,"show",a)),V.push(()=>te(n,"setStorageError",l)),{c(){s&&s.c(),e=N(),P(n.$$.fragment)},m(f,c){s&&s.m(f,c),w(f,e,c),L(n,f,c),o=!0},p(f,[c]){f[6].mode=="list"?s?(s.p(f,c),c&64&&b(s,1)):(s=Lo(f),s.c(),b(s,1),s.m(e.parentNode,e)):s&&(se(),y(s,1,1,()=>{s=null}),le());const p={};c&2&&(p.currentAuthority=f[1]),!t&&c&16&&(t=!0,p.show=f[4],ie(()=>t=!1)),!i&&c&32&&(i=!0,p.setStorageError=f[5],ie(()=>i=!1)),n.$set(p)},i(f){o||(b(s),b(n.$$.fragment,f),o=!0)},o(f){y(s),y(n.$$.fragment,f),o=!1},d(f){f&&k(e),s&&s.d(f),C(n,f)}}}function Wd(r,e){var n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8, "+encodeURIComponent(e)),n.setAttribute("download",r),document.body.appendChild(n),n.click(),document.body.removeChild(n)}function Kd(r,e,n){let t,i=Q,o=()=>(i(),i=We(u,B=>n(13,t=B)),u),s,a;H(r,ue,B=>n(6,s=B)),H(r,xe,B=>n(19,a=B)),r.$$.on_destroy.push(()=>i());let{cfg:l}=e,{gjSchemes:u}=e;o();let{authorityName:f}=e,c="",p=f;a!="v1"&&(p+=`_${a}`);let m=!1,h=!1;it(async()=>{let O=new URLSearchParams(window.location.search).get("geojsonUrl"),A=window.localStorage.getItem(p);if(O){console.log(`Loading GeoJSON from ${O}`);try{let I=await(await fetch(O)).text();u.set(Nn(JSON.parse(I)))}catch(F){console.log(`Failed to load from URL: ${F}`)}}else if(A)try{u.set(Nn(JSON.parse(A)))}catch(F){console.log(`Failed to load from local storage: ${F}`)}n(12,m=!0)});let $=!1,v;function M(){n(3,h=!1),u.update(B=>{let O=Tr(l);return O.origin=B.origin,O.authority=B.authority,O}),tn.set(null),rn.set(new Set),Be(ue,s.mode="list",s)}function g(){const B=JSON.parse(JSON.stringify(t));for(let O of B.features)delete O.properties.hide_while_editing;return B}function _(){let B=g();B.authority=f,B.origin="atip-v2",Wd(`${p}.geojson`,JSON.stringify(B,null," "))}function E(B,O){try{u.set(Nn(JSON.parse(O))),n(2,c="")}catch(A){n(2,c=`Couldn't load scheme from a file: ${A}`)}}const d=()=>n(3,h=!0),S=()=>n(3,h=!1);function R(B){h=B,n(3,h)}function j(B){$=B,n(4,$),n(12,m),n(13,t),n(11,p)}function T(B){v=B,n(5,v),n(12,m),n(13,t),n(11,p)}return r.$$set=B=>{"cfg"in B&&n(10,l=B.cfg),"gjSchemes"in B&&o(n(0,u=B.gjSchemes)),"authorityName"in B&&n(1,f=B.authorityName)},r.$$.update=()=>{if(r.$$.dirty&14336&&m&&t){console.log("GJ changed, saving to local storage");const B=vl(p,JSON.stringify(g()));B.isQuotaError&&(n(4,$=!0),n(5,v=B))}},[u,f,c,h,$,v,s,M,_,E,l,p,m,t,d,S,R,j,T]}class Hd extends ne{constructor(e){super(),re(this,e,Kd,Xd,x,{cfg:10,gjSchemes:0,authorityName:1})}}function Zd(r){let e;return{c(){e=D("div"),e.innerHTML=`

    Saving files

    ATIP does not send any data over the network or store your data in the - cloud. The current file you're editing will be saved in your browser's - local storage and automatically resume when you return to the page. Click Edit scheme - , then - Export to GeoJSON - or - Load from GeoJSON - to save or load a file to your computer. You can share these files with others - to collaborate on designs.

    `,z(e,"class","govuk-prose")},m(n,t){w(n,e,t)},p:Q,d(n){n&&k(e)}}}function Vd(r){let e,n,t;function i(s){r[1](s)}let o={title:"Instructions",$$slots:{default:[Zd]},$$scope:{ctx:r}};return r[0]!==void 0&&(o.open=r[0]),e=new yt({props:o}),V.push(()=>te(e,"open",i)),{c(){P(e.$$.fragment)},m(s,a){L(e,s,a),t=!0},p(s,[a]){const l={};a&4&&(l.$$scope={dirty:a,ctx:s}),!n&&a&1&&(n=!0,l.open=s[0],ie(()=>n=!1)),e.$set(l)},i(s){t||(b(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function Qd(r,e,n){let{open:t}=e;function i(o){t=o,n(0,t)}return r.$$set=o=>{"open"in o&&n(0,t=o.open)},[t,i]}class xd extends ne{constructor(e){super(),re(this,e,Qd,Vd,x,{open:0})}}function eg(r){let e;return{c(){e=q("Save")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function tg(r){let e;return{c(){e=q("Edit geometry")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function ng(r){let e;return{c(){e=q("Delete")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function rg(r){let e,n,t,i,o,s;return e=new mt({props:{$$slots:{default:[eg]},$$scope:{ctx:r}}}),e.$on("click",r[5]),t=new ge({props:{$$slots:{default:[tg]},$$scope:{ctx:r}}}),t.$on("click",r[6]),o=new wt({props:{$$slots:{default:[ng]},$$scope:{ctx:r}}}),o.$on("click",r[7]),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment),i=N(),P(o.$$.fragment)},m(a,l){L(e,a,l),w(a,n,l),L(t,a,l),w(a,i,l),L(o,a,l),s=!0},p(a,l){const u={};l&8192&&(u.$$scope={dirty:l,ctx:a}),e.$set(u);const f={};l&8192&&(f.$$scope={dirty:l,ctx:a}),t.$set(f);const c={};l&8192&&(c.$$scope={dirty:l,ctx:a}),o.$set(c)},i(a){s||(b(e.$$.fragment,a),b(t.$$.fragment,a),b(o.$$.fragment,a),s=!0)},o(a){y(e.$$.fragment,a),y(t.$$.fragment,a),y(o.$$.fragment,a),s=!1},d(a){a&&(k(n),k(i)),C(e,a),C(t,a),C(o,a)}}}function ig(r){let e,n,t=r[0].interventionName(r[3])+"",i,o,s,a,l,u,f,c,p,m,h,$;s=new Ke({props:{$$slots:{default:[rg]},$$scope:{ctx:r}}}),l=new Ye({props:{errorMessage:r[0].interventionWarning(r[3])}});function v(_){r[8](_)}var M=r[0].editFeatureForm;function g(_,E){let d={cfg:_[0],gjSchemes:_[1],id:_[2]};return _[3].properties!==void 0&&(d.props=_[3].properties),{props:d}}return M&&(f=jn(M,g(r)),V.push(()=>te(f,"props",v))),{c(){e=D("h2"),n=q("Editing "),i=q(t),o=N(),P(s.$$.fragment),a=N(),P(l.$$.fragment),u=N(),f&&P(f.$$.fragment),p=ce()},m(_,E){w(_,e,E),U(e,n),U(e,i),w(_,o,E),L(s,_,E),w(_,a,E),L(l,_,E),w(_,u,E),f&&L(f,_,E),w(_,p,E),m=!0,h||($=$e(window,"keydown",r[4]),h=!0)},p(_,[E]){(!m||E&9)&&t!==(t=_[0].interventionName(_[3])+"")&&he(i,t);const d={};E&8198&&(d.$$scope={dirty:E,ctx:_}),s.$set(d);const S={};if(E&9&&(S.errorMessage=_[0].interventionWarning(_[3])),l.$set(S),E&1&&M!==(M=_[0].editFeatureForm)){if(f){se();const R=f;y(R.$$.fragment,1,0,()=>{C(R,1)}),le()}M?(f=jn(M,g(_)),V.push(()=>te(f,"props",v)),P(f.$$.fragment),b(f.$$.fragment,1),L(f,p.parentNode,p)):f=null}else if(M){const R={};E&1&&(R.cfg=_[0]),E&2&&(R.gjSchemes=_[1]),E&4&&(R.id=_[2]),!c&&E&8&&(c=!0,R.props=_[3].properties,ie(()=>c=!1)),f.$set(R)}},i(_){m||(b(s.$$.fragment,_),b(l.$$.fragment,_),f&&b(f.$$.fragment,_),m=!0)},o(_){y(s.$$.fragment,_),y(l.$$.fragment,_),f&&y(f.$$.fragment,_),m=!1},d(_){_&&(k(e),k(o),k(a),k(u),k(p)),C(s,_),C(l,_),f&&C(f,_),h=!1,$()}}}function og(r,e,n){let t,i,o=Q,s=()=>(o(),o=We(l,g=>n(10,i=g)),l);H(r,Je,g=>n(9,t=g)),r.$$.on_destroy.push(()=>o());let{cfg:a}=e,{gjSchemes:l}=e;s();let{id:u}=e,f=i.features.find(g=>g.id==u);function c(g){l.set(i)}it(()=>{t==null||t.on("click",p)}),Xe(()=>{t==null||t.off("click",p)});function p(g){for(let _ of t.queryRenderedFeatures(g.point,{layers:["interventions-points","interventions-lines","interventions-polygons"]}))if(_.id==u)return;ue.set({mode:"list"})}function m(g){if(g.key=="Escape"){g.stopPropagation(),ue.set({mode:"list"});return}if(g.key=="Delete"){const _=g.target.tagName;if(_=="INPUT"||_=="TEXTAREA")return;g.stopPropagation(),ii(l,u)}if(g.key=="e"){const _=g.target.tagName;if(_=="INPUT"||_=="TEXTAREA")return;g.stopPropagation(),ue.set({mode:"edit-geometry",id:u})}}const h=()=>ue.set({mode:"list"}),$=()=>ue.set({mode:"edit-geometry",id:u}),v=()=>ii(l,u);function M(g){r.$$.not_equal(f.properties,g)&&(f.properties=g,n(3,f))}return r.$$set=g=>{"cfg"in g&&n(0,a=g.cfg),"gjSchemes"in g&&s(n(1,l=g.gjSchemes)),"id"in g&&n(2,u=g.id)},r.$$.update=()=>{r.$$.dirty&8&&c()},[a,l,u,f,m,h,$,v,M]}class sg extends ne{constructor(e){super(),re(this,e,og,ig,x,{cfg:0,gjSchemes:1,id:2})}}const lg="/atip/move_draw_controls/assets/delete-3c023172.svg";function Co(r,e,n){const t=r.slice();t[29]=e[n];const i=t[0].interventionWarning(t[29]);return t[30]=i,t}function ag(r){let e,n,t;return{c(){e=D("img"),t=q(` - Delete`),ot(e.src,n=lg)||z(e,"src",n),z(e,"alt","Delete scheme")},m(i,o){w(i,e,o),w(i,t,o)},p:Q,d(i){i&&(k(e),k(t))}}}function ug(r){let e;return{c(){e=q("Show")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function fg(r){let e,n;return e=new Ye({props:{errorMessage:"There's a problem with "+r[8]+" interventions below"}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i[0]&256&&(o.errorMessage="There's a problem with "+t[8]+" interventions below"),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function cg(r){let e,n;return e=new Ye({props:{errorMessage:"There's a problem with one intervention below"}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Ao(r){let e,n;return e=new Wo({props:{text:r[30]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i[0]&13&&(o.text=t[30]),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Fo(r,e){let n,t,i,o=e[0].interventionName(e[29])+"",s,a,l,u,f,c=e[30]&&Ao(e);function p(...$){return e[20](e[29],...$)}function m(){return e[21](e[29])}function h(){return e[22](e[29])}return{key:r,first:null,c(){n=D("li"),t=D("a"),c&&c.c(),i=N(),s=q(o),a=N(),z(t,"href","#"),this.first=n},m($,v){w($,n,v),U(n,t),c&&c.m(t,null),U(t,i),U(t,s),U(n,a),l=!0,u||(f=[$e(t,"click",p),$e(t,"mouseenter",m),$e(t,"mouseleave",h)],u=!0)},p($,v){e=$,e[30]?c?(c.p(e,v),v[0]&13&&b(c,1)):(c=Ao(e),c.c(),b(c,1),c.m(t,i)):c&&(se(),y(c,1,1,()=>{c=null}),le()),(!l||v[0]&13)&&o!==(o=e[0].interventionName(e[29])+"")&&he(s,o)},i($){l||(b(c),l=!0)},o($){y(c),l=!1},d($){$&&k(n),c&&c.d(),u=!1,xn(f)}}}function No(r){let e,n,t,i,o=r[7]==1?"intervention":"interventions",s,a,l,u,f,c;function p(h){r[23](h)}let m={label:"Move interventions to another scheme",choices:r[13]()};return r[5]!==void 0&&(m.value=r[5]),u=new nr({props:m}),V.push(()=>te(u,"value",p)),u.$on("change",r[12]),{c(){e=D("p"),n=q("Do you want to first move "),t=q(r[7]),i=N(),s=q(o),a=q(" to another scheme?"),l=N(),P(u.$$.fragment)},m(h,$){w(h,e,$),U(e,n),U(e,t),U(e,i),U(e,s),U(e,a),w(h,l,$),L(u,h,$),c=!0},p(h,$){(!c||$[0]&128)&&he(t,h[7]),(!c||$[0]&128)&&o!==(o=h[7]==1?"intervention":"interventions")&&he(s,o);const v={};!f&&$[0]&32&&(f=!0,v.value=h[5],ie(()=>f=!1)),u.$set(v)},i(h){c||(b(u.$$.fragment,h),c=!0)},o(h){y(u.$$.fragment,h),c=!1},d(h){h&&(k(e),k(l)),C(u,h)}}}function pg(r){let e;return{c(){e=q("Delete scheme")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function mg(r){let e;return{c(){e=q("Cancel")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function dg(r){let e,n,t,i;return e=new wt({props:{$$slots:{default:[pg]},$$scope:{ctx:r}}}),e.$on("click",r[11]),t=new ge({props:{$$slots:{default:[mg]},$$scope:{ctx:r}}}),t.$on("click",r[24]),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment)},m(o,s){L(e,o,s),w(o,n,s),L(t,o,s),i=!0},p(o,s){const a={};s[0]&67108864&&(a.$$scope={dirty:s,ctx:o}),e.$set(a);const l={};s[0]&67108864&&(l.$$scope={dirty:s,ctx:o}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),C(e,o),C(t,o)}}}function gg(r){let e=r[7]>0&&r[13]().length>0,n,t,i,o=e&&No(r);return t=new Ke({props:{$$slots:{default:[dg]},$$scope:{ctx:r}}}),{c(){o&&o.c(),n=N(),P(t.$$.fragment)},m(s,a){o&&o.m(s,a),w(s,n,a),L(t,s,a),i=!0},p(s,a){a[0]&128&&(e=s[7]>0&&s[13]().length>0),e?o?(o.p(s,a),a[0]&128&&b(o,1)):(o=No(s),o.c(),b(o,1),o.m(n.parentNode,n)):o&&(se(),y(o,1,1,()=>{o=null}),le());const l={};a[0]&67108880&&(l.$$scope={dirty:a,ctx:s}),t.$set(l)},i(s){i||(b(o),b(t.$$.fragment,s),i=!0)},o(s){y(o),y(t.$$.fragment,s),i=!1},d(s){s&&k(n),o&&o.d(s),C(t,s)}}}function hg(r){let e,n=r[0].schemeName(r[3].schemes[r[2]])+"",t,i,o,s,a,l,u,f,c,p,m,h,$,v,M,g,_=[],E=new Map,d,S,R,j,T,B;a=new wt({props:{$$slots:{default:[ag]},$$scope:{ctx:r}}}),a.$on("click",r[17]);function O(Y){r[18](Y)}let A={$$slots:{default:[ug]},$$scope:{ctx:r}};r[6]!==void 0&&(A.checked=r[6]),u=new Rt({props:A}),V.push(()=>te(u,"checked",O)),u.$on("change",r[14]);const F=r[15].default,I=at(F,r,r[26],null);var X=r[0].editSchemeForm;function J(Y,Z){return{props:{gjSchemes:Y[1],scheme_reference:Y[2]}}}X&&(m=jn(X,J(r)));const ee=[cg,fg],G=[];function fe(Y,Z){return Y[8]==1?0:Y[8]>0?1:-1}~($=fe(r))&&(v=G[$]=ee[$](r));let me=Ie(r[3].features.filter(r[19]));const _e=Y=>Y[29].id;for(let Y=0;Yte(S,"open",be)),{c(){e=D("h3"),t=q(n),i=N(),o=D("input"),s=N(),P(a.$$.fragment),l=N(),P(u.$$.fragment),c=N(),I&&I.c(),p=N(),m&&P(m.$$.fragment),h=N(),v&&v.c(),M=N(),g=D("ol");for(let Y=0;Y<_.length;Y+=1)_[Y].c();d=N(),P(S.$$.fragment),z(o,"type","color"),z(g,"class","govuk-list govuk-list--number")},m(Y,Z){w(Y,e,Z),U(e,t),U(e,i),U(e,o),Pe(o,r[3].schemes[r[2]].color),U(e,s),L(a,e,null),w(Y,l,Z),L(u,Y,Z),w(Y,c,Z),I&&I.m(Y,Z),w(Y,p,Z),m&&L(m,Y,Z),w(Y,h,Z),~$&&G[$].m(Y,Z),w(Y,M,Z),w(Y,g,Z);for(let je=0;je<_.length;je+=1)_[je]&&_[je].m(g,null);w(Y,d,Z),L(S,Y,Z),j=!0,T||(B=$e(o,"input",r[16]),T=!0)},p(Y,Z){(!j||Z[0]&13)&&n!==(n=Y[0].schemeName(Y[3].schemes[Y[2]])+"")&&he(t,n),Z[0]&12&&Pe(o,Y[3].schemes[Y[2]].color);const je={};Z[0]&67108864&&(je.$$scope={dirty:Z,ctx:Y}),a.$set(je);const W={};if(Z[0]&67108864&&(W.$$scope={dirty:Z,ctx:Y}),!f&&Z[0]&64&&(f=!0,W.checked=Y[6],ie(()=>f=!1)),u.$set(W),I&&I.p&&(!j||Z[0]&67108864)&&ut(I,F,Y,Y[26],j?ct(F,Y[26],Z,null):ft(Y[26]),null),Z[0]&1&&X!==(X=Y[0].editSchemeForm)){if(m){se();const Me=m;y(Me.$$.fragment,1,0,()=>{C(Me,1)}),le()}X?(m=jn(X,J(Y)),P(m.$$.fragment),b(m.$$.fragment,1),L(m,h.parentNode,h)):m=null}else if(X){const Me={};Z[0]&2&&(Me.gjSchemes=Y[1]),Z[0]&4&&(Me.scheme_reference=Y[2]),m.$set(Me)}let we=$;$=fe(Y),$===we?~$&&G[$].p(Y,Z):(v&&(se(),y(G[we],1,1,()=>{G[we]=null}),le()),~$?(v=G[$],v?v.p(Y,Z):(v=G[$]=ee[$](Y),v.c()),b(v,1),v.m(M.parentNode,M)):v=null),Z[0]&1549&&(me=Ie(Y[3].features.filter(Y[19])),se(),_=Br(_,Z,_e,1,Y,me,E,g,qr,Fo,null,Co),le());const qt={};Z[0]&67109040&&(qt.$$scope={dirty:Z,ctx:Y}),!R&&Z[0]&16&&(R=!0,qt.open=Y[4],ie(()=>R=!1)),S.$set(qt)},i(Y){if(!j){b(a.$$.fragment,Y),b(u.$$.fragment,Y),b(I,Y),m&&b(m.$$.fragment,Y),b(v);for(let Z=0;Z(a(),a=We(m,G=>n(3,s=G)),m),u;H(r,rn,G=>n(27,o=G)),H(r,Je,G=>n(28,u=G)),r.$$.on_destroy.push(()=>a());let{$$slots:f={},$$scope:c}=e,{cfg:p}=e,{gjSchemes:m}=e;l();let{scheme_reference:h}=e,$=!1;Xe(()=>{tn.set(null)});function v(G,fe){G.preventDefault();let me=s.features.find(_e=>_e.id==fe);me.geometry.type=="Point"?u==null||u.flyTo({center:me.geometry.coordinates,duration:500}):u==null||u.fitBounds(Yo(me),{padding:200,duration:500}),ue.set({mode:"edit-form",id:fe})}function M(G){tn.update(fe=>fe==G?null:fe)}function g(){m.update(G=>(G.features=G.features.filter(fe=>fe.properties.scheme_reference!=h),delete G.schemes[h],Object.keys(G.schemes).length==0&&(G=Tr(p)),G)),rn.update(G=>(G.delete(h),G)),n(4,$=!1)}let _="";function E(){_&&m.update(G=>{for(let fe of G.features)fe.properties.scheme_reference==h&&(fe.properties.scheme_reference=_);return G})}function d(){return Object.values(s.schemes).filter(G=>G.scheme_reference!=h).map(G=>[G.scheme_reference,p.schemeName(G)])}let S=!o.has(h);function R(){rn.update(G=>(S?G.delete(h):G.add(h),G))}function j(){s.schemes[h].color=this.value,m.set(s)}const T=()=>n(4,$=!0);function B(G){S=G,n(6,S)}const O=G=>G.properties.scheme_reference==h,A=(G,fe)=>v(fe,G.id),F=G=>tn.set(G.id),I=G=>M(G.id);function X(G){_=G,n(5,_)}const J=()=>n(4,$=!1);function ee(G){$=G,n(4,$)}return r.$$set=G=>{"cfg"in G&&n(0,p=G.cfg),"gjSchemes"in G&&l(n(1,m=G.gjSchemes)),"scheme_reference"in G&&n(2,h=G.scheme_reference),"$$scope"in G&&n(26,c=G.$$scope)},r.$$.update=()=>{r.$$.dirty[0]&13&&n(8,t=s.features.filter(G=>G.properties.scheme_reference==h&&p.interventionWarning(G)!=null).length),r.$$.dirty[0]&12&&n(7,i=s.features.filter(G=>G.properties.scheme_reference==h).length)},[p,m,h,s,$,_,S,i,t,v,M,g,E,d,R,f,j,T,B,O,A,F,I,X,J,ee,c]}class bg extends ne{constructor(e){super(),re(this,e,_g,hg,x,{cfg:0,gjSchemes:1,scheme_reference:2},null,[-1,-1])}}function Ro(r,e,n){const t=r.slice();return t[9]=e[n],t[11]=n,t}function $g(r){let e;return{c(){e=q("Add new blank scheme")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Oo(r){let e,n,t,i;function o(){return r[7](r[9])}e=new ge({props:{disabled:r[11]==0,$$slots:{default:[vg]},$$scope:{ctx:r}}}),e.$on("click",o);function s(){return r[8](r[9])}return t=new ge({props:{disabled:r[11]==Object.keys(r[3].schemes).length-1,$$slots:{default:[yg]},$$scope:{ctx:r}}}),t.$on("click",s),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment)},m(a,l){L(e,a,l),w(a,n,l),L(t,a,l),i=!0},p(a,l){r=a;const u={};l&8&&(u.disabled=r[11]==0),l&4096&&(u.$$scope={dirty:l,ctx:r}),e.$set(u);const f={};l&8&&(f.disabled=r[11]==Object.keys(r[3].schemes).length-1),l&4096&&(f.$$scope={dirty:l,ctx:r}),t.$set(f)},i(a){i||(b(e.$$.fragment,a),b(t.$$.fragment,a),i=!0)},o(a){y(e.$$.fragment,a),y(t.$$.fragment,a),i=!1},d(a){a&&k(n),C(e,a),C(t,a)}}}function vg(r){let e;return{c(){e=q("Move up")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function yg(r){let e;return{c(){e=q("Move down")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function wg(r){let e=Object.keys(r[3].schemes).length>1,n,t,i=e&&Oo(r);return{c(){i&&i.c(),n=ce()},m(o,s){i&&i.m(o,s),w(o,n,s),t=!0},p(o,s){s&8&&(e=Object.keys(o[3].schemes).length>1),e?i?(i.p(o,s),s&8&&b(i,1)):(i=Oo(o),i.c(),b(i,1),i.m(n.parentNode,n)):i&&(se(),y(i,1,1,()=>{i=null}),le())},i(o){t||(b(i),t=!0)},o(o){y(i),t=!1},d(o){o&&k(n),i&&i.d(o)}}}function Io(r,e){let n,t,i,o,s;return t=new bg({props:{cfg:e[0],gjSchemes:e[1],scheme_reference:e[9],$$slots:{default:[wg]},$$scope:{ctx:e}}}),{key:r,first:null,c(){n=ce(),P(t.$$.fragment),i=N(),o=D("hr"),this.first=n},m(a,l){w(a,n,l),L(t,a,l),w(a,i,l),w(a,o,l),s=!0},p(a,l){e=a;const u={};l&1&&(u.cfg=e[0]),l&2&&(u.gjSchemes=e[1]),l&8&&(u.scheme_reference=e[9]),l&4104&&(u.$$scope={dirty:l,ctx:e}),t.$set(u)},i(a){s||(b(t.$$.fragment,a),s=!0)},o(a){y(t.$$.fragment,a),s=!1},d(a){a&&(k(n),k(i),k(o)),C(t,a)}}}function kg(r){let e,n,t,i,o,s,a,l,u=[],f=new Map,c,p;e=new ge({props:{$$slots:{default:[$g]},$$scope:{ctx:r}}}),e.$on("click",r[4]),t=new Jo({props:{label:"Add scheme from file",onLoad:r[5]}}),o=new Ye({props:{errorMessage:r[2]}});let m=Ie(Object.keys(r[3].schemes));const h=$=>$[9];for(let $=0;${n[t]=e[t]}),n}function Mg(r,e,n){let t,i=Q,o=()=>(i(),i=We(a,h=>n(3,t=h)),a);r.$$.on_destroy.push(()=>i());let{cfg:s}=e,{gjSchemes:a}=e;o();function l(){yl(s,t),a.set(t)}let u="";function f(h,$){try{let v=s.backfill(JSON.parse($));for(let g of Object.values(v.schemes)){if(g.scheme_reference in t.schemes)throw new Error("The file you're loading seems to contain duplicate data. Are you merging in the same file accidentally?");Be(a,t.schemes[g.scheme_reference]=g,t)}Be(a,t.features=t.features.concat(v.features),t);let M=1;t.features.forEach(g=>{g.id=M++}),a.set(t),n(2,u="")}catch(v){n(2,u=`Couldn't load scheme from a file: ${v}`)}}function c(h,$){const v=JSON.parse(JSON.stringify(Object.keys(t.schemes))),M=v.indexOf(h);if(M+$>=0&&M+$c(h,-1),m=h=>c(h,1);return r.$$set=h=>{"cfg"in h&&n(0,s=h.cfg),"gjSchemes"in h&&o(n(1,a=h.gjSchemes))},[s,a,u,t,l,f,c,p,m]}class Pg extends ne{constructor(e){super(),re(this,e,Mg,kg,x,{cfg:0,gjSchemes:1})}}function jo(r){let e,n,t,i,o,s,a,l,u,f,c,p,m,h,$,v,M,g;return e=new kl({}),i=new Sl({}),$=new Gl({props:{boundaryGeojson:r[2]}}),M=new Ke({props:{$$slots:{default:[Ag]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment),n=N(),t=D("div"),P(i.$$.fragment),o=N(),s=D("p"),s.textContent=`App version: ${El()}`,a=N(),l=D("div"),u=D("p"),u.textContent=`${r[12]()}`,f=N(),c=D("a"),p=q("Change area"),h=N(),P($.$$.fragment),v=N(),P(M.$$.fragment),z(s,"class","svelte-1750ds5"),Oe(t,"border-bottom","1px solid #b1b4b6"),z(t,"class","svelte-1750ds5"),z(u,"class","svelte-1750ds5"),z(c,"href",m=`index.html?schema=${r[4]}`),z(c,"class","svelte-1750ds5"),Oe(l,"display","flex"),Oe(l,"justify-content","space-between"),z(l,"class","svelte-1750ds5")},m(_,E){L(e,_,E),w(_,n,E),w(_,t,E),L(i,t,null),U(t,o),U(t,s),w(_,a,E),w(_,l,E),U(l,u),U(l,f),U(l,c),U(c,p),U(l,h),L($,l,null),w(_,v,E),L(M,_,E),g=!0},p(_,E){(!g||E&16&&m!==(m=`index.html?schema=${_[4]}`))&&z(c,"href",m);const d={};E&4&&(d.boundaryGeojson=_[2]),$.$set(d);const S={};E&262144&&(S.$$scope={dirty:E,ctx:_}),M.$set(S)},i(_){g||(b(e.$$.fragment,_),b(i.$$.fragment,_),b($.$$.fragment,_),b(M.$$.fragment,_),g=!0)},o(_){y(e.$$.fragment,_),y(i.$$.fragment,_),y($.$$.fragment,_),y(M.$$.fragment,_),g=!1},d(_){_&&(k(n),k(t),k(a),k(l),k(v)),C(e,_),C(i),C($),C(M,_)}}}function Lg(r){let e;return{c(){e=q("About")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Cg(r){let e;return{c(){e=q("Instructions")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function Ag(r){let e,n,t,i;return e=new ge({props:{$$slots:{default:[Lg]},$$scope:{ctx:r}}}),e.$on("click",r[10]),t=new ge({props:{$$slots:{default:[Cg]},$$scope:{ctx:r}}}),t.$on("click",r[11]),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment)},m(o,s){L(e,o,s),w(o,n,s),L(t,o,s),i=!0},p(o,s){const a={};s&262144&&(a.$$scope={dirty:s,ctx:o}),e.$set(a);const l={};s&262144&&(l.$$scope={dirty:s,ctx:o}),t.$set(l)},i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),i=!0)},o(o){y(e.$$.fragment,o),y(t.$$.fragment,o),i=!1},d(o){o&&k(n),C(e,o),C(t,o)}}}function Fg(r){let e,n;return e=new sg({props:{cfg:Te,gjSchemes:r[7],id:r[3].id}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p(t,i){const o={};i&8&&(o.id=t[3].id),e.$set(o)},i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Ng(r){let e,n;return e=new Pg({props:{cfg:Te,gjSchemes:r[7]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Bo(r){let e;return{c(){e=D("hr"),z(e,"class","svelte-1750ds5")},m(n,t){w(n,e,t)},d(n){n&&k(e)}}}function qo(r){let e,n,t,i,o,s,a,l,u,f,c,p,m;e=new tf({props:{cfg:Te,boundaryGeojson:r[2]}}),t=new $c({props:{cfg:Te,gjSchemes:r[7]}}),o=new ic({props:{cfg:Te}}),a=new Em({props:{cfg:Te,gjSchemes:r[7],routeSnapperUrl:r[9]}});let h=r[3].mode=="split-route"&&Go(r);return f=new Cc({props:{cfg:Te}}),p=new kc({props:{cfg:Te}}),{c(){P(e.$$.fragment),n=N(),P(t.$$.fragment),i=N(),P(o.$$.fragment),s=N(),P(a.$$.fragment),l=N(),h&&h.c(),u=N(),P(f.$$.fragment),c=N(),P(p.$$.fragment)},m($,v){L(e,$,v),w($,n,v),L(t,$,v),w($,i,v),L(o,$,v),w($,s,v),L(a,$,v),w($,l,v),h&&h.m($,v),w($,u,v),L(f,$,v),w($,c,v),L(p,$,v),m=!0},p($,v){const M={};v&4&&(M.boundaryGeojson=$[2]),e.$set(M),$[3].mode=="split-route"?h?(h.p($,v),v&8&&b(h,1)):(h=Go($),h.c(),b(h,1),h.m(u.parentNode,u)):h&&(se(),y(h,1,1,()=>{h=null}),le())},i($){m||(b(e.$$.fragment,$),b(t.$$.fragment,$),b(o.$$.fragment,$),b(a.$$.fragment,$),b(h),b(f.$$.fragment,$),b(p.$$.fragment,$),m=!0)},o($){y(e.$$.fragment,$),y(t.$$.fragment,$),y(o.$$.fragment,$),y(a.$$.fragment,$),y(h),y(f.$$.fragment,$),y(p.$$.fragment,$),m=!1},d($){$&&(k(n),k(i),k(s),k(l),k(u),k(c)),C(e,$),C(t,$),C(o,$),C(a,$),h&&h.d($),C(f,$),C(p,$)}}}function Go(r){let e,n;return e=new bp({props:{cfg:Te,gjSchemes:r[7]}}),{c(){P(e.$$.fragment)},m(t,i){L(e,t,i),n=!0},p:Q,i(t){n||(b(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Rg(r){let e,n,t,i;e=new Tl({props:{position:"top-right"}});let o=r[6]&&qo(r);return{c(){P(e.$$.fragment),n=N(),o&&o.c(),t=ce()},m(s,a){L(e,s,a),w(s,n,a),o&&o.m(s,a),w(s,t,a),i=!0},p(s,a){s[6]?o?(o.p(s,a),a&64&&b(o,1)):(o=qo(s),o.c(),b(o,1),o.m(t.parentNode,t)):o&&(se(),y(o,1,1,()=>{o=null}),le())},i(s){i||(b(e.$$.fragment,s),b(o),i=!0)},o(s){y(e.$$.fragment,s),y(o),i=!1},d(s){s&&(k(n),k(t)),C(e,s),o&&o.d(s)}}}function Og(r){let e,n,t,i,o,s,a,l,u,f,c,p,m,h,$,v,M,g,_,E,d,S;t=new Bl({});let R=r[3].mode=="list"&&jo(r);s=new Hd({props:{cfg:Te,gjSchemes:r[7],authorityName:r[8]}});const j=[Ng,Fg],T=[];function B(J,ee){return J[3].mode=="list"?0:J[3].mode=="edit-form"?1:-1}~(l=B(r))&&(u=T[l]=j[l](r));let O=r[3].mode!="list"&&Bo();p=new ql({}),$=new wl({props:{style:r[5],$$slots:{default:[Rg]},$$scope:{ctx:r}}});function A(J){r[14](J)}let F={};r[0]!==void 0&&(F.open=r[0]),M=new Ul({props:F}),V.push(()=>te(M,"open",A));function I(J){r[15](J)}let X={};return r[1]!==void 0&&(X.open=r[1]),E=new xd({props:X}),V.push(()=>te(E,"open",I)),{c(){e=D("div"),n=D("div"),P(t.$$.fragment),i=N(),R&&R.c(),o=N(),P(s.$$.fragment),a=N(),u&&u.c(),f=N(),O&&O.c(),c=N(),P(p.$$.fragment),m=N(),h=D("div"),P($.$$.fragment),v=N(),P(M.$$.fragment),_=N(),P(E.$$.fragment),z(n,"class","sidebar govuk-prose svelte-1750ds5"),z(h,"class","main svelte-1750ds5"),z(e,"class","overall-layout svelte-1750ds5")},m(J,ee){w(J,e,ee),U(e,n),L(t,n,null),U(n,i),R&&R.m(n,null),U(n,o),L(s,n,null),U(n,a),~l&&T[l].m(n,null),U(n,f),O&&O.m(n,null),U(n,c),L(p,n,null),U(e,m),U(e,h),L($,h,null),w(J,v,ee),L(M,J,ee),w(J,_,ee),L(E,J,ee),S=!0},p(J,[ee]){J[3].mode=="list"?R?(R.p(J,ee),ee&8&&b(R,1)):(R=jo(J),R.c(),b(R,1),R.m(n,o)):R&&(se(),y(R,1,1,()=>{R=null}),le());let G=l;l=B(J),l===G?~l&&T[l].p(J,ee):(u&&(se(),y(T[G],1,1,()=>{T[G]=null}),le()),~l?(u=T[l],u?u.p(J,ee):(u=T[l]=j[l](J),u.c()),b(u,1),u.m(n,f)):u=null),J[3].mode!="list"?O||(O=Bo(),O.c(),O.m(n,c)):O&&(O.d(1),O=null);const fe={};ee&32&&(fe.style=J[5]),ee&262220&&(fe.$$scope={dirty:ee,ctx:J}),$.$set(fe);const me={};!g&&ee&1&&(g=!0,me.open=J[0],ie(()=>g=!1)),M.$set(me);const _e={};!d&&ee&2&&(d=!0,_e.open=J[1],ie(()=>d=!1)),E.$set(_e)},i(J){S||(b(t.$$.fragment,J),b(R),b(s.$$.fragment,J),b(u),b(p.$$.fragment,J),b($.$$.fragment,J),b(M.$$.fragment,J),b(E.$$.fragment,J),S=!0)},o(J){y(t.$$.fragment,J),y(R),y(s.$$.fragment,J),y(u),y(p.$$.fragment,J),y($.$$.fragment,J),y(M.$$.fragment,J),y(E.$$.fragment,J),S=!1},d(J){J&&(k(e),k(v),k(_)),C(t),R&&R.d(),C(s),~l&&T[l].d(),O&&O.d(),C(p),C($),C(M,J),C(E,J)}}}function Ig(r,e,n){let t,i,o,s,a;H(r,Ll,d=>n(13,t=d)),H(r,ue,d=>n(3,i=d)),H(r,xe,d=>n(4,o=d)),H(r,gr,d=>n(5,s=d)),H(r,Je,d=>n(6,a=d));let l=pt(Tr(Te)),u=!1,f=!1,c=new URLSearchParams(window.location.search),p=c.get("authority");gr.set(c.get("style")||"streets");let m=`https://atip.uk/route-snappers/v3/${p}.bin.gz`;function h(){n(0,u=!u),n(1,f=!1)}function $(){n(1,f=!f),n(0,u=!1)}let v;it(async()=>{Ml(),n(2,v=await M())});async function M(){let d=await Pl();return d.features=d.features.filter(S=>S.properties.full_name==p),d.features.length===0&&(window.location.href=`index.html?error=Authority name not found: ${p}`),d}function g(){let d=p.split("_");if(d.length==2){if(d[0]=="LAD")return`${d[1]} (LAD)`;if(d[0]=="TA")return`${d[1]} (Transport Authority)`}return p}function _(d){u=d,n(0,u)}function E(d){f=d,n(1,f)}return r.$$.update=()=>{r.$$.dirty&8192&&t&&Je.set(t)},[u,f,v,i,o,s,a,l,p,m,h,$,g,t,_,E]}class jg extends ne{constructor(e){super(),re(this,e,Ig,Og,x,{})}}document.body.className+=" js-enabled"+("noModule"in HTMLScriptElement.prototype?" govuk-frontend-supported":"");new jg({target:document.getElementById("app")}); diff --git a/move_draw_controls/assets/nested2-8e446194.js b/move_draw_controls/assets/nested2-50dc3b64.js similarity index 99% rename from move_draw_controls/assets/nested2-8e446194.js rename to move_draw_controls/assets/nested2-50dc3b64.js index 898f4066..89b1296b 100644 --- a/move_draw_controls/assets/nested2-8e446194.js +++ b/move_draw_controls/assets/nested2-50dc3b64.js @@ -1,4 +1,4 @@ -import{S as K,i as X,s as J,e as S,b as F,m as oe,c as d,n as Q,d as h,au as vr,g as H,h as E,a as L,j as b,p as w,_ as lt,u as B,t as m,q as g,v,Q as rt,T as st,U as ot,V as it,b6 as Hn,o as p,am as he,z as be,r as we,ax as Qe,y,P as G,aa as ve,ab as kn,ac as kr,w as Y,ad as yn,ae as yr,af as Ut,ag as Sr,ah as Tr,b7 as Ar,W as Bt,b8 as En,b9 as Fr,G as Gt,aQ as $n,a0 as ne,N as me,f as Ze,aS as Gr,b5 as le,a9 as Ne,ba as ce,K as te,J as De,a2 as re,at as se,R as Sn,aV as Qt,aX as tn,Z as Je,$ as Cr,bb as Kt,bc as Rt,bd as qr,be as zr,bf as Hr,x as Lr,bg as Er,D as Br,X as mn,b4 as Tn,bh as Ur,I as Wr,k as Cn,F as Yr,E as Jr,aY as Vr,aZ as _n,A as Qr,L as Zr,M as Kr,B as Xr}from"./index-7b4eed78.js";import{e as Bn,s as q,u as Ve,t as xr,q as tt,M as es,a as Ye,C as Re,v as _e,R as ts,k as At,h as Ke,f as Ft,b as ns,p as Un,g as ls,d as Wn,w as Yn,c as Jn,x as Jt,i as en,W as Mr,B as rs,S as ss,n as os,H as is,Z as as,G as fs,m as Vn}from"./ZoomOutMap-aaf9f888.js";import{P as fe,A as Ir}from"./Popup-b9aeab86.js";function us(s){let e;return{c(){e=S("span"),F(e,"class","svelte-kzgqtg"),oe(e,"background",s[0])},m(l,t){d(l,e,t)},p(l,[t]){t&1&&oe(e,"background",l[0])},i:Q,o:Q,d(l){l&&h(e)}}}function cs(s,e,l){let{color:t}=e;return s.$$set=n=>{"color"in n&&l(0,t=n.color)},[t]}class Se extends K{constructor(e){super(),X(this,e,cs,us,J,{color:0})}}const ps="/atip/move_draw_controls/assets/help-d011708a.svg";function $s(s){let e,l;const t=s[1].default,n=rt(t,s,s[4],null);return{c(){e=S("div"),n&&n.c(),F(e,"class","govuk-prose")},m(r,o){d(r,e,o),n&&n.m(e,null),l=!0},p(r,o){n&&n.p&&(!l||o&16)&&st(n,t,r,r[4],l?it(t,r[4],o,null):ot(r[4]),null)},i(r){l||(m(n,r),l=!0)},o(r){g(n,r),l=!1},d(r){r&&h(e),n&&n.d(r)}}}function ms(s){let e,l,t,n,r,o,f;function i(u){s[3](u)}let a={title:"Help",$$slots:{default:[$s]},$$scope:{ctx:s}};return s[0]!==void 0&&(a.open=s[0]),t=new vr({props:a}),H.push(()=>E(t,"open",i)),{c(){e=S("button"),e.innerHTML=`Help`,l=L(),b(t.$$.fragment),F(e,"class","svelte-7d9d1l")},m(u,c){d(u,e,c),d(u,l,c),w(t,u,c),r=!0,o||(f=lt(e,"click",s[2]),o=!0)},p(u,[c]){const $={};c&16&&($.$$scope={dirty:c,ctx:u}),!n&&c&1&&(n=!0,$.open=u[0],B(()=>n=!1)),t.$set($)},i(u){r||(m(t.$$.fragment,u),r=!0)},o(u){g(t.$$.fragment,u),r=!1},d(u){u&&(h(e),h(l)),v(t,u),o=!1,f()}}}function _s(s,e,l){let{$$slots:t={},$$scope:n}=e,r=!1;const o=()=>l(0,r=!0);function f(i){r=i,l(0,r)}return s.$$set=i=>{"$$scope"in i&&l(4,n=i.$$scope)},[r,t,o,f,n]}class gs extends K{constructor(e){super(),X(this,e,_s,ms,J,{})}}const ds=s=>({}),Qn=s=>({}),hs=s=>({}),Zn=s=>({});function bs(s){let e,l,t,n,r,o,f,i,a,u,c;const $=s[4].sidebar,_=rt($,s,s[3],Zn),k=s[4].main,T=rt(k,s,s[3],Qn);return{c(){e=S("div"),l=S("aside"),t=S("div"),_&&_.c(),n=L(),r=S("button"),r.textContent="→",f=L(),i=S("main"),T&&T.c(),F(t,"class","sidebar-content content-container svelte-1n0etgd"),F(r,"type","button"),F(r,"class","sidebar-toggle rounded-rect svelte-1n0etgd"),F(l,"class",o=Hn(s[1]?"":"collapsed")+" svelte-1n0etgd"),oe(l,"--sidebarWidth",s[0]),F(i,"class","svelte-1n0etgd"),F(e,"class","overall-layout svelte-1n0etgd")},m(C,N){d(C,e,N),p(e,l),p(l,t),_&&_.m(t,null),p(l,n),p(l,r),p(e,f),p(e,i),T&&T.m(i,null),a=!0,u||(c=lt(r,"click",s[2]),u=!0)},p(C,[N]){_&&_.p&&(!a||N&8)&&st(_,$,C,C[3],a?it($,C[3],N,hs):ot(C[3]),Zn),(!a||N&2&&o!==(o=Hn(C[1]?"":"collapsed")+" svelte-1n0etgd"))&&F(l,"class",o),(!a||N&1)&&oe(l,"--sidebarWidth",C[0]),T&&T.p&&(!a||N&8)&&st(T,k,C,C[3],a?it(k,C[3],N,ds):ot(C[3]),Qn)},i(C){a||(m(_,C),m(T,C),a=!0)},o(C){g(_,C),g(T,C),a=!1},d(C){C&&h(e),_&&_.d(C),T&&T.d(C),u=!1,c()}}}function ws(s,e,l){let{$$slots:t={},$$scope:n}=e,{sidebarWidth:r="25rem"}=e,o=!0;function f(){l(1,o=!o)}return s.$$set=i=>{"sidebarWidth"in i&&l(0,r=i.sidebarWidth),"$$scope"in i&&l(3,n=i.$$scope)},[r,o,f,n,t]}class vs extends K{constructor(e){super(),X(this,e,ws,bs,J,{sidebarWidth:0})}}function Kn(s,e,l){const t=s.slice();return t[1]=e[l][0],t[2]=e[l][1],t}function Xn(s){let e,l,t,n=s[1]+"",r,o,f;return l=new Se({props:{color:s[2]}}),{c(){e=S("li"),b(l.$$.fragment),t=L(),r=y(n),o=L()},m(i,a){d(i,e,a),w(l,e,null),p(e,t),p(e,r),p(e,o),f=!0},p(i,a){const u={};a&1&&(u.color=i[2]),l.$set(u),(!f||a&1)&&n!==(n=i[1]+"")&&G(r,n)},i(i){f||(m(l.$$.fragment,i),f=!0)},o(i){g(l.$$.fragment,i),f=!1},d(i){i&&h(e),v(l)}}}function ks(s){let e,l,t=he(s[0]),n=[];for(let o=0;og(n[o],1,1,()=>{n[o]=null});return{c(){e=S("ul");for(let o=0;o{"rows"in n&&l(0,t=n.rows)},[t]}class Xt extends K{constructor(e){super(),X(this,e,ys,ks,J,{rows:0})}}function xn(s){let e=s[0],l,t,n=el(s);return{c(){n.c(),l=ve()},m(r,o){n.m(r,o),d(r,l,o),t=!0},p(r,o){o&1&&J(e,e=r[0])?(be(),g(n,1,1,Q),we(),n=el(r),n.c(),m(n,1),n.m(l.parentNode,l)):n.p(r,o)},i(r){t||(m(n),t=!0)},o(r){g(n),t=!1},d(r){r&&h(l),n.d(r)}}}function el(s){let e;const l=s[16].default,t=rt(l,s,s[15],null);return{c(){t&&t.c()},m(n,r){t&&t.m(n,r),e=!0},p(n,r){t&&t.p&&(!e||r&32768)&&st(t,l,n,n[15],e?it(l,n[15],r,null):ot(n[15]),null)},i(n){e||(m(t,n),e=!0)},o(n){g(t,n),e=!1},d(n){t&&t.d(n)}}}function Ss(s){let e,l,t=s[0]&&xn(s);return{c(){t&&t.c(),e=ve()},m(n,r){t&&t.m(n,r),d(n,e,r),l=!0},p(n,[r]){n[0]?t?(t.p(n,r),r&1&&m(t,1)):(t=xn(n),t.c(),m(t,1),t.m(e.parentNode,e)):t&&(be(),g(t,1,1,()=>{t=null}),we())},i(n){l||(m(t),l=!0)},o(n){g(t),l=!1},d(n){n&&h(e),t&&t.d(n)}}}function Ts(s,e,l){let t,n,{$$slots:r={},$$scope:o}=e,{id:f=kn("raster-source")}=e,{tiles:i}=e,{tileSize:a=void 0}=e,{bounds:u=null}=e,{scheme:c=null}=e,{attribution:$=null}=e,{minzoom:_=null}=e,{maxzoom:k=null}=e,{volatile:T=null}=e;const{map:C,self:N}=kr();Y(s,C,M=>l(14,n=M)),Y(s,N,M=>l(0,t=M));let R,j=!0;return yn(()=>{t&&R&&n&&(yr(C,t,R),Ut(N,t=null,t),l(12,R=void 0))}),s.$$set=M=>{"id"in M&&l(3,f=M.id),"tiles"in M&&l(4,i=M.tiles),"tileSize"in M&&l(5,a=M.tileSize),"bounds"in M&&l(6,u=M.bounds),"scheme"in M&&l(7,c=M.scheme),"attribution"in M&&l(8,$=M.attribution),"minzoom"in M&&l(9,_=M.minzoom),"maxzoom"in M&&l(10,k=M.maxzoom),"volatile"in M&&l(11,T=M.volatile),"$$scope"in M&&l(15,o=M.$$scope)},s.$$.update=()=>{s.$$.dirty&24569&&n&&t!==f&&(Ut(N,t=f,t),Sr(n,t,Tr({type:"raster",tiles:i,tileSize:a,bounds:u,scheme:c,attribution:$,minzoom:_,maxzoom:k,volatile:T}),M=>n&&M===t,()=>{t&&(l(12,R=n==null?void 0:n.getSource(t)),l(13,j=!0))})),s.$$.dirty&16392&&(n==null||n.on("style.load",()=>{l(12,R=n==null?void 0:n.getSource(f))})),s.$$.dirty&12304&&R&&(j?l(13,j=!1):R.setTiles(i))},[t,C,N,f,i,a,u,c,$,_,k,T,R,j,n,o,r]}class Cs extends K{constructor(e){super(),X(this,e,Ts,Ss,J,{id:3,tiles:4,tileSize:5,bounds:6,scheme:7,attribution:8,minzoom:9,maxzoom:10,volatile:11})}}function Ls(s){let e;const l=s[16].default,t=rt(l,s,s[24],null);return{c(){t&&t.c()},m(n,r){t&&t.m(n,r),e=!0},p(n,r){t&&t.p&&(!e||r&16777216)&&st(t,l,n,n[24],e?it(l,n[24],r,null):ot(n[24]),null)},i(n){e||(m(t,n),e=!0)},o(n){g(t,n),e=!1},d(n){t&&t.d(n)}}}function Ms(s){let e,l,t;function n(o){s[17](o)}let r={id:s[1],type:"symbol",source:s[2],sourceLayer:s[3],beforeId:s[4],beforeLayerType:s[5],paint:s[6],layout:s[7],filter:s[8],applyToClusters:s[9],minzoom:s[10],maxzoom:s[11],hoverCursor:s[12],manageHoverState:s[13],eventsIfTopMost:s[14],interactive:s[15],$$slots:{default:[Ls]},$$scope:{ctx:s}};return s[0]!==void 0&&(r.hovered=s[0]),e=new Ar({props:r}),H.push(()=>E(e,"hovered",n)),e.$on("click",s[18]),e.$on("dblclick",s[19]),e.$on("contextmenu",s[20]),e.$on("mouseenter",s[21]),e.$on("mousemove",s[22]),e.$on("mouseleave",s[23]),{c(){b(e.$$.fragment)},m(o,f){w(e,o,f),t=!0},p(o,[f]){const i={};f&2&&(i.id=o[1]),f&4&&(i.source=o[2]),f&8&&(i.sourceLayer=o[3]),f&16&&(i.beforeId=o[4]),f&32&&(i.beforeLayerType=o[5]),f&64&&(i.paint=o[6]),f&128&&(i.layout=o[7]),f&256&&(i.filter=o[8]),f&512&&(i.applyToClusters=o[9]),f&1024&&(i.minzoom=o[10]),f&2048&&(i.maxzoom=o[11]),f&4096&&(i.hoverCursor=o[12]),f&8192&&(i.manageHoverState=o[13]),f&16384&&(i.eventsIfTopMost=o[14]),f&32768&&(i.interactive=o[15]),f&16777216&&(i.$$scope={dirty:f,ctx:o}),!l&&f&1&&(l=!0,i.hovered=o[0],B(()=>l=!1)),e.$set(i)},i(o){t||(m(e.$$.fragment,o),t=!0)},o(o){g(e.$$.fragment,o),t=!1},d(o){v(e,o)}}}function Is(s,e,l){let{$$slots:t={},$$scope:n}=e,{id:r=kn("symbol")}=e,{source:o=void 0}=e,{sourceLayer:f=void 0}=e,{beforeId:i=void 0}=e,{beforeLayerType:a=void 0}=e,{paint:u=void 0}=e,{layout:c=void 0}=e,{filter:$=void 0}=e,{applyToClusters:_=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:T=void 0}=e,{hoverCursor:C=void 0}=e,{manageHoverState:N=!1}=e,{hovered:R=null}=e,{eventsIfTopMost:j=!1}=e,{interactive:M=!0}=e;function O(A){R=A,l(0,R)}function I(A){Bt.call(this,s,A)}function D(A){Bt.call(this,s,A)}function P(A){Bt.call(this,s,A)}function z(A){Bt.call(this,s,A)}function Z(A){Bt.call(this,s,A)}function ae(A){Bt.call(this,s,A)}return s.$$set=A=>{"id"in A&&l(1,r=A.id),"source"in A&&l(2,o=A.source),"sourceLayer"in A&&l(3,f=A.sourceLayer),"beforeId"in A&&l(4,i=A.beforeId),"beforeLayerType"in A&&l(5,a=A.beforeLayerType),"paint"in A&&l(6,u=A.paint),"layout"in A&&l(7,c=A.layout),"filter"in A&&l(8,$=A.filter),"applyToClusters"in A&&l(9,_=A.applyToClusters),"minzoom"in A&&l(10,k=A.minzoom),"maxzoom"in A&&l(11,T=A.maxzoom),"hoverCursor"in A&&l(12,C=A.hoverCursor),"manageHoverState"in A&&l(13,N=A.manageHoverState),"hovered"in A&&l(0,R=A.hovered),"eventsIfTopMost"in A&&l(14,j=A.eventsIfTopMost),"interactive"in A&&l(15,M=A.interactive),"$$scope"in A&&l(24,n=A.$$scope)},[R,r,o,f,i,a,u,c,$,_,k,T,C,N,j,M,t,O,I,D,P,z,Z,ae,n]}class Ln extends K{constructor(e){super(),X(this,e,Is,Ms,J,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function tl(s){let e=s[0],l,t,n=nl(s);return{c(){n.c(),l=ve()},m(r,o){n.m(r,o),d(r,l,o),t=!0},p(r,o){o&1&&J(e,e=r[0])?(be(),g(n,1,1,Q),we(),n=nl(r),n.c(),m(n,1),n.m(l.parentNode,l)):n.p(r,o)},i(r){t||(m(n),t=!0)},o(r){g(n),t=!1},d(r){r&&h(l),n.d(r)}}}function nl(s){let e;const l=s[15].default,t=rt(l,s,s[14],null);return{c(){t&&t.c()},m(n,r){t&&t.m(n,r),e=!0},p(n,r){t&&t.p&&(!e||r&16384)&&st(t,l,n,n[14],e?it(l,n[14],r,null):ot(n[14]),null)},i(n){e||(m(t,n),e=!0)},o(n){g(t,n),e=!1},d(n){t&&t.d(n)}}}function Os(s){let e,l,t=s[0]&&tl(s);return{c(){t&&t.c(),e=ve()},m(n,r){t&&t.m(n,r),d(n,e,r),l=!0},p(n,[r]){n[0]?t?(t.p(n,r),r&1&&m(t,1)):(t=tl(n),t.c(),m(t,1),t.m(e.parentNode,e)):t&&(be(),g(t,1,1,()=>{t=null}),we())},i(n){l||(m(t),l=!0)},o(n){g(t),l=!1},d(n){n&&h(e),t&&t.d(n)}}}function Ns(s,e,l){let t,n,{$$slots:r={},$$scope:o}=e,{id:f=kn("vector")}=e,{url:i=null}=e,{tiles:a=null}=e,{promoteId:u=null}=e,{bounds:c=null}=e,{scheme:$=null}=e,{attribution:_=null}=e,{minzoom:k=null}=e,{maxzoom:T=null}=e,{volatile:C=null}=e;if(i&&i.includes("pmtiles://")&&!En.config.REGISTERED_PROTOCOLS.hasOwnProperty("pmtiles")){let M=new Fr;En.addProtocol("pmtiles",M.tile)}const{map:N,self:R}=kr();Y(s,N,M=>l(13,n=M)),Y(s,R,M=>l(0,t=M));let j;return yn(()=>{t&&n&&(yr(N,t,j),Ut(R,t=null,t),j=void 0)}),s.$$set=M=>{"id"in M&&l(3,f=M.id),"url"in M&&l(4,i=M.url),"tiles"in M&&l(5,a=M.tiles),"promoteId"in M&&l(6,u=M.promoteId),"bounds"in M&&l(7,c=M.bounds),"scheme"in M&&l(8,$=M.scheme),"attribution"in M&&l(9,_=M.attribution),"minzoom"in M&&l(10,k=M.minzoom),"maxzoom"in M&&l(11,T=M.maxzoom),"volatile"in M&&l(12,C=M.volatile),"$$scope"in M&&l(14,o=M.$$scope)},s.$$.update=()=>{s.$$.dirty&16377&&n&&t!==f&&(Ut(R,t=f,t),Sr(n,t,Tr({type:"vector",url:i,tiles:a,promoteId:u,bounds:c,scheme:$,attribution:_,minzoom:k,maxzoom:T,volatile:C}),M=>n&&M===t,()=>{t&&(j=n==null?void 0:n.getSource(t))})),s.$$.dirty&8200&&(n==null||n.on("style.load",()=>{j=n==null?void 0:n.getSource(f)}))},[t,N,R,f,i,a,u,c,$,_,k,T,C,n,o,r]}class pe extends K{constructor(e){super(),X(this,e,Ns,Os,J,{id:3,url:4,tiles:5,promoteId:6,bounds:7,scheme:8,attribution:9,minzoom:10,maxzoom:11,volatile:12})}}function ll(s,e,l){const t=s.slice();return t[11]=e[l],t[12]=e,t[13]=l,t}function js(s){let e,l,t;return l=new Ze({props:{$$slots:{default:[Ds]},$$scope:{ctx:s}}}),l.$on("click",s[9]),{c(){e=S("div"),b(l.$$.fragment)},m(n,r){d(n,e,r),w(l,e,null),t=!0},p(n,r){const o={};r&16384&&(o.$$scope={dirty:r,ctx:n}),l.$set(o)},i(n){t||(m(l.$$.fragment,n),t=!0)},o(n){g(l.$$.fragment,n),t=!1},d(n){n&&h(e),v(l)}}}function Ps(s){let e,l,t,n,r,o,f,i,a,u;l=new Ze({props:{$$slots:{default:[Rs]},$$scope:{ctx:s}}}),l.$on("click",s[4]);let c=s[2]&&rl(s);r=new tt({props:{label:"Help",$$slots:{default:[As]},$$scope:{ctx:s}}}),f=new Gr({}),f.$on("click",s[3]);let $=he(s[0]),_=[];for(let T=0;T<$.length;T+=1)_[T]=sl(ll(s,$,T));const k=T=>g(_[T],1,1,()=>{_[T]=null});return{c(){e=S("div"),b(l.$$.fragment),t=L(),c&&c.c(),n=L(),b(r.$$.fragment),o=L(),b(f.$$.fragment),i=L();for(let T=0;T<_.length;T+=1)_[T].c();a=ve()},m(T,C){d(T,e,C),w(l,e,null),d(T,t,C),c&&c.m(T,C),d(T,n,C),w(r,T,C),d(T,o,C),w(f,T,C),d(T,i,C);for(let N=0;N<_.length;N+=1)_[N]&&_[N].m(T,C);d(T,a,C),u=!0},p(T,C){const N={};C&16384&&(N.$$scope={dirty:C,ctx:T}),l.$set(N),T[2]?c?c.p(T,C):(c=rl(T),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null);const R={};if(C&16384&&(R.$$scope={dirty:C,ctx:T}),r.$set(R),C&65){$=he(T[0]);let j;for(j=0;j<$.length;j+=1){const M=ll(T,$,j);_[j]?(_[j].p(M,C),m(_[j],1)):(_[j]=sl(M),_[j].c(),m(_[j],1),_[j].m(a.parentNode,a))}for(be(),j=$.length;j<_.length;j+=1)k(j);we()}},i(T){if(!u){m(l.$$.fragment,T),m(r.$$.fragment,T),m(f.$$.fragment,T);for(let C=0;C<$.length;C+=1)m(_[C]);u=!0}},o(T){g(l.$$.fragment,T),g(r.$$.fragment,T),g(f.$$.fragment,T),_=_.filter(Boolean);for(let C=0;C<_.length;C+=1)g(_[C]);u=!1},d(T){T&&(h(e),h(t),h(n),h(o),h(i),h(a)),v(l),c&&c.d(T),v(r,T),v(f,T),Qe(_,T)}}}function Ds(s){let e;return{c(){e=y("Measure lines")},m(l,t){d(l,e,t)},d(l){l&&h(e)}}}function Rs(s){let e;return{c(){e=y("Stop measuring")},m(l,t){d(l,e,t)},d(l){l&&h(e)}}}function rl(s){let e,l,t=s[2].toFixed(2)+"",n,r;return{c(){e=S("p"),l=y("Length: "),n=y(t),r=y(" meters")},m(o,f){d(o,e,f),p(e,l),p(e,n),p(e,r)},p(o,f){f&4&&t!==(t=o[2].toFixed(2)+"")&&G(n,t)},d(o){o&&h(e)}}}function As(s){let e;return{c(){e=S("ul"),e.innerHTML=`
  • Click +import{S as K,i as X,s as J,e as S,b as F,m as oe,c as d,n as Q,d as h,au as vr,g as H,h as E,a as L,j as b,p as w,Z as lt,u as B,t as m,q as g,v,Q as rt,T as st,U as ot,V as it,b7 as Hn,o as p,am as he,z as be,r as we,ax as Qe,y,P as G,aa as ve,ab as kn,ac as kr,w as Y,ad as yn,ae as yr,af as Ut,ag as Sr,ah as Tr,b8 as Ar,$ as Bt,b9 as En,ba as Fr,G as Gt,aQ as $n,a0 as ne,N as me,f as Ze,aS as Gr,b6 as le,a9 as Ne,bb as ce,K as te,J as De,a2 as re,at as se,R as Sn,aV as Qt,aY as tn,Y as Je,_ as Cr,bc as Kt,bd as Rt,be as qr,bf as zr,bg as Hr,x as Lr,bh as Er,D as Br,W as mn,b5 as Tn,bi as Ur,I as Wr,k as Cn,F as Yr,E as Jr,aZ as Vr,a_ as _n,A as Qr,L as Zr,M as Kr,B as Xr}from"./index-d36e2ea3.js";import{e as Bn,s as q,u as Ve,t as xr,q as tt,M as es,a as Ye,C as Re,v as _e,R as ts,k as At,h as Ke,f as Ft,b as ns,p as Un,g as ls,d as Wn,w as Yn,c as Jn,x as Jt,i as en,W as Mr,B as rs,S as ss,n as os,H as is,Z as as,G as fs,m as Vn}from"./ZoomOutMap-9b4ebb28.js";import{P as fe,A as Ir}from"./Popup-61834b7b.js";function us(s){let e;return{c(){e=S("span"),F(e,"class","svelte-kzgqtg"),oe(e,"background",s[0])},m(l,t){d(l,e,t)},p(l,[t]){t&1&&oe(e,"background",l[0])},i:Q,o:Q,d(l){l&&h(e)}}}function cs(s,e,l){let{color:t}=e;return s.$$set=n=>{"color"in n&&l(0,t=n.color)},[t]}class Se extends K{constructor(e){super(),X(this,e,cs,us,J,{color:0})}}const ps="/atip/move_draw_controls/assets/help-d011708a.svg";function $s(s){let e,l;const t=s[1].default,n=rt(t,s,s[4],null);return{c(){e=S("div"),n&&n.c(),F(e,"class","govuk-prose")},m(r,o){d(r,e,o),n&&n.m(e,null),l=!0},p(r,o){n&&n.p&&(!l||o&16)&&st(n,t,r,r[4],l?it(t,r[4],o,null):ot(r[4]),null)},i(r){l||(m(n,r),l=!0)},o(r){g(n,r),l=!1},d(r){r&&h(e),n&&n.d(r)}}}function ms(s){let e,l,t,n,r,o,f;function i(u){s[3](u)}let a={title:"Help",$$slots:{default:[$s]},$$scope:{ctx:s}};return s[0]!==void 0&&(a.open=s[0]),t=new vr({props:a}),H.push(()=>E(t,"open",i)),{c(){e=S("button"),e.innerHTML=`Help`,l=L(),b(t.$$.fragment),F(e,"class","svelte-7d9d1l")},m(u,c){d(u,e,c),d(u,l,c),w(t,u,c),r=!0,o||(f=lt(e,"click",s[2]),o=!0)},p(u,[c]){const $={};c&16&&($.$$scope={dirty:c,ctx:u}),!n&&c&1&&(n=!0,$.open=u[0],B(()=>n=!1)),t.$set($)},i(u){r||(m(t.$$.fragment,u),r=!0)},o(u){g(t.$$.fragment,u),r=!1},d(u){u&&(h(e),h(l)),v(t,u),o=!1,f()}}}function _s(s,e,l){let{$$slots:t={},$$scope:n}=e,r=!1;const o=()=>l(0,r=!0);function f(i){r=i,l(0,r)}return s.$$set=i=>{"$$scope"in i&&l(4,n=i.$$scope)},[r,t,o,f,n]}class gs extends K{constructor(e){super(),X(this,e,_s,ms,J,{})}}const ds=s=>({}),Qn=s=>({}),hs=s=>({}),Zn=s=>({});function bs(s){let e,l,t,n,r,o,f,i,a,u,c;const $=s[4].sidebar,_=rt($,s,s[3],Zn),k=s[4].main,T=rt(k,s,s[3],Qn);return{c(){e=S("div"),l=S("aside"),t=S("div"),_&&_.c(),n=L(),r=S("button"),r.textContent="→",f=L(),i=S("main"),T&&T.c(),F(t,"class","sidebar-content content-container svelte-1n0etgd"),F(r,"type","button"),F(r,"class","sidebar-toggle rounded-rect svelte-1n0etgd"),F(l,"class",o=Hn(s[1]?"":"collapsed")+" svelte-1n0etgd"),oe(l,"--sidebarWidth",s[0]),F(i,"class","svelte-1n0etgd"),F(e,"class","overall-layout svelte-1n0etgd")},m(C,N){d(C,e,N),p(e,l),p(l,t),_&&_.m(t,null),p(l,n),p(l,r),p(e,f),p(e,i),T&&T.m(i,null),a=!0,u||(c=lt(r,"click",s[2]),u=!0)},p(C,[N]){_&&_.p&&(!a||N&8)&&st(_,$,C,C[3],a?it($,C[3],N,hs):ot(C[3]),Zn),(!a||N&2&&o!==(o=Hn(C[1]?"":"collapsed")+" svelte-1n0etgd"))&&F(l,"class",o),(!a||N&1)&&oe(l,"--sidebarWidth",C[0]),T&&T.p&&(!a||N&8)&&st(T,k,C,C[3],a?it(k,C[3],N,ds):ot(C[3]),Qn)},i(C){a||(m(_,C),m(T,C),a=!0)},o(C){g(_,C),g(T,C),a=!1},d(C){C&&h(e),_&&_.d(C),T&&T.d(C),u=!1,c()}}}function ws(s,e,l){let{$$slots:t={},$$scope:n}=e,{sidebarWidth:r="25rem"}=e,o=!0;function f(){l(1,o=!o)}return s.$$set=i=>{"sidebarWidth"in i&&l(0,r=i.sidebarWidth),"$$scope"in i&&l(3,n=i.$$scope)},[r,o,f,n,t]}class vs extends K{constructor(e){super(),X(this,e,ws,bs,J,{sidebarWidth:0})}}function Kn(s,e,l){const t=s.slice();return t[1]=e[l][0],t[2]=e[l][1],t}function Xn(s){let e,l,t,n=s[1]+"",r,o,f;return l=new Se({props:{color:s[2]}}),{c(){e=S("li"),b(l.$$.fragment),t=L(),r=y(n),o=L()},m(i,a){d(i,e,a),w(l,e,null),p(e,t),p(e,r),p(e,o),f=!0},p(i,a){const u={};a&1&&(u.color=i[2]),l.$set(u),(!f||a&1)&&n!==(n=i[1]+"")&&G(r,n)},i(i){f||(m(l.$$.fragment,i),f=!0)},o(i){g(l.$$.fragment,i),f=!1},d(i){i&&h(e),v(l)}}}function ks(s){let e,l,t=he(s[0]),n=[];for(let o=0;og(n[o],1,1,()=>{n[o]=null});return{c(){e=S("ul");for(let o=0;o{"rows"in n&&l(0,t=n.rows)},[t]}class Xt extends K{constructor(e){super(),X(this,e,ys,ks,J,{rows:0})}}function xn(s){let e=s[0],l,t,n=el(s);return{c(){n.c(),l=ve()},m(r,o){n.m(r,o),d(r,l,o),t=!0},p(r,o){o&1&&J(e,e=r[0])?(be(),g(n,1,1,Q),we(),n=el(r),n.c(),m(n,1),n.m(l.parentNode,l)):n.p(r,o)},i(r){t||(m(n),t=!0)},o(r){g(n),t=!1},d(r){r&&h(l),n.d(r)}}}function el(s){let e;const l=s[16].default,t=rt(l,s,s[15],null);return{c(){t&&t.c()},m(n,r){t&&t.m(n,r),e=!0},p(n,r){t&&t.p&&(!e||r&32768)&&st(t,l,n,n[15],e?it(l,n[15],r,null):ot(n[15]),null)},i(n){e||(m(t,n),e=!0)},o(n){g(t,n),e=!1},d(n){t&&t.d(n)}}}function Ss(s){let e,l,t=s[0]&&xn(s);return{c(){t&&t.c(),e=ve()},m(n,r){t&&t.m(n,r),d(n,e,r),l=!0},p(n,[r]){n[0]?t?(t.p(n,r),r&1&&m(t,1)):(t=xn(n),t.c(),m(t,1),t.m(e.parentNode,e)):t&&(be(),g(t,1,1,()=>{t=null}),we())},i(n){l||(m(t),l=!0)},o(n){g(t),l=!1},d(n){n&&h(e),t&&t.d(n)}}}function Ts(s,e,l){let t,n,{$$slots:r={},$$scope:o}=e,{id:f=kn("raster-source")}=e,{tiles:i}=e,{tileSize:a=void 0}=e,{bounds:u=null}=e,{scheme:c=null}=e,{attribution:$=null}=e,{minzoom:_=null}=e,{maxzoom:k=null}=e,{volatile:T=null}=e;const{map:C,self:N}=kr();Y(s,C,M=>l(14,n=M)),Y(s,N,M=>l(0,t=M));let R,j=!0;return yn(()=>{t&&R&&n&&(yr(C,t,R),Ut(N,t=null,t),l(12,R=void 0))}),s.$$set=M=>{"id"in M&&l(3,f=M.id),"tiles"in M&&l(4,i=M.tiles),"tileSize"in M&&l(5,a=M.tileSize),"bounds"in M&&l(6,u=M.bounds),"scheme"in M&&l(7,c=M.scheme),"attribution"in M&&l(8,$=M.attribution),"minzoom"in M&&l(9,_=M.minzoom),"maxzoom"in M&&l(10,k=M.maxzoom),"volatile"in M&&l(11,T=M.volatile),"$$scope"in M&&l(15,o=M.$$scope)},s.$$.update=()=>{s.$$.dirty&24569&&n&&t!==f&&(Ut(N,t=f,t),Sr(n,t,Tr({type:"raster",tiles:i,tileSize:a,bounds:u,scheme:c,attribution:$,minzoom:_,maxzoom:k,volatile:T}),M=>n&&M===t,()=>{t&&(l(12,R=n==null?void 0:n.getSource(t)),l(13,j=!0))})),s.$$.dirty&16392&&(n==null||n.on("style.load",()=>{l(12,R=n==null?void 0:n.getSource(f))})),s.$$.dirty&12304&&R&&(j?l(13,j=!1):R.setTiles(i))},[t,C,N,f,i,a,u,c,$,_,k,T,R,j,n,o,r]}class Cs extends K{constructor(e){super(),X(this,e,Ts,Ss,J,{id:3,tiles:4,tileSize:5,bounds:6,scheme:7,attribution:8,minzoom:9,maxzoom:10,volatile:11})}}function Ls(s){let e;const l=s[16].default,t=rt(l,s,s[24],null);return{c(){t&&t.c()},m(n,r){t&&t.m(n,r),e=!0},p(n,r){t&&t.p&&(!e||r&16777216)&&st(t,l,n,n[24],e?it(l,n[24],r,null):ot(n[24]),null)},i(n){e||(m(t,n),e=!0)},o(n){g(t,n),e=!1},d(n){t&&t.d(n)}}}function Ms(s){let e,l,t;function n(o){s[17](o)}let r={id:s[1],type:"symbol",source:s[2],sourceLayer:s[3],beforeId:s[4],beforeLayerType:s[5],paint:s[6],layout:s[7],filter:s[8],applyToClusters:s[9],minzoom:s[10],maxzoom:s[11],hoverCursor:s[12],manageHoverState:s[13],eventsIfTopMost:s[14],interactive:s[15],$$slots:{default:[Ls]},$$scope:{ctx:s}};return s[0]!==void 0&&(r.hovered=s[0]),e=new Ar({props:r}),H.push(()=>E(e,"hovered",n)),e.$on("click",s[18]),e.$on("dblclick",s[19]),e.$on("contextmenu",s[20]),e.$on("mouseenter",s[21]),e.$on("mousemove",s[22]),e.$on("mouseleave",s[23]),{c(){b(e.$$.fragment)},m(o,f){w(e,o,f),t=!0},p(o,[f]){const i={};f&2&&(i.id=o[1]),f&4&&(i.source=o[2]),f&8&&(i.sourceLayer=o[3]),f&16&&(i.beforeId=o[4]),f&32&&(i.beforeLayerType=o[5]),f&64&&(i.paint=o[6]),f&128&&(i.layout=o[7]),f&256&&(i.filter=o[8]),f&512&&(i.applyToClusters=o[9]),f&1024&&(i.minzoom=o[10]),f&2048&&(i.maxzoom=o[11]),f&4096&&(i.hoverCursor=o[12]),f&8192&&(i.manageHoverState=o[13]),f&16384&&(i.eventsIfTopMost=o[14]),f&32768&&(i.interactive=o[15]),f&16777216&&(i.$$scope={dirty:f,ctx:o}),!l&&f&1&&(l=!0,i.hovered=o[0],B(()=>l=!1)),e.$set(i)},i(o){t||(m(e.$$.fragment,o),t=!0)},o(o){g(e.$$.fragment,o),t=!1},d(o){v(e,o)}}}function Is(s,e,l){let{$$slots:t={},$$scope:n}=e,{id:r=kn("symbol")}=e,{source:o=void 0}=e,{sourceLayer:f=void 0}=e,{beforeId:i=void 0}=e,{beforeLayerType:a=void 0}=e,{paint:u=void 0}=e,{layout:c=void 0}=e,{filter:$=void 0}=e,{applyToClusters:_=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:T=void 0}=e,{hoverCursor:C=void 0}=e,{manageHoverState:N=!1}=e,{hovered:R=null}=e,{eventsIfTopMost:j=!1}=e,{interactive:M=!0}=e;function O(A){R=A,l(0,R)}function I(A){Bt.call(this,s,A)}function D(A){Bt.call(this,s,A)}function P(A){Bt.call(this,s,A)}function z(A){Bt.call(this,s,A)}function Z(A){Bt.call(this,s,A)}function ae(A){Bt.call(this,s,A)}return s.$$set=A=>{"id"in A&&l(1,r=A.id),"source"in A&&l(2,o=A.source),"sourceLayer"in A&&l(3,f=A.sourceLayer),"beforeId"in A&&l(4,i=A.beforeId),"beforeLayerType"in A&&l(5,a=A.beforeLayerType),"paint"in A&&l(6,u=A.paint),"layout"in A&&l(7,c=A.layout),"filter"in A&&l(8,$=A.filter),"applyToClusters"in A&&l(9,_=A.applyToClusters),"minzoom"in A&&l(10,k=A.minzoom),"maxzoom"in A&&l(11,T=A.maxzoom),"hoverCursor"in A&&l(12,C=A.hoverCursor),"manageHoverState"in A&&l(13,N=A.manageHoverState),"hovered"in A&&l(0,R=A.hovered),"eventsIfTopMost"in A&&l(14,j=A.eventsIfTopMost),"interactive"in A&&l(15,M=A.interactive),"$$scope"in A&&l(24,n=A.$$scope)},[R,r,o,f,i,a,u,c,$,_,k,T,C,N,j,M,t,O,I,D,P,z,Z,ae,n]}class Ln extends K{constructor(e){super(),X(this,e,Is,Ms,J,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function tl(s){let e=s[0],l,t,n=nl(s);return{c(){n.c(),l=ve()},m(r,o){n.m(r,o),d(r,l,o),t=!0},p(r,o){o&1&&J(e,e=r[0])?(be(),g(n,1,1,Q),we(),n=nl(r),n.c(),m(n,1),n.m(l.parentNode,l)):n.p(r,o)},i(r){t||(m(n),t=!0)},o(r){g(n),t=!1},d(r){r&&h(l),n.d(r)}}}function nl(s){let e;const l=s[15].default,t=rt(l,s,s[14],null);return{c(){t&&t.c()},m(n,r){t&&t.m(n,r),e=!0},p(n,r){t&&t.p&&(!e||r&16384)&&st(t,l,n,n[14],e?it(l,n[14],r,null):ot(n[14]),null)},i(n){e||(m(t,n),e=!0)},o(n){g(t,n),e=!1},d(n){t&&t.d(n)}}}function Os(s){let e,l,t=s[0]&&tl(s);return{c(){t&&t.c(),e=ve()},m(n,r){t&&t.m(n,r),d(n,e,r),l=!0},p(n,[r]){n[0]?t?(t.p(n,r),r&1&&m(t,1)):(t=tl(n),t.c(),m(t,1),t.m(e.parentNode,e)):t&&(be(),g(t,1,1,()=>{t=null}),we())},i(n){l||(m(t),l=!0)},o(n){g(t),l=!1},d(n){n&&h(e),t&&t.d(n)}}}function Ns(s,e,l){let t,n,{$$slots:r={},$$scope:o}=e,{id:f=kn("vector")}=e,{url:i=null}=e,{tiles:a=null}=e,{promoteId:u=null}=e,{bounds:c=null}=e,{scheme:$=null}=e,{attribution:_=null}=e,{minzoom:k=null}=e,{maxzoom:T=null}=e,{volatile:C=null}=e;if(i&&i.includes("pmtiles://")&&!En.config.REGISTERED_PROTOCOLS.hasOwnProperty("pmtiles")){let M=new Fr;En.addProtocol("pmtiles",M.tile)}const{map:N,self:R}=kr();Y(s,N,M=>l(13,n=M)),Y(s,R,M=>l(0,t=M));let j;return yn(()=>{t&&n&&(yr(N,t,j),Ut(R,t=null,t),j=void 0)}),s.$$set=M=>{"id"in M&&l(3,f=M.id),"url"in M&&l(4,i=M.url),"tiles"in M&&l(5,a=M.tiles),"promoteId"in M&&l(6,u=M.promoteId),"bounds"in M&&l(7,c=M.bounds),"scheme"in M&&l(8,$=M.scheme),"attribution"in M&&l(9,_=M.attribution),"minzoom"in M&&l(10,k=M.minzoom),"maxzoom"in M&&l(11,T=M.maxzoom),"volatile"in M&&l(12,C=M.volatile),"$$scope"in M&&l(14,o=M.$$scope)},s.$$.update=()=>{s.$$.dirty&16377&&n&&t!==f&&(Ut(R,t=f,t),Sr(n,t,Tr({type:"vector",url:i,tiles:a,promoteId:u,bounds:c,scheme:$,attribution:_,minzoom:k,maxzoom:T,volatile:C}),M=>n&&M===t,()=>{t&&(j=n==null?void 0:n.getSource(t))})),s.$$.dirty&8200&&(n==null||n.on("style.load",()=>{j=n==null?void 0:n.getSource(f)}))},[t,N,R,f,i,a,u,c,$,_,k,T,C,n,o,r]}class pe extends K{constructor(e){super(),X(this,e,Ns,Os,J,{id:3,url:4,tiles:5,promoteId:6,bounds:7,scheme:8,attribution:9,minzoom:10,maxzoom:11,volatile:12})}}function ll(s,e,l){const t=s.slice();return t[11]=e[l],t[12]=e,t[13]=l,t}function js(s){let e,l,t;return l=new Ze({props:{$$slots:{default:[Ds]},$$scope:{ctx:s}}}),l.$on("click",s[9]),{c(){e=S("div"),b(l.$$.fragment)},m(n,r){d(n,e,r),w(l,e,null),t=!0},p(n,r){const o={};r&16384&&(o.$$scope={dirty:r,ctx:n}),l.$set(o)},i(n){t||(m(l.$$.fragment,n),t=!0)},o(n){g(l.$$.fragment,n),t=!1},d(n){n&&h(e),v(l)}}}function Ps(s){let e,l,t,n,r,o,f,i,a,u;l=new Ze({props:{$$slots:{default:[Rs]},$$scope:{ctx:s}}}),l.$on("click",s[4]);let c=s[2]&&rl(s);r=new tt({props:{label:"Help",$$slots:{default:[As]},$$scope:{ctx:s}}}),f=new Gr({}),f.$on("click",s[3]);let $=he(s[0]),_=[];for(let T=0;T<$.length;T+=1)_[T]=sl(ll(s,$,T));const k=T=>g(_[T],1,1,()=>{_[T]=null});return{c(){e=S("div"),b(l.$$.fragment),t=L(),c&&c.c(),n=L(),b(r.$$.fragment),o=L(),b(f.$$.fragment),i=L();for(let T=0;T<_.length;T+=1)_[T].c();a=ve()},m(T,C){d(T,e,C),w(l,e,null),d(T,t,C),c&&c.m(T,C),d(T,n,C),w(r,T,C),d(T,o,C),w(f,T,C),d(T,i,C);for(let N=0;N<_.length;N+=1)_[N]&&_[N].m(T,C);d(T,a,C),u=!0},p(T,C){const N={};C&16384&&(N.$$scope={dirty:C,ctx:T}),l.$set(N),T[2]?c?c.p(T,C):(c=rl(T),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null);const R={};if(C&16384&&(R.$$scope={dirty:C,ctx:T}),r.$set(R),C&65){$=he(T[0]);let j;for(j=0;j<$.length;j+=1){const M=ll(T,$,j);_[j]?(_[j].p(M,C),m(_[j],1)):(_[j]=sl(M),_[j].c(),m(_[j],1),_[j].m(a.parentNode,a))}for(be(),j=$.length;j<_.length;j+=1)k(j);we()}},i(T){if(!u){m(l.$$.fragment,T),m(r.$$.fragment,T),m(f.$$.fragment,T);for(let C=0;C<$.length;C+=1)m(_[C]);u=!0}},o(T){g(l.$$.fragment,T),g(r.$$.fragment,T),g(f.$$.fragment,T),_=_.filter(Boolean);for(let C=0;C<_.length;C+=1)g(_[C]);u=!1},d(T){T&&(h(e),h(t),h(n),h(o),h(i),h(a)),v(l),c&&c.d(T),v(r,T),v(f,T),Qe(_,T)}}}function Ds(s){let e;return{c(){e=y("Measure lines")},m(l,t){d(l,e,t)},d(l){l&&h(e)}}}function Rs(s){let e;return{c(){e=y("Stop measuring")},m(l,t){d(l,e,t)},d(l){l&&h(e)}}}function rl(s){let e,l,t=s[2].toFixed(2)+"",n,r;return{c(){e=S("p"),l=y("Length: "),n=y(t),r=y(" meters")},m(o,f){d(o,e,f),p(e,l),p(e,n),p(e,r)},p(o,f){f&4&&t!==(t=o[2].toFixed(2)+"")&&G(n,t)},d(o){o&&h(e)}}}function As(s){let e;return{c(){e=S("ul"),e.innerHTML=`
  • Click on the map to place a new waypoint
  • Click and drag an existing waypoint to move it
  • Click an existing waypoint to delete it
  • Press Escape diff --git a/move_draw_controls/assets/scheme-9e1644e1.css b/move_draw_controls/assets/scheme-9e1644e1.css deleted file mode 100644 index fa1cf9a0..00000000 --- a/move_draw_controls/assets/scheme-9e1644e1.css +++ /dev/null @@ -1 +0,0 @@ -.dot.svelte-1tmbx1c{width:30px;height:30px;border-radius:50%;display:inline-block}.dot.svelte-1tmbx1c:hover{border:1px solid black;cursor:pointer}progress.svelte-q3473n{width:100%}.top.svelte-13k6o8k{position:absolute;top:10px;right:10px;width:90%;background-color:#fff;border:1px solid black}.toolbar.svelte-13k6o8k{display:flex;justify-content:space-between}fieldset.svelte-1bxyfcq{border:2px solid black;padding:8px}.svelte-1750ds5{box-sizing:border-box}.overall-layout.svelte-1750ds5{margin:0;padding:0;position:absolute;top:0;left:0;right:0;bottom:0;overflow-y:hidden;display:flex;flex-flow:row nowrap}.sidebar.svelte-1750ds5{width:25rem;padding:1rem;overflow-y:auto}.main.svelte-1750ds5{flex-grow:1;display:flex} diff --git a/move_draw_controls/assets/scheme-c080647f.css b/move_draw_controls/assets/scheme-c080647f.css new file mode 100644 index 00000000..39a95b87 --- /dev/null +++ b/move_draw_controls/assets/scheme-c080647f.css @@ -0,0 +1 @@ +.dot.svelte-1tmbx1c{width:30px;height:30px;border-radius:50%;display:inline-block}.dot.svelte-1tmbx1c:hover{border:1px solid black;cursor:pointer}progress.svelte-q3473n{width:100%}.focused.svelte-11kph2l{border-color:#fd0;outline:3px solid transparent;box-shadow:inset 0 0 0 1px #fd0}.top.svelte-njynco{position:absolute;top:10px;right:10px;width:90%;background-color:#fff;border:1px solid black;padding:4px}.toolbar.svelte-njynco{display:flex;justify-content:space-between}fieldset.svelte-1bxyfcq{border:2px solid black;padding:8px}.svelte-1750ds5{box-sizing:border-box}.overall-layout.svelte-1750ds5{margin:0;padding:0;position:absolute;top:0;left:0;right:0;bottom:0;overflow-y:hidden;display:flex;flex-flow:row nowrap}.sidebar.svelte-1750ds5{width:25rem;padding:1rem;overflow-y:auto}.main.svelte-1750ds5{flex-grow:1;display:flex} diff --git a/move_draw_controls/browse.html b/move_draw_controls/browse.html index e070a20b..4476a261 100644 --- a/move_draw_controls/browse.html +++ b/move_draw_controls/browse.html @@ -7,10 +7,10 @@ content="initial-scale=1,maximum-scale=1,user-scalable=no" /> ATIP v2 scheme browser - - - - + + + + diff --git a/move_draw_controls/index.html b/move_draw_controls/index.html index 0a79c340..f3dbc0df 100644 --- a/move_draw_controls/index.html +++ b/move_draw_controls/index.html @@ -7,10 +7,10 @@ content="initial-scale=1,maximum-scale=1,user-scalable=no" /> Active Travel Infrastructure Platform v2 - - - - + + + + diff --git a/move_draw_controls/scheme.html b/move_draw_controls/scheme.html index 4802fb62..f32b6741 100644 --- a/move_draw_controls/scheme.html +++ b/move_draw_controls/scheme.html @@ -7,12 +7,12 @@ content="initial-scale=1,maximum-scale=1,user-scalable=no" /> ATIP v2 Scheme Sketcher - - - - + + + + - +