+ pane.key = function(val) {
+ if (!arguments.length)
+ return _key;
+ _key = val;
+ return pane;
+ };
+ pane.description = function(val) {
+ if (!arguments.length)
+ return _description;
+ _description = val;
+ return pane;
+ };
+ pane.iconName = function(val) {
+ if (!arguments.length)
+ return _iconName;
+ _iconName = val;
+ return pane;
+ };
+ pane.sections = function(val) {
+ if (!arguments.length)
+ return _sections;
+ _sections = val;
+ return pane;
+ };
+ pane.selection = function() {
+ return _paneSelection;
+ };
+ function hidePane() {
+ context.ui().togglePanes();
+ }
+ pane.togglePane = function(d3_event) {
+ if (d3_event)
+ d3_event.preventDefault();
+ _paneTooltip.hide();
+ context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
+ };
+ pane.renderToggleButton = function(selection2) {
+ if (!_paneTooltip) {
+ _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _description).keys([_key]);
+ }
+ selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
+ };
+ pane.renderContent = function(selection2) {
+ if (_sections) {
+ _sections.forEach(function(section) {
+ selection2.call(section.render);
+ });
+ }
+ };
+ pane.renderPane = function(selection2) {
+ _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
+ var heading = _paneSelection.append("div").attr("class", "pane-heading");
+ heading.append("h2").text("").call(_label);
+ heading.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
+ _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
+ if (_key) {
+ context.keybinding().on(_key, pane.togglePane);
+ }
+ };
+ return pane;
+ }
+
+ // modules/ui/sections/background_display_options.js
+ function uiSectionBackgroundDisplayOptions(context) {
+ var section = uiSection("background-display-options", context).label(() => _t.append("background.display_options")).disclosureContent(renderDisclosureContent);
+ var _storedOpacity = corePreferences("background-opacity");
+ var _minVal = 0;
+ var _maxVal = 3;
+ var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
+ var _options = {
+ brightness: _storedOpacity !== null ? +_storedOpacity : 1,
+ contrast: 1,
+ saturation: 1,
+ sharpness: 1
+ };
+ function clamp3(x2, min3, max3) {
+ return Math.max(min3, Math.min(x2, max3));
+ }
+ function updateValue(d2, val) {
+ val = clamp3(val, _minVal, _maxVal);
+ _options[d2] = val;
+ context.background()[d2](val);
+ if (d2 === "brightness") {
+ corePreferences("background-opacity", val);
+ }
+ section.reRender();
+ }
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".display-options-container").data([0]);
+ var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
+ var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d2) {
+ return "display-control display-control-" + d2;
+ });
+ slidersEnter.html(function(d2) {
+ return _t.html("background." + d2);
+ }).append("span").attr("class", function(d2) {
+ return "display-option-value display-option-value-" + d2;
+ });
+ var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
+ sildersControlEnter.append("input").attr("class", function(d2) {
+ return "display-option-input display-option-input-" + d2;
+ }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.05").on("input", function(d3_event, d2) {
+ var val = select_default2(this).property("value");
+ if (!val && d3_event && d3_event.target) {
+ val = d3_event.target.value;
+ }
+ updateValue(d2, val);
+ });
+ sildersControlEnter.append("button").attr("title", function(d2) {
+ return `${_t("background.reset")} ${_t("background." + d2)}`;
+ }).attr("class", function(d2) {
+ return "display-option-reset display-option-reset-" + d2;
+ }).on("click", function(d3_event, d2) {
+ if (d3_event.button !== 0)
+ return;
+ updateValue(d2, 1);
+ }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
+ containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ for (var i3 = 0; i3 < _sliders.length; i3++) {
+ updateValue(_sliders[i3], 1);
+ }
+ });
+ container = containerEnter.merge(container);
+ container.selectAll(".display-option-input").property("value", function(d2) {
+ return _options[d2];
+ });
+ container.selectAll(".display-option-value").text(function(d2) {
+ return Math.floor(_options[d2] * 100) + "%";
+ });
+ container.selectAll(".display-option-reset").classed("disabled", function(d2) {
+ return _options[d2] === 1;
+ });
+ if (containerEnter.size() && _options.brightness !== 1) {
+ context.background().brightness(_options.brightness);
+ }
+ }
+ return section;
+ }
+
+ // modules/ui/settings/custom_background.js
+ function uiSettingsCustomBackground() {
+ var dispatch14 = dispatch_default("change");
+ function render(selection2) {
+ var _origSettings = {
+ template: corePreferences("background-custom-template")
+ };
+ var _currSettings = {
+ template: corePreferences("background-custom-template")
+ };
+ var example = "https://{switch:a,b,c}.tile.openstreetmap.org/{zoom}/{x}/{y}.png";
+ var modal = uiConfirm(selection2).okButton();
+ modal.classed("settings-modal settings-custom-background", true);
+ modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
+ var textSection = modal.select(".modal-section.message-text");
+ var instructions = `${_t.html("settings.custom_background.instructions.info")}
+
+#### ${_t.html("settings.custom_background.instructions.wms.tokens_label")}
+* ${_t.html("settings.custom_background.instructions.wms.tokens.proj")}
+* ${_t.html("settings.custom_background.instructions.wms.tokens.wkid")}
+* ${_t.html("settings.custom_background.instructions.wms.tokens.dimensions")}
+* ${_t.html("settings.custom_background.instructions.wms.tokens.bbox")}
+
+#### ${_t.html("settings.custom_background.instructions.tms.tokens_label")}
+* ${_t.html("settings.custom_background.instructions.tms.tokens.xyz")}
+* ${_t.html("settings.custom_background.instructions.tms.tokens.flipped_y")}
+* ${_t.html("settings.custom_background.instructions.tms.tokens.switch")}
+* ${_t.html("settings.custom_background.instructions.tms.tokens.quadtile")}
+* ${_t.html("settings.custom_background.instructions.tms.tokens.scale_factor")}
+
+#### ${_t.html("settings.custom_background.instructions.example")}
+\`${example}\``;
+ textSection.append("div").attr("class", "instructions-template").html(marked(instructions));
+ textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
+ var buttonSection = modal.select(".modal-section.buttons");
+ buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
+ buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
+ buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
+ function isSaveDisabled() {
+ return null;
+ }
+ function clickCancel() {
+ textSection.select(".field-template").property("value", _origSettings.template);
+ corePreferences("background-custom-template", _origSettings.template);
+ this.blur();
+ modal.close();
+ }
+ function clickSave() {
+ _currSettings.template = textSection.select(".field-template").property("value");
+ corePreferences("background-custom-template", _currSettings.template);
+ this.blur();
+ modal.close();
+ dispatch14.call("change", this, _currSettings);
+ }
+ }
+ return utilRebind(render, dispatch14, "on");
+ }
+
+ // modules/ui/sections/background_list.js
+ function uiSectionBackgroundList(context) {
+ var _backgroundList = select_default2(null);
+ var _customSource = context.background().findSource("custom");
+ var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
+ var section = uiSection("background-list", context).label(() => _t.append("background.backgrounds")).disclosureContent(renderDisclosureContent);
+ function previousBackgroundID() {
+ return corePreferences("background-last-used-toggle");
+ }
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".layer-background-list").data([0]);
+ _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
+ var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
+ var minimapLabelEnter = bgExtrasListEnter.append("li").attr("class", "minimap-toggle-item").append("label").call(
+ uiTooltip().title(() => _t.append("background.minimap.tooltip")).keys([_t("background.minimap.key")]).placement("top")
+ );
+ minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
+ d3_event.preventDefault();
+ uiMapInMap.toggle();
+ });
+ minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
+ var panelLabelEnter = bgExtrasListEnter.append("li").attr("class", "background-panel-toggle-item").append("label").call(
+ uiTooltip().title(() => _t.append("background.panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.background.key"))]).placement("top")
+ );
+ panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
+ d3_event.preventDefault();
+ context.ui().info.toggle("background");
+ });
+ panelLabelEnter.append("span").call(_t.append("background.panel.description"));
+ var locPanelLabelEnter = bgExtrasListEnter.append("li").attr("class", "location-panel-toggle-item").append("label").call(
+ uiTooltip().title(() => _t.append("background.location_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.location.key"))]).placement("top")
+ );
+ locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
+ d3_event.preventDefault();
+ context.ui().info.toggle("location");
+ });
+ locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
+ selection2.selectAll(".imagery-faq").data([0]).enter().append("div").attr("class", "imagery-faq").append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/openstreetmap/iD/blob/develop/FAQ.md#how-can-i-report-an-issue-with-background-imagery").append("span").call(_t.append("background.imagery_problem_faq"));
+ _backgroundList.call(drawListItems, "radio", function(d3_event, d2) {
+ chooseBackground(d2);
+ }, function(d2) {
+ return !d2.isHidden() && !d2.overlay;
+ });
+ }
+ function setTooltips(selection2) {
+ selection2.each(function(d2, i3, nodes) {
+ var item = select_default2(this).select("label");
+ var span = item.select("span");
+ var placement = i3 < nodes.length / 2 ? "bottom" : "top";
+ var hasDescription = d2.hasDescription();
+ var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
+ item.call(uiTooltip().destroyAny);
+ if (d2.id === previousBackgroundID()) {
+ item.call(
+ uiTooltip().placement(placement).title(() => _t.append("background.switch")).keys([uiCmd("\u2318" + _t("background.key"))])
+ );
+ } else if (hasDescription || isOverflowing) {
+ item.call(
+ uiTooltip().placement(placement).title(() => hasDescription ? d2.description() : d2.label())
+ );
+ }
+ });
+ }
+ function drawListItems(layerList, type2, change, filter2) {
+ var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a2, b2) {
+ return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
+ });
+ var layerLinks = layerList.selectAll("li").data(sources, function(d2, i3) {
+ return d2.id + "---" + i3;
+ });
+ layerLinks.exit().remove();
+ var enter = layerLinks.enter().append("li").classed("layer-custom", function(d2) {
+ return d2.id === "custom";
+ }).classed("best", function(d2) {
+ return d2.best();
+ });
+ var label = enter.append("label");
+ label.append("input").attr("type", type2).attr("name", "background-layer").attr("value", function(d2) {
+ return d2.id;
+ }).on("change", change);
+ label.append("span").each(function(d2) {
+ d2.label()(select_default2(this));
+ });
+ enter.filter(function(d2) {
+ return d2.id === "custom";
+ }).append("button").attr("class", "layer-browse").call(
+ uiTooltip().title(() => _t.append("settings.custom_background.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
+ ).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ editCustom();
+ }).call(svgIcon("#iD-icon-more"));
+ enter.filter(function(d2) {
+ return d2.best();
+ }).append("div").attr("class", "best").call(
+ uiTooltip().title(() => _t.append("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
+ ).append("span").text("\u2605");
+ layerList.call(updateLayerSelections);
+ }
+ function updateLayerSelections(selection2) {
+ function active(d2) {
+ return context.background().showsLayer(d2);
+ }
+ selection2.selectAll("li").classed("active", active).classed("switch", function(d2) {
+ return d2.id === previousBackgroundID();
+ }).call(setTooltips).selectAll("input").property("checked", active);
+ }
+ function chooseBackground(d2) {
+ if (d2.id === "custom" && !d2.template()) {
+ return editCustom();
+ }
+ var previousBackground = context.background().baseLayerSource();
+ corePreferences("background-last-used-toggle", previousBackground.id);
+ corePreferences("background-last-used", d2.id);
+ context.background().baseLayerSource(d2);
+ }
+ function customChanged(d2) {
+ if (d2 && d2.template) {
+ _customSource.template(d2.template);
+ chooseBackground(_customSource);
+ } else {
+ _customSource.template("");
+ chooseBackground(context.background().findSource("none"));
+ }
+ }
+ function editCustom() {
+ context.container().call(_settingsCustomBackground);
+ }
+ context.background().on("change.background_list", function() {
+ _backgroundList.call(updateLayerSelections);
+ });
+ context.map().on(
+ "move.background_list",
+ debounce_default(function() {
+ window.requestIdleCallback(section.reRender);
+ }, 1e3)
+ );
+ return section;
+ }
+
+ // modules/ui/sections/background_offset.js
+ function uiSectionBackgroundOffset(context) {
+ var section = uiSection("background-offset", context).label(() => _t.append("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
+ var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
+ var _directions = [
+ ["top", [0, -0.5]],
+ ["left", [-0.5, 0]],
+ ["right", [0.5, 0]],
+ ["bottom", [0, 0.5]]
+ ];
+ function updateValue() {
+ var meters = geoOffsetToMeters(context.background().offset());
+ var x2 = +meters[0].toFixed(2);
+ var y2 = +meters[1].toFixed(2);
+ context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x2 + ", " + y2);
+ context.container().selectAll(".nudge-reset").classed("disabled", function() {
+ return x2 === 0 && y2 === 0;
+ });
+ }
+ function resetOffset() {
+ context.background().offset([0, 0]);
+ updateValue();
+ }
+ function nudge(d2) {
+ context.background().nudge(d2, context.map().zoom());
+ updateValue();
+ }
+ function inputOffset() {
+ var input = select_default2(this);
+ var d2 = input.node().value;
+ if (d2 === "")
+ return resetOffset();
+ d2 = d2.replace(/;/g, ",").split(",").map(function(n3) {
+ return !isNaN(n3) && n3;
+ });
+ if (d2.length !== 2 || !d2[0] || !d2[1]) {
+ input.classed("error", true);
+ return;
+ }
+ context.background().offset(geoMetersToOffset(d2));
+ updateValue();
+ }
+ function dragOffset(d3_event) {
+ if (d3_event.button !== 0)
+ return;
+ var origin = [d3_event.clientX, d3_event.clientY];
+ var pointerId = d3_event.pointerId || "mouse";
+ context.container().append("div").attr("class", "nudge-surface");
+ select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
+ if (_pointerPrefix === "pointer") {
+ select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
+ }
+ function pointermove(d3_event2) {
+ if (pointerId !== (d3_event2.pointerId || "mouse"))
+ return;
+ var latest = [d3_event2.clientX, d3_event2.clientY];
+ var d2 = [
+ -(origin[0] - latest[0]) / 4,
+ -(origin[1] - latest[1]) / 4
+ ];
+ origin = latest;
+ nudge(d2);
+ }
+ function pointerup(d3_event2) {
+ if (pointerId !== (d3_event2.pointerId || "mouse"))
+ return;
+ if (d3_event2.button !== 0)
+ return;
+ context.container().selectAll(".nudge-surface").remove();
+ select_default2(window).on(".drag-bg-offset", null);
+ }
+ }
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".nudge-container").data([0]);
+ var containerEnter = container.enter().append("div").attr("class", "nudge-container");
+ containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
+ var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
+ var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
+ nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
+ nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d2) {
+ return _t(`background.nudge.${d2[0]}`);
+ }).attr("class", function(d2) {
+ return d2[0] + " nudge";
+ }).on("click", function(d3_event, d2) {
+ nudge(d2[1]);
+ });
+ nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
+ d3_event.preventDefault();
+ resetOffset();
+ }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
+ updateValue();
+ }
+ context.background().on("change.backgroundOffset-update", updateValue);
+ return section;
+ }
+
+ // modules/ui/sections/overlay_list.js
+ function uiSectionOverlayList(context) {
+ var section = uiSection("overlay-list", context).label(() => _t.append("background.overlays")).disclosureContent(renderDisclosureContent);
+ var _overlayList = select_default2(null);
+ function setTooltips(selection2) {
+ selection2.each(function(d2, i3, nodes) {
+ var item = select_default2(this).select("label");
+ var span = item.select("span");
+ var placement = i3 < nodes.length / 2 ? "bottom" : "top";
+ var description = d2.description();
+ var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
+ item.call(uiTooltip().destroyAny);
+ if (description || isOverflowing) {
+ item.call(
+ uiTooltip().placement(placement).title(() => description || d2.name())
+ );
+ }
+ });
+ }
+ function updateLayerSelections(selection2) {
+ function active(d2) {
+ return context.background().showsLayer(d2);
+ }
+ selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
+ }
+ function chooseOverlay(d3_event, d2) {
+ d3_event.preventDefault();
+ context.background().toggleOverlayLayer(d2);
+ _overlayList.call(updateLayerSelections);
+ document.activeElement.blur();
+ }
+ function drawListItems(layerList, type2, change, filter2) {
+ var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
+ var layerLinks = layerList.selectAll("li").data(sources, function(d2) {
+ return d2.name();
+ });
+ layerLinks.exit().remove();
+ var enter = layerLinks.enter().append("li");
+ var label = enter.append("label");
+ label.append("input").attr("type", type2).attr("name", "layers").on("change", change);
+ label.append("span").each(function(d2) {
+ d2.label()(select_default2(this));
+ });
+ layerList.selectAll("li").sort(sortSources);
+ layerList.call(updateLayerSelections);
+ function sortSources(a2, b2) {
+ return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
+ }
+ }
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".layer-overlay-list").data([0]);
+ _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
+ _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d2) {
+ return !d2.isHidden() && d2.overlay;
+ });
+ }
+ context.map().on(
+ "move.overlay_list",
+ debounce_default(function() {
+ window.requestIdleCallback(section.reRender);
+ }, 1e3)
+ );
+ return section;
+ }
+
+ // modules/ui/panes/background.js
+ function uiPaneBackground(context) {
+ var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.append("background.title")).description(_t.append("background.description")).iconName("iD-icon-layers").sections([
+ uiSectionBackgroundList(context),
+ uiSectionOverlayList(context),
+ uiSectionBackgroundDisplayOptions(context),
+ uiSectionBackgroundOffset(context)
+ ]);
+ return backgroundPane;
+ }
+
+ // modules/ui/panes/help.js
+ function uiPaneHelp(context) {
+ var docKeys = [
+ ["help", [
+ "welcome",
+ "open_data_h",
+ "open_data",
+ "before_start_h",
+ "before_start",
+ "open_source_h",
+ "open_source",
+ "open_source_attribution",
+ "open_source_help"
+ ]],
+ ["overview", [
+ "navigation_h",
+ "navigation_drag",
+ "navigation_zoom",
+ "features_h",
+ "features",
+ "nodes_ways"
+ ]],
+ ["editing", [
+ "select_h",
+ "select_left_click",
+ "select_right_click",
+ "select_space",
+ "multiselect_h",
+ "multiselect",
+ "multiselect_shift_click",
+ "multiselect_lasso",
+ "undo_redo_h",
+ "undo_redo",
+ "save_h",
+ "save",
+ "save_validation",
+ "upload_h",
+ "upload",
+ "backups_h",
+ "backups",
+ "keyboard_h",
+ "keyboard"
+ ]],
+ ["feature_editor", [
+ "intro",
+ "definitions",
+ "type_h",
+ "type",
+ "type_picker",
+ "fields_h",
+ "fields_all_fields",
+ "fields_example",
+ "fields_add_field",
+ "tags_h",
+ "tags_all_tags",
+ "tags_resources"
+ ]],
+ ["points", [
+ "intro",
+ "add_point_h",
+ "add_point",
+ "add_point_finish",
+ "move_point_h",
+ "move_point",
+ "delete_point_h",
+ "delete_point",
+ "delete_point_command"
+ ]],
+ ["lines", [
+ "intro",
+ "add_line_h",
+ "add_line",
+ "add_line_draw",
+ "add_line_continue",
+ "add_line_finish",
+ "modify_line_h",
+ "modify_line_dragnode",
+ "modify_line_addnode",
+ "connect_line_h",
+ "connect_line",
+ "connect_line_display",
+ "connect_line_drag",
+ "connect_line_tag",
+ "disconnect_line_h",
+ "disconnect_line_command",
+ "move_line_h",
+ "move_line_command",
+ "move_line_connected",
+ "delete_line_h",
+ "delete_line",
+ "delete_line_command"
+ ]],
+ ["areas", [
+ "intro",
+ "point_or_area_h",
+ "point_or_area",
+ "add_area_h",
+ "add_area_command",
+ "add_area_draw",
+ "add_area_continue",
+ "add_area_finish",
+ "square_area_h",
+ "square_area_command",
+ "modify_area_h",
+ "modify_area_dragnode",
+ "modify_area_addnode",
+ "delete_area_h",
+ "delete_area",
+ "delete_area_command"
+ ]],
+ ["relations", [
+ "intro",
+ "edit_relation_h",
+ "edit_relation",
+ "edit_relation_add",
+ "edit_relation_delete",
+ "maintain_relation_h",
+ "maintain_relation",
+ "relation_types_h",
+ "multipolygon_h",
+ "multipolygon",
+ "multipolygon_create",
+ "multipolygon_merge",
+ "turn_restriction_h",
+ "turn_restriction",
+ "turn_restriction_field",
+ "turn_restriction_editing",
+ "route_h",
+ "route",
+ "route_add",
+ "boundary_h",
+ "boundary",
+ "boundary_add"
+ ]],
+ ["operations", [
+ "intro",
+ "intro_2",
+ "straighten",
+ "orthogonalize",
+ "circularize",
+ "move",
+ "rotate",
+ "reflect",
+ "continue",
+ "reverse",
+ "disconnect",
+ "split",
+ "extract",
+ "merge",
+ "delete",
+ "downgrade",
+ "copy_paste"
+ ]],
+ ["notes", [
+ "intro",
+ "add_note_h",
+ "add_note",
+ "place_note",
+ "move_note",
+ "update_note_h",
+ "update_note",
+ "save_note_h",
+ "save_note"
+ ]],
+ ["imagery", [
+ "intro",
+ "sources_h",
+ "choosing",
+ "sources",
+ "offsets_h",
+ "offset",
+ "offset_change"
+ ]],
+ ["streetlevel", [
+ "intro",
+ "using_h",
+ "using",
+ "photos",
+ "viewer"
+ ]],
+ ["gps", [
+ "intro",
+ "survey",
+ "using_h",
+ "using",
+ "tracing",
+ "upload"
+ ]],
+ ["qa", [
+ "intro",
+ "tools_h",
+ "tools",
+ "issues_h",
+ "issues"
+ ]]
+ ];
+ var headings = {
+ "help.help.open_data_h": 3,
+ "help.help.before_start_h": 3,
+ "help.help.open_source_h": 3,
+ "help.overview.navigation_h": 3,
+ "help.overview.features_h": 3,
+ "help.editing.select_h": 3,
+ "help.editing.multiselect_h": 3,
+ "help.editing.undo_redo_h": 3,
+ "help.editing.save_h": 3,
+ "help.editing.upload_h": 3,
+ "help.editing.backups_h": 3,
+ "help.editing.keyboard_h": 3,
+ "help.feature_editor.type_h": 3,
+ "help.feature_editor.fields_h": 3,
+ "help.feature_editor.tags_h": 3,
+ "help.points.add_point_h": 3,
+ "help.points.move_point_h": 3,
+ "help.points.delete_point_h": 3,
+ "help.lines.add_line_h": 3,
+ "help.lines.modify_line_h": 3,
+ "help.lines.connect_line_h": 3,
+ "help.lines.disconnect_line_h": 3,
+ "help.lines.move_line_h": 3,
+ "help.lines.delete_line_h": 3,
+ "help.areas.point_or_area_h": 3,
+ "help.areas.add_area_h": 3,
+ "help.areas.square_area_h": 3,
+ "help.areas.modify_area_h": 3,
+ "help.areas.delete_area_h": 3,
+ "help.relations.edit_relation_h": 3,
+ "help.relations.maintain_relation_h": 3,
+ "help.relations.relation_types_h": 2,
+ "help.relations.multipolygon_h": 3,
+ "help.relations.turn_restriction_h": 3,
+ "help.relations.route_h": 3,
+ "help.relations.boundary_h": 3,
+ "help.notes.add_note_h": 3,
+ "help.notes.update_note_h": 3,
+ "help.notes.save_note_h": 3,
+ "help.imagery.sources_h": 3,
+ "help.imagery.offsets_h": 3,
+ "help.streetlevel.using_h": 3,
+ "help.gps.using_h": 3,
+ "help.qa.tools_h": 3,
+ "help.qa.issues_h": 3
+ };
+ var docs = docKeys.map(function(key) {
+ var helpkey = "help." + key[0];
+ var helpPaneReplacements = { version: context.version };
+ var text2 = key[1].reduce(function(all, part) {
+ var subkey = helpkey + "." + part;
+ var depth = headings[subkey];
+ var hhh = depth ? Array(depth + 1).join("#") + " " : "";
+ return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
+ }, "");
+ return {
+ title: _t.html(helpkey + ".title"),
+ content: marked(text2.trim()).replace(/<code>/g, "<kbd>").replace(/<\/code>/g, "</kbd>")
+ };
+ });
+ var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.append("help.title")).description(_t.append("help.title")).iconName("iD-icon-help");
+ helpPane.renderContent = function(content) {
+ function clickHelp(d2, i3) {
+ var rtl = _mainLocalizer.textDirection() === "rtl";
+ content.property("scrollTop", 0);
+ helpPane.selection().select(".pane-heading h2").html(d2.title);
+ body.html(d2.content);
+ body.selectAll("a").attr("target", "_blank");
+ menuItems.classed("selected", function(m2) {
+ return m2.title === d2.title;
+ });
+ nav.html("");
+ if (rtl) {
+ nav.call(drawNext).call(drawPrevious);
+ } else {
+ nav.call(drawPrevious).call(drawNext);
+ }
+ function drawNext(selection2) {
+ if (i3 < docs.length - 1) {
+ var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
+ d3_event.preventDefault();
+ clickHelp(docs[i3 + 1], i3 + 1);
+ });
+ nextLink.append("span").html(docs[i3 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
+ }
+ }
+ function drawPrevious(selection2) {
+ if (i3 > 0) {
+ var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
+ d3_event.preventDefault();
+ clickHelp(docs[i3 - 1], i3 - 1);
+ });
+ prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i3 - 1].title);
+ }
+ }
+ }
+ function clickWalkthrough(d3_event) {
+ d3_event.preventDefault();
+ if (context.inIntro())
+ return;
+ context.container().call(uiIntro(context));
+ context.ui().togglePanes();
+ }
+ function clickShortcuts(d3_event) {
+ d3_event.preventDefault();
+ context.container().call(context.ui().shortcuts, true);
+ }
+ var toc = content.append("ul").attr("class", "toc");
+ var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d2) {
+ return d2.title;
+ }).on("click", function(d3_event, d2) {
+ d3_event.preventDefault();
+ clickHelp(d2, docs.indexOf(d2));
+ });
+ var shortcuts = toc.append("li").attr("class", "shortcuts").call(
+ uiTooltip().title(() => _t.append("shortcuts.tooltip")).keys(["?"]).placement("top")
+ ).append("a").attr("href", "#").on("click", clickShortcuts);
+ shortcuts.append("div").call(_t.append("shortcuts.title"));
+ var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
+ walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
+ walkthrough.append("div").call(_t.append("splash.walkthrough"));
+ var helpContent = content.append("div").attr("class", "left-content");
+ var body = helpContent.append("div").attr("class", "body");
+ var nav = helpContent.append("div").attr("class", "nav");
+ clickHelp(docs[0], 0);
+ };
+ return helpPane;
+ }
+
+ // modules/ui/sections/validation_issues.js
+ function uiSectionValidationIssues(id2, severity, context) {
+ var _issues = [];
+ var section = uiSection(id2, context).label(function() {
+ if (!_issues)
+ return "";
+ var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
+ return _t.append("inspector.title_count", { title: _t("issues." + severity + "s.list_title"), count: issueCountText });
+ }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
+ return _issues && _issues.length;
+ });
+ function getOptions() {
+ return {
+ what: corePreferences("validate-what") || "edited",
+ where: corePreferences("validate-where") || "all"
+ };
+ }
+ function reloadIssues() {
+ _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
+ }
+ function renderDisclosureContent(selection2) {
+ var center = context.map().center();
+ var graph = context.graph();
+ var issues = _issues.map(function withDistance(issue) {
+ var extent = issue.extent(graph);
+ var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
+ return Object.assign(issue, { dist });
+ }).sort(function byDistance(a2, b2) {
+ return a2.dist - b2.dist;
+ });
+ issues = issues.slice(0, 1e3);
+ selection2.call(drawIssuesList, issues);
+ }
+ function drawIssuesList(selection2, issues) {
+ var list = selection2.selectAll(".issues-list").data([0]);
+ list = list.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list);
+ var items = list.selectAll("li").data(issues, function(d2) {
+ return d2.key;
+ });
+ items.exit().remove();
+ var itemsEnter = items.enter().append("li").attr("class", function(d2) {
+ return "issue severity-" + d2.severity;
+ });
+ var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d2) {
+ context.validator().focusIssue(d2);
+ }).on("mouseover", function(d3_event, d2) {
+ utilHighlightEntities(d2.entityIds, true, context);
+ }).on("mouseout", function(d3_event, d2) {
+ utilHighlightEntities(d2.entityIds, false, context);
+ });
+ var textEnter = labelsEnter.append("span").attr("class", "issue-text");
+ textEnter.append("span").attr("class", "issue-icon").each(function(d2) {
+ var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
+ select_default2(this).call(svgIcon(iconName));
+ });
+ textEnter.append("span").attr("class", "issue-message");
+ items = items.merge(itemsEnter).order();
+ items.selectAll(".issue-message").text("").each(function(d2) {
+ return d2.message(context)(select_default2(this));
+ });
+ }
+ context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
+ window.requestIdleCallback(function() {
+ reloadIssues();
+ section.reRender();
+ });
+ });
+ context.map().on(
+ "move.uiSectionValidationIssues" + id2,
+ debounce_default(function() {
+ window.requestIdleCallback(function() {
+ if (getOptions().where === "visible") {
+ reloadIssues();
+ }
+ section.reRender();
+ });
+ }, 1e3)
+ );
+ return section;
+ }
+
+ // modules/ui/sections/validation_options.js
+ function uiSectionValidationOptions(context) {
+ var section = uiSection("issues-options", context).content(renderContent);
+ function renderContent(selection2) {
+ var container = selection2.selectAll(".issues-options-container").data([0]);
+ container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
+ var data = [
+ { key: "what", values: ["edited", "all"] },
+ { key: "where", values: ["visible", "all"] }
+ ];
+ var options2 = container.selectAll(".issues-option").data(data, function(d2) {
+ return d2.key;
+ });
+ var optionsEnter = options2.enter().append("div").attr("class", function(d2) {
+ return "issues-option issues-option-" + d2.key;
+ });
+ optionsEnter.append("div").attr("class", "issues-option-title").html(function(d2) {
+ return _t.html("issues.options." + d2.key + ".title");
+ });
+ var valuesEnter = optionsEnter.selectAll("label").data(function(d2) {
+ return d2.values.map(function(val) {
+ return { value: val, key: d2.key };
+ });
+ }).enter().append("label");
+ valuesEnter.append("input").attr("type", "radio").attr("name", function(d2) {
+ return "issues-option-" + d2.key;
+ }).attr("value", function(d2) {
+ return d2.value;
+ }).property("checked", function(d2) {
+ return getOptions()[d2.key] === d2.value;
+ }).on("change", function(d3_event, d2) {
+ updateOptionValue(d3_event, d2.key, d2.value);
+ });
+ valuesEnter.append("span").html(function(d2) {
+ return _t.html("issues.options." + d2.key + "." + d2.value);
+ });
+ }
+ function getOptions() {
+ return {
+ what: corePreferences("validate-what") || "edited",
+ // 'all', 'edited'
+ where: corePreferences("validate-where") || "all"
+ // 'all', 'visible'
+ };
+ }
+ function updateOptionValue(d3_event, d2, val) {
+ if (!val && d3_event && d3_event.target) {
+ val = d3_event.target.value;
+ }
+ corePreferences("validate-" + d2, val);
+ context.validator().validate();
+ }
+ return section;
+ }
+
+ // modules/ui/sections/validation_rules.js
+ function uiSectionValidationRules(context) {
+ var MINSQUARE = 0;
+ var MAXSQUARE = 20;
+ var DEFAULTSQUARE = 5;
+ var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(() => _t.append("issues.rules.title"));
+ var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
+ return key !== "maprules";
+ }).sort(function(key1, key2) {
+ return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
+ });
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".issues-rulelist-container").data([0]);
+ var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
+ containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
+ var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
+ ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ context.validator().disableRules(_ruleKeys);
+ });
+ ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ context.validator().disableRules([]);
+ });
+ container = container.merge(containerEnter);
+ container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
+ }
+ function drawListItems(selection2, data, type2, name, change, active) {
+ var items = selection2.selectAll("li").data(data);
+ items.exit().remove();
+ var enter = items.enter().append("li");
+ if (name === "rule") {
+ enter.call(
+ uiTooltip().title(function(d2) {
+ return _t.append("issues." + d2 + ".tip");
+ }).placement("top")
+ );
+ }
+ var label = enter.append("label");
+ label.append("input").attr("type", type2).attr("name", name).on("change", change);
+ label.append("span").html(function(d2) {
+ var params = {};
+ if (d2 === "unsquare_way") {
+ params.val = { html: '<span class="square-degrees"></span>' };
+ }
+ return _t.html("issues." + d2 + ".title", params);
+ });
+ items = items.merge(enter);
+ items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
+ var degStr = corePreferences("validate-square-degrees");
+ if (degStr === null) {
+ degStr = DEFAULTSQUARE.toString();
+ }
+ var span = items.selectAll(".square-degrees");
+ var input = span.selectAll(".square-degrees-input").data([0]);
+ input.enter().append("input").attr("type", "number").attr("min", MINSQUARE.toString()).attr("max", MAXSQUARE.toString()).attr("step", "0.5").attr("class", "square-degrees-input").call(utilNoAuto).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ this.select();
+ }).on("keyup", function(d3_event) {
+ if (d3_event.keyCode === 13) {
+ this.blur();
+ this.select();
+ }
+ }).on("blur", changeSquare).merge(input).property("value", degStr);
+ }
+ function changeSquare() {
+ var input = select_default2(this);
+ var degStr = utilGetSetValue(input).trim();
+ var degNum = Number(degStr);
+ if (!isFinite(degNum)) {
+ degNum = DEFAULTSQUARE;
+ } else if (degNum > MAXSQUARE) {
+ degNum = MAXSQUARE;
+ } else if (degNum < MINSQUARE) {
+ degNum = MINSQUARE;
+ }
+ degNum = Math.round(degNum * 10) / 10;
+ degStr = degNum.toString();
+ input.property("value", degStr);
+ corePreferences("validate-square-degrees", degStr);
+ context.validator().revalidateUnsquare();
+ }
+ function isRuleEnabled(d2) {
+ return context.validator().isRuleEnabled(d2);
+ }
+ function toggleRule(d3_event, d2) {
+ context.validator().toggleRule(d2);
+ }
+ context.validator().on("validated.uiSectionValidationRules", function() {
+ window.requestIdleCallback(section.reRender);
+ });
+ return section;
+ }
+
+ // modules/ui/sections/validation_status.js
+ function uiSectionValidationStatus(context) {
+ var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
+ var issues = context.validator().getIssues(getOptions());
+ return issues.length === 0;
+ });
+ function getOptions() {
+ return {
+ what: corePreferences("validate-what") || "edited",
+ where: corePreferences("validate-where") || "all"
+ };
+ }
+ function renderContent(selection2) {
+ var box = selection2.selectAll(".box").data([0]);
+ var boxEnter = box.enter().append("div").attr("class", "box");
+ boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
+ var noIssuesMessage = boxEnter.append("span");
+ noIssuesMessage.append("strong").attr("class", "message");
+ noIssuesMessage.append("br");
+ noIssuesMessage.append("span").attr("class", "details");
+ renderIgnoredIssuesReset(selection2);
+ setNoIssuesText(selection2);
+ }
+ function renderIgnoredIssuesReset(selection2) {
+ var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
+ var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
+ resetIgnored.exit().remove();
+ var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
+ resetIgnoredEnter.append("a").attr("href", "#");
+ resetIgnored = resetIgnored.merge(resetIgnoredEnter);
+ resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
+ resetIgnored.on("click", function(d3_event) {
+ d3_event.preventDefault();
+ context.validator().resetIgnoredIssues();
+ });
+ }
+ function setNoIssuesText(selection2) {
+ var opts = getOptions();
+ function checkForHiddenIssues(cases) {
+ for (var type2 in cases) {
+ var hiddenOpts = cases[type2];
+ var hiddenIssues = context.validator().getIssues(hiddenOpts);
+ if (hiddenIssues.length) {
+ selection2.select(".box .details").html("").call(_t.append(
+ "issues.no_issues.hidden_issues." + type2,
+ { count: hiddenIssues.length.toString() }
+ ));
+ return;
+ }
+ }
+ selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
+ }
+ var messageType;
+ if (opts.what === "edited" && opts.where === "visible") {
+ messageType = "edits_in_view";
+ checkForHiddenIssues({
+ elsewhere: { what: "edited", where: "all" },
+ everything_else: { what: "all", where: "visible" },
+ disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
+ everything_else_elsewhere: { what: "all", where: "all" },
+ disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
+ ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
+ ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
+ });
+ } else if (opts.what === "edited" && opts.where === "all") {
+ messageType = "edits";
+ checkForHiddenIssues({
+ everything_else: { what: "all", where: "all" },
+ disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
+ ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
+ });
+ } else if (opts.what === "all" && opts.where === "visible") {
+ messageType = "everything_in_view";
+ checkForHiddenIssues({
+ elsewhere: { what: "all", where: "all" },
+ disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
+ disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
+ ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
+ ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
+ });
+ } else if (opts.what === "all" && opts.where === "all") {
+ messageType = "everything";
+ checkForHiddenIssues({
+ disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
+ ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
+ });
+ }
+ if (opts.what === "edited" && context.history().difference().summary().length === 0) {
+ messageType = "no_edits";
+ }
+ selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
+ }
+ context.validator().on("validated.uiSectionValidationStatus", function() {
+ window.requestIdleCallback(section.reRender);
+ });
+ context.map().on(
+ "move.uiSectionValidationStatus",
+ debounce_default(function() {
+ window.requestIdleCallback(section.reRender);
+ }, 1e3)
+ );
+ return section;
+ }
+
+ // modules/ui/panes/issues.js
+ function uiPaneIssues(context) {
+ var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.append("issues.title")).description(_t.append("issues.title")).iconName("iD-icon-alert").sections([
+ uiSectionValidationOptions(context),
+ uiSectionValidationStatus(context),
+ uiSectionValidationIssues("issues-errors", "error", context),
+ uiSectionValidationIssues("issues-warnings", "warning", context),
+ uiSectionValidationRules(context)
+ ]);
+ return issuesPane;
+ }
+
+ // modules/ui/settings/custom_data.js
+ function uiSettingsCustomData(context) {
+ var dispatch14 = dispatch_default("change");
+ function render(selection2) {
+ var dataLayer = context.layers().layer("data");
+ var _origSettings = {
+ fileList: dataLayer && dataLayer.fileList() || null,
+ url: corePreferences("settings-custom-data-url")
+ };
+ var _currSettings = {
+ fileList: dataLayer && dataLayer.fileList() || null
+ // url: prefs('settings-custom-data-url')
+ };
+ var modal = uiConfirm(selection2).okButton();
+ modal.classed("settings-modal settings-custom-data", true);
+ modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
+ var textSection = modal.select(".modal-section.message-text");
+ textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
+ textSection.append("input").attr("class", "field-file").attr("type", "file").attr("accept", ".gpx,.kml,.geojson,.json,application/gpx+xml,application/vnd.google-earth.kml+xml,application/geo+json,application/json").property("files", _currSettings.fileList).on("change", function(d3_event) {
+ var files = d3_event.target.files;
+ if (files && files.length) {
+ _currSettings.url = "";
+ textSection.select(".field-url").property("value", "");
+ _currSettings.fileList = files;
+ } else {
+ _currSettings.fileList = null;
+ }
+ });
+ textSection.append("h4").call(_t.append("settings.custom_data.or"));
+ textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
+ textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
+ var buttonSection = modal.select(".modal-section.buttons");
+ buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
+ buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
+ buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
+ function isSaveDisabled() {
+ return null;
+ }
+ function clickCancel() {
+ textSection.select(".field-url").property("value", _origSettings.url);
+ corePreferences("settings-custom-data-url", _origSettings.url);
+ this.blur();
+ modal.close();
+ }
+ function clickSave() {
+ _currSettings.url = textSection.select(".field-url").property("value").trim();
+ if (_currSettings.url) {
+ _currSettings.fileList = null;
+ }
+ if (_currSettings.fileList) {
+ _currSettings.url = "";
+ }
+ corePreferences("settings-custom-data-url", _currSettings.url);
+ this.blur();
+ modal.close();
+ dispatch14.call("change", this, _currSettings);
+ }
+ }
+ return utilRebind(render, dispatch14, "on");
+ }
+
+ // modules/ui/sections/data_layers.js
+ function uiSectionDataLayers(context) {
+ var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
+ var layers = context.layers();
+ var section = uiSection("data-layers", context).label(() => _t.append("map_data.data_layers")).disclosureContent(renderDisclosureContent);
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".data-layer-container").data([0]);
+ container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
+ }
+ function showsLayer(which) {
+ var layer = layers.layer(which);
+ if (layer) {
+ return layer.enabled();
+ }
+ return false;
+ }
+ function setLayer(which, enabled) {
+ var mode = context.mode();
+ if (mode && /^draw/.test(mode.id))
+ return;
+ var layer = layers.layer(which);
+ if (layer) {
+ layer.enabled(enabled);
+ if (!enabled && (which === "osm" || which === "notes")) {
+ context.enter(modeBrowse(context));
+ }
+ }
+ }
+ function toggleLayer(which) {
+ setLayer(which, !showsLayer(which));
+ }
+ function drawOsmItems(selection2) {
+ var osmKeys = ["osm", "notes"];
+ var osmLayers = layers.all().filter(function(obj) {
+ return osmKeys.indexOf(obj.id) !== -1;
+ });
+ var ul = selection2.selectAll(".layer-list-osm").data([0]);
+ ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
+ var li = ul.selectAll(".list-item").data(osmLayers);
+ li.exit().remove();
+ var liEnter = li.enter().append("li").attr("class", function(d2) {
+ return "list-item list-item-" + d2.id;
+ });
+ var labelEnter = liEnter.append("label").each(function(d2) {
+ if (d2.id === "osm") {
+ select_default2(this).call(
+ uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom")
+ );
+ } else {
+ select_default2(this).call(
+ uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
+ );
+ }
+ });
+ labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
+ toggleLayer(d2.id);
+ });
+ labelEnter.append("span").html(function(d2) {
+ return _t.html("map_data.layers." + d2.id + ".title");
+ });
+ li.merge(liEnter).classed("active", function(d2) {
+ return d2.layer.enabled();
+ }).selectAll("input").property("checked", function(d2) {
+ return d2.layer.enabled();
+ });
+ }
+ function drawQAItems(selection2) {
+ var qaKeys = ["keepRight", "improveOSM", "osmose"];
+ var qaLayers = layers.all().filter(function(obj) {
+ return qaKeys.indexOf(obj.id) !== -1;
+ });
+ var ul = selection2.selectAll(".layer-list-qa").data([0]);
+ ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
+ var li = ul.selectAll(".list-item").data(qaLayers);
+ li.exit().remove();
+ var liEnter = li.enter().append("li").attr("class", function(d2) {
+ return "list-item list-item-" + d2.id;
+ });
+ var labelEnter = liEnter.append("label").each(function(d2) {
+ select_default2(this).call(
+ uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
+ );
+ });
+ labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
+ toggleLayer(d2.id);
+ });
+ labelEnter.append("span").each(function(d2) {
+ _t.append("map_data.layers." + d2.id + ".title")(select_default2(this));
+ });
+ li.merge(liEnter).classed("active", function(d2) {
+ return d2.layer.enabled();
+ }).selectAll("input").property("checked", function(d2) {
+ return d2.layer.enabled();
+ });
+ }
+ function drawVectorItems(selection2) {
+ var dataLayer = layers.layer("data");
+ var vtData = [
+ {
+ name: "Detroit Neighborhoods/Parks",
+ src: "neighborhoods-parks",
+ tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
+ template: "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/jonahadkins.cjksmur6x34562qp9iv1u3ksf-54hev,jonahadkins.cjksmqxdx33jj2wp90xd9x2md-4e5y2/{z}/{x}/{y}.vector.pbf?access_token=pk.eyJ1Ijoiam9uYWhhZGtpbnMiLCJhIjoiRlVVVkx3VSJ9.9sdVEK_B_VkEXPjssU5MqA"
+ },
+ {
+ name: "Detroit Composite POIs",
+ src: "composite-poi",
+ tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
+ template: "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/jonahadkins.cjksmm6a02sli31myxhsr7zf3-2sw8h/{z}/{x}/{y}.vector.pbf?access_token=pk.eyJ1Ijoiam9uYWhhZGtpbnMiLCJhIjoiRlVVVkx3VSJ9.9sdVEK_B_VkEXPjssU5MqA"
+ },
+ {
+ name: "Detroit All-The-Places POIs",
+ src: "alltheplaces-poi",
+ tooltip: "Public domain business location data created by web scrapers.",
+ template: "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/jonahadkins.cjksmswgk340g2vo06p1w9w0j-8fjjc/{z}/{x}/{y}.vector.pbf?access_token=pk.eyJ1Ijoiam9uYWhhZGtpbnMiLCJhIjoiRlVVVkx3VSJ9.9sdVEK_B_VkEXPjssU5MqA"
+ }
+ ];
+ var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
+ var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
+ var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
+ container.exit().remove();
+ var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
+ containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
+ containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
+ containerEnter.append("div").attr("class", "vectortile-footer").append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/osmus/detroit-mapping-challenge").append("span").text("About these layers");
+ container = container.merge(containerEnter);
+ var ul = container.selectAll(".layer-list-vectortile");
+ var li = ul.selectAll(".list-item").data(vtData);
+ li.exit().remove();
+ var liEnter = li.enter().append("li").attr("class", function(d2) {
+ return "list-item list-item-" + d2.src;
+ });
+ var labelEnter = liEnter.append("label").each(function(d2) {
+ select_default2(this).call(
+ uiTooltip().title(d2.tooltip).placement("top")
+ );
+ });
+ labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
+ labelEnter.append("span").text(function(d2) {
+ return d2.name;
+ });
+ li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
+ function isVTLayerSelected(d2) {
+ return dataLayer && dataLayer.template() === d2.template;
+ }
+ function selectVTLayer(d3_event, d2) {
+ corePreferences("settings-custom-data-url", d2.template);
+ if (dataLayer) {
+ dataLayer.template(d2.template, d2.src);
+ dataLayer.enabled(true);
+ }
+ }
+ }
+ function drawCustomDataItems(selection2) {
+ var dataLayer = layers.layer("data");
+ var hasData = dataLayer && dataLayer.hasData();
+ var showsData = hasData && dataLayer.enabled();
+ var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
+ ul.exit().remove();
+ var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
+ var liEnter = ulEnter.append("li").attr("class", "list-item-data");
+ var labelEnter = liEnter.append("label").call(
+ uiTooltip().title(() => _t.append("map_data.layers.custom.tooltip")).placement("top")
+ );
+ labelEnter.append("input").attr("type", "checkbox").on("change", function() {
+ toggleLayer("data");
+ });
+ labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
+ liEnter.append("button").attr("class", "open-data-options").call(
+ uiTooltip().title(() => _t.append("settings.custom_data.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
+ ).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ editCustom();
+ }).call(svgIcon("#iD-icon-more"));
+ liEnter.append("button").attr("class", "zoom-to-data").call(
+ uiTooltip().title(() => _t.append("map_data.layers.custom.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
+ ).on("click", function(d3_event) {
+ if (select_default2(this).classed("disabled"))
+ return;
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ dataLayer.fitZoom();
+ }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
+ ul = ul.merge(ulEnter);
+ ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
+ ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
+ }
+ function editCustom() {
+ context.container().call(settingsCustomData);
+ }
+ function customChanged(d2) {
+ var dataLayer = layers.layer("data");
+ if (d2 && d2.url) {
+ dataLayer.url(d2.url);
+ } else if (d2 && d2.fileList) {
+ dataLayer.fileList(d2.fileList);
+ }
+ }
+ function drawPanelItems(selection2) {
+ var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
+ var historyPanelLabelEnter = panelsListEnter.append("li").attr("class", "history-panel-toggle-item").append("label").call(
+ uiTooltip().title(() => _t.append("map_data.history_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.history.key"))]).placement("top")
+ );
+ historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
+ d3_event.preventDefault();
+ context.ui().info.toggle("history");
+ });
+ historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
+ var measurementPanelLabelEnter = panelsListEnter.append("li").attr("class", "measurement-panel-toggle-item").append("label").call(
+ uiTooltip().title(() => _t.append("map_data.measurement_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.measurement.key"))]).placement("top")
+ );
+ measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
+ d3_event.preventDefault();
+ context.ui().info.toggle("measurement");
+ });
+ measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
+ }
+ context.layers().on("change.uiSectionDataLayers", section.reRender);
+ context.map().on(
+ "move.uiSectionDataLayers",
+ debounce_default(function() {
+ window.requestIdleCallback(section.reRender);
+ }, 1e3)
+ );
+ return section;
+ }
+
+ // modules/ui/sections/map_features.js
+ function uiSectionMapFeatures(context) {
+ var _features = context.features().keys();
+ var section = uiSection("map-features", context).label(() => _t.append("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".layer-feature-list-container").data([0]);
+ var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
+ containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
+ var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
+ footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ context.features().disableAll();
+ });
+ footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ context.features().enableAll();
+ });
+ container = container.merge(containerEnter);
+ container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
+ }
+ function drawListItems(selection2, data, type2, name, change, active) {
+ var items = selection2.selectAll("li").data(data);
+ items.exit().remove();
+ var enter = items.enter().append("li").call(
+ uiTooltip().title(function(d2) {
+ var tip = _t.append(name + "." + d2 + ".tooltip");
+ if (autoHiddenFeature(d2)) {
+ var msg = showsLayer("osm") ? _t.append("map_data.autohidden") : _t.append("map_data.osmhidden");
+ return (selection3) => {
+ selection3.call(tip);
+ selection3.append("div").call(msg);
+ };
+ }
+ return tip;
+ }).placement("top")
+ );
+ var label = enter.append("label");
+ label.append("input").attr("type", type2).attr("name", name).on("change", change);
+ label.append("span").html(function(d2) {
+ return _t.html(name + "." + d2 + ".description");
+ });
+ items = items.merge(enter);
+ items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
+ }
+ function autoHiddenFeature(d2) {
+ return context.features().autoHidden(d2);
+ }
+ function showsFeature(d2) {
+ return context.features().enabled(d2);
+ }
+ function clickFeature(d3_event, d2) {
+ context.features().toggle(d2);
+ }
+ function showsLayer(id2) {
+ var layer = context.layers().layer(id2);
+ return layer && layer.enabled();
+ }
+ context.features().on("change.map_features", section.reRender);
+ return section;
+ }
+
+ // modules/ui/sections/map_style_options.js
+ function uiSectionMapStyleOptions(context) {
+ var section = uiSection("fill-area", context).label(() => _t.append("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".layer-fill-list").data([0]);
+ container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
+ var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
+ container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
+ return context.surface().classed("highlight-edited");
+ });
+ }
+ function drawListItems(selection2, data, type2, name, change, active) {
+ var items = selection2.selectAll("li").data(data);
+ items.exit().remove();
+ var enter = items.enter().append("li").call(
+ uiTooltip().title(function(d2) {
+ return _t.append(name + "." + d2 + ".tooltip");
+ }).keys(function(d2) {
+ var key = d2 === "wireframe" ? _t("area_fill.wireframe.key") : null;
+ if (d2 === "highlight_edits")
+ key = _t("map_data.highlight_edits.key");
+ return key ? [key] : null;
+ }).placement("top")
+ );
+ var label = enter.append("label");
+ label.append("input").attr("type", type2).attr("name", name).on("change", change);
+ label.append("span").html(function(d2) {
+ return _t.html(name + "." + d2 + ".description");
+ });
+ items = items.merge(enter);
+ items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
+ }
+ function isActiveFill(d2) {
+ return context.map().activeAreaFill() === d2;
+ }
+ function toggleHighlightEdited(d3_event) {
+ d3_event.preventDefault();
+ context.map().toggleHighlightEdited();
+ }
+ function setFill(d3_event, d2) {
+ context.map().activeAreaFill(d2);
+ }
+ context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
+ return section;
+ }
+
+ // modules/ui/settings/local_photos.js
+ function uiSettingsLocalPhotos(context) {
+ var dispatch14 = dispatch_default("change");
+ var photoLayer = context.layers().layer("local-photos");
+ var modal;
+ function render(selection2) {
+ modal = uiConfirm(selection2).okButton();
+ modal.classed("settings-modal settings-local-photos", true);
+ modal.select(".modal-section.header").append("h3").call(_t.append("local_photos.header"));
+ modal.select(".modal-section.message-text").append("div").classed("local-photos", true);
+ var instructionsSection = modal.select(".modal-section.message-text .local-photos").append("div").classed("instructions", true);
+ instructionsSection.append("p").classed("instructions-local-photos", true).call(_t.append("local_photos.file.instructions"));
+ instructionsSection.append("input").classed("field-file", true).attr("type", "file").attr("multiple", "multiple").attr("accept", ".jpg,.jpeg,.png,image/png,image/jpeg").style("visibility", "hidden").attr("id", "local-photo-files").on("change", function(d3_event) {
+ var files = d3_event.target.files;
+ if (files && files.length) {
+ photoList.select("ul").append("li").classed("placeholder", true).append("div");
+ dispatch14.call("change", this, files);
+ }
+ d3_event.target.value = null;
+ });
+ instructionsSection.append("label").attr("for", "local-photo-files").classed("button", true).call(_t.append("local_photos.file.label"));
+ const photoList = modal.select(".modal-section.message-text .local-photos").append("div").append("div").classed("list-local-photos", true);
+ photoList.append("ul");
+ updatePhotoList(photoList.select("ul"));
+ context.layers().on("change", () => updatePhotoList(photoList.select("ul")));
+ }
+ function updatePhotoList(container) {
+ function locationUnavailable(d2) {
+ return !(isArray_default(d2.loc) && isNumber_default(d2.loc[0]) && isNumber_default(d2.loc[1]));
+ }
+ container.selectAll("li.placeholder").remove();
+ let selection2 = container.selectAll("li").data(photoLayer.getPhotos() ?? [], (d2) => d2.id);
+ selection2.exit().remove();
+ const selectionEnter = selection2.enter().append("li");
+ selectionEnter.append("span").classed("filename", true);
+ selectionEnter.append("button").classed("form-field-button zoom-to-data", true).attr("title", _t("local_photos.zoom_single")).call(svgIcon("#iD-icon-framed-dot"));
+ selectionEnter.append("button").classed("form-field-button no-geolocation", true).call(svgIcon("#iD-icon-alert")).call(
+ uiTooltip().title(() => _t.append("local_photos.no_geolocation.tooltip")).placement("left")
+ );
+ selectionEnter.append("button").classed("form-field-button remove", true).attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
+ selection2 = selection2.merge(selectionEnter);
+ selection2.classed("invalid", locationUnavailable);
+ selection2.select("span.filename").text((d2) => d2.name).attr("title", (d2) => d2.name);
+ selection2.select("span.filename").on("click", (d3_event, d2) => {
+ photoLayer.openPhoto(d3_event, d2, false);
+ });
+ selection2.select("button.zoom-to-data").on("click", (d3_event, d2) => {
+ photoLayer.openPhoto(d3_event, d2, true);
+ });
+ selection2.select("button.remove").on("click", (d3_event, d2) => {
+ photoLayer.removePhoto(d2.id);
+ updatePhotoList(container);
+ });
+ }
+ return utilRebind(render, dispatch14, "on");
+ }
+
+ // modules/ui/sections/photo_overlays.js
+ function uiSectionPhotoOverlays(context) {
+ var settingsLocalPhotos = uiSettingsLocalPhotos(context).on("change", localPhotosChanged);
+ var layers = context.layers();
+ var section = uiSection("photo-overlays", context).label(() => _t.append("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".photo-overlay-container").data([0]);
+ container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateFilter).call(drawUsernameFilter).call(drawLocalPhotos);
+ }
+ function drawPhotoItems(selection2) {
+ var photoKeys = context.photos().overlayLayerIDs();
+ var photoLayers = layers.all().filter(function(obj) {
+ return photoKeys.indexOf(obj.id) !== -1;
+ });
+ var data = photoLayers.filter(function(obj) {
+ if (!obj.layer.supported())
+ return false;
+ if (layerEnabled(obj))
+ return true;
+ if (typeof obj.layer.validHere === "function") {
+ return obj.layer.validHere(context.map().extent(), context.map().zoom());
+ }
+ return true;
+ });
+ function layerSupported(d2) {
+ return d2.layer && d2.layer.supported();
+ }
+ function layerEnabled(d2) {
+ return layerSupported(d2) && d2.layer.enabled();
+ }
+ function layerRendered(d2) {
+ return d2.layer.rendered?.(context.map().zoom()) ?? true;
+ }
+ var ul = selection2.selectAll(".layer-list-photos").data([0]);
+ ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
+ var li = ul.selectAll(".list-item-photos").data(data);
+ li.exit().remove();
+ var liEnter = li.enter().append("li").attr("class", function(d2) {
+ var classes = "list-item-photos list-item-" + d2.id;
+ if (d2.id === "mapillary-signs" || d2.id === "mapillary-map-features") {
+ classes += " indented";
+ }
+ return classes;
+ });
+ var labelEnter = liEnter.append("label").each(function(d2) {
+ var titleID;
+ if (d2.id === "mapillary-signs")
+ titleID = "mapillary.signs.tooltip";
+ else if (d2.id === "mapillary")
+ titleID = "mapillary_images.tooltip";
+ else if (d2.id === "kartaview")
+ titleID = "kartaview_images.tooltip";
+ else
+ titleID = d2.id.replace(/-/g, "_") + ".tooltip";
+ select_default2(this).call(
+ uiTooltip().title(() => {
+ if (!layerRendered(d2)) {
+ return _t.append("street_side.minzoom_tooltip");
+ } else {
+ return _t.append(titleID);
+ }
+ }).placement("top")
+ );
+ });
+ labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
+ toggleLayer(d2.id);
+ });
+ labelEnter.append("span").html(function(d2) {
+ var id2 = d2.id;
+ if (id2 === "mapillary-signs")
+ id2 = "photo_overlays.traffic_signs";
+ return _t.html(id2.replace(/-/g, "_") + ".title");
+ });
+ li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("disabled", (d2) => !layerRendered(d2)).property("checked", layerEnabled);
+ }
+ function drawPhotoTypeItems(selection2) {
+ var data = context.photos().allPhotoTypes();
+ function typeEnabled(d2) {
+ return context.photos().showsPhotoType(d2);
+ }
+ var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
+ ul.exit().remove();
+ ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
+ var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
+ li.exit().remove();
+ var liEnter = li.enter().append("li").attr("class", function(d2) {
+ return "list-item-photo-types list-item-" + d2;
+ });
+ var labelEnter = liEnter.append("label").each(function(d2) {
+ select_default2(this).call(
+ uiTooltip().title(() => _t.append("photo_overlays.photo_type." + d2 + ".tooltip")).placement("top")
+ );
+ });
+ labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
+ context.photos().togglePhotoType(d2);
+ });
+ labelEnter.append("span").html(function(d2) {
+ return _t.html("photo_overlays.photo_type." + d2 + ".title");
+ });
+ li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
+ }
+ function drawDateFilter(selection2) {
+ var data = context.photos().dateFilters();
+ function filterEnabled(d2) {
+ return context.photos().dateFilterValue(d2);
+ }
+ var ul = selection2.selectAll(".layer-list-date-filter").data([0]);
+ ul.exit().remove();
+ ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-filter").merge(ul);
+ var li = ul.selectAll(".list-item-date-filter").data(context.photos().shouldFilterByDate() ? data : []);
+ li.exit().remove();
+ var liEnter = li.enter().append("li").attr("class", "list-item-date-filter");
+ var labelEnter = liEnter.append("label").each(function(d2) {
+ select_default2(this).call(
+ uiTooltip().title(() => _t.append("photo_overlays.date_filter." + d2 + ".tooltip")).placement("top")
+ );
+ });
+ labelEnter.append("span").each(function(d2) {
+ _t.append("photo_overlays.date_filter." + d2 + ".title")(select_default2(this));
+ });
+ labelEnter.append("input").attr("type", "date").attr("class", "list-item-input").attr("placeholder", _t("units.year_month_day")).call(utilNoAuto).each(function(d2) {
+ utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d2) || "");
+ }).on("change", function(d3_event, d2) {
+ var value = utilGetSetValue(select_default2(this)).trim();
+ context.photos().setDateFilter(d2, value, true);
+ li.selectAll("input").each(function(d4) {
+ utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d4) || "");
+ });
+ });
+ li = li.merge(liEnter).classed("active", filterEnabled);
+ }
+ function drawUsernameFilter(selection2) {
+ function filterEnabled() {
+ return context.photos().usernames();
+ }
+ var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
+ ul.exit().remove();
+ ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
+ var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
+ li.exit().remove();
+ var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
+ var labelEnter = liEnter.append("label").each(function() {
+ select_default2(this).call(
+ uiTooltip().title(() => _t.append("photo_overlays.username_filter.tooltip")).placement("top")
+ );
+ });
+ labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
+ labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
+ var value = select_default2(this).property("value");
+ context.photos().setUsernameFilter(value, true);
+ select_default2(this).property("value", usernameValue);
+ });
+ li.merge(liEnter).classed("active", filterEnabled);
+ function usernameValue() {
+ var usernames = context.photos().usernames();
+ if (usernames)
+ return usernames.join("; ");
+ return usernames;
+ }
+ }
+ function toggleLayer(which) {
+ setLayer(which, !showsLayer(which));
+ }
+ function showsLayer(which) {
+ var layer = layers.layer(which);
+ if (layer) {
+ return layer.enabled();
+ }
+ return false;
+ }
+ function setLayer(which, enabled) {
+ var layer = layers.layer(which);
+ if (layer) {
+ layer.enabled(enabled);
+ }
+ }
+ function drawLocalPhotos(selection2) {
+ var photoLayer = layers.layer("local-photos");
+ var hasData = photoLayer && photoLayer.hasData();
+ var showsData = hasData && photoLayer.enabled();
+ var ul = selection2.selectAll(".layer-list-local-photos").data(photoLayer ? [0] : []);
+ ul.exit().remove();
+ var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-local-photos");
+ var localPhotosEnter = ulEnter.append("li").attr("class", "list-item-local-photos");
+ var localPhotosLabelEnter = localPhotosEnter.append("label").call(uiTooltip().title(() => _t.append("local_photos.tooltip")));
+ localPhotosLabelEnter.append("input").attr("type", "checkbox").on("change", function() {
+ toggleLayer("local-photos");
+ });
+ localPhotosLabelEnter.call(_t.append("local_photos.header"));
+ localPhotosEnter.append("button").attr("class", "open-data-options").call(
+ uiTooltip().title(() => _t.append("local_photos.tooltip_edit")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
+ ).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ editLocalPhotos();
+ }).call(svgIcon("#iD-icon-more"));
+ localPhotosEnter.append("button").attr("class", "zoom-to-data").call(
+ uiTooltip().title(() => _t.append("local_photos.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
+ ).on("click", function(d3_event) {
+ if (select_default2(this).classed("disabled"))
+ return;
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ photoLayer.fitZoom();
+ }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
+ ul = ul.merge(ulEnter);
+ ul.selectAll(".list-item-local-photos").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
+ ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
+ }
+ function editLocalPhotos() {
+ context.container().call(settingsLocalPhotos);
+ }
+ function localPhotosChanged(d2) {
+ var localPhotosLayer = layers.layer("local-photos");
+ localPhotosLayer.fileList(d2);
+ }
+ context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
+ context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
+ context.map().on(
+ "move.photo_overlays",
+ debounce_default(function() {
+ window.requestIdleCallback(section.reRender);
+ }, 1e3)
+ );
+ return section;
+ }
+
+ // modules/ui/panes/map_data.js
+ function uiPaneMapData(context) {
+ var mapDataPane = uiPane("map-data", context).key(_t("map_data.key")).label(_t.append("map_data.title")).description(_t.append("map_data.description")).iconName("iD-icon-data").sections([
+ uiSectionDataLayers(context),
+ uiSectionPhotoOverlays(context),
+ uiSectionMapStyleOptions(context),
+ uiSectionMapFeatures(context)
+ ]);
+ return mapDataPane;
+ }
+
+ // modules/ui/panes/preferences.js
+ function uiPanePreferences(context) {
+ let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.append("preferences.title")).description(_t.append("preferences.description")).iconName("fas-user-cog").sections([
+ uiSectionPrivacy(context)
+ ]);
+ return preferencesPane;
+ }
+
+ // modules/ui/init.js
+ function uiInit(context) {
+ var _initCounter = 0;
+ var _needWidth = {};
+ var _lastPointerType;
+ function render(container) {
+ container.on("click.ui", function(d3_event) {
+ if (d3_event.button !== 0)
+ return;
+ if (!d3_event.composedPath)
+ return;
+ var isOkayTarget = d3_event.composedPath().some(function(node) {
+ return node.nodeType === 1 && // clicking <input> focuses it and/or changes a value
+ (node.nodeName === "INPUT" || // clicking <label> affects its <input> by default
+ node.nodeName === "LABEL" || // clicking <a> opens a hyperlink by default
+ node.nodeName === "A");
+ });
+ if (isOkayTarget)
+ return;
+ d3_event.preventDefault();
+ });
+ var detected = utilDetect();
+ if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
+ // but we only need to do this on desktop Safari anyway. – #7694
+ !detected.isMobileWebKit) {
+ container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
+ d3_event.preventDefault();
+ });
+ }
+ if ("PointerEvent" in window) {
+ select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
+ var pointerType = d3_event.pointerType || "mouse";
+ if (_lastPointerType !== pointerType) {
+ _lastPointerType = pointerType;
+ container.attr("pointer", pointerType);
+ }
+ }, true);
+ } else {
+ _lastPointerType = "mouse";
+ container.attr("pointer", "mouse");
+ }
+ container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
+ container.call(uiFullScreen(context));
+ var map2 = context.map();
+ map2.redrawEnable(false);
+ map2.on("hitMinZoom.ui", function() {
+ ui.flash.iconName("#iD-icon-no").label(_t.append("cannot_zoom"))();
+ });
+ container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
+ container.append("div").attr("class", "sidebar").call(ui.sidebar);
+ var content = container.append("div").attr("class", "main-content active");
+ content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
+ content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
+ var overMap = content.append("div").attr("class", "over-map");
+ overMap.append("div").attr("class", "select-trap").text("t");
+ overMap.call(uiMapInMap(context)).call(uiNotice(context));
+ overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
+ var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
+ var controls = controlsWrap.append("div").attr("class", "map-controls");
+ controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
+ controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
+ controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
+ controlsWrap.on("wheel.mapControls", function(d3_event) {
+ if (!d3_event.deltaX) {
+ controlsWrap.node().scrollTop += d3_event.deltaY;
+ }
+ });
+ var panes = overMap.append("div").attr("class", "map-panes");
+ var uiPanes = [
+ uiPaneBackground(context),
+ uiPaneMapData(context),
+ uiPaneIssues(context),
+ uiPanePreferences(context),
+ uiPaneHelp(context)
+ ];
+ uiPanes.forEach(function(pane) {
+ controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
+ panes.call(pane.renderPane);
+ });
+ ui.info = uiInfo(context);
+ overMap.call(ui.info);
+ overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
+ overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
+ var about = content.append("div").attr("class", "map-footer");
+ about.append("div").attr("class", "api-status").call(uiStatus(context));
+ var footer = about.append("div").attr("class", "map-footer-bar fillD");
+ footer.append("div").attr("class", "flash-wrap footer-hide");
+ var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
+ footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
+ var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
+ aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
+ var apiConnections = context.connection().apiConnections();
+ if (apiConnections && apiConnections.length > 1) {
+ aboutList.append("li").attr("class", "source-switch").call(
+ uiSourceSwitch(context).keys(apiConnections)
+ );
+ }
+ aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
+ aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
+ var issueLinks = aboutList.append("li");
+ issueLinks.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD/issues").attr("aria-label", _t("report_a_bug")).call(svgIcon("#iD-icon-bug", "light")).call(uiTooltip().title(() => _t.append("report_a_bug")).placement("top"));
+ issueLinks.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD/blob/develop/CONTRIBUTING.md#translating").attr("aria-label", _t("help_translate")).call(svgIcon("#iD-icon-translate", "light")).call(uiTooltip().title(() => _t.append("help_translate")).placement("top"));
+ aboutList.append("li").attr("class", "version").call(uiVersion(context));
+ if (!context.embed()) {
+ aboutList.call(uiAccount(context));
+ }
+ ui.onResize();
+ map2.redrawEnable(true);
+ ui.hash = behaviorHash(context);
+ ui.hash();
+ if (!ui.hash.hadLocation) {
+ map2.centerZoom([0, 0], 2);
+ }
+ window.onbeforeunload = function() {
+ return context.save();
+ };
+ window.onunload = function() {
+ context.history().unlock();
+ };
+ select_default2(window).on("resize.editor", function() {
+ ui.onResize();
+ });
+ var panPixels = 80;
+ context.keybinding().on("\u232B", function(d3_event) {
+ d3_event.preventDefault();
+ }).on([_t("sidebar.key"), "`", "\xB2", "@"], ui.sidebar.toggle).on("\u2190", pan([panPixels, 0])).on("\u2191", pan([0, panPixels])).on("\u2192", pan([-panPixels, 0])).on("\u2193", pan([0, -panPixels])).on(uiCmd("\u2325\u2190"), pan([map2.dimensions()[0], 0])).on(uiCmd("\u2325\u2191"), pan([0, map2.dimensions()[1]])).on(uiCmd("\u2325\u2192"), pan([-map2.dimensions()[0], 0])).on(uiCmd("\u2325\u2193"), pan([0, -map2.dimensions()[1]])).on(uiCmd("\u2318" + _t("background.key")), function quickSwitch(d3_event) {
+ if (d3_event) {
+ d3_event.stopImmediatePropagation();
+ d3_event.preventDefault();
+ }
+ var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
+ if (previousBackground) {
+ var currentBackground = context.background().baseLayerSource();
+ corePreferences("background-last-used-toggle", currentBackground.id);
+ corePreferences("background-last-used", previousBackground.id);
+ context.background().baseLayerSource(previousBackground);
+ }
+ }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ context.map().toggleWireframe();
+ }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ var mode = context.mode();
+ if (mode && /^draw/.test(mode.id))
+ return;
+ var layer = context.layers().layer("osm");
+ if (layer) {
+ layer.enabled(!layer.enabled());
+ if (!layer.enabled()) {
+ context.enter(modeBrowse(context));
+ }
+ }
+ }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
+ d3_event.preventDefault();
+ context.map().toggleHighlightEdited();
+ });
+ context.on("enter.editor", function(entered) {
+ container.classed("mode-" + entered.id, true);
+ }).on("exit.editor", function(exited) {
+ container.classed("mode-" + exited.id, false);
+ });
+ context.enter(modeBrowse(context));
+ if (!_initCounter++) {
+ if (!ui.hash.startWalkthrough) {
+ context.container().call(uiSplash(context)).call(uiRestore(context));
+ }
+ context.container().call(ui.shortcuts);
+ }
+ var osm = context.connection();
+ var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
+ if (osm && auth) {
+ osm.on("authLoading.ui", function() {
+ context.container().call(auth);
+ }).on("authDone.ui", function() {
+ auth.close();
+ });
+ }
+ _initCounter++;
+ if (ui.hash.startWalkthrough) {
+ ui.hash.startWalkthrough = false;
+ context.container().call(uiIntro(context));
+ }
+ function pan(d2) {
+ return function(d3_event) {
+ if (d3_event.shiftKey)
+ return;
+ if (context.container().select(".combobox").size())
+ return;
+ d3_event.preventDefault();
+ context.map().pan(d2, 100);
+ };
+ }
+ }
+ let ui = {};
+ let _loadPromise;
+ ui.ensureLoaded = () => {
+ if (_loadPromise)
+ return _loadPromise;
+ return _loadPromise = Promise.all([
+ // must have strings and presets before loading the UI
+ _mainLocalizer.ensureLoaded(),
+ _mainPresetIndex.ensureLoaded()
+ ]).then(() => {
+ if (!context.container().empty())
+ render(context.container());
+ }).catch((err) => console.error(err));
+ };
+ ui.restart = function() {
+ context.keybinding().clear();
+ _loadPromise = null;
+ context.container().selectAll("*").remove();
+ ui.ensureLoaded();
+ };
+ ui.lastPointerType = function() {
+ return _lastPointerType;
+ };
+ ui.svgDefs = svgDefs(context);
+ ui.flash = uiFlash(context);
+ ui.sidebar = uiSidebar(context);
+ ui.photoviewer = uiPhotoviewer(context);
+ ui.shortcuts = uiShortcuts(context);
+ ui.onResize = function(withPan) {
+ var map2 = context.map();
+ var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
+ utilGetDimensions(context.container().select(".sidebar"), true);
+ if (withPan !== void 0) {
+ map2.redrawEnable(false);
+ map2.pan(withPan);
+ map2.redrawEnable(true);
+ }
+ map2.dimensions(mapDimensions);
+ ui.photoviewer.onMapResize();
+ ui.checkOverflow(".top-toolbar");
+ ui.checkOverflow(".map-footer-bar");
+ var resizeWindowEvent = document.createEvent("Event");
+ resizeWindowEvent.initEvent("resizeWindow", true, true);
+ document.dispatchEvent(resizeWindowEvent);
+ };
+ ui.checkOverflow = function(selector, reset) {
+ if (reset) {
+ delete _needWidth[selector];
+ }
+ var selection2 = context.container().select(selector);
+ if (selection2.empty())
+ return;
+ var scrollWidth = selection2.property("scrollWidth");
+ var clientWidth = selection2.property("clientWidth");
+ var needed = _needWidth[selector] || scrollWidth;
+ if (scrollWidth > clientWidth) {
+ selection2.classed("narrow", true);
+ if (!_needWidth[selector]) {
+ _needWidth[selector] = scrollWidth;
+ }
+ } else if (scrollWidth >= needed) {
+ selection2.classed("narrow", false);
+ }
+ };
+ ui.togglePanes = function(showPane) {
+ var hidePanes = context.container().selectAll(".map-pane.shown");
+ var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
+ hidePanes.classed("shown", false).classed("hide", true);
+ context.container().selectAll(".map-pane-control button").classed("active", false);
+ if (showPane) {
+ hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
+ context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
+ showPane.classed("shown", true).classed("hide", false);
+ if (hidePanes.empty()) {
+ showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
+ } else {
+ showPane.style(side, "0px");
+ }
+ } else {
+ hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
+ select_default2(this).classed("shown", false).classed("hide", true);
+ });
+ }
+ };
+ var _editMenu = uiEditMenu(context);
+ ui.editMenu = function() {
+ return _editMenu;
+ };
+ ui.showEditMenu = function(anchorPoint, triggerType, operations) {
+ ui.closeEditMenu();
+ if (!operations && context.mode().operations)
+ operations = context.mode().operations();
+ if (!operations || !operations.length)
+ return;
+ if (!context.map().editableDataEnabled())
+ return;
+ var surfaceNode = context.surface().node();
+ if (surfaceNode.focus) {
+ surfaceNode.focus();
+ }
+ operations.forEach(function(operation) {
+ if (operation.point)
+ operation.point(anchorPoint);
+ });
+ _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
+ context.map().supersurface.call(_editMenu);
+ };
+ ui.closeEditMenu = function() {
+ context.map().supersurface.select(".edit-menu").remove();
+ };
+ var _saveLoading = select_default2(null);
+ context.uploader().on("saveStarted.ui", function() {
+ _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
+ context.container().call(_saveLoading);
+ }).on("saveEnded.ui", function() {
+ _saveLoading.close();
+ _saveLoading = select_default2(null);
+ });
+ marked.use({
+ mangle: false,
+ headerIds: false
+ });
+ return ui;
+ }
+
+ // modules/core/context.js
+ function coreContext() {
+ const dispatch14 = dispatch_default("enter", "exit", "change");
+ let context = utilRebind({}, dispatch14, "on");
+ let _deferred2 = /* @__PURE__ */ new Set();
+ context.version = package_default.version;
+ context.privacyVersion = "20201202";
+ context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
+ context.changeset = null;
+ let _defaultChangesetComment = context.initialHashParams.comment;
+ let _defaultChangesetSource = context.initialHashParams.source;
+ let _defaultChangesetHashtags = context.initialHashParams.hashtags;
+ context.defaultChangesetComment = function(val) {
+ if (!arguments.length)
+ return _defaultChangesetComment;
+ _defaultChangesetComment = val;
+ return context;
+ };
+ context.defaultChangesetSource = function(val) {
+ if (!arguments.length)
+ return _defaultChangesetSource;
+ _defaultChangesetSource = val;
+ return context;
+ };
+ context.defaultChangesetHashtags = function(val) {
+ if (!arguments.length)
+ return _defaultChangesetHashtags;
+ _defaultChangesetHashtags = val;
+ return context;
+ };
+ let _setsDocumentTitle = true;
+ context.setsDocumentTitle = function(val) {
+ if (!arguments.length)
+ return _setsDocumentTitle;
+ _setsDocumentTitle = val;
+ return context;
+ };
+ let _documentTitleBase = document.title;
+ context.documentTitleBase = function(val) {
+ if (!arguments.length)
+ return _documentTitleBase;
+ _documentTitleBase = val;
+ return context;
+ };
+ let _ui;
+ context.ui = () => _ui;
+ context.lastPointerType = () => _ui.lastPointerType();
+ let _keybinding = utilKeybinding("context");
+ context.keybinding = () => _keybinding;
+ select_default2(document).call(_keybinding);
+ let _connection = services.osm;
+ let _history;
+ let _validator;
+ let _uploader;
+ context.connection = () => _connection;
+ context.history = () => _history;
+ context.validator = () => _validator;
+ context.uploader = () => _uploader;
+ context.preauth = (options2) => {
+ if (_connection) {
+ _connection.switch(options2);
+ }
+ return context;
+ };
+ context.locale = function(locale2) {
+ if (!arguments.length)
+ return _mainLocalizer.localeCode();
+ _mainLocalizer.preferredLocaleCodes(locale2);
+ return context;
+ };
+ function afterLoad(cid, callback) {
+ return (err, result) => {
+ if (err) {
+ if (err.status === 400 || err.status === 401 || err.status === 403) {
+ if (_connection) {
+ _connection.logout();
+ }
+ }
+ if (typeof callback === "function") {
+ callback(err);
+ }
+ return;
+ } else if (_connection && _connection.getConnectionId() !== cid) {
+ if (typeof callback === "function") {
+ callback({ message: "Connection Switched", status: -1 });
+ }
+ return;
+ } else {
+ _history.merge(result.data, result.extent);
+ if (typeof callback === "function") {
+ callback(err, result);
+ }
+ return;
+ }
+ };
+ }
+ context.loadTiles = (projection2, callback) => {
+ const handle = window.requestIdleCallback(() => {
+ _deferred2.delete(handle);
+ if (_connection && context.editableDataEnabled()) {
+ const cid = _connection.getConnectionId();
+ _connection.loadTiles(projection2, afterLoad(cid, callback));
+ }
+ });
+ _deferred2.add(handle);
+ };
+ context.loadTileAtLoc = (loc, callback) => {
+ const handle = window.requestIdleCallback(() => {
+ _deferred2.delete(handle);
+ if (_connection && context.editableDataEnabled()) {
+ const cid = _connection.getConnectionId();
+ _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
+ }
+ });
+ _deferred2.add(handle);
+ };
+ context.loadEntity = (entityID, callback) => {
+ if (_connection) {
+ const cid = _connection.getConnectionId();
+ _connection.loadEntity(entityID, afterLoad(cid, callback));
+ _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
+ }
+ };
+ context.zoomToEntity = (entityID, zoomTo) => {
+ context.loadEntity(entityID, (err, result) => {
+ if (err)
+ return;
+ if (zoomTo !== false) {
+ const entity = result.data.find((e3) => e3.id === entityID);
+ if (entity) {
+ _map.zoomTo(entity);
+ }
+ }
+ });
+ _map.on("drawn.zoomToEntity", () => {
+ if (!context.hasEntity(entityID))
+ return;
+ _map.on("drawn.zoomToEntity", null);
+ context.on("enter.zoomToEntity", null);
+ context.enter(modeSelect(context, [entityID]));
+ });
+ context.on("enter.zoomToEntity", () => {
+ if (_mode.id !== "browse") {
+ _map.on("drawn.zoomToEntity", null);
+ context.on("enter.zoomToEntity", null);
+ }
+ });
+ };
+ let _minEditableZoom = 16;
+ context.minEditableZoom = function(val) {
+ if (!arguments.length)
+ return _minEditableZoom;
+ _minEditableZoom = val;
+ if (_connection) {
+ _connection.tileZoom(val);
+ }
+ return context;
+ };
+ context.maxCharsForTagKey = () => 255;
+ context.maxCharsForTagValue = () => 255;
+ context.maxCharsForRelationRole = () => 255;
+ context.cleanTagKey = (val) => utilCleanOsmString(val, context.maxCharsForTagKey());
+ context.cleanTagValue = (val) => utilCleanOsmString(val, context.maxCharsForTagValue());
+ context.cleanRelationRole = (val) => utilCleanOsmString(val, context.maxCharsForRelationRole());
+ let _inIntro = false;
+ context.inIntro = function(val) {
+ if (!arguments.length)
+ return _inIntro;
+ _inIntro = val;
+ return context;
+ };
+ context.save = () => {
+ if (_inIntro || context.container().select(".modal").size())
+ return;
+ let canSave;
+ if (_mode && _mode.id === "save") {
+ canSave = false;
+ if (services.osm && services.osm.isChangesetInflight()) {
+ _history.clearSaved();
+ return;
+ }
+ } else {
+ canSave = context.selectedIDs().every((id2) => {
+ const entity = context.hasEntity(id2);
+ return entity && !entity.isDegenerate();
+ });
+ }
+ if (canSave) {
+ _history.save();
+ }
+ if (_history.hasChanges()) {
+ return _t("save.unsaved_changes");
+ }
+ };
+ context.debouncedSave = debounce_default(context.save, 350);
+ function withDebouncedSave(fn) {
+ return function() {
+ const result = fn.apply(_history, arguments);
+ context.debouncedSave();
+ return result;
+ };
+ }
+ context.hasEntity = (id2) => _history.graph().hasEntity(id2);
+ context.entity = (id2) => _history.graph().entity(id2);
+ let _mode;
+ context.mode = () => _mode;
+ context.enter = (newMode) => {
+ if (_mode) {
+ _mode.exit();
+ dispatch14.call("exit", this, _mode);
+ }
+ _mode = newMode;
+ _mode.enter();
+ dispatch14.call("enter", this, _mode);
+ };
+ context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
+ context.activeID = () => _mode && _mode.activeID && _mode.activeID();
+ let _selectedNoteID;
+ context.selectedNoteID = function(noteID) {
+ if (!arguments.length)
+ return _selectedNoteID;
+ _selectedNoteID = noteID;
+ return context;
+ };
+ let _selectedErrorID;
+ context.selectedErrorID = function(errorID) {
+ if (!arguments.length)
+ return _selectedErrorID;
+ _selectedErrorID = errorID;
+ return context;
+ };
+ context.install = (behavior) => context.surface().call(behavior);
+ context.uninstall = (behavior) => context.surface().call(behavior.off);
+ let _copyGraph;
+ context.copyGraph = () => _copyGraph;
+ let _copyIDs = [];
+ context.copyIDs = function(val) {
+ if (!arguments.length)
+ return _copyIDs;
+ _copyIDs = val;
+ _copyGraph = _history.graph();
+ return context;
+ };
+ let _copyLonLat;
+ context.copyLonLat = function(val) {
+ if (!arguments.length)
+ return _copyLonLat;
+ _copyLonLat = val;
+ return context;
+ };
+ let _background;
+ context.background = () => _background;
+ let _features;
+ context.features = () => _features;
+ context.hasHiddenConnections = (id2) => {
+ const graph = _history.graph();
+ const entity = graph.entity(id2);
+ return _features.hasHiddenConnections(entity, graph);
+ };
+ let _photos;
+ context.photos = () => _photos;
+ let _map;
+ context.map = () => _map;
+ context.layers = () => _map.layers();
+ context.surface = () => _map.surface;
+ context.editableDataEnabled = () => _map.editableDataEnabled();
+ context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
+ context.editable = () => {
+ const mode = context.mode();
+ if (!mode || mode.id === "save")
+ return false;
+ return _map.editableDataEnabled();
+ };
+ let _debugFlags = {
+ tile: false,
+ // tile boundaries
+ collision: false,
+ // label collision bounding boxes
+ imagery: false,
+ // imagery bounding polygons
+ target: false,
+ // touch targets
+ downloaded: false
+ // downloaded data from osm
+ };
+ context.debugFlags = () => _debugFlags;
+ context.getDebug = (flag) => flag && _debugFlags[flag];
+ context.setDebug = function(flag, val) {
+ if (arguments.length === 1)
+ val = true;
+ _debugFlags[flag] = val;
+ dispatch14.call("change");
+ return context;
+ };
+ let _container = select_default2(null);
+ context.container = function(val) {
+ if (!arguments.length)
+ return _container;
+ _container = val;
+ _container.classed("ideditor", true);
+ return context;
+ };
+ context.containerNode = function(val) {
+ if (!arguments.length)
+ return context.container().node();
+ context.container(select_default2(val));
+ return context;
+ };
+ let _embed;
+ context.embed = function(val) {
+ if (!arguments.length)
+ return _embed;
+ _embed = val;
+ return context;
+ };
+ let _assetPath = "";
+ context.assetPath = function(val) {
+ if (!arguments.length)
+ return _assetPath;
+ _assetPath = val;
+ _mainFileFetcher.assetPath(val);
+ return context;
+ };
+ let _assetMap = {};
+ context.assetMap = function(val) {
+ if (!arguments.length)
+ return _assetMap;
+ _assetMap = val;
+ _mainFileFetcher.assetMap(val);
+ return context;
+ };
+ context.asset = (val) => {
+ if (/^http(s)?:\/\//i.test(val))
+ return val;
+ const filename = _assetPath + val;
+ return _assetMap[filename] || filename;
+ };
+ context.imagePath = (val) => context.asset(`img/${val}`);
+ context.reset = context.flush = () => {
+ context.debouncedSave.cancel();
+ Array.from(_deferred2).forEach((handle) => {
+ window.cancelIdleCallback(handle);
+ _deferred2.delete(handle);
+ });
+ Object.values(services).forEach((service) => {
+ if (service && typeof service.reset === "function") {
+ service.reset(context);
+ }
+ });
+ context.changeset = null;
+ _validator.reset();
+ _features.reset();
+ _history.reset();
+ _uploader.reset();
+ context.container().select(".inspector-wrap *").remove();
+ return context;
+ };
+ context.projection = geoRawMercator();
+ context.curtainProjection = geoRawMercator();
+ context.init = () => {
+ instantiateInternal();
+ initializeDependents();
+ return context;
+ function instantiateInternal() {
+ _history = coreHistory(context);
+ context.graph = _history.graph;
+ context.pauseChangeDispatch = _history.pauseChangeDispatch;
+ context.resumeChangeDispatch = _history.resumeChangeDispatch;
+ context.perform = withDebouncedSave(_history.perform);
+ context.replace = withDebouncedSave(_history.replace);
+ context.pop = withDebouncedSave(_history.pop);
+ context.overwrite = withDebouncedSave(_history.overwrite);
+ context.undo = withDebouncedSave(_history.undo);
+ context.redo = withDebouncedSave(_history.redo);
+ _validator = coreValidator(context);
+ _uploader = coreUploader(context);
+ _background = rendererBackground(context);
+ _features = rendererFeatures(context);
+ _map = rendererMap(context);
+ _photos = rendererPhotos(context);
+ _ui = uiInit(context);
+ }
+ function initializeDependents() {
+ if (context.initialHashParams.presets) {
+ _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
+ }
+ if (context.initialHashParams.locale) {
+ _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
+ }
+ _mainLocalizer.ensureLoaded();
+ _mainPresetIndex.ensureLoaded();
+ _background.ensureLoaded();
+ Object.values(services).forEach((service) => {
+ if (service && typeof service.init === "function") {
+ service.init();
+ }
+ });
+ _map.init();
+ _validator.init();
+ _features.init();
+ if (services.maprules && context.initialHashParams.maprules) {
+ json_default(context.initialHashParams.maprules).then((mapcss) => {
+ services.maprules.init();
+ mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
+ }).catch(() => {
+ });
+ }
+ if (!context.container().empty()) {
+ _ui.ensureLoaded().then(() => {
+ _background.init();
+ _photos.init();
+ });
+ }
+ }
+ };
+ return context;
+ }
+
+ // modules/services/nominatim.js
+ var apibase = nominatimApiUrl;
+ var _inflight = {};
+ var _nominatimCache;
+ var nominatim_default = {
+ init: function() {
+ _inflight = {};
+ _nominatimCache = new import_rbush7.default();
+ },
+ reset: function() {
+ Object.values(_inflight).forEach(function(controller) {
+ controller.abort();
+ });
+ _inflight = {};
+ _nominatimCache = new import_rbush7.default();
+ },
+ countryCode: function(location, callback) {
+ this.reverse(location, function(err, result) {
+ if (err) {
+ return callback(err);
+ } else if (result.address) {
+ return callback(null, result.address.country_code);
+ } else {
+ return callback("Unable to geocode", null);
+ }
+ });
+ },
+ reverse: function(loc, callback) {
+ var cached = _nominatimCache.search(
+ { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] }
+ );
+ if (cached.length > 0) {
+ if (callback)
+ callback(null, cached[0].data);
+ return;
+ }
+ var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] };
+ var url = apibase + "reverse?" + utilQsString(params);
+ if (_inflight[url])
+ return;
+ var controller = new AbortController();
+ _inflight[url] = controller;
+ json_default(url, {
+ signal: controller.signal,
+ headers: {
+ "Accept-Language": _mainLocalizer.localeCodes().join(",")
+ }
+ }).then(function(result) {
+ delete _inflight[url];
+ if (result && result.error) {
+ throw new Error(result.error);
+ }
+ var extent = geoExtent(loc).padByMeters(200);
+ _nominatimCache.insert(Object.assign(extent.bbox(), { data: result }));
+ if (callback)
+ callback(null, result);
+ }).catch(function(err) {
+ delete _inflight[url];
+ if (err.name === "AbortError")
+ return;
+ if (callback)
+ callback(err.message);
+ });
+ },
+ search: function(val, callback) {
+ const params = {
+ q: val,
+ limit: 10,
+ format: "json"
+ };
+ var url = apibase + "search?" + utilQsString(params);
+ if (_inflight[url])
+ return;
+ var controller = new AbortController();
+ _inflight[url] = controller;
+ json_default(url, {
+ signal: controller.signal,
+ headers: {
+ "Accept-Language": _mainLocalizer.localeCodes().join(",")
+ }
+ }).then(function(result) {
+ delete _inflight[url];
+ if (result && result.error) {
+ throw new Error(result.error);
+ }
+ if (callback)
+ callback(null, result);
+ }).catch(function(err) {
+ delete _inflight[url];
+ if (err.name === "AbortError")
+ return;
+ if (callback)
+ callback(err.message);
+ });
+ }
+ };
+
+ // node_modules/name-suggestion-index/lib/matcher.js
+ var import_which_polygon4 = __toESM(require_which_polygon(), 1);
+
+ // node_modules/name-suggestion-index/lib/simplify.js
+ var import_diacritics3 = __toESM(require_diacritics(), 1);
+ function simplify2(str2) {
+ if (typeof str2 !== "string")
+ return "";
+ return import_diacritics3.default.remove(
+ str2.replace(/&/g, "and").replace(/İ/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u2000-\u206f\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e7f\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase()
+ );
+ }
+
+ // node_modules/name-suggestion-index/config/matchGroups.json
+ var matchGroups_default = {
+ matchGroups: {
+ adult_gaming_centre: [
+ "amenity/casino",
+ "amenity/gambling",
+ "leisure/adult_gaming_centre"
+ ],
+ beauty: [
+ "shop/beauty",
+ "shop/hairdresser_supply"
+ ],
+ bed: [
+ "shop/bed",
+ "shop/furniture"
+ ],
+ beverages: [
+ "shop/alcohol",
+ "shop/beer",
+ "shop/beverages",
+ "shop/kiosk",
+ "shop/wine"
+ ],
+ camping: [
+ "tourism/camp_site",
+ "tourism/caravan_site"
+ ],
+ car_parts: [
+ "shop/car_parts",
+ "shop/car_repair",
+ "shop/tires",
+ "shop/tyres"
+ ],
+ clinic: [
+ "amenity/clinic",
+ "amenity/doctors",
+ "healthcare/clinic",
+ "healthcare/laboratory",
+ "healthcare/physiotherapist",
+ "healthcare/sample_collection",
+ "healthcare/dialysis"
+ ],
+ convenience: [
+ "shop/beauty",
+ "shop/chemist",
+ "shop/convenience",
+ "shop/cosmetics",
+ "shop/grocery",
+ "shop/kiosk",
+ "shop/newsagent",
+ "shop/perfumery"
+ ],
+ coworking: [
+ "amenity/coworking_space",
+ "office/coworking",
+ "office/coworking_space"
+ ],
+ dentist: [
+ "amenity/dentist",
+ "amenity/doctors",
+ "healthcare/dentist"
+ ],
+ electronics: [
+ "office/telecommunication",
+ "shop/computer",
+ "shop/electronics",
+ "shop/hifi",
+ "shop/kiosk",
+ "shop/mobile",
+ "shop/mobile_phone",
+ "shop/telecommunication"
+ ],
+ fabric: [
+ "shop/fabric",
+ "shop/haberdashery",
+ "shop/sewing"
+ ],
+ fashion: [
+ "shop/accessories",
+ "shop/bag",
+ "shop/boutique",
+ "shop/clothes",
+ "shop/department_store",
+ "shop/fashion",
+ "shop/fashion_accessories",
+ "shop/sports",
+ "shop/shoes"
+ ],
+ financial: [
+ "amenity/bank",
+ "office/accountant",
+ "office/financial",
+ "office/financial_advisor",
+ "office/tax_advisor",
+ "shop/tax"
+ ],
+ fitness: [
+ "leisure/fitness_centre",
+ "leisure/fitness_center",
+ "leisure/sports_centre",
+ "leisure/sports_center"
+ ],
+ food: [
+ "amenity/bar",
+ "amenity/cafe",
+ "amenity/fast_food",
+ "amenity/ice_cream",
+ "amenity/pub",
+ "amenity/restaurant",
+ "shop/bakery",
+ "shop/candy",
+ "shop/chocolate",
+ "shop/coffee",
+ "shop/confectionary",
+ "shop/confectionery",
+ "shop/food",
+ "shop/kiosk",
+ "shop/ice_cream",
+ "shop/pastry",
+ "shop/tea"
+ ],
+ fuel: [
+ "amenity/fuel",
+ "shop/gas",
+ "shop/convenience;gas",
+ "shop/gas;convenience"
+ ],
+ gift: [
+ "shop/gift",
+ "shop/card",
+ "shop/cards",
+ "shop/kiosk",
+ "shop/stationery"
+ ],
+ hardware: [
+ "shop/bathroom_furnishing",
+ "shop/carpet",
+ "shop/diy",
+ "shop/doityourself",
+ "shop/doors",
+ "shop/electrical",
+ "shop/flooring",
+ "shop/hardware",
+ "shop/hardware_store",
+ "shop/power_tools",
+ "shop/tool_hire",
+ "shop/tools",
+ "shop/trade"
+ ],
+ health_food: [
+ "shop/health",
+ "shop/health_food",
+ "shop/herbalist",
+ "shop/nutrition_supplements"
+ ],
+ hobby: [
+ "shop/electronics",
+ "shop/hobby",
+ "shop/books",
+ "shop/games",
+ "shop/collector",
+ "shop/toys",
+ "shop/model",
+ "shop/video_games",
+ "shop/anime"
+ ],
+ hospital: [
+ "amenity/doctors",
+ "amenity/hospital",
+ "healthcare/hospital"
+ ],
+ houseware: [
+ "shop/houseware",
+ "shop/interior_decoration"
+ ],
+ lifeboat_station: [
+ "amenity/lifeboat_station",
+ "emergency/lifeboat_station",
+ "emergency/marine_rescue"
+ ],
+ lodging: [
+ "tourism/hotel",
+ "tourism/motel"
+ ],
+ money_transfer: [
+ "amenity/money_transfer",
+ "shop/money_transfer"
+ ],
+ office_supplies: [
+ "shop/office_supplies",
+ "shop/stationary",
+ "shop/stationery"
+ ],
+ outdoor: [
+ "shop/clothes",
+ "shop/outdoor",
+ "shop/sports"
+ ],
+ parcel_locker: [
+ "amenity/parcel_locker",
+ "amenity/vending_machine"
+ ],
+ pharmacy: [
+ "amenity/doctors",
+ "amenity/pharmacy",
+ "healthcare/pharmacy"
+ ],
+ playground: [
+ "amenity/theme_park",
+ "leisure/amusement_arcade",
+ "leisure/playground"
+ ],
+ rental: [
+ "amenity/bicycle_rental",
+ "amenity/boat_rental",
+ "amenity/car_rental",
+ "amenity/truck_rental",
+ "amenity/vehicle_rental",
+ "shop/kiosk",
+ "shop/rental"
+ ],
+ school: [
+ "amenity/childcare",
+ "amenity/college",
+ "amenity/kindergarten",
+ "amenity/language_school",
+ "amenity/prep_school",
+ "amenity/school",
+ "amenity/university"
+ ],
+ storage: [
+ "shop/storage_units",
+ "shop/storage_rental"
+ ],
+ substation: [
+ "power/station",
+ "power/substation",
+ "power/sub_station"
+ ],
+ supermarket: [
+ "shop/food",
+ "shop/frozen_food",
+ "shop/greengrocer",
+ "shop/grocery",
+ "shop/supermarket",
+ "shop/wholesale"
+ ],
+ variety_store: [
+ "shop/variety_store",
+ "shop/discount",
+ "shop/convenience"
+ ],
+ vending: [
+ "amenity/vending_machine",
+ "shop/kiosk",
+ "shop/vending_machine"
+ ],
+ weight_loss: [
+ "amenity/clinic",
+ "amenity/doctors",
+ "amenity/weight_clinic",
+ "healthcare/counselling",
+ "leisure/fitness_centre",
+ "office/therapist",
+ "shop/beauty",
+ "shop/diet",
+ "shop/food",
+ "shop/health_food",
+ "shop/herbalist",
+ "shop/nutrition",
+ "shop/nutrition_supplements",
+ "shop/weight_loss"
+ ],
+ wholesale: [
+ "shop/wholesale",
+ "shop/supermarket",
+ "shop/department_store"
+ ]
+ }
+ };
+
+ // node_modules/name-suggestion-index/config/genericWords.json
+ var genericWords_default = {
+ genericWords: [
+ "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$",
+ "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$",
+ "^(club|green|out|ware)\\s?house$",
+ "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$",
+ "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$",
+ "^(hofladen|librairie|magazine?|maison)$",
+ "^(mobile home|skate)?\\s?park$",
+ "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$",
+ "^\\?+$",
+ "^private$",
+ "^tattoo( studio)?$",
+ "^windmill$",
+ "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$"
+ ]
+ };
+
+ // node_modules/name-suggestion-index/config/trees.json
+ var trees_default = {
+ trees: {
+ brands: {
+ emoji: "\u{1F354}",
+ mainTag: "brand:wikidata",
+ sourceTags: ["brand", "name"],
+ nameTags: {
+ primary: "^(name|name:\\w+)$",
+ alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$"
+ }
+ },
+ flags: {
+ emoji: "\u{1F6A9}",
+ mainTag: "flag:wikidata",
+ nameTags: {
+ primary: "^(flag:name|flag:name:\\w+)$",
+ alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$"
+ }
+ },
+ operators: {
+ emoji: "\u{1F4BC}",
+ mainTag: "operator:wikidata",
+ sourceTags: ["operator"],
+ nameTags: {
+ primary: "^(name|name:\\w+|operator|operator:\\w+)$",
+ alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$"
+ }
+ },
+ transit: {
+ emoji: "\u{1F687}",
+ mainTag: "network:wikidata",
+ sourceTags: ["network"],
+ nameTags: {
+ primary: "^network$",
+ alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$"
+ }
+ }
+ }
+ };
+
+ // node_modules/name-suggestion-index/lib/matcher.js
+ var matchGroups = matchGroups_default.matchGroups;
+ var trees = trees_default.trees;
+ var Matcher = class {
+ //
+ // `constructor`
+ // initialize the genericWords regexes
+ constructor() {
+ this.matchIndex = void 0;
+ this.genericWords = /* @__PURE__ */ new Map();
+ (genericWords_default.genericWords || []).forEach((s2) => this.genericWords.set(s2, new RegExp(s2, "i")));
+ this.itemLocation = void 0;
+ this.locationSets = void 0;
+ this.locationIndex = void 0;
+ this.warnings = [];
+ }
+ //
+ // `buildMatchIndex()`
+ // Call this to prepare the matcher for use
+ //
+ // `data` needs to be an Object indexed on a 'tree/key/value' path.
+ // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
+ // {
+ // 'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
+ // 'brands/amenity/bar': { properties: {}, items: [ {}, {}, … ] },
+ // …
+ // }
+ //
+ buildMatchIndex(data) {
+ const that = this;
+ if (that.matchIndex)
+ return;
+ that.matchIndex = /* @__PURE__ */ new Map();
+ const seenTree = /* @__PURE__ */ new Map();
+ Object.keys(data).forEach((tkv) => {
+ const category = data[tkv];
+ const parts = tkv.split("/", 3);
+ const t2 = parts[0];
+ const k2 = parts[1];
+ const v2 = parts[2];
+ const thiskv = `${k2}/${v2}`;
+ const tree = trees[t2];
+ let branch = that.matchIndex.get(thiskv);
+ if (!branch) {
+ branch = {
+ primary: /* @__PURE__ */ new Map(),
+ alternate: /* @__PURE__ */ new Map(),
+ excludeGeneric: /* @__PURE__ */ new Map(),
+ excludeNamed: /* @__PURE__ */ new Map()
+ };
+ that.matchIndex.set(thiskv, branch);
+ }
+ const properties = category.properties || {};
+ const exclude = properties.exclude || {};
+ (exclude.generic || []).forEach((s2) => branch.excludeGeneric.set(s2, new RegExp(s2, "i")));
+ (exclude.named || []).forEach((s2) => branch.excludeNamed.set(s2, new RegExp(s2, "i")));
+ const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()];
+ let items = category.items;
+ if (!Array.isArray(items) || !items.length)