PageSourceSearch

https://abstour.by/build/assets/hotels-MacfWotX.js

js abstour.by collected 2026-10-02 20:14:56 UTC 6,865 bytes, 1 lines download raw bytes

1import{h as L,p as A}from"./cards-CT4eQxGR.js";const p=document.querySelector('meta[name="csrf-token"]')?.getAttribute("content"),h={"Content-Type":"application/json",Accept:"application/json",...p&&{"X-CSRF-TOKEN":p}},y=window.location.search;async function g(t,e=200,n=50){for(let o=0;o<e;o++){const r=document.getElementById(t);if(r)return r;await new Promise(s=>setTimeout(s,n))}return null}function B(t,e,n){if(n){const o=document.getElementById(n);if(o)return o}return document.querySelector(`input[type="radio"][name="${t}"][value="${e}"]`)}async function m(t,e,n,o=200,r=50){if(!e)return null;let s=null;for(let c=0;c<o&&(s=B(t,e,n),!s);c++)await new Promise(a=>setTimeout(a,r));return s&&(s.checked=!0,s.dispatchEvent(new Event("change",{bubbles:!0}))),s}function f(t,e){return t.get(e)||t.get(`amp;${e}`)}(async()=>{if(!y)return;window.Alpine&&await window.Alpine.nextTick();const t=new URLSearchParams(y),e=f(t,"destination")||f(t,"country");e&&(await m("country",e,`hotels-country-${e}`),await T(e),window.Alpine&&await window.Alpine.nextTick());const n=f(t,"region");if(n){let c=await g(`hotels-region-${n}`);c?(c.checked=!0,c.dispatchEvent(new Event("change",{bubbles:!0}))):c=await m("region",n,null)}const o=f(t,"resort");if(o){let c=await g(`hotels-resort-${o}`);c?(c.checked=!0,c.dispatchEvent(new Event("change",{bubbles:!0}))):c=await m("resort",o,null)}const r=f(t,"hotel_class");if(r){const c=document.getElementById(`hotels-class-${r}`);c&&(c.checked=!0)}const s=f(t,"service");s&&(s.includes(",")?s.split(","):[s]).forEach(a=>{const i=document.getElementById(`hotels-service-${a.trim()}`);i&&(i.checked=!0)})})();const w=document.getElementById("show-mobile-filter");w&&w.addEventListener("click",()=>{if(window.innerWidth<=768){const t=document.getElementById("filter-panel");t&&t.classList.remove("hidden")}});const E=document.getElementById("close-mobile-filter");E&&E.addEventListener("click",()=>{if(window.innerWidth<=768){const t=document.getElementById("filter-panel");t&&t.classList.add("hidden")}});function $(){const t=document.getElementById("filter-panel");if(!t)return;function e(){const r={};document.querySelectorAll(".filter-input").forEach(i=>{const l=i.querySelector('input[type="radio"]:checked');if(!l||l.value=="all")return;const u=l.name,d=l.value;switch(u){case"country":r.country=d;break;case"feeding":r.meal_type=d;break;default:r[u]=d}}),document.querySelectorAll(".filter-input input[type='checkbox']:checked").forEach(i=>{const l=i.name,u=i.value;r[l]=[...r[l]||[],u]});const a=document.querySelectorAll('input[name="service"]:checked');if(a.length>0){const i=Array.from(a).map(l=>l.value);r.service=i.join(",")}return r}const n=document.getElementById("filter-show-result-btn"),o=document.getElementById("filter-reset-result-btn");n&&n.addEventListener("click",()=>{const r=e();v(r)}),o&&o.addEventListener("click",()=>{const r=document.getElementById("hotels-country-all");r&&(r.checked=!0);const s=document.getElementById("hotels-region-all");s&&(s.checked=!0);const c=document.getElementById("hotels-resort-all");c&&(c.checked=!0),t.querySelectorAll('input[type="radio"].filter-input:checked').forEach(i=>{i.value!=="all"&&setTimeout(()=>{i.checked=!1},0)}),["hotel_class","feeding","service"].forEach(i=>{const l=t.querySelectorAll(`input[name="${i}"]:checked`);l.length>0&&l.forEach(u=>{setTimeout(()=>{u.checked=!1},0)})}),v({})})}async function v(t){let e,n;window.innerWidth<=768?(document.getElementById("close-mobile-filter").click(),e=document.querySelector("#hotels-page"),n="start"):(e=document.querySelector("#result-count"),n="center"),e&&setTimeout(()=>{e.scrollIntoView({behavior:"smooth",block:n})},100);let o=document.querySelector(".filtered-content");try{const r=new URLSearchParams(t).toString();let s=!1,c="";r?(s=!0,c=`/hotels?${r}`):(s=!1,c="/hotels"),window.history.pushState({filters:t},"",c);const a=await fetch(`/api${c}`,{method:"GET",headers:h}),i=await a.json();if(a.ok){o.innerHTML="",i.total?i.data.forEach(S=>{o.insertAdjacentHTML("beforeEnd",L(S))}):o.innerHTML="Результаты не найдены";const l=document.getElementById("result-count");l&&(l.innerHTML=i.total);const u=document.getElementById("count-text");switch(i.total){case 1:u.innerHTML="предложение";break;case 2:case 3:case 4:u.innerHTML="предложения";break;default:u.innerHTML="предложений";break}const d=document.getElementById("pagination");d&&(d.innerHTML="",d.innerHTML=A(1,i.total,i.per_page,c,s))}else console.error("Ошибка сервера:",i)}catch(r){console.error("Ошибка:",r)}}$();const k=document.getElementById("filter-panel");k&&k.addEventListener("change",t=>{const e=t.target;
1if(e.type==="radio"){if(e.value==="all"){(e.name==="country"||e.name==="region"||e.name==="resort")&&(window.Alpine.store("common").countries=null,window.Alpine.store("common").regions=null,window.Alpine.store("common").resorts=null);return}e.name==="country"?T(e.value):e.name==="region"?b(e.value,"regions"):e.name==="resort"&&b(e.value,"resorts")}});async function T(t){const e=`/api/hotels/filters/by-country/${t}`;try{const n=await fetch(e,{method:"GET",headers:h}),o=await n.json();n.ok?(window.Alpine.store("common").regions=o.regions,window.Alpine.store("common").resorts=o.resorts):console.error("Ошибка сервера:",o)}catch(n){console.error("Ошибка:",n)}}async function b(t,e){const n=`/api/${e}/${t}/destination`;try{const o=await fetch(n,{method:"GET",headers:h}),r=await o.json();o.ok?q(r.id):console.error("Ошибка сервера:",r)}catch(o){console.error("Ошибка:",o)}}function q(t){const e=document.querySelector("#countries-list").dataset.countries,n=JSON.parse(e),o=[];n.forEach(r=>{r.id==t&&o.push(r)}),window.Alpine.store("common").countries=o}const I=document.querySelector("#hotels-search-input");I&&(I.addEventListener("input",async t=>{const e=t.target.value;if(e)try{const n=`/api/hotels/search?q=${e}`,o=await fetch(n,{method:"GET",headers:h}),r=await o.json();if(o.ok){const s=document.querySelector("#hotels-search-result");s.classList.remove("hidden"),s.innerHTML="",r.data.length?r.data.forEach(c=>{const a=_(c.title,e);s.insertAdjacentHTML("beforeEnd",`<a href="${c.url}" class="block cursor-pointer text-vertical-overflow text-vertical-overflow-1">${a}</a>`)}):s.innerHTML="Результаты не найдены"}else console.error("Ошибка сервера:",r)}catch(n){console.error("Ошибка:",n)}}),document.addEventListener("click",t=>{const e=document.querySelector("#hotels-search-input"),n=document.querySelector("#hotels-search-result");!e.contains(t.target)&&!n.contains(t.target)&&n.classList.add("hidden")}));function _(t,e){if(!e)return t;const n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${n})`,"gi");return t.replace(o,'<span class="color-secondary">$1</span>')}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.