const h=document.getElementById("go"),n=document.getElementById("target"),a=document.getElementById("hint");function u(t){const e=t.trim().replace(/^https?:\/\//i,"").replace(/^\/+/,"");if(!e)return null;const s=e.match(/^([^\/\?#]+)(.*)$/);if(!s||!s[1])return null;const r=s[1].toLowerCase().replace(/:\d+$/,""),i=s[2]||"",d=i.startsWith("/")||i.startsWith("?")||i.startsWith("#")||i===""?i:`/${i}`;if(/^0x[a-f0-9]{40}$/.test(r))return{kind:"address",address:r,rest:d};const o=r.match(/^(0x[a-f0-9]{40})\.w3eth\.io$/);if(o&&o[1])return{kind:"address",address:o[1],rest:d};const c=r.match(/^((?:[a-z0-9-]+\.)+eth)\.(?:limo|link)$/);return c&&c[1]?{kind:"ens",host:c[1],rest:d}:/^(?:[a-z0-9-]+\.)+eth$/.test(r)?{kind:"ens",host:r,rest:d}:null}function l(t){const e=t.rest||"/";return t.kind==="ens"?`http://${t.host}${e}`:`https://${t.address}.w3eth.io${e}`}function f(t){a.textContent=t,a.hidden=!1,n.classList.add("invalid"),setTimeout(()=>{n.classList.remove("invalid")},450)}function m(){a.textContent="",a.hidden=!0}n.addEventListener("input",()=>{a.hidden||m()});h.addEventListener("submit",t=>{t.preventDefault();const e=u(n.value);if(!e){f("Couldn't parse that. Try `name.eth` or a 0x… contract address."),n.focus(),n.select();return}location.assign(l(e))});document.querySelectorAll(".chip[data-target]").forEach(t=>{t.addEventListener("click",()=>{const e=t.dataset.target??"";if(!e)return;n.value=e;const s=u(e);s&&location.assign(l(s))})});n.focus();
//# sourceMappingURL=home-DeqYfT9G.js.map
