1(()=>{"use strict";const e=e=>{const r=hotel_settings.currency_symbol||"",o=hotel_settings.currency_position||"left";switch(e=t(e),o){case"left":e=r+e;break;case"right":e+=r;break;case"left_with_space":e=r+" "+e;break;case"right_with_space":e=e+" "+r}return e},t=e=>{const t=hotel_settings.number_decimal||0,r=hotel_settings.thousands_separator||"";return(e=(e/1).toFixed(t)).toString().replace(/\B(?=(\d{3})+(?!\d))/g,r)},r=(document.location.href,hotel_settings,hotel_settings?.url_page_rooms);let o=JSON.parse(window.localStorage.getItem("wphb_filter_rooms"))||{},n=!0;const a=document.querySelector(".hotel-booking-search"),c=(e,t)=>{const r=new URL(e);return Object.keys(t).forEach(e=>{r.searchParams.set(e,t[e])}),r},l=()=>{const e=document.querySelector(".wp-hotel-booking-search-rooms .hotel-booking-search form#hb-form-search-page");null!==e&&s(e,o)},s=(e,t,r=!1)=>{const o=document.querySelector(".wp-hotel-booking-search-rooms .hotel-booking-search ul.wphb-skeleton-animation"),a=document.querySelector(".wp-hotel-booking-search-rooms .hotel-booking-search .detail__booking-rooms"),l=document.querySelector(".wp-hotel-booking-search-rooms .sort-by-wrapper .show-number"),s=hotel_settings.wphb_rest_url;if(!s)return;if(0===Object.keys(t).length){const e=new Intl.DateTimeFormat("en-US",{month:"long"}).format,r=new Date,o=e(r)+" "+("0"+r.getDate()).slice(-2)+", "+r.getFullYear(),n=new Date((new Date).getTime()+864e5),a=e(n)+" "+("0"+n.getDate()).slice(-2)+", "+n.getFullYear();t.check_in_date=o,t.check_out_date=a,t.adults=null,t.max_child=null,t.paged=1;const c=document.querySelector("#hotel-booking-search-filter");if(c){const e=c.querySelector(".hb-price-field"),r=c.querySelector(".hb-rating-field"),o=c.querySelector(".hb-type-field");e&&(t.min_price="",t.max_price=""),r&&(t.rating=""),o&&(t.room_type="")}}const p=c(s+"wphb/v1/rooms/search-rooms",{...t});wp.apiFetch({path:"wphb/v1/rooms/search-rooms"+p.search,method:"GET"}).then(t=>{r&&r.classList.remove("wphb_loading");const{status:c,data:s,message:d}=t;n&&i(e,o,a);const h=document.querySelector(".rooms-pagination");if(h&&h.remove(),"error"===c)throw new Error(d||"Error");a.style.display="block",a.innerHTML=s.content,l&&(l.innerHTML=s.show_number);const p=s.pagination;if(void 0!==p){const t=(new DOMParser).parseFromString(p,"text/html").querySelector(".rooms-pagination");t&&(a.after(t),u(e,o,a))}}).catch(e=>{a.innerHTML="";const t=document.querySelector(".wphb-message.error");t?t.innerHTML=e.message||"Error: Query wphb/v1/rooms/search-room":a.insertAdjacentHTML("beforeend",`<p class="wphb-message error" style="display:block">${e.message||"Error: Query wphb/v1/rooms/search-room"}</p>`),l&&(l.innerHTML="")}).finally(()=>{o.style.display="none",window.localStorage.setItem("wphb_filter_rooms",JSON.stringify(t));let r=c(document.location,t);r=((e,t)=>(["min_price","max_price","rating","room_type"].map(r=>{t.hasOwnProperty(r)||e.searchParams.delete(r)}),e))(r,t);const a=r.href;if("select-room-extra"!=new URL(a).searchParams.get("is_page_room_extra")&&!n){window.history.pushState("","",r);const e=document.querySelector('.wp-hotel-booking-search-rooms .hotel-booking-search form#hb-form-search-page input[name="check_in_date"]'),o=document.querySelector('.wp-hotel-booking-search-rooms .hotel-booking-search form#hb-form-search-page input[name="check_out_date"]');e.value=t.check_in_date,o.value=t.check_out_date}d(e),n=!1;const l=document.querySelector(".wp-hotel-booking-search-rooms .hotel-booking-search");null!=l&&l.scrollIntoView({behavior:"smooth"}),h()})},i=(e,t,r)=>{null!==e&&e.addEventListener("submit",n=>{n.preventDefault();const a=e.querySelector('input[name="check_in_date"]').value,c=e.querySelector('input[name="check_out_date"]').value,l=e.querySelector('select[name="adults_capacity"]')?e.querySelector('select[name="adults_capacity"]').value:0,i=e.querySelector('select[name="max_child"]')?e.querySelector('select[name="max_child"]').value:0,u=e.querySelector('input[name="paged"]')?e.querySelector('input[name="paged"]').value:1,d=e.querySelector("button.wphb-button");if(d&&d.classList.add("wphb_loading"),""===a||""===c)return alert(" Please select check in and check out date and search again! "),void(d&&d.classList.remove("wphb_loading"));r.innerHTML="",t.style.display="block",o={...o,check_in_date:a,check_out_date:c,adults:l,max_child:i,paged:u},window.localStorage.setItem("wphb_filter_rooms",JSON.stringify(o)),s(e,o,d)})},u=(e,t,r)=>{const o=document.querySelectorAll(".wp-hotel-booking-search-rooms .rooms-pagination .page-numbers");o.length>0&&o.forEach(n=>n.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),r.style.display="none",t.style.display="block";
1let c=JSON.parse(window.localStorage.getItem("wphb_filter_rooms"))||{};if(a.currentTarget.getAttribute("href")){const t=[...o].filter(e=>e.classList.contains("current")),r=parseInt(a.currentTarget.textContent)||n.classList.contains("next")&&parseInt(t[0].textContent)+1||n.classList.contains("prev")&&parseInt(t[0].textContent)-1;c.paged=r,s(e,{...c})}}))},d=e=>{const t=document.querySelectorAll(".wp-hotel-booking-search-rooms form.hb-page-search-room-results");if(0==t.length)return;const r=e.querySelector('input[name="check_in_date"]')?.value,o=e.querySelector('input[name="check_out_date"]')?.value,n=document.querySelector("#hb-form-search-page");let a=1,c=0;n&&(a=n.querySelector('select[name="adults_capacity"]')?n.querySelector('select[name="adults_capacity"]').value:1,c=n.querySelector('select[name="max_child"]')?n.querySelector('select[name="max_child"]').value:0),t.forEach(function(e){e.addEventListener("submit",function(t){t.preventDefault();const n=e.querySelector('select[name="hb-num-of-rooms"]')?.value,l=e.querySelector('input[name="room-id"]')?.value,s=e.querySelector('select[name="hb-num-of-rooms"]')?.value;if(0==s)return void alert("Please select quantity room!");if(""===r||""===o)return void alert(" Please select check in and check out date and search again! ");const i=e.querySelector("button.hb_add_to_cart");i&&i.classList.add("wphb_loading"),(async(e,t=!1,n,l)=>{const s=[],i=e.querySelectorAll("input.hb_optional_quantity_selected");i&&i.forEach(e=>{if(e.checked){const t=e.dataset.id,r=parseInt(e.parentElement?.nextElementSibling?.querySelector('input[class="hb_optional_quantity"]')?.value)||1;t&&s.push({extraID:t,qty:r})}});try{const i=await wp.apiFetch({path:"wphb/v1/rooms/book-rooms",method:"POST",data:{roomID:l,checkinDate:r,checkoutDate:o,numRoom:n,extraData:s,adults:a,maxChild:c}}),{status:u,data:d}=i,h=d?.results?.redirect||"",p=d?.results?.message||"",m=d?.results?.has_extra||!1;if(t&&t.classList.remove("wphb_loading"),"error"===u)throw new Error(p);if(m){const r=d?.results?.extra_html||"",o=e.querySelector(".hb_search_add_to_cart");o?(t.style.display="none",o.insertAdjacentHTML("beforeend",r)):e.insertAdjacentHTML("beforeend",r)}else window.location.href=h}catch(e){alert(e)}})(e,i,n,l)}),e.addEventListener("click",t=>{let r=t.target;if(r.classList.contains("add-extra-to-cart")){r.classList.add("wphb_loading");const t=r.dataset.cartid;l(e,t,r)}})});const l=async(e,t,r)=>{const o=[],n=e.querySelectorAll("input.hb_optional_quantity_selected");n&&n.forEach(e=>{if(e.checked){const t=e?.dataset.id||null,r=parseInt(e.parentElement?.nextElementSibling?.querySelector(`input[name="hb_optional_quantity[${t}]"]`)?.value)||1;t&&o.push({extraID:t,qty:r})}});try{const e=await wp.apiFetch({path:"wphb/v1/rooms/add-extra-cart",method:"POST",data:{cartID:t,extraData:o}}),{status:n,data:a,message:c}=e;if(r.classList.remove("wphb_loading"),"error"===n)throw new Error(c);const l=a?.redirect||"";"success"===n&&l&&(window.location.href=l)}catch(e){alert(e)}}},h=()=>{const e=document.querySelector(".hb-page-search-room-results select.number_room_select");null!=e&&e.addEventListener("change",function(t){t.preventDefault();const r=document.querySelectorAll(".hb-page-search-room-results .hb_optional_quantity");null!=r&&r.forEach(function(t){t.value=e.value})})},p=()=>{if(!document.querySelector(".hb-selection-field"))return;const t=document.querySelectorAll(".hb-price-field");if(t.length)for(let r=0;r<t.length;r++)t[r].querySelector(".hb-price-range").noUiSlider.on("update",function(t,r,o){const n=parseInt(t[0]),a=parseInt(t[1]);m("price",n+"-"+a,e(n)+"-"+e(a))});const r=document.querySelectorAll(".hb-rating-field");r.length&&[...r].map(e=>{[...e.querySelectorAll('input[type="checkbox"]')].map(e=>{if(e.checked){const t=e.value,r=e.closest("label").querySelector("span").innerHTML.replace("-"," ");m("rating",t,r)}e.addEventListener("change",function(){const t=this.value,r=e.closest("label").querySelector("span").innerHTML.replace("-"," ");m("rating",t,r)})})});const o=document.querySelectorAll(".hb-type-field");if(o.length)for(let e=0;e<o.length;e++)[...o[e].querySelectorAll('input[type="checkbox"]')].map(e=>{if(e.checked){const t=e.value,r=e.closest("label").querySelector("span").innerHTML.replace("-"," ");m("room-type",t,r)}e.addEventListener("change",function(){const t=this.value,r=e.closest("label").querySelector("span").innerHTML.replace("-"," ");m("room-type",t,r)})})},m=(e,t,r)=>{const o=document.querySelector(".hb-selection-field .list");let n=o.querySelector(`li[data-field="${e}"]`);if("rating"!==e&&"room-type"!==e||(n=o.querySelector(`li[data-field="${e}"][data-value="${t}"]`)),n)"rating"===e||"room-type"===e?n.remove():t?(n.setAttribute("data-value",t),n.querySelector(".title").innerHTML=r):n.remove();else{const n=`<li class="list-item" data-field = "${e}" data-value="${t}">
1\n <span class="title">${r}</span>\n <svg class="remove" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">\n <path d="M12.5 3.5L3.5 12.5" stroke="#AAAFB6" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M12.5 12.5L3.5 3.5" stroke="#AAAFB6" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n </li>`;o.insertAdjacentHTML("beforeend",n)}},y=()=>{const e=document.querySelectorAll(".hb-form-number-input");e.length<1||e.forEach(e=>{const t=e.querySelector('input[type="number"]'),r=e.querySelector(".hb-form-field-list"),o=e.querySelector(".hb-number-field-value"),n=e.querySelector(".hb-goUp"),a=e.querySelector(".hb-goDown"),c=parseInt(t.getAttribute("min"))||0,l=e=>{s=e,t.value=e,o.textContent=e,s<=c?(a.style.opacity="0.5",a.style.cursor="not-allowed"):(a.style.opacity="1",a.style.cursor="pointer")};let s=parseInt(t.value)||c;l(s),t.addEventListener("click",e=>{e.stopPropagation(),document.querySelectorAll(".hb-form-field-list").forEach(e=>{e!==r&&e.classList.remove("active")}),r.classList.toggle("active")}),n.addEventListener("click",e=>{e.stopPropagation(),s++,l(s)}),a.addEventListener("click",e=>{e.stopPropagation(),s>c&&(s--,l(s))})})};document.addEventListener("click",e=>{e.target.closest(".hb-form-number")||document.querySelectorAll(".hb-form-field-list").forEach(e=>{e.classList.remove("active")})}),document.addEventListener("keyup",e=>{let t=e.target;if(t.closest(".hb-form-number-input")&&"INPUT"===t.tagName){let e=t.closest(".hb-form-number-input");e.querySelector(".hb-number-field-value")&&(e.querySelector(".hb-number-field-value").innerText=parseInt(t.value))}}),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",y):y(),window.hbReinitNumberInputs=y,document.addEventListener("DOMContentLoaded",()=>{l(),(()=>{const e=document.querySelector("form.hb-select-extra-results");null!==e&&e.addEventListener("submit",function(t){t.preventDefault();const r=e.querySelector('button[type="submit"]');r&&r.classList.add("wphb_loading"),(async()=>{const t=[],r=e.querySelector('input[name="cart_id"]').value,o=e.querySelectorAll("input.hb_optional_quantity_selected");o&&o.forEach(e=>{if(e.checked){const r=e?.dataset.id||null,o=parseInt(e.parentElement?.nextElementSibling?.querySelector('input[class="hb_optional_quantity"]')?.value)||1;r&&t.push({extraID:r,qty:o})}});try{const e=await wp.apiFetch({path:"wphb/v1/rooms/add-extra-cart",method:"POST",data:{cartID:r,extraData:t}}),{status:o,redirect:n}=e;"success"===o&&n&&(window.location.href=n)}catch(e){alert(e.message&&e.message)}})()})})(),(()=>{const e=document.querySelector(".hotel-booking-search-el form#hb-form-search-page");e&&d(e)})(),(()=>{if(hotel_settings?.is_page_search){const e=document.querySelector(".thim-widget-search-room");if(null!=e){const t=e.querySelector("form#hb-form-search-page");null!=t&&t.removeAttribute("id");const r=e.querySelector("#hotel-booking-results");null!=r&&r.remove()}}const e=document.querySelectorAll('form[name="hb-search-form"]:not(#hb-form-search-page)');e.length>0&&e.forEach(e=>{e.addEventListener("submit",function(t){t.preventDefault();const o=e.querySelector('input[name="check_in_date"]').value,n=e.querySelector('input[name="check_out_date"]').value,a=e.querySelector('[name="adults_capacity"]')?e.querySelector('[name="adults_capacity"]').value:0,l=e.querySelector('[name="max_child"]')?e.querySelector('[name="max_child"]').value:0,s=e.querySelector('input[name="paged"]')?e.querySelector('input[name="paged"]').value:1,i=e.querySelector('[name="number-of-rooms"]')?e.querySelector('[name="number-of-rooms"]').value:1;if(""===o||""===n)return void alert(" Please select check in and check out date and search again! ");const u={check_in_date:o,check_out_date:n,adults:a,max_child:l,paged:s,room_qty:i};window.localStorage.setItem("wphb_filter_rooms",JSON.stringify(u));const d=c(document.location,u).search;window.location.href=r+d})})})(),(()=>{const e=document.getElementById("hb-cart-form");if(null===e)return;const t=e.querySelector("a.hb_checkout");null!==t&&t.addEventListener("click",function(e){e.preventDefault(),hotel_settings?.checkout_page_url?window.location.href=hotel_settings.checkout_page_url:alert("Please set checkout page url in settings")})})(),(()=>{const e=document.querySelector(".thim-hb-show-coupon-form"),t=document.querySelector(".thim-hb-coupon-form-wrapper");e&&t&&e.addEventListener("click",function(r){r.preventDefault(),"none"===t.style.display||"none"===getComputedStyle(t).display?(t.style.display="block",e.textContent=e.dataset.hideText||"Hide coupon form"):(t.style.display="none",e.textContent=e.dataset.showText||"Click here to enter your co
1de")})})(),a&&hotel_settings&&hotel_settings.is_page_search&&((()=>{const t=document.querySelectorAll(".hb-price-field");if(t)for(let r=0;r<t.length;r++){const n=t[r],a=n.getAttribute("data-min"),c=n.getAttribute("data-max");let s=n.getAttribute("data-step");if(""===a||""===c||""===s)continue;const i=n.querySelector(".hb-min-price"),u=n.querySelector(".hb-max-price"),d=n.querySelector(".hb-price-range"),h=o.min_price||a,p=o.max_price||c;s=parseInt(s),noUiSlider.create(d,{start:[parseInt(h),parseInt(p)],connect:!0,step:s,tooltips:!1,range:{min:parseInt(a),max:parseInt(c)}}),d.noUiSlider.on("update",function(t,r,o){let a=t[0],c=t[1];isNaN(a)&&(a=0),isNaN(c)&&(c=0),i.value=parseInt(a),u.value=parseInt(c),n.querySelector(".min").innerHTML=e(a),n.querySelector(".max").innerHTML=e(c)});const m=n.querySelector("button.apply");m&&m.addEventListener("click",function(e){e.preventDefault();const t=i.value,r=u.value;o={...o,min_price:parseInt(t),max_price:parseInt(r)},window.localStorage.setItem("wphb_filter_rooms",JSON.stringify(o)),l()})}})(),(()=>{const e=document.querySelectorAll(".hb-rating-field");if(e)for(let t=0;t<e.length;t++){const r=e[t],n=r.querySelectorAll('input[type="checkbox"]');[...o.rating||[]].map(e=>{r.querySelector(`input[name ="rating"][value ="${e}"]`).checked=!0});for(let e=0;e<n.length;e++)n[e].addEventListener("change",function(e){const t=r.querySelectorAll('input[type="checkbox"]:checked');let n=[];[...t].map(e=>{n.push(e.value)}),o={...o,rating:n},window.localStorage.setItem("wphb_filter_rooms",JSON.stringify(o)),l()})}})(),(()=>{const e=document.querySelectorAll(".hb-type-field");if(e)for(let t=0;t<e.length;t++){const r=e[t],n=r.querySelectorAll('input[type="checkbox"]');[...o.room_type||[]].map(e=>{r.querySelector(`input[name ="room_type"][value ="${e}"]`).checked=!0});for(let e=0;e<n.length;e++)n[e].addEventListener("change",function(e){const t=r.querySelectorAll('input[type="checkbox"]:checked');let n=[];[...t].map(e=>{n.push(e.value)}),o={...o,room_type:n},window.localStorage.setItem("wphb_filter_rooms",JSON.stringify(o)),l()})}})(),p(),document.addEventListener("click",function(e){const t=e.target;if(!t.classList.contains("remove"))return;if(!t.closest(".hb-selection-field"))return;const r=t.closest(".list-item");switch(r.getAttribute("data-field")){case"room-type":((e="all")=>{[...document.querySelectorAll(".hb-type-field")].map(t=>{const r=t.querySelectorAll('input[type="checkbox"]');"all"===e?[...r].map(e=>{e.checked=!1}):t.querySelector(`.room-type-list input[value="${e}"]`).checked=!1;let n=[];[...t.querySelectorAll('input[type="checkbox"]:checked')].map(e=>{n.push(e.value)}),o={...o,room_type:n},window.localStorage.setItem("wphb_filter_rooms",JSON.stringify(o)),l()})})(r.getAttribute("data-value"));break;case"rating":((e="all")=>{[...document.querySelectorAll(".hb-rating-field")].map(t=>{const r=t.querySelectorAll('input[type="checkbox"]');"all"===e?[...r].map(e=>{e.checked=!1}):t.querySelector(`.rating-list input[value="${e}"]`).checked=!1;let n=[];[...t.querySelectorAll('input[type="checkbox"]:checked')].map(e=>{n.push(e.value)}),o={...o,rating:n},window.localStorage.setItem("wphb_filter_rooms",JSON.stringify(o)),l()})})(r.getAttribute("data-value"));break;case"price":(()=>{const e=document.querySelectorAll(".hb-price-field");if(e.length)for(let t=0;t<e.length;t++){const r=e[t];r.querySelector(".hb-price-range").noUiSlider.updateOptions({start:[parseInt(r.getAttribute("data-min")),parseInt(r.getAttribute("data-max"))]})}o.hasOwnProperty("min_price")&&delete o.min_price,o.hasOwnProperty("max_price")&&delete o.max_price,window.localStorage.setItem("wphb_filter_rooms",JSON.stringify(o)),l()})()}r&&r.remove()}),(()=>{const e=document.querySelectorAll(".search-filter-form");if(e)for(let t=0;t<e.length;t++){const r=e[t];r.querySelector(".clear-filter button").addEventListener("click",function(e){const t=document.querySelector(".hb-price-field");if(t){const e=t.getAttribute("data-min"),r=t.getAttribute("data-max");t.querySelector(".hb-price-range").noUiSlider.updateOptions({start:[parseInt(e),parseInt(r)]})}[...r.querySelectorAll(".hb-rating-field input")].map(e=>{e.checked=!1}
1),[...r.querySelectorAll(".hb-type-field input")].map(e=>{e.checked=!1}),o.hasOwnProperty("min_price")&&delete o.min_price,o.hasOwnProperty("max_price")&&delete o.max_price,o.hasOwnProperty("rating")&&delete o.rating,o.hasOwnProperty("room_type")&&delete o.room_type,[...document.querySelectorAll(".hb-selection-field .list-item")].map(e=>{e.remove()}),window.localStorage.setItem("wphb_filter_rooms",JSON.stringify(o)),l()})}})(),(()=>{const e=document.querySelector(".sort-by-wrapper");if(!e)return;const t=o.sort_by||"",r=e.querySelectorAll("ul li"),n=e.querySelector(".toggle");[...r].map(e=>{e.getAttribute("data-value")===t?(n.innerHTML=e.innerHTML,e.classList.add("active")):e.classList.remove("active"),e.addEventListener("click",function(t){const r=e.getAttribute("data-value");o={...o,sort_by:r},window.localStorage.setItem("wphb_filter_rooms",JSON.stringify(o)),l()})})})())})})();
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.