import"./hoisted.DebOr7RK.js";const o=t=>t.replace(/[&<>"]/g,e=>({"&":"&","<":"<",">":">",'"':"""})[e]),r=(new URLSearchParams(location.search).get("q")??"").trim().slice(0,100),u=document.querySelector('.search input[name="q"]');u&&(u.value=r);const w=document.getElementById("search-title"),v=document.getElementById("search-count"),x=document.getElementById("search-results"),h=document.getElementById("search-empty"),m="(min-width: 1180px) 270px, (min-width: 900px) 23vw, 48vw",B='',b=document.getElementById("search-ideas"),k=document.getElementById("ideas-results"),f=t=>t.map(e=>` ${e.i?`${e.as?``:""}`:""} ${e.tm?`${B} ${o(e.tm)}`:""} ${e.rv?`★ ${e.rv.toFixed(1)} (${e.rc})`:""} ${o(e.c)}${o(e.t)} `).join(""),C=t=>{t=[...t];for(let e=t.length-1;e>0;e--){const n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t},g=(t,e)=>{h.hidden=!1,h.textContent=e,k.innerHTML=f(C(t).slice(0,8)),b.hidden=!1},c=(t,e)=>e.length>1?t.includes(e):new RegExp(`(^|[^a-z])${e}`).test(t);async function E(){const t=await(await fetch("/search-index.json")).json(),e=r.toLowerCase().split(/\s+/).map(s=>s.replace(/[^\p{L}\p{N}'-]/gu,"")).filter(Boolean);if(!e.length)return g(t,"Type a country, a city or a trip idea above, or start with one of these.");w.textContent=`Results for “${r}”`;const n=[];for(const s of t){const i=s.t.toLowerCase(),y=s.d.toLowerCase(),$=s.c.toLowerCase();let l=0,d=!0;for(const a of e){const p=(c(i,a)?10:0)+(c(s.k,a)||c($,a)?6:0)+(c(y,a)?4:0)+(c(s.b,a)?1:0);if(!p){d=!1;break}l+=p}d&&n.push({it:s,s:l})}if(n.sort((s,i)=>i.s-s.s),v.textContent=`${n.length} ${n.length===1?"guide":"guides"}`,!n.length)return g(t,`No guides found for “${r}”. Try a country, a city or a shorter word, or pick an idea below.`);x.innerHTML=f(n.slice(0,48).map(s=>s.it))}E();