Ticket #18639: 18639.patch

File 18639.patch, 52.1 KB (added by simon04, 5 years ago)
Line 
1commit 34028f044503638eee3c5d1fe9eac9f9cc2a3612
2Author: Simon Legner <Simon.Legner@gmail.com>
3Date: 2020-01-29 23:59:10 +0100
4
5 fix #18639 - Update to overpass-wizard 0.0.9
6
7diff --git a/data/overpass-wizard.js b/data/overpass-wizard.js
8index 144e65175..4f8831bdb 100644
9--- a/data/overpass-wizard.js
10+++ b/data/overpass-wizard.js
11@@ -1 +1 @@
12-!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.overpassWizard=e()}}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module,exports){module.exports=function(presets){var freeFormQuery={};if(!presets)presets={};if(!presets){if(typeof $==="undefined")return false;var presets_file="data/iD_presets.json";try{$.ajax(presets_file,{async:false,dataType:"json"}).success(function(data){presets=data}).error(function(){throw new Error})}catch(e){console.error("failed to load presets file",presets_file,e)}}Object.keys(presets).map(function(key){var preset=presets[key];preset.nameCased=preset.name;preset.name=preset.name.toLowerCase();preset.terms=!preset.terms?[]:preset.terms.map(function(term){return term.toLowerCase()})});(function loadPresetTranslations(){if(typeof $==="undefined"||typeof i18n==="undefined")return;var language=i18n.getLanguage();if(language=="en")return;var translation_file="data/iD_presets_"+language+".json";try{$.ajax(translation_file,{async:false,dataType:"json"}).success(function(data){Object.keys(data).map(function(preset){var translation=data[preset];preset=presets[preset];preset.translated=true;var oriPresetName=preset.name;preset.nameCased=translation.name;preset.name=translation.name.toLowerCase();if(translation.terms)preset.terms=translation.terms.split(",").map(function(term){return term.trim().toLowerCase()}).concat(preset.terms);preset.terms.unshift(oriPresetName)})}).error(function(){throw new Error})}catch(e){console.error("failed to load preset translations file: "+translation_file)}})();freeFormQuery.get_query_clause=function(condition){var search=condition.free.toLowerCase();var candidates=Object.keys(presets).map(function(key){return presets[key]}).filter(function(preset){if(preset.searchable===false)return false;if(preset.name===search)return true;preset._termsIndex=preset.terms.indexOf(search);return preset._termsIndex!=-1});if(candidates.length===0)return false;candidates.sort(function(a,b){if(a.name===search)return-1;if(b.name===search)return 1;return a._termsIndex-b._termsIndex});var preset=candidates[0];var types=[];preset.geometry.forEach(function(g){switch(g){case"point":case"vertex":types.push("node");break;case"line":types.push("way");break;case"area":types.push("way");types.push("relation");break;case"relation":types.push("relation");break;default:console.error("unknown geometry type "+g+" of preset "+preset.name)}});function onlyUnique(value,index,self){return self.indexOf(value)===index}return{types:types.filter(onlyUnique),conditions:Object.keys(preset.tags).map(function(k){var v=preset.tags[k];return{query:v==="*"?"key":"eq",key:k,val:v}})}};freeFormQuery.fuzzy_search=function(condition){var search=condition.free.toLowerCase();var fuzzyness=2+Math.floor(search.length/7);function fuzzyMatch(term){return levenshteinDistance(term,search)<=fuzzyness}var candidates=Object.keys(presets).map(function(key){return presets[key]}).filter(function(preset){if(preset.searchable===false)return false;if(fuzzyMatch(preset.name))return true;return preset.terms.some(fuzzyMatch)});if(candidates.length===0)return false;function preset_weight(preset){return[preset.name].concat(preset.terms).map(function(term,index){return levenshteinDistance(term,search)}).reduce(function min(a,b){return a<=b?a:b})}candidates.sort(function(a,b){return preset_weight(a)-preset_weight(b)});var preset=candidates[0];return preset.nameCased};return freeFormQuery}},{}],2:[function(_dereq_,module,exports){var parser=_dereq_("./parser.js");var freeFormQuery;function normalize(query){var normalized_query={logical:"or",queries:[]};function normalize_recursive(rem_query){if(!rem_query.logical){return[{logical:"and",queries:[rem_query]}]}else if(rem_query.logical==="and"){var c1=normalize_recursive(rem_query.queries[0]);var c2=normalize_recursive(rem_query.queries[1]);var c=[];for(var i=0;i<c1.length;i++)for(var j=0;j<c2.length;j++){c.push({logical:"and",queries:c1[i].queries.concat(c2[j].queries)})}return c}else if(rem_query.logical==="or"){var c1=normalize_recursive(rem_query.queries[0]);var c2=normalize_recursive(rem_query.queries[1]);return[].concat(c1,c2)}else{console.error("unsupported boolean operator: "+rem_query.logical)}}normalized_query.queries=normalize_recursive(query);return normalized_query}module.exports=function wizard(search,options){var defaults={comment:true,outputMode:"geom",globalBbox:true,timeout:25,maxsize:undefined,outputFormat:"json",aroundRadius:1e3,freeFormPresets:undefined};for(var k in options){defaults[k]=options[k]}options=defaults;function quote_comment_str(s){return s.replace(/\*\//g,"[…]").replace(/\n/g,"\\n")}var parsedQuery;try{parsedQuery=parser.parse(search)}catch(e){console.error("couldn't parse wizard input");return false}var query_parts=[];var bounds_part;if(options.comment===true){query_parts.push("/*");query_parts.push("This has been generated by the overpass-turbo wizard.");query_parts.push("The original search was:");query_parts.push("“"+quote_comment_str(search)+"”");query_parts.push("*/")}else if(typeof options.comment==="string"){query_parts.push("/*");query_parts.push(options.comment);query_parts.push("*/");comment=true}query_parts.push("[out:"+options.outputFormat+"]"+"[timeout:"+options.timeout+"]"+(options.maxsize!==undefined?"[maxsize:"+options.maxsize+"]":"")+(options.globalBbox&&parsedQuery.bounds==="bbox"?"[bbox:{{bbox}}]":"")+";");switch(parsedQuery.bounds){case"area":if(options.comment)query_parts.push("// fetch area “"+parsedQuery.area+"” to search in");query_parts.push("{{geocodeArea:"+parsedQuery.area+"}}->.searchArea;");bounds_part="(area.searchArea)";break;case"around":if(options.comment)query_parts.push("// adjust the search radius (in meters) here");query_parts.push("{{radius="+options.aroundRadius+"}}");bounds_part="(around:{{radius}},{{geocodeCoords:"+parsedQuery.area+"}})";break;case"bbox":bounds_part=options.globalBbox?"":"({{bbox}})";break;case"global":bounds_part=undefined;break;default:console.error("unknown bounds condition: "+parsedQuery.bounds);return false;break}function get_query_clause(condition){function escRegexp(str){return str.replace(/([()[{*+.$^\\|?])/g,"\\$1")}function esc(str){if(typeof str!=="string")return;return str.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\t/g,"\\t").replace(/\n/g,"\\n")}var key=esc(condition.key);var val=esc(condition.val);if(condition.query==="substr"){condition.query="like";condition.val={regex:escRegexp(condition.val)}}if(val===""){if(condition.query==="eq"){condition.query="like";condition.val={regex:"^$"}}else if(condition.query==="neq"){condition.query="notlike";condition.val={regex:"^$"}}}if(key===""){if(condition.query==="key"){condition.query="likelike";key="^$";condition.val={regex:".*"}}else if(condition.query==="eq"){condition.query="likelike";key="^$";condition.val={regex:"^"+escRegexp(condition.val)+"$"}}else if(condition.query==="like"){condition.query="likelike";key="^$"}}switch(condition.query){case"key":return'["'+key+'"]';case"nokey":return'["'+key+'"!~".*"]';case"eq":return'["'+key+'"="'+val+'"]';case"neq":return'["'+key+'"!="'+val+'"]';case"like":return'["'+key+'"~"'+esc(condition.val.regex)+'"'+(condition.val.modifier==="i"?",i":"")+"]";case"likelike":return'[~"'+key+'"~"'+esc(condition.val.regex)+'"'+(condition.val.modifier==="i"?",i":"")+"]";case"notlike":return'["'+key+'"!~"'+esc(condition.val.regex)+'"'+(condition.val.modifier==="i"?",i":"")+"]";case"meta":switch(condition.meta){case"id":return"("+val+")";case"newer":if(condition.val.match(/^-?\d+ ?(seconds?|minutes?|hours?|days?|weeks?|months?|years?)?$/))return'(newer:"{{date:'+val+'}}")';return'(newer:"'+val+'")';case"user":return'(user:"'+val+'")';case"uid":return"(uid:"+val+")";default:console.error("unknown query type: meta/"+condition.meta);return false}case"free form":default:console.error("unknown query type: "+condition.query);return false}}function get_query_clause_str(condition){function quotes(s){if(s.match(/^[a-zA-Z0-9_]+$/)===null)return'"'+s.replace(/"/g,'\\"')+'"';return s}function quoteRegex(s){if(s.regex.match(/^[a-zA-Z0-9_]+$/)===null||s.modifier)return"/"+s.regex.replace(/\//g,"\\/")+"/"+(s.modifier||"");return s.regex}switch(condition.query){case"key":return quote_comment_str(quotes(condition.key)+"=*");case"nokey":return quote_comment_str(quotes(condition.key)+"!=*");case"eq":return quote_comment_str(quotes(condition.key)+"="+quotes(condition.val));case"neq":return quote_comment_str(quotes(condition.key)+"!="+quotes(condition.val));case"like":return quote_comment_str(quotes(condition.key)+"~"+quoteRegex(condition.val));case"likelike":return quote_comment_str("~"+quotes(condition.key)+"~"+quoteRegex(condition.val));case"notlike":return quote_comment_str(quotes(condition.key)+"!~"+quoteRegex(condition.val));case"substr":return quote_comment_str(quotes(condition.key)+":"+quotes(condition.val));case"meta":switch(condition.meta){case"id":return quote_comment_str("id:"+quotes(condition.val));case"newer":return quote_comment_str("newer:"+quotes(condition.val));case"user":return quote_comment_str("user:"+quotes(condition.val));case"uid":return quote_comment_str("uid:"+quotes(condition.val));default:return""}case"free form":return quote_comment_str(quotes(condition.free));default:return""}}parsedQuery.query=normalize(parsedQuery.query);if(options.comment)query_parts.push("// gather results");query_parts.push("(");for(var i=0;i<parsedQuery.query.queries.length;i++){var and_query=parsedQuery.query.queries[i];var types=["node","way","relation"];var clauses=[];var clauses_str=[];for(var j=0;j<and_query.queries.length;j++){var cond_query=and_query.queries[j];if(cond_query.query==="free form"){if(!freeFormQuery)freeFormQuery=_dereq_("./free")(options.freeFormPresets);var ffs_clause=freeFormQuery.get_query_clause(cond_query);if(ffs_clause===false){console.error("Couldn't find preset for free form input: "+cond_query.free);return false}types=types.filter(function(t){return ffs_clause.types.indexOf(t)!=-1});if(options.comment)clauses_str.push(get_query_clause_str(cond_query));clauses=clauses.concat(ffs_clause.conditions.map(function(condition){return get_query_clause(condition)}))}else if(cond_query.query==="type"){types=types.indexOf(cond_query.type)!=-1?[cond_query.type]:[]}else{if(options.comment)clauses_str.push(get_query_clause_str(cond_query));var clause=get_query_clause(cond_query);if(clause===false)return false;clauses.push(clause)}}clauses_str=clauses_str.join(" and ");if(options.comment)query_parts.push(" // query part for: “"+clauses_str+"”");for(var t=0;t<types.length;t++){var buffer=" "+types[t];for(var c=0;c<clauses.length;c++)buffer+=clauses[c];if(bounds_part)buffer+=bounds_part;buffer+=";";query_parts.push(buffer)}}query_parts.push(");");if(options.comment)query_parts.push("// print results");if(options.outputMode==="recursive"){query_parts.push("out body;");query_parts.push(">;");query_parts.push("out skel qt;")}else if(options.outputMode==="recursive_meta"){query_parts.push("(._;>;);");query_parts.push("out meta;")}else{query_parts.push("out "+options.outputMode+";")}return query_parts.join("\n")}},{"./free":1,"./parser.js":3}],3:[function(_dereq_,module,exports){module.exports=function(){"use strict";function peg$subclass(child,parent){function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor}function peg$SyntaxError(message,expected,found,location){this.message=message;this.expected=expected;this.found=found;this.location=location;this.name="SyntaxError";if(typeof Error.captureStackTrace==="function"){Error.captureStackTrace(this,peg$SyntaxError)}}peg$subclass(peg$SyntaxError,Error);function peg$parse(input){var options=arguments.length>1?arguments[1]:{},parser=this,peg$FAILED={},peg$startRuleIndices={start:0},peg$startRuleIndex=0,peg$consts=[function(x){return x},"in bbox",{type:"literal",value:"in bbox",description:'"in bbox"'},"IN BBOX",{type:"literal",value:"IN BBOX",description:'"IN BBOX"'},function(x){return{bounds:"bbox",query:x}},"in",{type:"literal",value:"in",description:'"in"'},"IN",{type:"literal",value:"IN",description:'"IN"'},function(x,y){return{bounds:"area",query:x,area:y}},"around",{type:"literal",value:"around",description:'"around"'},"AROUND",{type:"literal",value:"AROUND",description:'"AROUND"'},function(x,y){return{bounds:"around",query:x,area:y}},"global",{type:"literal",value:"global",description:'"global"'},"GLOBAL",{type:"literal",value:"GLOBAL",description:'"GLOBAL"'},function(x){return{bounds:"global",query:x}},"or",{type:"literal",value:"or",description:'"or"'},"OR",{type:"literal",value:"OR",description:'"OR"'},"||",{type:"literal",value:"||",description:'"||"'},"|",{type:"literal",value:"|",description:'"|"'},function(x,y){return{logical:"or",queries:[x,y]}},"and",{type:"literal",value:"and",description:'"and"'},"AND",{type:"literal",value:"AND",description:'"AND"'},"&&",{type:"literal",value:"&&",description:'"&&"'},"&",{type:"literal",value:"&",description:'"&"'},function(x,y){return{logical:"and",queries:[x,y]}},"(",{type:"literal",value:"(",description:'"("'},")",{type:"literal",value:")",description:'")"'},function(x){return x},"=",{type:"literal",value:"=",description:'"="'},"==",{type:"literal",value:"==",description:'"=="'},function(x,y){return{query:"eq",key:x,val:y}},"!=",{type:"literal",value:"!=",description:'"!="'},"<>",{type:"literal",value:"<>",description:'"<>"'},function(x,y){return{query:"neq",key:x,val:y}},"*",{type:"literal",value:"*",description:'"*"'},function(x){return{query:"key",key:x}},"is",{type:"literal",value:"is",description:'"is"'},"not",{type:"literal",value:"not",description:'"not"'},"null",{type:"literal",value:"null",description:'"null"'},"IS",{type:"literal",value:"IS",description:'"IS"'},"NOT",{type:"literal",value:"NOT",description:'"NOT"'},"NULL",{type:"literal",value:"NULL",description:'"NULL"'},function(x){return{query:"nokey",key:x}},"~=",{type:"literal",value:"~=",description:'"~="'},"~",{type:"literal",value:"~",description:'"~"'},"=~",{type:"literal",value:"=~",description:'"=~"'},function(x,y){return{query:"like",key:x,val:y.regex?y:{regex:y}}},"like",{type:"literal",value:"like",description:'"like"'},"LIKE",{type:"literal",value:"LIKE",description:'"LIKE"'},function(x,y){return{query:"likelike",key:x,val:y.regex?y:{regex:y}}},"!~",{type:"literal",value:"!~",description:'"!~"'},function(x,y){return{query:"notlike",key:x,val:y.regex?y:{regex:y}}},":",{type:"literal",value:":",description:'":"'},function(x,y){return{query:"substr",key:x,val:y}},"type",{type:"literal",value:"type",description:'"type"'},function(x){return{query:"type",type:x}},"user",{type:"literal",value:"user",description:'"user"'},"uid",{type:"literal",value:"uid",description:'"uid"'},"newer",{type:"literal",value:"newer",description:'"newer"'},"id",{type:"literal",value:"id",description:'"id"'},function(x,y){return{query:"meta",meta:x,val:y}},function(x){return{query:"free form",free:x}},{type:"other",description:"Key"},/^[a-zA-Z0-9_:\-]/,{type:"class",value:"[a-zA-Z0-9_:-]",description:"[a-zA-Z0-9_:-]"},function(s){return s.join("")},'"',{type:"literal",value:'"',description:'"\\""'},"'",{type:"literal",value:"'",description:'"\'"'},function(parts){return parts[1]},{type:"other",description:"string"},/^[^'" ()~=!*\/:<>&|[\]{}#+@$%?\^.,]/,{type:"class",value:"[^'\" ()~=!*/:<>&|[\\]{}#+@$%?^.,]",description:"[^'\" ()~=!*/:<>&|[\\]{}#+@$%?^.,]"},function(chars){return chars.join("")},"\\",{type:"literal",value:"\\",description:'"\\\\"'},{type:"any",description:"any character"},function(char_){return char_},function(sequence){return sequence},/^['"\\bfnrtv]/,{type:"class",value:"['\"\\\\bfnrtv]",description:"['\"\\\\bfnrtv]"},function(char_){return char_.replace("b","\b").replace("f","\f").replace("n","\n").replace("r","\r").replace("t"," ").replace("v","
13")},"/",{type:"literal",value:"/",description:'"/"'},"i",{type:"literal",value:"i",description:'"i"'},"",function(parts){return{regex:parts[1],modifier:parts[3]}},"\\/",{type:"literal",value:"\\/",description:'"\\\\/"'},function(){return"/"},{type:"other",description:"whitespace"},/^[ \t\n\r]/,{type:"class",value:"[ \\t\\n\\r]",description:"[ \\t\\n\\r]"}],peg$bytecode=[peg$decode("%;;/:#;!/1$;;/($8#: #!!)(#'#(\"'#&'#"),peg$decode('%;"/Y#$;</&#0#*;<&&&#/C$2!""6!7".) &2#""6#7$/($8#:%#!")(#\'#("\'#&\'#.Ł &%;"/y#$;</&#0#*;<&&&#/c$2&""6&7\'.) &2(""6(7)/H$$;</&#0#*;<&&&#/2$;2/)$8%:*%"$ )(%\'#($\'#(#\'#("\'#&\'#.Û &%;"/y#$;</&#0#*;<&&&#/c$2+""6+7,.) &2-""6-7./H$$;</&#0#*;<&&&#/2$;2/)$8%:/%"$ )(%\'#($\'#(#\'#("\'#&\'#.u &%;"/Y#$;</&#0#*;<&&&#/C$20""6071.) &22""6273/($8#:4#!")(#\'#("\'#&\'#./ &%;"/\' 8!:%!! )'),peg$decode('%;#/‘#$;</&#0#*;<&&&#/{$25""6576.A &27""6778.5 &29""697:.) &2;""6;7</H$$;</&#0#*;<&&&#/2$;"/)$8%:=%"$ )(%\'#($\'#(#\'#("\'#&\'#.# &;#'),peg$decode('%;$/‘#$;</&#0#*;<&&&#/{$2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E/H$$;</&#0#*;<&&&#/2$;#/)$8%:F%"$ )(%\'#($\'#(#\'#("\'#&\'#.# &;$'),peg$decode(';%.b &%2G""6G7H/R#;;/I$;"/@$;;/7$2I""6I7J/($8%:K%!")(%\'#($\'#(#\'#("\'#&\'#'),peg$decode(";..Y &;/.S &;&.M &;'.G &;(.A &;).; &;*.5 &;+./ &;,.) &;-.# &;0"),peg$decode('%;1/_#;;/V$2L""6L7M.) &2N""6N7O/;$;;/2$;2/)$8%:P%"$ )(%\'#($\'#(#\'#("\'#&\'#'),peg$decode('%;1/_#;;/V$2Q""6Q7R.) &2S""6S7T/;$;;/2$;2/)$8%:U%"$ )(%\'#($\'#(#\'#("\'#&\'#'),peg$decode('%;1/d#;;/[$2L""6L7M.) &2N""6N7O/@$;;/7$2V""6V7W/($8%:X%!$)(%\'#($\'#(#\'#("\'#&\'#.ċ &%;2/ā#$;</&#0#*;<&&&#/ë$%2Y""6Y7Z/m#$;</&#0#*;<&&&#/W$2[""6[7\\/H$$;</&#0#*;<&&&#/2$2]""6]7^/#$+%)(%\'#($\'#(#\'#("\'#&\'#.} &%2_""6_7`/m#$;</&#0#*;<&&&#/W$2a""6a7b/H$$;</&#0#*;<&&&#/2$2c""6c7d/#$+%)(%\'#($\'#(#\'#("\'#&\'#/($8#:X#!")(#\'#("\'#&\'#'),peg$decode('%;1/d#;;/[$2Q""6Q7R.) &2S""6S7T/@$;;/7$2V""6V7W/($8%:e%!$)(%\'#($\'#(#\'#("\'#&\'#.Á &%;2/·#$;</&#0#*;<&&&#/¡$%2Y""6Y7Z/H#$;</&#0#*;<&&&#/2$2]""6]7^/#$+#)(#\'#("\'#&\'#.X &%2_""6_7`/H#$;</&#0#*;<&&&#/2$2c""6c7d/#$+#)(#\'#("\'#&\'#/($8#:e#!")(#\'#("\'#&\'#'),peg$decode('%;1/q#;;/h$2f""6f7g.5 &2h""6h7i.) &2j""6j7k/A$;;/8$;2.# &;8/)$8%:l%"$ )(%\'#($\'#(#\'#("\'#&\'#.‰ &%;2/#$;</&#0#*;<&&&#/i$2m""6m7n.) &2o""6o7p/N$$;</&#0#*;<&&&#/8$;2.# &;8/)$8%:l%"$ )(%\'#($\'#(#\'#("\'#&\'#'),peg$decode("%2h\"\"6h7i/ƒ#;;/z$;2/q$;;/h$2f\"\"6f7g.5 &2h\"\"6h7i.) &2j\"\"6j7k/A$;;/8$;2.# &;8/)$8':q'\"$ )(''#(&'#(%'#($'#(#'#(\"'#&'#"),peg$decode("%;1/Y#;;/P$2r\"\"6r7s/A$;;/8$;2.# &;8/)$8%:t%\"$ )(%'#($'#(#'#(\"'#&'#.ç &%;2/Ý#$;</&#0#*;<&&&#/Ç$%2[\"\"6[7\\/H#$;</&#0#*;<&&&#/2$2m\"\"6m7n/#$+#)(#'#(\"'#&'#.X &%2a\"\"6a7b/H#$;</&#0#*;<&&&#/2$2o\"\"6o7p/#$+#)(#'#(\"'#&'#/N$$;</&#0#*;<&&&#/8$;2.# &;8/)$8%:t%\"$ )(%'#($'#(#'#(\"'#&'#"),peg$decode("%;2/S#;;/J$2u\"\"6u7v/;$;;/2$;2/)$8%:w%\"$ )(%'#($'#(#'#(\"'#&'#"),peg$decode("%2x\"\"6x7y/R#;;/I$2u\"\"6u7v/:$;;/1$;2/($8%:z%! )(%'#($'#(#'#(\"'#&'#"),peg$decode('%2{""6{7|.A &2}""6}7~.5 &2""67€.) &2""67‚/S#;;/J$2u""6u7v/;$;;/2$;2/)$8%:ƒ%"$ )(%\'#($\'#(#\'#("\'#&\'#'),peg$decode("%;2/' 8!:„!! )"),peg$decode('<%$4†""5!7‡/,#0)*4†""5!7‡&&&#/\' 8!:ˆ!! ).…
14 &%%2‰""6‰7Š/;#;3/2$2‰""6‰7Š/#$+#)(#\'#("\'#&\'#.K &%2‹""6‹7Œ/;#;4/2$2‹""6‹7Œ/#$+#)(#\'#("\'#&\'#/\' 8!:!! )=." 7…
15'),peg$decode('<%$4""5!7/,#0)*4""5!7&&&#/\' 8!:ˆ!! ).…
16 &%%2‰""6‰7Š/;#;3/2$2‰""6‰7Š/#$+#)(#\'#("\'#&\'#.K &%2‹""6‹7Œ/;#;4/2$2‹""6‹7Œ/#$+#)(#\'#("\'#&\'#/\' 8!:!! )=." 7Ž'),peg$decode("%$;50#*;5&/' 8!:‘!! )"),peg$decode("%$;60#*;6&/' 8!:‘!! )"),peg$decode('%%<2‰""6‰7Š.) &2’""6’7“=.##&&!&\'#/6#1""5!7”/($8":•"! )("\'#&\'#.A &%2’""6’7“/1#;7/($8":–"! )("\'#&\'#'),peg$decode('%%<2‹""6‹7Œ.) &2’""6’7“=.##&&!&\'#/6#1""5!7”/($8":•"! )("\'#&\'#.A &%2’""6’7“/1#;7/($8":–"! )("\'#&\'#'),peg$decode('%4—""5!7˜/\' 8!:™!! )'),peg$decode('<%%2š""6š7›/U#;9/L$2š""6š7›/=$2œ""6œ7.# & ž." &"/#$+$)($\'#(#\'#("\'#&\'#/\' 8!:Ÿ!! )=." 7Ž'),peg$decode("%$;:/&#0#*;:&&&#/' 8!:‘!! )"),peg$decode('%%<2š""6š7›.) &2 ""6 7¡=.##&&!&\'#/6#1""5!7”/($8":•"! )("\'#&\'#.4 &%2 ""6 7¡/& 8!:¢! )'),peg$decode('<$;<0#*;<&=." 7£'),peg$decode('<4¤""5!7¥=." 7£')],peg$currPos=0,peg$savedPos=0,peg$posDetailsCache=[{line:1,column:1,seenCR:false}],peg$maxFailPos=0,peg$maxFailExpected=[],peg$silentFails=0,peg$result;if("startRule"in options){if(!(options.startRule in peg$startRuleIndices)){throw new Error("Can't start parsing from rule \""+options.startRule+'".')}peg$startRuleIndex=peg$startRuleIndices[options.startRule]}function text(){return input.substring(peg$savedPos,peg$currPos)}function location(){return peg$computeLocation(peg$savedPos,peg$currPos)}function expected(description){throw peg$buildException(null,[{type:"other",description:description}],input.substring(peg$savedPos,peg$currPos),peg$computeLocation(peg$savedPos,peg$currPos))}function error(message){throw peg$buildException(message,null,input.substring(peg$savedPos,peg$currPos),peg$computeLocation(peg$savedPos,peg$currPos))}function peg$computePosDetails(pos){var details=peg$posDetailsCache[pos],p,ch;if(details){return details}else{p=pos-1;while(!peg$posDetailsCache[p]){p--}details=peg$posDetailsCache[p];details={line:details.line,column:details.column,seenCR:details.seenCR};while(p<pos){ch=input.charAt(p);if(ch==="\n"){if(!details.seenCR){details.line++}details.column=1;details.seenCR=false}else if(ch==="\r"||ch==="\u2028"||ch==="\u2029"){details.line++;details.column=1;details.seenCR=true}else{details.column++;details.seenCR=false}p++}peg$posDetailsCache[pos]=details;return details}}function peg$computeLocation(startPos,endPos){var startPosDetails=peg$computePosDetails(startPos),endPosDetails=peg$computePosDetails(endPos);return{start:{offset:startPos,line:startPosDetails.line,column:startPosDetails.column},end:{offset:endPos,line:endPosDetails.line,column:endPosDetails.column}}}function peg$fail(expected){if(peg$currPos<peg$maxFailPos){return}if(peg$currPos>peg$maxFailPos){peg$maxFailPos=peg$currPos;peg$maxFailExpected=[]}peg$maxFailExpected.push(expected)}function peg$buildException(message,expected,found,location){function cleanupExpected(expected){var i=1;expected.sort(function(a,b){if(a.description<b.description){return-1}else if(a.description>b.description){return 1}else{return 0}});while(i<expected.length){if(expected[i-1]===expected[i]){expected.splice(i,1)}else{i++}}}function buildMessage(expected,found){function stringEscape(s){function hex(ch){return ch.charCodeAt(0).toString(16).toUpperCase()}return s.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(ch){return"\\x0"+hex(ch)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(ch){return"\\x"+hex(ch)}).replace(/[\u0100-\u0FFF]/g,function(ch){return"\\u0"+hex(ch)}).replace(/[\u1000-\uFFFF]/g,function(ch){return"\\u"+hex(ch)})}var expectedDescs=new Array(expected.length),expectedDesc,foundDesc,i;for(i=0;i<expected.length;i++){expectedDescs[i]=expected[i].description}expectedDesc=expected.length>1?expectedDescs.slice(0,-1).join(", ")+" or "+expectedDescs[expected.length-1]:expectedDescs[0];foundDesc=found?'"'+stringEscape(found)+'"':"end of input";return"Expected "+expectedDesc+" but "+foundDesc+" found."}if(expected!==null){cleanupExpected(expected)}return new peg$SyntaxError(message!==null?message:buildMessage(expected,found),expected,found,location)}function peg$decode(s){var bc=new Array(s.length),i;for(i=0;i<s.length;i++){bc[i]=s.charCodeAt(i)-32}return bc}function peg$parseRule(index){var bc=peg$bytecode[index],ip=0,ips=[],end=bc.length,ends=[],stack=[],params,i;while(true){while(ip<end){switch(bc[ip]){case 0:stack.push(peg$consts[bc[ip+1]]);ip+=2;break;case 1:stack.push(void 0);ip++;break;case 2:stack.push(null);ip++;break;case 3:stack.push(peg$FAILED);ip++;break;case 4:stack.push([]);ip++;break;case 5:stack.push(peg$currPos);ip++;break;case 6:stack.pop();ip++;break;case 7:peg$currPos=stack.pop();ip++;break;case 8:stack.length-=bc[ip+1];ip+=2;break;case 9:stack.splice(-2,1);ip++;break;case 10:stack[stack.length-2].push(stack.pop());ip++;break;case 11:stack.push(stack.splice(stack.length-bc[ip+1],bc[ip+1]));ip+=2;break;case 12:stack.push(input.substring(stack.pop(),peg$currPos));ip++;break;case 13:ends.push(end);ips.push(ip+3+bc[ip+1]+bc[ip+2]);if(stack[stack.length-1]){end=ip+3+bc[ip+1];ip+=3}else{end=ip+3+bc[ip+1]+bc[ip+2];ip+=3+bc[ip+1]}break;case 14:ends.push(end);ips.push(ip+3+bc[ip+1]+bc[ip+2]);if(stack[stack.length-1]===peg$FAILED){end=ip+3+bc[ip+1];ip+=3}else{end=ip+3+bc[ip+1]+bc[ip+2];ip+=3+bc[ip+1]}break;case 15:ends.push(end);ips.push(ip+3+bc[ip+1]+bc[ip+2]);if(stack[stack.length-1]!==peg$FAILED){end=ip+3+bc[ip+1];ip+=3}else{end=ip+3+bc[ip+1]+bc[ip+2];ip+=3+bc[ip+1]}break;case 16:if(stack[stack.length-1]!==peg$FAILED){ends.push(end);ips.push(ip);end=ip+2+bc[ip+1];ip+=2}else{ip+=2+bc[ip+1]}break;case 17:ends.push(end);ips.push(ip+3+bc[ip+1]+bc[ip+2]);if(input.length>peg$currPos){end=ip+3+bc[ip+1];ip+=3}else{end=ip+3+bc[ip+1]+bc[ip+2];ip+=3+bc[ip+1]}break;case 18:ends.push(end);ips.push(ip+4+bc[ip+2]+bc[ip+3]);if(input.substr(peg$currPos,peg$consts[bc[ip+1]].length)===peg$consts[bc[ip+1]]){end=ip+4+bc[ip+2];ip+=4}else{end=ip+4+bc[ip+2]+bc[ip+3];ip+=4+bc[ip+2]}break;case 19:ends.push(end);ips.push(ip+4+bc[ip+2]+bc[ip+3]);if(input.substr(peg$currPos,peg$consts[bc[ip+1]].length).toLowerCase()===peg$consts[bc[ip+1]]){end=ip+4+bc[ip+2];ip+=4}else{end=ip+4+bc[ip+2]+bc[ip+3];ip+=4+bc[ip+2]}break;case 20:ends.push(end);ips.push(ip+4+bc[ip+2]+bc[ip+3]);if(peg$consts[bc[ip+1]].test(input.charAt(peg$currPos))){end=ip+4+bc[ip+2];ip+=4}else{end=ip+4+bc[ip+2]+bc[ip+3];ip+=4+bc[ip+2]}break;case 21:stack.push(input.substr(peg$currPos,bc[ip+1]));peg$currPos+=bc[ip+1];ip+=2;break;case 22:stack.push(peg$consts[bc[ip+1]]);peg$currPos+=peg$consts[bc[ip+1]].length;ip+=2;break;case 23:stack.push(peg$FAILED);if(peg$silentFails===0){peg$fail(peg$consts[bc[ip+1]])}ip+=2;break;case 24:peg$savedPos=stack[stack.length-1-bc[ip+1]];ip+=2;break;case 25:peg$savedPos=peg$currPos;ip++;break;case 26:params=bc.slice(ip+4,ip+4+bc[ip+3]);for(i=0;i<bc[ip+3];i++){params[i]=stack[stack.length-1-params[i]]}stack.splice(stack.length-bc[ip+2],bc[ip+2],peg$consts[bc[ip+1]].apply(null,params));ip+=4+bc[ip+3];break;case 27:stack.push(peg$parseRule(bc[ip+1]));ip+=2;break;case 28:peg$silentFails++;ip++;break;case 29:peg$silentFails--;ip++;break;default:throw new Error("Invalid opcode: "+bc[ip]+".")}}if(ends.length>0){end=ends.pop();ip=ips.pop()}else{break}}return stack[0]}peg$result=peg$parseRule(peg$startRuleIndex);if(peg$result!==peg$FAILED&&peg$currPos===input.length){return peg$result}else{if(peg$result!==peg$FAILED&&peg$currPos<input.length){peg$fail({type:"end",description:"end of input"})}throw peg$buildException(null,peg$maxFailExpected,peg$maxFailPos<input.length?input.charAt(peg$maxFailPos):null,peg$maxFailPos<input.length?peg$computeLocation(peg$maxFailPos,peg$maxFailPos+1):peg$computeLocation(peg$maxFailPos,peg$maxFailPos))}}return{SyntaxError:peg$SyntaxError,parse:peg$parse}}()},{}]},{},[2])(2)});
17+var overpassWizard=function(){"use strict";function e(r,n,t,u){this.message=r,this.expected=n,this.found=t,this.location=u,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}function r(e){var r={};if(e||(e={}),!e){if("undefined"==typeof $)return!1;try{$.ajax("data/iD_presets.json",{async:!1,dataType:"json"}).success((function(r){e=r})).error((function(){throw new Error}))}catch(e){console.error("failed to load presets file","data/iD_presets.json",e)}}return Object.keys(e).map((function(r){var n=e[r];n.nameCased=n.name,n.name=n.name.toLowerCase(),n.terms=n.terms?n.terms.map((function(e){return e.toLowerCase()})):[]})),function(){if("undefined"!=typeof $&&"undefined"!=typeof i18n){var r=i18n.getLanguage();if("en"!=r){var n="data/iD_presets_"+r+".json";try{$.ajax(n,{async:!1,dataType:"json"}).success((function(r){Object.keys(r).map((function(n){var t=r[n];(n=e[n]).translated=!0;var u=n.name;n.nameCased=t.name,n.name=t.name.toLowerCase(),t.terms&&(n.terms=t.terms.split(",").map((function(e){return e.trim().toLowerCase()})).concat(n.terms)),n.terms.unshift(u)}))})).error((function(){throw new Error}))}catch(e){console.error("failed to load preset translations file: "+n)}}}}(),r.get_query_clause=function(r){var n=r.free.toLowerCase(),t=Object.keys(e).map((function(r){return e[r]})).filter((function(e){return!1!==e.searchable&&(e.name===n||(e._termsIndex=e.terms.indexOf(n),-1!=e._termsIndex))}));if(0===t.length)return!1;t.sort((function(e,r){return e.name===n?-1:r.name===n?1:e._termsIndex-r._termsIndex}));var u=t[0],a=[];return u.geometry.forEach((function(e){switch(e){case"point":case"vertex":a.push("node");break;case"line":a.push("way");break;case"area":a.push("way"),a.push("relation");break;case"relation":a.push("relation");break;default:console.error("unknown geometry type "+e+" of preset "+u.name)}})),{types:a.filter((function(e,r,n){return n.indexOf(e)===r})),conditions:Object.keys(u.tags).map((function(e){var r=u.tags[e];return{query:"*"===r?"key":"eq",key:e,val:r}}))}},r.fuzzy_search=function(r){var n=r.free.toLowerCase(),t=2+Math.floor(n.length/7);function u(e){return levenshteinDistance(e,n)<=t}var a=Object.keys(e).map((function(r){return e[r]})).filter((function(e){return!1!==e.searchable&&(!!u(e.name)||e.terms.some(u))}));if(0===a.length)return!1;function o(e){return[e.name].concat(e.terms).map((function(e,r){return levenshteinDistance(e,n)})).reduce((function(e,r){return e<=r?e:r}))}return a.sort((function(e,r){return o(e)-o(r)})),a[0].nameCased},r}var n;return function(e,r){function n(){this.constructor=e}n.prototype=r.prototype,e.prototype=new n}(e,Error),e.buildMessage=function(e,r){var n={literal:function(e){return'"'+u(e.text)+'"'},class:function(e){var r=e.parts.map((function(e){return Array.isArray(e)?a(e[0])+"-"+a(e[1]):a(e)}));return"["+(e.inverted?"^":"")+r+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(e){return e.description}};function t(e){return e.charCodeAt(0).toString(16).toUpperCase()}function u(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+t(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+t(e)}))}function a(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+t(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+t(e)}))}function o(e){return n[e.type](e)}return"Expected "+function(e){var r,n,t=e.map(o);if(t.sort(),t.length>0){for(r=1,n=1;r<t.length;r++)t[r-1]!==t[r]&&(t[n]=t[r],n++);t.length=n}switch(t.length){case 1:return t[0];case 2:return t[0]+" or "+t[1];default:return t.slice(0,-1).join(", ")+", or "+t[t.length-1]}}(e)+" but "+function(e){return e?'"'+u(e)+'"':"end of input"}(r)+" found."},function(t,u){var a,o={comment:!0,outputMode:"geom",globalBbox:!0,timeout:25,maxsize:void 0,outputFormat:"json",aroundRadius:1e3,freeFormPresets:void 0};for(var s in u)o[s]=u[s];function i(e){return e.replace(/\*\//g,"[…]").replace(/\n/g,"\\n")}u=o;try{a=function(r,n){n=void 0!==n?n:{};var t,u,a,o,s={},i={start:0},c=0,l=[function(e){return e},"in bbox",y("in bbox",!1),"IN BBOX",y("IN BBOX",!1),function(e){return{bounds:"bbox",query:e}},"in",y("in",!1),"IN",y("IN",!1),function(e,r){return{bounds:"area",query:e,area:r}},"around",y("around",!1),"AROUND",y("AROUND",!1),function(e,r){return{bounds:"around",query:e,area:r}},"global",y("global",!1),"GLOBAL",y("GLOBAL",!1),function(e){return{bounds:"global",query:e}},"or",y("or",!1),"OR",y("OR",!1),"||",y("||",!1),"|",y("|",!1),function(e,r){return{logical:"or",queries:[e,r]}},"and",y("and",!1),"AND",y("AND",!1),"&&",y("&&",!1),"&",y("&",!1),function(e,r){return{logical:"and",queries:[e,r]}},"(",y("(",!1),")",y(")",!1),function(e){return e},"==",y("==",!1),"=",y("=",!1),function(e,r){return{query:"eq",key:e,val:r}},"!=",y("!=",!1),"<>",y("<>",!1),function(e,r){return{query:"neq",key:e,val:r}},"*",y("*",!1),function(e){return{query:"key",key:e}},"is",y("is",!1),"not",y("not",!1),"null",y("null",!1),"IS",y("IS",!1),"NOT",y("NOT",!1),"NULL",y("NULL",!1),function(e){return{query:"nokey",key:e}},"~=",y("~=",!1),"~",y("~",!1),"=~",y("=~",!1),function(e,r){return{query:"like",key:e,val:r.regex?r:{regex:r}}},"like",y("like",!1),"LIKE",y("LIKE",!1),function(e,r){return{query:"likelike",key:e.regex?e:{regex:e},val:r.regex?r:{regex:r}}},"!~",y("!~",!1),function(e,r){return{query:"notlike",key:e,val:r.regex?r:{regex:r}}},":",y(":",!1),function(e,r){return{query:"substr",key:e,val:r}},"type",y("type",!1),function(e){return{query:"type",type:e}},"user",y("user",!1),"uid",y("uid",!1),"newer",y("newer",!1),"id",y("id",!1),function(e,r){return{query:"meta",meta:e,val:r}},function(e){return{query:"free form",free:e}},k("Key"),/^[a-zA-Z0-9_:\-]/,m([["a","z"],["A","Z"],["0","9"],"_",":","-"],!1,!1),function(e){return e.join("")},'"',y('"',!1),"'",y("'",!1),function(e){return e[1]},k("string"),/^[^'" ()~=!*\/:<>&|[\]{}#+@$%?\^.,]/,m(["'",'"'," ","(",")","~","=","!","*","/",":","<",">","&","|","[","]","{","}","#","+","@","$","%","?","^",".",","],!0,!1),function(e){return e.join("")},"\\",y("\\",!1),{type:"any"},function(e){return e},function(e){return e},/^['"\\bfnrtv]/,m(["'",'"',"\\","b","f","n","r","t","v"],!1,!1),function(e){return e.replace("b","\b").replace("f","\f").replace("n","\n").replace("r","\r").replace("t","\t").replace("v","\v")},"/",y("/",!1),"i",y("i",!1),"",function(e){return{regex:e[1],modifier:e[3]}},"\\/",y("\\/",!1),function(){return"/"},k("whitespace"),/^[ \t\n\r]/,m([" ","\t","\n","\r"],!1,!1)],f=[q("%;;/:#;!/1$;;/($8#: #!!)(#'#(\"'#&'#"),q('%;"/Y#$;</&#0#*;<&&&#/C$2!""6!7".) &2#""6#7$/($8#:%#!")(#\'#("\'#&\'#.Ł &%;"/y#$;</&#0#*;<&&&#/c$2&""6&7\'.) &2(""6(7)/H$$;</&#0#*;<&&&#/2$;2/)$8%:*%"$ )(%\'#($\'#(#\'#("\'#&\'#.Û &%;"/y#$;</&#0#*;<&&&#/c$2+""6+7,.) &2-""6-7./H$$;</&#0#*;<&&&#/2$;2/)$8%:/%"$ )(%\'#($\'#(#\'#("\'#&\'#.u &%;"/Y#$;</&#0#*;<&&&#/C$20""6071.) &22""6273/($8#:4#!")(#\'#("\'#&\'#./ &%;"/\' 8!:%!! )'),q('%;#/‘#$;</&#0#*;<&&&#/{$25""6576.A &27""6778.5 &29""697:.) &2;""6;7</H$$;</&#0#*;<&&&#/2$;"/)$8%:=%"$ )(%\'#($\'#(#\'#("\'#&\'#.# &;#'),q('%;$/‘#$;</&#0#*;<&&&#/{$2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E/H$$;</&#0#*;<&&&#/2$;#/)$8%:F%"$ )(%\'#($\'#(#\'#("\'#&\'#.# &;$'),q(';%.b &%2G""6G7H/R#;;/I$;"/@$;;/7$2I""6I7J/($8%:K%!")(%\'#($\'#(#\'#("\'#&\'#'),q(";..Y &;/.S &;&.M &;'.G &;(.A &;).; &;*.5 &;+./ &;,.) &;-.# &;0"),q('%;1/_#;;/V$2L""6L7M.) &2N""6N7O/;$;;/2$;2/)$8%:P%"$ )(%\'#($\'#(#\'#("\'#&\'#'),q('%;1/_#;;/V$2Q""6Q7R.) &2S""6S7T/;$;;/2$;2/)$8%:U%"$ )(%\'#($\'#(#\'#("\'#&\'#'),q('%;1/d#;;/[$2L""6L7M.) &2N""6N7O/@$;;/7$2V""6V7W/($8%:X%!$)(%\'#($\'#(#\'#("\'#&\'#.ċ &%;2/ā#$;</&#0#*;<&&&#/ë$%2Y""6Y7Z/m#$;</&#0#*;<&&&#/W$2[""6[7\\/H$$;</&#0#*;<&&&#/2$2]""6]7^/#$+%)(%\'#($\'#(#\'#("\'#&\'#.} &%2_""6_7`/m#$;</&#0#*;<&&&#/W$2a""6a7b/H$$;</&#0#*;<&&&#/2$2c""6c7d/#$+%)(%\'#($\'#(#\'#("\'#&\'#/($8#:X#!")(#\'#("\'#&\'#'),q('%;1/d#;;/[$2Q""6Q7R.) &2S""6S7T/@$;;/7$2V""6V7W/($8%:e%!$)(%\'#($\'#(#\'#("\'#&\'#.Á &%;2/·#$;</&#0#*;<&&&#/¡$%2Y""6Y7Z/H#$;</&#0#*;<&&&#/2$2]""6]7^/#$+#)(#\'#("\'#&\'#.X &%2_""6_7`/H#$;</&#0#*;<&&&#/2$2c""6c7d/#$+#)(#\'#("\'#&\'#/($8#:e#!")(#\'#("\'#&\'#'),q('%;1/q#;;/h$2f""6f7g.5 &2h""6h7i.) &2j""6j7k/A$;;/8$;2.# &;8/)$8%:l%"$ )(%\'#($\'#(#\'#("\'#&\'#.‰ &%;2/#$;</&#0#*;<&&&#/i$2m""6m7n.) &2o""6o7p/N$$;</&#0#*;<&&&#/8$;2.# &;8/)$8%:l%"$ )(%\'#($\'#(#\'#("\'#&\'#'),q("%2h\"\"6h7i/‰#;;/€$;2.# &;8/q$;;/h$2f\"\"6f7g.5 &2h\"\"6h7i.) &2j\"\"6j7k/A$;;/8$;2.# &;8/)$8':q'\"$ )(''#(&'#(%'#($'#(#'#(\"'#&'#"),q("%;1/Y#;;/P$2r\"\"6r7s/A$;;/8$;2.# &;8/)$8%:t%\"$ )(%'#($'#(#'#(\"'#&'#.ç &%;2/Ý#$;</&#0#*;<&&&#/Ç$%2[\"\"6[7\\/H#$;</&#0#*;<&&&#/2$2m\"\"6m7n/#$+#)(#'#(\"'#&'#.X &%2a\"\"6a7b/H#$;</&#0#*;<&&&#/2$2o\"\"6o7p/#$+#)(#'#(\"'#&'#/N$$;</&#0#*;<&&&#/8$;2.# &;8/)$8%:t%\"$ )(%'#($'#(#'#(\"'#&'#"),q("%;2/S#;;/J$2u\"\"6u7v/;$;;/2$;2/)$8%:w%\"$ )(%'#($'#(#'#(\"'#&'#"),q("%2x\"\"6x7y/R#;;/I$2u\"\"6u7v/:$;;/1$;2/($8%:z%! )(%'#($'#(#'#(\"'#&'#"),q('%2{""6{7|.A &2}""6}7~.5 &2""67€.) &2""67‚/S#;;/J$2u""6u7v/;$;;/2$;2/)$8%:ƒ%"$ )(%\'#($\'#(#\'#("\'#&\'#'),q("%;2/' 8!:„!! )"),q('<%$4†""5!7‡/,#0)*4†""5!7‡&&&#/\' 8!:ˆ!! ).…
18 &%%2‰""6‰7Š/;#;3/2$2‰""6‰7Š/#$+#)(#\'#("\'#&\'#.K &%2‹""6‹7Œ/;#;4/2$2‹""6‹7Œ/#$+#)(#\'#("\'#&\'#/\' 8!:!! )=." 7…
19'),q('<%$4""5!7/,#0)*4""5!7&&&#/\' 8!:ˆ!! ).…
20 &%%2‰""6‰7Š/;#;3/2$2‰""6‰7Š/#$+#)(#\'#("\'#&\'#.K &%2‹""6‹7Œ/;#;4/2$2‹""6‹7Œ/#$+#)(#\'#("\'#&\'#/\' 8!:!! )=." 7Ž'),q("%$;50#*;5&/' 8!:‘!! )"),q("%$;60#*;6&/' 8!:‘!! )"),q('%%<2‰""6‰7Š.) &2’""6’7“=.##&&!&\'#/6#1""5!7”/($8":•"! )("\'#&\'#.A &%2’""6’7“/1#;7/($8":–"! )("\'#&\'#'),q('%%<2‹""6‹7Œ.) &2’""6’7“=.##&&!&\'#/6#1""5!7”/($8":•"! )("\'#&\'#.A &%2’""6’7“/1#;7/($8":–"! )("\'#&\'#'),q('%4—""5!7˜/\' 8!:™!! )'),q('<%%2š""6š7›/U#;9/L$2š""6š7›/=$2œ""6œ7.# & ž." &"/#$+$)($\'#(#\'#("\'#&\'#/\' 8!:Ÿ!! )=." 7Ž'),q("%$;:/&#0#*;:&&&#/' 8!:‘!! )"),q('%%<2š""6š7›.) &2 ""6 7¡=.##&&!&\'#/6#1""5!7”/($8":•"! )("\'#&\'#.4 &%2 ""6 7¡/& 8!:¢! )'),q('<$;<0#*;<&=." 7£'),q('<4¤""5!7¥=." 7£')],p=0,$=[{line:1,column:1}],h=0,d=[],g=0;if("startRule"in n){if(!(n.startRule in i))throw new Error("Can't start parsing from rule \""+n.startRule+'".');c=i[n.startRule]}function y(e,r){return{type:"literal",text:e,ignoreCase:r}}function m(e,r,n){return{type:"class",parts:e,inverted:r,ignoreCase:n}}function k(e){return{type:"other",description:e}}function b(e){var n,t=$[e];if(t)return t;for(n=e-1;!$[n];)n--;for(t={line:(t=$[n]).line,column:t.column};n<e;)10===r.charCodeAt(n)?(t.line++,t.column=1):t.column++,n++;return $[e]=t,t}function v(e,r){var n=b(e),t=b(r);return{start:{offset:e,line:n.line,column:n.column},end:{offset:r,line:t.line,column:t.column}}}function x(e){p<h||(p>h&&(h=p,d=[]),d.push(e))}function q(e){return e.split("").map((function(e){return e.charCodeAt(0)-32}))}if((t=function e(n){for(var t,u=f[n],a=0,o=[],i=u.length,c=[],$=[];;){for(;a<i;)switch(u[a]){case 0:$.push(l[u[a+1]]),a+=2;break;case 1:$.push(void 0),a++;break;case 2:$.push(null),a++;break;case 3:$.push(s),a++;break;case 4:$.push([]),a++;break;case 5:$.push(p),a++;break;case 6:$.pop(),a++;break;case 7:p=$.pop(),a++;break;case 8:$.length-=u[a+1],a+=2;break;case 9:$.splice(-2,1),a++;break;case 10:$[$.length-2].push($.pop()),a++;break;case 11:$.push($.splice($.length-u[a+1],u[a+1])),a+=2;break;case 12:$.push(r.substring($.pop(),p)),a++;break;case 13:c.push(i),o.push(a+3+u[a+1]+u[a+2]),$[$.length-1]?(i=a+3+u[a+1],a+=3):(i=a+3+u[a+1]+u[a+2],a+=3+u[a+1]);break;case 14:c.push(i),o.push(a+3+u[a+1]+u[a+2]),$[$.length-1]===s?(i=a+3+u[a+1],a+=3):(i=a+3+u[a+1]+u[a+2],a+=3+u[a+1]);break;case 15:c.push(i),o.push(a+3+u[a+1]+u[a+2]),$[$.length-1]!==s?(i=a+3+u[a+1],a+=3):(i=a+3+u[a+1]+u[a+2],a+=3+u[a+1]);break;case 16:$[$.length-1]!==s?(c.push(i),o.push(a),i=a+2+u[a+1],a+=2):a+=2+u[a+1];break;case 17:c.push(i),o.push(a+3+u[a+1]+u[a+2]),r.length>p?(i=a+3+u[a+1],a+=3):(i=a+3+u[a+1]+u[a+2],a+=3+u[a+1]);break;case 18:c.push(i),o.push(a+4+u[a+2]+u[a+3]),r.substr(p,l[u[a+1]].length)===l[u[a+1]]?(i=a+4+u[a+2],a+=4):(i=a+4+u[a+2]+u[a+3],a+=4+u[a+2]);break;case 19:c.push(i),o.push(a+4+u[a+2]+u[a+3]),r.substr(p,l[u[a+1]].length).toLowerCase()===l[u[a+1]]?(i=a+4+u[a+2],a+=4):(i=a+4+u[a+2]+u[a+3],a+=4+u[a+2]);break;case 20:c.push(i),o.push(a+4+u[a+2]+u[a+3]),l[u[a+1]].test(r.charAt(p))?(i=a+4+u[a+2],a+=4):(i=a+4+u[a+2]+u[a+3],a+=4+u[a+2]);break;case 21:$.push(r.substr(p,u[a+1])),p+=u[a+1],a+=2;break;case 22:$.push(l[u[a+1]]),p+=l[u[a+1]].length,a+=2;break;case 23:$.push(s),0===g&&x(l[u[a+1]]),a+=2;break;case 24:$[$.length-1-u[a+1]],a+=2;break;case 25:p,a++;break;case 26:t=u.slice(a+4,a+4+u[a+3]).map((function(e){return $[$.length-1-e]})),$.splice($.length-u[a+2],u[a+2],l[u[a+1]].apply(null,t)),a+=4+u[a+3];break;case 27:$.push(e(u[a+1])),a+=2;break;case 28:g++,a++;break;case 29:g--,a++;break;default:throw new Error("Invalid opcode: "+u[a]+".")}if(!(c.length>0))break;i=c.pop(),a=o.pop()}return $[0]}(c))!==s&&p===r.length)return t;throw t!==s&&p<r.length&&x({type:"end"}),u=d,a=h<r.length?r.charAt(h):null,o=h<r.length?v(h,h+1):v(h,h),new e(e.buildMessage(u,a),u,a,o)}(t)}catch(e){return console.error("couldn't parse wizard input",e),!1}var c,l,f,p=[];switch(!0===u.comment?(p.push("/*"),p.push("This has been generated by the overpass-turbo wizard."),p.push("The original search was:"),p.push("“"+i(t)+"”"),p.push("*/")):"string"==typeof u.comment&&(p.push("/*"),p.push(u.comment),p.push("*/"),comment=!0),p.push("[out:"+u.outputFormat+"][timeout:"+u.timeout+"]"+(void 0!==u.maxsize?"[maxsize:"+u.maxsize+"]":"")+(u.globalBbox&&"bbox"===a.bounds?"[bbox:{{bbox}}]":"")+";"),a.bounds){case"area":u.comment&&p.push("// fetch area “"+a.area+"” to search in"),p.push("{{geocodeArea:"+a.area+"}}->.searchArea;"),c="(area.searchArea)";break;case"around":u.comment&&p.push("// adjust the search radius (in meters) here"),p.push("{{radius="+u.aroundRadius+"}}"),c="(around:{{radius}},{{geocodeCoords:"+a.area+"}})";break;case"bbox":c=u.globalBbox?"":"({{bbox}})";break;case"global":c=void 0;break;default:return console.error("unknown bounds condition: "+a.bounds),!1}function $(e){function r(e){return e.replace(/([()[{*+.$^\\|?])/g,"\\$1")}function n(e){if("string"==typeof e)return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\t/g,"\\t").replace(/\n/g,"\\n")}var t=n(e.key),u=n(e.val);switch("substr"===e.query&&(e.query="like",e.val={regex:r(e.val)}),""===u&&("eq"===e.query?(e.query="like",e.val={regex:"^$"}):"neq"===e.query&&(e.query="notlike",e.val={regex:"^$"})),""===t&&("key"===e.query?(e.query="likelike",e.key={regex:"^$"},e.val={regex:".*"}):"eq"===e.query?(e.query="likelike",e.key={regex:"^$"},e.val={regex:"^"+r(e.val)+"$"}):"like"===e.query&&(e.query="likelike",e.key={regex:"^$"})),e.query){case"key":return'["'+t+'"]';case"nokey":return'["'+t+'"!~".*"]';case"eq":return'["'+t+'"="'+u+'"]';case"neq":return'["'+t+'"!="'+u+'"]';case"like":return'["'+t+'"~"'+n(e.val.regex)+'"'+("i"===e.val.modifier?",i":"")+"]";case"likelike":return(e.key.modifier||"")==(e.val.modifier||"")?'[~"'+n(e.key.regex)+'"~"'+n(e.val.regex)+'"'+("i"===e.val.modifier?",i":"")+"]":"i"===e.val.modifier?'[~"'+n(e.key.regex)+'"~"'+n(e.val.regex)+'",i][~"'+n(e.key.regex)+'"~".*"]':'[~"'+n(e.key.regex)+'"~"'+n(e.val.regex)+'",i][~".*"~"'+n(e.val.regex)+'"]';case"notlike":return'["'+t+'"!~"'+n(e.val.regex)+'"'+("i"===e.val.modifier?",i":"")+"]";case"meta":switch(e.meta){case"id":return"("+u+")";case"newer":return e.val.match(/^-?\d+ ?(seconds?|minutes?|hours?|days?|weeks?|months?|years?)?$/)?'(newer:"{{date:'+u+'}}")':'(newer:"'+u+'")';case"user":return'(user:"'+u+'")';case"uid":return"(uid:"+u+")";default:return console.error("unknown query type: meta/"+e.meta),!1}case"free form":default:return console.error("unknown query type: "+e.query),!1}}function h(e){function r(e){return null===e.match(/^[a-zA-Z0-9_]+$/)?'"'+e.replace(/"/g,'\\"')+'"':e}function n(e){return null===e.regex.match(/^[a-zA-Z0-9_]+$/)||e.modifier?"/"+e.regex.replace(/\//g,"\\/")+"/"+(e.modifier||""):e.regex}switch(e.query){case"key":return i(r(e.key)+"=*");case"nokey":return i(r(e.key)+"!=*");case"eq":return i(r(e.key)+"="+r(e.val));case"neq":return i(r(e.key)+"!="+r(e.val));case"like":return i(r(e.key)+"~"+n(e.val));case"likelike":return i("~"+n(e.key)+"~"+n(e.val));case"notlike":return i(r(e.key)+"!~"+n(e.val));case"substr":return i(r(e.key)+":"+r(e.val));case"meta":switch(e.meta){case"id":return i("id:"+r(e.val));case"newer":return i("newer:"+r(e.val));case"user":return i("user:"+r(e.val));case"uid":return i("uid:"+r(e.val));default:return""}case"free form":return i(r(e.free));default:return""}}a.query=(l=a.query,(f={logical:"or",queries:[]}).queries=function e(r){if(!r.logical)return[{logical:"and",queries:[r]}];if("and"===r.logical){for(var n=e(r.queries[0]),t=e(r.queries[1]),u=[],a=0;a<n.length;a++)for(var o=0;o<t.length;o++)u.push({logical:"and",queries:n[a].queries.concat(t[o].queries)});return u}if("or"===r.logical)return n=e(r.queries[0]),t=e(r.queries[1]),[].concat(n,t);console.error("unsupported boolean operator: "+r.logical)}(l),f),u.comment&&p.push("// gather results"),p.push("(");for(var d=0;d<a.query.queries.length;d++){for(var g=a.query.queries[d],y=["node","way","relation"],m=[],k=[],b=0;b<g.queries.length;b++){var v=g.queries[b];if("free form"===v.query){n||(n=r(u.freeFormPresets));var x=n.get_query_clause(v);if(!1===x)return console.error("Couldn't find preset for free form input: "+v.free),!1;y=y.filter((function(e){return-1!=x.types.indexOf(e)})),u.comment&&k.push(h(v)),m=m.concat(x.conditions.map((function(e){return $(e)})))}else if("type"===v.query)y=-1!=y.indexOf(v.type)?[v.type]:[];else{u.comment&&k.push(h(v));var q=$(v);if(!1===q)return!1;m.push(q)}}k=k.join(" and "),u.comment&&p.push(" // query part for: “"+k+"”"),!1!==u.compactNWR&&3===y.length&&(y=["nwr"]);for(var w=0;w<y.length;w++){for(var A=" "+y[w],_=0;_<m.length;_++)A+=m[_];c&&(A+=c),A+=";",p.push(A)}}return p.push(");"),u.comment&&p.push("// print results"),"recursive"===u.outputMode?(p.push("out body;"),p.push(">;"),p.push("out skel qt;")):"recursive_meta"===u.outputMode?(p.push("(._;>;);"),p.push("out meta;")):p.push("out "+u.outputMode+";"),p.join("\n")}}();
21diff --git a/src/org/openstreetmap/josm/tools/OverpassTurboQueryWizard.java b/src/org/openstreetmap/josm/tools/OverpassTurboQueryWizard.java
22index ba16a2efc..fc4c340f8 100644
23--- a/src/org/openstreetmap/josm/tools/OverpassTurboQueryWizard.java
24+++ b/src/org/openstreetmap/josm/tools/OverpassTurboQueryWizard.java
25@@ -42,8 +42,8 @@ private OverpassTurboQueryWizard() {
26 engine.eval("var console = {error: " + Logging.class.getCanonicalName() + ".warn};");
27 engine.eval("var global = {};");
28 engine.eval(reader);
29- engine.eval("var overpassWizard = function(query) {" +
30- " return global.overpassWizard(query, {" +
31+ engine.eval("var overpassWizardJOSM = function(query) {" +
32+ " return overpassWizard(query, {" +
33 " comment: false," +
34 " timeout: " + Config.getPref().getInt("overpass.wizard.timeout", 90) + "," +
35 " outputFormat: 'xml'," +
36@@ -67,7 +67,7 @@ public String constructQuery(String search) {
37 throw new IllegalStateException("Failed to retrieve JavaScript engine");
38 }
39 try {
40- final Object result = ((Invocable) engine).invokeFunction("overpassWizard", search);
41+ final Object result = ((Invocable) engine).invokeFunction("overpassWizardJOSM", search);
42 if (Boolean.FALSE.equals(result)) {
43 throw new UncheckedParseException();
44 }
45diff --git a/test/unit/org/openstreetmap/josm/tools/OverpassTurboQueryWizardTest.java b/test/unit/org/openstreetmap/josm/tools/OverpassTurboQueryWizardTest.java
46index 83343c176..90a3a2a65 100644
47--- a/test/unit/org/openstreetmap/josm/tools/OverpassTurboQueryWizardTest.java
48+++ b/test/unit/org/openstreetmap/josm/tools/OverpassTurboQueryWizardTest.java
49@@ -30,9 +30,7 @@ public void testKeyValue() {
50 assertEquals("" +
51 "[out:xml][timeout:90][bbox:{{bbox}}];\n" +
52 "(\n" +
53- " node[\"amenity\"=\"drinking_water\"];\n" +
54- " way[\"amenity\"=\"drinking_water\"];\n" +
55- " relation[\"amenity\"=\"drinking_water\"];\n" +
56+ " nwr[\"amenity\"=\"drinking_water\"];\n" +
57 ");\n" +
58 "(._;>;);\n" +
59 "out meta;", query);
60@@ -47,9 +45,7 @@ public void testKeyNotValue() {
61 assertEquals("" +
62 "[out:xml][timeout:90][bbox:{{bbox}}];\n" +
63 "(\n" +
64- " node[\"amenity\"!=\"drinking_water\"];\n" +
65- " way[\"amenity\"!=\"drinking_water\"];\n" +
66- " relation[\"amenity\"!=\"drinking_water\"];\n" +
67+ " nwr[\"amenity\"!=\"drinking_water\"];\n" +
68 ");\n" +
69 "(._;>;);\n" +
70 "out meta;", query);
71@@ -63,9 +59,7 @@ public void testBooleanAnd() {
72 final String expected = "" +
73 "[out:xml][timeout:90][bbox:{{bbox}}];\n" +
74 "(\n" +
75- " node[\"foo\"=\"bar\"][\"baz\"=\"42\"];\n" +
76- " way[\"foo\"=\"bar\"][\"baz\"=\"42\"];\n" +
77- " relation[\"foo\"=\"bar\"][\"baz\"=\"42\"];\n" +
78+ " nwr[\"foo\"=\"bar\"][\"baz\"=\"42\"];\n" +
79 ");\n" +
80 "(._;>;);\n" +
81 "out meta;";
82@@ -82,12 +76,8 @@ public void testBooleanOr() {
83 final String expected = "" +
84 "[out:xml][timeout:90][bbox:{{bbox}}];\n" +
85 "(\n" +
86- " node[\"foo\"=\"bar\"];\n" +
87- " way[\"foo\"=\"bar\"];\n" +
88- " relation[\"foo\"=\"bar\"];\n" +
89- " node[\"baz\"=\"42\"];\n" +
90- " way[\"baz\"=\"42\"];\n" +
91- " relation[\"baz\"=\"42\"];\n" +
92+ " nwr[\"foo\"=\"bar\"];\n" +
93+ " nwr[\"baz\"=\"42\"];\n" +
94 ");\n" +
95 "(._;>;);\n" +
96 "out meta;";
97@@ -105,18 +95,10 @@ public void testBoolean() {
98 assertEquals("" +
99 "[out:xml][timeout:90][bbox:{{bbox}}];\n" +
100 "(\n" +
101- " node[\"foo\"][\"asd\"];\n" +
102- " way[\"foo\"][\"asd\"];\n" +
103- " relation[\"foo\"][\"asd\"];\n" +
104- " node[\"foo\"][\"fasd\"];\n" +
105- " way[\"foo\"][\"fasd\"];\n" +
106- " relation[\"foo\"][\"fasd\"];\n" +
107- " node[\"bar\"][\"asd\"];\n" +
108- " way[\"bar\"][\"asd\"];\n" +
109- " relation[\"bar\"][\"asd\"];\n" +
110- " node[\"bar\"][\"fasd\"];\n" +
111- " way[\"bar\"][\"fasd\"];\n" +
112- " relation[\"bar\"][\"fasd\"];\n" +
113+ " nwr[\"foo\"][\"asd\"];\n" +
114+ " nwr[\"foo\"][\"fasd\"];\n" +
115+ " nwr[\"bar\"][\"asd\"];\n" +
116+ " nwr[\"bar\"][\"fasd\"];\n" +
117 ");\n" +
118 "(._;>;);\n" +
119 "out meta;", query);
120@@ -147,12 +129,8 @@ public void testUser() {
121 assertEquals("" +
122 "[out:xml][timeout:90][bbox:{{bbox}}];\n" +
123 "(\n" +
124- " node(user:\"foo\");\n" +
125- " way(user:\"foo\");\n" +
126- " relation(user:\"foo\");\n" +
127- " node(uid:42);\n" +
128- " way(uid:42);\n" +
129- " relation(uid:42);\n" +
130+ " nwr(user:\"foo\");\n" +
131+ " nwr(uid:42);\n" +
132 ");\n" +
133 "(._;>;);\n" +
134 "out meta;", query);
135@@ -183,9 +161,7 @@ public void testInArea() {
136 "[out:xml][timeout:90];\n" +
137 "{{geocodeArea:Josmland}}->.searchArea;\n" +
138 "(\n" +
139- " node[\"foo\"=\"bar\"](area.searchArea);\n" +
140- " way[\"foo\"=\"bar\"](area.searchArea);\n" +
141- " relation[\"foo\"=\"bar\"](area.searchArea);\n" +
142+ " nwr[\"foo\"=\"bar\"](area.searchArea);\n" +
143 ");\n" +
144 "(._;>;);\n" +
145 "out meta;", query);
146@@ -201,9 +177,7 @@ public void testPreset() {
147 assertEquals("" +
148 "[out:xml][timeout:90];\n" +
149 "(\n" +
150- " node[\"amenity\"=\"hospital\"];\n" +
151- " way[\"amenity\"=\"hospital\"];\n" +
152- " relation[\"amenity\"=\"hospital\"];\n" +
153+ " nwr[\"amenity\"=\"hospital\"];\n" +
154 ");\n" +
155 "(._;>;);\n" +
156 "out meta;", query);