!function(){"use strict";class t{constructor(){}invite(t,e,n){!function(t,e,n,o,i){try{new $.JsonRpcClient({ajaxUrl:o}).call(i,t,(function(t){n(e,t)}),(function(t){n(e,null)}))}catch(t){n(e,null)}}([n],t,e,"/backend/comingsoon","signup_invite")}}const e={currentsearch:"",init:function(){const t=document.getElementById("search_query"),n=document.getElementById("cityCountryInput"),o=document.getElementById("resultsDropdown");n.addEventListener("input",(async function(){const t=n.value.trim();if(t.length<3)return o.innerHTML="",void o.classList.remove("show");const e=`https://geo.moviao.com/api/?q=${t}&limit=10&layer=city&layer=district&layer=country&lang=en`;try{const t=await fetch(e),n=await t.json();let i=null,s=null;const r=n.features.filter((t=>{const{osm_value:e,name:n,city:o,country:r,countrycode:c}=t.properties;return i=t.geometry.coordinates[1],s=t.geometry.coordinates[0],(n||o||r||c||i||s||e)&&("town"===e||"city"===e||"village"===e||"district"===e||"country"===e)})).map((t=>t.properties));o.innerHTML=r.map((t=>`\n
  • \n \n
  • \n `)).join(""),o.classList.add("show")}catch(t){}})),o.addEventListener("click",(function(e){if("BUTTON"===e.target.tagName){const i=e.target.dataset.geoLat,s=e.target.dataset.geoLng,r=e.target.dataset.geoType,c=e.target.dataset.geoCnt;n.value=e.target.textContent.trim(),o.classList.remove("show"),window.location.href="/find?q="+t.value+"&location="+n.value+"&source=E&lat="+i+"&lng="+s+"&type="+r+"&cnt="+c}})),document.addEventListener("click",(function(t){o.contains(t.target)||t.target===n?cityCountryInput.value.trim().length>0&&(e.currentsearch=cityCountryInput.value.trim(),t.target.value=""):(o.classList.remove("show"),0===cityCountryInput.value.trim().length&&(cityCountryInput.value=e.currentsearch))})),document.getElementById("clear_search_query").addEventListener("click",(function(){document.getElementById("search_query").value=""}));const i=document.getElementById("fsubscribe");i&&i.addEventListener("submit",(function(t){t.preventDefault(),e.onSubscribe(t)}))},showSuccess:function(){document.getElementById("form_success").style.visibility="visible",document.getElementById("form_success").style.display="block"},hideErrors:function(){document.getElementById("form_success").style.visibility="hidden",document.getElementById("form_success").style.display="none",document.getElementById("error_exists").style.visibility="hidden",document.getElementById("error_exists").style.display="none",document.getElementById("error_unknown").style.visibility="hidden",document.getElementById("error_unknown").style.display="none"},showErrorUnknown:function(){document.getElementById("error_unknown").style.visibility="visible",document.getElementById("error_unknown").style.display="block"},showErrorExists:function(){document.getElementById("error_exists").style.visibility="visible",document.getElementById("error_exists").style.display="block"},isValidEmailStrict:function(t){if(!t||"string"!=typeof t)return!1;if(t.length>254)return!1;const e=t.split("@");if(2!==e.length)return!1;const[n,o]=e;return!(n.length>64)&&(!!/^[a-zA-Z0-9._%+-]+$/.test(n)&&!!/^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(o))},disableButton:function(){document.getElementById("bsubmit").disabled=!0},enableButton:function(){document.getElementById("bsubmit").disabled=!1},onSubscribe:function(n){try{const n=this,o=document.getElementById("email").value;if(!e.isValidEmailStrict(o))return void e.showErrorExists();const i={MAIL:o,CNT:"ZZ"};e.disableButton(),e.hideErrors();(new t).invite(n,(function(t,n){e.enableButton(),null!==n&&!0===n.result?(document.getElementById("email").value="",e.showSuccess()):null!==n&&!1===n.result&&307===n.code?e.showErrorExists():e.showErrorUnknown()}),i)}finally{n.preventDefault()}}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(function(){e.init()})):e.init()}();