');this.remove()});$(this).hasClass("via")||($(this).val()===""?t.addClass("d-none"):t.removeClass("d-none"));setTimeout(updateSearchButton,250)});$(document).on("click",".address-delete-btn",function(n){n.preventDefault();const t=$(this).closest(".address-form"),i=t.find(".address-input");i.val("");i.focus();i.hasClass("via")&&deleteViaForm(this);t.find(".address-result").hide(100,function(){t.append('');this.remove()});$(this).addClass("d-none");setTimeout(updateSearchButton,250)});$("#address-start").find(".address-input").on("focus input propertychange paste",function(){$(this).val()===""?$(this).closest(".address-form").find(".favorites").collapse("show"):$(this).closest(".address-form").find(".favorites").collapse("hide")});n=null;$(document).on("mousedown",function(t){n=$(t.target)});$(document).on("focus",".address-input",function(){$(this).hasClass("via")||($(this).val()!==""?$(this).parent().find(".address-delete-btn").removeClass("d-none"):$(this).parent().find(".address-delete-btn").addClass("d-none"))});$(document).on("blur",".address-input",function(){const t=$(n);t.hasClass("favorite-btn")||t.hasClass("favorite-delete-btn")||$(this).closest(".address-form").find(".favorites").collapse("hide")});$(document).on("click",".address",function(){map.showAddress($(this).val(),$(this).data("waypoint"))});$(document).on("click",".countries button",function(){if($dropdown=$(this).parent().find("ul"),!$dropdown.children().any(function(){return $(this).hasClass("dropdown-item")})){const n=$(this).parents(".input-group").find(".address-input").data("country");$dropdown.load("/CountriesDropdown",{current:n})}});$(document).on("click",".countries .dropdown-menu a",function(){var t=$(this).find(".flag");$(this).parents(".input-group").find(".address-input").data("country",$(this).data("country"));$(this).parents(".input-group").find(".dropdown-toggle").html(t.clone());const n=$(this).parents(".address-form");n.find(".address-result").hide(100,function(){n.append('');this.remove()});setTimeout(updateSearchButton,250)});$(document).on("keydown",".countries",function(n){n.keyCode!=13&&$(this).find("button").attr("aria-expanded")=="false"&&$(this).find(".dropdown-toggle").dropdown("toggle");var i=String.fromCharCode(n.keyCode).toLowerCase(),t=$(this).find("a").filter(function(){return $(this).text().toLowerCase().indexOf(i)===0}),r=$(t).is(":focus");r&&(t=$("a:focus").parent().nextAll().find("a").filter(function(){return $(this).text().toLowerCase().indexOf(i)===0}).first(),t.length==0&&(t=$(this).find("a").filter(function(){return $(this).text().toLowerCase().indexOf(i)===0})));t.first().focus()});t=function(n,t){var r=Handlebars.templates.address,u=r(n);const i=$("#address-start").find(".address-input");if(i.data("country",n.c).val(decodeURIComponent(n.q)),t)i.focus(),map.showAddress(decodeURIComponent(n.a),"start");else{const n=$("#address-start").find(".address-delete-btn");n.removeClass("d-none")}$("#address-start").append(u);$("#address-start").find(".address-result").show(200);$("#address-start").find(".dummy").remove();$("#address-start").find(".countries").find("button").html('