1function _wrapRegExp(){function t(e,o,i){var a=RegExp(e,o);return n.set(a,i||n.get(e)),_setPrototypeOf(a,t.prototype)}function e(t,e){var o=n.get(e);return Object.keys(o).reduce(function(e,n){var i=o[n];if("number"==typeof i)e[n]=t[i];else{for(var a=0;void 0===t[i[a]]&&a+1<i.length;)a++;e[n]=t[i[a]]}return e},Object.create(null))}_wrapRegExp=function(e,o){return new t(e,void 0,o)};var o=RegExp.prototype,n=new WeakMap;return _inherits(t,RegExp),t.prototype.exec=function(t){var n=o.exec.call(this,t);if(n){n.groups=e(n,this);var i=n.indices;i&&(i.groups=e(i,this))}return n},t.prototype[Symbol.replace]=function(t,i){if("string"==typeof i){var a=n.get(this);return o[Symbol.replace].call(this,t,i.replace(/\$<([^>]+)>/g,function(t,e){var o=a[e];return"$"+(Array.isArray(o)?o.join("$"):o)}))}if("function"==typeof i){var s=this;return o[Symbol.replace].call(this,t,function(){var t=arguments;return"object"!=typeof t[t.length-1]&&(t=[].slice.call(t)).push(e(t,s)),i.apply(this,t)})}return o[Symbol.replace].call(this,t,i)},_wrapRegExp.apply(this,arguments)}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e)}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_setPrototypeOf(t,e)}OSM.initializations=[],$(function(){function t(t){for(const e of t)e.addTo(o);const e=t[0].getContainer();$(e).find(".control-button").first().addClass("control-button-first");const n=t[t.length-1].getContainer();$(n).find(".control-button").last().addClass("control-button-last")}function e(t,e){function o(t){return fetch(t,{mode:"no-cors",signal:AbortSignal.timeout(5e3)})}const n="http://127.0.0.1:8111",i=location.protocol+"//"+location.host,a=new URLSearchParams({left:t.getWest()-1e-4,top:t.getNorth()+1e-4,right:t.getEast()+1e-4,bottom:t.getSouth()-1e-4});return e&&"note"!==e.type&&a.set("select",e.type+e.id),o(n+"/load_and_zoom?"+a).then(()=>{if(e&&"note"===e.type){const t=new URLSearchParams({url:i+OSM.apiUrl(e)});o(n+"/import?"+t)}}).catch(()=>{OSM.showAlert(OSM.i18n.t("javascripts.remote_edit.failed.title"),OSM.i18n.t("javascripts.remote_edit.failed.body"))}),!1}const o=new L.OSM.Map("map",{zoomControl:!1,layerControl:!1,contextmenu:!0,worldCopyJump:!0});OSM.loadSidebarContent=function(t){return o.setSidebarOverlaid(!1),new Promise((e,o)=>{$("#sidebar_content_frame").one("turbo:frame-render",t=>{const n=t.originalEvent.detail.fetchResponse.response,i=n.headers.get("X-Page-Title");i&&(document.title=decodeURIComponent(i)),n.ok?e():o(new Error(`HTTP Error ${n.status} ${n.statusText}`))}).prop("src",t)})},$("#sidebar_content_frame").on("turbo:before-fetch-response",()=>$("#flash").empty()).on("turbo:before-frame-render",t=>{const e="link[type='application/atom+xml']";$("head").find(e).remove(),$("head").append($(t.originalEvent.detail.newFrame).find(e).detach())});const n=$("head").data("oauthToken");n&&(OSM.oauth={authorization:"Bearer "+n});const i=OSM.mapParams();o.attributionControl.setPrefix(""),o.updateLayers(i.layers),o.on("baselayerchange",function(t){o.getZoom()>t.layer.options.maxZoom&&o.setView(o.getCenter(),t.layer.options.maxZoom,{reset:!0})});const a=L.OSM.sidebar("#map-ui").addTo(o),s="rtl"===$("html").attr("dir")?"topleft":"topright";t([L.OSM.zoom({position:s}),L.OSM.locate({position:s})]),t([L.OSM.layers({position:s,sidebar:a,layers:o.baseLayers}),L.OSM.legend({position:s,sidebar:a}),L.OSM.share({position:s,sidebar:a,short:!0})]),t([L.OSM.note({position:s,sidebar:a})]),t([L.OSM.query({position:s,sidebar:a})]),L.control.scale().addTo(o),OSM.initializations.forEach(t=>t(o)),"api_offline"!==OSM.STATUS&&"database_offline"!==OSM.STATUS&&(OSM.initializeNotesLayer(o),i.layers.indexOf(o.noteLayer.options.code)>=0&&o.addLayer(o.noteLayer),OSM.initializeDataLayer(o),i.layers.indexOf(o.dataLayer.options.code)>=0&&o.addLayer(o.dataLayer),i.layers.indexOf(o.gpsLayer.options.code)>=0&&o.addLayer(o.gpsLayer)),$(".leaflet-control .control-button").tooltip({placement:"left",container:"body"});const r=new Date,l=r.getFullYear();r.setFullYear(l+10);const c=function(){updateLinks(o.getCenter().wrap(),o.getZoom(),o.getLayersCode(),o._object),OSM.cookies.set("_osm_location",OSM.locationCookie(o),{expires:r})};for(const t of["moveend","baselayerchange","overlayadd","overlayremove"])o.on(t,c);if("hide"!==OSM.cookies.get("_osm_welcome")&&$(".welcome").addClass("d-md-block"),$(".welcome .btn-close").on("click",function(){$(".welcome").removeClass("d-md-block"),OSM.cookies.set("_osm_welcome","hide",{expires:r})}),r.setFullYear(l+1),$("#banner .btn-close").on("click",function(t){const e=t.target.id;$("#banner").removeClass("d-md-block"),t.preventDefault(),e&&OSM.cookies.set(e,"hide",{expires:r})}),OSM.MATOMO){const t=function(t){if(t.layer.options){const e=OSM.MATOMO.goals[t.layer.options.layerId];e&&$("body").trigger("matomogoal",e)}};o.on("baselayerchange",t),o.on("overlayadd",t)}
1i.bounds?o.fitBounds(i.bounds):o.setView([i.lat,i.lon],i.zoom),i.marker&&i.mrad?L.circle([i.mlat,i.mlon],{radius:i.mrad}).addTo(o):i.marker&&L.marker([i.mlat,i.mlon],{icon:OSM.getMarker({color:"var(--marker-blue)"})}).addTo(o),$("a[data-editor=remote]").click(function(t){const n=OSM.mapParams(this.search);e(o.getBounds(),n.object),t.preventDefault()}),new URLSearchParams(location.search).get("edit_help")&&($("#editanchor").removeAttr("title").tooltip({placement:"bottom",title:OSM.i18n.t("javascripts.edit_help")}).tooltip("show"),$("body").one("click",function(){$("#editanchor").tooltip("hide")})),OSM.router=OSM.Router(o,{"/":"index","/search":"search","/directions":"directions","/export":"export","/note/new":"new_note","/history/friends":"history","/history/nearby":"history","/history":"history","/user/:display_name/history":"history","/note/:id":"note","/node/:id(/history)":{module:"index_element",part:t=>t.mappedElement("node")},"/node/:id/history/:version":{module:"index_element",part:t=>t.mappedElement("node")},"/way/:id(/history)":{module:"index_element",part:t=>t.mappedElement("way")},"/way/:id/history/:version":{module:"index_element",part:t=>t.element("way")},"/relation/:id(/history)":{module:"index_element",part:t=>t.mappedElement("relation")},"/relation/:id/history/:version":{module:"index_element",part:t=>t.element("relation")},"/changeset/:id":"changeset","/query":"query","/account/home":"home"}),"remote"===OSM.preferred_editor&&"/edit"===location.pathname&&(e(o.getBounds(),i.object),OSM.router.setCurrentPath("/")),OSM.router.load(),$(document).on("click","a",function(t){if(t.isDefaultPrevented()||t.isPropagationStopped()||$(t.target).data("turbo"))return;if(t.which>1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;if($(this).attr("href")?.startsWith("#"))return;const e=new URL($(this).attr("href"),location);location.protocol===e.protocol&&location.host===e.host&&OSM.router.route(e.pathname+e.search+e.hash)&&(t.preventDefault(),"/directions"!==e.pathname&&$(".navbar-toggler:not(.collapsed)").trigger("click"))}),$(document).on("click","#sidebar .sidebar-close-controls button",function(){$(".search_form input[name=query]").val(""),OSM.router.route("/"+OSM.formatHash(o))})}),function(){class t{constructor(t){function e(t,e){const o=.95;return new IntersectionObserver(([n])=>{const i=n.intersectionRatio<o;$(t).css("box-shadow",i?`rgba(0, 0, 0, 0.075) ${e} 2px`:"").css("z-index",i?"5":"")},{threshold:o})}const[o,n,i]=$(t).children(),[a]=$(n).children().first(),[s]=$(n).children().last();a&&(this.scrollStartObserver=e(o,"2px 0px"),this.scrollStartObserver.observe(a)),s&&(this.scrollEndObserver=e(i,"-2px 0px"),this.scrollEndObserver.observe(s))}disable(){this.scrollStartObserver?.disconnect(),this.scrollEndObserver?.disconnect()}}$(document).on("click","a.numbered_pagination_link",function(t){const e=$(this).attr("href"),o=$(e);o.trigger("numbered_pagination:center"),o.find("a.page-link").trigger("focus"),t.preventDefault()}),$(document).on("numbered_pagination:enable",".numbered_pagination",function(){$(this).data("shadow-effect",new t(this)),$(this).trigger("numbered_pagination:center")}),$(document).on("numbered_pagination:disable",".numbered_pagination",function(){$(this).data("shadow-effect")?.disable(),$(this).removeData("shadow-effect")}),$(document).on("numbered_pagination:center",".numbered_pagination",function(){const[t,e]=$(this).children();if(!e)return;const[o]=$(t).find(".page-item.active"),[n]=$(e).find(".page-item.active");e.scrollLeft=o?0:n?Math.round(n.offsetLeft-e.offsetWidth/2+n.offsetWidth/2):e.scrollWidth-e.offsetWidth})}(),L.OSM.sidebar=function(t){const e={},o=$(t);let n,i=$(),a=$();return e.addTo=function(t){return n=t,e},e.addPane=function(t){t.hide().appendTo(o)},e.togglePane=function(t,e){const s=window.getComputedStyle(document.documentElement).getPropertyValue("--bs-breakpoint-md"),r=window.matchMedia(`(max-width: ${s})`).matches,l=250;i.hide().trigger("hide"),a.parent().removeClass("active"),i===t?($(o).hide(),$("#content").addClass("overlay-right-sidebar"),i=a=$(),r?n.panBy([0,-$("#map").height()/2],{animate:!1}):"rtl"===$("html").attr("dir")&&n.panBy([-l,0],{animate:!1})):($(o).show(),$("#content").removeClass("overlay-right-sidebar"),i=t,a=e||$(),r?n.panBy([0,$("#map").height()],{animate:!1}):"rtl"===$("html").attr("dir")&&n.panBy([l,0],{animate:!1})),n.invalidateSize({pan:!1,animate:!1}),i.show().trigger("show"),a.parent().addClass("active")}
1,o.find(".sidebar-close-controls button").on("click",()=>{e.togglePane(i,a)}),e},L.OSM.sidebarPane=function(t,e,o,n){const i=L.control(t);return i.onAdd=function(i){function a(e){e.stopPropagation(),e.preventDefault(),r.hasClass("disabled")||t.sidebar.togglePane(c,r),$(".leaflet-control .control-button").tooltip("hide")}const s=$("<div>").attr("class","control-"+e),r=$("<a>").attr("class","control-button").attr("href","#").attr("title",OSM.i18n.t(o)).on("click",a),l={layers:"stack",legend:"info-lg",share:"share-fill"}[e]||e;$("<i>").addClass("fs-5 bi bi-"+l).appendTo(r),r.appendTo(s);const c=$("<div>").attr("class",`${e}-ui position-relative z-n1`);return $("<h2 class='p-3 pb-0 pe-5 text-break'>").text(OSM.i18n.t(n)).appendTo(c),t.sidebar.addPane(c),this.loadContent=()=>fetch("/panes/"+e).then(t=>t.text()).then(t=>{$(t).appendTo(c)}).then(this.onContentLoaded),this.onAddPane(i,r,c,a),s[0]},i}, 2/*! Version: 0.90.1 3Copyright (c) 2016 Dominik Moritz */ 4function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("leaflet")):"function"==typeof define&&define.amd?define(["exports","leaflet"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).L=t.L||{},t.L.Control=t.L.Control||{},t.L.Control.Locate={}),t.L)}(this,function(t,e){"use strict"; 5/*! 6 Copyright (c) 2016 Dominik Moritz 7 8 This file is part of the leaflet locate control. It is licensed under the MIT license. 9 You can find the project at: https://github.com/domoritz/leaflet-locatecontrol 10 */function o(t,e){e.split(" ").forEach(e=>{t.classList.add(e)})}function n(t,e){e.split(" ").forEach(e=>{t.classList.remove(e)})}function i(t,e,o){const n=document.createElement(t);return e&&(n.className=e),o?.append(n),n}function a(t){const e={};for(const o in t){const n=t[o];Array.isArray(n)?e[o]=[...n]:e[o]=n?.constructor===Object?{...n}:n}return e}function s(t){return new d(t)}const r=3.2808399,l=e.Marker.extend({initialize(t,o){e.Util.setOptions(this,o),this._latlng=t,this.createIcon()},createIcon(){const t=this.options,o=[["stroke",t.color],["stroke-width",t.weight],["fill",t.fillColor],["fill-opacity",t.fillOpacity],["opacity",t.opacity]].filter(([,t])=>void 0!==t).map(([t,e])=>`${t}="${e}"`).join(" "),n=this._getIconSVG(t,o);this._locationIcon=new e.DivIcon({className:n.className,html:n.svg,iconSize:[n.w,n.h]}),this.setIcon(this._locationIcon)},_getIconSVG(t,e){const o=t.radius,n=o+t.weight,i=2*n;return{className:"leaflet-control-locate-location",svg:`<svg xmlns="http://www.w3.org/2000/svg" width="${i}" height="${i}" version="1.1" viewBox="-${n} -${n} ${i} ${i}"><circle r="${o}" ${e} /></svg>`,w:i,h:i}},setStyle(t){e.Util.setOptions(this,t),this.createIcon()}}),c=l.extend({initialize(t,o,n){e.Util.setOptions(this,n),this._latlng=t,this._heading=o,this.createIcon()},setHeading(t){this._heading=t},_getIconSVG(t,e){const o=t.radius,n=o+t.weight+t.depth,i=2*n;return{className:"leaflet-control-locate-heading",svg:`<svg xmlns="http://www.w3.org/2000/svg" width="${i}" height="${i}" version="1.1" viewBox="-${n} -${n} ${i} ${i}"><path d="${this._arrowPoints(o,t.width,t.depth,this._heading)}" ${e} /></svg>`,w:i,h:i}},_arrowPoints(t,e,o,n){const i=(n-90)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),r=-Math.sin(i),l=Math.cos(i),c=e/2,d=t*a,h=t*s;return`M ${d+c*r},${h+c*l} L ${d-c*r},${h-c*l} L ${d+o*a},${h+o*s} Z`}}),d=e.Control.extend({options:{position:"topleft",layer:void 0,setView:"untilPanOrZoom",keepCurrentZoomLevel:!1,initialZoomLevel:!1,getLocationBounds:t=>t.bounds,flyTo:!1,clickBehavior:{inView:"stop",outOfView:"setView",inViewNotFollowing:"inView"},returnToPrevBounds:!1,cacheLocation:!0,drawCircle:!0,drawMarker:!0,showCompass:!0,compassAccuracyThreshold:45,markerClass:l,compassClass:c,circleStyle:{className:"leaflet-control-locate-circle",color:"#136AEC",fillColor:"#136AEC",fillOpacity:.15,weight:0},markerStyle:{className:"leaflet-control-locate-marker",color:"#fff",fillColor:"#2A93EE",fillOpacity:1,weight:3,opacity:1,radius:9},compassStyle:{fillColor:"#2A93EE",fillOpacity:1,weight:0,color:"#fff",opacity:1,radius:9,width:9,depth:6},followCircleStyle:{},followMarkerStyle:{},followCompassStyle:{},icon:"leaflet-control-locate-location-arrow",iconLoading:"leaflet-control-locate-spinner",iconElementTag:"span",textElementTag:"small",circlePadding:[0,0],metric:!0,createButtonCallback(t,e){const o=i("a","leaflet-bar-part leaflet-bar-part-single",t);o.title=e.strings.title,o.href="#",o.setAttribute("role","button"),o.setAttribute("aria-label",e.strings.title);const n=i(e.iconElementTag,e.icon,o);if(n.classList.add("leaflet-locate-icon"),void 0!==e.strings.text){i(e.textElementTag,"leaflet-locate-text",o).textContent=e.strings.text,o.classList.add("leaflet-locate-text-active"),o.parentNode.style.display="flex"}return{link:o,icon:n}},onLocationError(t){alert(t.message)},onLocationOutsideMapBounds(t){t.stop(),alert(t.options.strings.outsideMapBoundsMsg)},showPopup:!0,strings:{title:"Show me where I am",metersUnit:"meters",feetUnit:"feet",popup:"You are within {distance} {unit} from this point",outsideMapBoundsMsg:"You seem located outside the boundaries of the map"},locateOptions:{maxZoom:1/0,watch:!0,setView:!1}},initialize(t={}){this.options=a(this.options);for(const e in t){const o=t[e],n=this.options[e];o?.constructor===Object&&n?.constructor===Object?Object.assign(n,o):this.options[e]=o}this.options.followMarkerStyle={...this.options.markerStyle,...this.options.followMarkerStyle},this.options.followCircleStyle={...this.options.circleStyle,...this.options.followCircleStyle},this.options.followCompassStyle={...this.options.compassStyle,...this.options.followCompassStyle}},onAdd(t){const o=i("div","leaflet-control-locate leaflet-bar leaflet-control");this._container=o,this._map=t,this._layer=this.options.layer||new e.LayerGroup,this._layer.addTo(t),this._event=void 0,this._compassHeading=null,this._prevBounds=null;const n=this.options.createButtonCallback(o,this.options);return this._link=n.link,this._icon=n.icon,this._linkClickHandler=t=>{t.stopPropagation(),t.preventDefault(),this._onClick()},this._linkDblClickHandler=t=>t.stopPropagation(),this._link.addEventListener("click",this._linkClickHandler),this._link.addEventListener("dblclick",this._linkDblClickHandler),this._resetVariables(),this._map.on("unload",this._unload,this),o},onRemove(){this._link&&this._linkClickHandler&&this._link.removeEventListener("click",this._linkClickHandler),this._link&&this._linkDblClickHandler&&this._link.removeEventListener("dblclick",this._linkDblClickHandler),this._map&&this._map.off("unload",this._unload,this),this._linkClickHandler=null,this._linkDblClickHandler=null,this.stop()},_onClick(){this._justClicked=!0;const t=this._isFollowing();if(this._userPanned=!1,this._userZoomed=!1,this._active&&!this._event)this.stop();else if(this._active){const e=this.options.clickBehavior;let o=e.outOfView;switch(this._map.getBounds().contains(this._event.latlng)&&(o=t?e.inView:e.inViewNotFollowing),e[o]&&(o=e[o]),o){case"setView":this.setView();break;case"stop":if(this.stop(),this.options.returnToPrevBounds){(this.options.flyTo?this._map.flyToBounds:this._map.fitBounds).bind(this._map)(this._prevBounds)}}}else this.options.returnToPrevBounds&&(this._prevBounds=this._map.getBounds()),this.start();this._updateContainerStyle()},start(){this._activate(),this._event&&(this._drawMarker(this._map),this.options.setView&&this.setView()),this._updateContainerStyle()}
vendor: 6,805 bytes, line 10
10,stop(){this._deactivate(),this._cleanClasses(),this._resetVariables(),this._removeMarker()},stopFollowing(){this._userPanned=!0,this._updateContainerStyle(),this._drawMarker()},_activate(){!this._active&&this._map&&(this._map.locate(this.options.locateOptions),this._map.fire("locateactivate",this),this._active=!0,this._map.on("locationfound",this._onLocationFound,this),this._map.on("locationerror",this._onLocationError,this),this._map.on("dragstart",this._onDrag,this),this._map.on("zoomstart",this._onZoom,this),this._map.on("zoomend",this._onZoomEnd,this),this._activateCompass())},async _activateCompass(){if(!this.options.showCompass)return;const t="ondeviceorientationabsolute"in window;if(!t&&!("ondeviceorientation"in window))return;const o=t?"deviceorientationabsolute":"deviceorientation",n=window.DeviceOrientationEvent;if(void 0!==n&&"function"==typeof n.requestPermission)try{if("granted"!==await n.requestPermission())return}catch(t){return void console.warn("DeviceOrientation permission denied or unavailable:",t)}this._active&&(this._compassEventName=o,e.DomEvent.on(window,o,this._onDeviceOrientation,this))},_deactivate(){this._active&&this._map&&(this._map.stopLocate(),this._map.fire("locatedeactivate",this),this._active=!1,this.options.cacheLocation||(this._event=void 0),this._map.off("locationfound",this._onLocationFound,this),this._map.off("locationerror",this._onLocationError,this),this._map.off("dragstart",this._onDrag,this),this._map.off("zoomstart",this._onZoom,this),this._map.off("zoomend",this._onZoomEnd,this),this._deactivateCompass())},_deactivateCompass(){this._compassEventName&&(this._compassHeading=null,e.DomEvent.off(window,this._compassEventName,this._onDeviceOrientation,this),this._compassEventName=null)},_shouldKeepCurrentZoom(){const t=this.options.keepCurrentZoomLevel;if(Array.isArray(t)&&2===t.length){const e=this._map.getZoom(),[o,n]=t;return e>=o&&e<=n}return!0===t},setView(){if(this._drawMarker(),this._isOutsideMapBounds())return this._event=void 0,void this.options.onLocationOutsideMapBounds(this);const{latlng:t}=this._event,e=this.options.flyTo;let o,n;this._justClicked&&!1!==this.options.initialZoomLevel?(o=e?"flyTo":"setView",n=[t,this.options.initialZoomLevel]):this._shouldKeepCurrentZoom()?(o=e?"flyTo":"panTo",n=[t]):(o=e?"flyToBounds":"fitBounds",n=[this.options.getLocationBounds(this._event),{padding:this.options.circlePadding,maxZoom:this.options.locateOptions.maxZoom}]),this._setViewIgnoringEvents(o,n)},_setViewIgnoringEvents(t,e){this._ignoreEvent=!0,this._map[t](...e),requestAnimationFrame(()=>{this._ignoreEvent=!1})},_drawCompass(){if(!this._event)return;const t=this._event.latlng;if(this.options.showCompass&&t&&null!==this._compassHeading){const e=this._isFollowing()?this.options.followCompassStyle:this.options.compassStyle;this._compass?(this._compass.setLatLng(t),this._compass.setHeading(this._compassHeading),this._compass.setStyle&&this._compass.setStyle(e)):this._compass=new this.options.compassClass(t,this._compassHeading,e).addTo(this._layer)}!this._compass||this.options.showCompass&&null!==this._compassHeading||(this._compass.removeFrom(this._layer),this._compass=null)},_drawMarker(){if(!this._event)return;const t=this._event.latlng,o=this._event.accuracy??0,n=this._isFollowing();if(this.options.drawCircle){const i=n?this.options.followCircleStyle:this.options.circleStyle;if(this._circle)this._circle.setLatLng(t).setRadius(o).setStyle(i);else{const n={...i,radius:o};this._circle=new e.Circle(t,n).addTo(this._layer)}}if(this.options.drawMarker){const e=n?this.options.followMarkerStyle:this.options.markerStyle;this._marker?(this._marker.setLatLng(t),this._marker.setStyle&&this._marker.setStyle(e)):this._marker=new this.options.markerClass(t,e).addTo(this._layer)}this._drawCompass(),this._bindPopup(t,o)},_bindPopup(t,o){const n=this.options.strings.popup;if(!this.options.showPopup||!n)return;let i,a,s;this.options.metric?(i=o.toFixed(0),a=this.options.strings.metersUnit,s=null!=this._event?.altitude?this._event.altitude.toFixed(1):"N/A"):(i=(o*r).toFixed(0),a=this.options.strings.feetUnit,s=null!=this._event?.altitude?(this._event.altitude*r).toFixed(1):"N/A");const l=null!=this._event?.speed?this._event.speed.toFixed(2):"N/A",c=null!=this._event?.heading?this._event.heading.toFixed(0):"N/A",d={distance:i,unit:a,lat:t.lat.toFixed(6),lng:t.lng.toFixed(6),altitude:s,speed:l,heading:c};let h;h="string"==typeof n?e.Util.template(n,d):"function"==typeof n?n(d):n,this._marker&&this._marker.bindPopup(h)._popup.setLatLng(t),this._compass&&this._compass.bindPopup(h)._popup.setLatLng(t)},_removeMarker(){this._layer.clearLayers(),this._marker=void 0,this._circle=void 0,this._compass=void 0},_unload(){this.stop(),this._map&&this._map.off("unload",this._unload,this)},_setCompassHeading(t){Number.isFinite(t)?(this._compassHeading=Math.round(t),requestAnimationFrame(()=>this._drawCompass())):(this._compassHeading=null,this._drawCompass())},_onCompassNeedsCalibration(){this._setCompassHeading()},_onDeviceOrientation(t){if(this._active)if(null!=t.webkitCompassHeading){const e=this.options.compassAccuracyThreshold;if("number"==typeof e&&null!=t.webkitCompassAccuracy&&(t.webkitCompassAccuracy<0||t.webkitCompassAccuracy>e))return void this._setCompassHeading();const o=window.screen?.orientation?.angle??0;this._setCompassHeading((t.webkitCompassHeading+o)%360)}else null!==t.alpha&&this._setCompassHeading(360-t.alpha)},_onLocationError(t){if(3===t.code&&this.options.locateOptions.watch)return this._timeoutCount=(this._timeoutCount||0)+1,this._map.fire("locationtimeout",{error:t,control:this,count:this._timeoutCount}),void(this._timeoutCount>=3&&this._container&&o(this._container,"locate-timeout"));this._timeoutCount=0,this.stop(),this.options.onLocationError(t,this)},_onLocationFound(t){if((this._event?.latlng?.lat!==t.latlng.lat||this._event?.latlng?.lng!==t.latlng.lng||this._event?.accuracy!==t.accuracy)&&this._active){switch(this._timeoutCount=0,this._container&&n(this._container,"locate-timeout"),this._event=t,this._drawMarker(),this._updateContainerStyle(),this._map.fire("locatelocationfound",{...t,control:this}),this.options.setView){case"once":this._justClicked&&this.setView();break;case"untilPan":this._userPanned||this.setView();break;case"untilPanOrZoom":this._userPanned||this._userZoomed||this.setView();break;case"always":this.setView()}this._justClicked=!1}},_onDrag(){this._event&&!this._ignoreEvent&&(this._userPanned=!0,this._updateContainerStyle(),this._drawMarker())},_onZoom(){this._event&&!this._ignoreEvent&&(this._userZoomed=!0,this._updateContainerStyle(),this._drawMarker())},_onZoomEnd(){this._event&&this._drawCompass(),this._event&&!this._ignoreEvent&&this._marker&&!this._map.getBounds().pad(-.3).contains(this._marker.getLatLng())&&
10(this._userPanned=!0,this._updateContainerStyle(),this._drawMarker())},_isFollowing(){return!!this._active&&("always"===this.options.setView||("untilPan"===this.options.setView?!this._userPanned:"untilPanOrZoom"===this.options.setView&&(!this._userPanned&&!this._userZoomed)))},_isOutsideMapBounds(){return void 0!==this._event&&(this._map.options.maxBounds&&!this._map.options.maxBounds.contains(this._event.latlng))},_updateContainerStyle(){this._container&&(this._active&&!this._event?this._setClasses("requesting"):this._isFollowing()?this._setClasses("following"):this._active?this._setClasses("active"):this._cleanClasses())},_setClasses(t){switch(t){case"requesting":n(this._container,"active following"),o(this._container,"requesting"),n(this._icon,this.options.icon),o(this._icon,this.options.iconLoading);break;case"active":n(this._container,"requesting following"),o(this._container,"active"),n(this._icon,this.options.iconLoading),o(this._icon,this.options.icon);break;case"following":n(this._container,"requesting"),o(this._container,"active following"),n(this._icon,this.options.iconLoading),o(this._icon,this.options.icon)}},_cleanClasses(){n(this._container,"requesting active following"),n(this._icon,this.options.iconLoading),o(this._icon,this.options.icon)},_resetVariables(){this._active=!1,this._justClicked=!1,this._timeoutCount=0,this._container&&n(this._container,"locate-timeout"),this._userPanned=!1,this._userZoomed=!1}});t.CompassMarker=c,t.LocateControl=d,t.LocationMarker=l,t.locate=s,Object.defineProperty(t,"__esModule",{value:!0})}),"undefined"!=typeof window&&window.L&&(window.L.control=window.L.control||{},window.L.control.locate=window.L.Control.Locate.locate),L.OSM.locate=function(t){const e=L.control.locate({clickBehavior:{inView:"stop",outOfView:"stop",inViewNotFollowing:"stop"},strings:{title:OSM.i18n.t("javascripts.map.GeolocateControl.FindMyLocation"),popup:function(t){return OSM.i18n.t("javascripts.map.GeolocateControl."+t.unit+"Popup",{count:t.distance})}},...t});return e.onAdd=function(t){const e=Object.getPrototypeOf(this).onAdd.apply(this,[t]);return $(e).removeClass("leaflet-control-locate leaflet-bar").addClass("control-locate").children("a").attr("href","#").removeClass("leaflet-bar-part leaflet-bar-part-single").addClass("control-button").empty().append($("<i>").addClass("fs-5 bi bi-cursor-fill")),e},e},function(){function t(t,e){const o=e?/\{name:\S+\}/:/\{name\}/;return{contains:o.test(t),exactMatch:new RegExp("^".concat(o.source,"$")).test(t)}}function e(t,e){return Array.isArray(t)&&2===t.length&&"get"===t[0]&&"string"==typeof t[1]&&(!e||t[1].startsWith("name:"))&&(e||"name"===t[1])}function o(t,o,n){const i=structuredClone(t),a=t=>{if("string"!=typeof t)for(let i=0;i<t.length;i+=1)e(t[i],n)?t[i]=structuredClone(o):a(t[i])};return e(i,n)?o:(a(i),i)}function n(t){return Array.isArray(t)&&2===t.length&&"get"===t[0]&&"string"==typeof t[1]?"name"===t[1].trim()?{isLanguage:!0,localization:null}:t[1].trim().startsWith("name:")?{isLanguage:!0,localization:t[1].trim().split(":").pop()}:null:null}function i(t){const e=[],o=structuredClone(t),i=t=>{if("string"!=typeof t)for(let o=0;o<t.length;o+=1){const a=n(t[o]);a?e.push(a.localization):i(t[o])}};return i([o]),e}function a(t){const e=_wrapRegExp(/\{name(?::(\S+))?\}/g,{language:1}),o=[];for(;;){var n,i;const a=e.exec(t);if(!a)break;const s=null!==(n=null===(i=a.groups)||void 0===i?void 0:i.language)&&void 0!==n?n:null;o.push(s)}return o}function s(t,e){const o=[];for(const n of t){if("symbol"!==n.type)continue;const t=n,{id:s,layout:r}=t;if(!r)continue;if(!("text-field"in r))continue;const l=e.getLayoutProperty(s,"text-field");l&&("string"==typeof l?o.push(a(l)):o.push(i(l)))}const n=o.flat(),s={unlocalized:0,localized:{}};for(const t of n)null===t?s.unlocalized+=1:(t in s.localized||(s.localized[t]=0),s.localized[t]+=1);return s}function r(){if("undefined"==typeof navigator){const t=Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];return l.includes(t)?"name:"+t:"name:en"}const t=Array.from(new Set(navigator.languages.map(t=>t.split("-")[0]))).filter(t=>l.includes(t));return t[0]?"name:"+t[0]:"name"}const l=["latin","nonlatin","am","ar","az","be","bg","bn","br","bs","ca","co","cs","cy","da","de","el","en","eo","es","et","eu","fa","fi","fr","fy","ga","gd","he","hi","hr","hu","hy","id","is","it","ja","ja-Hira","ja-Latn","ja_kana","ja_rm","ka","kk","kn","ko","ko-Latn","ku","la","lb","lt","lv","mk","ml","mt","nl","no","oc","pa","pl","pnb","pt","rm","ro","ru","sk","sl","sq","sr","sr-Latn","sv","ta","te","th","tr","uk","vi","zh","zh-Hans","zh-Hant"];maplibregl.Map.prototype.supportedLanguages=l,maplibregl.Map.prototype.getStyleLanguage=function(){return this.style&&this.style.stylesheet&&this.style.stylesheet.metadata&&"object"==typeof this.style.stylesheet.metadata&&"maptiler:language"in this.style.stylesheet.metadata&&"string"==typeof this.style.stylesheet.metadata["maptiler:language"]?this.style.stylesheet.metadata["maptiler:language"]:null},maplibregl.Map.prototype.onStyleReady=function(t){this.isStyleLoaded()?t():this.once("styledata",()=>{t()})},maplibregl.Map.prototype.setLanguage=function(t){this.onStyleReady(()=>{this.setPrimaryLanguage(t)})},maplibregl.Map.prototype,maplibregl.Map.prototype.setPrimaryLanguage=function(e){var n;const i=["name","auto","style","visitor","visitor_en"].includes(e);if(!i&&!l.includes(e))return void console.warn('The language "'.concat(e,'" is not supported.'));const a=i?e:"name:"+e,c=this.getStyleLanguage();if("style"!==a||"auto"!==c&&"visitor"!==c){if("style"!==a&&(this.languageAlwaysBeenStyle=!1),this.languageAlwaysBeenStyle)return;if(this.primaryLanguage===a&&!this.forceLanguageUpdate)return}if("style_lock"===this.primaryLanguage)return void console.warn("The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.");this.primaryLanguage=a;let d=a;if("style"===a){if(!c)return void console.warn("The style has no default languages or has an invali
10d one.");d=c}let h="name",p=["get",h];"visitor"===d?(h=r(),p=["case",["all",["has",h],["has","name"]],["case",["==",["get",h],["get","name"]],["get","name"],["format",["get",h],{"font-scale":.8},"\n",["get","name"],{"font-scale":1.1}]],["get","name"]]):"visitor_en"===d?(h="name:en",p=["case",["all",["has",h],["has","name"]],["case",["==",["get",h],["get","name"]],["get","name"],["format",["get",h],{"font-scale":.8},"\n",["get","name"],{"font-scale":1.1}]],["get","name"]]):"auto"===d?(h=r(),p=["coalesce",["get",h],["get","name"]]):"name"===d?(h="name",p=["get",h]):(h=d,p=["coalesce",["get",h],["get","name"]]);const{layers:u}=this.getStyle();null!==(n=this.originalLabelStyle)&&void 0!==n||(this.originalLabelStyle=new Map);const m=0===this.originalLabelStyle.size;if(m){const t=s(u,this);this.isStyleLocalized=0<Object.keys(t.localized).length}for(const e of u){if("symbol"!==e.type)continue;const n=this.getSource(e.source);if(!n)continue;if(!("url"in n)||"string"!=typeof n.url)continue;if("api.maptiler.com"!==new URL(n.url).host)continue;const{id:i,layout:a}=e;if(!a||!("text-field"in a))continue;let s;if(m?(s=this.getLayoutProperty(i,"text-field"),this.originalLabelStyle.set(i,s)):s=this.originalLabelStyle.get(i),"string"==typeof s){const{contains:e,exactMatch:o}=t(s,this.isStyleLocalized);if(!e)continue;o?this.setLayoutProperty(i,"text-field",p):this.setLayoutProperty(i,"text-field",replaceLanguage(s,p,this.isStyleLocalized))}else this.setLayoutProperty(i,"text-field",o(s,p,this.isStyleLocalized))}}}(),OSM.MapLibre.CombinedControlGroup=class{constructor(t){this.controls=t,this.containers=[]}onAdd(t){this._container=document.createElement("div"),this._container.className="maplibregl-ctrl maplibregl-ctrl-group";for(const e of this.controls){const o=e.onAdd(t);this.containers.push(o);const n=o.querySelectorAll("button"),i={"zoom-in":"plus-lg","zoom-out":"dash-lg",geolocate:"cursor-fill"};n.forEach(t=>{const e=t.className.match(/maplibregl-ctrl-([\w-]+)/);if(e){const o=e[1],n=i[o];if(n){const e=document.createElement("i");e.className=`maplibregl-ctrl-icon fs-5 bi bi-${n}`,t.replaceChildren(e)}}this._container.appendChild(t)})}return this._container}onRemove(){for(const t of this.controls)t.onRemove?.();this._container&&this._container.remove()}},OSM.MapLibre.GeolocateControl=class extends maplibregl.GeolocateControl{constructor({positionOptions:t={},...e}={}){super({positionOptions:{enableHighAccuracy:!0,...t},trackUserLocation:!0,...e})}},OSM.MapLibre.NavigationControl=class extends maplibregl.NavigationControl{constructor(t={}){super({showCompass:!1,...t})}},OSM.MapLibre.Marker=class extends maplibregl.Marker{constructor({icon:t="dot",color:e="var(--marker-red)",autoPan:o=!1,...n}={}){const i=document.createElement("div");i.className="maplibre-gl-marker",i.style.width="25px",i.style.height="40px";const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 25 40"),a.setAttribute("width","25"),a.setAttribute("height","40"),a.classList.add("pe-none"),a.style.overflow="visible";const s=document.createElementNS("http://www.w3.org/2000/svg","use");s.setAttribute("href","#pin-shadow");const r=document.createElementNS("http://www.w3.org/2000/svg","use");r.setAttribute("href",`#pin-${t}`),r.setAttribute("color",e),r.classList.add("pe-auto"),a.appendChild(s),a.appendChild(r),i.appendChild(a),super({element:i,anchor:"bottom",offset:[0,0],...n}),o&&n.draggable&&this._enableAutoPan()}_enableAutoPan(){const t=50,e=10;let o=null;const n=()=>{o=requestAnimationFrame(n);const i=this._map;if(!i)return;const a=i.project(this.getLngLat()),{clientWidth:s,clientHeight:r}=i.getContainer();let l=0,c=0;if(a.x<t?l=a.x-t:a.x>s-t&&(l=a.x-(s-t)),a.y<t?c=a.y-t:a.y>r-t&&(c=a.y-(r-t)),!l&&!c)return;const d=t=>Math.max(-e,Math.min(e,t));i.panBy([d(l),d(c)],{duration:0}),this.setLngLat(i.unproject(a)),this.fire("drag")};this.on("dragstart",()=>{null===o&&(o=requestAnimationFrame(n))}),this.on("dragend",()=>{null!==o&&cancelAnimationFrame(o),o=null})}},OSM.MapLibre.Popup=class extends maplibregl.Popup{constructor(t){super({offset:{bottom:[
100,-45],"bottom-left":[0,-45],"bottom-right":[0,-45],top:[0,5],"top-left":[0,5],"top-right":[0,5],right:[-15,-10],left:[15,-10]},...t})}},maplibregl.Map.prototype._getUIString=function(t){return OSM.i18n.t(`javascripts.map.${t}`)},OSM.MapLibre.showWebGLError=function(t){const e="string"==typeof t?document.getElementById(t):t;e&&fetch("/panes/webgl_error").then(t=>t.text()).then(t=>e.innerHTML=t)},OSM.MapLibre.Map=class extends maplibregl.Map{constructor({allowRotation:t,...e}={}){const o={};let n;!1===t&&Object.assign(o,{rollEnabled:!1,dragRotate:!1,pitchWithRotate:!1,bearingSnap:180});try{n=super({validateStyle:!1,...o,...e})}catch(t){throw"webglcontextcreationerror"===JSON.parse(t.message).type&&OSM.MapLibre.showWebGLError(e.container),t}return!1===t&&(n.touchZoomRotate.disableRotation(),n.keyboard.disableRotation()),n}getZoom(){return super.getZoom()+1}setZoom(t,...e){return super.setZoom(t-1,...e)}zoomTo(t,...e){return super.zoomTo(t-1,...e)}},OSM.MapLibre.SecondaryMap=class extends OSM.MapLibre.Map{constructor(t={}){const e=11;super({container:"map",style:OSM.LAYER_DEFINITIONS[0].style,attributionControl:!1,allowRotation:!1,maxPitch:0,center:OSM.home?[OSM.home.lon,OSM.home.lat]:[0,0],zoom:OSM.home?e:0,zoomSnap:1,...t})}},OSM.MapLibre.setOMTMapLanguage=function(t){if(t.style.loaded())for(const e of OSM.preferred_languages){const o=e.toLowerCase().replace("-","_"),n=t.supportedLanguages.find(t=>t.toLowerCase()===o);if(n){t.setLanguage(n);break}}else t.once("load",()=>OSM.MapLibre.setOMTMapLanguage(t))},L.OSM.layers=function(t){const e=L.OSM.sidebarPane(t,"layers","javascripts.map.layers.title","javascripts.map.layers.header");return e.onAddPane=function(o,n,i,a){function s(){const[t,e,n]=this.children,s=l.find(e=>e.options.layerId===t.dataset.layer);e.checked=o.hasLayer(s),o.whenReady(function(){function e(){const e=o.getCenter();try{l=new OSM.MapLibre.Map({container:t,style:s.options.style,interactive:!1,attributionControl:!1,fadeDuration:0,zoomSnap:s.options.isVectorStyle?0:1,center:[e.lng,e.lat],zoom:r()})}catch(t){return}"openmaptiles_osm"===s.options.layerId&&OSM.MapLibre.setOMTMapLanguage(l),o.on("moveend",a)}function n(){l&&(o.off("moveend",a),l.remove())}function a(){const t=o.getCenter(),e=r();l.easeTo({center:[t.lng,t.lat],zoom:e})}function r(){return Math.max(Math.floor(o.getZoom()-3),-1)}let l;i.on("show",e).on("hide",n)}),$(e).on("click",function(){for(const t of l)t!==s&&o.removeLayer(t);o.addLayer(s)}),$(n).on("dblclick",a),o.on("baselayerchange",function(){e.checked=o.hasLayer(s)})}function r(){i.find(".overlay-layers div.form-check").each(function(){function t(){i.checked=o.hasLayer(n),i.disabled=o.getBounds().getSize()>=e.dataset.maxArea&&!i.checked,e.classList.toggle("disabled",i.disabled),$(e).tooltip(i.disabled?"enable":"disable")}const e=this,n=o[this.dataset.layerId],i=this.firstElementChild.firstElementChild;$(e).tooltip("disable"),$(i).on("change",function(){n.cancelLoading?.(),i.checked?o.addLayer(n):(o.removeLayer(n),$(`#layers-${name}-loading`).remove())}),o.on("zoomend overlayadd overlayremove",t),t()})}const l=t.layers;e.onContentLoaded=function(){i.find(".base-layers>div").each(s),r()},e.loadContent()},e},L.OSM.legend=function(t){const e=L.OSM.sidebarPane(t,"legend","javascripts.legend.title","javascripts.legend.title");return e.onAddPane=function(t,o,n){function i(){const e=!t.getMapBaseLayer().options.hasLegend;o.toggleClass("disabled",e).attr("data-bs-original-title",OSM.i18n.t(e?"javascripts.legend.tooltip_disabled":"javascripts.legend.tooltip"))}function a(){const e=t.getMapBaseLayerId(),o=t.getZoom();$("#legend [data-layer]").each(function(){const t=$(this).data();$(this).toggle(e===t.layer&&(!t.zoomMin||o>=t.zoomMin)&&(!t.zoomMax||o<=t.zoomMax))})}n.on("show",()=>{t.on("zoomend",a),a()}).on("hide",()=>{t.off("zoomend",a)}
10),t.on("baselayerchange",i),i(),e.onContentLoaded=a,n.one("show",e.loadContent)},e},L.OSM.note=function(t){const e=L.control(t);return e.onAdd=function(t){function e(){const e=n.hasClass("disabled"),o="database_offline"===OSM.STATUS||t.getZoom()<12;n.toggleClass("disabled",o).attr("data-bs-original-title",OSM.i18n.t(o?"javascripts.site.createnote_disabled_tooltip":"javascripts.site.createnote_tooltip")),o!==e&&n.trigger(o?"disabled":"enabled")}const o=$("<div>").attr("class","control-note"),n=$("<a>").attr("class","control-button").attr("href","#").attr("title",OSM.i18n.t("javascripts.site.createnote_tooltip")).append($("<i>").addClass("fs-5 bi bi-chat-square-text-fill")).appendTo(o);return t.on("zoomend",e),e(),o[0]},e},OSM.downloadBlob=function(t,e){const o=URL.createObjectURL(t),n=document.createElement("a");n.href=o,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(o)},OSM.getTurboBlobHandler=function(t){function e({fetchResponse:e}){e.response.blob().then(e=>OSM.downloadBlob(e,t)).catch(()=>i("(blob error)"))}function o({error:t,fetchResponse:e}){Promise.resolve(t?.message||e.responseText.then(n)).then(i).catch(()=>i("(unknown)"))}function n(t){const e=(new DOMParser).parseFromString(t,"text/html");return e.body?e.body.textContent.trim():"(unknown)"}function i(t){OSM.showAlert(OSM.i18n.t("javascripts.share.export_failed_title"),t)}return function({detail:t}){t.success?e(t):o(t)}},OSM.turboHtmlResponseHandler=function(t){const e=t.detail.fetchResponse.response,o=e.headers.get("content-type");!e.ok&&o?.includes("text/html")&&(t.preventDefault(),t.stopPropagation())},OSM.displayLoadError=function(t,e){$("#browse_status").html($("<div class='p-3'>").append($("<div class='d-flex'>").append($("<h2 class='flex-grow-1 text-break'>").text(OSM.i18n.t("browse.start_rjs.load_data")),$("<div>").append($("<button type='button' class='btn-close'>").attr("aria-label",OSM.i18n.t("javascripts.close")).on("click",e))),$("<p class='alert alert-warning'>").text(OSM.i18n.t("browse.start_rjs.feature_error",{message:t}))))},L.OSM.share=function(t){function e(t,e){function o(){$("#mapnik_scale").val(m()),p()}function a(){t.removeLayer(n),t.options.scrollWheelZoom=t.options.doubleClickZoom=!0,i.disable(),p()}function s(){$(this).is(":checked")?(n.setLatLng(t.getCenter()),t.addLayer(n),t.options.scrollWheelZoom=t.options.doubleClickZoom="center"):(t.removeLayer(n),t.options.scrollWheelZoom=t.options.doubleClickZoom=!0),p()}function r(){$(this).is(":checked")?(i.setBounds(t.getBounds().pad(-.2)),i.enable()):i.disable(),p()}function l(){n.setLatLng(t.getCenter()),p()}function c(){t.hasLayer(n)&&(t.off("move",l),t.on("moveend",d),t.panTo(n.getLatLng()))}function d(){t.off("moveend",d),t.on("move",l),p()}function h(t){const e={"&":"&","<":"<",">":">",'"':""","'":"'"};return null===t?"":String(t).replace(/[&<>"']/g,function(t){return e[t]})}function p(){const e=t.getMapBaseLayer(),o=Boolean(e&&e.options.canEmbed);$("#link_marker").prop("checked",t.hasLayer(n)),$("#image_filter").prop("checked",i.isEnabled()),Object.assign($("#long_link")[0],t.getUrl(n)),Object.assign($("#short_link")[0],t.getShortUrl(n)),Object.assign($("#embed_link")[0],t.getEmbedUrl(n)),$("#long_input").val($("#long_link").prop("href")),$("#short_input").val($("#short_link").prop("href")),!o&&$("#nav-embed").hasClass("active")&&bootstrap.Tab.getOrCreateInstance($("#long_link")).show(),$("#embed_link").toggleClass("disabled",!o).parent().tooltip(o?"disable":"enable"),$("#embed_html").val('<iframe width="425" height="350" src="'+h($("#embed_link").prop("href"))+'" style="border: 1px solid black"></iframe><br/><small><a href="'+h($("#long_link").prop("href"))+'">'+h(OSM.i18n.t("javascripts.share.view_larger_map"))+"</a></small>"),$("#geo_uri").attr("href",t.getGeoUri(n)).text(t.getGeoUri(n));const a=i.isEnabled()?i.getBounds():t.getBounds();let s=$("#mapnik_scale").val();
10const r=L.bounds(L.CRS.EPSG3857.project(a.getSouthWest()),L.CRS.EPSG3857.project(a.getNorthEast())).getSize(),l=Math.floor(Math.sqrt(r.x*r.y/.3136));$("#mapnik_minlon").val(a.getWest()),$("#mapnik_minlat").val(a.getSouth()),$("#mapnik_maxlon").val(a.getEast()),$("#mapnik_maxlat").val(a.getNorth()),s<l&&(s=g(l),$("#mapnik_scale").val(s));const c=Math.round(r.x/s/28e-5),d=Math.round(r.y/s/28e-5);$("#mapnik_image_width").text(c),$("#mapnik_image_height").text(d);const p=Boolean(e&&e.options.canDownloadImage);$("#mapnik_image_layer").text(p?e.options.name:""),$("#map_format").val(p?e.options.layerId:""),$("#map_zoom").val(t.getZoom()),$("#mapnik_lon").val(t.getCenter().lng),$("#mapnik_lat").val(t.getCenter().lat),$("#map_width").val(c),$("#map_height").val(d),$("#export-image").toggle(p),$("#export-warning").toggle(!p),$("#mapnik_scale_row").toggle(p&&"mapnik"===e.options.layerId)}function u(){$(this).trigger("select")}function m(){const e=t.getBounds(),o=e.getCenter().lat,n=6378137*Math.PI*Math.cos(o*Math.PI/180)*(e.getEast()-e.getWest())/180,i=t.getSize().x/n,a=1/3622.0492;return Math.round(1/(i*a))}function g(t){const e=5*Math.pow(10,Math.floor(Math.LOG10E*Math.log(t))-2);return e*Math.ceil(t/e)}e.find("#link_marker").on("change",s),e.find(".btn-group .btn").on("shown.bs.tab",()=>{e.find(".tab-pane.active [id]").trigger("select")}),e.find(".share-tab [id]").on("click",u),e.find("#mapnik_scale").on("change",p),e.find("#image_filter").bind("change",r);const f=e.find("#csrf_export")[0];[[f.name,f.value]]=Object.entries(OSM.csrf),document.getElementById("export-image").addEventListener("turbo:submit-end",OSM.getTurboBlobHandler(OSM.i18n.t("javascripts.share.filename"))),document.getElementById("export-image").addEventListener("turbo:before-fetch-response",OSM.turboHtmlResponseHandler),i.on("change",p).addTo(t),n.on("dragend",c),t.on("move",l),t.on("moveend baselayerchange overlayadd overlayremove",p),e.on("show",o).on("hide",a),p()}const o=L.OSM.sidebarPane(t,"share","javascripts.share.title","javascripts.share.title"),n=L.marker([0,0],{draggable:!0,icon:OSM.getMarker({ 11color:"var(--marker-blue)"})}),i=new L.LocationFilter({enableButton:!1,adjustButton:!1});return o.onAddPane=function(t,n,i){$("#content").addClass("overlay-right-sidebar"),o.onContentLoaded=()=>e(t,i),i.one("show",o.loadContent)},o},L.OSM.query=function(t){const e=L.control(t);return e.onAdd=function(t){function e(){const e=n.hasClass("disabled"),o=t.getZoom()<14;n.toggleClass("disabled",o).attr("data-bs-original-title",OSM.i18n.t(o?"javascripts.site.queryfeature_disabled_tooltip":"javascripts.site.queryfeature_tooltip")),o!==e&&n.trigger(o?"disabled":"enabled")}const o=$("<div>").attr("class","control-query"),n=$("<a>").attr("class","control-button").attr("href","#").attr("title",OSM.i18n.t("javascripts.site.queryfeature_tooltip")).append($("<i>").addClass("fs-5 bi bi-question-lg")).appendTo(o);return t.on("zoomend",e),e(),o[0]},e},OSM.initializations.push(function(t){const e=$("#map-context-menu");t.osm_contextmenu=new OSM.ContextMenu(t,e);const o=(t,e)=>{t.toggleClass("disabled",!e).attr("aria-disabled",e?null:"true")},n=()=>{const e=t.getZoom();o($("#menu-action-add-note"),e>=12),o($("#menu-action-query-features"),e>=14)},i=t=>{const e=t.attr("data-lat"),o=t.attr("data-lon");return e&&o?`${e},${o}`:t.val()},a=()=>L.latLng(e.data("lat"),e.data("lng")),s=()=>OSM.cropLocation(a(),t.getZoom()),r=(t,e={})=>{const{lat:o,lng:n}=s();OSM.router.route(`${t}?`+new URLSearchParams({lat:o,lon:n,...e}))},l=[{id:"menu-action-directions-from",icon:"bi-cursor",text:OSM.i18n.t("javascripts.context.directions_from"),callback:()=>{const{lat:t,lng:e}=s(),o=new URLSearchParams({from:`${t},${e}`,to:i($("#route_to"))});OSM.router.route(`/directions?${o}`)}},{id:"menu-action-directions-to",icon:"bi-flag",text:OSM.i18n.t("javascripts.context.directions_to"),callback:()=>{const{lat:t,lng:e}=s(),o=new URLSearchParams({from:i($("#route_from")),to:`${t},${e}`});OSM.router.route(`/directions?${o}`)}},{separator:!0},{id:"menu-action-add-note",icon:"bi-chat-square-text",text:OSM.i18n.t("javascripts.context.add_note"),callback:()=>r("/note/new")},{separator:!0},{id:"menu-action-show-address",icon:"bi-compass",text:OSM.i18n.t("javascripts.context.show_address"),callback:()=>r("/search",{zoom:t.getZoom()})},{id:"menu-action-query-features",icon:"bi-question-lg",text:OSM.i18n.t("javascripts.context.query_features"),callback:()=>r("/query")},{id:"menu-action-centre-map",icon:"bi-crosshair",text:OSM.i18n.t("javascripts.context.centre_map"),callback:()=>t.panTo(a())}];t.on("contextmenu",function(e){t.osm_contextmenu.show(e,l),n()}),t.on("show-contextmenu",function(e){t.osm_contextmenu.show(e.event,e.items)}),t.on("zoomend",n)}),OSM.ContextMenu=class{constructor(t,e){this._map=t,this._$element=e,this._popperInstance=null;const o=this.hide.bind(this);this._map.on("click",o),this._map.on("movestart",o),$(document).on("click",t=>{$(t.target).closest(this._$element).length||this.hide()})}show(t,e){t.originalEvent.preventDefault(),t.originalEvent.stopPropagation(),this._render(e),this._$element.removeClass("d-none"),this._updatePopper(t),this._$element.data("lat",t.latlng.lat),this._$element.data("lng",t.latlng.lng)}hide(){this._$element.addClass("d-none"),this._popperInstance&&(this._popperInstance.destroy(),this._popperInstance=null)}_updatePopper(t){const e=(t,e)=>({getBoundingClientRect:()=>({width:0,height:0,top:e,left:t,right:t,bottom:e})});this._popperInstance&&(this._popperInstance.destroy(),this._popperInstance=null);const o=e(t.originalEvent.clientX,t.originalEvent.clientY);this._popperInstance=Popper.createPopper(o,this._$element.find(".dropdown-menu")[0],{placement:"bottom-start",strategy:"absolute",modifiers:[{name:"offset",options:{offset:[0,0]}},{name:"preventOverflow",options:{boundary:document.getElementById("map")}},{name:"flip",options:{fallbackPlacements:["top-start","bottom-end","top-end"]}}]})}_render(t){const e=$("<ul>").addClass("dropdown-menu show shadow cm_dropdown_menu");t.forEach(t=>{const o=t.separator?this._createSeparator():this._createMenuItem(t);e.append(o)}),this._$element.empty().append(e)}_createMenuItem(t){const e=$("<i>").addClass(`bi ${t.icon}`).prop("ariaHidden",!0),o=$("<span>").text(t.text),n=$("<a>").addClass("dropdown-item d-flex align-items-center gap-3").attr({href:"#",id:t.id}).append(e,o).on("click",e=>{e.preventDefault(),t.callback?.(),this.hide()});return $("<li>").append(n)}_createSeparator(){return $("<li>").append($("<hr>").addClass("dropdown-divider"))}},OSM.initializations.push(function(t){$(".search_form a.btn.switch_link").on("click",function(e){e.preventDefault();const o=$(this).closest("form").find("input[name=query]").val();let n="";o&&(n="?"+new URLSearchParams({to:o})),OSM.router.route("/directions"+n+OSM.formatHash(t))}),$(".search_form").on("submit",function(e){e.preventDefault(),$(".navbar-toggler:not(.collapsed)").trigger("click");const o=t.getBounds(),n=new URLSearchParams({query:this.elements.query.value,zoom:t.getZoom(),minlon:o.getWest(),minlat:o.getSouth(),maxlon:o.getEast(),maxlat:o.getNorth()}),i=n.get("query")?`/search?${n}`:"/";OSM.router.route(i+OSM.formatHash(t))}),$(".describe_location").on("click",function(e){e.preventDefault(),$(".navbar-toggler:not(.collapsed)").trigger("click");const o=t.getZoom(),{lat:n,lng:i}=OSM.cropLocation(t.getCenter(),o);OSM.router.route("/search?"+new URLSearchParams({lat:n,lon:i,zoom:o}))})}),OSM.initializations.push(function(){$(".control-note .control-button").on("click",function(t){t.preventDefault(),t.stopPropagation(),$(this).hasClass("disabled")||OSM.router.route("/note/new")})}),OSM.initializations.push(function(t){function e(e){const{lat:o,lng:n}=OSM.cropLocation(e.latlng,t.getZoom());OSM.router.route("/query?"+new URLSearchParams({lat:o,lon:n}))}function o(){$(".control-query").addClass("active"),t.on("click",e),$(t.getContainer()).addClass("query-active")}function n(){$(t.getContainer()).removeClass("query-active").removeClass("query-disabled"),t.off("click",e),$(".control-query").removeClass("active")}const i=$(".control-query"),a=i.find(".control-button");a.on("click",function(t){t.preventDefault(),t.stopPropagation(),i.hasClass("active")?n():a.hasClass("disabled")||o()}).on("disabled",function(){i.hasClass("active")&&(t.off("click",e),$(t.getContainer()).removeClass("query-active").addClass("query-disabled"),$(this).tooltip("show"))}).on("enabled",function(){i.hasClass("active")&&(t.on("click",e),$(t.getContainer()).removeClass("query-disabled").addClass("query-active"),$(this).tooltip("hide"))})}),OSM.initializeDataLayer=function(t){function e(){const e=t.getBounds();s&&s.contains(e)||n()}function o(t,e,o){$("#browse_status").html($("<div class='p-3'>").append($("<div class='d-flex'>").append($("<h2 class='flex-grow-1 text-break'>").text(OSM.i18n.t("browse.start_rjs.load_data")),$("<div>").append($("<button type='button' class='btn-close'>").attr("aria-label",OSM.i18n.t("javascripts.close")).click(o))),$("<p class='alert alert-warning'>").text(OSM.i18n.t("browse.start_rjs.feature_warning",{num_features:t})),$("<input type='submit' class='btn btn-primary d-block mx-auto'>").val(OSM.i18n.t("browse.start_rjs.load_data")).click(e)))}
11function n(){function e(t){const e=t.getSouthWest().wrap(),o=t.getNorthEast().wrap();return{minLat:e.lat,minLng:e.lng,maxLat:o.lat,maxLng:o.lng}}function n(t){const o=e(t);return o.minLng>o.maxLng?[L.latLngBounds([o.minLat,o.minLng],[o.maxLat,180]),L.latLngBounds([o.minLat,-180],[o.maxLat,o.maxLng])]:[L.latLngBounds([o.minLat,o.minLng],[o.maxLat,o.maxLng])]}function l(t){return fetch(`/api/${OSM.API_VERSION}/map.json?bbox=${t.toBBoxString()}`,{headers:{...OSM.oauth},signal:a.signal})}const c=4e3,d=t.getBounds();a&&a.abort(),$("#layers-data-loading").remove();const h=$("<span>").attr("id","layers-data-loading").attr("class","spinner-border spinner-border-sm ms-1").attr("role","status").html("<span class='visually-hidden'>"+OSM.i18n.t("browse.start_rjs.loading")+"</span>").appendTo($("#label-layers-data"));a=new AbortController;const p=n(d),u=p.map(l);Promise.all(u).then(t=>Promise.all(t.map(async t=>{if(t.ok)return t.json();const e=`HTTP Error ${t.status} ${t.statusText}`;if(400!==t.status&&509!==t.status)throw new Error(e);const o=await t.text();throw new Error(o||e)}))).then(e=>{function n(){$("#browse_status").empty(),r.addData(u),s=d}function a(){$("#browse_status").empty()}r.clearLayers();const l=e.flatMap(t=>t.elements),h=r.buildFeatures({elements:l}),u=p.length>1?[...h,...i(h)]:h;u.length<c*p.length?n():o(u.length,n,a),t._objectLayer&&t._objectLayer.bringToFront()}).catch(function(t){"AbortError"!==t.name&&OSM.displayLoadError(t?.message,()=>{$("#browse_status").empty()})}).finally(()=>{a=null,h.remove()})}function i(e){const o=t.getCenter().lng<0?-360:360,n=({latLng:t,...e})=>({...e,latLng:{...t,lng:t.lng+o}});return e.flatMap(t=>{if("node"===t.type)return[n(t)];if("way"===t.type){const e=t.nodes.map(n);return[{...t,nodes:e}]}return[]})}let a,s;const r=t.dataLayer;r.isWayArea=function(){return!1},r.on("click",function(t){const e=t.layer.feature;OSM.router.click(t.originalEvent,`/${e.type}/${e.id}`)}),r.on("add",function(){t.fire("overlayadd",{layer:this}),t.on("moveend",e),e()}),r.on("remove",function(){a&&a.abort(),a=null,t.off("moveend",e),$("#browse_status").empty(),t.fire("overlayremove",{layer:this})})},OSM.initializeNotesLayer=function(t){function e(t,e){let o=t;if(o)o.setIcon(OSM.noteMarkers[e.properties.status]);else{let t;const n=e.properties.comments[0];"opened"===n?.action&&(t=n.text),o=L.marker(e.geometry.coordinates.reverse(),{icon:OSM.noteMarkers[e.properties.status],title:t,opacity:.8,interactive:!0}),o.id=e.properties.id,o.addTo(i)}return o}function o(){function o(t){const o=a;a={};for(const n of t.features){const t=o[n.properties.id];delete o[n.properties.id],a[n.properties.id]=e(t,n)}for(const t in o)i.removeLayer(o[t])}const s=t.getBounds();if(s.getSize()<=OSM.MAX_NOTE_REQUEST_AREA){const t="/api/"+OSM.API_VERSION+"/notes.json?bbox="+s.toBBoxString();n&&n.abort(),n=new AbortController,fetch(t,{signal:n.signal}).then(t=>t.json()).then(o).catch(()=>{}).finally(()=>n=null)}}let n;const i=t.noteLayer;let a={};i.on("add",()=>{o(),t.on("moveend",o),t.fire("overlayadd",{layer:i})}).on("remove",()=>{n&&n.abort(),n=null,t.off("moveend",o),i.clearLayers(),a={},t.fire("overlayremove",{layer:i})}).on("click",function(t){t.layer.id&&OSM.router.click(t.originalEvent,"/note/"+t.layer.id)}),i.getLayerId=function(t){return t.id}},OSM.Router=function(t,e){function o(e,o){let n=null;const i=new RegExp("^"+e.replace(a,"\\$&").replace(s,"(?:$1)?").replace(r,function(t,e){return e?t:"([^/]+)"}).replace(l,"(.*?)")+"(?:\\?.*)?$"),c={match:function(t){return i.test(t)},run:async function(e,a,...s){let r=[];if(a&&(r=i.exec(a).map(function(t,e){return e>0&&t?decodeURIComponent(t):t})),!n){const e="string"==typeof o?"index_"+o:o.module,i=o.part||(t=>t.default);n=await import(OSM.MODULE_PATHS[e]).then(i).then(e=>e(t))}return n[e]?.(...r,...s)}};return c}function n(){$("header ul.nav > li > a").each(function(){const t=new URL($(this).attr("href"),location.href).pathname===location.pathname;$(this).toggleClass("active",t).toggleClass("text-secondary",!t).toggleClass("text-secondary-emphasis",t)})}function i(t,e=()=>{}){const o=c.recognize(t);return!!o&&(u=u.catch(()=>{}).then(async()=>{await h.run("unload",null,o===h),e(),d=t,h=o,await h.run("load",d),n()}),u)}const a=/[-{}[\]+?.,\\^$|#\s]/g,s=/\((.*?)\)/g,r=/(\(\?)?:\w+/g,l=/\*\w+/g,c=Object.entries(e).map(([t,e])=>new o(t,e));c.recognize=t=>c.find(e=>e.match(t));let d=location.pathname.replace(/(.)\/$/,"$1")+location.search,h=c.recognize(d),p=location.hash||OSM.formatHash(t),u=Promise.resolve();const m={};addEventListener("popstate",function({state:e}){if(!e)return;const o=location.pathname+location.search;if(o===d)return;const n=i(o);n&&n.then(()=>t.setState(e,{animate:!1}))}),m.route=function(e){const o=e.replace(/#.*/,""),n=OSM.parseHash(e);return Boolean(i(o,()=>{t.setState(n),window.history.pushState(n,document.title,e)}))},m.replace=function(t){window.history.replaceState(OSM.parseHash(t),document.title,t)},m.stateChange=function(t){const e=t.center?OSM.formatHash(t):location;window.history.replaceState(t,document.title,e)},m.updateHash=function(){const e=OSM.formatHash(t);e!==p&&(p=e,m.stateChange(OSM.parseHash(e)))},m.hashUpdated=function(){const e=location.hash;if(e===p)return;p=e;const o=OSM.parseHash(e);t.setState(o),m.stateChange(o,e)},m.withoutMoveListener=function(e){function o(){t.off("moveend",m.updateHash),t.once("moveend",function(){t.on("moveend",m.updateHash)})}t.once("movestart",o),e(),t.off("movestart",o)},m.load=async function(){const t=await h.run("init",d);m.stateChange(t||{})},m.setCurrentPath=function(t){d=t,h=c.recognize(d)},m.click=function(t,e){const o={};for(const e in t)o[e]=t[e];const n=new t.constructor("click",o),i=document.createElement("a");i.href=e,i.hash=location.hash,document.body.appendChild(i),i.dispatchEvent(n),document.body.removeChild(i)};for(const e of["moveend","baselayerchange","overlayadd","overlayremove"])t.on(e,m.updateHash);return $(window).on("hashchange",m.hashUpdated),m};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.