1"use strict";(self.webpackChunklanding_page=self.webpackChunklanding_page||[]).push([[8984],{1683:(o,t,e)=>{e.d(t,{s:()=>l});const l=(o,t)=>{const e=(o=>{const t=null===o||void 0===o?void 0:o.cutoffAmount;if(null===t||void 0===t||""===t)return null;const e=Number(t);return Number.isFinite(e)&&e>0?e:null})(o);if(null===e)return null;const l=Number(t),i=Math.round(100*(e-(Number.isFinite(l)?l:0)))/100;return!Number.isFinite(l)||l<e?"Add \u20b9".concat(i," more to use this coupon"):null}},3976:(o,t,e)=>{e.d(t,{Ak:()=>x,C8:()=>s,CN:()=>yo,DE:()=>P,EI:()=>no,Eh:()=>j,GO:()=>h,GR:()=>y,IB:()=>Do,Jq:()=>Co,Jy:()=>M,L3:()=>N,Lo:()=>w,MF:()=>q,MQ:()=>X,N7:()=>K,O2:()=>z,P$:()=>oo,PG:()=>p,PH:()=>k,PU:()=>to,QD:()=>T,Qn:()=>d,Qo:()=>r,RT:()=>H,RU:()=>Eo,TP:()=>so,US:()=>G,Vz:()=>F,Wk:()=>L,Xr:()=>uo,Yy:()=>A,Z1:()=>b,Zf:()=>a,_B:()=>Ao,aK:()=>E,aO:()=>f,be:()=>_o,bx:()=>_,cc:()=>ao,cp:()=>vo,dP:()=>Q,eQ:()=>m,fj:()=>fo,h0:()=>ro,hK:()=>V,iR:()=>go,j$:()=>ko,jR:()=>ho,ls:()=>po,mA:()=>g,mI:()=>c,mN:()=>co,nC:()=>u,r3:()=>O,rC:()=>D,t3:()=>B,tO:()=>$,te:()=>Y,th:()=>eo,uB:()=>Z,uR:()=>lo,um:()=>U,x7:()=>C,xD:()=>S,xp:()=>W,yD:()=>mo,yJ:()=>io,yQ:()=>I,yX:()=>R,yZ:()=>Io,zr:()=>v,zv:()=>J});var l=e(9379),i=(e(854),e(666)),n=e(6471);const d=(o,t)=>{if(n.A.isCorporateBooking()){const e=n.A.getAvailabilityEndpoint(!1);return n.A.get(e,(0,l.A)((0,l.A)({},o),{},{ln:t}))}return i.A.get("hotel/v2/hotel/availability",(0,l.A)((0,l.A)({},o),{},{ln:t}))},a=o=>i.A.get("payments/v1/gateways/hotel",o),r=(o,t,e)=>i.A.get("payments/v1/gateways/hotel",(0,l.A)((0,l.A)({},o),{},{contextType:t,contextValue:e})),u=o=>i.A.post("users/v1/getOrCreateCustomerBookingToken",o),c=o=>i.A.post("hotel/authorised/v1/bookings",o),v=o=>i.A.post("payments/authorized/v2/order/",o),s=o=>i.A.post("payments/authorized/v2/order/success",o),h=o=>i.A.post("payments/v1/gift-cards/reverse-voucher-on-dismiss",o),p=o=>i.A.get("hotel/v1/bookings",o),f=o=>i.A.get("hotel/v1/bookings",o),m=o=>i.A.get("hotel/v2/bookings",o),g=(o,t)=>i.A.put("hotel/v1/hotel/".concat(o,"/view"),t),A=(o,t)=>i.A.put("hotel/v1/hotel/".concat(o,"/whatsapp"),t),y=o=>i.A.get("hotel/v1/hotel/reviews?placeId=".concat(o)),I=o=>i.A.get("hotel/v2/hotel/reviews?hotelId=".concat(o)),D=(o,t,e)=>i.A.get("/hotel/v2/hotel/nearby-locations?latitude=".concat(t,"&longitude=").concat(e,"&hotelId=").concat(o)),k=()=>i.A.get("hotel/authorised/v2/hotel/lookups?type=pending_reason&ln=en"),E=o=>i.A.post("hotel/authorised/v1/abandonReason",o),_=o=>i.A.get("hotel/v1/hotel/instagramData?userName=".concat(o)),C=o=>i.A.get("hotel/v2/promotions/get-promotion?hotelId=".concat(o)),P=o=>i.A.get("hotel/v2/promotions/get-promotion",o),T=o=>i.A.get("hotel/authorized/v2/promotions/get-memberdeal-promotions",o),b=o=>i.A.get("hotel/v1/faq/get-faq?hotelId=".concat(o)),S=o=>i.A.post("hotel/v1/faq/add-faq",o),w=(o,t)=>i.A.get("hotel/v2/hotel/policies/".concat(o,"?ln=").concat(t)),O=o=>i.A.post("hotel/v1/bookings/cancel",o),N=o=>i.A.post("hotel/v1/bookings/cancel/info",o),x=o=>i.A.get("payments/authorised/v2/order/paymentDetails?bookingId=".concat(o)),Y=(o,t)=>i.A.put("hotel/v1/hotel/".concat(o,"/").concat(t)),M=o=>i.A.post("hotel/v1/bookings/confirmation",o),R=o=>i.A.post("hotel/v1/hotel/travel-planner",o),B=(o,t)=>i.A.get("hotel/v1/hotel/is-lowest?hotelId=".concat(o,"&checkIn=").concat(t)),F=(o,t)=>i.A.get("hotel/v1/bookings/autofill?dialCode=".concat(o,"&mobile=").concat(t)),H=o=>{const t=new URLSearchParams(o).toString();return i.A.get("hotel/v2/promotions/returning-member-promotion?".concat(t))},G=o=>i.A.post("hotel/v2/promotions/verify-sterling-member",o),L=o=>i.A.post("hotel/v1/abandonReason/price-enquiry",o),j=o=>i.A.get("payments/v2/order/paymentDetails?bookingId=".concat(o)),U=o=>i.A.get("hotel/v1/profile/getProfile?hotelId=".concat(o)),V=()=>i.A.get("hotel/v1/hotel/slugs-list"),z=(o,t)=>i.A.get("hotel/v2/promotions/get-promotion-id?id=".concat(o,"&hotelId=").concat(t)),q=o=>i.A.get("hotel/v1/pricing_and_inventory/calendar-list",o),W=o=>i.A.get("payments/v1/tax/list?hotelId=".concat(o,"&page=1&pageSize=100&getDefaultTaxes=false")),Q=o=>i.A.post("hotel/v1/bookings/prices-logs",o),K=o=>i.A.post("hotel/v1/bookings/is-room-available",o),Z=o=>i.A.post("hotel/v2/promotions/validate-coupon-codes",o),J=o=>i.A.get("hotel/v2/bookings/".concat(o)),$=o=>i.A.post("hotel/authorised/v1/bookings/modify-booking",o),X=function(o){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,l="payments/v1/gateways/payment-provider?hotelId=".concat(o);return t&&(l+="&contextType=".concat(t)),e&&(l+="&contextValue=".concat(e)),i.A.get(l)},oo=o=>localStorage.getItem("corporateToken")?i.A.get("hotel/v1/corporate/agents/".concat(o)):Promise.resolve({status:404,data:null}),to=o=>i.A.get("/hotel/v1/hotel/bnpl-config?hotelId=".concat(o)),eo=o=>i.A.get("hotel/v1/chatbot/scripttag?hotelId=".concat(o)),lo=o=>i.A.post("hotel/v1/hotel/scraper/get-latest-price",o),io=o=>i.A.get("hotel/v2/promotions/retargeting-promotion-hotel?hotelId=".concat(o)),no=o=>i.A.post("users/v1/otpCreateLoginAccount",o),ao=o=>i.A.post("users/v1/otpLoginAccount",o),ro=o=>i.A.post("users/v1/verifyOtpLoginAccount",o),uo=o=>i.A.post("users/v1/verifyOtpCreateLoginAccount",o),co=o=>i.A.post("hotel/v2/bookings/is-rooms-available",o),vo=o=>i.A.post("hotel/v1/hotel/inventory-retargtting",o),so=o=>i.A.get("hotel/v1/hotel/get-videos?hotelId=".concat(o)),ho=o=>i.A.post("hotel/v1/chatbot/request-voice-callback",o),po=o=>i.A.get("hotel/v1/bookings?id=".concat(o)),fo=o=>{let{bookingId:t}=o;return i.A.post("hotel/v2/bookings/".concat(t,"/booking-token"))},mo=o=>{let{hotelId:t}=o;return i.A.get("payments/v1/gateways/cod-payment-provider?hotelId=".concat(t))},go=o=>{let{hotelId:t,checkInDate:e}=o;return i.A.get("hotel/v1/custom-messages/active?hotelId=".concat(t,"&checkInDate=").concat(e))},Ao=o=>i.A.post("hotel/v1/hotel/send-roi",o),yo=o=>i.A.get("hotel/v1/pricing_and_inventory/next-available-dates",o),Io=o=>i.A.get("hotel/v1/hotel/booking-engine-config?hotelId=".concat(o)),Do=(o,t,e)=>i.A.get("hotel/v2/hotel/nearby-hotels-availability?hotelId=".concat(o,"&checkInDate=").concat(t,"&checkOutDate=").concat(e)),ko=o=>i.A.get("hotel/v2/hotel/chain-hotels-lite-v2?chainId=".concat(o)),Eo=(o,t,e,l)=>i.A.post("hotel/v1/loyalty/validate",{programName:o,memberId:t,amount:e,hotelId:l}),_o=o=>i.A.post("payments/v1/gift-cards/balance",o),Co=o=>{let{hotelId:t}=o;return i.A.get("payments/v1/gift-cards/enabled",{hotelId:t})}},6032:(o,t,e)=>{e.d(t,{i:()=>u,y:()=>c});var l=e(446),i=e.n(l),n=e(8259),d=e.n(n),a=e(5030),r=e.n(a);i().extend(d()),i().extend(r());const u=o=>{if(o)try{const t=i()().tz(o);if(t.isValid())return new Date(t.year(),t.month(),t.date())}catch(e){console.error("getHotelToday timezone error",e)}const t=new Date;return t.setHours(0,0,0,0),t},c=(o,t)=>{if(null===t||void 0===t)return;const e=u(o),l=new Date(e);return l.setDate(l.getDate()+Number(t)),l}},6156:(o,t,e)=>{e.d(t,{$:()=>d,F:()=>n});const l=(o,t,e,l,i)=>{var n,d,a;let r=(null===i||void 0===i||null===(n=i.filter(t=>(null===t||void 0===t?void 0:t.adultCount)===o))||void 0===n||null===(d=n[0])||void 0===d?void 0:d.priceForPax)||[];if((!r||0===r.length)&&(null===i||void 0===i?void 0:i.length)>0){var u,c,v;let t=(null===i||void 0===i||null===(u=i.filter(t=>(null===t||void 0===t?void 0:t.adultCount)>=o))||void 0===u||null===(c=u.sort((o,t)=>(null===o||void 0===o?void 0:o.adultCount)-(null===t||void 0===t?void 0:t.adultCount)))||void 0===c?void 0:c[0])||(null===i||void 0===i||null===(v=i.sort((o,t)=>(null===t||void 0===t?void 0:t.adultCount)-(null===o||void 0===o?void 0:o.adultCount)))||void 0===v?void 0:v[0]);r=(null===t||void 0===t?void 0:t.priceForPax)||[]}let s=null===l||void 0===l?void 0:l.children,h=null===l||void 0===l?void 0:l.infants,p=(null===(a=r)||void 0===a?void 0:a.map(o=>null===o||void 0===o?void 0:o.checkInDate))||[],f=[];return p.forEach(l=>{var n,d,a;let u=0;if(u+=null===(n=r)||void 0===n||null===(d=n.filter(o=>(null===o||void 0===o?void 0:o.checkInDate)===l))||void 0===d||null===(a=d[0])||void 0===a?void 0:a.priceBeforeTax,t>0){var c;let e=null===s||void 0===s||null===(c=s.filter(o=>(null===o||void 0===o?void 0:o.checkInDate)===l)[0])||void 0===c?void 0:c.priceBeforeTax,n=0;for(let o=0;o<t;o++)n+=e;if(null!==i&&void 0!==i&&i.some(e=>(null===e||void 0===e?void 0:e.adultCount)===o+t)){var v,p,m,g;let e=(null===i||void 0===i||null===(v=i.filter(e=>(null===e||void 0===e?void 0:e.adultCount)===o+t))||void 0===v||null===(p=v[0])||void 0===p?void 0:p.priceForPax)||[],d=null===e||void 0===e||null===(m=e.filter(o=>(null===o||void 0===o?void 0:o.checkInDate)===l))||void 0===m||null===(g=m[0])||void 0===g?void 0:g.priceBeforeTax;u=Math.min(d,u+n)}}if(e>0){var A,y;let n=null===s||void 0===s||null===(A=s.filter(o=>(null===o||void 0===o?void 0:o.checkInDate)===l)[0])||void 0===A?void 0:A.priceBeforeTax,d=null===h||void 0===h||null===(y=h.filter(o=>(null===o||void 0===o?void 0:o.checkInDate)===l)[0])||void 0===y?void 0:y.priceBeforeTax,a=Math.min(n,d),r=0;for(let o=0;o<e;o++)r+=a;if(null!==i&&void 0!==i&&i.some(l=>(null===l||void 0===l?void 0:l.adultCount)===o+e+t)){var I,D,k,E;let n=(null===i||void 0===i||null===(I=i.filter(l=>(null===l||void 0===l?void 0:l.adultCount)===o+e+t))||void 0===I||null===(D=I[0])||void 0===D?void 0:D.priceForPax)||[],d=null===n||void 0===n||null===(k=n.filter(o=>(null===o||void 0===o?void 0:o.checkInDate)===l))||void 0===k||null===(E=k[0])||void 0===E?void 0:E.priceBeforeTax;u=Math.min(d,u+r)}}let _={checkInDate:l,priceBeforeTax:u};f.push(_)}),f},i=function(o,t){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const i=t<(null===o||void 0===o?void 0:o.maxAdultCount)?t:null===o||void 0===o?void 0:o.maxAdultCount;let d=n(parseInt(t),parseInt(e),null===o||void 0===o?void 0:o.availableRooms,null===o||void 0===o?void 0:o.maxGuestCount,i,null===o||void 0===o?void 0:o.maxChildCount);const a=[];if((null===d||void 0===d?void 0:d.length)>
10)Object.keys(null===o||void 0===o?void 0:o.ratePlans).forEach(t=>{let e=0;for(let a=0;a<(null===d||void 0===d?void 0:d.length);a++){var i,n,r;let u=l(null===(i=d[a])||void 0===i?void 0:i.adults,null===(n=d[a])||void 0===n?void 0:n.children,0,null===o||void 0===o?void 0:o.pricingAdditionalGuests[t],null===o||void 0===o||null===(r=o.pricing)||void 0===r?void 0:r.filter(o=>(null===o||void 0===o?void 0:o.ratePlanCode)===t));null===u||void 0===u||u.forEach(o=>{let t=null===o||void 0===o?void 0:o.priceBeforeTax;e+=t})}e>0&&a.push(e)});else{const e=t<=i?t:i;Object.keys(null===o||void 0===o?void 0:o.ratePlans).forEach(t=>{var l,i,n;let d=(null===o||void 0===o||null===(l=o.pricing)||void 0===l||null===(i=l.filter(o=>(null===o||void 0===o?void 0:o.adultCount)===parseInt(e)&&0===(null===o||void 0===o?void 0:o.childCount)&&0===(null===o||void 0===o?void 0:o.infantCount)&&(null===o||void 0===o?void 0:o.ratePlanCode)===t))||void 0===i||null===(n=i[0])||void 0===n?void 0:n.priceForPax)||[],r=0;null===d||void 0===d||d.forEach((o,t)=>{let e=null===o||void 0===o?void 0:o.priceBeforeTax;r+=e}),r>0&&a.push(r)})}return{lowestPrice:Math.min(...a),canAccomadate:(null===d||void 0===d?void 0:d.length)>0}};function n(o,t,e,l,i,n){let d=[],a=o,r=t;if(t>0&&!n)return[];let u=Math.ceil(o/i);if(u=Math.max(u,Math.ceil((o+t)/l)),e<u)return[];for(let c=0;c<e;c++){let o=0,t=0;if(r>0&&a>0?(t=Math.min(r,n,l-1),o=Math.min(a,i,l-t),r-=t,a-=o):a>0&&(o=Math.min(a,i,l),a-=o),d.push({adults:o,children:t}),0===a&&0===r)break}return a>0||r>0?[]:d}function d(o){let{rooms:t,adultCount:e=2,childCount:l=0}=o;function n(o){var t;if(o)return Math.min(...(null===(t=o.priceForPax)||void 0===t?void 0:t.map(o=>null===o||void 0===o?void 0:o.priceBeforeTax))||[])}let d=null===t||void 0===t?void 0:t.filter(o=>(null===o||void 0===o?void 0:o.availableRooms)>0);d.forEach(o=>{var t;null===o||void 0===o||null===(t=o.pricing)||void 0===t||t.sort((o,t)=>n(o)-n(t))});let a=null===t||void 0===t?void 0:t.filter(o=>0===(null===o||void 0===o?void 0:o.availableRooms));return d.sort((o,t)=>{const n=i(o,e,l),d=i(t,e,l);return(null===n||void 0===n?void 0:n.canAccomadate)!==(null===d||void 0===d?void 0:d.canAccomadate)?null!==n&&void 0!==n&&n.canAccomadate?-1:1:(null===n||void 0===n?void 0:n.lowestPrice)-(null===d||void 0===d?void 0:d.lowestPrice)}),[...d,...a]}},6471:(o,t,e)=>{e.d(t,{A:()=>p});var l=e(9379),i=e(854),n=e.n(i),d=e(8173),a=e(5346),r=e(5989),u=e(6695);const c=n().create({baseURL:(v="https://api.hotelzify.com/",null!==v&&void 0!==v&&v.endsWith("/")?v.slice(0,-1):v)});var v;c.interceptors.request.use(o=>{const t=localStorage.getItem("corporateToken"),e=localStorage.getItem("corporateHotelId"),i=localStorage.getItem("corporateAgentId");if(console.log({corporateAgentId:i,corporateHotelId:e,corporateToken:t}),t&&e)o.headers.Authorization="Bearer ".concat(t),console.log({request:o}),"get"===o.method&&i&&(o.params=(0,l.A)((0,l.A)({},o.params),{},{corporateAgentId:i})),["post","put","patch"].includes(o.method)&&i&&o.data&&(o.data=(0,l.A)((0,l.A)({},o.data),{},{corporateAgentId:i}));else{const t=r.A.get("token");t&&(o.headers.Authorization="Bearer monne ".concat(t))}return o}),c.interceptors.response.use(null,o=>{const{status:t}=(null===o||void 0===o?void 0:o.response)||{};if(401===t){localStorage.removeItem("corporateToken"),localStorage.removeItem("corporateHotelId"),localStorage.removeItem("corporateAgentId"),r.A.remove("token");const o=new URLSearchParams(window.location.search),t=o.get("hotelId");o.get("corporate")&&t?window.location.href="/corporate-booking?hotelId=".concat(t,"&returnUrl=").concat(encodeURIComponent(window.location.pathname+window.location.search)):d.b.push("/")}return Promise.reject(o)});const s=async o=>{try{const{data:t}=await c(o);return 400===(null===t||void 0===t?void 0:t.status)&&(0,a.fireGtmEvent)("api_error",{url:null===o||void 0===o?void 0:o.url,params:null===o||void 0===o?void 0:o.params,payload:null===o||void 0===o?void 0:o.data,data:t}),t}catch(i){var t,e,l;if((null===i||void 0===i||null===(t=i.response)||void 0===t?void 0:t.status)>=500)(0,u.Cp)("API: ".concat(null===o||void 0===o||null===(l=o.url)||void 0===l?void 0:l.slice(0,30)," Failed!"),{data:{request:o,error:i}});return(0,a.fireGtmEvent)("api_error",{url:null===o||void 0===o?void 0:o.url,axiosObject:o,error:i}),(null===i||void 0===i||null===(e=i.response)||void 0===e?void 0:e.data)||{}}},h={get:(o,t)=>s({method:"GET",url:o,params:t}),post:(o,t)=>s({method:"POST",url:o,data:t}),put:(o,t)=>s({method:"PUT",url:o,data:t}),patch:(o,t)=>s({method:"PATCH",url:o,data:t}),delete:(o,t)=>s({method:"DELETE",url:o,data:t}),isCorporateBooking:()=>!!localStorage.getItem("corporateToken")&&!!localStorage.getItem("corporateHotelId"),getAvailabilityEndpoint:function(){let o=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return h.isCorporateBooking()?"hotel/authorized/v2/hotel/availability":o?"hotel/v2/hotel/availability/rateplan":"hotel/v2/hotel/availability"},clearCorporateSession:()=>{localStorage.clear()}},p=h},8780:(o,t,e)=>{e.d(t,{Ay:()=>C,Fg:()=>E,Kn:()=>p,O_:()=>k,Ou:()=>A,UT:()=>h,Zg:()=>y,bu:()=>I,hR:()=>f,ix:()=>_,qB:()=>s,um:()=>m});var l=e(9379),i=e(446),n=e.n(i),d=e(5043),a=e(8601),r=e(5989),u=e(7343),c=e(1683),v=e(4849);const s=o=>((null===o||void 0===o?void 0:o.PromotionsExtraConfigs)||[]).some(o=>{var t;return"coupon_code"===(null===o||void 0===o?void 0:o.type)&&String(null!==(t=null===o||void 0===o?void 0:o.value)&&void 0!==t?t:"").toLowerCase().includes("sterlingmemberdeal")}),h=o=>!(null===o||void 0===o||!o.isMembership),p=o=>{if(!("true"===sessionStorage.getItem("isMembershipUnlocked")))return null;const t="true"===sessionStorage.getItem("isSterlingMemberVerified"),e=(null===o||void 0===o?void 0:o.filter(h))||[],l=e.find(o=>!s(o)),i=e.find(s);return t&&i?i:l||null},f=o=>{let t=(null===o||void 0===o?void 0:o.filter(o=>"percentage"===(null===o||void 0===o?void 0:o.discountType)))||[],e=(null===o||void 0===o?void 0:o.filter(o=>"fixed_amount"===(null===o||void 0===o?void 0:o.discountType)))||[];return[...(null===o||void 0===o?void 0:o.filter(o=>"nights"===(null===o||void 0===o?void 0:o.discountType)))||[],...null===t||void 0===t?void 0:t.sort((o,t)=>(null===t||void 0===t?void 0:t.discount)-(null===o||void 0===o?void 0:o.discount)),...e]},m=o=>{let{price:t,promo:e,idx:l,dateCount:i,checkInDate:n=null,nightPromotionNights:d=new Set}=o,a=0,r=0;switch(null===e||void 0===e?void 0:e.discountType){case"percentage":case null:r=t*(null===e||void 0===e?void 0:e.discount)/100,a=t-r;break;case"fixed_amount":r=null===e||void 0===e?void 0:e.discount,a=t-r;break;case"nights":d.has(n)?(r=t,a=0):(r=0,a=t);break;default:r=0,a=t}return{reducedPrice:Number(r),finalValue:Number(a)}};function g(o,t){return"fixed_amount"===o.discountType?parseFloat(o.discount):"percentage"===o.discountType||null===o.discountType?parseFloat(o.discount)/100*t:"nights"===o.discountType?t:0}const A=(o,t)=>{const e=(o||[]).filter(o=>"rateplan_id"===(null===o||void 0===o?void 0:o.type));return 0!==e.length&&(void 0!==t&&null!==t&&""!==t&&e.some(o=>{var e;return null===o||void 0===o||null===(e=o.value)||void 0===e?void 0:e.includes(String(t))}))},y=()=>!!localStorage.getItem("corporateToken")&&!!localStorage.getItem("corporateHotelId"),I=o=>{let{arrangedPromos:t,tempPrice:e,rp:l,checkInDate:i}=o;if((null===t||void 0===t?void 0:t.length)<1)return null;const n=y();let d=[...t].sort((o,t)=>{const l=g(o,e);return g(t,e)-l}),a=null;for(let u=0;u<(null===d||void 0===d?void 0:d.length);u++)if(!a){var r;let o=d[u],t=(null===o||void 0===o?void 0:o.PromotionsExtraConfigs)||[];if(n&&!A(t,null===l||void 0===l||null===(r=l.rpObject)||void 0===r?void 0:r.id))continue;if(!D(null===o||void 0===o?void 0:o.stayStartDate,null===o||void 0===o?void 0:o.stayEndDate,i))continue;if("fixed_amount"===(null===o||void 0===o?void 0:o.discountType)&&(null===o||void 0===o?void 0:o.discount)>=e)continue;if(!D(null===o||void 0===o?void 0:o.startDate,null===o||void 0===o?void 0:o.endDate,new Date))continue;switch(null===o||void 0===o?void 0:o.type){case"bulk":null===(null===o||void 0===o?void 0:o.discountType)?a=null:e>=(null===o||void 0===o?void 0:o.cutoffAmount)?(a=o,(null===t||void 0===t?void 0:t.length)>0&&(a=E({tempPrice:e,rp:l,checkInDate:i,customArray:t,promo:o}))):a=null;break;
1case"custom":a=o,null!==o&&void 0!==o&&o.cutoffAmount&&e>=(null===o||void 0===o?void 0:o.cutoffAmount)||null===(null===o||void 0===o?void 0:o.cutoffAmount)?(null===t||void 0===t?void 0:t.length)>0&&(a=E({tempPrice:e,rp:l,checkInDate:i,customArray:t,promo:o})):a=null;break;default:a=o,(null===t||void 0===t?void 0:t.length)>0&&(a=E({tempPrice:e,rp:l,checkInDate:i,customArray:t,promo:o}))}}return a};function D(o,t,e){let l=o?new Date(o):null,i=t?new Date(t):null,n=new Date(e);return l&&i?n>=l&&n<=i:l?n>=l:!i||n<=i}const k=o=>{let{arrangedPromos:t,tempPrice:e,rp:l,checkInDate:i}=o;if((null===t||void 0===t?void 0:t.length)<1)return null;const n=y();let d=[...t].sort((o,t)=>{const l=g(o,e);return g(t,e)-l}),a=null;for(let u=0;u<(null===d||void 0===d?void 0:d.length);u++)if(!a){var r;let o=d[u],t=(null===o||void 0===o?void 0:o.PromotionsExtraConfigs)||[];if(n&&!A(t,null===l||void 0===l||null===(r=l.rpObject)||void 0===r?void 0:r.id))continue;if(!D(null===o||void 0===o?void 0:o.stayStartDate,null===o||void 0===o?void 0:o.stayEndDate,i))continue;if("fixed_amount"===(null===o||void 0===o?void 0:o.discountType)&&(null===o||void 0===o?void 0:o.discount)>=e)continue;if(!D(null===o||void 0===o?void 0:o.startDate,null===o||void 0===o?void 0:o.endDate,new Date))continue;switch(null===o||void 0===o?void 0:o.type){case"bulk":null===(null===o||void 0===o?void 0:o.discountType)&&e>=(null===o||void 0===o?void 0:o.cutoffAmount)?a=o:e>=(null===o||void 0===o?void 0:o.cutoffAmount)?(a=o,(null===t||void 0===t?void 0:t.length)>0&&(a=E({tempPrice:e,rp:l,checkInDate:i,customArray:t,promo:o}))):a=null;break;case"custom":a=o,e>=(null===o||void 0===o?void 0:o.cutoffAmount)||null===(null===o||void 0===o?void 0:o.cutoffAmount)?(null===t||void 0===t?void 0:t.length)>0&&(a=E({tempPrice:e,rp:l,checkInDate:i,customArray:t,promo:o})):a=null;break;default:a=o,(null===t||void 0===t?void 0:t.length)>0&&(a=E({tempPrice:e,rp:l,checkInDate:i,customArray:t,promo:o}))}}return a},E=o=>{var t,e,l,i,d,a,r,u,c;let{rp:v,checkInDate:s,customArray:h,promo:p}=o,f=p,m=!1,g=!1;const A=!!h.find(o=>"rateplan_id"===(null===o||void 0===o?void 0:o.type)),y=!!h.find(o=>"room_id"===(null===o||void 0===o?void 0:o.type));let I=!1,D=!1;for(let C=0;C<(null===h||void 0===h?void 0:h.length);C++){var k;switch(null===(k=h[C])||void 0===k?void 0:k.type){case"blackout_date":if(null!==(t=h[C])&&void 0!==t&&null!==(e=t.value)&&void 0!==e&&e.includes(s))return null;f=p;break;case"day_of_week":if(null===(l=h[C])||void 0===l||null===(i=l.value)||void 0===i||!i.includes(n()(s).format("dddd").toLowerCase()))return null;f=p;break;case"room_id":if(null!==(d=h[C])&&void 0!==d&&null!==(a=d.value)&&void 0!==a&&a.includes(String(null===v||void 0===v?void 0:v.roomId)))I=!0,f=p;else if(!A)return null;break;case"rateplan_id":if(null!==(r=h[C])&&void 0!==r&&null!==(u=r.value)&&void 0!==u&&u.includes(String(null===v||void 0===v||null===(c=v.rpObject)||void 0===c?void 0:c.id)))D=!0,f=p;else if(!y)return null;break;case"payment_instrument":break;case"stay_date_range":m=!0;try{var E;const o=null===(E=h[C])||void 0===E?void 0:E.value,t=n()(s);for(let e of o){e=JSON.parse(e);const o=n()(e.start),l=n()(e.end);if(t.isSameOrAfter(o,"day")&&t.isSameOrBefore(l,"day")){g=!0,f=p;break}}}catch(_){console.error("Error parsing date range:",_)}}}return m&&!g||y&&A&&!I&&!D?null:f},_=(o,t,e)=>{const i=null===t||void 0===t?void 0:t.infants;if(null===o||void 0===o||!o.length||null===i||void 0===i||!i.length||!e)return o;const n=new Set(o.map(o=>"".concat(o.adultCount,"-").concat(o.childCount,"-").concat(o.infantCount))),d=[];for(const r of o)if(0===r.infantCount)for(let o=1;o<=e;o++){var a;const t="".concat(r.adultCount,"-").concat(r.childCount,"-").concat(o);n.has(t)||(n.add(t),d.push((0,l.A)((0,l.A)({},r),{},{infantCount:o,priceForPax:null===(a=r.priceForPax)||void 0===a?void 0:a.map(t=>{var e;const n=null===(e=i.find(o=>(null===o||void 0===o?void 0:o.checkInDate)===(null===t||void 0===t?void 0:t.checkInDate)))||void 0===e?void 0:e.priceBeforeTax;return(0,l.A)((0,l.A)({},t),{},{priceBeforeTax:((null===t||void 0===t?void 0:t.priceBeforeTax)||0)+(n||0)*o})})})))}return d.length?[...o,...d]:o},C=()=>{const{selectedRatePlans:o=[],hotelData:t={},dateRange:e,dateCount:i,selectedHotelAddons:s=[],promotions:A=[],taxes:y=[],couponCode:D={},selectedPaymentOffer:k=null,isRatePlans:C,isHourlyRoom:P}=(0,a.d4)(o=>o.hotelInfo),T=(0,a.wA)(),{HotelRooms:b=[]}=t,[S,w]=(0,d.useState)(0),[O,N]=(0,d.useState)([]),[x,Y]=(0,d.useState)(0),[M,R]=(0,d.useState)(0),[B,F]=(0,d.useState)(0),[H,G]=(0,d.useState)(0),[L,j]=(0,d.useState)(0),[U,V]=(0,d.useState)(0),[z,q]=(0,d.useState)(0),[W,Q]=(0,d.useState)({discount:0}),[K,Z]=(0,d.useState)(0),[J,$]=(0,d.useState)([]),[X,oo]=(0,d.useState)(0),[to,eo]=(0,d.useState)({}),[lo,io]=(0,d.useState)({}),[no,ao]=(0,d.useState)(0),[ro,uo]=(0,d.useState)(0),[co,vo]=(0,d.useState)(null),[so,ho]=(0,d.useState)(0);(0,d.useEffect)(()=>{(null===A||void 0===A?void 0:A.length)>0&&(()=>{let o=f(A.filter(o=>"payment_method"!==(null===o||void 0===o?void 0:o.type)));$(o)})()},[A]);const po=(o,t,e,l,i)=>{var n,d,a,r,u,c,v,s;let h=null===(n=i=_(i,l,e))||void 0===n||null===(d=n.filter(l=>(null===l||void 0===l?void 0:l.adultCount)===o&&(null===l||void 0===l?void 0:l.childCount)===t&&(null===l||void 0===l?void 0:l.infantCount)===e))||void 0===d||null===(a=d[0])||void 0===a?void 0:a.priceForPax,p=h||(null===(r=i)||void 0===r||null===(u=r.filter(t=>(null===t||void 0===t?void 0:t.adultCount)===o&&0===(null===t||void 0===t?void 0:t.childCount)&&0===(null===t||void 0===t?void 0:t.infantCount)))||void 0===u||null===(c=u[0])||void 0===c?void 0:c.priceForPax)||[];if((!p||0===p.length)&&(null===(v=i)||void 0===v?void 0:v.length)>0){var f,m,g,A,y;let t=(null===(f=i)||void 0===f||null===(m=f.filter(t=>(null===t||void 0===t?void 0:t.adultCount)>=o))||void 0===m||null===(g=m.sort((o,t)=>(null===o||void 0===o?void 0:o.adultCount)-(null===t||void 0===t?void 0:t.adultCount)))||void 0===g?void 0:g[0])||(null===(A=i)||void 0===A||null===(y=A.sort((o,t)=>(null===t||void 0===t?void 0:t.adultCount)-(null===o||void 0===o?void 0:o.adultCount)))||void 0===y?void 0:y[0]);p=(null===t||void 0===t?void 0:t.priceForPax)||[]}let I=null===l||void 0===l?void 0:l.children,D=null===l||void 0===l?void 0:l.infants,k=(null===(s=p)||void 0===s?void 0:s.map(o=>null===o||void 0===o?void 0:o.checkInDate))||[],E=[];
1return k.forEach(l=>{var n,d,a;let r=0;if(r+=null===(n=p)||void 0===n||null===(d=n.filter(o=>(null===o||void 0===o?void 0:o.checkInDate)===l))||void 0===d||null===(a=d[0])||void 0===a?void 0:a.priceBeforeTax,t>0&&!h){var u,c;let e=null===I||void 0===I||null===(u=I.filter(o=>(null===o||void 0===o?void 0:o.checkInDate)===l)[0])||void 0===u?void 0:u.priceBeforeTax,n=0;for(let o=0;o<t;o++)n+=e;if(null!==(c=i)&&void 0!==c&&c.some(e=>(null===e||void 0===e?void 0:e.adultCount)===o+t)){var v,s,f,m,g;let e=(null===(v=i)||void 0===v||null===(s=v.filter(e=>(null===e||void 0===e?void 0:e.adultCount)===o+t))||void 0===s||null===(f=s[0])||void 0===f?void 0:f.priceForPax)||[],d=null===e||void 0===e||null===(m=e.filter(o=>(null===o||void 0===o?void 0:o.checkInDate)===l))||void 0===m||null===(g=m[0])||void 0===g?void 0:g.priceBeforeTax;r=Math.min(d,r+n)}else r+=n}if(e>0&&!h){var A,y,k;let n=null===I||void 0===I||null===(A=I.filter(o=>(null===o||void 0===o?void 0:o.checkInDate)===l)[0])||void 0===A?void 0:A.priceBeforeTax,d=null===D||void 0===D||null===(y=D.filter(o=>(null===o||void 0===o?void 0:o.checkInDate)===l)[0])||void 0===y?void 0:y.priceBeforeTax,a=Math.min(n,d),u=0;for(let o=0;o<e;o++)u+=a;if(null!==(k=i)&&void 0!==k&&k.some(l=>(null===l||void 0===l?void 0:l.adultCount)===o+e+t)){var _,C,P,T,b;let n=(null===(_=i)||void 0===_||null===(C=_.filter(l=>(null===l||void 0===l?void 0:l.adultCount)===o+e+t))||void 0===C||null===(P=C[0])||void 0===P?void 0:P.priceForPax)||[],d=null===n||void 0===n||null===(T=n.filter(o=>(null===o||void 0===o?void 0:o.checkInDate)===l))||void 0===T||null===(b=T[0])||void 0===b?void 0:b.priceBeforeTax;r=Math.min(d,r+u)}else r+=u}let S={checkInDate:l,priceBeforeTax:r};E.push(S)}),E};return(0,d.useEffect)(()=>{(()=>{if(!X)return;if(0===(null===A||void 0===A?void 0:A.length)||!A)return;let o=(null===A||void 0===A?void 0:A.filter(o=>null===(null===o||void 0===o?void 0:o.discountType)&&"bulk"===(null===o||void 0===o?void 0:o.type)))||[];if(0===(null===o||void 0===o?void 0:o.length)||!o)return;let t=[...o].sort((o,t)=>{const e=g(o,X);return g(t,X)-e});for(let e=0;e<t.length;e++){let o=t[e];if(X>=Number(null===o||void 0===o?void 0:o.cutoffAmount)){let t=X-X*(null===o||void 0===o?void 0:o.discount)/100;if(t<S+L){let e=0,i=0,n=0,d=[];return O.forEach(t=>{var e;let a=[];null===t||void 0===t||null===(e=t.onedayObj)||void 0===e||e.forEach(t=>{let e=null===t||void 0===t?void 0:t.noDiscPrice;i+=e;let d=e*(null===o||void 0===o?void 0:o.discount)/100;n+=d,a.push((0,l.A)((0,l.A)({},t),{},{finalValue:e-d,reducedPrice:d}))}),d.push((0,l.A)((0,l.A)({},t),{},{onedayObj:a})),eo(o)}),N(d),j(e),V(i-n),Q({discount:X-t}),Z(t),null}return t===S||eo({}),null}}})()},[S,X,W.discount,A]),(0,d.useEffect)(()=>{(()=>{if(!o)return;let d=0,a=0,f=0,g=0,A=[],_=0,S=0,O=0,x=0,M=0,B=0,H=0;for(let r of o){var L;let c=0,v=0,s=0,C=[],P=[],T=[];const S=null===b||void 0===b||null===(L=b.filter(o=>(null===o||void 0===o?void 0:o.id)===(null===r||void 0===r?void 0:r.roomId)))||void 0===L?void 0:L[0];O+=null===r||void 0===r?void 0:r.sAdult,x+=null===r||void 0===r?void 0:r.sChild,H+=null===r||void 0===r?void 0:r.sInfant;const{pricing:w=[],pricingAdditionalGuests:N={},ratePlans:Y={}}=S;f+=(null===r||void 0===r?void 0:r.sAdult)+(null===r||void 0===r?void 0:r.sChild)+(null===r||void 0===r?void 0:r.sInfant);const R=N[null===r||void 0===r?void 0:r.code];let F=(null===w||void 0===w?void 0:w.filter(o=>(null===o||void 0===o?void 0:o.ratePlanCode)===(null===r||void 0===r?void 0:r.code)&&(null===o||void 0===o?void 0:o.adultCount)===(null===r||void 0===r?void 0:r.sAdult)&&(null===o||void 0===o?void 0:o.childCount)===(null===r||void 0===r?void 0:r.sChild)&&(null===o||void 0===o?void 0:o.infantCount)===(null===r||void 0===r?void 0:r.sInfant)))||[];P=po(null===r||void 0===r?void 0:r.sAdult,null===r||void 0===r?void 0:r.sChild,null===r||void 0===r?void 0:r.sInfant,R,null===w||void 0===w?void 0:w.filter(o=>(null===o||void 0===o?void 0:o.ratePlanCode)===(null===r||void 0===r?void 0:r.code))),(null===F||void 0===F?void 0:F.length)>0&&(P=null===F||void 0===F?void 0:F.flatMap(o=>null===o||void 0===o?void 0:o.priceForPax));let G=!1,j=new Set;const V=(null===D||void 0===D?void 0:D.id)&&"nights"===(null===D||void 0===D?void 0:D.discountType);if((V||(null===J||void 0===J?void 0:J.some(o=>"nights"===(null===o||void 0===o?void 0:o.discountType))))&&P.length>0){const o=P.map(o=>({price:null===o||void 0===o?void 0:o.priceBeforeTax,checkInDate:null===o||void 0===o?void 0:o.checkInDate}));if(o.sort((o,t)=>o.price-t.price),o.length>0&&o[0]){var U,z,W,K;const t=V?[D]:J.filter(o=>"nights"===(null===o||void 0===o?void 0:o.discountType)),e=I({arrangedPromos:t,rp:r,tempPrice:(null===(U=o[0])||void 0===U?void 0:U.priceBeforeTax)||(null===(z=P[0])||void 0===z?void 0:z.priceBeforeTax),checkInDate:(null===(W=o[0])||void 0===W?void 0:W.checkInDate)||(null===(K=P[0])||void 0===K?void 0:K.checkInDate)});if(e){const t=Math.min(e.discount,o.length);for(let e=0;e<t;e++)j.add(o[e].checkInDate)}}}if(P.forEach((d,f)=>{var g,A,_;let P=null===d||void 0===d?void 0:d.priceBeforeTax,b=null===d||void 0===d?void 0:d.checkInDate,w={},O=[];const N=n()(b).diff(n()(null===e||void 0===e?void 0:e.startDate),"day"),x=o=>null===(null===o||void 0===o?void 0:o.maximumNights)||void 0===(null===o||void 0===o?void 0:o.maximumNights)||N<o.maximumNights,Y=J.filter(x);let R=p(Y);R&&(R=I({arrangedPromos:[R],rp:r,tempPrice:P,checkInDate:b}));let F=null,H=null;var L;if(R)if(null!==(L=R)&&void 0!==L&&L.isStack){let o=(null===Y||void 0===Y?void 0:Y.filter(o=>!h(o)))||[];F=I({arrangedPromos:o,rp:r,tempPrice:P,checkInDate:b}),H=R}else F=R,H=null;else F=I({arrangedPromos:Y,rp:r,tempPrice:P,checkInDate:b});a+=P;let{finalValue:U,reducedPrice:V}=m({price:P,promo:F,idx:f,dateCount:i,checkInDate:b,nightPromotionNights:j});if(H&&null!==(g=H)&&void 0!==g&&g.isStack){let o=m({price:U,promo:H,idx:f,dateCount:i,checkInDate:b,nightPromotionNights:j});V+=o.reducedPrice,U=o.finalValue}if(null!==D&&void 0!==D&&D.id&&x(D)){const t=o.length||1,e="booking"===D.discountScope&&"fixed_amount"===D.discountType?(0,l.A)((0,l.A)({},D),{},{discount:parseFloat(D.discount)/(t*i)}):D;if(w=I({arrangedPromos:[e],rp:r,tempPrice:null!==D&&void 0!==D&&D.isStack?U:P,checkInDate:b}),w){var z;let o=m({price:null!==D&&void 0!==D&&D.isStack?U:P,promo:w,idx:f,dateCount:i,checkInDate:b,nightPromotionNights:j});M+=o.reducedPrice,U=o.finalValue,null!==(z=w)&&void 0!==z&&z.isStack?V+=o.reducedPrice:V=o.reducedPrice}}let q=null;if(null!==k&&void 0!==k&&k.id){const t=o.length||1,e="fixed_amount"===k.discountType?(0,l.A)((0,l.A)({},k),{},{discount:parseFloat(k.discount)/(t*i)}):k,n=e.PromotionsExtraConfigs||[];
1if(q=n.some(o=>"room_id"===(null===o||void 0===o?void 0:o.type)||"rateplan_id"===(null===o||void 0===o?void 0:o.type))?E({tempPrice:null!==k&&void 0!==k&&k.isStack?U:P,rp:r,checkInDate:b,customArray:n.filter(o=>"room_id"===(null===o||void 0===o?void 0:o.type)||"rateplan_id"===(null===o||void 0===o?void 0:o.type)),promo:e}):e,q){var W;let o=m({price:null!==k&&void 0!==k&&k.isStack?U:P,promo:q,idx:f,dateCount:i,checkInDate:b,nightPromotionNights:j});B+=o.reducedPrice,U=o.finalValue||U,null!==(W=q)&&void 0!==W&&W.isStack?V+=o.reducedPrice:V=o.reducedPrice}}if(0===U&&(G=!0),F||H||null!==(A=w)&&void 0!==A&&A.id||null!==(_=q)&&void 0!==_&&_.id){var Q,K;if(F){const o=m({price:P,promo:F,idx:f,dateCount:i,checkInDate:b,nightPromotionNights:j});O.push((0,l.A)((0,l.A)({},F),{},{_reducedPrice:o.reducedPrice}))}if(H){var Z;const o=F?P-((null===(Z=O[0])||void 0===Z?void 0:Z._reducedPrice)||0):P,t=m({price:o,promo:H,idx:f,dateCount:i,checkInDate:b,nightPromotionNights:j});O.push((0,l.A)((0,l.A)({},H),{},{_reducedPrice:t.reducedPrice}))}if(w&&null!==(Q=w)&&void 0!==Q&&Q.id){var $;const o=m({price:null!==D&&void 0!==D&&D.isStack?U+0:P,promo:w,idx:f,dateCount:i,checkInDate:b,nightPromotionNights:j});null!==($=w)&&void 0!==$&&$.isStack?O.push((0,l.A)((0,l.A)({},w),{},{_reducedPrice:o.reducedPrice})):O=[(0,l.A)((0,l.A)({},w),{},{_reducedPrice:o.reducedPrice})]}if(q&&null!==(K=q)&&void 0!==K&&K.id){var X;const o=m({price:null!==k&&void 0!==k&&k.isStack?U:P,promo:q,idx:f,dateCount:i,checkInDate:b,nightPromotionNights:j});null!==(X=q)&&void 0!==X&&X.isStack?O.push((0,l.A)((0,l.A)({},q),{},{_reducedPrice:o.reducedPrice})):O=[(0,l.A)((0,l.A)({},q),{},{_reducedPrice:o.reducedPrice})]}C.push({promo:O,checkInDate:b,reducedPrice:V})}s+=V;const oo=(0,u.oT)({taxes:y,rooms:[{id:null===S||void 0===S?void 0:S.id,amount:U}],isInclusive:null===t||void 0===t?void 0:t.isTaxIncluded,noOfNights:1});c+=U,v+=oo.totalRoomTax;let to={noDiscPrice:null===d||void 0===d?void 0:d.priceBeforeTax,checkInDate:null===d||void 0===d?void 0:d.checkInDate,finalValue:U,reducedPrice:V,tax:oo.totalRoomTax,roomId:null===S||void 0===S?void 0:S.id};T.push(to)}),G&&localStorage.getItem("corporateAgentId"))continue;let q=(0,l.A)((0,l.A)({},r),{},{sum:c,tax:v,priceReduced:s,promosApplied:[...new Set(C)],room:S,onedayObj:T});A.push(q),d+=null===q||void 0===q?void 0:q.sum,_+=null===q||void 0===q?void 0:q.tax,g+=null===q||void 0===q?void 0:q.priceReduced}R(O),F(x),G(H),null===s||void 0===s||s.forEach(o=>{"per_day"===o.Addon.multiplier?S+=parseFloat(o.price)*i:S+=parseFloat(o.price)});const $=d+S+M,X=C&&!P,to=X&&null!==D&&void 0!==D&&D.id?(0,c.s)(D,$):null;X&&to&&T({type:v.A.SET_COUPON_CODE,payload:{}}),vo(to),r.A.set("totalPrice",d+S),w(d+S),oo(a+S),j(_),V(d),ao(M),uo($),ho(B),q(S),Y(f),Q({discount:g}),Z(d),N(A)})()},[o,s,J,D,A,k,e,C,P]),(0,d.useEffect)(()=>{O.length>0&&(()=>{let o=[...O],e=[];o.forEach(o=>{var t;e=[...e,...(null===o||void 0===o||null===(t=o.onedayObj)||void 0===t?void 0:t.map(o=>({id:null===o||void 0===o?void 0:o.roomId,amount:null===o||void 0===o?void 0:o.finalValue})))||[]]});let l=(0,u.oT)({rooms:e,taxes:y,isInclusive:null===t||void 0===t?void 0:t.isTaxIncluded,noOfNights:i});io(l)})()},[O,y,to]),{rpPrice:S,selectedRooms:O,couponValue:no,bookingAmountBeforeCoupon:ro,couponCutoffReason:co,paymentOfferValue:so,rpTotalGuest:x,rpTax:L,totalRoomCost:U,priceAfterDiscount:K,taxObj:lo,bulkDiscount:to,totalAddonCost:z,appliedDiscount:W,adultCount:M,childCount:B,infantCount:H}}},8984:(o,t,e)=>{e.d(t,{Oz:()=>Y,qO:()=>R,$l:()=>S,TG:()=>N,qC:()=>T,sd:()=>M,$r:()=>x,X$:()=>z,en:()=>W,T5:()=>L,ix:()=>V,z2:()=>F,BU:()=>j,PR:()=>G,jh:()=>q,N$:()=>H,xy:()=>B,A9:()=>O,h:()=>w});var l=e(9379),i=e(446),n=e.n(i),d=e(8222),a=e.n(d);var r=e(3976),u=e(2457),c=e(5989),v=e(5346),s=e(6032),h=e(7343),p=e(4849),f=e(6156),m=(e(5043),e(8780));const g=(o,t,e)=>{const l=n()(e).diff(t,"day"),i=n()().diff(t,"day");return o.filter(o=>{let{lengthOfStay:e,type:d,cutoffDays:a,startDate:r,endDate:u,stayStartDate:c,stayEndDate:v}=o;return!(e&&e>l)&&(!("late"===d&&a&&a<i)&&(!("early"===d&&a&&a>i)&&(!(r&&n()().diff(r,"day")<0)&&(!(u&&n()().diff(u,"day")>0)&&(!(c&&n()(t).diff(c,"day")<0)&&!(v&&n()(t).diff(v,"day")>0))))))})},A=(o,t,e,l,i)=>{const d=(0,m.Zg)(),a=[];return o.forEach(o=>{if(o.cutoffAmount&&o.cutoffAmount>t)return;const r=o.PromotionsExtraConfigs||[];
1if(d&&!(0,m.Ou)(r,l))return;for(let{type:t,value:d}of r)switch(t){case"room_id":if(!d.includes("".concat(e.id)))return;break;case"rateplan_id":if(!d.includes("".concat(l)))return;break;case"day_of_week":if(!d.includes(n()(i).format("dddd").toLowerCase()))return;break;case"blackout_date":if(d.includes(n()(i).format("YYYY-MM-DD")))return}a.push(o)}),a},y=(o,t,e,l)=>{const i=Math.min(...t.priceForPax.map(o=>{let{priceBeforeTax:t}=o;return t}))||0;let n=o[0],d=0;return o.forEach(o=>{switch(o.discountType){case"percentage":{const t=e*o.discount/100;d=Math.max(t,d),d===t&&(n=o);break}case"fixed_amount":d=Math.max(o.discount,d)/100,d===o.discount&&(n=o);break;case"nights":0===l&&(d=Math.max(i,d),d===i&&(n=o))}}),{mostApplicablePromotion:n,highestDiscount:d}},I=(o,t)=>{try{const e=Number(o);return Number.isNaN(e)?0:Number(e.toFixed(t))}catch(e){return 0}};let D=!1;const k=[375,480,640,750],E=[640,960,1400],_=o=>{var t,e;if("undefined"===typeof document)return;const l=(o=>{if("string"!==typeof o||!o||"undefined"===typeof window)return null;const t=o.replace(/#/g,"%23").replace(/ /g,"%20"),e=t.includes("?")?"&":"?",l=Math.max(1,window.innerWidth||375),i=Math.max(1,window.devicePixelRatio||1);if(l>900){const o=l<=1200?.5*l:l<=1400?.55*l:792,n=Math.ceil(o*i),d=E.find(o=>o>=n)||E[E.length-1];return"".concat(t).concat(e,"tr=w-").concat(d,",ar-4-3,q-70,f-auto,fo-auto")}const n=Math.ceil(l*i),d=k.find(o=>o>=n)||k[k.length-1];return"".concat(t).concat(e,"tr=w-").concat(d,",h-").concat(Math.round(.5625*d),",ar-16-9,q-50,f-auto,fo-auto")})(null===o||void 0===o||null===(t=o.HotelImages)||void 0===t||null===(e=t[0])||void 0===e?void 0:e.cdnImageUrl);if(!l)return;const i=document.querySelector('link[data-hotelzify-availability-hero-preload="true"]');if((null===i||void 0===i?void 0:i.getAttribute("href"))===l)return;const n=i||document.createElement("link");n.rel="preload",n.as="image",n.href=l,n.setAttribute("fetchpriority","high"),n.setAttribute("data-hotelzify-availability-hero-preload","true"),i||document.head.appendChild(n)},C=()=>{var o;if(D||null!==(o=c.A.get("locationDetails"))&&void 0!==o&&o.country||"undefined"===typeof window)return;D=!0;const t=["pointerdown","keydown","touchstart"];let e;e=async()=>{t.forEach(o=>window.removeEventListener(o,e));try{const o=await(0,h.ow)();if(null===o||void 0===o||!o.country)return;c.A.set("ipAdress",o.ip),c.A.set("city",o.city),c.A.set("state",o.region),c.A.set("country",o.country_name),c.A.set("country_code",o.country),c.A.set("dialcode",o.country_calling_code),c.A.set("locationDetails",o)}catch(o){}},t.forEach(o=>window.addEventListener(o,e,{once:!0,passive:!0}))};const P=function(o,t,e){var i,n,d,a,r,u,v,s;let h=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return(0,l.A)({hotelId:null!==(i=null===o||void 0===o?void 0:o.id)&&void 0!==i?i:null,hotelName:null!==(n=null===o||void 0===o?void 0:o.name)&&void 0!==n?n:null,checkInDate:null!==(d=null===t||void 0===t?void 0:t.checkInDate)&&void 0!==d?d:null,checkOutDate:null!==(a=null===t||void 0===t?void 0:t.checkOutDate)&&void 0!==a?a:null,totalAdult:null!==(r=null!==(u=null===t||void 0===t?void 0:t.totalAdult)&&void 0!==u?u:null===t||void 0===t?void 0:t.adultCount)&&void 0!==r?r:null,totalChild:null!==(v=null!==(s=null===t||void 0===t?void 0:t.totalChild)&&void 0!==s?s:null===t||void 0===t?void 0:t.childCount)&&void 0!==v?v:null,source:c.A.get("source")||"Direct",trigger:e},h)},T=function(o){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"en",i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],d=arguments.length>4&&void 0!==arguments[4]&&arguments[4],h=arguments.length>5&&void 0!==arguments[5]&&arguments[5],m=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return async(D,k)=>{var E,w,O,N,x;t&&D({type:p.A.FETCHING,payload:!0});const Y=i?[]:k().hotelInfo.selectedRatePlans;let M;i&&D({type:p.A.RESET,payload:!0}),n()(null===o||void 0===o?void 0:o.checkOutDate).isBefore(n()(null===o||void 0===o?void 0:o.checkInDate))&&(u.A.error("Invalid Dates"),window.location.href="/rooms/".concat(null===o||void 0===o?void 0:o.id,"/").concat(n()().format("YYYY-MM-DD"),"/").concat(n()().add(1,"day").format("YYYY-MM-DD"),"/2/0"));const R=c.A.get("utmObj")||{};if((null===R||void 0===R?void 0:R.utmSource)||(null===R||void 0===R?void 0:R.googleSource))try{M=await async function(o){let t,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;for(let c=0;c<e;c++)try{var n;const t=await o();if(200===(null===t||void 0===t?void 0:t.status)||400===(null===t||void 0===t?void 0:t.status)&&null!==t&&void 0!==t&&null!==(n=t.message)&&void 0!==n&&n.includes("date"))return t;if("Bookings are not allowed for this hotel."===(null===t||void 0===t?void 0:t.message))return t;throw new Error(t)}catch(u){var d,a,r;if(t=u,"Bookings are not allowed for this hotel."===((null===u||void 0===u||null===(d=u.response)||void 0===d||null===(a=d.data)||void 0===a?void 0:a.message)||(null===u||void 0===u||null===(r=u.response)||void 0===r?void 0:r.message)||(null===u||void 0===u?void 0:u.message)))throw u;c<e-1&&(i&&i(c+1,u),await new Promise(o=>setTimeout(o,l*Math.pow(2,c))))}throw t}(()=>(0,r.Qn)(o,e),10,1e3,(o,t)=>{console.log("Retry attempt ".concat(o,"/10 with exponential backoff for UTM source: ").concat((null===R||void 0===R?void 0:R.utmSource)||(null===R||void 0===R?void 0:R.googleSource)))})}catch(et){M=et.response||{status:500,message:"Failed after 10 retries with exponential backoff"}}else M=await(0,r.Qn)(o,e);let B=[];if(200===(null===(E=M)||void 0===E?void 0:E.status)){var F,H,G,L,V,z,q,Q,K,Z,J,$,X,oo,to,eo,lo,io,no,ao,ro,uo,co,vo,so,ho,po,fo,mo,go,Ao,yo,Io;sessionStorage.removeItem("dateRedirectAttempted");const{data:a=[]}=M;
1_(a[0]);let u=0===c.A.get("testId")||1===c.A.get("testId")?c.A.get("testId"):null;null===u&&(u=Math.floor(2*Math.random()),c.A.set("testId",0));let s=0===c.A.get("showBanner")||1===c.A.get("showBanner")?c.A.get("showBanner"):null;null===s&&(s=Math.floor(2*Math.random()),c.A.set("showBanner",s));const{checkInDate:E,checkOutDate:C}=o;c.A.set("hotelId",null===(F=a[0])||void 0===F?void 0:F.id),c.A.set("hotelName",null===(H=a[0])||void 0===H?void 0:H.name),c.A.set("slug",null===(G=a[0])||void 0===G?void 0:G.websiteSlug),c.A.set("domain",null===(L=a[0])||void 0===L?void 0:L.domain),c.A.set("isGHC",null===(V=a[0])||void 0===V?void 0:V.ghcEnabled),c.A.set("chainId",null===(z=a[0])||void 0===z?void 0:z.chainId);const w=null===(q=a[0])||void 0===q?void 0:q.domain,O=null===(Q=a[0])||void 0===Q?void 0:Q.websiteSlug,N=(null===w||void 0===w?void 0:w.startsWith("booking."))||(null===w||void 0===w?void 0:w.startsWith("bookings.")),x=N?w.split("/")[0]:null,Zo=!!x&&/^[a-z0-9.-]+\.[a-z]{2,}$/i.test(x),Jo=window.location.host,$o=/localhost|dev\.hotelzify|staging\.|test-dev|^\d+\.\d+\.\d+\.\d+/.test(Jo);if(N&&Zo&&!$o&&Jo!==x){const o=Jo.replace(/^www\./,""),t=o.endsWith(".bookmystay.io")&&o.split(".").length>2;let e=window.location.pathname;return t&&O&&"/"===e?e="/".concat(O):"/"===e&&(e=""),void window.location.replace("https://".concat(x).concat(e).concat(window.location.search))}const Xo=Jo.replace(/^www\./,""),ot="bookmystay.io"===Xo||Xo.endsWith(".bookmystay.io");if(console.log("currentHostdomain",Jo),console.log("hotelDomain",w),!$o&&!ot&&Jo!==w)return void window.location.replace("https://bookmystay.io".concat(window.location.pathname).concat(window.location.search));c.A.set("checkInDate",E),c.A.set("checkOutDate",C);let tt=(0,l.A)({},a[0]),{HotelRooms:it=[]}=tt;c.A.set("rooms",it),it=null===(K=it)||void 0===K?void 0:K.filter(o=>{var t;return null===o||void 0===o||null===(t=o.pricing)||void 0===t?void 0:t.every(o=>(null===o||void 0===o?void 0:o.price)>0)});const nt="google_vr"===c.A.get("source");let dt=Intl.DateTimeFormat().resolvedOptions().timeZone;dt="Etc/Unknown"===dt?null:encodeURIComponent(dt);let at=dt?"".concat(null===(Z=a[0])||void 0===Z?void 0:Z.id,"&checkInDate=").concat(n()(E).format("DD/MM/YYYY"),"&checkOutDate=").concat(n()(C).format("DD/MM/YYYY"),"&shouldApplyFilter=true&timezone=").concat(dt):"".concat(null===(J=a[0])||void 0===J?void 0:J.id,"&checkInDate=").concat(n()(E).format("DD/MM/YYYY"),"&checkOutDate=").concat(n()(C).format("DD/MM/YYYY"),"&shouldApplyFilter=true");const rt=D(W(null===($=tt)||void 0===$?void 0:$.id)),ut=(0,r.xp)(null===(X=tt)||void 0===X?void 0:X.id),ct=D(j(null===(oo=tt)||void 0===oo?void 0:oo.id,e)).catch(()=>{});let vt=Intl.DateTimeFormat().resolvedOptions().timeZone;vt="Etc/Unknown"===vt?null:encodeURIComponent(vt);const st={hotelId:null===(to=tt)||void 0===to?void 0:to.id,timezone:vt,vendorCampaignId:null===R||void 0===R?void 0:R.hotel_campaign,currency:null===(eo=tt)||void 0===eo?void 0:eo.currency};vt||delete st.timezone;const ht=D(U(st)).catch(()=>{}),pt=(0,r.um)(null===(lo=tt)||void 0===lo?void 0:lo.id).then(o=>{null!==o&&void 0!==o&&o.data&&D({type:p.A.SET_OWNER_DETAILS,payload:o.data})}).catch(()=>{}),ft=D(b(null===(io=tt)||void 0===io?void 0:io.googlePlaceId,null===(no=tt)||void 0===no?void 0:no.id)).catch(()=>{}),mt=null===(ao=await(0,r.x7)(at))||void 0===ao?void 0:ao.data,gt=!!c.A.get("corporateToken")&&!!c.A.get("corporateHotelId"),At=(mt||[]).filter(o=>{return"coupon"!==(null===o||void 0===o?void 0:o.type)&&("payment_method"!==(null===o||void 0===o?void 0:o.type)&&(!gt||(null===o||void 0===o||null===(t=o.PromotionsExtraConfigs)||void 0===t?void 0:t.some(o=>"rateplan_id"===o.type))));var t});var Do;if(D({type:p.A.SET_PROMOTION,payload:At}),D({type:p.A.SET_PAYMENT_METHOD_PROMOTIONS,payload:(mt||[]).filter(o=>"payment_method"===(null===o||void 0===o?void 0:o.type))}),(o=>{let{promotions:t,hotelRooms:e,checkInDate:l,checkOutDate:i,adultCount:d=2,childCount:a=0,infantCount:r=0}=o;const u=g(t,l,i),c={promotionData:{},rateplanPrices:{}};e.forEach(o=>{var t,e,l;null!==o&&void 0!==o&&null!==(t=o.pricing)&&void 0!==t&&t.some(o=>(null===o||void 0===o?void 0:o.adultCount)===d&&(null===o||void 0===o?void 0:o.childCount)===a&&(null===o||void 0===o?void 0:o.infantCount)===r)||(d=null!==(l=null===o||void 0===o?void 0:o.defaultGuestCount)&&void 0!==l?l:2,a=0,r=0),null===(e=o.pricing)||void 0===e||e.forEach(t=>{var e;if(t.adultCount!==d||t.childCount!==a||t.infantCount!==r)return;const l={price:0,discount:0,discountPercentage:0,priceAfterDiscount:0};null===(e=t.priceForPax)||void 0===e||e.forEach((e,i)=>{var d;let{checkInDate:a,priceBeforeTax:r}=e;const v=n()(a).format("YYYY-MM-DD"),s=A(u,r,o,null===(d=o.ratePlans[t.ratePlanCode])||void 0===d?void 0:d.id,a),{mostApplicablePromotion:h,highestDiscount:p}=y(s,t,r,i);console.log({mostApplicablePromotion:h,suitablePromotions:s}),h&&p&&(c.promotionData[v]||(c.promotionData[v]=[]),c.promotionData[v].includes(h.id)||c.promotionData[v].push(h.id)),l.price+=r,l.discount+=p}),l.price=I(l.price),l.discount=I(l.discount),l.discountPercentage=I(l.discount/l.price*100),l.priceAfterDiscount=I(l.price-l.discount),c.rateplanPrices[t.ratePlanCode]=l});const i=Object.keys(o.ratePlans||{});if(i.forEach(t=>{o.ratePlans[t].prices=c.rateplanPrices[t],o.ratePlans[t].pricing=o.pricing.find(o=>o.adultCount===d&&o.ratePlanCode===t)}),i.length>0){const t={},e=Object.entries(o.ratePlans);e.sort((o,t)=>{var e,l;const i=(null===(e=o[1].prices)||void 0===e?void 0:e.priceAfterDiscount)||Number.MAX_VALUE;return((null===(l=t[1].prices)||void 0===l?void 0:l.priceAfterDiscount)||Number.MAX_VALUE)-i}),e.forEach(o=>{let[e,l]=o;t[e]=l}),o.ratePlans=t}}),console.log({hotelRooms:e})})({checkInDate:E,checkOutDate:C,adultCount:+(null!==(ro=null!==(uo=null===o||void 0===o?void 0:o.adultCount)&&void 0!==uo?uo:null===o||void 0===o?void 0:o.totalAdult)&&void 0!==ro?ro:2),
1childCount:+(null!==(co=null!==(vo=null!==(so=null===o||void 0===o?void 0:o.childCount)&&void 0!==so?so:null===o||void 0===o?void 0:o.totalChild)&&void 0!==vo?vo:null===o||void 0===o?void 0:o.totalChildren)&&void 0!==co?co:0),hotelRooms:it,infantCount:null===o||void 0===o?void 0:o.infantCount,promotions:At}),nt)it=[null===(Do=it)||void 0===Do?void 0:Do.reduce((o,t)=>!o||+(null===o||void 0===o?void 0:o.defaultPrice)>+(null===t||void 0===t?void 0:t.defaultPrice)?t:o,null)];n()("2023/09/09").add(1,"hour").set("minute",0).set("second",0).set("millisecond",0).format("hh:mm A");let yt=(null===(ho=it)||void 0===ho?void 0:ho.some(o=>{var t;return(null===o||void 0===o||null===(t=o.hourly)||void 0===t?void 0:t.length)>0}))||!1;if(it.forEach(o=>{var t;let{HotelRoomAddons:e=[]}=o;e=null===(t=e)||void 0===t?void 0:t.filter(o=>{var t;return"person"!==(null===o||void 0===o||null===(t=o.Addon)||void 0===t?void 0:t.category)});let i=(0,l.A)((0,l.A)({},o),{},{HotelRoomAddons:e});B.push(i)}),B.length>0){var ko,Eo;let o=null===(ko=B)||void 0===ko?void 0:ko.filter(o=>{var t;return null===o||void 0===o||null===(t=o.pricing)||void 0===t?void 0:t.every(o=>(null===o||void 0===o?void 0:o.roomCount)>0)}),t=null===(Eo=B)||void 0===Eo?void 0:Eo.filter(o=>{var t;return null===o||void 0===o||null===(t=o.pricing)||void 0===t?void 0:t.some(o=>0===(null===o||void 0===o?void 0:o.roomCount))});const e=o.sort((o,t)=>(null===o||void 0===o?void 0:o.pricing.reduce((o,t)=>o+(null===t||void 0===t?void 0:t.price),0))-(null===t||void 0===t?void 0:t.pricing.reduce((o,t)=>o+(null===t||void 0===t?void 0:t.price),0))),l=function(o){let t=1/0,e=0,l="";return o.forEach(o=>{const i=(null===o||void 0===o?void 0:o.ratePlans)||{};var n;Object.values(i).forEach(i=>{var n;const d=null===i||void 0===i||null===(n=i.prices)||void 0===n?void 0:n.priceAfterDiscount;var a;d&&d<t&&(t=d,e=(null===i||void 0===i||null===(a=i.pricing)||void 0===a?void 0:a.adultCount)||1,l=o.roomName)}),Object.keys(i).length||null===o||void 0===o||null===(n=o.pricing)||void 0===n||n.forEach(i=>{i.priceForPax?i.priceForPax.forEach(n=>{n.priceBeforeTax<t&&(t=n.priceBeforeTax,e=i.adultCount||1,l=o.roomName)}):i.price<t&&(t=i.price,e=i.adultCount||1,l=o.roomName)})}),{lowestPrice:Math.round(t),adultCount:e,roomName:l}}(e);c.A.set("lowestAmount",l),B=[...e,...t],c.A.set("lowestRoom",(null===o||void 0===o?void 0:o[0])||{})}let It=null===(po=B)||void 0===po?void 0:po.some(o=>null===o||void 0===o?void 0:o.ratePlans);n()(C).diff(E,"days");const Dt=n()(E).diff(n()(),"days");B=null===(fo=B)||void 0===fo?void 0:fo.map(o=>{const t={};return Object.entries((null===o||void 0===o?void 0:o.ratePlans)||{}).forEach(o=>{var e;let[l,i]=o;const n=JSON.parse(null!==(e=null===i||void 0===i?void 0:i.ratePlanConfig)&&void 0!==e?e:"null");null!==n&&void 0!==n&&n.advanceBookingWindow&&Dt<n.advanceBookingWindow||null!==n&&void 0!==n&&n.lateBookingWindow&&Dt>n.lateBookingWindow||(t[l]=i)}),(0,l.A)((0,l.A)({},o),{},{ratePlans:t})}),tt=(0,l.A)((0,l.A)({},tt),{},{HotelRooms:B}),await Promise.all([rt,ct,ht,pt,ft]),D({type:p.A.SET_IS_RATEPLAN,payload:It}),D({type:p.A.SHOW_HOURLY,payload:yt}),D({type:p.A.DETAILS,payload:tt});const kt=await ut;200===(null===kt||void 0===kt?void 0:kt.status)&&D({type:p.A.SET_TAXES,payload:null===kt||void 0===kt?void 0:kt.data});const Et=[];D({type:p.A.RESET_SELECTED_RATEPLANS}),Y.forEach(o=>{const t=B.find(t=>String(t.id)===String(o.roomId));t&&t.ratePlans&&t.ratePlans[o.code]&&Et.push(o)});const _t=new Set,Ct=Et.filter(o=>{const t="".concat(o.roomId,"_").concat(o.code);return!_t.has(t)&&(_t.add(t),!0)});if(!i&&Ct.length>0&&d){var _o,Co,Po,To,bo,So,wo;const t=+(null!==(_o=null!==(Co=null===o||void 0===o?void 0:o.adultCount)&&void 0!==Co?Co:null===o||void 0===o?void 0:o.totalAdult)&&void 0!==_o?_o:2),e=+(null!==(Po=null!==(To=null!==(bo=null===o||void 0===o?void 0:o.childCount)&&void 0!==bo?bo:null===o||void 0===o?void 0:o.totalChild)&&void 0!==To?To:null===o||void 0===o?void 0:o.totalChildren)&&void 0!==Po?Po:0),i=+(null!==(So=null!==(wo=null===o||void 0===o?void 0:o.infantCount)&&void 0!==wo?wo:null===o||void 0===o?void 0:o.totalInfant)&&void 0!==So?So:0),n=[];Ct.forEach(o=>{var d,a,r,u,c;const v=B.find(t=>String(t.id)===String(o.roomId));if(!v||!v.availableRooms||null===v||void 0===v||null===(d=v.pricing)||void 0===d||!d.find(t=>t.ratePlanCode===(null===o||void 0===o?void 0:o.code)))return;if(!v.ratePlans[o.code])return;const s=((null===v||void 0===v?void 0:v.maxAdultCount)>(null===(a=v.pricing)||void 0===a||null===(r=a.filter(t=>(null===t||void 0===t?void 0:t.ratePlanCode)===(null===o||void 0===o?void 0:o.code)))||void 0===r?void 0:r.length)?null===(u=v.pricing)||void 0===u||null===(c=u.filter(t=>(null===t||void 0===t?void 0:t.ratePlanCode)===(null===o||void 0===o?void 0:o.code)))||void 0===c?void 0:c.length:null===v||void 0===v?void 0:v.maxAdultCount)||v.maxAdultCount,h=v.maxChildCount,p=v.maxInfantCount,f=v.maxGuestCount,m=((o,t,e,l,i,n,d,a)=>{let r=o,u=t,c=e;const v=[];
1if(t>0&&!d||e>0&&!a)return[];let s=Math.ceil(o/n);if(s=Math.max(s,Math.ceil((o+t+e)/i)),l<s)return[];if(t>0||e>0){for(let t=0;t<l;t++)r>0&&(v.push({adults:1,children:0,infants:0}),r--);for(;r>0;)v.push({adults:1,children:0,infants:0}),r--;for(const t of v){let o=i-t.adults;if(u>0&&o>0){const e=Math.min(u,d,o);t.children=e,u-=e,o-=e}if(c>0&&o>0){const e=Math.min(c,a,o);t.infants=e,c-=e}}if(r>0)for(let t=0;t<v.length&&r>0;t++){const o=v[t],e=i-(o.adults+o.children+o.infants),l=n-o.adults;if(e>0&&l>0){const t=Math.min(r,e,l);o.adults+=t,r-=t}}const o=0===r&&0===u&&0===c;for(let t=v.length-1;t>=0&&!(v.length<=s&&o);t--){const o=v[t];if(!(o.children>0||o.infants>0))for(let e=0;e<t;e++){const o=v[e],l=i-(o.adults+o.children+o.infants);if(o.adults<n&&l>=1){o.adults++,v.splice(t,1);break}}}}else{for(let o=0;o<l;o++)if(r>0){const o=Math.min(r,n);v.push({adults:o,children:0,infants:0}),r-=o}for(;r>0;){const o=Math.min(r,n);v.push({adults:o,children:0,infants:0}),r-=o}}return r>0||u>0||c>0?[]:v})(t,e,i,v.availableRooms,f,s,h,p);m.forEach((t,e)=>{const i=(0,l.A)((0,l.A)({},o),{},{sAdult:t.adults,sChild:t.children,sInfant:t.infants,idx:e,id:"".concat(v.id,"_").concat(o.code,"_").concat(o.rpObject.id)});n.push(i)})}),n.forEach(o=>{D({type:p.A.SELECT_RP,payload:o})})}else if(!i){const o=[],t={};Y.forEach(o=>{const e="".concat(o.roomId,"_").concat(o.code);t[e]||(t[e]=[]),t[e].push(o)}),Object.entries(t).forEach(t=>{let[e,l]=t;const[i]=e.split("_"),n=B.find(o=>String(o.id)===String(i));if(n&&n.availableRooms>0){const t=n.availableRooms,e=l.length,i=Math.min(e,t);for(let n=0;n<i;n++)o.push(l[n])}}),o.forEach(o=>{var t;const e=B.find(t=>String(t.id)===String(o.roomId));e&&e.availableRooms>0&&e.ratePlans&&e.ratePlans[o.code]&&null!==(t=e.pricing)&&void 0!==t&&t.find(t=>(null===t||void 0===t?void 0:t.ratePlanCode)===o.code)&&D({type:p.A.SELECT_RP,payload:o})})}let Pt;var Oo,No;if(It)Pt=null===(Oo=B)||void 0===Oo?void 0:Oo.every(o=>{if(null===o||void 0===o||!o.availableRooms)return!0;if(null===o||void 0===o||!o.ratePlans||0===Object.keys(o.ratePlans).length)return!0;if(null===o||void 0===o||!o.pricing||0===o.pricing.length)return!0;return!o.pricing.some(t=>(null===t||void 0===t?void 0:t.ratePlanCode)&&o.ratePlans[t.ratePlanCode])});else Pt=null===(No=B)||void 0===No?void 0:No.every(o=>null===o||void 0===o?void 0:o.soldOut);if(Pt){if(!m){var xo;if(D({type:p.A.SET_NOTIFY_NO_INVENTORY,payload:!0}),null!==(xo=tt)&&void 0!==xo&&xo.chainId)try{var Yo;const t=await(0,r.IB)(null===(Yo=tt)||void 0===Yo?void 0:Yo.id,n()(null===o||void 0===o?void 0:o.checkInDate).format("YYYY-MM-DD"),n()(null===o||void 0===o?void 0:o.checkOutDate).format("YYYY-MM-DD"));200===(null===t||void 0===t?void 0:t.status)&&null!==t&&void 0!==t&&t.data?(D({type:p.A.SET_NEARBY_HOTELS,payload:t.data}),(0,v.fireGtmEvent)("Nearby Hotels Fetched",(0,l.A)((0,l.A)({},o),{},{nearbyHotelsCount:t.data.length}))):D({type:p.A.SET_NEARBY_HOTELS,payload:[]})}catch(et){console.error("Failed to fetch nearby hotels:",et),D({type:p.A.SET_NEARBY_HOTELS,payload:[]})}return D({type:p.A.FETCHING,payload:!1}),(0,v.fireGtmEvent)("no_rooms_available",P(tt,o,"user_selected_dates")),M}if(h)return D({type:p.A.SET_NOTIFY_NO_INVENTORY,payload:!0}),D({type:p.A.FETCHING,payload:!1}),(0,v.fireGtmEvent)("no_rooms_available",P(tt,o,"after_next_available_search")),M;try{var Mo,Ro,Bo;const a=(null===(Mo=tt)||void 0===Mo?void 0:Mo.minBookingNights)||1,u=new Date,c=new Date(u.getFullYear(),u.getMonth()+1,0),s=n()(u).format("YYYY-MM-DD"),h={fromDate:s,toDate:n()(c).format("YYYY-MM-DD"),hotelId:null===(Ro=tt)||void 0===Ro?void 0:Ro.id,timezone:null===o||void 0===o?void 0:o.timezone,adults:(null===o||void 0===o?void 0:o.totalAdult)||(null===o||void 0===o?void 0:o.adultCount)||1,children:(null===o||void 0===o?void 0:o.totalChild)||(null===o||void 0===o?void 0:o.childCount)||0},f=await(0,r.CN)(h);if(200===(null===f||void 0===f?void 0:f.status)&&null!==f&&void 0!==f&&f.data&&Array.isArray(null===f||void 0===f?void 0:f.data)&&(null===f||void 0===f||null===(Bo=f.data)||void 0===Bo?void 0:Bo.length)>0){const u=((o,t)=>{if(!o||o.length<t)return null;const e=[...o].sort((o,t)=>new Date(o.checkInDate)-new Date(t.checkInDate));if(1===t)return{checkInDate:e[0].checkInDate};let l=1,i=e[0];for(let n=1;n<e.length;n++){const o=new Date(e[n-1].checkInDate),d=new Date(e[n].checkInDate);if(1===Math.round((d-o)/864e5)){if(l++,l>=t)return{checkInDate:i.checkInDate}}else l=1,i=e[n]}return null})(f.data.filter(o=>o.count>0).map(o=>({checkInDate:o.checkInDate})),a);if(u){const r=n()(u.checkInDate).format("YYYY-MM-DD HH:mm:ss"),c=n()(u.checkInDate).add(a,"days").format("YYYY-MM-DD HH:mm:ss");return(0,v.fireGtmEvent)("no_rooms_available",P(tt,o,"auto_redirected_to_next_available",{redirected_check_in_date:r,redirected_check_out_date:c})),D(T((0,l.A)((0,l.A)({},o),{},{checkInDate:r,checkOutDate:c}),t,e,i,d,!0))}var Fo;if(null!==(Fo=tt)&&void 0!==Fo&&Fo.chainId)try{var Ho;const t=await(0,r.IB)(null===(Ho=tt)||void 0===Ho?void 0:Ho.id,n()(null===o||void 0===o?void 0:o.checkInDate).format("YYYY-MM-DD"),n()(null===o||void 0===o?void 0:o.checkOutDate).format("YYYY-MM-DD"));200===(null===t||void 0===t?void 0:t.status)&&null!==t&&void 0!==t&&t.data?(D({type:p.A.SET_NEARBY_HOTELS,payload:t.data}),(0,v.fireGtmEvent)("Nearby Hotels Fetched - No Consecutive Dates",(0,l.A)((0,l.A)({},o),{},{nearbyHotelsCount:t.data.length}))):D({type:p.A.SET_NEARBY_HOTELS,payload:[]})}catch(lt){console.error("Failed to fetch nearby hotels:",lt),D({type:p.A.SET_NEARBY_HOTELS,payload:[]})}D({type:p.A.SET_NOTIFY_NO_INVENTORY,payload:!0}),D({type:p.A.FETCHING,payload:!1}),(0,v.fireGtmEvent)("no_rooms_available",P(tt,o,"no_consecutive_dates",{min_booking_nights:a,dates_found:f.data.length}))}else{var Go;
1if(console.log("\u274c No available dates found in API response"),null!==(Go=tt)&&void 0!==Go&&Go.chainId)try{var Lo;const t=await(0,r.IB)(null===(Lo=tt)||void 0===Lo?void 0:Lo.id,n()(null===o||void 0===o?void 0:o.checkInDate).format("YYYY-MM-DD"),n()(null===o||void 0===o?void 0:o.checkOutDate).format("YYYY-MM-DD"));200===(null===t||void 0===t?void 0:t.status)&&null!==t&&void 0!==t&&t.data?(D({type:p.A.SET_NEARBY_HOTELS,payload:t.data}),(0,v.fireGtmEvent)("Nearby Hotels Fetched - No Dates in Month",(0,l.A)((0,l.A)({},o),{},{nearbyHotelsCount:t.data.length}))):D({type:p.A.SET_NEARBY_HOTELS,payload:[]})}catch(lt){console.error("Failed to fetch nearby hotels:",lt),D({type:p.A.SET_NEARBY_HOTELS,payload:[]})}D({type:p.A.SET_NOTIFY_NO_INVENTORY,payload:!0}),D({type:p.A.FETCHING,payload:!1}),(0,v.fireGtmEvent)("no_rooms_available",P(tt,o,"no_dates_in_month"))}}catch(et){var jo;if(null!==(jo=tt)&&void 0!==jo&&jo.chainId)try{var Uo;const t=await(0,r.IB)(null===(Uo=tt)||void 0===Uo?void 0:Uo.id,n()(null===o||void 0===o?void 0:o.checkInDate).format("YYYY-MM-DD"),n()(null===o||void 0===o?void 0:o.checkOutDate).format("YYYY-MM-DD"));200===(null===t||void 0===t?void 0:t.status)&&null!==t&&void 0!==t&&t.data?(D({type:p.A.SET_NEARBY_HOTELS,payload:t.data}),(0,v.fireGtmEvent)("Nearby Hotels Fetched - API Error",(0,l.A)((0,l.A)({},o),{},{nearbyHotelsCount:t.data.length}))):D({type:p.A.SET_NEARBY_HOTELS,payload:[]})}catch(lt){console.error("Failed to fetch nearby hotels:",lt),D({type:p.A.SET_NEARBY_HOTELS,payload:[]})}D({type:p.A.SET_NOTIFY_NO_INVENTORY,payload:!0}),D({type:p.A.FETCHING,payload:!1}),(0,v.fireGtmEvent)("no_rooms_available",P(tt,o,"api_error",{error:(null===et||void 0===et?void 0:et.message)||null}))}}else D({type:p.A.SET_NOTIFY_NO_INVENTORY,payload:!1}),D({type:p.A.SET_NEARBY_HOTELS,payload:[]}),h&&null!==o&&void 0!==o&&o.checkInDate&&null!==o&&void 0!==o&&o.checkOutDate&&D({type:p.A.SET_DATE,payload:{startDate:n()(o.checkInDate,"YYYY/MM/DD"),endDate:n()(o.checkOutDate,"YYYY/MM/DD")}});if(1===(null===(mo=tt)||void 0===mo||null===(go=mo.HotelType)||void 0===go?void 0:go.id)&&1===(null===(Ao=B)||void 0===Ao?void 0:Ao.length)&&(null===(yo=B[0])||void 0===yo?void 0:yo.availableRooms)>0&&(null===(Io=k().hotelInfo.selectedRatePlans)||void 0===Io||!Io.length)){const t=B[0],e=null!==t&&void 0!==t&&t.ratePlans?Object.keys(t.ratePlans):[];if(console.log({ratePlanKeys:e}),1===e.length){var Vo,zo,qo,Wo,Qo,Ko;const i=e[0],n=t.ratePlans[i];if(null===t||void 0===t||null===(Vo=t.pricing)||void 0===Vo||!Vo.find(o=>o.ratePlanCode===i))return;const d=parseInt(null!==(zo=null!==(qo=null===o||void 0===o?void 0:o.adultCount)&&void 0!==qo?qo:null===o||void 0===o?void 0:o.totalAdult)&&void 0!==zo?zo:2),a=parseInt(null!==(Wo=null!==(Qo=null!==(Ko=null===o||void 0===o?void 0:o.childCount)&&void 0!==Ko?Ko:null===o||void 0===o?void 0:o.totalChild)&&void 0!==Qo?Qo:null===o||void 0===o?void 0:o.totalChildren)&&void 0!==Wo?Wo:0),r=(0,f.F)(d,a,t.availableRooms,t.maxGuestCount,t.maxAdultCount||t.maxGuestCount,t.maxChildCount||0);if(r&&r.length>0){const o=JSON.parse((null===n||void 0===n?void 0:n.ratePlanConfig)||"{}");r.forEach((e,d)=>{const a={sAdult:e.adults,sChild:e.children,sInfant:0,code:n.ratePlanCode||i,roomId:t.id,id:"".concat(t.id,"_").concat(i,"_").concat(null===n||void 0===n?void 0:n.id),idx:null===n||void 0===n?void 0:n.id,roomName:t.roomName||t.name||"Room",RoomImages:t.RoomImages,rpObject:(0,l.A)((0,l.A)({},o),{},{id:n.id})};D(S(a,{},d,()=>{}))})}}}}else if(400===(null===(w=M)||void 0===w?void 0:w.status)&&null!==(O=M)&&void 0!==O&&null!==(N=O.message)&&void 0!==N&&N.includes("date"))if(sessionStorage.getItem("dateRedirectAttempted"))sessionStorage.removeItem("dateRedirectAttempted"),u.A.error("These dates are no longer available. Please choose new dates.");else{var Zo,Jo,$o,Xo,ot;sessionStorage.setItem("dateRedirectAttempted","1");const t=null===(Zo=M)||void 0===Zo||null===(Jo=Zo.data)||void 0===Jo?void 0:Jo.timezone,e=null!==($o=null===o||void 0===o?void 0:o.id)&&void 0!==$o?$o:null===(Xo=M)||void 0===Xo||null===(ot=Xo.data)||void 0===ot?void 0:ot.hotelId,l=(0,s.i)(t),i=n()(l).add(1,"day").toDate(),d=new URL(window.location.href).searchParams.toString(),a=d?"?".concat(d):"";null!==o&&void 0!==o&&o.id||null===o||void 0===o||!o.websiteSlug?window.location.href="/rooms/".concat(e,"/").concat(n()(l).format("YYYY-MM-DD"),"/").concat(n()(i).format("YYYY-MM-DD"),"/2/0").concat(a):window.location.href="/".concat(o.websiteSlug).concat(a)}else{sessionStorage.removeItem("dateRedirectAttempted");let t=c.A.get("source")||"no_source",e=c.A.get("utmObj")||{utmSource:t};(0,v.fireGtmEvent)("availableApiFailed",(0,l.A)((0,l.A)({},o),{},{utmObj:e})),window.location.href="/pagenotfound"}if(D({type:p.A.FETCHING,payload:!1}),200===(null===(x=M)||void 0===x?void 0:x.status)){var tt;let o=localStorage.getItem("uuid")||"";!(null!==(tt=o)&&void 0!==tt&&tt.length)>0&&(o=a()(),localStorage.setItem("uuid",o)),C()}return M}},b=(o,t)=>async e=>{const[l,i]=await Promise.all([(0,r.GR)(o),(0,r.yQ)(t)]);var n;200===(null===l||void 0===l?void 0:l.status)&&200===i.status&&(e({type:p.A.FETCH_REVIEW,payload:null===l||void 0===l||null===(n=l.data)||void 0===n?void 0:n.result}),e({type:p.A.FETCH_REVIEW_Arjun,payload:null===i||void 0===i?void 0:i.data}))},S=function(o,t){let e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:()=>{};return async t=>{try{t({type:p.A.SELECT_RP,payload:o})}catch(l){(0,v.fireGtmEvent)("checkRoomApiFailed",o)}finally{e()}}},w=o=>async t=>{try{t({type:p.A.UPDATE_RP,payload:o})}catch(e){console.log("Updating rate plan failed",e)}},O=function(o){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e=>{try{e({type:p.A.REMOVE_RP,payload:o})}catch(l){console.log("Removing rate plan failed",l)}finally{t()}}},N=o=>t=>{t({type:p.A.SELECT_ROOM,payload:o})},x=o=>t=>{t({type:p.A.DESELECT_ROOM,payload:o})},Y=o=>t=>{t({type:p.A.SELECT_ADDON,payload:o})},M=o=>t=>{t({type:p.A.DESELECT_ADDON,payload:o})},R=o=>t=>{t({type:p.A.ADD_HOTELADDON,payload:o})},B=o=>t=>{t({type:p.A.REMOVE_HOTELADDON,payload:o})},F=()=>async o=>{const t=await(0,r.PH)();200===t.status&&o({type:p.A.PENDING_REASONS,payload:t.data})},H=o=>async t=>{const e=await(0,r.bx)(o);
1200===e.status&&t({type:p.A.SET_INSTA_LINKS,payload:e.data})},G=function(o){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return async e=>{let i;if(o.includes("isMembership=true")&&c.A.get("token")){const t=o.split("?")[1]||o,l={},n=t.split("&");if(n[0]&&!n[0].includes("=")&&(l.hotelId=n[0],n.shift()),n.forEach(o=>{const[t,e]=o.split("=");t&&e&&(l[t]=decodeURIComponent(e))}),i=await(0,r.QD)(l),401===i.status||403===i.status||i.error)return sessionStorage.removeItem("isMembershipUnlocked"),c.A.remove("token"),void e({type:p.A.SHOW_MEMBERSHIP_MODAL,payload:!0})}else i=await(0,r.x7)(o);if(200===i.status){var d,a,u,v,s,f,m,g,A,y,I,D,k,E;const o=!!localStorage.getItem("corporateToken")&&!!localStorage.getItem("corporateHotelId"),r=null===(d=i)||void 0===d||null===(a=d.data)||void 0===a?void 0:a.filter(t=>{return"coupon"!==(null===t||void 0===t?void 0:t.type)&&("payment_method"!==(null===t||void 0===t?void 0:t.type)&&(!o||(null===t||void 0===t||null===(e=t.PromotionsExtraConfigs)||void 0===e?void 0:e.some(o=>"rateplan_id"===o.type))));var e});e({type:p.A.SET_PAYMENT_METHOD_PROMOTIONS,payload:((null===(u=i)||void 0===u?void 0:u.data)||[]).filter(o=>"payment_method"===(null===o||void 0===o?void 0:o.type))}),e({type:p.A.SET_PROMOTION,payload:r});let P={},T=1;if((null===(v=i)||void 0===v||null===(s=v.data)||void 0===s?void 0:s.length)>0){var _;const{data:o}=i;let t=[...o];var C;if(t=t.filter(o=>"coupon"!==(null===o||void 0===o?void 0:o.type)),t.sort((o,t)=>t.discount-o.discount),P=t[0],"bulk"!==(null===(_=P)||void 0===_?void 0:_.type))T=(null===(C=P)||void 0===C?void 0:C.discount)/100}let b=c.A.get("source")||"Hotelzify_Fallback",S=c.A.get("utmObj")||{utmSource:b},w=0,O=c.A.get("showBanner")||null,N=JSON.parse(localStorage.getItem("visited"))||[],x=c.A.get("isGHC"),Y=new URLSearchParams(new URL(window.location.href).search),M=Object.fromEntries(Y),R=c.A.get("uuid"),B=c.A.get("locationDetails"),F=c.A.get("lowestRoom")||{},H=c.A.get("checkInDate"),G=c.A.get("checkOutDate");M=(0,l.A)((0,l.A)({},M),{},{shownPrice:null===F||void 0===F||null===(f=F.pricing)||void 0===f||null===(m=f[0])||void 0===m?void 0:m.price,promotionSelected:P,discountPrice:(null===F||void 0===F||null===(g=F.pricing)||void 0===g||null===(A=g[0])||void 0===A?void 0:A.price)-(null===F||void 0===F||null===(y=F.pricing)||void 0===y||null===(I=y[0])||void 0===I?void 0:I.price)*T}),c.A.set("searchParams",M);let L=c.A.get("rooms")||[],j=(0,l.A)({source:b,deviceType:h.RX,locationDetails:B,testId:w,isGHC:x,isDev:h.Cu,showBanner:O,networkSpeed:(null===(D=window)||void 0===D||null===(k=D.navigator)||void 0===k||null===(E=k.connection)||void 0===E?void 0:E.effectiveType)||"not-set",uuid:R,searchParams:M,checkInDate:H,checkOutDate:G,isAvailable:null===L||void 0===L?void 0:L.some(o=>(null===o||void 0===o?void 0:o.availableRooms)>0),date:n()().format("DD-MM-YYYY hh:mm")},S);N=[...N,(0,l.A)((0,l.A)({},j),{},{hotelId:t})],localStorage.setItem("visited",JSON.stringify(N))}}},L=o=>async t=>{const e=await(0,r.Z1)(o);200===e.status&&t({type:p.A.GET_FAQ,payload:e.data})},j=function(o){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en";return async e=>{const l=await(0,r.Lo)(o,t);200===l.status&&e({type:p.A.GET_POLICY,payload:l.data})}},U=function(o){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return async l=>{const i=t&&e?await(0,r.Qo)(o,t,e):await(0,r.Zf)(o);200===i.status&&l({type:p.A.SET_PAYMENTS,payload:i.data})}},V=function(o){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return async l=>{const i=await(0,r.MQ)(o,t,e);200===(null===i||void 0===i?void 0:i.status)&&l({type:p.A.SET_PAYMENT_PROVIDER,payload:null===i||void 0===i?void 0:i.data})}},z=o=>async t=>{const e=await(0,r.PU)(o);200===e.status&&t({type:p.A.BNPL_CONFIG,payload:e.data})},q=o=>async t=>{const e=await(0,r.th)(o);200===e.status&&t({type:p.A.GET_SCRIPT_TAG_ID,payload:e.data.scriptTagID})},W=o=>async t=>{try{t({type:p.A.SET_BOOKING_ENGINE_CONFIG_LOADING,payload:!0});const e=await(0,r.yZ)(o);200===(null===e||void 0===e?void 0:e.status)&&null!==e&&void 0!==e&&e.data?t({type:p.A.SET_BOOKING_ENGINE_CONFIG,payload:e.data.config}):t({type:p.A.SET_BOOKING_ENGINE_CONFIG,payload:{}})}catch(e){console.log("Failed to fetch booking engine config",e),t({type:p.A.SET_BOOKING_ENGINE_CONFIG,payload:{}})}finally{t({type:p.A.SET_BOOKING_ENGINE_CONFIG_LOADING,payload:!1})}}}}]); 2//# sourceMappingURL=8984.1576aeae.chunk.js.map
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.