diff --git a/assets/backend_bg.wasm b/assets/backend_bg.wasm index ba9d84d..78f037e 100644 Binary files a/assets/backend_bg.wasm and b/assets/backend_bg.wasm differ diff --git a/assets/main-cc0081b1.js b/assets/main-c662bd63.js similarity index 98% rename from assets/main-cc0081b1.js rename to assets/main-c662bd63.js index f8e1057..0343c56 100644 --- a/assets/main-cc0081b1.js +++ b/assets/main-c662bd63.js @@ -581,4 +581,4 @@ uniform ${A} ${P} u_${R}; `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){N.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(u,t,n){this._canvas.width=Math.floor(n*u),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const u={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{t={requestedAttributes:u},a&&(t.statusMessage=a.statusMessage,t.type=a.type)},{once:!0});const n=this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u);if(!n){const a="Failed to initialize WebGL";throw t?(t.message=a,new Error(JSON.stringify(t))):new Error(a)}this.painter=new zo(n,this.transform),_e.testSupport(n)}_onCooperativeGesture(u,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const c=this.transform.zoom,d=s.h.now();this.style.zoomHistory.update(c,d);const x=new s.a8(c,{now:d,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),b=x.crossFadingFactor();b===1&&b===this._crossFadingFactor||(n=!0,this._crossFadingFactor=b),this.style.update(x)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new s.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,s.bg.mark(s.bh.load),this.fire(new s.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new s.k("idle")),!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,s.bg.mark(s.bh.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var u;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Ne.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),N.remove(this._canvasContainer),N.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),s.bg.clearMetrics(),this._removed=!0,this.fire(new s.k("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=s.h.frame(u=>{s.bg.frame(u),this._frame=null,this._render(u)}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get version(){return xt}getCameraTargetElevation(){return this.transform.elevation}},wi.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),a=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,n)=>{const a=this._map._getUIString(`NavigationControl.${n}`);t.title=a,t.setAttribute("aria-label",a)},this.options=s.e({},ql,u),this._container=N.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),N.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),N.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=N.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(u){return this._map=u,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Zl(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){N.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(u,t){const n=N.create("button",u,this._container);return n.type="button",n.addEventListener("click",t),n}},wi.GeolocateControl=class extends s.E{constructor(u){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new s.k("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new s.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new s.L(t.coords.longitude,t.coords.latitude),a=t.coords.accuracy,c=this._map.getBearing(),d=s.e({bearing:c},this.options.fitBoundsOptions),x=Tt.fromLngLat(n,a);this._map.fitBounds(x,d,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new s.L(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&Ta)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new s.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=t=>{if(this._map){if(this._container.addEventListener("contextmenu",n=>n.preventDefault()),this._geolocateButton=N.create("button","maplibregl-ctrl-geolocate",this._container),N.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){s.w("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=N.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Fs({element:this._dotElement}),this._circleElement=N.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Fs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",n=>{n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n.originalEvent&&n.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new s.k("trackuserlocationend")))})}},this.options=s.e({},cr,u)}onAdd(u){return this._map=u,this._container=N.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,n=!1){xr===void 0||n?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(a=>{xr=a.state!=="denied",t(xr)}).catch(()=>{xr=!!window.navigator.geolocation,t(xr)}):(xr=!!window.navigator.geolocation,t(xr)):t(xr)}(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),N.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,or=0,Ta=!1}_isOutOfMapMaxBounds(u){const t=this._map.getMaxBounds(),n=u.coords;return t&&(n.longitudet.getEast()||n.latitudet.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const u=this._map.getBounds(),t=u.getSouthEast(),n=u.getNorthEast(),a=t.distanceTo(n),c=Math.ceil(this._accuracy/(a/this._map._container.clientHeight)*2);this._circleElement.style.width=`${c}px`,this._circleElement.style.height=`${c}px`}trigger(){if(!this._setup)return s.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new s.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":or--,Ta=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new s.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new s.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let u;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),or++,or>1?(u={maximumAge:6e5,timeout:0},Ta=!0):(u=this.options.positionOptions,Ta=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,u)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},wi.AttributionControl=Hn,wi.LogoControl=Yi,wi.ScaleControl=class{constructor(u){this._onMove=()=>{Ka(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Ka(this._map,this._container,this.options)},this.options=s.e({},Xa,u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=N.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){N.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},wi.FullscreenControl=class extends s.E{constructor(u={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:s.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=N.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){N.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=N.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);N.create("span","maplibregl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.title=u}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new s.k("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new s.k("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},wi.TerrainControl=class{constructor(u){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=u}onAdd(u){return this._map=u,this._container=N.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=N.create("button","maplibregl-ctrl-terrain",this._container),N.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){N.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},wi.Popup=class extends s.E{constructor(u){super(),this.remove=()=>(this._content&&N.remove(this._content),this._container&&(N.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new s.k("close")),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=N.create("div","maplibregl-popup",this._map.getContainer()),this._tip=N.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const x of this.options.className.split(" "))this._container.classList.add(x);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Gl(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const n=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let a=this.options.anchor;const c=Ia(this.options.offset);if(!a){const x=this._container.offsetWidth,b=this._container.offsetHeight;let S;S=n.y+c.bottom.ythis._map.transform.height-b?["bottom"]:[],n.xthis._map.transform.width-x/2&&S.push("right"),a=S.length===0?"bottom":S.join("-")}const d=n.add(c[a]).round();N.setTransform(this._container,`${so[a]} translate(${d.x}px,${d.y}px)`),Nc(this._container,a,"popup")},this._onClose=()=>{this.remove()},this.options=s.e(Object.create(Wl),u)}addTo(u){return this._map&&this.remove(),this._map=u,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new s.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=s.L.convert(u),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const t=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=u;a=n.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){var u;return(u=this._container)===null||u===void 0?void 0:u.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=N.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(u),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(u){this._container&&this._container.classList.add(u)}removeClassName(u){this._container&&this._container.classList.remove(u)}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){if(this._container)return this._container.classList.toggle(u)}_createCloseButton(){this.options.closeButton&&(this._closeButton=N.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(Hl);u&&u.focus()}},wi.Marker=Fs,wi.Style=Ir,wi.LngLat=s.L,wi.LngLatBounds=Tt,wi.Point=s.P,wi.MercatorCoordinate=s.U,wi.Evented=s.E,wi.AJAXError=s.bi,wi.config=s.c,wi.CanvasSource=_r,wi.GeoJSONSource=He,wi.ImageSource=ct,wi.RasterDEMTileSource=Pt,wi.RasterTileSource=ze,wi.VectorTileSource=Oi,wi.VideoSource=Zi,wi.setRTLTextPlugin=s.bj,wi.getRTLTextPluginStatus=s.bk,wi.prewarm=function(){qo().acquire(ti)},wi.clearPrewarmedResources=function(){const u=Un;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(ti),Un=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},Xl.extend(wi,{isSafari:s.ac,getPerformanceMetrics:s.bg.getPerformanceMetrics}),wi});var B=E;return B})})(Qp);var V_=Qp.exports;const is=Yp(V_);function vp(m){let f;return _=>{if(_)for(let v in _){let E=f==null?void 0:f[v],k=_[v];E!==k&&m(v,k,E)}else if(f)for(let v in f)m(v,void 0,f[v]);f=_}}function U_(m,...f){let _=[m];for(let v of f)if(v)Array.isArray(v)&&v[0]===m?_.push(...v.slice(1)):_.push(v);else continue;if(_.length!==1)return _.length===2?_[1]:_}function j_(m){return m===!0?["has","point_count"]:m===!1?["!",["has","point_count"]]:void 0}function q_(m,f){return["case",["boolean",["feature-state","hover"],!1],f,m]}var gu=Z_;function Z_(m){var f,_,v;if(m){if(Array.isArray(m)){for(f=[],_=m.length,v=0;v<_;v++){var E=m[v];E!=null&&f.push(E)}return f}if(typeof m=="object"){f={};var k=Object.keys(m);for(_=k.length,v=0;v<_;v++){var B=k[v],s=m[B];s!=null&&(f[B]=s)}return f}}}function xp(m){let f=m[0],_,v,E=bp(m);return{c(){E.c(),_=Oa()},m(k,B){E.m(k,B),hi(k,_,B),v=!0},p(k,B){B[0]&1&&Sr(f,f=k[0])?(rs(),St(E,1,1,Mr),ns(),E=bp(k),E.c(),ft(E,1),E.m(_.parentNode,_)):E.p(k,B)},i(k){v||(ft(E),v=!0)},o(k){St(E),v=!1},d(k){k&&li(_),E.d(k)}}}function bp(m){let f;const _=m[37].default,v=Ks(_,m,m[36],null);return{c(){v&&v.c()},m(E,k){v&&v.m(E,k),f=!0},p(E,k){v&&v.p&&(!f||k[1]&32)&&Ys(v,_,E,E[36],f?Js(_,E[36],k,null):Qs(E[36]),null)},i(E){f||(ft(v,E),f=!0)},o(E){St(v,E),f=!1},d(E){v&&v.d(E)}}}function G_(m){let f,_,v=m[0]&&xp(m);return{c(){v&&v.c(),f=Oa()},m(E,k){v&&v.m(E,k),hi(E,f,k),_=!0},p(E,k){E[0]?v?(v.p(E,k),k[0]&1&&ft(v,1)):(v=xp(E),v.c(),ft(v,1),v.m(f.parentNode,f)):v&&(rs(),St(v,1,1,()=>{v=null}),ns())},i(E){_||(ft(v),_=!0)},o(E){St(v),_=!1},d(E){E&&li(f),v&&v.d(E)}}}function W_(m,f,_){let v,E,k,B,s,H,N,_e,be,ye,Oe,Le,{$$slots:Be={},$$scope:Ne}=f,{id:et=Lc("layer")}=f,{source:at=void 0}=f,{sourceLayer:nt=void 0}=f,{beforeId:it=void 0}=f,{beforeLayerType:Vt=void 0}=f,{type:ei}=f,{paint:Ht=void 0}=f,{layout:Nt=void 0}=f,{filter:Jt=void 0}=f,{applyToClusters:At=void 0}=f,{minzoom:Ae=void 0}=f,{maxzoom:Ge=void 0}=f,{manageHoverState:Ui=!1}=f,{hovered:Dt=null}=f,{interactive:qt=!0}=f,{hoverCursor:Lt=void 0}=f,{eventsIfTopMost:di=!1}=f;const Pi=Ih(),{map:$r,source:Nr,self:zi,minzoom:Ti,maxzoom:Tt,eventTopMost:pi,layerInfo:Oi}=B_();Qr(m,$r,He=>_(32,be=He)),Qr(m,Nr,He=>_(33,ye=He)),Qr(m,zi,He=>_(0,_e=He)),Qr(m,Ti,He=>_(35,Le=He)),Qr(m,Tt,He=>_(34,Oe=He)),ol(()=>{_e&&be&&(Oi.delete(_e),be==null||be.removeLayer(_e))});let ze,Pt=!0;return m.$$set=He=>{"id"in He&&_(7,et=He.id),"source"in He&&_(8,at=He.source),"sourceLayer"in He&&_(9,nt=He.sourceLayer),"beforeId"in He&&_(10,it=He.beforeId),"beforeLayerType"in He&&_(11,Vt=He.beforeLayerType),"type"in He&&_(12,ei=He.type),"paint"in He&&_(13,Ht=He.paint),"layout"in He&&_(14,Nt=He.layout),"filter"in He&&_(15,Jt=He.filter),"applyToClusters"in He&&_(16,At=He.applyToClusters),"minzoom"in He&&_(17,Ae=He.minzoom),"maxzoom"in He&&_(18,Ge=He.maxzoom),"manageHoverState"in He&&_(19,Ui=He.manageHoverState),"hovered"in He&&_(6,Dt=He.hovered),"interactive"in He&&_(20,qt=He.interactive),"hoverCursor"in He&&_(21,Lt=He.hoverCursor),"eventsIfTopMost"in He&&_(22,di=He.eventsIfTopMost),"$$scope"in He&&_(36,Ne=He.$$scope)},m.$$.update=()=>{if(m.$$.dirty[0]&65536&&_(31,v=j_(At)),m.$$.dirty[0]&32768|m.$$.dirty[1]&1&&_(25,E=U_("all",v,Jt)),m.$$.dirty[0]&131072|m.$$.dirty[1]&16&&_(27,k=Ae??Le),m.$$.dirty[0]&262144|m.$$.dirty[1]&8&&_(26,B=Ge??Oe),m.$$.dirty[0]&256|m.$$.dirty[1]&4&&_(30,s=at||ye),m.$$.dirty[0]&1324908161|m.$$.dirty[1]&2&&be&&_e!==et&&s){let He=function(ct){var Bi,gr;if(!qt||!_e||!be||di&&pi(ct)!==_e)return;let Zi=ct.features??[],_r=(gr=(Bi=Zi[0])==null?void 0:Bi.properties)==null?void 0:gr.cluster_id,Ue={event:ct,map:be,clusterId:_r,layer:_e,source:s,features:Zi};Pi(ct.type,Ue)};_e&&Oi.delete(_e);let Zt=it;if(!it&&Vt){let ct=be.getStyle().layers,Zi=typeof Vt=="function"?Vt:Ue=>Ue.type===Vt,_r=ct==null?void 0:ct.find(Zi);_r&&(Zt=_r.id)}il(zi,_e=et,_e),be.addLayer(gu({id:_e,type:ei,source:s,"source-layer":nt,filter:E,paint:Ht,layout:Nt,minzoom:k,maxzoom:B}),Zt),_(24,Pt=!0),be.on("click",_e,He),be.on("dblclick",_e,He),be.on("contextmenu",_e,He),be.on("mouseenter",_e,ct=>{var Bi,gr;if(!qt||!_e||!be||di&&pi(ct)!==_e)return;Lt&&(be.getCanvas().style.cursor=Lt);let Zi=ct.features??[];_(6,Dt=Zi[0]??null);let _r=(gr=(Bi=Zi[0])==null?void 0:Bi.properties)==null?void 0:gr.cluster_id;Pi("mouseenter",{event:ct,map:be,clusterId:_r,layer:_e,source:s,features:Zi})}),be.on("mousemove",_e,ct=>{var Bi,gr,ci;if(!qt)return;if(di&&pi(ct)!==_e){_(6,Dt=null),Ui&&ze!==void 0&&(be==null||be.setFeatureState({source:s,sourceLayer:nt,id:ze},{hover:!1}),_(23,ze=void 0));return}be.getCanvas().style.cursor=Lt;let Zi=ct.features??[],_r=(gr=(Bi=Zi[0])==null?void 0:Bi.properties)==null?void 0:gr.cluster_id,Ue=(ci=Zi[0])==null?void 0:ci.id;Ue!==ze&&(Ui&&(ze!==void 0&&(be==null||be.setFeatureState({source:s,id:ze,sourceLayer:nt},{hover:!1})),be==null||be.setFeatureState({source:s,id:Ue,sourceLayer:nt},{hover:!0})),_(23,ze=Ue),_(6,Dt=Zi[0]??null)),Pi("mousemove",{event:ct,map:be,clusterId:_r,layer:_e,source:s,features:Zi})}),be.on("mouseleave",_e,ct=>{if(!(!qt||!_e||!be)){if(Lt&&(be.getCanvas().style.cursor=""),_(6,Dt=null),Ui&&ze!==void 0){const Zi={source:s,id:ze,sourceLayer:nt};be==null||be.setFeatureState(Zi,{hover:!1}),_(23,ze=void 0)}Pi("mouseleave",{map:be,layer:_e,source:s})}})}m.$$.dirty[0]&1048577&&_e&&Oi.set(_e,{interactive:qt}),m.$$.dirty[0]&1|m.$$.dirty[1]&2&&_(29,H=_e?vp((He,Zt)=>be==null?void 0:be.setPaintProperty(_e,He,Zt)):void 0),m.$$.dirty[0]&1|m.$$.dirty[1]&2&&_(28,N=_e?vp((He,Zt)=>be==null?void 0:be.setLayoutProperty(_e,He,Zt)):void 0),m.$$.dirty[0]&536879104&&(H==null||H(Ht)),m.$$.dirty[0]&268451840&&(N==null||N(Nt)),m.$$.dirty[0]&201326593|m.$$.dirty[1]&2&&_e&&(be==null||be.setLayerZoomRange(_e,k,B)),m.$$.dirty[0]&50331649|m.$$.dirty[1]&2&&_e&&(Pt?_(24,Pt=!1):be==null||be.setFilter(_e,E))},[_e,$r,Nr,zi,Ti,Tt,Dt,et,at,nt,it,Vt,ei,Ht,Nt,Jt,At,Ae,Ge,Ui,qt,Lt,di,ze,Pt,E,B,k,N,H,s,v,be,ye,Oe,Le,Ne,Be]}class Ch extends Gr{constructor(f){super(),Zr(this,f,W_,G_,Sr,{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 H_(m){let f;const _=m[16].default,v=Ks(_,m,m[24],null);return{c(){v&&v.c()},m(E,k){v&&v.m(E,k),f=!0},p(E,k){v&&v.p&&(!f||k&16777216)&&Ys(v,_,E,E[24],f?Js(_,E[24],k,null):Qs(E[24]),null)},i(E){f||(ft(v,E),f=!0)},o(E){St(v,E),f=!1},d(E){v&&v.d(E)}}}function X_(m){let f,_,v;function E(B){m[17](B)}let k={id:m[1],type:"circle",source:m[2],sourceLayer:m[3],beforeId:m[4],beforeLayerType:m[5],paint:m[6],layout:m[7],filter:m[8],applyToClusters:m[9],minzoom:m[10],maxzoom:m[11],hoverCursor:m[12],manageHoverState:m[13],eventsIfTopMost:m[14],interactive:m[15],$$slots:{default:[H_]},$$scope:{ctx:m}};return m[0]!==void 0&&(k.hovered=m[0]),f=new Ch({props:k}),$s.push(()=>zc(f,"hovered",E)),f.$on("click",m[18]),f.$on("dblclick",m[19]),f.$on("contextmenu",m[20]),f.$on("mouseenter",m[21]),f.$on("mousemove",m[22]),f.$on("mouseleave",m[23]),{c(){Ri(f.$$.fragment)},m(B,s){Ai(f,B,s),v=!0},p(B,[s]){const H={};s&2&&(H.id=B[1]),s&4&&(H.source=B[2]),s&8&&(H.sourceLayer=B[3]),s&16&&(H.beforeId=B[4]),s&32&&(H.beforeLayerType=B[5]),s&64&&(H.paint=B[6]),s&128&&(H.layout=B[7]),s&256&&(H.filter=B[8]),s&512&&(H.applyToClusters=B[9]),s&1024&&(H.minzoom=B[10]),s&2048&&(H.maxzoom=B[11]),s&4096&&(H.hoverCursor=B[12]),s&8192&&(H.manageHoverState=B[13]),s&16384&&(H.eventsIfTopMost=B[14]),s&32768&&(H.interactive=B[15]),s&16777216&&(H.$$scope={dirty:s,ctx:B}),!_&&s&1&&(_=!0,H.hovered=B[0],Pc(()=>_=!1)),f.$set(H)},i(B){v||(ft(f.$$.fragment,B),v=!0)},o(B){St(f.$$.fragment,B),v=!1},d(B){ki(f,B)}}}function K_(m,f,_){let{$$slots:v={},$$scope:E}=f,{id:k=Lc("circle")}=f,{source:B=void 0}=f,{sourceLayer:s=void 0}=f,{beforeId:H=void 0}=f,{beforeLayerType:N=void 0}=f,{paint:_e}=f,{layout:be=void 0}=f,{filter:ye=void 0}=f,{applyToClusters:Oe=void 0}=f,{minzoom:Le=void 0}=f,{maxzoom:Be=void 0}=f,{hoverCursor:Ne=void 0}=f,{manageHoverState:et=!1}=f,{hovered:at=null}=f,{eventsIfTopMost:nt=!1}=f,{interactive:it=!0}=f;function Vt(Ge){at=Ge,_(0,at)}function ei(Ge){pn.call(this,m,Ge)}function Ht(Ge){pn.call(this,m,Ge)}function Nt(Ge){pn.call(this,m,Ge)}function Jt(Ge){pn.call(this,m,Ge)}function At(Ge){pn.call(this,m,Ge)}function Ae(Ge){pn.call(this,m,Ge)}return m.$$set=Ge=>{"id"in Ge&&_(1,k=Ge.id),"source"in Ge&&_(2,B=Ge.source),"sourceLayer"in Ge&&_(3,s=Ge.sourceLayer),"beforeId"in Ge&&_(4,H=Ge.beforeId),"beforeLayerType"in Ge&&_(5,N=Ge.beforeLayerType),"paint"in Ge&&_(6,_e=Ge.paint),"layout"in Ge&&_(7,be=Ge.layout),"filter"in Ge&&_(8,ye=Ge.filter),"applyToClusters"in Ge&&_(9,Oe=Ge.applyToClusters),"minzoom"in Ge&&_(10,Le=Ge.minzoom),"maxzoom"in Ge&&_(11,Be=Ge.maxzoom),"hoverCursor"in Ge&&_(12,Ne=Ge.hoverCursor),"manageHoverState"in Ge&&_(13,et=Ge.manageHoverState),"hovered"in Ge&&_(0,at=Ge.hovered),"eventsIfTopMost"in Ge&&_(14,nt=Ge.eventsIfTopMost),"interactive"in Ge&&_(15,it=Ge.interactive),"$$scope"in Ge&&_(24,E=Ge.$$scope)},[at,k,B,s,H,N,_e,be,ye,Oe,Le,Be,Ne,et,nt,it,v,Vt,ei,Ht,Nt,Jt,At,Ae,E]}class ef extends Gr{constructor(f){super(),Zr(this,f,K_,X_,Sr,{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 J_(m){let f;const _=m[15].default,v=Ks(_,m,m[23],null);return{c(){v&&v.c()},m(E,k){v&&v.m(E,k),f=!0},p(E,k){v&&v.p&&(!f||k&8388608)&&Ys(v,_,E,E[23],f?Js(_,E[23],k,null):Qs(E[23]),null)},i(E){f||(ft(v,E),f=!0)},o(E){St(v,E),f=!1},d(E){v&&v.d(E)}}}function Y_(m){let f,_,v;function E(B){m[16](B)}let k={id:m[1],type:"fill",source:m[2],sourceLayer:m[3],beforeId:m[4],beforeLayerType:m[5],paint:m[6],layout:m[7],filter:m[8],minzoom:m[9],maxzoom:m[10],hoverCursor:m[11],manageHoverState:m[12],eventsIfTopMost:m[13],interactive:m[14],$$slots:{default:[J_]},$$scope:{ctx:m}};return m[0]!==void 0&&(k.hovered=m[0]),f=new Ch({props:k}),$s.push(()=>zc(f,"hovered",E)),f.$on("click",m[17]),f.$on("dblclick",m[18]),f.$on("contextmenu",m[19]),f.$on("mouseenter",m[20]),f.$on("mousemove",m[21]),f.$on("mouseleave",m[22]),{c(){Ri(f.$$.fragment)},m(B,s){Ai(f,B,s),v=!0},p(B,[s]){const H={};s&2&&(H.id=B[1]),s&4&&(H.source=B[2]),s&8&&(H.sourceLayer=B[3]),s&16&&(H.beforeId=B[4]),s&32&&(H.beforeLayerType=B[5]),s&64&&(H.paint=B[6]),s&128&&(H.layout=B[7]),s&256&&(H.filter=B[8]),s&512&&(H.minzoom=B[9]),s&1024&&(H.maxzoom=B[10]),s&2048&&(H.hoverCursor=B[11]),s&4096&&(H.manageHoverState=B[12]),s&8192&&(H.eventsIfTopMost=B[13]),s&16384&&(H.interactive=B[14]),s&8388608&&(H.$$scope={dirty:s,ctx:B}),!_&&s&1&&(_=!0,H.hovered=B[0],Pc(()=>_=!1)),f.$set(H)},i(B){v||(ft(f.$$.fragment,B),v=!0)},o(B){St(f.$$.fragment,B),v=!1},d(B){ki(f,B)}}}function Q_(m,f,_){let{$$slots:v={},$$scope:E}=f,{id:k=Lc("fill")}=f,{source:B=void 0}=f,{sourceLayer:s=void 0}=f,{beforeId:H=void 0}=f,{beforeLayerType:N=void 0}=f,{paint:_e}=f,{layout:be=void 0}=f,{filter:ye=void 0}=f,{minzoom:Oe=void 0}=f,{maxzoom:Le=void 0}=f,{hoverCursor:Be=void 0}=f,{manageHoverState:Ne=!1}=f,{hovered:et=null}=f,{eventsIfTopMost:at=!1}=f,{interactive:nt=!0}=f;function it(Ae){et=Ae,_(0,et)}function Vt(Ae){pn.call(this,m,Ae)}function ei(Ae){pn.call(this,m,Ae)}function Ht(Ae){pn.call(this,m,Ae)}function Nt(Ae){pn.call(this,m,Ae)}function Jt(Ae){pn.call(this,m,Ae)}function At(Ae){pn.call(this,m,Ae)}return m.$$set=Ae=>{"id"in Ae&&_(1,k=Ae.id),"source"in Ae&&_(2,B=Ae.source),"sourceLayer"in Ae&&_(3,s=Ae.sourceLayer),"beforeId"in Ae&&_(4,H=Ae.beforeId),"beforeLayerType"in Ae&&_(5,N=Ae.beforeLayerType),"paint"in Ae&&_(6,_e=Ae.paint),"layout"in Ae&&_(7,be=Ae.layout),"filter"in Ae&&_(8,ye=Ae.filter),"minzoom"in Ae&&_(9,Oe=Ae.minzoom),"maxzoom"in Ae&&_(10,Le=Ae.maxzoom),"hoverCursor"in Ae&&_(11,Be=Ae.hoverCursor),"manageHoverState"in Ae&&_(12,Ne=Ae.manageHoverState),"hovered"in Ae&&_(0,et=Ae.hovered),"eventsIfTopMost"in Ae&&_(13,at=Ae.eventsIfTopMost),"interactive"in Ae&&_(14,nt=Ae.interactive),"$$scope"in Ae&&_(23,E=Ae.$$scope)},[et,k,B,s,H,N,_e,be,ye,Oe,Le,Be,Ne,at,nt,v,it,Vt,ei,Ht,Nt,Jt,At,E]}class tf extends Gr{constructor(f){super(),Zr(this,f,Q_,Y_,Sr,{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 $_(m,f,_){let v;const{map:E}=Ll();Qr(m,E,H=>_(4,v=H));let{position:k="top-left"}=f,{container:B=void 0}=f,s=null;return ol(()=>{v!=null&&v.loaded()&&s&&v.removeControl(s)}),m.$$set=H=>{"position"in H&&_(1,k=H.position),"container"in H&&_(2,B=H.container)},m.$$.update=()=>{if(m.$$.dirty&30&&v&&!s){let H;typeof B=="string"?H=document.querySelector(B)??void 0:H=B,_(3,s=new is.FullscreenControl({container:H})),v.addControl(s,k)}},[E,k,B,s,v]}class eg extends Gr{constructor(f){super(),Zr(this,f,$_,null,Sr,{position:1,container:2})}}function tg(m,f,_,v,E){let k=!1;m.getSource(f)&&(k=!0,m.removeSource(f));const B=()=>{v(f)&&(m.addSource(f,_),E())};if(k){const s=()=>{f&&(m.getSource(f)?setTimeout(s,1):B())};s()}else B()}function ig(m,f,_){v_().then(()=>{let v=h_(m);if(!v)return;v.getSource(f)===_&&v.removeSource(f)})}function wp(m){let f=m[0],_,v,E=Sp(m);return{c(){E.c(),_=Oa()},m(k,B){E.m(k,B),hi(k,_,B),v=!0},p(k,B){B&1&&Sr(f,f=k[0])?(rs(),St(E,1,1,Mr),ns(),E=Sp(k),E.c(),ft(E,1),E.m(_.parentNode,_)):E.p(k,B)},i(k){v||(ft(E),v=!0)},o(k){St(E),v=!1},d(k){k&&li(_),E.d(k)}}}function Sp(m){let f;const _=m[15].default,v=Ks(_,m,m[14],null);return{c(){v&&v.c()},m(E,k){v&&v.m(E,k),f=!0},p(E,k){v&&v.p&&(!f||k&16384)&&Ys(v,_,E,E[14],f?Js(_,E[14],k,null):Qs(E[14]),null)},i(E){f||(ft(v,E),f=!0)},o(E){St(v,E),f=!1},d(E){v&&v.d(E)}}}function rg(m){let f,_,v=m[0]&&wp(m);return{c(){v&&v.c(),f=Oa()},m(E,k){v&&v.m(E,k),hi(E,f,k),_=!0},p(E,[k]){E[0]?v?(v.p(E,k),k&1&&ft(v,1)):(v=wp(E),v.c(),ft(v,1),v.m(f.parentNode,f)):v&&(rs(),St(v,1,1,()=>{v=null}),ns())},i(E){_||(ft(v),_=!0)},o(E){St(v),_=!1},d(E){E&&li(f),v&&v.d(E)}}}function ng(m,f,_){let v,E,k,{$$slots:B={},$$scope:s}=f,{id:H=Lc("geojson")}=f,{data:N}=f,{generateId:_e=!1}=f,{promoteId:be=void 0}=f,{filter:ye=void 0}=f,{lineMetrics:Oe=void 0}=f,{cluster:Le=void 0}=f;const{map:Be,cluster:Ne,self:et}=O_();Qr(m,Be,it=>_(13,E=it)),Qr(m,Ne,it=>_(16,k=it)),Qr(m,et,it=>_(0,v=it));let at,nt=!0;return ol(()=>{v&&at&&E&&(ig(Be,v,at),il(et,v=null,v),_(11,at=void 0))}),m.$$set=it=>{"id"in it&&_(4,H=it.id),"data"in it&&_(5,N=it.data),"generateId"in it&&_(6,_e=it.generateId),"promoteId"in it&&_(7,be=it.promoteId),"filter"in it&&_(8,ye=it.filter),"lineMetrics"in it&&_(9,Oe=it.lineMetrics),"cluster"in it&&_(10,Le=it.cluster),"$$scope"in it&&_(14,s=it.$$scope)},m.$$.update=()=>{m.$$.dirty&1024&&il(Ne,k=Le,k),m.$$.dirty&12273&&E&&v!==H&&(il(et,v=H,v),tg(E,v,gu({type:"geojson",data:N,filter:ye,lineMetrics:Oe,generateId:_e,promoteId:be,cluster:!!Le,clusterMinPoints:Le==null?void 0:Le.minPoints,clusterMaxZoom:Le==null?void 0:Le.maxZoom,clusterRadius:Le==null?void 0:Le.radius,clusterProperties:Le==null?void 0:Le.properties}),it=>E&&it===v,()=>{v&&(_(11,at=E==null?void 0:E.getSource(v)),_(12,nt=!0))})),m.$$.dirty&8208&&(E==null||E.on("style.load",()=>{_(11,at=E==null?void 0:E.getSource(H))})),m.$$.dirty&6176&&at&&(nt?_(12,nt=!1):at.setData(N)),m.$$.dirty&3072&&(at==null||at.setClusterOptions(gu({cluster:!!Le,clusterMaxZoom:Le==null?void 0:Le.maxZoom,clusterRadius:Le==null?void 0:Le.radius})))},[v,Be,Ne,et,H,N,_e,be,ye,Oe,Le,at,nt,E,s,B]}class Mh extends Gr{constructor(f){super(),Zr(this,f,ng,rg,Sr,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function og(m,f,_){let v;const{map:E}=Ll();Qr(m,E,ye=>_(8,v=ye));let{position:k="top-left"}=f,{positionOptions:B=void 0}=f,{fitBoundsOptions:s=void 0}=f,{trackUserLocation:H=!1}=f,{showAccuracyCircle:N=!0}=f,{showUserLocation:_e=!0}=f,be=null;return ol(()=>{v!=null&&v.loaded()&&be&&v.removeControl(be)}),m.$$set=ye=>{"position"in ye&&_(1,k=ye.position),"positionOptions"in ye&&_(2,B=ye.positionOptions),"fitBoundsOptions"in ye&&_(3,s=ye.fitBoundsOptions),"trackUserLocation"in ye&&_(4,H=ye.trackUserLocation),"showAccuracyCircle"in ye&&_(5,N=ye.showAccuracyCircle),"showUserLocation"in ye&&_(6,_e=ye.showUserLocation)},m.$$.update=()=>{m.$$.dirty&510&&v&&!be&&(_(7,be=new is.GeolocateControl({positionOptions:B,fitBoundsOptions:s,trackUserLocation:H,showAccuracyCircle:N,showUserLocation:_e})),v.addControl(be,k))},[E,k,B,s,H,N,_e,be,v]}class sg extends Gr{constructor(f){super(),Zr(this,f,og,null,Sr,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function ag(m){let f;const _=m[15].default,v=Ks(_,m,m[23],null);return{c(){v&&v.c()},m(E,k){v&&v.m(E,k),f=!0},p(E,k){v&&v.p&&(!f||k&8388608)&&Ys(v,_,E,E[23],f?Js(_,E[23],k,null):Qs(E[23]),null)},i(E){f||(ft(v,E),f=!0)},o(E){St(v,E),f=!1},d(E){v&&v.d(E)}}}function lg(m){let f,_,v;function E(B){m[16](B)}let k={id:m[1],type:"line",source:m[2],sourceLayer:m[3],beforeId:m[4],beforeLayerType:m[5],paint:m[6],layout:m[7],filter:m[8],minzoom:m[9],maxzoom:m[10],hoverCursor:m[11],manageHoverState:m[12],eventsIfTopMost:m[13],interactive:m[14],$$slots:{default:[ag]},$$scope:{ctx:m}};return m[0]!==void 0&&(k.hovered=m[0]),f=new Ch({props:k}),$s.push(()=>zc(f,"hovered",E)),f.$on("click",m[17]),f.$on("dblclick",m[18]),f.$on("contextmenu",m[19]),f.$on("mouseenter",m[20]),f.$on("mousemove",m[21]),f.$on("mouseleave",m[22]),{c(){Ri(f.$$.fragment)},m(B,s){Ai(f,B,s),v=!0},p(B,[s]){const H={};s&2&&(H.id=B[1]),s&4&&(H.source=B[2]),s&8&&(H.sourceLayer=B[3]),s&16&&(H.beforeId=B[4]),s&32&&(H.beforeLayerType=B[5]),s&64&&(H.paint=B[6]),s&128&&(H.layout=B[7]),s&256&&(H.filter=B[8]),s&512&&(H.minzoom=B[9]),s&1024&&(H.maxzoom=B[10]),s&2048&&(H.hoverCursor=B[11]),s&4096&&(H.manageHoverState=B[12]),s&8192&&(H.eventsIfTopMost=B[13]),s&16384&&(H.interactive=B[14]),s&8388608&&(H.$$scope={dirty:s,ctx:B}),!_&&s&1&&(_=!0,H.hovered=B[0],Pc(()=>_=!1)),f.$set(H)},i(B){v||(ft(f.$$.fragment,B),v=!0)},o(B){St(f.$$.fragment,B),v=!1},d(B){ki(f,B)}}}function cg(m,f,_){let{$$slots:v={},$$scope:E}=f,{id:k=Lc("line")}=f,{source:B=void 0}=f,{sourceLayer:s=void 0}=f,{beforeId:H=void 0}=f,{beforeLayerType:N=void 0}=f,{paint:_e}=f,{layout:be=void 0}=f,{filter:ye=void 0}=f,{minzoom:Oe=void 0}=f,{maxzoom:Le=void 0}=f,{hoverCursor:Be=void 0}=f,{manageHoverState:Ne=!1}=f,{hovered:et=null}=f,{eventsIfTopMost:at=!1}=f,{interactive:nt=!0}=f;function it(Ae){et=Ae,_(0,et)}function Vt(Ae){pn.call(this,m,Ae)}function ei(Ae){pn.call(this,m,Ae)}function Ht(Ae){pn.call(this,m,Ae)}function Nt(Ae){pn.call(this,m,Ae)}function Jt(Ae){pn.call(this,m,Ae)}function At(Ae){pn.call(this,m,Ae)}return m.$$set=Ae=>{"id"in Ae&&_(1,k=Ae.id),"source"in Ae&&_(2,B=Ae.source),"sourceLayer"in Ae&&_(3,s=Ae.sourceLayer),"beforeId"in Ae&&_(4,H=Ae.beforeId),"beforeLayerType"in Ae&&_(5,N=Ae.beforeLayerType),"paint"in Ae&&_(6,_e=Ae.paint),"layout"in Ae&&_(7,be=Ae.layout),"filter"in Ae&&_(8,ye=Ae.filter),"minzoom"in Ae&&_(9,Oe=Ae.minzoom),"maxzoom"in Ae&&_(10,Le=Ae.maxzoom),"hoverCursor"in Ae&&_(11,Be=Ae.hoverCursor),"manageHoverState"in Ae&&_(12,Ne=Ae.manageHoverState),"hovered"in Ae&&_(0,et=Ae.hovered),"eventsIfTopMost"in Ae&&_(13,at=Ae.eventsIfTopMost),"interactive"in Ae&&_(14,nt=Ae.interactive),"$$scope"in Ae&&_(23,E=Ae.$$scope)},[et,k,B,s,H,N,_e,be,ye,Oe,Le,Be,Ne,at,nt,v,it,Vt,ei,Ht,Nt,Jt,At,E]}class Ah extends Gr{constructor(f){super(),Zr(this,f,cg,lg,Sr,{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 ug(m){let f=m.getCenter(),_=Math.round(m.getZoom()*100)/100,v=Math.ceil((_*Math.LN2+Math.log(512/360/.5))/Math.LN10),E=Math.pow(10,v),k=Math.round(f.lat*E)/E,B=Math.round(f.lng*E)/E,s=`${_}/${k}/${B}`,H=m.getBearing(),N=m.getPitch();return(H||N)&&(s+=`/${Math.round(H*10)/10}`),N&&(s+=`/${Math.round(N)}`),`#${s}`}function hg(m){return m.replace("#","").split("/").map(parseFloat)}var cu=kh;function kh(m,f){return m===f||m!==m&&f!==f?!0:typeof m!=typeof f||{}.toString.call(m)!={}.toString.call(f)||m!==Object(m)||!m?!1:Array.isArray(m)?Tp(m,f):{}.toString.call(m)=="[object Set]"?Tp(Array.from(m),Array.from(f)):{}.toString.call(m)=="[object Object]"?pg(m,f):dg(m,f)}function dg(m,f){return m.toString()===f.toString()}function Tp(m,f){var _=m.length;if(_!=f.length)return!1;for(var v=0;v<_;v++)if(!kh(m[v],f[v]))return!1;return!0}function pg(m,f){var _=Object.keys(m),v=_.length;if(v!=Object.keys(f).length)return!1;for(var E=0;E_(6,v=_e));let{position:k="top-left"}=f,{showCompass:B=!0}=f,{showZoom:s=!0}=f,{visualizePitch:H=!1}=f,N=null;return ol(()=>{v!=null&&v.loaded()&&N&&v.removeControl(N)}),m.$$set=_e=>{"position"in _e&&_(1,k=_e.position),"showCompass"in _e&&_(2,B=_e.showCompass),"showZoom"in _e&&_(3,s=_e.showZoom),"visualizePitch"in _e&&_(4,H=_e.visualizePitch)},m.$$.update=()=>{m.$$.dirty&126&&v&&!N&&(_(5,N=new is.NavigationControl({showCompass:B,showZoom:s,visualizePitch:H})),v.addControl(N,k))},[E,k,B,s,H,N,v]}class mg extends Gr{constructor(f){super(),Zr(this,f,fg,null,Sr,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function _g(m,f,_){let v;const{map:E}=Ll();Qr(m,E,N=>_(5,v=N));let{position:k="bottom-left"}=f,{maxWidth:B=void 0}=f,{unit:s="metric"}=f,H=null;return ol(()=>{v!=null&&v.loaded()&&H&&v.removeControl(H)}),m.$$set=N=>{"position"in N&&_(1,k=N.position),"maxWidth"in N&&_(2,B=N.maxWidth),"unit"in N&&_(3,s=N.unit)},m.$$.update=()=>{m.$$.dirty&62&&v&&!H&&(_(4,H=new is.ScaleControl({maxWidth:B,unit:s})),v.addControl(H,k))},[E,k,B,s,H,v]}class gg extends Gr{constructor(f){super(),Zr(this,f,_g,null,Sr,{position:1,maxWidth:2,unit:3})}}const yg=m=>({map:m[0]&8,loadedImages:m[0]&16,allImagesLoaded:m[0]&32}),Ip=m=>({map:m[3],loadedImages:m[4],allImagesLoaded:m[5]});function Ep(m){let f,_,v=m[2]&&Cp(m);const E=m[33].default,k=Ks(E,m,m[32],Ip);return{c(){v&&v.c(),f=Tn(),k&&k.c()},m(B,s){v&&v.m(B,s),hi(B,f,s),k&&k.m(B,s),_=!0},p(B,s){B[2]?v?(v.p(B,s),s[0]&4&&ft(v,1)):(v=Cp(B),v.c(),ft(v,1),v.m(f.parentNode,f)):v&&(rs(),St(v,1,1,()=>{v=null}),ns()),k&&k.p&&(!_||s[0]&56|s[1]&2)&&Ys(k,E,B,B[32],_?Js(E,B[32],s,yg):Qs(B[32]),Ip)},i(B){_||(ft(v),ft(k,B),_=!0)},o(B){St(v),St(k,B),_=!1},d(B){B&&li(f),v&&v.d(B),k&&k.d(B)}}}function Cp(m){let f,_,v,E,k,B,s,H;return f=new mg({props:{position:m[6]}}),v=new sg({props:{position:m[6],fitBoundsOptions:{maxZoom:12}}}),k=new eg({props:{position:m[6]}}),s=new gg({props:{position:m[6]}}),{c(){Ri(f.$$.fragment),_=Tn(),Ri(v.$$.fragment),E=Tn(),Ri(k.$$.fragment),B=Tn(),Ri(s.$$.fragment)},m(N,_e){Ai(f,N,_e),hi(N,_,_e),Ai(v,N,_e),hi(N,E,_e),Ai(k,N,_e),hi(N,B,_e),Ai(s,N,_e),H=!0},p(N,_e){const be={};_e[0]&64&&(be.position=N[6]),f.$set(be);const ye={};_e[0]&64&&(ye.position=N[6]),v.$set(ye);const Oe={};_e[0]&64&&(Oe.position=N[6]),k.$set(Oe);const Le={};_e[0]&64&&(Le.position=N[6]),s.$set(Le)},i(N){H||(ft(f.$$.fragment,N),ft(v.$$.fragment,N),ft(k.$$.fragment,N),ft(s.$$.fragment,N),H=!0)},o(N){St(f.$$.fragment,N),St(v.$$.fragment,N),St(k.$$.fragment,N),St(s.$$.fragment,N),H=!1},d(N){N&&(li(_),li(E),li(B)),ki(f,N),ki(v,N),ki(k,N),ki(s,N)}}}function vg(m){let f,_,v,E,k,B=m[3]&&m[0]&&Ep(m);return{c(){f=Wt("div"),B&&B.c(),vs(f,"class",_=fp(m[1])+" svelte-p00lfq"),_p(f,"expand-map",!m[1])},m(s,H){hi(s,f,H),B&&B.m(f,null),v=!0,E||(k=p_(m[9].call(null,f)),E=!0)},p(s,H){s[3]&&s[0]?B?(B.p(s,H),H[0]&9&&ft(B,1)):(B=Ep(s),B.c(),ft(B,1),B.m(f,null)):B&&(rs(),St(B,1,1,()=>{B=null}),ns()),(!v||H[0]&2&&_!==(_=fp(s[1])+" svelte-p00lfq"))&&vs(f,"class",_),(!v||H[0]&2)&&_p(f,"expand-map",!s[1])},i(s){v||(ft(B),v=!0)},o(s){St(B),v=!1},d(s){s&&li(f),B&&B.d(),E=!1,k()}}}function xg(m,f,_){let v,E,k,B,{$$slots:s={},$$scope:H}=f,{map:N=null}=f,{class:_e=void 0}=f,{style:be}=f,{diffStyleUpdates:ye=!1}=f,{center:Oe=void 0}=f,{zoom:Le=void 0}=f,{pitch:Be=0}=f,{bearing:Ne=0}=f,{bounds:et=void 0}=f,{hash:at=!1}=f,{loaded:nt=!1}=f,{minZoom:it=0}=f,{maxZoom:Vt=22}=f,{zoomOnDoubleClick:ei=!0}=f,{interactive:Ht=!0}=f,{attributionControl:Nt=!0}=f,{preserveDrawingBuffer:Jt=!1}=f,{maxBounds:At=void 0}=f,{images:Ae=[]}=f,{standardControls:Ge=!1}=f,{filterLayers:Ui=void 0}=f,{transformRequest:Dt=void 0}=f;const qt=Ih(),{map:Lt,loadedImages:di}=R_();Qr(m,Lt,ze=>_(3,k=ze)),Qr(m,di,ze=>_(4,B=ze));let Pi=new Set;function $r(ze){k!=null&&k.loaded()&&("url"in ze?(Pi.add(ze.id),k.loadImage(ze.url,(Pt,He)=>{Pi.delete(ze.id),Pt?qt("error",Pt):He&&(k==null||k.addImage(ze.id,He,ze.options),B.add(ze.id),di.set(B))})):(k.addImage(ze.id,ze.data,ze.options),B.add(ze.id),di.set(B)))}let Nr,zi,Ti,Tt;function pi(ze){if(at){let Pt=hg(window.location.hash);Pt.length>=3&&(_(11,Le=Pt[0]),_(10,Oe=[Pt[2],Pt[1]])),Pt.length==5&&(_(15,Ne=Pt[3]),_(14,Be=Pt[4]))}return il(Lt,k=new is.Map(gu({container:ze,style:be,center:Oe,zoom:Le,pitch:Be,bearing:Ne,minZoom:it,maxZoom:Vt,interactive:Ht,preserveDrawingBuffer:Jt,maxBounds:At,bounds:et,attributionControl:Nt,transformRequest:Dt})),k),k.on("load",Pt=>{_(0,nt=!0),qt("load",k)}),k.on("error",Pt=>qt("error",{...Pt,map:k})),k.on("movestart",Pt=>qt("movestart",{...Pt,map:k})),k.on("moveend",Pt=>{if(_(10,Oe=Pt.target.getCenter()),_(11,Le=Pt.target.getZoom()),_(12,et=Pt.target.getBounds()),qt("moveend",{...Pt,map:k}),at){let He=window.location.href.replace(/(#.+)?$/,ug(k));window.history.replaceState(window.history.state,"",He)}}),k.on("zoomstart",Pt=>qt("zoomstart",{...Pt,map:k})),k.on("zoom",Pt=>{_(11,Le=Pt.target.getZoom()),qt("zoom",{...Pt,map:k})}),k.on("zoomend",Pt=>{_(11,Le=Pt.target.getZoom()),qt("zoomend",{...Pt,map:k})}),k.on("style.load",()=>{if(k){const Pt=k.getStyle();if(_(29,Nr=Pt.layers.map(He=>He.id)),_(30,zi=Object.keys(Pt.sources)),Tt)for(const[He,Zt]of Object.entries(Tt))k.addSource(He,Zt);if(Ti)for(const He of Ti)k.addLayer(He)}}),k.on("styledata",Pt=>{if(k&&Ui){const He=k.getStyle().layers;if(He)for(let Zt of He)Ui(Zt)||k.setLayoutProperty(Zt.id,"visibility","none")}qt("styledata",{...Pt,map:k})}),{destroy(){_(0,nt=!1),k==null||k.remove(),il(Lt,k=null,k)}}}let Oi=be;return m.$$set=ze=>{"map"in ze&&_(13,N=ze.map),"class"in ze&&_(1,_e=ze.class),"style"in ze&&_(16,be=ze.style),"diffStyleUpdates"in ze&&_(17,ye=ze.diffStyleUpdates),"center"in ze&&_(10,Oe=ze.center),"zoom"in ze&&_(11,Le=ze.zoom),"pitch"in ze&&_(14,Be=ze.pitch),"bearing"in ze&&_(15,Ne=ze.bearing),"bounds"in ze&&_(12,et=ze.bounds),"hash"in ze&&_(18,at=ze.hash),"loaded"in ze&&_(0,nt=ze.loaded),"minZoom"in ze&&_(19,it=ze.minZoom),"maxZoom"in ze&&_(20,Vt=ze.maxZoom),"zoomOnDoubleClick"in ze&&_(21,ei=ze.zoomOnDoubleClick),"interactive"in ze&&_(22,Ht=ze.interactive),"attributionControl"in ze&&_(23,Nt=ze.attributionControl),"preserveDrawingBuffer"in ze&&_(24,Jt=ze.preserveDrawingBuffer),"maxBounds"in ze&&_(25,At=ze.maxBounds),"images"in ze&&_(26,Ae=ze.images),"standardControls"in ze&&_(2,Ge=ze.standardControls),"filterLayers"in ze&&_(27,Ui=ze.filterLayers),"transformRequest"in ze&&_(28,Dt=ze.transformRequest),"$$scope"in ze&&_(32,H=ze.$$scope)},m.$$.update=()=>{if(m.$$.dirty[0]&4&&_(6,v=typeof Ge=="boolean"?void 0:Ge),m.$$.dirty[0]&8&&_(13,N=k),m.$$.dirty[0]&67108873&&nt&&k!=null&&k.loaded())for(let ze of Ae)!Pi.has(ze.id)&&!k.hasImage(ze.id)&&$r(ze);if(m.$$.dirty[0]&67108880&&_(5,E=Ae.every(ze=>B.has(ze.id))),m.$$.dirty[0]&1610809352|m.$$.dirty[1]&1&&k&&!cu(be,Oi)){const ze=k.getStyle();if(Nr&&(Ti=ze.layers.filter(Pt=>!Nr.includes(Pt.id))),zi){const Pt=Object.keys(ze.sources).filter(He=>!zi.includes(He));Tt={};for(const He of Pt)Tt[He]=ze.sources[He]}_(31,Oi=be),k.setStyle(be,{diff:ye})}m.$$.dirty[0]&1032&&Oe&&!cu(Oe,k==null?void 0:k.getCenter())&&(k==null||k.panTo(Oe)),m.$$.dirty[0]&2056&&Le&&!cu(Le,k==null?void 0:k.getZoom())&&(k==null||k.zoomTo(Le)),m.$$.dirty[0]&4104&&et&&!cu(et,k==null?void 0:k.getBounds())&&(k==null||k.fitBounds(et)),m.$$.dirty[0]&2097160&&(ei?k==null||k.doubleClickZoom.enable():k==null||k.doubleClickZoom.disable())},[nt,_e,Ge,k,B,E,v,Lt,di,pi,Oe,Le,et,N,Be,Ne,be,ye,at,it,Vt,ei,Ht,Nt,Jt,At,Ae,Ui,Dt,Nr,zi,Oi,H,s]}class bg extends Gr{constructor(f){super(),Zr(this,f,xg,vg,Sr,{map:13,class:1,style:16,diffStyleUpdates:17,center:10,zoom:11,pitch:14,bearing:15,bounds:12,hash:18,loaded:0,minZoom:19,maxZoom:20,zoomOnDoubleClick:21,interactive:22,attributionControl:23,preserveDrawingBuffer:24,maxBounds:25,images:26,standardControls:2,filterLayers:27,transformRequest:28},null,[-1,-1])}}const wg=m=>({features:m[0]&16,data:m[0]&16,map:m[0]&4,close:m[0]&1}),Mp=m=>{var f;return{features:m[4],data:(f=m[4])==null?void 0:f[0],map:m[2],close:m[31]}};function Ap(m){let f,_,v=(m[4]||m[3]instanceof is.Marker)&&kp(m);return{c(){f=Wt("div"),v&&v.c()},m(E,k){hi(E,f,k),v&&v.m(f,null),m[32](f),_=!0},p(E,k){E[4]||E[3]instanceof is.Marker?v?(v.p(E,k),k[0]&24&&ft(v,1)):(v=kp(E),v.c(),ft(v,1),v.m(f,null)):v&&(rs(),St(v,1,1,()=>{v=null}),ns())},i(E){_||(ft(v),_=!0)},o(E){St(v),_=!1},d(E){E&&li(f),v&&v.d(),m[32](null)}}}function kp(m){let f;const _=m[30].default,v=Ks(_,m,m[29],Mp);return{c(){v&&v.c()},m(E,k){v&&v.m(E,k),f=!0},p(E,k){v&&v.p&&(!f||k[0]&536870933)&&Ys(v,_,E,E[29],f?Js(_,E[29],k,wg):Qs(E[29]),Mp)},i(E){f||(ft(v,E),f=!0)},o(E){St(v,E),f=!1},d(E){v&&v.d(E)}}}function Sg(m){let f,_,v=m[9].default&&Ap(m);return{c(){v&&v.c(),f=Oa()},m(E,k){v&&v.m(E,k),hi(E,f,k),_=!0},p(E,k){E[9].default?v?(v.p(E,k),k[0]&512&&ft(v,1)):(v=Ap(E),v.c(),ft(v,1),v.m(f.parentNode,f)):v&&(rs(),St(v,1,1,()=>{v=null}),ns())},i(E){_||(ft(v),_=!0)},o(E){St(v),_=!1},d(E){E&&li(f),v&&v.d(E)}}}function Tg(m,f,_){let v,E,k,B,s,H,{$$slots:N={},$$scope:_e}=f;const be=d_(N);let{closeButton:ye=void 0}=f,{closeOnClickOutside:Oe=!0}=f,{closeOnClickInside:Le=!1}=f,{closeOnMove:Be=!1}=f,{openOn:Ne="click"}=f,{openIfTopMost:et=!0}=f,{focusAfterOpen:at=!0}=f,{anchor:nt=void 0}=f,{offset:it=void 0}=f,{popupClass:Vt=void 0}=f,{maxWidth:ei=void 0}=f,{lngLat:Ht=void 0}=f,{html:Nt=void 0}=f,{open:Jt=!1}=f;const{map:At,popupTarget:Ae,layerEvent:Ge,layer:Ui,eventTopMost:Dt}=Ll();Qr(m,At,Ue=>_(2,k=Ue)),Qr(m,Ae,Ue=>_(3,s=Ue)),Qr(m,Ge,Ue=>_(28,B=Ue)),Qr(m,Ui,Ue=>_(35,H=Ue));const qt=["click","dblclick","contextmenu"];let Lt,di=!1,Pi;function $r(){if(!Lt)return;let Ue=Lt.getElement();!Ue||Ue===Pi||(Pi=Ue,Ne==="hover"&&(Pi.style.pointerEvents="none"),Pi.addEventListener("mouseenter",()=>{_(24,di=!0)},{passive:!0}),Pi.addEventListener("mouseleave",()=>{_(24,di=!1)},{passive:!0}),Pi.addEventListener("click",()=>{Le&&_(0,Jt=!1)},{passive:!0}))}jp(()=>{if(k)return k.on("click",Zt),k.on("contextmenu",Zt),typeof s=="string"&&(k.on("click",s,Tt),k.on("dblclick",s,Tt),k.on("contextmenu",s,Tt),k.on("mousemove",s,He),k.on("mouseleave",s,Pt),k.on("touchstart",s,Oi),k.on("touchend",s,ze)),()=>{k!=null&&k.loaded()&&(Lt==null||Lt.remove(),k.off("click",Zt),k.off("contextmenu",Zt),s instanceof is.Marker?s.getPopup()===Lt&&s.setPopup(void 0):typeof s=="string"&&(k.off("click",s,Tt),k.off("dblclick",s,Tt),k.off("contextmenu",s,Tt),k.off("mousemove",s,He),k.off("mouseleave",s,Pt),k.off("touchstart",s,Oi),k.off("touchend",s,ze)))}});function Nr(Ue){return et?!("marker"in Ue)&&!N_(Ue)&&Dt(Ue)!==H:!1}let zi=null,Ti="normal";function Tt(Ue){Ue.type===Ne&&(Nr(Ue)||("layerType"in Ue?Ue.layerType==="deckgl"?(_(10,Ht=Ue.coordinate),_(4,zi=Ue.object?[Ue.object]:null)):(_(10,Ht=Ue.lngLat),_(4,zi=Ue.features??[])):(_(10,Ht=Ue.lngLat),_(4,zi=Ue.features??[])),setTimeout(()=>_(0,Jt=!0))))}let pi=null;function Oi(Ue){pi=Ue.point}function ze(Ue){if(!pi||Ne!=="hover")return;let Bi=pi.dist(Ue.point);pi=null,Bi<3&&(_(10,Ht=Ue.lngLat),_(4,zi=Ue.features??[]),Lt.isOpen()?_(25,Ti="justOpened"):(_(25,Ti="opening"),_(0,Jt=!0)))}function Pt(Ue){Ne!=="hover"||pi||Ti!=="normal"||(_(0,Jt=!1),_(4,zi=null))}function He(Ue){if(!(Ne!=="hover"||pi||Ti!=="normal")){if(Nr(Ue)){_(0,Jt=!1),_(4,zi=null);return}_(0,Jt=!0),_(4,zi=Ue.features??[]),_(10,Ht=Ue.lngLat)}}function Zt(Ue){if(Ti==="justOpened"){_(25,Ti="normal");return}if(!Oe)return;let Bi=[Pi,s instanceof is.Marker?s==null?void 0:s.getElement():null];Jt&&Lt.isOpen()&&!Bi.some(gr=>gr==null?void 0:gr.contains(Ue.originalEvent.target))&&(Ue.type==="contextmenu"&&Ne==="contextmenu"||Ue.type!=="contextmenu")&&_(0,Jt=!1)}let ct;const Zi=()=>_(0,Jt=!1);function _r(Ue){$s[Ue?"unshift":"push"](()=>{ct=Ue,_(1,ct)})}return m.$$set=Ue=>{"closeButton"in Ue&&_(11,ye=Ue.closeButton),"closeOnClickOutside"in Ue&&_(12,Oe=Ue.closeOnClickOutside),"closeOnClickInside"in Ue&&_(13,Le=Ue.closeOnClickInside),"closeOnMove"in Ue&&_(14,Be=Ue.closeOnMove),"openOn"in Ue&&_(15,Ne=Ue.openOn),"openIfTopMost"in Ue&&_(16,et=Ue.openIfTopMost),"focusAfterOpen"in Ue&&_(17,at=Ue.focusAfterOpen),"anchor"in Ue&&_(18,nt=Ue.anchor),"offset"in Ue&&_(19,it=Ue.offset),"popupClass"in Ue&&_(20,Vt=Ue.popupClass),"maxWidth"in Ue&&_(21,ei=Ue.maxWidth),"lngLat"in Ue&&_(10,Ht=Ue.lngLat),"html"in Ue&&_(22,Nt=Ue.html),"open"in Ue&&_(0,Jt=Ue.open),"$$scope"in Ue&&_(29,_e=Ue.$$scope)},m.$$.update=()=>{if(m.$$.dirty[0]&14336&&_(27,v=ye??(!Oe&&!Le)),m.$$.dirty[0]&146685952&&(Lt||(_(23,Lt=new is.Popup({closeButton:v,closeOnClick:!1,closeOnMove:Be,focusAfterOpen:at,maxWidth:ei,className:Vt,anchor:nt,offset:it})),Pi=Lt.getElement(),Lt.on("open",()=>{_(0,Jt=!0),$r()}),Lt.on("close",Ue=>{_(0,Jt=!1)}))),m.$$.dirty[0]&8421384&&Lt&&s instanceof is.Marker&&(Ne==="click"?s.setPopup(Lt):s.getPopup()===Lt&&s.setPopup(void 0)),m.$$.dirty[0]&268468224&&qt.includes(Ne)&&(B==null?void 0:B.type)===Ne&&(Tt(B),il(Ge,B=null,B)),m.$$.dirty[0]&268468224&&_(26,E=Ne==="hover"&&((B==null?void 0:B.type)==="mousemove"||(B==null?void 0:B.type)==="mouseenter")),m.$$.dirty[0]&352354304&&Ne==="hover"&&Ge&&(E&&B&&(B.layerType==="deckgl"?(_(10,Ht=B.coordinate),_(4,zi=B.object?[B.object]:null)):(_(10,Ht=B.lngLat),_(4,zi=B.features??[]))),_(0,Jt=(E||di)??!1)),m.$$.dirty[0]&12582914&&(ct?Lt.setDOMContent(ct):Nt&&Lt.setHTML(Nt)),m.$$.dirty[0]&8389632&&Ht&&Lt.setLngLat(Ht),m.$$.dirty[0]&41943045&&k){let Ue=Lt.isOpen();Jt&&!Ue?(Lt.addTo(k),Ti==="opening"&&_(25,Ti="justOpened")):!Jt&&Ue&&Lt.remove()}},[Jt,ct,k,s,zi,At,Ae,Ge,Ui,be,Ht,ye,Oe,Le,Be,Ne,et,at,nt,it,Vt,ei,Nt,Lt,di,Ti,E,v,B,_e,N,Zi,_r]}class Ph extends Gr{constructor(f){super(),Zr(this,f,Tg,Sg,Sr,{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])}}var Dc=Uint8Array,rf=Uint16Array,Ig=Int32Array,Eg=new Dc([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]),Cg=new Dc([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]),nf=function(m,f){for(var _=new rf(31),v=0;v<31;++v)_[v]=f+=1<>1|(Fi&21845)<<1,Gs=(Gs&52428)>>2|(Gs&13107)<<2,Gs=(Gs&61680)>>4|(Gs&3855)<<4,kg[Fi]=((Gs&65280)>>8|(Gs&255)<<8)>>1;var Gs,Fi,xu=new Dc(288);for(Fi=0;Fi<144;++Fi)xu[Fi]=8;var Fi;for(Fi=144;Fi<256;++Fi)xu[Fi]=9;var Fi;for(Fi=256;Fi<280;++Fi)xu[Fi]=7;var Fi;for(Fi=280;Fi<288;++Fi)xu[Fi]=8;var Fi,Pg=new Dc(32);for(Fi=0;Fi<32;++Fi)Pg[Fi]=5;var Fi,zg=new Dc(0),Lg=typeof TextDecoder<"u"&&new TextDecoder,Dg=0;try{Lg.decode(zg,{stream:!0}),Dg=1}catch{}const Fg=m=>({}),Pp=m=>({}),Rg=m=>({}),zp=m=>({});function Og(m){let f,_,v,E;const k=m[1].left,B=Ks(k,m,m[0],zp),s=m[1].main,H=Ks(s,m,m[0],Pp);return{c(){f=Wt("div"),B&&B.c(),_=Tn(),v=Wt("div"),H&&H.c(),vs(f,"class","left svelte-6kzmjs"),vs(v,"class","main svelte-6kzmjs")},m(N,_e){hi(N,f,_e),B&&B.m(f,null),hi(N,_,_e),hi(N,v,_e),H&&H.m(v,null),E=!0},p(N,[_e]){B&&B.p&&(!E||_e&1)&&Ys(B,k,N,N[0],E?Js(k,N[0],_e,Rg):Qs(N[0]),zp),H&&H.p&&(!E||_e&1)&&Ys(H,s,N,N[0],E?Js(s,N[0],_e,Fg):Qs(N[0]),Pp)},i(N){E||(ft(B,N),ft(H,N),E=!0)},o(N){St(B,N),St(H,N),E=!1},d(N){N&&(li(f),li(_),li(v)),B&&B.d(N),H&&H.d(N)}}}function Bg(m,f,_){let{$$slots:v={},$$scope:E}=f;return m.$$set=k=>{"$$scope"in k&&_(0,E=k.$$scope)},[E,v]}class Ng extends Gr{constructor(f){super(),Zr(this,f,Bg,Og,Sr,{})}}function Lp(m){let f,_;return{c(){f=Wt("div"),_=nl(m[0]),vs(f,"class","svelte-1uuov7f")},m(v,E){hi(v,f,E),_i(f,_)},p(v,E){E&1&&yh(_,v[0])},d(v){v&&li(f)}}}function Vg(m){let f,_=m[0]&&Lp(m);return{c(){_&&_.c(),f=Oa()},m(v,E){_&&_.m(v,E),hi(v,f,E)},p(v,[E]){v[0]?_?_.p(v,E):(_=Lp(v),_.c(),_.m(f.parentNode,f)):_&&(_.d(1),_=null)},i:Mr,o:Mr,d(v){v&&li(f),_&&_.d(v)}}}function Ug(m,f,_){let{msg:v=null}=f;return m.$$set=E=>{"msg"in E&&_(0,v=E.msg)},[v]}class jg extends Gr{constructor(f){super(),Zr(this,f,Ug,Vg,Sr,{msg:0})}}var sf={exports:{}};(function(m,f){(function(_,v){m.exports=v()})(Al,function(){var _=function(g,I){var O={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},Y={on:function(se,fe,De){if(O[se]===void 0)throw new Error("Invalid event type: "+se);O[se].push({selector:fe,fn:De})},render:function(se){I.store.featureChanged(se)}},ne=function(se,fe){for(var De=O[se],Ve=De.length;Ve--;){var rt=De[Ve];if(rt.selector(fe)){rt.fn.call(Y,fe)||I.store.render(),I.ui.updateMapClasses();break}}};return g.start.call(Y),{render:g.render,stop:function(){g.stop&&g.stop()},trash:function(){g.trash&&(g.trash(),I.store.render())},combineFeatures:function(){g.combineFeatures&&g.combineFeatures()},uncombineFeatures:function(){g.uncombineFeatures&&g.uncombineFeatures()},drag:function(se){ne("drag",se)},click:function(se){ne("click",se)},mousemove:function(se){ne("mousemove",se)},mousedown:function(se){ne("mousedown",se)},mouseup:function(se){ne("mouseup",se)},mouseout:function(se){ne("mouseout",se)},keydown:function(se){ne("keydown",se)},keyup:function(se){ne("keyup",se)},touchstart:function(se){ne("touchstart",se)},touchmove:function(se){ne("touchmove",se)},touchend:function(se){ne("touchend",se)},tap:function(se){ne("tap",se)}}};function v(g){return g&&g.__esModule&&Object.prototype.hasOwnProperty.call(g,"default")?g.default:g}function E(g){if(g.__esModule)return g;var I=g.default;if(typeof I=="function"){var O=function Y(){if(this instanceof Y){var ne=[null];ne.push.apply(ne,arguments);var se=Function.bind.apply(I,ne);return new se}return I.apply(this,arguments)};O.prototype=I.prototype}else O={};return Object.defineProperty(O,"__esModule",{value:!0}),Object.keys(g).forEach(function(Y){var ne=Object.getOwnPropertyDescriptor(g,Y);Object.defineProperty(O,Y,ne.get?ne:{enumerable:!0,get:function(){return g[Y]}})}),O}var k={},B={RADIUS:6378137,FLATTENING:1/298.257223563,POLAR_RADIUS:63567523142e-4},s=B;function H(g){var I=0;if(g&&g.length>0){I+=Math.abs(N(g[0]));for(var O=1;O2){for(fe=0;fe=Math.pow(2,g)?zi(g,I):se};zi.rack=function(g,I,O){var Y=function(se){var fe=0;do{if(fe++>10){if(!O)throw new Error("too many ID collisions, use more bits");g+=O}var De=zi(g,I)}while(Object.hasOwnProperty.call(ne,De));return ne[De]=se,De},ne=Y.hats={};return Y.get=function(se){return Y.hats[se]},Y.set=function(se,fe){return Y.hats[se]=fe,Y},Y.bits=g||128,Y.base=I||16,Y};var Ti=v(Nr.exports),Tt=function(g,I){this.ctx=g,this.properties=I.properties||{},this.coordinates=I.geometry.coordinates,this.id=I.id||Ti(),this.type=I.geometry.type};Tt.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},Tt.prototype.incomingCoords=function(g){this.setCoordinates(g)},Tt.prototype.setCoordinates=function(g){this.coordinates=g,this.changed()},Tt.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},Tt.prototype.setProperty=function(g,I){this.properties[g]=I},Tt.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:Be.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},Tt.prototype.internal=function(g){var I={id:this.id,meta:nt.FEATURE,"meta:type":this.type,active:it.INACTIVE,mode:g};if(this.ctx.options.userProperties)for(var O in this.properties)I["user_"+O]=this.properties[O];return{type:Be.FEATURE,properties:I,geometry:{coordinates:this.getCoordinates(),type:this.type}}};var pi=function(g,I){Tt.call(this,g,I)};(pi.prototype=Object.create(Tt.prototype)).isValid=function(){return typeof this.coordinates[0]=="number"&&typeof this.coordinates[1]=="number"},pi.prototype.updateCoordinate=function(g,I,O){this.coordinates=arguments.length===3?[I,O]:[g,I],this.changed()},pi.prototype.getCoordinate=function(){return this.getCoordinates()};var Oi=function(g,I){Tt.call(this,g,I)};(Oi.prototype=Object.create(Tt.prototype)).isValid=function(){return this.coordinates.length>1},Oi.prototype.addCoordinate=function(g,I,O){this.changed();var Y=parseInt(g,10);this.coordinates.splice(Y,0,[I,O])},Oi.prototype.getCoordinate=function(g){var I=parseInt(g,10);return JSON.parse(JSON.stringify(this.coordinates[I]))},Oi.prototype.removeCoordinate=function(g){this.changed(),this.coordinates.splice(parseInt(g,10),1)},Oi.prototype.updateCoordinate=function(g,I,O){var Y=parseInt(g,10);this.coordinates[Y]=[I,O],this.changed()};var ze=function(g,I){Tt.call(this,g,I),this.coordinates=this.coordinates.map(function(O){return O.slice(0,-1)})};(ze.prototype=Object.create(Tt.prototype)).isValid=function(){return this.coordinates.length!==0&&this.coordinates.every(function(g){return g.length>2})},ze.prototype.incomingCoords=function(g){this.coordinates=g.map(function(I){return I.slice(0,-1)}),this.changed()},ze.prototype.setCoordinates=function(g){this.coordinates=g,this.changed()},ze.prototype.addCoordinate=function(g,I,O){this.changed();var Y=g.split(".").map(function(ne){return parseInt(ne,10)});this.coordinates[Y[0]].splice(Y[1],0,[I,O])},ze.prototype.removeCoordinate=function(g){this.changed();var I=g.split(".").map(function(Y){return parseInt(Y,10)}),O=this.coordinates[I[0]];O&&(O.splice(I[1],1),O.length<3&&this.coordinates.splice(I[0],1))},ze.prototype.getCoordinate=function(g){var I=g.split(".").map(function(Y){return parseInt(Y,10)}),O=this.coordinates[I[0]];return JSON.parse(JSON.stringify(O[I[1]]))},ze.prototype.getCoordinates=function(){return this.coordinates.map(function(g){return g.concat([g[0]])})},ze.prototype.updateCoordinate=function(g,I,O){this.changed();var Y=g.split("."),ne=parseInt(Y[0],10),se=parseInt(Y[1],10);this.coordinates[ne]===void 0&&(this.coordinates[ne]=[]),this.coordinates[ne][se]=[I,O]};var Pt={MultiPoint:pi,MultiLineString:Oi,MultiPolygon:ze},He=function(g,I,O,Y,ne){var se=O.split("."),fe=parseInt(se[0],10),De=se[1]?se.slice(1).join("."):null;return g[fe][I](De,Y,ne)},Zt=function(g,I){if(Tt.call(this,g,I),delete this.coordinates,this.model=Pt[I.geometry.type],this.model===void 0)throw new TypeError(I.geometry.type+" is not a valid type");this.features=this._coordinatesToFeatures(I.geometry.coordinates)};function ct(g){this.map=g.map,this.drawConfig=JSON.parse(JSON.stringify(g.options||{})),this._ctx=g}(Zt.prototype=Object.create(Tt.prototype))._coordinatesToFeatures=function(g){var I=this,O=this.model.bind(this);return g.map(function(Y){return new O(I.ctx,{id:Ti(),type:Be.FEATURE,properties:{},geometry:{coordinates:Y,type:I.type.replace("Multi","")}})})},Zt.prototype.isValid=function(){return this.features.every(function(g){return g.isValid()})},Zt.prototype.setCoordinates=function(g){this.features=this._coordinatesToFeatures(g),this.changed()},Zt.prototype.getCoordinate=function(g){return He(this.features,"getCoordinate",g)},Zt.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map(function(g){return g.type===Be.POLYGON?g.getCoordinates():g.coordinates})))},Zt.prototype.updateCoordinate=function(g,I,O){He(this.features,"updateCoordinate",g,I,O),this.changed()},Zt.prototype.addCoordinate=function(g,I,O){He(this.features,"addCoordinate",g,I,O),this.changed()},Zt.prototype.removeCoordinate=function(g){He(this.features,"removeCoordinate",g),this.changed()},Zt.prototype.getFeatures=function(){return this.features},ct.prototype.setSelected=function(g){return this._ctx.store.setSelected(g)},ct.prototype.setSelectedCoordinates=function(g){var I=this;this._ctx.store.setSelectedCoordinates(g),g.reduce(function(O,Y){return O[Y.feature_id]===void 0&&(O[Y.feature_id]=!0,I._ctx.store.get(Y.feature_id).changed()),O},{})},ct.prototype.getSelected=function(){return this._ctx.store.getSelected()},ct.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},ct.prototype.isSelected=function(g){return this._ctx.store.isSelected(g)},ct.prototype.getFeature=function(g){return this._ctx.store.get(g)},ct.prototype.select=function(g){return this._ctx.store.select(g)},ct.prototype.deselect=function(g){return this._ctx.store.deselect(g)},ct.prototype.deleteFeature=function(g,I){return I===void 0&&(I={}),this._ctx.store.delete(g,I)},ct.prototype.addFeature=function(g){return this._ctx.store.add(g)},ct.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},ct.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},ct.prototype.setActionableState=function(g){g===void 0&&(g={});var I={trash:g.trash||!1,combineFeatures:g.combineFeatures||!1,uncombineFeatures:g.uncombineFeatures||!1};return this._ctx.events.actionable(I)},ct.prototype.changeMode=function(g,I,O){return I===void 0&&(I={}),O===void 0&&(O={}),this._ctx.events.changeMode(g,I,O)},ct.prototype.updateUIClasses=function(g){return this._ctx.ui.queueMapClasses(g)},ct.prototype.activateUIButton=function(g){return this._ctx.ui.setActiveButton(g)},ct.prototype.featuresAt=function(g,I,O){if(O===void 0&&(O="click"),O!=="click"&&O!=="touch")throw new Error("invalid buffer type");return Dt[O](g,I,this._ctx)},ct.prototype.newFeature=function(g){var I=g.geometry.type;return I===Be.POINT?new pi(this._ctx,g):I===Be.LINE_STRING?new Oi(this._ctx,g):I===Be.POLYGON?new ze(this._ctx,g):new Zt(this._ctx,g)},ct.prototype.isInstanceOf=function(g,I){if(g===Be.POINT)return I instanceof pi;if(g===Be.LINE_STRING)return I instanceof Oi;if(g===Be.POLYGON)return I instanceof ze;if(g==="MultiFeature")return I instanceof Zt;throw new Error("Unknown feature class: "+g)},ct.prototype.doRender=function(g){return this._ctx.store.featureChanged(g)},ct.prototype.onSetup=function(){},ct.prototype.onDrag=function(){},ct.prototype.onClick=function(){},ct.prototype.onMouseMove=function(){},ct.prototype.onMouseDown=function(){},ct.prototype.onMouseUp=function(){},ct.prototype.onMouseOut=function(){},ct.prototype.onKeyUp=function(){},ct.prototype.onKeyDown=function(){},ct.prototype.onTouchStart=function(){},ct.prototype.onTouchMove=function(){},ct.prototype.onTouchEnd=function(){},ct.prototype.onTap=function(){},ct.prototype.onStop=function(){},ct.prototype.onTrash=function(){},ct.prototype.onCombineFeature=function(){},ct.prototype.onUncombineFeature=function(){},ct.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};var Zi={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},_r=Object.keys(Zi);function Ue(g){var I=Object.keys(g);return function(O,Y){Y===void 0&&(Y={});var ne={},se=I.reduce(function(fe,De){return fe[De]=g[De],fe},new ct(O));return{start:function(){var fe=this;ne=se.onSetup(Y),_r.forEach(function(De){var Ve,rt=Zi[De],ot=function(){return!1};g[rt]&&(ot=function(){return!0}),fe.on(De,ot,(Ve=rt,function(Je){return se[Ve](ne,Je)}))})},stop:function(){se.onStop(ne)},trash:function(){se.onTrash(ne)},combineFeatures:function(){se.onCombineFeatures(ne)},uncombineFeatures:function(){se.onUncombineFeatures(ne)},render:function(fe,De){se.toDisplayFeatures(ne,fe,De)}}}}function Bi(g){return[].concat(g).filter(function(I){return I!==void 0})}function gr(){var g=this;if(!(g.ctx.map&&g.ctx.map.getSource(ye.HOT)!==void 0))return Ve();var I=g.ctx.events.currentModeName();g.ctx.ui.queueMapClasses({mode:I});var O=[],Y=[];g.isDirty?Y=g.getAllIds():(O=g.getChangedIds().filter(function(rt){return g.get(rt)!==void 0}),Y=g.sources.hot.filter(function(rt){return rt.properties.id&&O.indexOf(rt.properties.id)===-1&&g.get(rt.properties.id)!==void 0}).map(function(rt){return rt.properties.id})),g.sources.hot=[];var ne=g.sources.cold.length;g.sources.cold=g.isDirty?[]:g.sources.cold.filter(function(rt){var ot=rt.properties.id||rt.properties.parent;return O.indexOf(ot)===-1});var se=ne!==g.sources.cold.length||Y.length>0;function fe(rt,ot){var Je=g.get(rt).internal(I);g.ctx.events.currentModeRender(Je,function(Rt){g.sources[ot].push(Rt)})}if(O.forEach(function(rt){return fe(rt,"hot")}),Y.forEach(function(rt){return fe(rt,"cold")}),se&&g.ctx.map.getSource(ye.COLD).setData({type:Be.FEATURE_COLLECTION,features:g.sources.cold}),g.ctx.map.getSource(ye.HOT).setData({type:Be.FEATURE_COLLECTION,features:g.sources.hot}),g._emitSelectionChange&&(g.ctx.map.fire(et.SELECTION_CHANGE,{features:g.getSelected().map(function(rt){return rt.toGeoJSON()}),points:g.getSelectedCoordinates().map(function(rt){return{type:Be.FEATURE,properties:{},geometry:{type:Be.POINT,coordinates:rt.coordinates}}})}),g._emitSelectionChange=!1),g._deletedFeaturesToEmit.length){var De=g._deletedFeaturesToEmit.map(function(rt){return rt.toGeoJSON()});g._deletedFeaturesToEmit=[],g.ctx.map.fire(et.DELETE,{features:De})}function Ve(){g.isDirty=!1,g.clearChangedIds()}Ve(),g.ctx.map.fire(et.RENDER,{})}function ci(g){var I,O=this;this._features={},this._featureIds=new Ge,this._selectedFeatureIds=new Ge,this._selectedCoordinates=[],this._changedFeatureIds=new Ge,this._deletedFeaturesToEmit=[],this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=g,this.sources={hot:[],cold:[]},this.render=function(){I||(I=requestAnimationFrame(function(){I=null,gr.call(O)}))},this.isDirty=!1}function co(g,I){var O=g._selectedCoordinates.filter(function(Y){return g._selectedFeatureIds.has(Y.feature_id)});g._selectedCoordinates.length===O.length||I.silent||(g._emitSelectionChange=!0),g._selectedCoordinates=O}ci.prototype.createRenderBatch=function(){var g=this,I=this.render,O=0;return this.render=function(){O++},function(){g.render=I,O>0&&g.render()}},ci.prototype.setDirty=function(){return this.isDirty=!0,this},ci.prototype.featureChanged=function(g){return this._changedFeatureIds.add(g),this},ci.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},ci.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},ci.prototype.getAllIds=function(){return this._featureIds.values()},ci.prototype.add=function(g){return this.featureChanged(g.id),this._features[g.id]=g,this._featureIds.add(g.id),this},ci.prototype.delete=function(g,I){var O=this;return I===void 0&&(I={}),Bi(g).forEach(function(Y){O._featureIds.has(Y)&&(O._featureIds.delete(Y),O._selectedFeatureIds.delete(Y),I.silent||O._deletedFeaturesToEmit.indexOf(O._features[Y])===-1&&O._deletedFeaturesToEmit.push(O._features[Y]),delete O._features[Y],O.isDirty=!0)}),co(this,I),this},ci.prototype.get=function(g){return this._features[g]},ci.prototype.getAll=function(){var g=this;return Object.keys(this._features).map(function(I){return g._features[I]})},ci.prototype.select=function(g,I){var O=this;return I===void 0&&(I={}),Bi(g).forEach(function(Y){O._selectedFeatureIds.has(Y)||(O._selectedFeatureIds.add(Y),O._changedFeatureIds.add(Y),I.silent||(O._emitSelectionChange=!0))}),this},ci.prototype.deselect=function(g,I){var O=this;return I===void 0&&(I={}),Bi(g).forEach(function(Y){O._selectedFeatureIds.has(Y)&&(O._selectedFeatureIds.delete(Y),O._changedFeatureIds.add(Y),I.silent||(O._emitSelectionChange=!0))}),co(this,I),this},ci.prototype.clearSelected=function(g){return g===void 0&&(g={}),this.deselect(this._selectedFeatureIds.values(),{silent:g.silent}),this},ci.prototype.setSelected=function(g,I){var O=this;return I===void 0&&(I={}),g=Bi(g),this.deselect(this._selectedFeatureIds.values().filter(function(Y){return g.indexOf(Y)===-1}),{silent:I.silent}),this.select(g.filter(function(Y){return!O._selectedFeatureIds.has(Y)}),{silent:I.silent}),this},ci.prototype.setSelectedCoordinates=function(g){return this._selectedCoordinates=g,this._emitSelectionChange=!0,this},ci.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},ci.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},ci.prototype.getSelected=function(){var g=this;return this._selectedFeatureIds.values().map(function(I){return g.get(I)})},ci.prototype.getSelectedCoordinates=function(){var g=this;return this._selectedCoordinates.map(function(I){return{coordinates:g.get(I.feature_id).getCoordinate(I.coord_path)}})},ci.prototype.isSelected=function(g){return this._selectedFeatureIds.has(g)},ci.prototype.setFeatureProperty=function(g,I,O){this.get(g).setProperty(I,O),this.featureChanged(g)},ci.prototype.storeMapConfig=function(){var g=this;Vt.forEach(function(I){g.ctx.map[I]&&(g._mapInitialConfig[I]=g.ctx.map[I].isEnabled())})},ci.prototype.restoreMapConfig=function(){var g=this;Object.keys(this._mapInitialConfig).forEach(function(I){g._mapInitialConfig[I]?g.ctx.map[I].enable():g.ctx.map[I].disable()})},ci.prototype.getInitialConfigValue=function(g){return this._mapInitialConfig[g]===void 0||this._mapInitialConfig[g]};var wo=function(){for(var g=arguments,I={},O=0;O=48&&ke<=57)};function Ot(ke,_t,yi){yi===void 0&&(yi={}),Rt.stop();var Xi=De[ke];if(Xi===void 0)throw new Error(ke+" is not valid");Je=ke;var tr=Xi(fe,_t);Rt=_(tr,fe),yi.silent||fe.map.fire(et.MODE_CHANGE,{mode:ke}),fe.store.setDirty(),fe.store.render()}ot.keydown=function(ke){(ke.srcElement||ke.target).classList.contains("mapboxgl-canvas")&&(ke.keyCode!==8&&ke.keyCode!==46||!fe.options.controls.trash?Hi(ke.keyCode)?Rt.keydown(ke):ke.keyCode===49&&fe.options.controls.point?Ot(Ne.DRAW_POINT):ke.keyCode===50&&fe.options.controls.line_string?Ot(Ne.DRAW_LINE_STRING):ke.keyCode===51&&fe.options.controls.polygon&&Ot(Ne.DRAW_POLYGON):(ke.preventDefault(),Rt.trash()))},ot.keyup=function(ke){Hi(ke.keyCode)&&Rt.keyup(ke)},ot.zoomend=function(){fe.store.changeZoom()},ot.data=function(ke){if(ke.dataType==="style"){var _t=fe.setup,yi=fe.map,Xi=fe.options,tr=fe.store;Xi.styles.some(function(rn){return yi.getLayer(rn.id)})||(_t.addLayers(),tr.setDirty(),tr.render())}};var ar={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start:function(){Je=fe.options.defaultMode,Rt=_(De[Je](fe),fe)},changeMode:Ot,actionable:function(ke){var _t=!1;Object.keys(ke).forEach(function(yi){if(ar[yi]===void 0)throw new Error("Invalid action type");ar[yi]!==ke[yi]&&(_t=!0),ar[yi]=ke[yi]}),_t&&fe.map.fire(et.ACTIONABLE,{actions:ar})},currentModeName:function(){return Je},currentModeRender:function(ke,_t){return Rt.render(ke,_t)},fire:function(ke,_t){ot[ke]&&ot[ke](_t)},addEventListeners:function(){fe.map.on("mousemove",ot.mousemove),fe.map.on("mousedown",ot.mousedown),fe.map.on("mouseup",ot.mouseup),fe.map.on("data",ot.data),fe.map.on("touchmove",ot.touchmove),fe.map.on("touchstart",ot.touchstart),fe.map.on("touchend",ot.touchend),fe.container.addEventListener("mouseout",ot.mouseout),fe.options.keybindings&&(fe.container.addEventListener("keydown",ot.keydown),fe.container.addEventListener("keyup",ot.keyup))},removeEventListeners:function(){fe.map.off("mousemove",ot.mousemove),fe.map.off("mousedown",ot.mousedown),fe.map.off("mouseup",ot.mouseup),fe.map.off("data",ot.data),fe.map.off("touchmove",ot.touchmove),fe.map.off("touchstart",ot.touchstart),fe.map.off("touchend",ot.touchend),fe.container.removeEventListener("mouseout",ot.mouseout),fe.options.keybindings&&(fe.container.removeEventListener("keydown",ot.keydown),fe.container.removeEventListener("keyup",ot.keyup))},trash:function(ke){Rt.trash(ke)},combineFeatures:function(){Rt.combineFeatures()},uncombineFeatures:function(){Rt.uncombineFeatures()},getMode:function(){return Je}}}(g),g.ui=function(fe){var De={},Ve=null,rt={mode:null,feature:null,mouse:null},ot={mode:null,feature:null,mouse:null};function Je(ke){ot=Se(ot,ke)}function Rt(){var ke,_t;if(fe.container){var yi=[],Xi=[];en.forEach(function(tr){ot[tr]!==rt[tr]&&(yi.push(tr+"-"+rt[tr]),ot[tr]!==null&&Xi.push(tr+"-"+ot[tr]))}),yi.length>0&&(ke=fe.container.classList).remove.apply(ke,yi),Xi.length>0&&(_t=fe.container.classList).add.apply(_t,Xi),rt=Se(rt,ot)}}function Hi(ke,_t){_t===void 0&&(_t={});var yi=document.createElement("button");return yi.className=be.CONTROL_BUTTON+" "+_t.className,yi.setAttribute("title",_t.title),_t.container.appendChild(yi),yi.addEventListener("click",function(Xi){if(Xi.preventDefault(),Xi.stopPropagation(),Xi.target===Ve)return Ot(),void _t.onDeactivate();ar(ke),_t.onActivate()},!0),yi}function Ot(){Ve&&(Ve.classList.remove(be.ACTIVE_BUTTON),Ve=null)}function ar(ke){Ot();var _t=De[ke];_t&&_t&&ke!=="trash"&&(_t.classList.add(be.ACTIVE_BUTTON),Ve=_t)}return{setActiveButton:ar,queueMapClasses:Je,updateMapClasses:Rt,clearMapClasses:function(){Je({mode:null,feature:null,mouse:null}),Rt()},addButtons:function(){var ke=fe.options.controls,_t=document.createElement("div");return _t.className=be.CONTROL_GROUP+" "+be.CONTROL_BASE,ke&&(ke[Le.LINE]&&(De[Le.LINE]=Hi(Le.LINE,{container:_t,className:be.CONTROL_BUTTON_LINE,title:"LineString tool "+(fe.options.keybindings?"(l)":""),onActivate:function(){return fe.events.changeMode(Ne.DRAW_LINE_STRING)},onDeactivate:function(){return fe.events.trash()}})),ke[Le.POLYGON]&&(De[Le.POLYGON]=Hi(Le.POLYGON,{container:_t,className:be.CONTROL_BUTTON_POLYGON,title:"Polygon tool "+(fe.options.keybindings?"(p)":""),onActivate:function(){return fe.events.changeMode(Ne.DRAW_POLYGON)},onDeactivate:function(){return fe.events.trash()}})),ke[Le.POINT]&&(De[Le.POINT]=Hi(Le.POINT,{container:_t,className:be.CONTROL_BUTTON_POINT,title:"Marker tool "+(fe.options.keybindings?"(m)":""),onActivate:function(){return fe.events.changeMode(Ne.DRAW_POINT)},onDeactivate:function(){return fe.events.trash()}})),ke.trash&&(De.trash=Hi("trash",{container:_t,className:be.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:function(){fe.events.trash()}})),ke.combine_features&&(De.combine_features=Hi("combineFeatures",{container:_t,className:be.CONTROL_BUTTON_COMBINE_FEATURES,title:"Combine",onActivate:function(){fe.events.combineFeatures()}})),ke.uncombine_features&&(De.uncombine_features=Hi("uncombineFeatures",{container:_t,className:be.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:function(){fe.events.uncombineFeatures()}}))),_t},removeButtons:function(){Object.keys(De).forEach(function(ke){var _t=De[ke];_t.parentNode&&_t.parentNode.removeChild(_t),delete De[ke]})}}}(g),g.container=ne.getContainer(),g.store=new ci(g),I=g.ui.addButtons(),g.options.boxSelect&&(g.boxZoomInitial=ne.boxZoom.isEnabled(),ne.boxZoom.disable(),ne.dragPan.disable(),ne.dragPan.enable()),ne.loaded()?Y.connect():(ne.on("load",Y.connect),O=setInterval(function(){ne.loaded()&&Y.connect()},16)),g.events.start(),I},addLayers:function(){g.map.addSource(ye.COLD,{data:{type:Be.FEATURE_COLLECTION,features:[]},type:"geojson"}),g.map.addSource(ye.HOT,{data:{type:Be.FEATURE_COLLECTION,features:[]},type:"geojson"}),g.options.styles.forEach(function(ne){g.map.addLayer(ne)}),g.store.setDirty(!0),g.store.render()},removeLayers:function(){g.options.styles.forEach(function(ne){g.map.getLayer(ne.id)&&g.map.removeLayer(ne.id)}),g.map.getSource(ye.COLD)&&g.map.removeSource(ye.COLD),g.map.getSource(ye.HOT)&&g.map.removeSource(ye.HOT)}};return g.setup=Y,Y}var Ii=[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],paint:{"fill-color":"#3bb2d0","fill-outline-color":"#3bb2d0","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","active","true"],["==","$type","Polygon"]],paint:{"fill-color":"#fbb03b","fill-outline-color":"#fbb03b","fill-opacity":.1}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","$type","Point"],["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","active","true"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-line-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","LineString"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-line-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-polygon-and-line-vertex-stroke-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-point-point-stroke-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-opacity":1,"circle-color":"#fff"}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#3bb2d0"}},{id:"gl-draw-point-stroke-active",type:"circle",filter:["all",["==","$type","Point"],["==","active","true"],["!=","meta","midpoint"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":5,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-fill-static",type:"fill",filter:["all",["==","mode","static"],["==","$type","Polygon"]],paint:{"fill-color":"#404040","fill-outline-color":"#404040","fill-opacity":.1}},{id:"gl-draw-polygon-stroke-static",type:"line",filter:["all",["==","mode","static"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-line-static",type:"line",filter:["all",["==","mode","static"],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-point-static",type:"circle",filter:["all",["==","mode","static"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#404040"}}];function ti(g){return function(I){var O=I.featureTarget;return!!O&&!!O.properties&&O.properties.meta===g}}function Vn(g){return!!g.originalEvent&&!!g.originalEvent.shiftKey&&g.originalEvent.button===0}function En(g){return!!g.featureTarget&&!!g.featureTarget.properties&&g.featureTarget.properties.active===it.ACTIVE&&g.featureTarget.properties.meta===nt.FEATURE}function Un(g){return!!g.featureTarget&&!!g.featureTarget.properties&&g.featureTarget.properties.active===it.INACTIVE&&g.featureTarget.properties.meta===nt.FEATURE}function qo(g){return g.featureTarget===void 0}function So(g){return!!g.featureTarget&&!!g.featureTarget.properties&&g.featureTarget.properties.meta===nt.FEATURE}function Cn(g){var I=g.featureTarget;return!!I&&!!I.properties&&I.properties.meta===nt.VERTEX}function $n(g){return!!g.originalEvent&&g.originalEvent.shiftKey===!0}function qe(g){return g.keyCode===27}function fn(g){return g.keyCode===13}var er=Object.freeze({__proto__:null,isOfMetaType:ti,isShiftMousedown:Vn,isActiveFeature:En,isInactiveFeature:Un,noTarget:qo,isFeature:So,isVertex:Cn,isShiftDown:$n,isEscapeKey:qe,isEnterKey:fn,isTrue:function(){return!0}}),Zo=tn;function tn(g,I){this.x=g,this.y=I}tn.prototype={clone:function(){return new tn(this.x,this.y)},add:function(g){return this.clone()._add(g)},sub:function(g){return this.clone()._sub(g)},multByPoint:function(g){return this.clone()._multByPoint(g)},divByPoint:function(g){return this.clone()._divByPoint(g)},mult:function(g){return this.clone()._mult(g)},div:function(g){return this.clone()._div(g)},rotate:function(g){return this.clone()._rotate(g)},rotateAround:function(g,I){return this.clone()._rotateAround(g,I)},matMult:function(g){return this.clone()._matMult(g)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(g){return this.x===g.x&&this.y===g.y},dist:function(g){return Math.sqrt(this.distSqr(g))},distSqr:function(g){var I=g.x-this.x,O=g.y-this.y;return I*I+O*O},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(g){return Math.atan2(this.y-g.y,this.x-g.x)},angleWith:function(g){return this.angleWithSep(g.x,g.y)},angleWithSep:function(g,I){return Math.atan2(this.x*I-this.y*g,this.x*g+this.y*I)},_matMult:function(g){var I=g[0]*this.x+g[1]*this.y,O=g[2]*this.x+g[3]*this.y;return this.x=I,this.y=O,this},_add:function(g){return this.x+=g.x,this.y+=g.y,this},_sub:function(g){return this.x-=g.x,this.y-=g.y,this},_mult:function(g){return this.x*=g,this.y*=g,this},_div:function(g){return this.x/=g,this.y/=g,this},_multByPoint:function(g){return this.x*=g.x,this.y*=g.y,this},_divByPoint:function(g){return this.x/=g.x,this.y/=g.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var g=this.y;return this.y=this.x,this.x=-g,this},_rotate:function(g){var I=Math.cos(g),O=Math.sin(g),Y=I*this.x-O*this.y,ne=O*this.x+I*this.y;return this.x=Y,this.y=ne,this},_rotateAround:function(g,I){var O=Math.cos(g),Y=Math.sin(g),ne=I.x+O*(this.x-I.x)-Y*(this.y-I.y),se=I.y+Y*(this.x-I.x)+O*(this.y-I.y);return this.x=ne,this.y=se,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},tn.convert=function(g){return g instanceof tn?g:Array.isArray(g)?new tn(g[0],g[1]):g};var We=v(Zo);function Bt(g,I){var O=I.getBoundingClientRect();return new We(g.clientX-O.left-(I.clientLeft||0),g.clientY-O.top-(I.clientTop||0))}function Mt(g,I,O,Y){return{type:Be.FEATURE,properties:{meta:nt.VERTEX,parent:g,coord_path:O,active:Y?it.ACTIVE:it.INACTIVE},geometry:{type:Be.POINT,coordinates:I}}}function Vr(g,I,O){var Y=I.geometry.coordinates,ne=O.geometry.coordinates;if(Y[1]>85||Y[1]85||ne[1]=I&&this._bbox[3]>=O},Ut.prototype.intersect=function(g){return this._valid?(I=g instanceof Ut?g.bbox():g,!(this._bbox[0]>I[2]||this._bbox[2]I[3])):null;var I},Ut.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var g="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",g)},Ut.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null};var si=function(g){if(!g)return[];var I=Q(J(g)),O=[];return I.features.forEach(function(Y){Y.geometry&&(O=O.concat(he(Y.geometry.coordinates)))}),O},ii=Ft,Ur=mi,Ei={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},ur=Object.keys(Ei);function yr(g){for(var I=Ur(),O=si(g),Y=0;YO&&(O=Je),Rtne&&(ne=Rt),JeDe&&(De=Ot)});var Ve=I;return O+Ve.lat>85&&(Ve.lat=85-O),ne+Ve.lat>90&&(Ve.lat=90-ne),Y+Ve.lat<-85&&(Ve.lat=-85-Y),se+Ve.lat=270&&(Ve.lng-=360*Math.ceil(Math.abs(Ve.lng)/360)),Ve}function Io(g,I){var O=To(g.map(function(Y){return Y.toGeoJSON()}),I);g.forEach(function(Y){var ne,se=Y.getCoordinates(),fe=function(Ve){var rt={lng:Ve[0]+O.lng,lat:Ve[1]+O.lat};return[rt.lng,rt.lat]},De=function(Ve){return Ve.map(function(rt){return fe(rt)})};Y.type===Be.POINT?ne=fe(se):Y.type===Be.LINE_STRING||Y.type===Be.MULTI_POINT?ne=se.map(fe):Y.type===Be.POLYGON||Y.type===Be.MULTI_LINE_STRING?ne=se.map(De):Y.type===Be.MULTI_POLYGON&&(ne=se.map(function(Ve){return Ve.map(function(rt){return De(rt)})})),Y.incomingCoords(ne)})}var vr={onSetup:function(g){var I=this,O={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initiallySelectedFeatureIds:g.featureIds||[]};return this.setSelected(O.initiallySelectedFeatureIds.filter(function(Y){return I.getFeature(Y)!==void 0})),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),O},fireUpdate:function(){this.map.fire(et.UPDATE,{action:at.MOVE,features:this.getSelected().map(function(g){return g.toGeoJSON()})})},fireActionable:function(){var g=this,I=this.getSelected(),O=I.filter(function(De){return g.isInstanceOf("MultiFeature",De)}),Y=!1;if(I.length>1){Y=!0;var ne=I[0].type.replace("Multi","");I.forEach(function(De){De.type.replace("Multi","")!==ne&&(Y=!1)})}var se=O.length>0,fe=I.length>0;this.setActionableState({combineFeatures:Y,uncombineFeatures:se,trash:fe})},getUniqueIds:function(g){return g.length?g.map(function(I){return I.properties.id}).filter(function(I){return I!==void 0}).reduce(function(I,O){return I.add(O),I},new Ge).values():[]},stopExtendedInteractions:function(g){g.boxSelectElement&&(g.boxSelectElement.parentNode&&g.boxSelectElement.parentNode.removeChild(g.boxSelectElement),g.boxSelectElement=null),this.map.dragPan.enable(),g.boxSelecting=!1,g.canBoxSelect=!1,g.dragMoving=!1,g.canDragMove=!1},onStop:function(){It.enable(this)},onMouseMove:function(g,I){return So(I)&&g.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(g),!0},onMouseOut:function(g){return!g.dragMoving||this.fireUpdate()}};vr.onTap=vr.onClick=function(g,I){return qo(I)?this.clickAnywhere(g,I):ti(nt.VERTEX)(I)?this.clickOnVertex(g,I):So(I)?this.clickOnFeature(g,I):void 0},vr.clickAnywhere=function(g){var I=this,O=this.getSelectedIds();O.length&&(this.clearSelectedFeatures(),O.forEach(function(Y){return I.doRender(Y)})),It.enable(this),this.stopExtendedInteractions(g)},vr.clickOnVertex=function(g,I){this.changeMode(Ne.DIRECT_SELECT,{featureId:I.featureTarget.properties.parent,coordPath:I.featureTarget.properties.coord_path,startPos:I.lngLat}),this.updateUIClasses({mouse:Oe.MOVE})},vr.startOnActiveFeature=function(g,I){this.stopExtendedInteractions(g),this.map.dragPan.disable(),this.doRender(I.featureTarget.properties.id),g.canDragMove=!0,g.dragMoveLocation=I.lngLat},vr.clickOnFeature=function(g,I){var O=this;It.disable(this),this.stopExtendedInteractions(g);var Y=$n(I),ne=this.getSelectedIds(),se=I.featureTarget.properties.id,fe=this.isSelected(se);if(!Y&&fe&&this.getFeature(se).type!==Be.POINT)return this.changeMode(Ne.DIRECT_SELECT,{featureId:se});fe&&Y?(this.deselect(se),this.updateUIClasses({mouse:Oe.POINTER}),ne.length===1&&It.enable(this)):!fe&&Y?(this.select(se),this.updateUIClasses({mouse:Oe.MOVE})):fe||Y||(ne.forEach(function(De){return O.doRender(De)}),this.setSelected(se),this.updateUIClasses({mouse:Oe.MOVE})),this.doRender(se)},vr.onMouseDown=function(g,I){return En(I)?this.startOnActiveFeature(g,I):this.drawConfig.boxSelect&&Vn(I)?this.startBoxSelect(g,I):void 0},vr.startBoxSelect=function(g,I){this.stopExtendedInteractions(g),this.map.dragPan.disable(),g.boxSelectStartLocation=Bt(I.originalEvent,this.map.getContainer()),g.canBoxSelect=!0},vr.onTouchStart=function(g,I){if(En(I))return this.startOnActiveFeature(g,I)},vr.onDrag=function(g,I){return g.canDragMove?this.dragMove(g,I):this.drawConfig.boxSelect&&g.canBoxSelect?this.whileBoxSelect(g,I):void 0},vr.whileBoxSelect=function(g,I){g.boxSelecting=!0,this.updateUIClasses({mouse:Oe.ADD}),g.boxSelectElement||(g.boxSelectElement=document.createElement("div"),g.boxSelectElement.classList.add(be.BOX_SELECT),this.map.getContainer().appendChild(g.boxSelectElement));var O=Bt(I.originalEvent,this.map.getContainer()),Y=Math.min(g.boxSelectStartLocation.x,O.x),ne=Math.max(g.boxSelectStartLocation.x,O.x),se=Math.min(g.boxSelectStartLocation.y,O.y),fe=Math.max(g.boxSelectStartLocation.y,O.y),De="translate("+Y+"px, "+se+"px)";g.boxSelectElement.style.transform=De,g.boxSelectElement.style.WebkitTransform=De,g.boxSelectElement.style.width=ne-Y+"px",g.boxSelectElement.style.height=fe-se+"px"},vr.dragMove=function(g,I){g.dragMoving=!0,I.originalEvent.stopPropagation();var O={lng:I.lngLat.lng-g.dragMoveLocation.lng,lat:I.lngLat.lat-g.dragMoveLocation.lat};Io(this.getSelected(),O),g.dragMoveLocation=I.lngLat},vr.onTouchEnd=vr.onMouseUp=function(g,I){var O=this;if(g.dragMoving)this.fireUpdate();else if(g.boxSelecting){var Y=[g.boxSelectStartLocation,Bt(I.originalEvent,this.map.getContainer())],ne=this.featuresAt(null,Y,"click"),se=this.getUniqueIds(ne).filter(function(fe){return!O.isSelected(fe)});se.length&&(this.select(se),se.forEach(function(fe){return O.doRender(fe)}),this.updateUIClasses({mouse:Oe.MOVE}))}this.stopExtendedInteractions(g)},vr.toDisplayFeatures=function(g,I,O){I.properties.active=this.isSelected(I.properties.id)?it.ACTIVE:it.INACTIVE,O(I),this.fireActionable(),I.properties.active===it.ACTIVE&&I.geometry.type!==Be.POINT&&mn(I).forEach(O)},vr.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},vr.onCombineFeatures=function(){var g=this.getSelected();if(!(g.length===0||g.length<2)){for(var I=[],O=[],Y=g[0].type.replace("Multi",""),ne=0;ne1){var fe=this.newFeature({type:Be.FEATURE,properties:O[0].properties,geometry:{type:"Multi"+Y,coordinates:I}});this.addFeature(fe),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([fe.id]),this.map.fire(et.COMBINE_FEATURES,{createdFeatures:[fe.toGeoJSON()],deletedFeatures:O})}this.fireActionable()}},vr.onUncombineFeatures=function(){var g=this,I=this.getSelected();if(I.length!==0){for(var O=[],Y=[],ne=function(fe){var De=I[fe];g.isInstanceOf("MultiFeature",De)&&(De.getFeatures().forEach(function(Ve){g.addFeature(Ve),Ve.properties=De.properties,O.push(Ve.toGeoJSON()),g.select([Ve.id])}),g.deleteFeature(De.id,{silent:!0}),Y.push(De.toGeoJSON()))},se=0;se1&&this.map.fire(et.UNCOMBINE_FEATURES,{createdFeatures:O,deletedFeatures:Y}),this.fireActionable()}};var gi=ti(nt.VERTEX),ea=ti(nt.MIDPOINT),jn={fireUpdate:function(){this.map.fire(et.UPDATE,{action:at.CHANGE_COORDINATES,features:this.getSelected().map(function(g){return g.toGeoJSON()})})},fireActionable:function(g){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:g.selectedCoordPaths.length>0})},startDragging:function(g,I){this.map.dragPan.disable(),g.canDragMove=!0,g.dragMoveLocation=I.lngLat},stopDragging:function(g){this.map.dragPan.enable(),g.dragMoving=!1,g.canDragMove=!1,g.dragMoveLocation=null},onVertex:function(g,I){this.startDragging(g,I);var O=I.featureTarget.properties,Y=g.selectedCoordPaths.indexOf(O.coord_path);$n(I)||Y!==-1?$n(I)&&Y===-1&&g.selectedCoordPaths.push(O.coord_path):g.selectedCoordPaths=[O.coord_path];var ne=this.pathsToCoordinates(g.featureId,g.selectedCoordPaths);this.setSelectedCoordinates(ne)},onMidpoint:function(g,I){this.startDragging(g,I);var O=I.featureTarget.properties;g.feature.addCoordinate(O.coord_path,O.lng,O.lat),this.fireUpdate(),g.selectedCoordPaths=[O.coord_path]},pathsToCoordinates:function(g,I){return I.map(function(O){return{feature_id:g,coord_path:O}})},onFeature:function(g,I){g.selectedCoordPaths.length===0?this.startDragging(g,I):this.stopDragging(g)},dragFeature:function(g,I,O){Io(this.getSelected(),O),g.dragMoveLocation=I.lngLat},dragVertex:function(g,I,O){for(var Y=g.selectedCoordPaths.map(function(De){return g.feature.getCoordinate(De)}),ne=To(Y.map(function(De){return{type:Be.FEATURE,properties:{},geometry:{type:Be.POINT,coordinates:De}}}),O),se=0;se0?this.dragVertex(g,I,O):this.dragFeature(g,I,O),g.dragMoveLocation=I.lngLat}},jn.onClick=function(g,I){return qo(I)?this.clickNoTarget(g,I):En(I)?this.clickActiveFeature(g,I):Un(I)?this.clickInactive(g,I):void this.stopDragging(g)},jn.onTap=function(g,I){return qo(I)?this.clickNoTarget(g,I):En(I)?this.clickActiveFeature(g,I):Un(I)?this.clickInactive(g,I):void 0},jn.onTouchEnd=jn.onMouseUp=function(g){g.dragMoving&&this.fireUpdate(),this.stopDragging(g)};var ji={};function jr(g,I){return!!g.lngLat&&g.lngLat.lng===I[0]&&g.lngLat.lat===I[1]}ji.onSetup=function(){var g=this.newFeature({type:Be.FEATURE,properties:{},geometry:{type:Be.POINT,coordinates:[]}});return this.addFeature(g),this.clearSelectedFeatures(),this.updateUIClasses({mouse:Oe.ADD}),this.activateUIButton(Le.POINT),this.setActionableState({trash:!0}),{point:g}},ji.stopDrawingAndRemove=function(g){this.deleteFeature([g.point.id],{silent:!0}),this.changeMode(Ne.SIMPLE_SELECT)},ji.onTap=ji.onClick=function(g,I){this.updateUIClasses({mouse:Oe.MOVE}),g.point.updateCoordinate("",I.lngLat.lng,I.lngLat.lat),this.map.fire(et.CREATE,{features:[g.point.toGeoJSON()]}),this.changeMode(Ne.SIMPLE_SELECT,{featureIds:[g.point.id]})},ji.onStop=function(g){this.activateUIButton(),g.point.getCoordinate().length||this.deleteFeature([g.point.id],{silent:!0})},ji.toDisplayFeatures=function(g,I,O){var Y=I.properties.id===g.point.id;if(I.properties.active=Y?it.ACTIVE:it.INACTIVE,!Y)return O(I)},ji.onTrash=ji.stopDrawingAndRemove,ji.onKeyUp=function(g,I){if(qe(I)||fn(I))return this.stopDrawingAndRemove(g,I)};var Go={onSetup:function(){var g=this.newFeature({type:Be.FEATURE,properties:{},geometry:{type:Be.POLYGON,coordinates:[[]]}});return this.addFeature(g),this.clearSelectedFeatures(),It.disable(this),this.updateUIClasses({mouse:Oe.ADD}),this.activateUIButton(Le.POLYGON),this.setActionableState({trash:!0}),{polygon:g,currentVertexPosition:0}},clickAnywhere:function(g,I){if(g.currentVertexPosition>0&&jr(I,g.polygon.coordinates[0][g.currentVertexPosition-1]))return this.changeMode(Ne.SIMPLE_SELECT,{featureIds:[g.polygon.id]});this.updateUIClasses({mouse:Oe.ADD}),g.polygon.updateCoordinate("0."+g.currentVertexPosition,I.lngLat.lng,I.lngLat.lat),g.currentVertexPosition++,g.polygon.updateCoordinate("0."+g.currentVertexPosition,I.lngLat.lng,I.lngLat.lat)},clickOnVertex:function(g){return this.changeMode(Ne.SIMPLE_SELECT,{featureIds:[g.polygon.id]})},onMouseMove:function(g,I){g.polygon.updateCoordinate("0."+g.currentVertexPosition,I.lngLat.lng,I.lngLat.lat),Cn(I)&&this.updateUIClasses({mouse:Oe.POINTER})}};Go.onTap=Go.onClick=function(g,I){return Cn(I)?this.clickOnVertex(g,I):this.clickAnywhere(g,I)},Go.onKeyUp=function(g,I){qe(I)?(this.deleteFeature([g.polygon.id],{silent:!0}),this.changeMode(Ne.SIMPLE_SELECT)):fn(I)&&this.changeMode(Ne.SIMPLE_SELECT,{featureIds:[g.polygon.id]})},Go.onStop=function(g){this.updateUIClasses({mouse:Oe.NONE}),It.enable(this),this.activateUIButton(),this.getFeature(g.polygon.id)!==void 0&&(g.polygon.removeCoordinate("0."+g.currentVertexPosition),g.polygon.isValid()?this.map.fire(et.CREATE,{features:[g.polygon.toGeoJSON()]}):(this.deleteFeature([g.polygon.id],{silent:!0}),this.changeMode(Ne.SIMPLE_SELECT,{},{silent:!0})))},Go.toDisplayFeatures=function(g,I,O){var Y=I.properties.id===g.polygon.id;if(I.properties.active=Y?it.ACTIVE:it.INACTIVE,!Y)return O(I);if(I.geometry.coordinates.length!==0){var ne=I.geometry.coordinates[0].length;if(!(ne<3)){if(I.properties.meta=nt.FEATURE,O(Mt(g.polygon.id,I.geometry.coordinates[0][0],"0.0",!1)),ne>3){var se=I.geometry.coordinates[0].length-3;O(Mt(g.polygon.id,I.geometry.coordinates[0][se],"0."+se,!1))}if(ne<=4){var fe=[[I.geometry.coordinates[0][0][0],I.geometry.coordinates[0][0][1]],[I.geometry.coordinates[0][1][0],I.geometry.coordinates[0][1][1]]];if(O({type:Be.FEATURE,properties:I.properties,geometry:{coordinates:fe,type:Be.LINE_STRING}}),ne===3)return}return O(I)}}},Go.onTrash=function(g){this.deleteFeature([g.polygon.id],{silent:!0}),this.changeMode(Ne.SIMPLE_SELECT)};var Tr={onSetup:function(g){var I,O,Y=(g=g||{}).featureId,ne="forward";if(Y){if(!(I=this.getFeature(Y)))throw new Error("Could not find a feature with the provided featureId");var se=g.from;if(se&&se.type==="Feature"&&se.geometry&&se.geometry.type==="Point"&&(se=se.geometry),se&&se.type==="Point"&&se.coordinates&&se.coordinates.length===2&&(se=se.coordinates),!se||!Array.isArray(se))throw new Error("Please use the `from` property to indicate which point to continue the line from");var fe=I.coordinates.length-1;if(I.coordinates[fe][0]===se[0]&&I.coordinates[fe][1]===se[1])O=fe+1,I.addCoordinate.apply(I,[O].concat(I.coordinates[fe]));else{if(I.coordinates[0][0]!==se[0]||I.coordinates[0][1]!==se[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");ne="backwards",O=0,I.addCoordinate.apply(I,[O].concat(I.coordinates[0]))}}else I=this.newFeature({type:Be.FEATURE,properties:{},geometry:{type:Be.LINE_STRING,coordinates:[]}}),O=0,this.addFeature(I);return this.clearSelectedFeatures(),It.disable(this),this.updateUIClasses({mouse:Oe.ADD}),this.activateUIButton(Le.LINE),this.setActionableState({trash:!0}),{line:I,currentVertexPosition:O,direction:ne}},clickAnywhere:function(g,I){if(g.currentVertexPosition>0&&jr(I,g.line.coordinates[g.currentVertexPosition-1])||g.direction==="backwards"&&jr(I,g.line.coordinates[g.currentVertexPosition+1]))return this.changeMode(Ne.SIMPLE_SELECT,{featureIds:[g.line.id]});this.updateUIClasses({mouse:Oe.ADD}),g.line.updateCoordinate(g.currentVertexPosition,I.lngLat.lng,I.lngLat.lat),g.direction==="forward"?(g.currentVertexPosition++,g.line.updateCoordinate(g.currentVertexPosition,I.lngLat.lng,I.lngLat.lat)):g.line.addCoordinate(0,I.lngLat.lng,I.lngLat.lat)},clickOnVertex:function(g){return this.changeMode(Ne.SIMPLE_SELECT,{featureIds:[g.line.id]})},onMouseMove:function(g,I){g.line.updateCoordinate(g.currentVertexPosition,I.lngLat.lng,I.lngLat.lat),Cn(I)&&this.updateUIClasses({mouse:Oe.POINTER})}};Tr.onTap=Tr.onClick=function(g,I){if(Cn(I))return this.clickOnVertex(g,I);this.clickAnywhere(g,I)},Tr.onKeyUp=function(g,I){fn(I)?this.changeMode(Ne.SIMPLE_SELECT,{featureIds:[g.line.id]}):qe(I)&&(this.deleteFeature([g.line.id],{silent:!0}),this.changeMode(Ne.SIMPLE_SELECT))},Tr.onStop=function(g){It.enable(this),this.activateUIButton(),this.getFeature(g.line.id)!==void 0&&(g.line.removeCoordinate(""+g.currentVertexPosition),g.line.isValid()?this.map.fire(et.CREATE,{features:[g.line.toGeoJSON()]}):(this.deleteFeature([g.line.id],{silent:!0}),this.changeMode(Ne.SIMPLE_SELECT,{},{silent:!0})))},Tr.onTrash=function(g){this.deleteFeature([g.line.id],{silent:!0}),this.changeMode(Ne.SIMPLE_SELECT)},Tr.toDisplayFeatures=function(g,I,O){var Y=I.properties.id===g.line.id;if(I.properties.active=Y?it.ACTIVE:it.INACTIVE,!Y)return O(I);I.geometry.coordinates.length<2||(I.properties.meta=nt.FEATURE,O(Mt(g.line.id,I.geometry.coordinates[g.direction==="forward"?I.geometry.coordinates.length-2:1],""+(g.direction==="forward"?I.geometry.coordinates.length-2:1),!1)),O(I))};var Ir={simple_select:vr,direct_select:jn,draw_point:ji,draw_polygon:Go,draw_line_string:Tr},ta={defaultMode:Ne.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:Ii,modes:Ir,controls:{},userProperties:!1},os={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},Gi={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function ui(g,I){return g.map(function(O){return O.source?O:Se(O,{id:O.id+"."+I,source:I==="hot"?ye.HOT:ye.COLD})})}var uo={exports:{}};(function(g,I){var O="__lodash_hash_undefined__",Y=9007199254740991,ne="[object Arguments]",se="[object Array]",fe="[object Boolean]",De="[object Date]",Ve="[object Error]",rt="[object Function]",ot="[object Map]",Je="[object Number]",Rt="[object Object]",Hi="[object Promise]",Ot="[object RegExp]",ar="[object Set]",ke="[object String]",_t="[object Symbol]",yi="[object WeakMap]",Xi="[object ArrayBuffer]",tr="[object DataView]",rn=/^\[object .+?Constructor\]$/,ia=/^(?:0|[1-9]\d*)$/,Ci={};Ci["[object Float32Array]"]=Ci["[object Float64Array]"]=Ci["[object Int8Array]"]=Ci["[object Int16Array]"]=Ci["[object Int32Array]"]=Ci["[object Uint8Array]"]=Ci["[object Uint8ClampedArray]"]=Ci["[object Uint16Array]"]=Ci["[object Uint32Array]"]=!0,Ci[ne]=Ci[se]=Ci[Xi]=Ci[fe]=Ci[tr]=Ci[De]=Ci[Ve]=Ci[rt]=Ci[ot]=Ci[Je]=Ci[Rt]=Ci[Ot]=Ci[ar]=Ci[ke]=Ci[yi]=!1;var ss=typeof Al=="object"&&Al&&Al.Object===Object&&Al,ra=typeof self=="object"&&self&&self.Object===Object&&self,nn=ss||ra||Function("return this")(),ho=I&&!I.nodeType&&I,Xt=ho&&g&&!g.nodeType&&g,Ss=Xt&&Xt.exports===ho,Wr=Ss&&ss.process,on=function(){try{return Wr&&Wr.binding&&Wr.binding("util")}catch{}}(),na=on&&on.isTypedArray;function oa(de,we){for(var Ye=-1,wt=de==null?0:de.length;++Yelr))return!1;var rr=ri.get(de);if(rr&&ri.get(we))return rr==we;var xi=-1,sn=!0,no=2&Ye?new ls:void 0;for(ri.set(de,we),ri.set(we,de);++xi-1},_n.prototype.set=function(de,we){var Ye=this.__data__,wt=cs(Ye,de);return wt<0?(++this.size,Ye.push([de,we])):Ye[wt][1]=we,this},Ao.prototype.clear=function(){this.size=0,this.__data__={hash:new vi,map:new(qn||_n),string:new vi}},Ao.prototype.delete=function(de){var we=ga(this,de).delete(de);return this.size-=we?1:0,we},Ao.prototype.get=function(de){return ga(this,de).get(de)},Ao.prototype.has=function(de){return ga(this,de).has(de)},Ao.prototype.set=function(de,we){var Ye=ga(this,de),wt=Ye.size;return Ye.set(de,we),this.size+=Ye.size==wt?0:1,this},ls.prototype.add=ls.prototype.push=function(de){return this.__data__.set(de,O),this},ls.prototype.has=function(de){return this.__data__.has(de)},Zn.prototype.clear=function(){this.__data__=new _n,this.size=0},Zn.prototype.delete=function(de){var we=this.__data__,Ye=we.delete(de);return this.size=we.size,Ye},Zn.prototype.get=function(de){return this.__data__.get(de)},Zn.prototype.has=function(de){return this.__data__.has(de)},Zn.prototype.set=function(de,we){var Ye=this.__data__;if(Ye instanceof _n){var wt=Ye.__data__;if(!qn||wt.length<199)return wt.push([de,we]),this.size=++Ye.size,this;Ye=this.__data__=new Ao(wt)}return Ye.set(de,we),this.size=Ye.size,this};var ya=Ho?function(de){return de==null?[]:(de=Object(de),function(we,Ye){for(var wt=-1,Vi=we==null?0:we.length,ri=0,ir=[];++wt-1&&de%1==0&&de-1&&de%1==0&&de<=Y}function Hr(de){var we=typeof de;return de!=null&&(we=="object"||we=="function")}function ro(de){return de!=null&&typeof de=="object"}var ds=na?function(de){return function(we){return de(we)}}(na):function(de){return ro(de)&&zo(de.length)&&!!Ci[ko(de)]};function ba(de){return(we=de)!=null&&zo(we.length)&&!Ji(we)?fa(de):As(de);var we}g.exports=function(de,we){return us(de,we)}})(uo,uo.exports);var Wi=v(uo.exports);function bs(g,I){return g.length===I.length&&JSON.stringify(g.map(function(O){return O}).sort())===JSON.stringify(I.map(function(O){return O}).sort())}var kn={Polygon:ze,LineString:Oi,Point:pi,MultiPolygon:Zt,MultiLineString:Zt,MultiPoint:Zt},Ba=Object.freeze({__proto__:null,CommonSelectors:er,constrainFeatureMovement:To,createMidPoint:Vr,createSupplementaryPoints:mn,createVertex:Mt,doubleClickZoom:It,euclideanDistance:di,featuresAt:Dt,getFeatureAtAndSetCursors:Lt,isClick:Pi,isEventAtCoordinates:jr,isTap:$r,mapEventToBoundingBox:Ae,ModeHandler:_,moveFeatures:Io,sortFeatures:At,stringSetsAreEqual:bs,StringSet:Ge,theme:Ii,toDenseArray:Bi}),Eo=function(g,I){var O={options:g=function(ne){ne===void 0&&(ne={});var se=Se(ne);return ne.controls||(se.controls={}),ne.displayControlsDefault===!1?se.controls=Se(Gi,ne.controls):se.controls=Se(os,ne.controls),(se=Se(ta,se)).styles=ui(se.styles,"cold").concat(ui(se.styles,"hot")),se}(g)};I=function(ne,se){return se.modes=Ne,se.getFeatureIdsAt=function(fe){return Dt.click({point:fe},null,ne).map(function(De){return De.properties.id})},se.getSelectedIds=function(){return ne.store.getSelectedIds()},se.getSelected=function(){return{type:Be.FEATURE_COLLECTION,features:ne.store.getSelectedIds().map(function(fe){return ne.store.get(fe)}).map(function(fe){return fe.toGeoJSON()})}},se.getSelectedPoints=function(){return{type:Be.FEATURE_COLLECTION,features:ne.store.getSelectedCoordinates().map(function(fe){return{type:Be.FEATURE,properties:{},geometry:{type:Be.POINT,coordinates:fe.coordinates}}})}},se.set=function(fe){if(fe.type===void 0||fe.type!==Be.FEATURE_COLLECTION||!Array.isArray(fe.features))throw new Error("Invalid FeatureCollection");var De=ne.store.createRenderBatch(),Ve=ne.store.getAllIds().slice(),rt=se.add(fe),ot=new Ge(rt);return(Ve=Ve.filter(function(Je){return!ot.has(Je)})).length&&se.delete(Ve),De(),rt},se.add=function(fe){var De=JSON.parse(JSON.stringify(F(fe))).features.map(function(Ve){if(Ve.id=Ve.id||Ti(),Ve.geometry===null)throw new Error("Invalid geometry: null");if(ne.store.get(Ve.id)===void 0||ne.store.get(Ve.id).type!==Ve.geometry.type){var rt=kn[Ve.geometry.type];if(rt===void 0)throw new Error("Invalid geometry type: "+Ve.geometry.type+".");var ot=new rt(ne,Ve);ne.store.add(ot)}else{var Je=ne.store.get(Ve.id);Je.properties=Ve.properties,Wi(Je.properties,Ve.properties)||ne.store.featureChanged(Je.id),Wi(Je.getCoordinates(),Ve.geometry.coordinates)||Je.incomingCoords(Ve.geometry.coordinates)}return Ve.id});return ne.store.render(),De},se.get=function(fe){var De=ne.store.get(fe);if(De)return De.toGeoJSON()},se.getAll=function(){return{type:Be.FEATURE_COLLECTION,features:ne.store.getAll().map(function(fe){return fe.toGeoJSON()})}},se.delete=function(fe){return ne.store.delete(fe,{silent:!0}),se.getMode()!==Ne.DIRECT_SELECT||ne.store.getSelectedIds().length?ne.store.render():ne.events.changeMode(Ne.SIMPLE_SELECT,void 0,{silent:!0}),se},se.deleteAll=function(){return ne.store.delete(ne.store.getAllIds(),{silent:!0}),se.getMode()===Ne.DIRECT_SELECT?ne.events.changeMode(Ne.SIMPLE_SELECT,void 0,{silent:!0}):ne.store.render(),se},se.changeMode=function(fe,De){return De===void 0&&(De={}),fe===Ne.SIMPLE_SELECT&&se.getMode()===Ne.SIMPLE_SELECT?(bs(De.featureIds||[],ne.store.getSelectedIds())||(ne.store.setSelected(De.featureIds,{silent:!0}),ne.store.render()),se):(fe===Ne.DIRECT_SELECT&&se.getMode()===Ne.DIRECT_SELECT&&De.featureId===ne.store.getSelectedIds()[0]||ne.events.changeMode(fe,De,{silent:!0}),se)},se.getMode=function(){return ne.events.getMode()},se.trash=function(){return ne.events.trash({silent:!0}),se},se.combineFeatures=function(){return ne.events.combineFeatures({silent:!0}),se},se.uncombineFeatures=function(){return ne.events.uncombineFeatures({silent:!0}),se},se.setFeatureProperty=function(fe,De,Ve){return ne.store.setFeatureProperty(fe,De,Ve),se},se}(O,I),O.api=I;var Y=In(O);return I.onAdd=Y.onAdd,I.onRemove=Y.onRemove,I.types=Le,I.options=g,I};function ws(g){Eo(g,this)}return ws.modes=Ir,ws.constants=Ht,ws.lib=Ba,ws})})(sf);var qg=sf.exports;const La=Yp(qg);function Zg(m){let f,_,v;return{c(){f=Wt("button"),f.textContent="Import current view",vs(f,"type","button")},m(E,k){hi(E,f,k),_||(v=Fa(f,"click",m[0]),_=!0)},p:Mr,i:Mr,o:Mr,d(E){E&&li(f),_=!1,v()}}}function Gg(m){let f='poly:"';for(let[v,E]of m.geometry.coordinates[0])f+=`${E} ${v} `;return f=f.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${f}); node(w)->.x; <;); out meta;`}`}function _c(m){return[m.lng,m.lat]}function Wg(m,f,_){let{map:v}=f;const E=Ih();let k=null;ol(()=>{v!=null&&v.loaded()&&k&&v.removeControl(k)});async function B(N){try{E("loading","Loading from Overpass");let be=await(await fetch(Gg(N))).text();E("gotXml",be)}catch(_e){E("error",_e.toString())}}function s(){let N=v.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[_c(N.getSouthWest()),_c(N.getNorthWest()),_c(N.getNorthEast()),_c(N.getSouthEast()),_c(N.getSouthWest())]],type:"Polygon"}}}async function H(){if(v){if(v.getZoom()<13){E("error","Zoom in more to import");return}await B(s())}}return m.$$set=N=>{"map"in N&&_(1,v=N.map)},m.$$.update=()=>{m.$$.dirty&14&&v&&!k&&(_(2,La.constants.classes.CONTROL_BASE="maplibregl-ctrl",La),_(2,La.constants.classes.CONTROL_PREFIX="maplibregl-ctrl-",La),_(2,La.constants.classes.CONTROL_GROUP="maplibregl-ctrl-group",La),_(3,k=new La({displayControlsDefault:!1,controls:{polygon:!0}})),v.addControl(k),v.on("draw.create",async N=>{let _e=N.features[0];k.deleteAll(),await B(_e)}))},[H,v,La,k]}class Hg extends Gr{constructor(f){super(),Zr(this,f,Wg,Zg,Sr,{map:1})}}function Dp(m,f,_){const v=m.slice();return v[1]=f[_][0],v[2]=f[_][1],v}function Fp(m){let f,_,v=m[1]+"",E,k,B=m[2]+"",s;return{c(){f=Wt("tr"),_=Wt("td"),E=nl(v),k=Wt("td"),s=nl(B)},m(H,N){hi(H,f,N),_i(f,_),_i(_,E),_i(f,k),_i(k,s)},p(H,N){N&1&&v!==(v=H[1]+"")&&yh(E,v),N&1&&B!==(B=H[2]+"")&&yh(s,B)},d(H){H&&li(f)}}}function Xg(m){let f,_,v=gp(Object.entries(m[0])),E=[];for(let k=0;k{"properties"in E&&_(0,v=E.properties)},[v]}class zh extends Gr{constructor(f){super(),Zr(this,f,Kg,Xg,Sr,{properties:0})}}const af=["==",["geometry-type"],"Polygon"],lf=["==",["geometry-type"],"LineString"],cf=["==",["geometry-type"],"Point"];function yu(m,f,_){let v=["match",m];for(let[E,k]of Object.entries(f))v.push(E),v.push(k);return v.push(_),v}let zt;const uf=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&uf.decode();let bc=null;function Cc(){return(bc===null||bc.byteLength===0)&&(bc=new Uint8Array(zt.memory.buffer)),bc}function Hs(m,f){return m=m>>>0,uf.decode(Cc().subarray(m,m+f))}const Xs=new Array(128).fill(void 0);Xs.push(void 0,null,!0,!1);let Mc=Xs.length;function Yr(m){Mc===Xs.length&&Xs.push(Xs.length+1);const f=Mc;return Mc=Xs[f],Xs[f]=m,f}function ai(m){return Xs[m]}function Jg(m){m<132||(Xs[m]=Mc,Mc=m)}function fu(m){const f=ai(m);return Jg(m),f}function _h(m){return m==null}let wc=null;function Yg(){return(wc===null||wc.byteLength===0)&&(wc=new Float64Array(zt.memory.buffer)),wc}let Sc=null;function sr(){return(Sc===null||Sc.byteLength===0)&&(Sc=new Int32Array(zt.memory.buffer)),Sc}let Da=0;const mu=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Qg=typeof mu.encodeInto=="function"?function(m,f){return mu.encodeInto(m,f)}:function(m,f){const _=mu.encode(m);return f.set(_),{read:m.length,written:_.length}};function uu(m,f,_){if(_===void 0){const s=mu.encode(m),H=f(s.length,1)>>>0;return Cc().subarray(H,H+s.length).set(s),Da=s.length,H}let v=m.length,E=f(v,1)>>>0;const k=Cc();let B=0;for(;B127)break;k[E+B]=s}if(B!==v){B!==0&&(m=m.slice(B)),E=_(E,v,v=B+m.length*3,1)>>>0;const s=Cc().subarray(E+B,E+v),H=Qg(m,s);B+=H.written}return Da=B,E}function Sh(m){const f=typeof m;if(f=="number"||f=="boolean"||m==null)return`${m}`;if(f=="string")return`"${m}"`;if(f=="symbol"){const E=m.description;return E==null?"Symbol":`Symbol(${E})`}if(f=="function"){const E=m.name;return typeof E=="string"&&E.length>0?`Function(${E})`:"Function"}if(Array.isArray(m)){const E=m.length;let k="[";E>0&&(k+=Sh(m[0]));for(let B=1;B1)v=_[1];else return toString.call(m);if(v=="Object")try{return"Object("+JSON.stringify(m)+")"}catch{return"Object"}return m instanceof Error?`${m.name}: ${m.message} ${m.stack}`:v}function $g(m,f){const _=f(m.length*1,1)>>>0;return Cc().set(m,_/1),Da=m.length,_}function gh(m,f){try{return m.apply(this,f)}catch(_){zt.__wbindgen_exn_store(Yr(_))}}class vu{static __wrap(f){f=f>>>0;const _=Object.create(vu.prototype);return _.__wbg_ptr=f,_}__destroy_into_raw(){const f=this.__wbg_ptr;return this.__wbg_ptr=0,f}free(){const f=this.__destroy_into_raw();zt.__wbg_jsroutesnapper_free(f)}constructor(f){try{const k=zt.__wbindgen_add_to_stack_pointer(-16),B=$g(f,zt.__wbindgen_malloc),s=Da;zt.jsroutesnapper_new(k,B,s);var _=sr()[k/4+0],v=sr()[k/4+1],E=sr()[k/4+2];if(E)throw fu(v);return vu.__wrap(_)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}setRouteConfig(f){zt.jsroutesnapper_setRouteConfig(this.__wbg_ptr,Yr(f))}setAreaMode(){zt.jsroutesnapper_setAreaMode(this.__wbg_ptr)}getConfig(){let f,_;try{const k=zt.__wbindgen_add_to_stack_pointer(-16);zt.jsroutesnapper_getConfig(k,this.__wbg_ptr);var v=sr()[k/4+0],E=sr()[k/4+1];return f=v,_=E,Hs(v,E)}finally{zt.__wbindgen_add_to_stack_pointer(16),zt.__wbindgen_free(f,_,1)}}toFinalFeature(){try{const v=zt.__wbindgen_add_to_stack_pointer(-16);zt.jsroutesnapper_toFinalFeature(v,this.__wbg_ptr);var f=sr()[v/4+0],_=sr()[v/4+1];let E;return f!==0&&(E=Hs(f,_).slice(),zt.__wbindgen_free(f,_*1)),E}finally{zt.__wbindgen_add_to_stack_pointer(16)}}renderGeojson(){let f,_;try{const k=zt.__wbindgen_add_to_stack_pointer(-16);zt.jsroutesnapper_renderGeojson(k,this.__wbg_ptr);var v=sr()[k/4+0],E=sr()[k/4+1];return f=v,_=E,Hs(v,E)}finally{zt.__wbindgen_add_to_stack_pointer(16),zt.__wbindgen_free(f,_,1)}}toggleSnapMode(){zt.jsroutesnapper_toggleSnapMode(this.__wbg_ptr)}onMouseMove(f,_,v){return zt.jsroutesnapper_onMouseMove(this.__wbg_ptr,f,_,v)!==0}onClick(){zt.jsroutesnapper_onClick(this.__wbg_ptr)}onDragStart(){return zt.jsroutesnapper_onDragStart(this.__wbg_ptr)!==0}onMouseUp(){return zt.jsroutesnapper_onMouseUp(this.__wbg_ptr)!==0}clearState(){zt.jsroutesnapper_clearState(this.__wbg_ptr)}editExisting(f){try{const E=zt.__wbindgen_add_to_stack_pointer(-16);zt.jsroutesnapper_editExisting(E,this.__wbg_ptr,Yr(f));var _=sr()[E/4+0],v=sr()[E/4+1];if(v)throw fu(_)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}debugRenderGraph(){let f,_;try{const k=zt.__wbindgen_add_to_stack_pointer(-16);zt.jsroutesnapper_debugRenderGraph(k,this.__wbg_ptr);var v=sr()[k/4+0],E=sr()[k/4+1];return f=v,_=E,Hs(v,E)}finally{zt.__wbindgen_add_to_stack_pointer(16),zt.__wbindgen_free(f,_,1)}}routeNameForWaypoints(f){let _,v;try{const _e=zt.__wbindgen_add_to_stack_pointer(-16);zt.jsroutesnapper_routeNameForWaypoints(_e,this.__wbg_ptr,Yr(f));var E=sr()[_e/4+0],k=sr()[_e/4+1],B=sr()[_e/4+2],s=sr()[_e/4+3],H=E,N=k;if(s)throw H=0,N=0,fu(B);return _=H,v=N,Hs(H,N)}finally{zt.__wbindgen_add_to_stack_pointer(16),zt.__wbindgen_free(_,v,1)}}addSnappedWaypoint(f,_){zt.jsroutesnapper_addSnappedWaypoint(this.__wbg_ptr,f,_)}undo(){zt.jsroutesnapper_undo(this.__wbg_ptr)}}async function ey(m,f){if(typeof Response=="function"&&m instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(m,f)}catch(v){if(m.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",v);else throw v}const _=await m.arrayBuffer();return await WebAssembly.instantiate(_,f)}else{const _=await WebAssembly.instantiate(m,f);return _ instanceof WebAssembly.Instance?{instance:_,module:m}:_}}function ty(){const m={};return m.wbg={},m.wbg.__wbindgen_string_new=function(f,_){const v=Hs(f,_);return Yr(v)},m.wbg.__wbindgen_object_drop_ref=function(f){fu(f)},m.wbg.__wbindgen_error_new=function(f,_){const v=new Error(Hs(f,_));return Yr(v)},m.wbg.__wbindgen_is_object=function(f){const _=ai(f);return typeof _=="object"&&_!==null},m.wbg.__wbindgen_is_undefined=function(f){return ai(f)===void 0},m.wbg.__wbindgen_in=function(f,_){return ai(f)in ai(_)},m.wbg.__wbindgen_boolean_get=function(f){const _=ai(f);return typeof _=="boolean"?_?1:0:2},m.wbg.__wbindgen_number_get=function(f,_){const v=ai(_),E=typeof v=="number"?v:void 0;Yg()[f/8+1]=_h(E)?0:E,sr()[f/4+0]=!_h(E)},m.wbg.__wbindgen_object_clone_ref=function(f){const _=ai(f);return Yr(_)},m.wbg.__wbindgen_jsval_loose_eq=function(f,_){return ai(f)==ai(_)},m.wbg.__wbindgen_string_get=function(f,_){const v=ai(_),E=typeof v=="string"?v:void 0;var k=_h(E)?0:uu(E,zt.__wbindgen_malloc,zt.__wbindgen_realloc),B=Da;sr()[f/4+1]=B,sr()[f/4+0]=k},m.wbg.__wbg_String_4370c5505c674d30=function(f,_){const v=String(ai(_)),E=uu(v,zt.__wbindgen_malloc,zt.__wbindgen_realloc),k=Da;sr()[f/4+1]=k,sr()[f/4+0]=E},m.wbg.__wbg_getwithrefkey_d1f0d12f1f1b63ea=function(f,_){const v=ai(f)[ai(_)];return Yr(v)},m.wbg.__wbg_new_abda76e883ba8a5f=function(){const f=new Error;return Yr(f)},m.wbg.__wbg_stack_658279fe44541cf6=function(f,_){const v=ai(_).stack,E=uu(v,zt.__wbindgen_malloc,zt.__wbindgen_realloc),k=Da;sr()[f/4+1]=k,sr()[f/4+0]=E},m.wbg.__wbg_error_f851667af71bcfc6=function(f,_){let v,E;try{v=f,E=_,console.error(Hs(f,_))}finally{zt.__wbindgen_free(v,E,1)}},m.wbg.__wbg_debug_9a6b3243fbbebb61=function(f){console.debug(ai(f))},m.wbg.__wbg_error_788ae33f81d3b84b=function(f){console.error(ai(f))},m.wbg.__wbg_info_2e30e8204b29d91d=function(f){console.info(ai(f))},m.wbg.__wbg_log_1d3ae0273d8f4f8a=function(f){console.log(ai(f))},m.wbg.__wbg_warn_d60e832f9882c1b2=function(f){console.warn(ai(f))},m.wbg.__wbg_get_44be0491f933a435=function(f,_){const v=ai(f)[_>>>0];return Yr(v)},m.wbg.__wbg_length_fff51ee6522a1a18=function(f){return ai(f).length},m.wbg.__wbindgen_is_function=function(f){return typeof ai(f)=="function"},m.wbg.__wbg_next_526fc47e980da008=function(f){const _=ai(f).next;return Yr(_)},m.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return gh(function(f){const _=ai(f).next();return Yr(_)},arguments)},m.wbg.__wbg_done_5c1f01fb660d73b5=function(f){return ai(f).done},m.wbg.__wbg_value_1695675138684bd5=function(f){const _=ai(f).value;return Yr(_)},m.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return Yr(Symbol.iterator)},m.wbg.__wbg_get_97b561fb56f034b5=function(){return gh(function(f,_){const v=Reflect.get(ai(f),ai(_));return Yr(v)},arguments)},m.wbg.__wbg_call_cb65541d95d71282=function(){return gh(function(f,_){const v=ai(f).call(ai(_));return Yr(v)},arguments)},m.wbg.__wbg_isArray_4c24b343cb13cfb1=function(f){return Array.isArray(ai(f))},m.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(f){let _;try{_=ai(f)instanceof ArrayBuffer}catch{_=!1}return _},m.wbg.__wbg_buffer_085ec1f694018c4f=function(f){const _=ai(f).buffer;return Yr(_)},m.wbg.__wbg_new_8125e318e6245eed=function(f){const _=new Uint8Array(ai(f));return Yr(_)},m.wbg.__wbg_set_5cf90238115182c3=function(f,_,v){ai(f).set(ai(_),v>>>0)},m.wbg.__wbg_length_72e2208bbc0efc61=function(f){return ai(f).length},m.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(f){let _;try{_=ai(f)instanceof Uint8Array}catch{_=!1}return _},m.wbg.__wbindgen_debug_string=function(f,_){const v=Sh(ai(_)),E=uu(v,zt.__wbindgen_malloc,zt.__wbindgen_realloc),k=Da;sr()[f/4+1]=k,sr()[f/4+0]=E},m.wbg.__wbindgen_throw=function(f,_){throw new Error(Hs(f,_))},m.wbg.__wbindgen_memory=function(){const f=zt.memory;return Yr(f)},m}function iy(m,f){return zt=m.exports,hf.__wbindgen_wasm_module=f,wc=null,Sc=null,bc=null,zt}async function hf(m){if(zt!==void 0)return zt;typeof m>"u"&&(m="/ltn/assets/route_snapper_bg.wasm");const f=ty();(typeof m=="string"||typeof Request=="function"&&m instanceof Request||typeof URL=="function"&&m instanceof URL)&&(m=fetch(m));const{instance:_,module:v}=await ey(await m,f);return iy(_,v)}const df=bo({type:"FeatureCollection",features:[]}),ry=bo(!0),ny=bo(0),oy=30;class sy{constructor(f,_){Nn(this,"map");Nn(this,"inner");Nn(this,"active");Nn(this,"eventListenersSuccess");Nn(this,"eventListenersUpdated");Nn(this,"eventListenersFailure");Nn(this,"onMouseMove",f=>{if(!this.active)return;const _=[f.point.x-oy,f.point.y],v=this.map.unproject(f.point).distanceTo(this.map.unproject(_));this.inner.onMouseMove(f.lngLat.lng,f.lngLat.lat,v)&&(this.redraw(),this.dataUpdated())});Nn(this,"onClick",()=>{this.active&&(this.inner.onClick(),this.redraw(),this.dataUpdated())});Nn(this,"onDoubleClick",f=>{this.active&&(f.preventDefault(),this.inner.onClick(),this.finish())});Nn(this,"onDragStart",()=>{this.active&&this.inner.onDragStart()&&this.map.dragPan.disable()});Nn(this,"onMouseUp",()=>{this.active&&this.inner.onMouseUp()&&this.map.dragPan.enable()});Nn(this,"onKeyDown",f=>{this.active&&f.key=="Escape"&&(f.stopPropagation(),this.cancel())});Nn(this,"onKeyPress",f=>{this.active&&f.target.tagName!="INPUT"&&(f.key=="Enter"?(f.stopPropagation(),this.finish()):f.key=="s"?(f.stopPropagation(),this.inner.toggleSnapMode(),this.redraw()):f.key=="z"&&f.ctrlKey&&this.undo())});this.map=f,console.time("Deserialize and setup JsRouteSnapper"),this.inner=new vu(_),console.timeEnd("Deserialize and setup JsRouteSnapper"),this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],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(f){this.active&&window.alert("Bug: editExistingRoute called when tool is already active"),f.properties.waypoints||(f.properties.waypoints=[{lon:f.geometry.coordinates[0][0],lat:f.geometry.coordinates[0][1],snapped:!0},{lon:f.geometry.coordinates[f.geometry.coordinates.length-1][0],lat:f.geometry.coordinates[f.geometry.coordinates.length-1][1],snapped:!0}]),this.startRoute(),this.inner.editExisting(f.properties.waypoints),this.redraw()}editExistingArea(f){this.active&&window.alert("Bug: editExistingArea called when tool is already active"),f.properties.waypoints||window.alert("Bug: editExistingArea called for a polygon not produced by the route-snapper"),this.startArea(),this.inner.editExisting(f.properties.waypoints),this.redraw()}addEventListenerSuccess(f){this.eventListenersSuccess.push(f)}addEventListenerUpdated(f){this.eventListenersUpdated.push(f)}addEventListenerFailure(f){this.eventListenersFailure.push(f)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}isActive(){return this.active}finish(){let f=this.inner.toFinalFeature();if(f)for(let _ of this.eventListenersSuccess)_(JSON.parse(f));else for(let _ of this.eventListenersFailure)_();this.stop()}cancel(){this.inner.clearState(),this.finish()}setRouteConfig(f){this.inner.setRouteConfig(f),this.redraw()}addSnappedWaypoint(f){this.inner.addSnappedWaypoint(f[0],f[1]),this.redraw()}undo(){this.inner.undo(),this.redraw()}redraw(){let f=JSON.parse(this.inner.renderGeojson());df.set(f),this.map.getCanvas().style.cursor=f.cursor,ry.set(f.snap_mode),ny.set(f.undo_length)}dataUpdated(){let f=this.inner.toFinalFeature();if(f)for(let _ of this.eventListenersUpdated)_(JSON.parse(f))}}function ay(m){let f,_,v,E,k,B;return f=new ef({props:{filter:cf,paint:{"circle-color":yu(["get","type"],{"snapped-waypoint":"red","free-waypoint":"blue"},"black"),"circle-opacity":["case",["has","hovered"],.5,1],"circle-radius":yu(["get","type"],{node:Rp/2},Rp)}}}),v=new Ah({props:{filter:lf,paint:{"line-color":["case",["get","snapped"],"red","blue"],"line-width":2.5}}}),k=new tf({props:{filter:af,paint:{"fill-color":"black","fill-opacity":.5}}}),{c(){Ri(f.$$.fragment),_=Tn(),Ri(v.$$.fragment),E=Tn(),Ri(k.$$.fragment)},m(s,H){Ai(f,s,H),hi(s,_,H),Ai(v,s,H),hi(s,E,H),Ai(k,s,H),B=!0},p:Mr,i(s){B||(ft(f.$$.fragment,s),ft(v.$$.fragment,s),ft(k.$$.fragment,s),B=!0)},o(s){St(f.$$.fragment,s),St(v.$$.fragment,s),St(k.$$.fragment,s),B=!1},d(s){s&&(li(_),li(E)),ki(f,s),ki(v,s),ki(k,s)}}}function ly(m){let f,_;return f=new Mh({props:{data:m[0],$$slots:{default:[ay]},$$scope:{ctx:m}}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,[E]){const k={};E&1&&(k.data=v[0]),E&2&&(k.$$scope={dirty:E,ctx:v}),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}const Rp=10;function cy(m,f,_){let v;return Qr(m,df,E=>_(0,v=E)),[v]}class uy extends Gr{constructor(f){super(),Zr(this,f,cy,ly,Sr,{})}}function hy(m){let f,_,v,E,k,B,s,H,N,_e,be,ye,Oe,Le,Be,Ne,et,at,nt,it,Vt,ei,Ht,Nt,Jt,At,Ae,Ge,Ui;return f=new jg({props:{msg:m[2]}}),At=new Hg({props:{map:m[0]}}),At.$on("gotXml",m[5]),At.$on("loading",m[9]),At.$on("error",m[10]),{c(){Ri(f.$$.fragment),_=Tn(),v=Wt("div"),E=Wt("div"),k=Wt("label"),B=nl(`Load an osm.xml or a .pbf file: `),s=Wt("input"),H=Tn(),N=Wt("div"),_e=Wt("label"),be=nl(`Or load an example: - `),ye=Wt("select"),Oe=Wt("option"),Oe.textContent="Custom file loaded",Le=Wt("option"),Le.textContent="Akihabara",Be=Wt("option"),Be.textContent="Hanegi Park",Ne=Wt("option"),Ne.textContent="Harujuku",et=Wt("option"),et.textContent="Taipei main station",at=Wt("option"),at.textContent="Ximending",nt=Wt("option"),nt.textContent="Hong Kong",it=Wt("option"),it.textContent="Kowloon",Vt=Wt("option"),Vt.textContent="Bristol",ei=Wt("option"),ei.textContent="Elephant & Castle",Ht=Wt("option"),Ht.textContent="Westminster",Nt=Wt("option"),Nt.textContent="Montlake",Jt=Tn(),Ri(At.$$.fragment),vs(s,"type","file"),Oe.__value="",Uo(Oe,Oe.__value),Le.__value="akihabara",Uo(Le,Le.__value),Be.__value="hanegi",Uo(Be,Be.__value),Ne.__value="harujuku",Uo(Ne,Ne.__value),et.__value="taipei_main_station",Uo(et,et.__value),at.__value="ximending",Uo(at,at.__value),nt.__value="hong_kong",Uo(nt,nt.__value),it.__value="kowloon",Uo(it,it.__value),Vt.__value="bristol",Uo(Vt,Vt.__value),ei.__value="elephant_castle",Uo(ei,ei.__value),Ht.__value="westminster",Uo(Ht,Ht.__value),Nt.__value="montlake",Uo(Nt,Nt.__value),m[1]===void 0&&_u(()=>m[8].call(ye)),Tc(v,"border","1px solid black"),Tc(v,"padding","8px")},m(Dt,qt){Ai(f,Dt,qt),hi(Dt,_,qt),hi(Dt,v,qt),_i(v,E),_i(E,k),_i(k,B),_i(k,s),m[7](s),_i(v,H),_i(v,N),_i(N,_e),_i(_e,be),_i(_e,ye),_i(ye,Oe),_i(ye,Le),_i(ye,Be),_i(ye,Ne),_i(ye,et),_i(ye,at),_i(ye,nt),_i(ye,it),_i(ye,Vt),_i(ye,ei),_i(ye,Ht),_i(ye,Nt),mp(ye,m[1],!0),_i(v,Jt),Ai(At,v,null),Ae=!0,Ge||(Ui=[Fa(s,"change",m[4]),Fa(ye,"change",m[8])],Ge=!0)},p(Dt,[qt]){const Lt={};qt&4&&(Lt.msg=Dt[2]),f.$set(Lt),qt&2&&mp(ye,Dt[1]);const di={};qt&1&&(di.map=Dt[0]),At.$set(di)},i(Dt){Ae||(ft(f.$$.fragment,Dt),ft(At.$$.fragment,Dt),Ae=!0)},o(Dt){St(f.$$.fragment,Dt),St(At.$$.fragment,Dt),Ae=!1},d(Dt){Dt&&(li(_),li(v)),ki(f,Dt),m[7](null),ki(At),Ge=!1,Ra(Ui)}}}function dy(m,f,_){let{model:v=void 0}=f,{map:E}=f,k="",B=null,s=!1;jp(async()=>{await Kp(),await hf();try{s=(await fetch("/kowloon.pbf",{method:"HEAD"})).ok,console.log("Using local cache, not od2net.org"),ye("bristol")}catch{}});let H;async function N(at){try{_e(await H.files[0].arrayBuffer()),_(1,k="")}catch(nt){window.alert(`Couldn't open this file: ${nt}`)}_(2,B=null)}function _e(at){_(2,B="Building map model from OSM input"),console.time("load"),_(6,v=new k_(new Uint8Array(at))),console.timeEnd("load")}function be(at){try{_e(new TextEncoder().encode(at.detail)),_(1,k="")}catch(nt){window.alert(`Couldn't import from Overpass: ${nt}`)}_(2,B=null)}async function ye(at){at!=""&&(s?await Oe(`/${at}.pbf`):await Oe(`https://assets.od2net.org/severance_pbfs/${at}.pbf`))}async function Oe(at){try{_(2,B=`Downloading ${at}`);let nt=await fetch(at);_e(await nt.arrayBuffer())}catch(nt){window.alert(`Couldn't open from URL ${at}: ${nt}`)}_(2,B=null)}function Le(at){$s[at?"unshift":"push"](()=>{H=at,_(3,H)})}function Be(){k=__(this),_(1,k)}const Ne=at=>_(2,B=at.detail),et=at=>window.alert(at.detail);return m.$$set=at=>{"model"in at&&_(6,v=at.model),"map"in at&&_(0,E=at.map)},m.$$.update=()=>{m.$$.dirty&2&&ye(k)},[E,k,B,H,N,be,v,Le,Be,Ne,et]}class py extends Gr{constructor(f){super(),Zr(this,f,dy,hy,Sr,{model:6,map:0})}}function fy(m){let f,_;return f=new zh({props:{properties:m[6].properties}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&64&&(k.properties=v[6].properties),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function my(m){let f,_;return f=new Ph({props:{openOn:"hover",$$slots:{default:[fy,({data:v})=>({6:v}),({data:v})=>v?64:0]},$$scope:{ctx:m}}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&192&&(k.$$scope={dirty:E,ctx:v}),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function _y(m){let f,_;return f=new zh({props:{properties:m[6].properties}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&64&&(k.properties=v[6].properties),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function gy(m){let f,_;return f=new Ph({props:{openOn:"hover",$$slots:{default:[_y,({data:v})=>({6:v}),({data:v})=>v?64:0]},$$scope:{ctx:m}}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&192&&(k.$$scope={dirty:E,ctx:v}),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function yy(m){let f,_,v,E,k,B;return f=new Ah({props:{filter:lf,paint:{"line-width":5,"line-color":yu(["get","kind"],{interior_road:["interpolate-hcl",["linear"],["get","shortcuts"],0,"#F19A93",m[1],"#A32015"],crosses:"blue"},"red")},hoverCursor:"pointer",$$slots:{default:[my]},$$scope:{ctx:m}}}),f.$on("click",m[4]),v=new ef({props:{filter:cf,paint:{"circle-radius":15,"circle-color":yu(["get","kind"],{border_intersection:"green"},"red")},$$slots:{default:[gy]},$$scope:{ctx:m}}}),k=new tf({props:{filter:af,manageHoverState:!0,paint:{"fill-color":["get","color"],"fill-opacity":q_(.6,1)}}}),{c(){Ri(f.$$.fragment),_=Tn(),Ri(v.$$.fragment),E=Tn(),Ri(k.$$.fragment)},m(s,H){Ai(f,s,H),hi(s,_,H),Ai(v,s,H),hi(s,E,H),Ai(k,s,H),B=!0},p(s,H){const N={};H&128&&(N.$$scope={dirty:H,ctx:s}),f.$set(N);const _e={};H&128&&(_e.$$scope={dirty:H,ctx:s}),v.$set(_e)},i(s){B||(ft(f.$$.fragment,s),ft(v.$$.fragment,s),ft(k.$$.fragment,s),B=!0)},o(s){St(f.$$.fragment,s),St(v.$$.fragment,s),St(k.$$.fragment,s),B=!1},d(s){s&&(li(_),li(E)),ki(f,s),ki(v,s),ki(k,s)}}}function vy(m){let f,_;return f=new Mh({props:{data:m[0],$$slots:{default:[yy]},$$scope:{ctx:m}}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,[E]){const k={};E&128&&(k.$$scope={dirty:E,ctx:v}),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function xy(m,f,_){let{model:v}=f,{boundary:E}=f,k=["#8dd3c7","#ffffb3","#bebada","#80b1d3","#fdb462","#b3de69","#fccde5","#bc80bd","#ccebc5","#ffed6f"],B=JSON.parse(v.analyzeNeighbourhood(E)),s=Math.max(...B.features.map(N=>N.properties.shortcuts??0));for(let N of B.features)N.properties.color=="disconnected"?N.properties.color="red":N.properties.color&&(N.properties.color=k[N.properties.color%k.length]);const H=N=>window.open(N.detail.features[0].properties.way,"_blank");return m.$$set=N=>{"model"in N&&_(2,v=N.model),"boundary"in N&&_(3,E=N.boundary)},[B,s,v,E,H]}class by extends Gr{constructor(f){super(),Zr(this,f,xy,vy,Sr,{model:2,boundary:3})}}function wy(m){let f,_;return f=new zh({props:{properties:m[2].properties}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&4&&(k.properties=v[2].properties),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function Sy(m){let f,_;return f=new Ph({props:{openOn:"hover",$$slots:{default:[wy,({data:v})=>({2:v}),({data:v})=>v?4:0]},$$scope:{ctx:m}}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&12&&(k.$$scope={dirty:E,ctx:v}),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function Ty(m){let f,_;return f=new Ah({props:{id:"network",paint:{"line-width":5,"line-color":"black"},hoverCursor:"pointer",$$slots:{default:[Sy]},$$scope:{ctx:m}}}),f.$on("click",m[1]),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&8&&(k.$$scope={dirty:E,ctx:v}),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function Iy(m){let f,_;return f=new Mh({props:{data:JSON.parse(m[0].render()),$$slots:{default:[Ty]},$$scope:{ctx:m}}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,[E]){const k={};E&1&&(k.data=JSON.parse(v[0].render())),E&8&&(k.$$scope={dirty:E,ctx:v}),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function Ey(m,f,_){let{model:v}=f;const E=k=>window.open(k.detail.features[0].properties.way,"_blank");return m.$$set=k=>{"model"in k&&_(0,v=k.model)},[v,E]}class Cy extends Gr{constructor(f){super(),Zr(this,f,Ey,Iy,Sr,{model:0})}}function Op(m){let f,_,v;function E(B){m[8](B)}let k={map:m[2]};return m[0]!==void 0&&(k.model=m[0]),f=new py({props:k}),$s.push(()=>zc(f,"model",E)),{c(){Ri(f.$$.fragment)},m(B,s){Ai(f,B,s),v=!0},p(B,s){const H={};s&4&&(H.map=B[2]),!_&&s&1&&(_=!0,H.model=B[0],Pc(()=>_=!1)),f.$set(H)},i(B){v||(ft(f.$$.fragment,B),v=!0)},o(B){St(f.$$.fragment,B),v=!1},d(B){ki(f,B)}}}function My(m){let f,_,v,E,k,B,s,H,N;return{c(){f=Wt("div"),_=Wt("button"),_.textContent="Reset",v=Tn(),E=Wt("div"),k=Wt("button"),k.textContent="Edit boundary",B=Tn(),s=Wt("p"),s.textContent="Analyze and edit now"},m(_e,be){hi(_e,f,be),_i(f,_),hi(_e,v,be),hi(_e,E,be),_i(E,k),hi(_e,B,be),hi(_e,s,be),H||(N=[Fa(_,"click",m[6]),Fa(k,"click",m[4])],H=!0)},p:Mr,d(_e){_e&&(li(f),li(v),li(E),li(B),li(s)),H=!1,Ra(N)}}}function Ay(m){let f;return{c(){f=Wt("p"),f.textContent="Draw the boundary..."},m(_,v){hi(_,f,v)},p:Mr,d(_){_&&li(f)}}}function ky(m){let f,_,v,E,k,B,s;return{c(){f=Wt("div"),_=Wt("button"),_.textContent="Set boundary",v=Tn(),E=Wt("div"),k=Wt("button"),k.textContent="Quickset boundary (dev)"},m(H,N){hi(H,f,N),_i(f,_),hi(H,v,N),hi(H,E,N),_i(E,k),B||(s=[Fa(_,"click",m[4]),Fa(k,"click",m[5])],B=!0)},p:Mr,d(H){H&&(li(f),li(v),li(E)),B=!1,Ra(s)}}}function Py(m){let f,_,v,E,k,B,s,H,N=m[2]&&Op(m);function _e(Oe,Le){if(Oe[1].mode=="network"&&Oe[0])return ky;if(Oe[1].mode=="set-boundary")return Ay;if(Oe[1].mode=="neighbourhood")return My}let be=_e(m),ye=be&&be(m);return{c(){f=Wt("div"),N&&N.c(),_=Tn(),v=Wt("div"),E=Wt("button"),E.textContent="Zoom to fit",k=Tn(),ye&&ye.c(),vs(f,"slot","left")},m(Oe,Le){hi(Oe,f,Le),N&&N.m(f,null),_i(f,_),_i(f,v),_i(v,E),_i(f,k),ye&&ye.m(f,null),B=!0,s||(H=Fa(E,"click",m[3]),s=!0)},p(Oe,Le){Oe[2]?N?(N.p(Oe,Le),Le&4&&ft(N,1)):(N=Op(Oe),N.c(),ft(N,1),N.m(f,_)):N&&(rs(),St(N,1,1,()=>{N=null}),ns()),be===(be=_e(Oe))&&ye?ye.p(Oe,Le):(ye&&ye.d(1),ye=be&&be(Oe),ye&&(ye.c(),ye.m(f,null)))},i(Oe){B||(ft(N),B=!0)},o(Oe){St(N),B=!1},d(Oe){Oe&&li(f),N&&N.d(),ye&&ye.d(),s=!1,H()}}}function Bp(m){let f,_,v,E;const k=[Dy,Ly,zy],B=[];function s(H,N){return H[1].mode=="network"?0:H[1].mode=="set-boundary"?1:H[1].mode=="neighbourhood"?2:-1}return~(f=s(m))&&(_=B[f]=k[f](m)),{c(){_&&_.c(),v=Oa()},m(H,N){~f&&B[f].m(H,N),hi(H,v,N),E=!0},p(H,N){let _e=f;f=s(H),f===_e?~f&&B[f].p(H,N):(_&&(rs(),St(B[_e],1,1,()=>{B[_e]=null}),ns()),~f?(_=B[f],_?_.p(H,N):(_=B[f]=k[f](H),_.c()),ft(_,1),_.m(v.parentNode,v)):_=null)},i(H){E||(ft(_),E=!0)},o(H){St(_),E=!1},d(H){H&&li(v),~f&&B[f].d(H)}}}function zy(m){let f,_;return f=new by({props:{model:m[0],boundary:m[1].boundary}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&1&&(k.model=v[0]),E&2&&(k.boundary=v[1].boundary),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function Ly(m){let f,_;return f=new uy({}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p:Mr,i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function Dy(m){let f,_;return f=new Cy({props:{model:m[0]}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&1&&(k.model=v[0]),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function Fy(m){let f,_,v=m[0]&&Bp(m);return{c(){v&&v.c(),f=Oa()},m(E,k){v&&v.m(E,k),hi(E,f,k),_=!0},p(E,k){E[0]?v?(v.p(E,k),k&1&&ft(v,1)):(v=Bp(E),v.c(),ft(v,1),v.m(f.parentNode,f)):v&&(rs(),St(v,1,1,()=>{v=null}),ns())},i(E){_||(ft(v),_=!0)},o(E){St(v),_=!1},d(E){E&&li(f),v&&v.d(E)}}}function Ry(m){let f,_,v,E;function k(s){m[7](s)}let B={style:"https://api.maptiler.com/maps/dataviz/style.json?key=MZEJTanw3WpxRvt7qDfo",standardControls:!0,hash:!0,$$slots:{default:[Fy]},$$scope:{ctx:m}};return m[2]!==void 0&&(B.map=m[2]),_=new bg({props:B}),$s.push(()=>zc(_,"map",k)),{c(){f=Wt("div"),Ri(_.$$.fragment),vs(f,"slot","main"),Tc(f,"position","relative"),Tc(f,"width","100%"),Tc(f,"height","100vh")},m(s,H){hi(s,f,H),Ai(_,f,null),E=!0},p(s,H){const N={};H&2051&&(N.$$scope={dirty:H,ctx:s}),!v&&H&4&&(v=!0,N.map=s[2],Pc(()=>v=!1)),_.$set(N)},i(s){E||(ft(_.$$.fragment,s),E=!0)},o(s){St(_.$$.fragment,s),E=!1},d(s){s&&li(f),ki(_)}}}function Oy(m){let f,_;return f=new Ng({props:{$$slots:{main:[Ry],left:[Py]},$$scope:{ctx:m}}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,[E]){const k={};E&2055&&(k.$$scope={dirty:E,ctx:v}),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function By(m,f,_){let v={mode:"network"},E,k,B;function s(){if(B&&E){let Le=bh(JSON.parse(E.render()));B.fitBounds(Le,{animate:!1})}}function H(Le){E&&(console.log("New map model loaded"),s(),_(1,v={mode:"network"}),k=new sy(B,E.toRouteSnapper()))}function N(){v.mode=="network"?k.startArea():v.mode=="neighbourhood"&&k.editExistingArea(v.boundary),_(1,v={mode:"set-boundary"}),k.addEventListenerSuccess(Le=>{_(1,v={mode:"neighbourhood",boundary:Le}),k.clearEventListeners()}),k.addEventListenerFailure(()=>{_(1,v={mode:"network"}),k.clearEventListeners()})}function _e(){_(1,v={mode:"neighbourhood",boundary:{geometry:{coordinates:[[[-2.582766,51.455751],[-2.582715,51.455655],[-2.582477,51.455207],[-2.582446,51.455157],[-2.582409,51.455129],[-2.582334,51.455111],[-2.58226,51.455115],[-2.582174,51.455113],[-2.582115,51.455126],[-2.581976,51.454882],[-2.581812,51.454602],[-2.582181,51.454505],[-2.582091,51.454224],[-2.582071,51.454159],[-2.582042,51.454073],[-2.581915,51.453674],[-2.581972,51.453287],[-2.581714,51.45322],[-2.58169,51.453214],[-2.581866,51.452966],[-2.581588,51.45288],[-2.581521,51.45281],[-2.581584,51.452731],[-2.581401,51.452671],[-2.581103,51.452566],[-2.579862,51.452092],[-2.579808,51.452069],[-2.579753,51.452045],[-2.579074,51.451752],[-2.578228,51.45135],[-2.578131,51.451293],[-2.578066,51.451251],[-2.577641,51.450924],[-2.577504,51.450818],[-2.577228,51.450628],[-2.576815,51.450348],[-2.576749,51.450294],[-2.576487,51.450084],[-2.57599,51.449653],[-2.575886,51.449685],[-2.575807,51.449709],[-2.575324,51.44978],[-2.574139,51.449954],[-2.573887,51.450007],[-2.573699,51.450097],[-2.573534,51.450262],[-2.573415,51.450398],[-2.573305,51.45055],[-2.573286,51.450604],[-2.573279,51.450637],[-2.573275,51.45066],[-2.57327,51.450705],[-2.573278,51.450761],[-2.573366,51.451076],[-2.573491,51.451385],[-2.573553,51.451514],[-2.573591,51.451605],[-2.573635,51.451726],[-2.573785,51.451943],[-2.573862,51.452052],[-2.574029,51.452215],[-2.574301,51.452438],[-2.573889,51.452598],[-2.572852,51.452994],[-2.57186,51.453341],[-2.571252,51.453557],[-2.571012,51.45364],[-2.570853,51.453697],[-2.5705,51.453823],[-2.570369,51.45387],[-2.570287,51.453901],[-2.570078,51.453977],[-2.569972,51.454016],[-2.569803,51.454082],[-2.569713,51.454115],[-2.569632,51.454144],[-2.569501,51.454184],[-2.569137,51.454304],[-2.568791,51.454436],[-2.568648,51.454505],[-2.568666,51.454525],[-2.568674,51.454548],[-2.56867,51.454571],[-2.568656,51.454593],[-2.568632,51.454611],[-2.568601,51.454623],[-2.568688,51.454756],[-2.568967,51.454972],[-2.569021,51.455014],[-2.568715,51.455271],[-2.568646,51.455327],[-2.568374,51.455559],[-2.568108,51.455772],[-2.567496,51.456239],[-2.567414,51.456319],[-2.567628,51.456492],[-2.567643,51.456517],[-2.567649,51.456526],[-2.567656,51.456544],[-2.567659,51.456553],[-2.567655,51.456589],[-2.56766,51.456617],[-2.567688,51.456643],[-2.567726,51.456662],[-2.567757,51.456684],[-2.567783,51.456719],[-2.567793,51.456739],[-2.567796,51.456747],[-2.56779,51.456775],[-2.567829,51.456783],[-2.567946,51.456871],[-2.568049,51.456948],[-2.568176,51.457057],[-2.568213,51.457083],[-2.568322,51.45716],[-2.568414,51.457216],[-2.56846,51.457251],[-2.568445,51.457292],[-2.567621,51.457946],[-2.567536,51.457943],[-2.567354,51.458066],[-2.567316,51.458148],[-2.567406,51.458165],[-2.567764,51.458232],[-2.568027,51.458276],[-2.568076,51.458283],[-2.568358,51.458287],[-2.568442,51.45829],[-2.568972,51.458337],[-2.56919,51.458356],[-2.569451,51.458365],[-2.569642,51.458363],[-2.569759,51.458354],[-2.570133,51.458292],[-2.570486,51.458208],[-2.570908,51.458114],[-2.571103,51.458103],[-2.57128,51.458116],[-2.571551,51.458175],[-2.571638,51.458205],[-2.571745,51.458247],[-2.571982,51.45828],[-2.572208,51.458286],[-2.573275,51.458227],[-2.573563,51.458208],[-2.573671,51.458195],[-2.573724,51.458183],[-2.573781,51.458175],[-2.573895,51.458156],[-2.573943,51.458146],[-2.576163,51.457686],[-2.576531,51.457615],[-2.576651,51.457592],[-2.576817,51.457539],[-2.57706,51.4574],[-2.577425,51.457222],[-2.577781,51.457082],[-2.578035,51.456998],[-2.578202,51.456951],[-2.578496,51.456874],[-2.578585,51.456849],[-2.578781,51.456795],[-2.579666,51.456548],[-2.579847,51.456493],[-2.579937,51.456464],[-2.580159,51.456403],[-2.580275,51.456396],[-2.580319,51.456385],[-2.580442,51.456351],[-2.580625,51.456286],[-2.580716,51.456255],[-2.580822,51.456205],[-2.580925,51.45617],[-2.581018,51.456139],[-2.581116,51.456108],[-2.581297,51.456054],[-2.581424,51.456018],[-2.581562,51.455983],[-2.581716,51.455949],[-2.581883,51.455913],[-2.582016,51.455898],[-2.582766,51.455751]]],type:"Polygon"},properties:{waypoints:[{lat:51.455751,lon:-2.582766,snapped:!0},{lat:51.449653,lon:-2.57599,snapped:!0},{lat:51.457083,lon:-2.568213,snapped:!0},{lat:51.455751,lon:-2.582766,snapped:!0}]},type:"Feature"}})}function be(){_(1,v={mode:"network"})}function ye(Le){B=Le,_(2,B)}function Oe(Le){E=Le,_(0,E)}return m.$$.update=()=>{m.$$.dirty&1&&H()},[E,v,B,s,N,_e,be,ye,Oe]}class Ny extends Gr{constructor(f){super(),Zr(this,f,By,Oy,Sr,{})}}new Ny({target:document.getElementById("app")}); + `),ye=Wt("select"),Oe=Wt("option"),Oe.textContent="Custom file loaded",Le=Wt("option"),Le.textContent="Akihabara",Be=Wt("option"),Be.textContent="Hanegi Park",Ne=Wt("option"),Ne.textContent="Harujuku",et=Wt("option"),et.textContent="Taipei main station",at=Wt("option"),at.textContent="Ximending",nt=Wt("option"),nt.textContent="Hong Kong",it=Wt("option"),it.textContent="Kowloon",Vt=Wt("option"),Vt.textContent="Bristol",ei=Wt("option"),ei.textContent="Elephant & Castle",Ht=Wt("option"),Ht.textContent="Westminster",Nt=Wt("option"),Nt.textContent="Montlake",Jt=Tn(),Ri(At.$$.fragment),vs(s,"type","file"),Oe.__value="",Uo(Oe,Oe.__value),Le.__value="akihabara",Uo(Le,Le.__value),Be.__value="hanegi",Uo(Be,Be.__value),Ne.__value="harujuku",Uo(Ne,Ne.__value),et.__value="taipei_main_station",Uo(et,et.__value),at.__value="ximending",Uo(at,at.__value),nt.__value="hong_kong",Uo(nt,nt.__value),it.__value="kowloon",Uo(it,it.__value),Vt.__value="bristol",Uo(Vt,Vt.__value),ei.__value="elephant_castle",Uo(ei,ei.__value),Ht.__value="westminster",Uo(Ht,Ht.__value),Nt.__value="montlake",Uo(Nt,Nt.__value),m[1]===void 0&&_u(()=>m[8].call(ye)),Tc(v,"border","1px solid black"),Tc(v,"padding","8px")},m(Dt,qt){Ai(f,Dt,qt),hi(Dt,_,qt),hi(Dt,v,qt),_i(v,E),_i(E,k),_i(k,B),_i(k,s),m[7](s),_i(v,H),_i(v,N),_i(N,_e),_i(_e,be),_i(_e,ye),_i(ye,Oe),_i(ye,Le),_i(ye,Be),_i(ye,Ne),_i(ye,et),_i(ye,at),_i(ye,nt),_i(ye,it),_i(ye,Vt),_i(ye,ei),_i(ye,Ht),_i(ye,Nt),mp(ye,m[1],!0),_i(v,Jt),Ai(At,v,null),Ae=!0,Ge||(Ui=[Fa(s,"change",m[4]),Fa(ye,"change",m[8])],Ge=!0)},p(Dt,[qt]){const Lt={};qt&4&&(Lt.msg=Dt[2]),f.$set(Lt),qt&2&&mp(ye,Dt[1]);const di={};qt&1&&(di.map=Dt[0]),At.$set(di)},i(Dt){Ae||(ft(f.$$.fragment,Dt),ft(At.$$.fragment,Dt),Ae=!0)},o(Dt){St(f.$$.fragment,Dt),St(At.$$.fragment,Dt),Ae=!1},d(Dt){Dt&&(li(_),li(v)),ki(f,Dt),m[7](null),ki(At),Ge=!1,Ra(Ui)}}}function dy(m,f,_){let{model:v=void 0}=f,{map:E}=f,k="",B=null,s=!1;jp(async()=>{await Kp(),await hf();try{s=(await fetch("/kowloon.pbf",{method:"HEAD"})).ok,console.log("Using local cache, not od2net.org"),ye("bristol")}catch{}});let H;async function N(at){try{_e(await H.files[0].arrayBuffer()),_(1,k="")}catch(nt){window.alert(`Couldn't open this file: ${nt}`)}_(2,B=null)}function _e(at){_(2,B="Building map model from OSM input"),console.time("load"),_(6,v=new k_(new Uint8Array(at))),console.timeEnd("load")}function be(at){try{_e(new TextEncoder().encode(at.detail)),_(1,k="")}catch(nt){window.alert(`Couldn't import from Overpass: ${nt}`)}_(2,B=null)}async function ye(at){at!=""&&(s?await Oe(`/${at}.pbf`):await Oe(`https://assets.od2net.org/severance_pbfs/${at}.pbf`))}async function Oe(at){try{_(2,B=`Downloading ${at}`);let nt=await fetch(at);_e(await nt.arrayBuffer())}catch(nt){window.alert(`Couldn't open from URL ${at}: ${nt}`)}_(2,B=null)}function Le(at){$s[at?"unshift":"push"](()=>{H=at,_(3,H)})}function Be(){k=__(this),_(1,k)}const Ne=at=>_(2,B=at.detail),et=at=>window.alert(at.detail);return m.$$set=at=>{"model"in at&&_(6,v=at.model),"map"in at&&_(0,E=at.map)},m.$$.update=()=>{m.$$.dirty&2&&ye(k)},[E,k,B,H,N,be,v,Le,Be,Ne,et]}class py extends Gr{constructor(f){super(),Zr(this,f,dy,hy,Sr,{model:6,map:0})}}function fy(m){let f,_;return f=new zh({props:{properties:m[6].properties}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&64&&(k.properties=v[6].properties),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function my(m){let f,_;return f=new Ph({props:{openOn:"hover",$$slots:{default:[fy,({data:v})=>({6:v}),({data:v})=>v?64:0]},$$scope:{ctx:m}}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&192&&(k.$$scope={dirty:E,ctx:v}),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function _y(m){let f,_;return f=new zh({props:{properties:m[6].properties}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&64&&(k.properties=v[6].properties),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function gy(m){let f,_;return f=new Ph({props:{openOn:"hover",$$slots:{default:[_y,({data:v})=>({6:v}),({data:v})=>v?64:0]},$$scope:{ctx:m}}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&192&&(k.$$scope={dirty:E,ctx:v}),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function yy(m){let f,_,v,E,k,B;return f=new Ah({props:{filter:lf,paint:{"line-width":5,"line-color":yu(["get","kind"],{interior_road:["interpolate-hcl",["linear"],["get","shortcuts"],0,"#F19A93",m[1],"#A32015"],crosses:"blue"},"red")},hoverCursor:"pointer",$$slots:{default:[my]},$$scope:{ctx:m}}}),f.$on("click",m[4]),v=new ef({props:{filter:cf,paint:{"circle-radius":15,"circle-color":yu(["get","kind"],{border_intersection:"green"},"red")},$$slots:{default:[gy]},$$scope:{ctx:m}}}),k=new tf({props:{filter:af,manageHoverState:!0,paint:{"fill-color":["get","color"],"fill-opacity":q_(.6,1)}}}),{c(){Ri(f.$$.fragment),_=Tn(),Ri(v.$$.fragment),E=Tn(),Ri(k.$$.fragment)},m(s,H){Ai(f,s,H),hi(s,_,H),Ai(v,s,H),hi(s,E,H),Ai(k,s,H),B=!0},p(s,H){const N={};H&128&&(N.$$scope={dirty:H,ctx:s}),f.$set(N);const _e={};H&128&&(_e.$$scope={dirty:H,ctx:s}),v.$set(_e)},i(s){B||(ft(f.$$.fragment,s),ft(v.$$.fragment,s),ft(k.$$.fragment,s),B=!0)},o(s){St(f.$$.fragment,s),St(v.$$.fragment,s),St(k.$$.fragment,s),B=!1},d(s){s&&(li(_),li(E)),ki(f,s),ki(v,s),ki(k,s)}}}function vy(m){let f,_;return f=new Mh({props:{data:m[0],generateId:!0,$$slots:{default:[yy]},$$scope:{ctx:m}}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,[E]){const k={};E&128&&(k.$$scope={dirty:E,ctx:v}),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function xy(m,f,_){let{model:v}=f,{boundary:E}=f,k=["#8dd3c7","#ffffb3","#bebada","#80b1d3","#fdb462","#b3de69","#fccde5","#bc80bd","#ccebc5","#ffed6f"],B=JSON.parse(v.analyzeNeighbourhood(E)),s=Math.max(...B.features.map(N=>N.properties.shortcuts??0));for(let N of B.features)N.properties.color=="disconnected"?N.properties.color="red":N.properties.color&&(N.properties.color=k[N.properties.color%k.length]);const H=N=>window.open(N.detail.features[0].properties.way,"_blank");return m.$$set=N=>{"model"in N&&_(2,v=N.model),"boundary"in N&&_(3,E=N.boundary)},[B,s,v,E,H]}class by extends Gr{constructor(f){super(),Zr(this,f,xy,vy,Sr,{model:2,boundary:3})}}function wy(m){let f,_;return f=new zh({props:{properties:m[2].properties}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&4&&(k.properties=v[2].properties),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function Sy(m){let f,_;return f=new Ph({props:{openOn:"hover",$$slots:{default:[wy,({data:v})=>({2:v}),({data:v})=>v?4:0]},$$scope:{ctx:m}}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&12&&(k.$$scope={dirty:E,ctx:v}),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function Ty(m){let f,_;return f=new Ah({props:{id:"network",paint:{"line-width":5,"line-color":"black"},hoverCursor:"pointer",$$slots:{default:[Sy]},$$scope:{ctx:m}}}),f.$on("click",m[1]),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&8&&(k.$$scope={dirty:E,ctx:v}),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function Iy(m){let f,_;return f=new Mh({props:{data:JSON.parse(m[0].render()),$$slots:{default:[Ty]},$$scope:{ctx:m}}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,[E]){const k={};E&1&&(k.data=JSON.parse(v[0].render())),E&8&&(k.$$scope={dirty:E,ctx:v}),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function Ey(m,f,_){let{model:v}=f;const E=k=>window.open(k.detail.features[0].properties.way,"_blank");return m.$$set=k=>{"model"in k&&_(0,v=k.model)},[v,E]}class Cy extends Gr{constructor(f){super(),Zr(this,f,Ey,Iy,Sr,{model:0})}}function Op(m){let f,_,v;function E(B){m[8](B)}let k={map:m[2]};return m[0]!==void 0&&(k.model=m[0]),f=new py({props:k}),$s.push(()=>zc(f,"model",E)),{c(){Ri(f.$$.fragment)},m(B,s){Ai(f,B,s),v=!0},p(B,s){const H={};s&4&&(H.map=B[2]),!_&&s&1&&(_=!0,H.model=B[0],Pc(()=>_=!1)),f.$set(H)},i(B){v||(ft(f.$$.fragment,B),v=!0)},o(B){St(f.$$.fragment,B),v=!1},d(B){ki(f,B)}}}function My(m){let f,_,v,E,k,B,s,H,N;return{c(){f=Wt("div"),_=Wt("button"),_.textContent="Reset",v=Tn(),E=Wt("div"),k=Wt("button"),k.textContent="Edit boundary",B=Tn(),s=Wt("p"),s.textContent="Analyze and edit now"},m(_e,be){hi(_e,f,be),_i(f,_),hi(_e,v,be),hi(_e,E,be),_i(E,k),hi(_e,B,be),hi(_e,s,be),H||(N=[Fa(_,"click",m[6]),Fa(k,"click",m[4])],H=!0)},p:Mr,d(_e){_e&&(li(f),li(v),li(E),li(B),li(s)),H=!1,Ra(N)}}}function Ay(m){let f;return{c(){f=Wt("p"),f.textContent="Draw the boundary..."},m(_,v){hi(_,f,v)},p:Mr,d(_){_&&li(f)}}}function ky(m){let f,_,v,E,k,B,s;return{c(){f=Wt("div"),_=Wt("button"),_.textContent="Set boundary",v=Tn(),E=Wt("div"),k=Wt("button"),k.textContent="Quickset boundary (dev)"},m(H,N){hi(H,f,N),_i(f,_),hi(H,v,N),hi(H,E,N),_i(E,k),B||(s=[Fa(_,"click",m[4]),Fa(k,"click",m[5])],B=!0)},p:Mr,d(H){H&&(li(f),li(v),li(E)),B=!1,Ra(s)}}}function Py(m){let f,_,v,E,k,B,s,H,N=m[2]&&Op(m);function _e(Oe,Le){if(Oe[1].mode=="network"&&Oe[0])return ky;if(Oe[1].mode=="set-boundary")return Ay;if(Oe[1].mode=="neighbourhood")return My}let be=_e(m),ye=be&&be(m);return{c(){f=Wt("div"),N&&N.c(),_=Tn(),v=Wt("div"),E=Wt("button"),E.textContent="Zoom to fit",k=Tn(),ye&&ye.c(),vs(f,"slot","left")},m(Oe,Le){hi(Oe,f,Le),N&&N.m(f,null),_i(f,_),_i(f,v),_i(v,E),_i(f,k),ye&&ye.m(f,null),B=!0,s||(H=Fa(E,"click",m[3]),s=!0)},p(Oe,Le){Oe[2]?N?(N.p(Oe,Le),Le&4&&ft(N,1)):(N=Op(Oe),N.c(),ft(N,1),N.m(f,_)):N&&(rs(),St(N,1,1,()=>{N=null}),ns()),be===(be=_e(Oe))&&ye?ye.p(Oe,Le):(ye&&ye.d(1),ye=be&&be(Oe),ye&&(ye.c(),ye.m(f,null)))},i(Oe){B||(ft(N),B=!0)},o(Oe){St(N),B=!1},d(Oe){Oe&&li(f),N&&N.d(),ye&&ye.d(),s=!1,H()}}}function Bp(m){let f,_,v,E;const k=[Dy,Ly,zy],B=[];function s(H,N){return H[1].mode=="network"?0:H[1].mode=="set-boundary"?1:H[1].mode=="neighbourhood"?2:-1}return~(f=s(m))&&(_=B[f]=k[f](m)),{c(){_&&_.c(),v=Oa()},m(H,N){~f&&B[f].m(H,N),hi(H,v,N),E=!0},p(H,N){let _e=f;f=s(H),f===_e?~f&&B[f].p(H,N):(_&&(rs(),St(B[_e],1,1,()=>{B[_e]=null}),ns()),~f?(_=B[f],_?_.p(H,N):(_=B[f]=k[f](H),_.c()),ft(_,1),_.m(v.parentNode,v)):_=null)},i(H){E||(ft(_),E=!0)},o(H){St(_),E=!1},d(H){H&&li(v),~f&&B[f].d(H)}}}function zy(m){let f,_;return f=new by({props:{model:m[0],boundary:m[1].boundary}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&1&&(k.model=v[0]),E&2&&(k.boundary=v[1].boundary),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function Ly(m){let f,_;return f=new uy({}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p:Mr,i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function Dy(m){let f,_;return f=new Cy({props:{model:m[0]}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,E){const k={};E&1&&(k.model=v[0]),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function Fy(m){let f,_,v=m[0]&&Bp(m);return{c(){v&&v.c(),f=Oa()},m(E,k){v&&v.m(E,k),hi(E,f,k),_=!0},p(E,k){E[0]?v?(v.p(E,k),k&1&&ft(v,1)):(v=Bp(E),v.c(),ft(v,1),v.m(f.parentNode,f)):v&&(rs(),St(v,1,1,()=>{v=null}),ns())},i(E){_||(ft(v),_=!0)},o(E){St(v),_=!1},d(E){E&&li(f),v&&v.d(E)}}}function Ry(m){let f,_,v,E;function k(s){m[7](s)}let B={style:"https://api.maptiler.com/maps/dataviz/style.json?key=MZEJTanw3WpxRvt7qDfo",standardControls:!0,hash:!0,$$slots:{default:[Fy]},$$scope:{ctx:m}};return m[2]!==void 0&&(B.map=m[2]),_=new bg({props:B}),$s.push(()=>zc(_,"map",k)),{c(){f=Wt("div"),Ri(_.$$.fragment),vs(f,"slot","main"),Tc(f,"position","relative"),Tc(f,"width","100%"),Tc(f,"height","100vh")},m(s,H){hi(s,f,H),Ai(_,f,null),E=!0},p(s,H){const N={};H&2051&&(N.$$scope={dirty:H,ctx:s}),!v&&H&4&&(v=!0,N.map=s[2],Pc(()=>v=!1)),_.$set(N)},i(s){E||(ft(_.$$.fragment,s),E=!0)},o(s){St(_.$$.fragment,s),E=!1},d(s){s&&li(f),ki(_)}}}function Oy(m){let f,_;return f=new Ng({props:{$$slots:{main:[Ry],left:[Py]},$$scope:{ctx:m}}}),{c(){Ri(f.$$.fragment)},m(v,E){Ai(f,v,E),_=!0},p(v,[E]){const k={};E&2055&&(k.$$scope={dirty:E,ctx:v}),f.$set(k)},i(v){_||(ft(f.$$.fragment,v),_=!0)},o(v){St(f.$$.fragment,v),_=!1},d(v){ki(f,v)}}}function By(m,f,_){let v={mode:"network"},E,k,B;function s(){if(B&&E){let Le=bh(JSON.parse(E.render()));B.fitBounds(Le,{animate:!1})}}function H(Le){E&&(console.log("New map model loaded"),s(),_(1,v={mode:"network"}),k=new sy(B,E.toRouteSnapper()))}function N(){v.mode=="network"?k.startArea():v.mode=="neighbourhood"&&k.editExistingArea(v.boundary),_(1,v={mode:"set-boundary"}),k.addEventListenerSuccess(Le=>{_(1,v={mode:"neighbourhood",boundary:Le}),k.clearEventListeners()}),k.addEventListenerFailure(()=>{_(1,v={mode:"network"}),k.clearEventListeners()})}function _e(){_(1,v={mode:"neighbourhood",boundary:{geometry:{coordinates:[[[-2.582766,51.455751],[-2.582715,51.455655],[-2.582477,51.455207],[-2.582446,51.455157],[-2.582409,51.455129],[-2.582334,51.455111],[-2.58226,51.455115],[-2.582174,51.455113],[-2.582115,51.455126],[-2.581976,51.454882],[-2.581812,51.454602],[-2.582181,51.454505],[-2.582091,51.454224],[-2.582071,51.454159],[-2.582042,51.454073],[-2.581915,51.453674],[-2.581972,51.453287],[-2.581714,51.45322],[-2.58169,51.453214],[-2.581866,51.452966],[-2.581588,51.45288],[-2.581521,51.45281],[-2.581584,51.452731],[-2.581401,51.452671],[-2.581103,51.452566],[-2.579862,51.452092],[-2.579808,51.452069],[-2.579753,51.452045],[-2.579074,51.451752],[-2.578228,51.45135],[-2.578131,51.451293],[-2.578066,51.451251],[-2.577641,51.450924],[-2.577504,51.450818],[-2.577228,51.450628],[-2.576815,51.450348],[-2.576749,51.450294],[-2.576487,51.450084],[-2.57599,51.449653],[-2.575886,51.449685],[-2.575807,51.449709],[-2.575324,51.44978],[-2.574139,51.449954],[-2.573887,51.450007],[-2.573699,51.450097],[-2.573534,51.450262],[-2.573415,51.450398],[-2.573305,51.45055],[-2.573286,51.450604],[-2.573279,51.450637],[-2.573275,51.45066],[-2.57327,51.450705],[-2.573278,51.450761],[-2.573366,51.451076],[-2.573491,51.451385],[-2.573553,51.451514],[-2.573591,51.451605],[-2.573635,51.451726],[-2.573785,51.451943],[-2.573862,51.452052],[-2.574029,51.452215],[-2.574301,51.452438],[-2.573889,51.452598],[-2.572852,51.452994],[-2.57186,51.453341],[-2.571252,51.453557],[-2.571012,51.45364],[-2.570853,51.453697],[-2.5705,51.453823],[-2.570369,51.45387],[-2.570287,51.453901],[-2.570078,51.453977],[-2.569972,51.454016],[-2.569803,51.454082],[-2.569713,51.454115],[-2.569632,51.454144],[-2.569501,51.454184],[-2.569137,51.454304],[-2.568791,51.454436],[-2.568648,51.454505],[-2.568666,51.454525],[-2.568674,51.454548],[-2.56867,51.454571],[-2.568656,51.454593],[-2.568632,51.454611],[-2.568601,51.454623],[-2.568688,51.454756],[-2.568967,51.454972],[-2.569021,51.455014],[-2.568715,51.455271],[-2.568646,51.455327],[-2.568374,51.455559],[-2.568108,51.455772],[-2.567496,51.456239],[-2.567414,51.456319],[-2.567628,51.456492],[-2.567643,51.456517],[-2.567649,51.456526],[-2.567656,51.456544],[-2.567659,51.456553],[-2.567655,51.456589],[-2.56766,51.456617],[-2.567688,51.456643],[-2.567726,51.456662],[-2.567757,51.456684],[-2.567783,51.456719],[-2.567793,51.456739],[-2.567796,51.456747],[-2.56779,51.456775],[-2.567829,51.456783],[-2.567946,51.456871],[-2.568049,51.456948],[-2.568176,51.457057],[-2.568213,51.457083],[-2.568322,51.45716],[-2.568414,51.457216],[-2.56846,51.457251],[-2.568445,51.457292],[-2.567621,51.457946],[-2.567536,51.457943],[-2.567354,51.458066],[-2.567316,51.458148],[-2.567406,51.458165],[-2.567764,51.458232],[-2.568027,51.458276],[-2.568076,51.458283],[-2.568358,51.458287],[-2.568442,51.45829],[-2.568972,51.458337],[-2.56919,51.458356],[-2.569451,51.458365],[-2.569642,51.458363],[-2.569759,51.458354],[-2.570133,51.458292],[-2.570486,51.458208],[-2.570908,51.458114],[-2.571103,51.458103],[-2.57128,51.458116],[-2.571551,51.458175],[-2.571638,51.458205],[-2.571745,51.458247],[-2.571982,51.45828],[-2.572208,51.458286],[-2.573275,51.458227],[-2.573563,51.458208],[-2.573671,51.458195],[-2.573724,51.458183],[-2.573781,51.458175],[-2.573895,51.458156],[-2.573943,51.458146],[-2.576163,51.457686],[-2.576531,51.457615],[-2.576651,51.457592],[-2.576817,51.457539],[-2.57706,51.4574],[-2.577425,51.457222],[-2.577781,51.457082],[-2.578035,51.456998],[-2.578202,51.456951],[-2.578496,51.456874],[-2.578585,51.456849],[-2.578781,51.456795],[-2.579666,51.456548],[-2.579847,51.456493],[-2.579937,51.456464],[-2.580159,51.456403],[-2.580275,51.456396],[-2.580319,51.456385],[-2.580442,51.456351],[-2.580625,51.456286],[-2.580716,51.456255],[-2.580822,51.456205],[-2.580925,51.45617],[-2.581018,51.456139],[-2.581116,51.456108],[-2.581297,51.456054],[-2.581424,51.456018],[-2.581562,51.455983],[-2.581716,51.455949],[-2.581883,51.455913],[-2.582016,51.455898],[-2.582766,51.455751]]],type:"Polygon"},properties:{waypoints:[{lat:51.455751,lon:-2.582766,snapped:!0},{lat:51.449653,lon:-2.57599,snapped:!0},{lat:51.457083,lon:-2.568213,snapped:!0},{lat:51.455751,lon:-2.582766,snapped:!0}]},type:"Feature"}})}function be(){_(1,v={mode:"network"})}function ye(Le){B=Le,_(2,B)}function Oe(Le){E=Le,_(0,E)}return m.$$.update=()=>{m.$$.dirty&1&&H()},[E,v,B,s,N,_e,be,ye,Oe]}class Ny extends Gr{constructor(f){super(),Zr(this,f,By,Oy,Sr,{})}}new Ny({target:document.getElementById("app")}); diff --git a/index.html b/index.html index 97a4b99..5898cde 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ LTN from scratch - +