diff --git a/assets/en-GB-CadBtWGj.js b/assets/en-GB-CadBtWGj.js deleted file mode 100644 index 408790d1..00000000 --- a/assets/en-GB-CadBtWGj.js +++ /dev/null @@ -1,2 +0,0 @@ -const e={"nav.run":"Run","nav.run_tt":"execute this query on Overpass API","nav.rerender_tt":"parse the MapCSS and rerender the map","nav.share":"Share","nav.share_tt":"get a permalink for this query","nav.export":"Export","nav.export_tt":"various export tools","nav.save":"Save","nav.save_tt":"save this query","nav.load":"Load","nav.load_tt":"load saved query or example","nav.wizard":"Wizard","nav.wizard_tt":"a query builder","nav.settings":"Settings","nav.settings_tt":"various settings","nav.help":"Help","nav.help_tt":"help, about, and attributions","nav.logout":"Logout","nav.logout_tt":"log out from currently synced osm account","tabs.map":"Map","tabs.map_tt":"map view","tabs.data":"Data","tabs.data_tt":"data view","map_controlls.zoom_to_data":"zoom to data","map_controlls.localize_user":"locate me!","map_controlls.localize_user_disabled":"disabled because overpass turbo has not been loaded via https://","map_controlls.select_bbox":"manually select bbox","map_controlls.select_bbox_disabled":"disabled as the current query doesn't require a bbox","map_controlls.toggle_wide_map":"toggle wide map","map_controlls.toggle_data":"toggle data overlay","map_controlls.suggest_zoom_to_data":"click here to show the data","settings.title":"Settings","settings.section.general":"General Settings","settings.ui_lang":"UI Language","settings.server":"Server","settings.disable_autorepair":"Disable warning/auto repair message when Overpass API returns no visible data.","settings.section.editor":"Editor","settings.enable_rich_editor":"Enable rich code editor","settings.enable_rich_editor_expl":"disable this on mobile devices; requires a page reload to take effect","settings.editor_width":"Width of editor","settings.editor_width_expl":"eg '400px', leave blank for defaults","settings.section.map":"Map","settings.tile_server":"Tile-Server","settings.tile_opacity":"Tiles Opacity","settings.tile_opacity_expl":"transparency of background tiles: 0=transparent … 1=visible","settings.show_crosshairs":"Show crosshairs at the map centre.","settings.disable_poiomatic":"Don't display small features as POIs.","settings.show_data_stats":"Show some stats about loaded and displayed data.","settings.section.sharing":"Sharing","settings.include_map_state":"Include current map state in shared links","settings.compression":"Compression","settings.section.export":"Export","settings.export_image_scale":"Show scale on exported images.","settings.export_image_attr":"Show attribution on exported images.","save.title":"Save","save.enter_name":"Enter a name for this query","load.title":"Load","load.delete_query":"delete this query","load.saved_queries-local":"Saved Queries (local)","load.saved_queries-osm":"Saved Queries (osm.org)","load.saved_queries-osm-loading":"Loading saved queries from osm.org...","load.saved_queries-osm-error":"An error occurred while loading saved queries from osm.org :(","load.examples":"Examples","load.no_saved_query":"no saved query yet","export.title":"Export","export.download-error":"Export – Error","export.copy_to_clipboard":"Copy this text to clipboard","export.copy_to_clipboard_success":"Export – Successfully copied to clipboard","export.copy_to_clipboard_success-message":' was successfully copied to the clipboard.',"export.section.map":"Map","export.as_png":'as png image',"export.as_interactive_map":'as interactive Map',"export.current_map_view":'current map view',"export.map_view_expl":"bbox, center etc","export.section.data":"Data","export.generic_download_copy":'
{if(x)return w(x);const D=S.querySelector("preferences"),H=D.querySelectorAll(`preference[k^="${configs.settingNamespace}_query"]`);for(const G of H)G.remove();let M=!0;Q.forEach((G,Y)=>{G.name==g.name&&(G.query=g.query,M=Y)}),M===!0?Q.push(g):g.deleteMe&&Q.splice(M,1);const R=S.createElement("preference");R.setAttribute("k",`${configs.settingNamespace}_query-count`),R.setAttribute("v",Q.length),D.appendChild(R);for(let G=0;G200)return w(new Error("query name too long to be saved on osm.org"));const J=Math.ceil((Y.query.length+Y.name.length+8)/255);if(J>9)return w(new Error("query too long to be saved on osm.org"));let X=`p=${J}`;X+=`&n=${Y.name}`,X+=`&q=${Y.query}`,X=X.match(/.{1,255}/g);for(let re=0;re {if(G)return w(G);w(null,Q)})})}const cache={};class nominatim{static request(w,x){$.ajax(`https://nominatim.openstreetmap.org/search?X-Requested-With=${configs.appname}`,{data:{format:"json",q:w},success(Q){if(typeof Q=="string")try{Q=JSON.parse(Q)}catch{}cache[w]=Q,x(void 0,Q)},error(){const Q="An error occurred while contacting the osm search server nominatim.openstreetmap.org :(";console.log(Q),x(Q,null)}})}static get(w,x){return cache[w]===void 0?this.request(w,x):x(void 0,cache[w]),this}static getBest(w,x,Q){return Q||(Q=x,x=null),this.get(w,(S,D)=>{if(S){Q(S,null);return}x&&(D=D.filter(x)),D.length===0?Q("No result found",null):Q(S,D[0])}),this}}function map2bbox(g){let w;ide.map.bboxfilter&&ide.map.bboxfilter.isEnabled()?w=ide.map.bboxfilter.getBounds():w=ide.map.getBounds();const x=Math.min(Math.max(w.getSouthWest().lat,-90),90),Q=Math.min(Math.max(w.getNorthEast().lat,-90),90),S=Math.min(Math.max(w.getSouthWest().lng,-180),180),D=Math.min(Math.max(w.getNorthEast().lng,-180),180);if(g=="OverpassQL")return`${x},${S},${Q},${D}`;if(g=="xml")return`s="${x}" w="${S}" n="${Q}" e="${D}"`}function map2coord(g){const w=ide.map.getCenter();if(g=="OverpassQL")return`${w.lat},${w.lng}`;if(g=="xml")return`lat="${w.lat}" lon="${w.lng}"`}function relativeTime(g,w){const x=Date.now();if(g==""&&(g="0 seconds"),g=g.toLowerCase().match(/(-?[0-9]+) ?(seconds?|minutes?|hours?|days?|weeks?|months?|years?)?/),g===null){w("");return}const Q=parseInt(g[1]);let S;switch(g[2]){case"second":case"seconds":S=1;break;case"minute":case"minutes":S=60;break;case"hour":case"hours":S=3600;break;case"day":case"days":default:S=86400;break;case"week":case"weeks":S=604800;break;case"month":case"months":S=2628e3;break;case"year":case"years":S=31536e3;break}const D=x-Q*S*1e3;w(new Date(D).toISOString())}function geocodeId(g,w){const x=ide.getQueryLang();function Q(S){return S.osm_type&&S.osm_id}nominatim.getBest(g,Q,(S,D)=>{if(S)return ide.onNominatimError(g,"Id");x=="OverpassQL"?D=`${D.osm_type}(${D.osm_id})`:x=="xml"&&(D=`type="${D.osm_type}" ref="${D.osm_id}"`),w(D)})}function geocodeArea(g,w){const x=ide.getQueryLang();function Q(S){return S.osm_type&&S.osm_id&&S.osm_type!=="node"}nominatim.getBest(g,Q,(S,D)=>{if(S)return ide.onNominatimError(g,"Area");let H=1*D.osm_id;if(D.osm_type=="way"&&(H+=24e8),D.osm_type=="relation"&&(H+=36e8),x=="OverpassQL")return D.osm_type==="way"&&(H+=`,${D.osm_id}`),w(`area(id:${H})`);if(x=="xml")return D.osm_type==="way"&&(H+=`" ref_1="${D.osm_id}`),w(`type="area" ref="${H}"`)})}function geocodeBbox(g,w){const x=ide.getQueryLang();nominatim.getBest(g,(Q,S)=>{if(Q)return ide.onNominatimError(g,"Bbox");const D=Math.min(Math.max(S.boundingbox[0],-90),90),H=Math.min(Math.max(S.boundingbox[1],-90),90),M=Math.min(Math.max(S.boundingbox[2],-180),180),R=Math.min(Math.max(S.boundingbox[3],-180),180);x=="OverpassQL"?S=`${D},${M},${H},${R}`:x=="xml"&&(S=`s="${D}" w="${M}" n="${H}" e="${R}"`),w(S)})}function geocodeCoords(g,w){const x=ide.getQueryLang();nominatim.getBest(g,(Q,S)=>{if(Q)return ide.onNominatimError(g,"Coords");x=="OverpassQL"?S=`${S.lat},${S.lon}`:x=="xml"&&(S=`lat="${S.lat}" lon="${S.lon}"`),w(S)})}function shortcuts(){const g=ide.getQueryLang();return{bbox:map2bbox(g),center:map2coord(g),__bbox__global_bbox_xml__ezs4K8__:map2bbox("OverpassQL"),date:relativeTime,geocodeId,geocodeArea,geocodeBbox,geocodeCoords,nominatimId:g=="xml"?geocodeId:(w,x)=>geocodeId(w,Q=>x(`${Q};`)),nominatimArea:g=="xml"?geocodeArea:(w,x)=>geocodeArea(w,Q=>x(`${Q};`)),nominatimBbox:geocodeBbox,nominatimCoords:geocodeCoords}}let copyData;$(document).on("copy",g=>{copyData&&g.originalEvent&&g.originalEvent.clipboardData?(Object.keys(copyData).forEach(w=>{g.originalEvent.clipboardData.setData(w,copyData[w])}),g.originalEvent.preventDefault(),copyData=void 0):copyData&©Data["text/plain"]&&(prompt(i18n.t("export.copy_to_clipboard"),copyData["text/plain"]),copyData=null)});function make_combobox(g,w,x,Q){if(g[0].is_combobox){g.autocomplete("option",{source:w});return}const S=g.wrap("").parent().addClass("ui-combobox");g.autocomplete({source:w,minLength:0}).addClass("ui-widget ui-widget-content ui-corner-left ui-state-default").autocomplete("instance")._renderItem=(D,H)=>$(" ").append(x&&x.indexOf(H.value)!==-1?` ${H.label}`:`${H.label}`).on("click",function(M){if(M.shiftKey&&x.indexOf(H.value)!==-1){Q(H.value),$(this).remove();const R=g.autocomplete("option","source");return R.splice(R.indexOf(H),1),g.autocomplete("option","source",R),!1}}).appendTo(D),$("").attr("tabIndex",-1).attr("title","show all items").appendTo(S).button({icons:{primary:"ui-icon-triangle-1-s"},text:!1}).removeClass("ui-corner-all").addClass("ui-corner-right ui-combobox-toggle").click(()=>{if(g.autocomplete("widget").is(":visible")){g.autocomplete("close");return}g.autocomplete("search",""),g.focus()}),g[0].is_combobox=!0}function showDialog(g,w,x){const Q=``,S=$(Q);$(".delete",S).click(()=>$(S).remove());for(const D in x){const H=x[D];$(``).click(()=>{var M;(M=H.callback)==null||M.call(H),$(S).remove()}).appendTo($("footer .level-item",S))}S.appendTo("body")}class IDE{constructor(){this.attribControl=null,this.scaleControl=null,this.queryParser=new parser,this.run_query_on_startup=!1,this.codeEditor=null,this.dataViewer=null,this.map=null,this.waiter=new class{constructor(){this.opened=!0,this.frames=["◴","◷","◶","◵"],this.frameDelay=250,this.onAbort=void 0,this.interval=0,this._initialTitle=document.title}open(x){x?($(".modal .wait-info h4").text(x),$(".wait-info").show()):$(".wait-info").hide(),$("#loading-dialog").addClass("is-active"),document.title=`${this.frames[0]} ${this._initialTitle}`;let Q=0;this.interval=setInterval(()=>{const S=this.isAlert?this.alertFrame:this.frames[++Q%this.frames.length];document.title=`${S} ${this._initialTitle}`},this.frameDelay),this.opened=!0}close(x=""){this.opened&&(clearInterval(this.interval),document.title=`${x}${this._initialTitle}`,$("#loading-dialog").removeClass("is-active"),$(".wait-info ul li").remove(),delete this.onAbort,this.opened=!1)}addInfo(x,Q){$("#aborter").remove(),$(".wait-info ul li:nth-child(n+1)").css("opacity",.5),$(".wait-info ul li span.fas").removeClass("fa-spinner").removeClass("fa-spin").addClass("fa-check"),$(".wait-info ul li:nth-child(n+4)").hide();const S=$(`${g}
${w} ${x} `);if(typeof Q=="function"){this.onAbort=Q;const D=$(' (abort)').on("click",()=>(this.abort(),!1));S.append(D)}$(".wait-info ul").prepend(S)}abort(){typeof this.onAbort=="function"&&(this.addInfo("aborting"),this.onAbort(this.close))}}}init(){this.waiter.addInfo("ide starting up"),$("#overpass-turbo-version").html("overpass-turbo2024-11-03/58460f4
"),$("#overpass-turbo-dependencies").html('@fortawesome/fontawesome-free 5.15.4 ((CC-BY-4.0 AND OFL-1.1 AND MIT)), @openstreetmap/id-tagging-schema 3.5.1 (ISC), bulma 0.9.4 (MIT), canvg 4.0.1 (MIT), codemirror 2.38.00 (undefined), colorbrewer 1.5.7 ([object Object]), colormap 2.3.2 (MIT), html2canvas 1.4.1 (MIT), jquery 3.7.1 (MIT), jquery-ui 1.13.2 (MIT), jquery-ui-dist 1.13.2 (MIT), leaflet 1.9.4 (BSD-2-Clause), leaflet-polylineoffset 1.1.1 (MIT), leaflet-locationfilter 0.1.3 (MIT), lodash 4.17.21 (MIT), osm-auth 2.2.0 (ISC), osmtogeojson 3.0.0-beta.5 (MIT), rgbcolor 1.0.1 (MIT OR SEE LICENSE IN FEEL-FREE.md), stackblur 1.0.0 (BSD-2-Clause), tag2link 2024.05.21 (ISC), togpx 0.5.4 (MIT), tokml 0.4.0 (BSD-2-Clause)'),($.support.cors!=!0||typeof function(){let w;try{localStorage.setItem("startup_localstorage_quota_test",123),localStorage.removeItem("startup_localstorage_quota_test"),w=localStorage}catch{}return w}()!="object")&&(this.not_supported=!0,$("#warning-unsupported-browser").addClass("is-active")),this.waiter.addInfo("load settings"),settings.load(),this.waiter.addInfo("translate ui"),i18n.translate().then(()=>this.initAfterI18n()),sync.enabled&&($("#load-dialog .osm").show(),sync.authenticated()&&($("#logout").show(),$("#logout").appendTo($("#logout").parent())))}initAfterI18n(){const w=this;w.waiter.addInfo("parse url parameters");const x=urlParameters();x.has_coords&&(settings.coords_lat=x.coords.lat,settings.coords_lon=x.coords.lng),x.has_zoom&&(settings.coords_zoom=x.zoom),x.run_query&&(w.run_query_on_startup=!0),settings.save(),w.waiter.addInfo("initialize page");const Q=$(window).width()/$(window).height()<.8;if(settings.editor_width!=""&&!Q&&($("#editor").css("width",settings.editor_width),$("#dataviewer").css("left",settings.editor_width)),Q&&$("#editor, #dataviewer").addClass("portrait"),$("#editor").resizable({handles:Q?"s":"e",minWidth:Q?void 0:"200",resize(){if(!Q)$(this).next().css("left",`${$(this).outerWidth()}px`);else{const J=$(this).offset().top+$(this).outerHeight();$(this).next().css("top",`${J}px`)}w.map.invalidateSize(!1)},stop(){Q||(settings.editor_width=$("#editor").css("width"),settings.save())}}),$("#editor").prepend(""),$("#editor textarea")[0].value=settings.code.overpass,settings.use_rich_editor){let J=0;CodeMirror.defineMIME("text/x-overpassQL",{name:"clike",keywords:function(X){const re={},ae=X.split(" ");for(const oe of ae)re[oe]=!0;return re}("out json xml custom popup timeout maxsize bbox date diff adiff foreach relation rel way node is_in area around user uid newer changed poly pivot nwr nw nr wr derived out meta body skel tags ids count qt asc center bb geom")}),CodeMirror.defineMIME("text/x-overpassXML","xml"),CodeMirror.defineMode("xml+mustache",X=>CodeMirror.multiplexingMode(CodeMirror.multiplexingMode(CodeMirror.getMode(X,"xml"),{open:"{{",close:"}}",mode:CodeMirror.getMode(X,"text/plain"),delimStyle:"mustache"}),{open:"{{style:",close:"}}",mode:CodeMirror.getMode(X,"text/css"),delimStyle:"mustache"})),CodeMirror.defineMode("ql+mustache",X=>CodeMirror.multiplexingMode(CodeMirror.multiplexingMode(CodeMirror.getMode(X,"text/x-overpassQL"),{open:"{{",close:"}}",mode:CodeMirror.getMode(X,"text/plain"),delimStyle:"mustache"}),{open:"{{style:",close:"}}",mode:CodeMirror.getMode(X,"text/css"),delimStyle:"mustache"})),w.codeEditor=CodeMirror.fromTextArea($("#editor textarea")[0],{lineNumbers:!0,lineWrapping:!0,mode:"text/plain",onChange(X){clearTimeout(J),J=setTimeout(()=>{w.getQueryLang()=="xml"?X.getOption("mode")!="xml+mustache"&&(X.closeTagEnabled=!0,X.setOption("matchBrackets",!1),X.setOption("mode","xml+mustache")):X.getOption("mode")!="ql+mustache"&&(X.closeTagEnabled=!1,X.setOption("matchBrackets",!0),X.setOption("mode","ql+mustache"));const re=$(".leaflet-control-buttons-bboxfilter");w.getRawQuery().match(/\{\{bbox\}\}/)?re.hasClass("disabled")&&(re.removeClass("disabled"),re.attr("data-t","[title]map_controlls.select_bbox"),i18n.translate_ui(re[0])):re.hasClass("disabled")||(re.addClass("disabled"),re.attr("data-t","[title]map_controlls.select_bbox_disabled"),i18n.translate_ui(re[0]))},500),settings.code.overpass=X.getValue(),settings.save()},closeTagEnabled:!0,closeTagIndent:["osm-script","query","union","foreach","difference"],extraKeys:{"'>'"(X){X.closeTag(X,">")},"'/'"(X){X.closeTag(X,"/")}}}),w.codeEditor.getOption("onChange")(w.codeEditor)}else w.codeEditor=$("#editor textarea")[0],w.codeEditor.getValue=function(){return this.value},w.codeEditor.setValue=function(J){this.value=J},w.codeEditor.lineCount=function(){return this.value.split(/\r\n|\r|\n/).length},w.codeEditor.setLineClass=function(){},$("#editor textarea").bind("input change",J=>{settings.code.overpass=J.target.getValue(),settings.save()});x.has_query&&w.codeEditor.setValue(x.query),w.dataViewer=CodeMirror($("#data")[0],{value:"no data loaded yet",lineNumbers:!0,readOnly:!0,mode:"javascript"}),w.map=new L.Map("map",{attributionControl:!1,minZoom:0,maxZoom:configs.maxMapZoom,worldCopyJump:!1});const S=settings.tile_server,D=configs.tileServerAttribution,H=new L.TileLayer(S,{attribution:D,noWrap:!0,maxNativeZoom:19,maxZoom:w.map.options.maxZoom}),M=new L.Control.Attribution({position:"bottomright"});M.addAttribution(D),M.addTo(w.map);const R=new L.LatLng(settings.coords_lat,settings.coords_lon);w.map.setView(R,settings.coords_zoom).addLayer(H),w.map.tile_layer=H,w.map.inv_opacity_layer=L.tileLayer("data:image/gif;base64,R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==").setOpacity(1-settings.background_opacity),settings.background_opacity!=1&&w.map.inv_opacity_layer.addTo(w.map),w.scaleControl=new L.Control.Scale({metric:!0,imperial:!1}),w.scaleControl.addTo(w.map),w.map.on("moveend",()=>{settings.coords_lat=w.map.getCenter().lat,settings.coords_lon=w.map.getCenter().lng,settings.coords_zoom=w.map.getZoom(),settings.save()}),$("#dataviewer > div#data")[0].style.zIndex=-1001,$(".tabs li").bind("click",J=>{$(J.target).hasClass("is-active")||($("#dataviewer > div#data")[0].style.zIndex=-1*$("#dataviewer > div#data")[0].style.zIndex,$(".tabs li").toggleClass("is-active"))}),$(document).keydown(J=>w.onKeyPress(J));const G=L.Control.extend({options:{position:"topleft"},onAdd(){const J=L.DomUtil.create("div","leaflet-control-buttons leaflet-bar");let X=L.DomUtil.create("a","leaflet-control-buttons-fitdata leaflet-bar-part leaflet-bar-part-top",J);return $('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.zoom_to_data"),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",()=>{try{w.map.fitBounds(overpass.osmLayer.getBaseLayer().getBounds(),{maxZoom:18})}catch{}return!1},w.map),X=L.DomUtil.create("a","leaflet-control-buttons-myloc leaflet-bar-part",J),$('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.localize_user"),window.isSecureContext||(X.className+=" disabled",X.setAttribute("data-t","[title]map_controlls.localize_user_disabled")),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",()=>{try{navigator.geolocation.getCurrentPosition(re=>{const ae=new L.LatLng(re.coords.latitude,re.coords.longitude);w.map.setView(ae,settings.coords_zoom)})}catch{}return!1},w.map),X=L.DomUtil.create("a","leaflet-control-buttons-bboxfilter leaflet-bar-part",J),$('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.select_bbox"),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",re=>($(re.target).parent().hasClass("disabled")||(w.map.bboxfilter.isEnabled()?w.map.bboxfilter.disable():(w.map.bboxfilter.setBounds(w.map.getBounds().pad(-.2)),w.map.bboxfilter.enable()),$(re.target).toggleClass("fa-times-circle").toggleClass("fa-image")),!1),w.map),X=L.DomUtil.create("a","leaflet-control-buttons-fullscreen leaflet-bar-part",J),$('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.toggle_wide_map"),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",re=>($("#dataviewer").toggleClass("fullscreen"),w.map.invalidateSize(),$(re.target).toggleClass("fa-step-forward").toggleClass("fa-step-backward"),$("#editor").toggleClass("hidden"),$("#editor").resizable("option","disabled")?$("#editor").resizable("enable"):$("#editor").resizable("disable"),!1),w.map),X=L.DomUtil.create("a","leaflet-control-buttons-clearoverlay leaflet-bar-part leaflet-bar-part-bottom",J),$('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.toggle_data"),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",re=>(re.preventDefault(),w.map.hasLayer(overpass.osmLayer)?w.map.removeLayer(overpass.osmLayer):w.map.addLayer(overpass.osmLayer),!1),w.map),J}});w.map.addControl(new G),$(".leaflet-control-buttons > a").bind("dblclick",J=>J.stopPropagation()),$(".leaflet-control-buttons > a").tooltip({items:"a[title]",hide:{effect:"fadeOut",duration:100},position:{my:"left+5 center",at:"right center"}});const Y=L.Control.extend({options:{position:"topright"},onAdd(){const J=L.DomUtil.create("div","leaflet-control-search control has-icons-left");J.style.position="absolute",J.style.right="0";const X=L.DomUtil.create("input","input is-rounded",J);return $('').click(function(){$(this).prev().autocomplete("search")}).insertAfter(X),X.id="search",X.type="search",X.onclick=function(){this.focus()},J.ondblclick=function(re){re.stopPropagation()},$(X).autocomplete({source(re,ae){$.ajax(`https://search.osmnames.org/q/${encodeURIComponent(re.term)}.js?key=${configs.osmnamesApiKey}`,{success(oe){if(typeof oe=="string")try{oe=$.parseJSON(oe)}catch{}ae($.map(oe.results.slice(0,10),pe=>({label:pe.display_name,value:pe.display_name,lat:pe.lat,lon:pe.lon,boundingbox:pe.boundingbox})))},error(){console.error("An error occurred while contacting the search server osmnames.org :(")}})},minLength:2,autoFocus:!0,select(re,ae){return ae.item.boundingbox&&ae.item.boundingbox instanceof Array?w.map.fitBounds(L.latLngBounds([[ae.item.boundingbox[1],ae.item.boundingbox[0]],[ae.item.boundingbox[3],ae.item.boundingbox[2]]]),{maxZoom:18}):w.map.panTo(new L.LatLng(ae.item.lat,ae.item.lon)),this.value="",!1},open(){$(this).removeClass("ui-corner-all").addClass("ui-corner-top")},close(){$(this).addClass("ui-corner-all").removeClass("ui-corner-top")}}),$(X).autocomplete("option","delay",20),J}});w.map.addControl(new Y),$('').addClass("crosshairs").hide().appendTo("#map"),settings.enable_crosshairs&&$(".crosshairs").show(),w.map.bboxfilter=new L.LocationFilter({enable:!1,adjustButton:!1,enableButton:!1}).addTo(w.map),w.map.on("popupopen popupclose",J=>{if(typeof J.popup.layer<"u"){const X=J.popup.layer.placeholder||J.popup.layer,re=overpass.osmLayer._baseLayer.options.style(X.feature,J.type=="popupopen");typeof X.eachLayer!="function"?typeof X.setStyle=="function"&&X.setStyle(re):X.eachLayer(ae=>{typeof ae.setStyle=="function"&&ae.setStyle(re)})}}),overpass.init(),overpass.handlers.onProgress=function(J,X){w.waiter.addInfo(J,X)},overpass.handlers.onDone=function(){const J=w.getRawQuery().match(/@name ([^\n]+)/),X=J?`${J[1]} | `:"";w.waiter.close(X);const re=w.map.getBounds(),ae=overpass.osmLayer.getBaseLayer().getBounds();if(ae.isValid()&&!re.intersects(ae)){const oe=$(".leaflet-control-buttons-fitdata").tooltip("option","content");$(".leaflet-control-buttons-fitdata").tooltip("option","content",`← ${i18n.t("map_controlls.suggest_zoom_to_data")}`),$(".leaflet-control-buttons-fitdata").tooltip("open"),$(".leaflet-control-buttons-fitdata").tooltip("option","hide",{effect:"fadeOut",duration:1e3}),setTimeout(()=>{$(".leaflet-control-buttons-fitdata").tooltip("option","content",oe),$(".leaflet-control-buttons-fitdata").tooltip("close"),$(".leaflet-control-buttons-fitdata").tooltip("option","hide",{effect:"fadeOut",duration:100})},2600)}},overpass.handlers.onEmptyMap=function(J,X){const re=w.getRawQuery(),ae=/out[^;]+?count/.test(re);if(J=="no visible data")if(!ae&&!settings.no_autorepair){const oe=`${i18n.t("warning.incomplete.expl.1")}
${i18n.t("warning.incomplete.expl.2")}
${i18n.t("warning.incomplete.not_again")}
`,pe=[{name:i18n.t("dialog.repair_query"),callback(){w.repairQuery("no visible data")}},{name:i18n.t("dialog.show_data"),callback(){var fe,_e;(_e=(fe=$("input[name=hide_incomplete_data_warning]"))==null?void 0:fe[0])!=null&&_e.checked&&(settings.no_autorepair=!0,settings.save()),w.switchTab("Data")}}];showDialog(i18n.t("warning.incomplete.title"),oe,pe)}else ae&&w.switchTab("Data");J=="only areas returned"&&w.switchTab("Data"),J=="no coordinates returned"&&w.switchTab("Data"),X=="unknown"&&w.switchTab("Data"),$(`${i18n.t("map.intentionally_blank")} (${J})`).appendTo("#map")},overpass.handlers.onDataReceived=function(J,X,re,ae){if(J>1e6){w.waiter.close();const oe=document.title;document.title=`❗ ${oe}`;const pe=[{name:i18n.t("dialog.abort"),callback(){document.title=oe,re()}},{name:i18n.t("dialog.continue_anyway"),callback(){document.title=oe,ae()}}],fe=`${i18n.t("warning.huge_data.expl.1").replace("{{amount_txt}}",X)}
${i18n.t("warning.huge_data.expl.2")}
`;showDialog(i18n.t("warning.huge_data.title"),fe,pe)}else ae()},overpass.handlers.onAbort=function(){w.waiter.close()},overpass.handlers.onAjaxError=function(J){w.waiter.close();const X=document.title;document.title=`❗ ${X}`;const re=[{name:i18n.t("dialog.dismiss"),callback(){document.title=X}}],ae=`${i18n.t("error.ajax.expl")}
${J}`;showDialog(i18n.t("error.ajax.title"),ae,re),overpass.resultText&&w.dataViewer.setValue(overpass.resultText)},overpass.handlers.onQueryError=function(J){w.waiter.close();const X=document.title;document.title=`❗ ${X}`;const re=[{name:i18n.t("dialog.dismiss"),callback(){document.title=X}}],ae=`${i18n.t("error.query.expl")}`;showDialog(i18n.t("error.query.title"),ae,re)},overpass.handlers.onStyleError=function(J){const X=[{name:i18n.t("dialog.dismiss")}],re=`
${J}${i18n.t("error.mapcss.expl")}
${J}`;showDialog(i18n.t("error.mapcss.title"),re,X)},overpass.handlers.onQueryErrorLine=function(J){w.highlightError(J)},overpass.handlers.onRawDataPresent=function(){w.dataViewer.setOption("mode",overpass.resultType),w.dataViewer.setValue(overpass.resultText)},overpass.handlers.onGeoJsonReady=function(){if(w.map.addLayer(overpass.osmLayer),typeof w.run_query_on_startup=="function"&&w.run_query_on_startup(),$("#styler-button").show(),settings.show_data_stats){const J=overpass.stats,X=`${i18n.t("data_stats.loaded")} – ${i18n.t("data_stats.nodes")}: ${J.data.nodes}, ${i18n.t("data_stats.ways")}: ${J.data.ways}, ${i18n.t("data_stats.relations")}: ${J.data.relations}${J.data.areas>0?`, ${i18n.t("data_stats.areas")}: ${J.data.areas}`:""}
${i18n.t("data_stats.displayed")} – ${i18n.t("data_stats.pois")}: ${J.geojson.pois}, ${i18n.t("data_stats.lines")}: ${J.geojson.lines}, ${i18n.t("data_stats.polygons")}: ${J.geojson.polys}`;$(`${X}`).insertAfter("#map .leaflet-control-attribution");const re=overpass.timestamp&&Date.now()-Date.parse(overpass.timestamp),ae=overpass.timestampAreas&&Date.now()-Date.parse(overpass.timestampAreas);$("#data_stats").tooltip({items:"div",tooltipClass:"stats",content(){let oe="";if(overpass.ajax_request_duration){let pe=overpass.ajax_request_duration;pe.toLocaleString&&(pe=pe.toLocaleString()),oe+=`${i18n.t("data_stats.request_duration")}: ${pe}ms",oe},hide:{effect:"fadeOut",duration:100},position:{my:"right bottom-5",at:"right top"}}),(re>24*60*60*1e3||ae>96*60*60*1e3)&&$("#data_stats").css("background-color","yellow")}},overpass.handlers.onPopupReady=function(J){J.openOn(w.map)},w.waiter.close(),w.run_query_on_startup===!0&&(w.update_map(),!x.has_coords&&x.has_query&&x.query.match(/\{\{(bbox|center)\}\}/)===null&&(w.run_query_on_startup=function(){w.run_query_on_startup=null;try{w.map.fitBounds(overpass.osmLayer.getBaseLayer().getBounds(),{maxZoom:18})}catch{}}))}onNominatimError(w,x){this.waiter.close();let Q=this.getRawQuery();Q=Q.split(` +`+H+"}":"{"+M.join(",")+"}",gap=H,S}}typeof JSON.stringify!="function"&&(meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(g,w,x){var Q;if(gap="",indent="",typeof x=="number")for(Q=0;Q
`}return overpass.timestamp&&(oe+=`${i18n.t("data_stats.lag")}: ${Math.floor(re/1e3)}s ${i18n.t("data_stats.lag.expl")}`),overpass.timestampAreas&&(oe+=`
${i18n.t("data_stats.lag_areas")}: ${Math.floor(ae/1e3)}s ${i18n.t("data_stats.lag.expl")}`),oe+="{var R=(G,Y)=>{G?M(new Error(G)):H(Y)};_generatePkceChallenge(G=>x(G,R))}))};function x(H,M){var R=generateState(),G=g.url+"/oauth2/authorize?"+utilQsString({client_id:g.client_id,redirect_uri:g.redirect_uri,response_type:"code",scope:g.scope,state:R,code_challenge:H.code_challenge,code_challenge_method:H.code_challenge_method});if(g.singlepage){if(!store.enabled){var Y=new Error("local storage unavailable, but require in singlepage mode");Y.status="pkce-localstorage-unavailable",M(Y);return}var J=utilStringQs(window.location.search.slice(1));J.code?w.bootstrapToken(J.code,M):(S("oauth2_state",R),S("oauth2_pkce_code_verifier",H.code_verifier),window.location=G)}else{var X=600,re=550,ae=[["width",X],["height",re],["left",window.screen.width/2-X/2],["top",window.screen.height/2-re/2]].map(function(fe){return fe.join("=")}).join(","),oe=window.open("about:blank","oauth_window",ae);w.popupWindow=oe,oe.location=G,oe||(Y=new Error("Popup was blocked"),Y.status="popup-blocked",M(Y))}window.authComplete=function(fe){var _e=utilStringQs(fe.split("?")[1]);if(_e.state!==R){Y=new Error("Invalid state"),Y.status="invalid-state",M(Y);return}Q(_e.code,H.code_verifier,pe),delete window.authComplete};function pe(fe,_e){if(g.done(),fe){M(fe);return}var me=JSON.parse(_e.response);S("oauth2_access_token",me.access_token),M(null,w)}}function Q(H,M,R){var G=g.url+"/oauth2/token?"+utilQsString({client_id:g.client_id,redirect_uri:g.redirect_uri,grant_type:"authorization_code",code:H,code_verifier:M});w.rawxhr("POST",G,null,null,null,R),g.loading()}w.bringPopupWindowToFront=function(){var H=!1;try{w.popupWindow&&!w.popupWindow.closed&&(w.popupWindow.focus(),H=!0)}catch{}return H},w.bootstrapToken=function(H,M){var R=S("oauth2_state");S("oauth2_state","");var G=utilStringQs(window.location.search.slice(1));if(G.state!==R){var Y=new Error("Invalid state");Y.status="invalid-state",M(Y);return}var J=S("oauth2_pkce_code_verifier");S("oauth2_pkce_code_verifier",""),Q(H,J,X);function X(re,ae){if(g.done(),re){M(re);return}var oe=JSON.parse(ae.response);S("oauth2_access_token",oe.access_token),M(null,w)}},w.fetch=function(H,M){if(w.authenticated())return R();return g.auto?w.authenticateAsync().then(R):Promise.reject(new Error("not authenticated"));function R(){return M=M||{},M.headers||(M.headers={"Content-Type":"application/x-www-form-urlencoded"}),M.headers.Authorization="Bearer "+S("oauth2_access_token"),fetch(H,M)}},w.xhr=function(H,M){if(w.authenticated())return R();if(g.auto){w.authenticate(R);return}else{M("not authenticated",null);return}function R(){var Y=H.prefix!==!1?g.url+H.path:H.path;return w.rawxhr(H.method,Y,S("oauth2_access_token"),H.content,H.headers,G)}function G(Y,J){Y?M(Y):J.responseXML?M(Y,J.responseXML):M(Y,J.response)}},w.rawxhr=function(H,M,R,G,Y,J){Y=Y||{"Content-Type":"application/x-www-form-urlencoded"},R&&(Y.Authorization="Bearer "+R);var X=new XMLHttpRequest;X.onreadystatechange=function(){X.readyState===4&&X.status!==0&&(/^20\d$/.test(X.status)?J(null,X):J(X,null))},X.onerror=function(ae){J(ae,null)},X.open(H,M,!0);for(var re in Y)X.setRequestHeader(re,Y[re]);return X.send(G),X},w.preauth=function(H){return H&&H.access_token&&S("oauth2_access_token",H.access_token),w},w.options=function(H){return arguments.length?(g=H,g.url=g.url||"https://www.openstreetmap.org",g.auto=g.auto||!1,g.singlepage=g.singlepage||!1,g.loading=g.loading||function(){},g.done=g.done||function(){},w.preauth(g)):g};var S;if(store.enabled)S=function(H,M){if(arguments.length===1)return store.get(g.url+H);if(arguments.length===2)return store.set(g.url+H,M)};else{var D={};S=function(H,M){if(arguments.length===1)return D[g.url+H];if(arguments.length===2)return D[g.url+H]=M}}return w.options(g),w}function utilQsString(g){return Object.keys(g).filter(function(w){return g[w]!==void 0}).sort().map(function(w){return encodeURIComponent(w)+"="+encodeURIComponent(g[w])}).join("&")}function utilStringQs(g){for(var w=0;w {if(w)return g(w);loadQueries(g)})},save(g,w){auth.authenticated()?saveQuery(g,w):auth.authenticate(x=>{if(x)return w(x);saveQuery(g,w)})},delete(g,w){if(!auth.authenticated())return w(new Error("must be logged in to delete a synced query"));g={name:g,deleteMe:!0},saveQuery(g,w)},logout(){auth.authenticated()&&auth.logout()},authenticated(){return enabled&&auth.authenticated()}};function loadQueries(g){auth.xhr({method:"GET",path:"/api/0.6/user/preferences"},(w,x)=>{if(w)return g(w);let Q=0,S;(S=x.querySelector(`preference[k="${configs.settingNamespace}_query-count"]`))&&(Q=+S.getAttribute("v"));const D=[];for(let H=0;H {if(x)return w(x);const D=S.querySelector("preferences"),H=D.querySelectorAll(`preference[k^="${configs.settingNamespace}_query"]`);for(const G of H)G.remove();let M=!0;Q.forEach((G,Y)=>{G.name==g.name&&(G.query=g.query,M=Y)}),M===!0?Q.push(g):g.deleteMe&&Q.splice(M,1);const R=S.createElement("preference");R.setAttribute("k",`${configs.settingNamespace}_query-count`),R.setAttribute("v",Q.length),D.appendChild(R);for(let G=0;G200)return w(new Error("query name too long to be saved on osm.org"));const J=Math.ceil((Y.query.length+Y.name.length+8)/255);if(J>9)return w(new Error("query too long to be saved on osm.org"));let X=`p=${J}`;X+=`&n=${Y.name}`,X+=`&q=${Y.query}`,X=X.match(/.{1,255}/g);for(let re=0;re {if(G)return w(G);w(null,Q)})})}const cache={};class nominatim{static request(w,x){$.ajax(`https://nominatim.openstreetmap.org/search?X-Requested-With=${configs.appname}`,{data:{format:"json",q:w},success(Q){if(typeof Q=="string")try{Q=JSON.parse(Q)}catch{}cache[w]=Q,x(void 0,Q)},error(){const Q="An error occurred while contacting the osm search server nominatim.openstreetmap.org :(";console.log(Q),x(Q,null)}})}static get(w,x){return cache[w]===void 0?this.request(w,x):x(void 0,cache[w]),this}static getBest(w,x,Q){return Q||(Q=x,x=null),this.get(w,(S,D)=>{if(S){Q(S,null);return}x&&(D=D.filter(x)),D.length===0?Q("No result found",null):Q(S,D[0])}),this}}function map2bbox(g){let w;ide.map.bboxfilter&&ide.map.bboxfilter.isEnabled()?w=ide.map.bboxfilter.getBounds():w=ide.map.getBounds();const x=Math.min(Math.max(w.getSouthWest().lat,-90),90),Q=Math.min(Math.max(w.getNorthEast().lat,-90),90),S=Math.min(Math.max(w.getSouthWest().lng,-180),180),D=Math.min(Math.max(w.getNorthEast().lng,-180),180);if(g=="OverpassQL")return`${x},${S},${Q},${D}`;if(g=="xml")return`s="${x}" w="${S}" n="${Q}" e="${D}"`}function map2coord(g){const w=ide.map.getCenter();if(g=="OverpassQL")return`${w.lat},${w.lng}`;if(g=="xml")return`lat="${w.lat}" lon="${w.lng}"`}function relativeTime(g,w){const x=Date.now();if(g==""&&(g="0 seconds"),g=g.toLowerCase().match(/(-?[0-9]+) ?(seconds?|minutes?|hours?|days?|weeks?|months?|years?)?/),g===null){w("");return}const Q=parseInt(g[1]);let S;switch(g[2]){case"second":case"seconds":S=1;break;case"minute":case"minutes":S=60;break;case"hour":case"hours":S=3600;break;case"day":case"days":default:S=86400;break;case"week":case"weeks":S=604800;break;case"month":case"months":S=2628e3;break;case"year":case"years":S=31536e3;break}const D=x-Q*S*1e3;w(new Date(D).toISOString())}function geocodeId(g,w){const x=ide.getQueryLang();function Q(S){return S.osm_type&&S.osm_id}nominatim.getBest(g,Q,(S,D)=>{if(S)return ide.onNominatimError(g,"Id");x=="OverpassQL"?D=`${D.osm_type}(${D.osm_id})`:x=="xml"&&(D=`type="${D.osm_type}" ref="${D.osm_id}"`),w(D)})}function geocodeArea(g,w){const x=ide.getQueryLang();function Q(S){return S.osm_type&&S.osm_id&&S.osm_type!=="node"}nominatim.getBest(g,Q,(S,D)=>{if(S)return ide.onNominatimError(g,"Area");let H=1*D.osm_id;if(D.osm_type=="way"&&(H+=24e8),D.osm_type=="relation"&&(H+=36e8),x=="OverpassQL")return D.osm_type==="way"&&(H+=`,${D.osm_id}`),w(`area(id:${H})`);if(x=="xml")return D.osm_type==="way"&&(H+=`" ref_1="${D.osm_id}`),w(`type="area" ref="${H}"`)})}function geocodeBbox(g,w){const x=ide.getQueryLang();nominatim.getBest(g,(Q,S)=>{if(Q)return ide.onNominatimError(g,"Bbox");const D=Math.min(Math.max(S.boundingbox[0],-90),90),H=Math.min(Math.max(S.boundingbox[1],-90),90),M=Math.min(Math.max(S.boundingbox[2],-180),180),R=Math.min(Math.max(S.boundingbox[3],-180),180);x=="OverpassQL"?S=`${D},${M},${H},${R}`:x=="xml"&&(S=`s="${D}" w="${M}" n="${H}" e="${R}"`),w(S)})}function geocodeCoords(g,w){const x=ide.getQueryLang();nominatim.getBest(g,(Q,S)=>{if(Q)return ide.onNominatimError(g,"Coords");x=="OverpassQL"?S=`${S.lat},${S.lon}`:x=="xml"&&(S=`lat="${S.lat}" lon="${S.lon}"`),w(S)})}function shortcuts(){const g=ide.getQueryLang();return{bbox:map2bbox(g),center:map2coord(g),__bbox__global_bbox_xml__ezs4K8__:map2bbox("OverpassQL"),date:relativeTime,geocodeId,geocodeArea,geocodeBbox,geocodeCoords,nominatimId:g=="xml"?geocodeId:(w,x)=>geocodeId(w,Q=>x(`${Q};`)),nominatimArea:g=="xml"?geocodeArea:(w,x)=>geocodeArea(w,Q=>x(`${Q};`)),nominatimBbox:geocodeBbox,nominatimCoords:geocodeCoords}}let copyData;$(document).on("copy",g=>{copyData&&g.originalEvent&&g.originalEvent.clipboardData?(Object.keys(copyData).forEach(w=>{g.originalEvent.clipboardData.setData(w,copyData[w])}),g.originalEvent.preventDefault(),copyData=void 0):copyData&©Data["text/plain"]&&(prompt(i18n.t("export.copy_to_clipboard"),copyData["text/plain"]),copyData=null)});function make_combobox(g,w,x,Q){if(g[0].is_combobox){g.autocomplete("option",{source:w});return}const S=g.wrap("").parent().addClass("ui-combobox");g.autocomplete({source:w,minLength:0}).addClass("ui-widget ui-widget-content ui-corner-left ui-state-default").autocomplete("instance")._renderItem=(D,H)=>$(" ").append(x&&x.indexOf(H.value)!==-1?` ${H.label}`:`${H.label}`).on("click",function(M){if(M.shiftKey&&x.indexOf(H.value)!==-1){Q(H.value),$(this).remove();const R=g.autocomplete("option","source");return R.splice(R.indexOf(H),1),g.autocomplete("option","source",R),!1}}).appendTo(D),$("").attr("tabIndex",-1).attr("title","show all items").appendTo(S).button({icons:{primary:"ui-icon-triangle-1-s"},text:!1}).removeClass("ui-corner-all").addClass("ui-corner-right ui-combobox-toggle").click(()=>{if(g.autocomplete("widget").is(":visible")){g.autocomplete("close");return}g.autocomplete("search",""),g.focus()}),g[0].is_combobox=!0}function showDialog(g,w,x){const Q=``,S=$(Q);$(".delete",S).click(()=>$(S).remove());for(const D in x){const H=x[D];$(``).click(()=>{var M;(M=H.callback)==null||M.call(H),$(S).remove()}).appendTo($("footer .level-item",S))}S.appendTo("body")}class IDE{constructor(){this.attribControl=null,this.scaleControl=null,this.queryParser=new parser,this.run_query_on_startup=!1,this.codeEditor=null,this.dataViewer=null,this.map=null,this.waiter=new class{constructor(){this.opened=!0,this.frames=["◴","◷","◶","◵"],this.frameDelay=250,this.onAbort=void 0,this.interval=0,this._initialTitle=document.title}open(x){x?($(".modal .wait-info h4").text(x),$(".wait-info").show()):$(".wait-info").hide(),$("#loading-dialog").addClass("is-active"),document.title=`${this.frames[0]} ${this._initialTitle}`;let Q=0;this.interval=setInterval(()=>{const S=this.isAlert?this.alertFrame:this.frames[++Q%this.frames.length];document.title=`${S} ${this._initialTitle}`},this.frameDelay),this.opened=!0}close(x=""){this.opened&&(clearInterval(this.interval),document.title=`${x}${this._initialTitle}`,$("#loading-dialog").removeClass("is-active"),$(".wait-info ul li").remove(),delete this.onAbort,this.opened=!1)}addInfo(x,Q){$("#aborter").remove(),$(".wait-info ul li:nth-child(n+1)").css("opacity",.5),$(".wait-info ul li span.fas").removeClass("fa-spinner").removeClass("fa-spin").addClass("fa-check"),$(".wait-info ul li:nth-child(n+4)").hide();const S=$(`${g}
${w} ${x} `);if(typeof Q=="function"){this.onAbort=Q;const D=$(' (abort)').on("click",()=>(this.abort(),!1));S.append(D)}$(".wait-info ul").prepend(S)}abort(){typeof this.onAbort=="function"&&(this.addInfo("aborting"),this.onAbort(this.close))}}}init(){this.waiter.addInfo("ide starting up"),$("#overpass-turbo-version").html("overpass-turbo2024-11-03/cbfdd99
"),$("#overpass-turbo-dependencies").html('@fortawesome/fontawesome-free 5.15.4 ((CC-BY-4.0 AND OFL-1.1 AND MIT)), @openstreetmap/id-tagging-schema 3.5.1 (ISC), bulma 0.9.4 (MIT), canvg 4.0.1 (MIT), codemirror 2.38.00 (undefined), colorbrewer 1.5.7 ([object Object]), colormap 2.3.2 (MIT), html2canvas 1.4.1 (MIT), jquery 3.7.1 (MIT), jquery-ui 1.13.2 (MIT), jquery-ui-dist 1.13.2 (MIT), leaflet 1.9.4 (BSD-2-Clause), leaflet-polylineoffset 1.1.1 (MIT), leaflet-locationfilter 0.1.3 (MIT), lodash 4.17.21 (MIT), osm-auth 2.2.0 (ISC), osmtogeojson 3.0.0-beta.5 (MIT), rgbcolor 1.0.1 (MIT OR SEE LICENSE IN FEEL-FREE.md), stackblur 1.0.0 (BSD-2-Clause), tag2link 2024.05.21 (ISC), togpx 0.5.4 (MIT), tokml 0.4.0 (BSD-2-Clause)'),($.support.cors!=!0||typeof function(){let w;try{localStorage.setItem("startup_localstorage_quota_test",123),localStorage.removeItem("startup_localstorage_quota_test"),w=localStorage}catch{}return w}()!="object")&&(this.not_supported=!0,$("#warning-unsupported-browser").addClass("is-active")),this.waiter.addInfo("load settings"),settings.load(),this.waiter.addInfo("translate ui"),i18n.translate().then(()=>this.initAfterI18n()),sync.enabled&&($("#load-dialog .osm").show(),sync.authenticated()&&($("#logout").show(),$("#logout").appendTo($("#logout").parent())))}initAfterI18n(){const w=this;w.waiter.addInfo("parse url parameters");const x=urlParameters();x.has_coords&&(settings.coords_lat=x.coords.lat,settings.coords_lon=x.coords.lng),x.has_zoom&&(settings.coords_zoom=x.zoom),x.run_query&&(w.run_query_on_startup=!0),settings.save(),w.waiter.addInfo("initialize page");const Q=$(window).width()/$(window).height()<.8;if(settings.editor_width!=""&&!Q&&($("#editor").css("width",settings.editor_width),$("#dataviewer").css("left",settings.editor_width)),Q&&$("#editor, #dataviewer").addClass("portrait"),$("#editor").resizable({handles:Q?"s":"e",minWidth:Q?void 0:"200",resize(){if(!Q)$(this).next().css("left",`${$(this).outerWidth()}px`);else{const J=$(this).offset().top+$(this).outerHeight();$(this).next().css("top",`${J}px`)}w.map.invalidateSize(!1)},stop(){Q||(settings.editor_width=$("#editor").css("width"),settings.save())}}),$("#editor").prepend(""),$("#editor textarea")[0].value=settings.code.overpass,settings.use_rich_editor){let J=0;CodeMirror.defineMIME("text/x-overpassQL",{name:"clike",keywords:function(X){const re={},ae=X.split(" ");for(const oe of ae)re[oe]=!0;return re}("out json xml custom popup timeout maxsize bbox date diff adiff foreach relation rel way node is_in area around user uid newer changed poly pivot nwr nw nr wr derived out meta body skel tags ids count qt asc center bb geom")}),CodeMirror.defineMIME("text/x-overpassXML","xml"),CodeMirror.defineMode("xml+mustache",X=>CodeMirror.multiplexingMode(CodeMirror.multiplexingMode(CodeMirror.getMode(X,"xml"),{open:"{{",close:"}}",mode:CodeMirror.getMode(X,"text/plain"),delimStyle:"mustache"}),{open:"{{style:",close:"}}",mode:CodeMirror.getMode(X,"text/css"),delimStyle:"mustache"})),CodeMirror.defineMode("ql+mustache",X=>CodeMirror.multiplexingMode(CodeMirror.multiplexingMode(CodeMirror.getMode(X,"text/x-overpassQL"),{open:"{{",close:"}}",mode:CodeMirror.getMode(X,"text/plain"),delimStyle:"mustache"}),{open:"{{style:",close:"}}",mode:CodeMirror.getMode(X,"text/css"),delimStyle:"mustache"})),w.codeEditor=CodeMirror.fromTextArea($("#editor textarea")[0],{lineNumbers:!0,lineWrapping:!0,mode:"text/plain",onChange(X){clearTimeout(J),J=setTimeout(()=>{w.getQueryLang()=="xml"?X.getOption("mode")!="xml+mustache"&&(X.closeTagEnabled=!0,X.setOption("matchBrackets",!1),X.setOption("mode","xml+mustache")):X.getOption("mode")!="ql+mustache"&&(X.closeTagEnabled=!1,X.setOption("matchBrackets",!0),X.setOption("mode","ql+mustache"));const re=$(".leaflet-control-buttons-bboxfilter");w.getRawQuery().match(/\{\{bbox\}\}/)?re.hasClass("disabled")&&(re.removeClass("disabled"),re.attr("data-t","[title]map_controlls.select_bbox"),i18n.translate_ui(re[0])):re.hasClass("disabled")||(re.addClass("disabled"),re.attr("data-t","[title]map_controlls.select_bbox_disabled"),i18n.translate_ui(re[0]))},500),settings.code.overpass=X.getValue(),settings.save()},closeTagEnabled:!0,closeTagIndent:["osm-script","query","union","foreach","difference"],extraKeys:{"'>'"(X){X.closeTag(X,">")},"'/'"(X){X.closeTag(X,"/")}}}),w.codeEditor.getOption("onChange")(w.codeEditor)}else w.codeEditor=$("#editor textarea")[0],w.codeEditor.getValue=function(){return this.value},w.codeEditor.setValue=function(J){this.value=J},w.codeEditor.lineCount=function(){return this.value.split(/\r\n|\r|\n/).length},w.codeEditor.setLineClass=function(){},$("#editor textarea").bind("input change",J=>{settings.code.overpass=J.target.getValue(),settings.save()});x.has_query&&w.codeEditor.setValue(x.query),w.dataViewer=CodeMirror($("#data")[0],{value:"no data loaded yet",lineNumbers:!0,readOnly:!0,mode:"javascript"}),w.map=new L.Map("map",{attributionControl:!1,minZoom:0,maxZoom:configs.maxMapZoom,worldCopyJump:!1});const S=settings.tile_server,D=configs.tileServerAttribution,H=new L.TileLayer(S,{attribution:D,noWrap:!0,maxNativeZoom:19,maxZoom:w.map.options.maxZoom}),M=new L.Control.Attribution({position:"bottomright"});M.addAttribution(D),M.addTo(w.map);const R=new L.LatLng(settings.coords_lat,settings.coords_lon);w.map.setView(R,settings.coords_zoom).addLayer(H),w.map.tile_layer=H,w.map.inv_opacity_layer=L.tileLayer("data:image/gif;base64,R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==").setOpacity(1-settings.background_opacity),settings.background_opacity!=1&&w.map.inv_opacity_layer.addTo(w.map),w.scaleControl=new L.Control.Scale({metric:!0,imperial:!1}),w.scaleControl.addTo(w.map),w.map.on("moveend",()=>{settings.coords_lat=w.map.getCenter().lat,settings.coords_lon=w.map.getCenter().lng,settings.coords_zoom=w.map.getZoom(),settings.save()}),$("#dataviewer > div#data")[0].style.zIndex=-1001,$(".tabs li").bind("click",J=>{$(J.target).hasClass("is-active")||($("#dataviewer > div#data")[0].style.zIndex=-1*$("#dataviewer > div#data")[0].style.zIndex,$(".tabs li").toggleClass("is-active"))}),$(document).keydown(J=>w.onKeyPress(J));const G=L.Control.extend({options:{position:"topleft"},onAdd(){const J=L.DomUtil.create("div","leaflet-control-buttons leaflet-bar");let X=L.DomUtil.create("a","leaflet-control-buttons-fitdata leaflet-bar-part leaflet-bar-part-top",J);return $('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.zoom_to_data"),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",()=>{try{w.map.fitBounds(overpass.osmLayer.getBaseLayer().getBounds(),{maxZoom:18})}catch{}return!1},w.map),X=L.DomUtil.create("a","leaflet-control-buttons-myloc leaflet-bar-part",J),$('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.localize_user"),window.isSecureContext||(X.className+=" disabled",X.setAttribute("data-t","[title]map_controlls.localize_user_disabled")),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",()=>{try{navigator.geolocation.getCurrentPosition(re=>{const ae=new L.LatLng(re.coords.latitude,re.coords.longitude);w.map.setView(ae,settings.coords_zoom)})}catch{}return!1},w.map),X=L.DomUtil.create("a","leaflet-control-buttons-bboxfilter leaflet-bar-part",J),$('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.select_bbox"),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",re=>($(re.target).parent().hasClass("disabled")||(w.map.bboxfilter.isEnabled()?w.map.bboxfilter.disable():(w.map.bboxfilter.setBounds(w.map.getBounds().pad(-.2)),w.map.bboxfilter.enable()),$(re.target).toggleClass("fa-times-circle").toggleClass("fa-image")),!1),w.map),X=L.DomUtil.create("a","leaflet-control-buttons-fullscreen leaflet-bar-part",J),$('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.toggle_wide_map"),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",re=>($("#dataviewer").toggleClass("fullscreen"),w.map.invalidateSize(),$(re.target).toggleClass("fa-step-forward").toggleClass("fa-step-backward"),$("#editor").toggleClass("hidden"),$("#editor").resizable("option","disabled")?$("#editor").resizable("enable"):$("#editor").resizable("disable"),!1),w.map),X=L.DomUtil.create("a","leaflet-control-buttons-clearoverlay leaflet-bar-part leaflet-bar-part-bottom",J),$('').appendTo($(X)),X.href="#",X.className+=" t",X.setAttribute("data-t","[title]map_controlls.toggle_data"),i18n.translate_ui(X),L.DomEvent.addListener(X,"click",re=>(re.preventDefault(),w.map.hasLayer(overpass.osmLayer)?w.map.removeLayer(overpass.osmLayer):w.map.addLayer(overpass.osmLayer),!1),w.map),J}});w.map.addControl(new G),$(".leaflet-control-buttons > a").bind("dblclick",J=>J.stopPropagation()),$(".leaflet-control-buttons > a").tooltip({items:"a[title]",hide:{effect:"fadeOut",duration:100},position:{my:"left+5 center",at:"right center"}});const Y=L.Control.extend({options:{position:"topright"},onAdd(){const J=L.DomUtil.create("div","leaflet-control-search control has-icons-left");J.style.position="absolute",J.style.right="0";const X=L.DomUtil.create("input","input is-rounded",J);return $('').click(function(){$(this).prev().autocomplete("search")}).insertAfter(X),X.id="search",X.type="search",X.onclick=function(){this.focus()},J.ondblclick=function(re){re.stopPropagation()},$(X).autocomplete({source(re,ae){$.ajax(`https://search.osmnames.org/q/${encodeURIComponent(re.term)}.js?key=${configs.osmnamesApiKey}`,{success(oe){if(typeof oe=="string")try{oe=$.parseJSON(oe)}catch{}ae($.map(oe.results.slice(0,10),pe=>({label:pe.display_name,value:pe.display_name,lat:pe.lat,lon:pe.lon,boundingbox:pe.boundingbox})))},error(){console.error("An error occurred while contacting the search server osmnames.org :(")}})},minLength:2,autoFocus:!0,select(re,ae){return ae.item.boundingbox&&ae.item.boundingbox instanceof Array?w.map.fitBounds(L.latLngBounds([[ae.item.boundingbox[1],ae.item.boundingbox[0]],[ae.item.boundingbox[3],ae.item.boundingbox[2]]]),{maxZoom:18}):w.map.panTo(new L.LatLng(ae.item.lat,ae.item.lon)),this.value="",!1},open(){$(this).removeClass("ui-corner-all").addClass("ui-corner-top")},close(){$(this).addClass("ui-corner-all").removeClass("ui-corner-top")}}),$(X).autocomplete("option","delay",20),J}});w.map.addControl(new Y),$('').addClass("crosshairs").hide().appendTo("#map"),settings.enable_crosshairs&&$(".crosshairs").show(),w.map.bboxfilter=new L.LocationFilter({enable:!1,adjustButton:!1,enableButton:!1}).addTo(w.map),w.map.on("popupopen popupclose",J=>{if(typeof J.popup.layer<"u"){const X=J.popup.layer.placeholder||J.popup.layer,re=overpass.osmLayer._baseLayer.options.style(X.feature,J.type=="popupopen");typeof X.eachLayer!="function"?typeof X.setStyle=="function"&&X.setStyle(re):X.eachLayer(ae=>{typeof ae.setStyle=="function"&&ae.setStyle(re)})}}),overpass.init(),overpass.handlers.onProgress=function(J,X){w.waiter.addInfo(J,X)},overpass.handlers.onDone=function(){const J=w.getRawQuery().match(/@name ([^\n]+)/),X=J?`${J[1]} | `:"";w.waiter.close(X);const re=w.map.getBounds(),ae=overpass.osmLayer.getBaseLayer().getBounds();if(ae.isValid()&&!re.intersects(ae)){const oe=$(".leaflet-control-buttons-fitdata").tooltip("option","content");$(".leaflet-control-buttons-fitdata").tooltip("option","content",`← ${i18n.t("map_controlls.suggest_zoom_to_data")}`),$(".leaflet-control-buttons-fitdata").tooltip("open"),$(".leaflet-control-buttons-fitdata").tooltip("option","hide",{effect:"fadeOut",duration:1e3}),setTimeout(()=>{$(".leaflet-control-buttons-fitdata").tooltip("option","content",oe),$(".leaflet-control-buttons-fitdata").tooltip("close"),$(".leaflet-control-buttons-fitdata").tooltip("option","hide",{effect:"fadeOut",duration:100})},2600)}},overpass.handlers.onEmptyMap=function(J,X){const re=w.getRawQuery(),ae=/out[^;]+?count/.test(re);if(J=="no visible data")if(!ae&&!settings.no_autorepair){const oe=`${i18n.t("warning.incomplete.expl.1")}
${i18n.t("warning.incomplete.expl.2")}
${i18n.t("warning.incomplete.not_again")}
`,pe=[{name:i18n.t("dialog.repair_query"),callback(){w.repairQuery("no visible data")}},{name:i18n.t("dialog.show_data"),callback(){var fe,_e;(_e=(fe=$("input[name=hide_incomplete_data_warning]"))==null?void 0:fe[0])!=null&&_e.checked&&(settings.no_autorepair=!0,settings.save()),w.switchTab("Data")}}];showDialog(i18n.t("warning.incomplete.title"),oe,pe)}else ae&&w.switchTab("Data");J=="only areas returned"&&w.switchTab("Data"),J=="no coordinates returned"&&w.switchTab("Data"),X=="unknown"&&w.switchTab("Data"),$(`${i18n.t("map.intentionally_blank")} (${J})`).appendTo("#map")},overpass.handlers.onDataReceived=function(J,X,re,ae){if(J>1e6){w.waiter.close();const oe=document.title;document.title=`❗ ${oe}`;const pe=[{name:i18n.t("dialog.abort"),callback(){document.title=oe,re()}},{name:i18n.t("dialog.continue_anyway"),callback(){document.title=oe,ae()}}],fe=`${i18n.t("warning.huge_data.expl.1").replace("{{amount_txt}}",X)}
${i18n.t("warning.huge_data.expl.2")}
`;showDialog(i18n.t("warning.huge_data.title"),fe,pe)}else ae()},overpass.handlers.onAbort=function(){w.waiter.close()},overpass.handlers.onAjaxError=function(J){w.waiter.close();const X=document.title;document.title=`❗ ${X}`;const re=[{name:i18n.t("dialog.dismiss"),callback(){document.title=X}}],ae=`${i18n.t("error.ajax.expl")}
${J}`;showDialog(i18n.t("error.ajax.title"),ae,re),overpass.resultText&&w.dataViewer.setValue(overpass.resultText)},overpass.handlers.onQueryError=function(J){w.waiter.close();const X=document.title;document.title=`❗ ${X}`;const re=[{name:i18n.t("dialog.dismiss"),callback(){document.title=X}}],ae=`${i18n.t("error.query.expl")}`;showDialog(i18n.t("error.query.title"),ae,re)},overpass.handlers.onStyleError=function(J){const X=[{name:i18n.t("dialog.dismiss")}],re=`
${J}${i18n.t("error.mapcss.expl")}
${J}`;showDialog(i18n.t("error.mapcss.title"),re,X)},overpass.handlers.onQueryErrorLine=function(J){w.highlightError(J)},overpass.handlers.onRawDataPresent=function(){w.dataViewer.setOption("mode",overpass.resultType),w.dataViewer.setValue(overpass.resultText)},overpass.handlers.onGeoJsonReady=function(){if(w.map.addLayer(overpass.osmLayer),typeof w.run_query_on_startup=="function"&&w.run_query_on_startup(),$("#styler-button").show(),settings.show_data_stats){const J=overpass.stats,X=`${i18n.t("data_stats.loaded")} – ${i18n.t("data_stats.nodes")}: ${J.data.nodes}, ${i18n.t("data_stats.ways")}: ${J.data.ways}, ${i18n.t("data_stats.relations")}: ${J.data.relations}${J.data.areas>0?`, ${i18n.t("data_stats.areas")}: ${J.data.areas}`:""}
${i18n.t("data_stats.displayed")} – ${i18n.t("data_stats.pois")}: ${J.geojson.pois}, ${i18n.t("data_stats.lines")}: ${J.geojson.lines}, ${i18n.t("data_stats.polygons")}: ${J.geojson.polys}`;$(`${X}`).insertAfter("#map .leaflet-control-attribution");const re=overpass.timestamp&&Date.now()-Date.parse(overpass.timestamp),ae=overpass.timestampAreas&&Date.now()-Date.parse(overpass.timestampAreas);$("#data_stats").tooltip({items:"div",tooltipClass:"stats",content(){let oe="";if(overpass.ajax_request_duration){let pe=overpass.ajax_request_duration;pe.toLocaleString&&(pe=pe.toLocaleString()),oe+=`${i18n.t("data_stats.request_duration")}: ${pe}ms",oe},hide:{effect:"fadeOut",duration:100},position:{my:"right bottom-5",at:"right top"}}),(re>24*60*60*1e3||ae>96*60*60*1e3)&&$("#data_stats").css("background-color","yellow")}},overpass.handlers.onPopupReady=function(J){J.openOn(w.map)},w.waiter.close(),w.run_query_on_startup===!0&&(w.update_map(),!x.has_coords&&x.has_query&&x.query.match(/\{\{(bbox|center)\}\}/)===null&&(w.run_query_on_startup=function(){w.run_query_on_startup=null;try{w.map.fitBounds(overpass.osmLayer.getBaseLayer().getBounds(),{maxZoom:18})}catch{}}))}onNominatimError(w,x){this.waiter.close();let Q=this.getRawQuery();Q=Q.split(` `),Q.forEach((H,M)=>{H.indexOf(`{{geocode${x}:${w}}}`)!==-1&&this.highlightError(M+1)});const S=[{name:i18n.t("dialog.dismiss")}],D=`
`}return overpass.timestamp&&(oe+=`${i18n.t("data_stats.lag")}: ${Math.floor(re/1e3)}s ${i18n.t("data_stats.lag.expl")}`),overpass.timestampAreas&&(oe+=`
${i18n.t("data_stats.lag_areas")}: ${Math.floor(ae/1e3)}s ${i18n.t("data_stats.lag.expl")}`),oe+="${i18n.t("error.nominatim.expl")}
${htmlentities(w)}
`;showDialog(i18n.t("error.nominatim.title"),D,S)}getRawQuery(){return this.codeEditor.getValue()}async getQuery(){let w=this.getRawQuery();w=w.replace(/(]+bbox[^=]*=[^"'']*["'])({{bbox}})(["'])/,"$1{{__bbox__global_bbox_xml__ezs4K8__}}$3"),w=await this.queryParser.parse(w,shortcuts());let x="";this.queryParser.hasStatement("style")&&(x=this.queryParser.getStatement("style")),this.mapcss=x;let Q=null;if(this.queryParser.hasStatement("data")){Q=this.queryParser.getStatement("data"),Q=Q.split(",");const S=Q[0].toLowerCase();Q=Q.slice(1);const D={};for(const H of Q){const M=H.split("=");D[M[0]]=M[1]}Q={mode:S,options:D}}return this.data_source=Q,w}setQuery(w){this.codeEditor.setValue(w)}getQueryLang(){return $.trim(this.getRawQuery().replace(/{{.*?}}/g,"")).match(/^)?"xml":"OverpassQL"}repairQuery(w){const x=this.getRawQuery(),Q=this.getQueryLang(),S=autorepair(x,Q);w=="no visible data"?S.recurse():w=="xml+metadata"&&S.editors(),this.setQuery(S.getQuery())}highlightError(w){this.codeEditor.setLineClass(w-1,null,"errorline")}resetErrors(){for(let w=0;w {delete settings.saves[w],settings.save(),this.onLoadClick()}},{name:i18n.t("dialog.cancel")}],Q=` ${i18n.t("dialog.delete_query.expl")}: "${w}"?
`;showDialog(i18n.t("dialog.delete_query.title"),Q,x)}removeExampleSync(w,x){const Q=[{name:i18n.t("dialog.delete"),callback(){sync.delete(w.name,D=>{if(D)return console.error(D);$(x).parent().remove()})}},{name:i18n.t("dialog.cancel")}],S=`${i18n.t("dialog.delete_query.expl-osm")}: "${w.name}"?
`;showDialog(i18n.t("dialog.delete_query.title"),S,Q)}onLoadClick(){const w=this;$("#load-dialog .panel.saved_query .panel-block").remove(),$("#load-dialog .panel.example .panel-block").remove();let x=!1;for(const Q in settings.saves){const S=settings.saves[Q].type;S!="template"&&($('').attr("href","#").text(Q).on("click",()=>(w.loadExample(Q),$("#load-dialog").removeClass("is-active"),!1)).append($('