PageSourceSearch

https://hotelzify.com/static/js/8984.25c36e8d.chunk.js

js hotelzify.com collected 2026-10-01 15:36:32 UTC 69,536 bytes, 2 lines download raw bytes

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:()=>Po,Jy:()=>M,L3:()=>N,Lo:()=>w,MF:()=>q,MQ:()=>X,N7:()=>K,O2:()=>z,P$:()=>oo,PG:()=>p,PH:()=>k,PU:()=>to,QD:()=>b,Qn:()=>d,Qo:()=>r,RT:()=>H,RU:()=>_o,TP:()=>so,US:()=>G,Vz:()=>F,Wk:()=>L,Xr:()=>uo,Yy:()=>A,Z1:()=>T,Zf:()=>a,_B:()=>Ao,aK:()=>E,aO:()=>f,be:()=>Co,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,nw:()=>Eo,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),b=o=>i.A.get("hotel/authorized/v2/promotions/get-memberdeal-promotions",o),T=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=>i.A.get("hotel/v2/hotel/chain-hotels-summary?chainId=".concat(o)),_o=(o,t,e,l)=>i.A.post("hotel/v1/loyalty/validate",{programName:o,memberId:t,amount:e,hotelId:l}),Co=o=>i.A.post("payments/v1/gift-cards/balance",o),Po=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:()=>b,Fg:()=>C,Kn:()=>p,O_:()=>_,Ou:()=>A,UT:()=>h,Zg:()=>y,b9:()=>I,bu:()=>k,hR:()=>f,ix:()=>P,qB:()=>s,sO:()=>D,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=()=>22==r.A.get("chainId"),D=o=>I()&&h(o)&&!((null===o||void 0===o?void 0:o.PromotionsExtraConfigs)||[]).some(o=>"rateplan_id"===(null===o||void 0===o?void 0:o.type)),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&&!D(o)&&!A(t,null===l||void 0===l||null===(r=l.rpObject)||void 0===r?void 0:r.id))continue;if(!E(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(!E(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=C({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=C({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=C({tempPrice:e,rp:l,checkInDate:i,customArray:t,promo:o}))}}return a};function E(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 _=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&&!D(o)&&!A(t,null===l||void 0===l||null===(r=l.rpObject)||void 0===r?void 0:r.id))continue;if(!E(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(!E(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=C({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=C({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=C({tempPrice:e,rp:l,checkInDate:i,customArray:t,promo:o}))}}return a},C=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},P=(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},b=()=>{const{selectedRatePlans:o=[],hotelData:t={},dateRange:e,dateCount:i,selectedHotelAddons:s=[],promotions:A=[],taxes:y=[],couponCode:I={},selectedPaymentOffer:D=null,isRatePlans:E,isHourlyRoom:_}=(0,a.d4)(o=>o.hotelInfo),b=(0,a.wA)(),{HotelRooms:T=[]}=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=P(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,b,T;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===(b=n.filter(o=>(null===o||void 0===o?void 0:o.checkInDate)===l))||void 0===b||null===(T=b[0])||void 0===T?void 0:T.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=[],P=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,E=[],_=[],b=[];const S=null===T||void 0===T||null===(L=T.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)))||[];_=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&&(_=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===I||void 0===I?void 0:I.id)&&"nights"===(null===I||void 0===I?void 0:I.discountType);if((V||(null===J||void 0===J?void 0:J.some(o=>"nights"===(null===o||void 0===o?void 0:o.discountType))))&&_.length>0){const o=_.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?[I]:J.filter(o=>"nights"===(null===o||void 0===o?void 0:o.discountType)),e=k({arrangedPromos:t,rp:r,tempPrice:(null===(U=o[0])||void 0===U?void 0:U.priceBeforeTax)||(null===(z=_[0])||void 0===z?void 0:z.priceBeforeTax),checkInDate:(null===(W=o[0])||void 0===W?void 0:W.checkInDate)||(null===(K=_[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(_.forEach((d,f)=>{var g,A,_;let P=null===d||void 0===d?void 0:d.priceBeforeTax,T=null===d||void 0===d?void 0:d.checkInDate,w={},O=[];const N=n()(T).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=k({arrangedPromos:[R],rp:r,tempPrice:P,checkInDate:T}));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=k({arrangedPromos:o,rp:r,tempPrice:P,checkInDate:T}),H=R}else F=R,H=null;else F=k({arrangedPromos:Y,rp:r,tempPrice:P,checkInDate:T});a+=P;let{finalValue:U,reducedPrice:V}=m({price:P,promo:F,idx:f,dateCount:i,checkInDate:T,nightPromotionNights:j});if(H&&null!==(g=H)&&void 0!==g&&g.isStack){let o=m({price:U,promo:H,idx:f,dateCount:i,checkInDate:T,nightPromotionNights:j});V+=o.reducedPrice,U=o.finalValue}if(null!==I&&void 0!==I&&I.id&&x(I)){const t=o.length||1,e="booking"===I.discountScope&&"fixed_amount"===I.discountType?(0,l.A)((0,l.A)({},I),{},{discount:parseFloat(I.discount)/(t*i)}):I;if(w=k({arrangedPromos:[e],rp:r,tempPrice:null!==I&&void 0!==I&&I.isStack?U:P,checkInDate:T}),w){var z;let o=m({price:null!==I&&void 0!==I&&I.isStack?U:P,promo:w,idx:f,dateCount:i,checkInDate:T,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!==D&&void 0!==D&&D.id){const t=o.length||1,e="fixed_amount"===D.discountType?(0,l.A)((0,l.A)({},D),{},{discount:parseFloat(D.discount)/(t*i)}):D,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))?C({tempPrice:null!==D&&void 0!==D&&D.isStack?U:P,rp:r,checkInDate:T,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!==D&&void 0!==D&&D.isStack?U:P,promo:q,idx:f,dateCount:i,checkInDate:T,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:T,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:T,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!==I&&void 0!==I&&I.isStack?U+0:P,promo:w,idx:f,dateCount:i,checkInDate:T,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!==D&&void 0!==D&&D.isStack?U:P,promo:q,idx:f,dateCount:i,checkInDate:T,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})]}E.push({promo:O,checkInDate:T,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};b.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(E)],room:S,onedayObj:b});A.push(q),d+=null===q||void 0===q?void 0:q.sum,P+=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=>{"guest_based"===o.Addon.multiplier?S+=(O*parseFloat(o.price)+x*parseFloat(o.childPrice||0))*i:"per_day"===o.Addon.multiplier?S+=parseFloat(o.price)*i:S+=parseFloat(o.price)});const $=d+S+M,X=E&&!_,to=X&&null!==I&&void 0!==I&&I.id?(0,c.s)(I,$):null;X&&to&&b({type:v.A.SET_COUPON_CODE,payload:{}}),vo(to),r.A.set("totalPrice",d+S),w(d+S),oo(a+S),j(P),V(d),ao(M),uo($),ho(B),q(S),Y(f),Q({discount:g}),Z(d),N(A)})()},[o,s,J,I,A,D,e,E,_]),(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:()=>b,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.sO)(o)&&!(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)},b=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],D=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return async(k,E)=>{var w,O,N,x,Y;t&&k({type:p.A.FETCHING,payload:!0});const M=i?[]:E().hotelInfo.selectedRatePlans;let R;i&&k({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 B=c.A.get("utmObj")||{};if((null===B||void 0===B?void 0:B.utmSource)||(null===B||void 0===B?void 0:B.googleSource))try{R=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===B||void 0===B?void 0:B.utmSource)||(null===B||void 0===B?void 0:B.googleSource)))})}catch(lt){R=lt.response||{status:500,message:"Failed after 10 retries with exponential backoff"}}else R=await(0,r.Qn)(o,e);let F=[];if(200===(null===(w=R)||void 0===w?void 0:w.status)){var 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,Do;sessionStorage.removeItem("dateRedirectAttempted");const{data:a=[]}=R;_(a[0]);let u=0===c.A.get("testId")||1===c.A.get("testId")?c.A.get("testId"):null;
1null===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:C,checkOutDate:w}=o;c.A.set("hotelId",null===(H=a[0])||void 0===H?void 0:H.id),c.A.set("hotelName",null===(G=a[0])||void 0===G?void 0:G.name),c.A.set("slug",null===(L=a[0])||void 0===L?void 0:L.websiteSlug),c.A.set("domain",null===(V=a[0])||void 0===V?void 0:V.domain),c.A.set("isGHC",null===(z=a[0])||void 0===z?void 0:z.ghcEnabled),c.A.set("chainId",null===(q=a[0])||void 0===q?void 0:q.chainId);const O=null===(Q=a[0])||void 0===Q?void 0:Q.domain,N=null===(K=a[0])||void 0===K?void 0:K.websiteSlug,x=(null===O||void 0===O?void 0:O.startsWith("booking."))||(null===O||void 0===O?void 0:O.startsWith("bookings.")),Y=x?O.split("/")[0]:null,Jo=!!Y&&/^[a-z0-9.-]+\.[a-z]{2,}$/i.test(Y),$o=window.location.host,Xo=/localhost|dev\.hotelzify|staging\.|test-dev|^\d+\.\d+\.\d+\.\d+/.test($o);if(x&&Jo&&!Xo&&$o!==Y){const o=$o.replace(/^www\./,""),t=o.endsWith(".bookmystay.io")&&o.split(".").length>2;let e=window.location.pathname;return t&&N&&"/"===e?e="/".concat(N):"/"===e&&(e=""),void window.location.replace("https://".concat(Y).concat(e).concat(window.location.search))}const ot=$o.replace(/^www\./,""),tt="bookmystay.io"===ot||ot.endsWith(".bookmystay.io");if(console.log("currentHostdomain",$o),console.log("hotelDomain",O),!Xo&&!tt&&$o!==O)return void window.location.replace("https://bookmystay.io".concat(window.location.pathname).concat(window.location.search));c.A.set("checkInDate",C),c.A.set("checkOutDate",w);let et=(0,l.A)({},a[0]),{HotelRooms:nt=[]}=et;c.A.set("rooms",nt),nt=null===(Z=nt)||void 0===Z?void 0:Z.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 dt="google_vr"===c.A.get("source");let at=Intl.DateTimeFormat().resolvedOptions().timeZone;at="Etc/Unknown"===at?null:encodeURIComponent(at);let rt=at?"".concat(null===(J=a[0])||void 0===J?void 0:J.id,"&checkInDate=").concat(n()(C).format("DD/MM/YYYY"),"&checkOutDate=").concat(n()(w).format("DD/MM/YYYY"),"&shouldApplyFilter=true&timezone=").concat(at):"".concat(null===($=a[0])||void 0===$?void 0:$.id,"&checkInDate=").concat(n()(C).format("DD/MM/YYYY"),"&checkOutDate=").concat(n()(w).format("DD/MM/YYYY"),"&shouldApplyFilter=true");const ut=k(W(null===(X=et)||void 0===X?void 0:X.id)),ct=(0,r.xp)(null===(oo=et)||void 0===oo?void 0:oo.id),vt=k(j(null===(to=et)||void 0===to?void 0:to.id,e)).catch(()=>{});let st=Intl.DateTimeFormat().resolvedOptions().timeZone;st="Etc/Unknown"===st?null:encodeURIComponent(st);const ht={hotelId:null===(eo=et)||void 0===eo?void 0:eo.id,timezone:st,vendorCampaignId:null===B||void 0===B?void 0:B.hotel_campaign,currency:null===(lo=et)||void 0===lo?void 0:lo.currency};st||delete ht.timezone;const pt=k(U(ht)).catch(()=>{}),ft=(0,r.um)(null===(io=et)||void 0===io?void 0:io.id).then(o=>{null!==o&&void 0!==o&&o.data&&k({type:p.A.SET_OWNER_DETAILS,payload:o.data})}).catch(()=>{}),mt=k(T(null===(no=et)||void 0===no?void 0:no.googlePlaceId,null===(ao=et)||void 0===ao?void 0:ao.id)).catch(()=>{}),gt=null===(ro=await(0,r.x7)(rt))||void 0===ro?void 0:ro.data,At=!!c.A.get("corporateToken")&&!!c.A.get("corporateHotelId"),yt=(gt||[]).filter(o=>{return"coupon"!==(null===o||void 0===o?void 0:o.type)&&("payment_method"!==(null===o||void 0===o?void 0:o.type)&&(!At||(!!(0,m.sO)(o)||(null===o||void 0===o||null===(t=o.PromotionsExtraConfigs)||void 0===t?void 0:t.some(o=>"rateplan_id"===o.type)))));var t});var ko;if(k({type:p.A.SET_PROMOTION,payload:yt}),k({type:p.A.SET_PAYMENT_METHOD_PROMOTIONS,payload:(gt||[]).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:C,checkOutDate:w,adultCount:+(null!==(uo=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!==uo?uo:2),childCount:+(null!==(vo=null!==(so=null!==(ho=null===o||void 0===o?void 0:o.childCount)&&void 0!==ho?ho:null===o||void 0===o?void 0:o.totalChild)&&void 0!==so?so:null===o||void 0===o?void 0:o.totalChildren)&&void 0!==vo?vo:0),hotelRooms:nt,infantCount:null===o||void 0===o?void 0:o.infantCount,promotions:yt}),dt)nt=[null===(ko=nt)||void 0===ko?void 0:ko.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 It=(null===(po=nt)||void 0===po?void 0:po.some(o=>{var t;return(null===o||void 0===o||null===(t=o.hourly)||void 0===t?void 0:t.length)>0}))||!1;if(nt.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});F.push(i)}),F.length>0){var Eo,_o;let o=null===(Eo=F)||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.every(o=>(null===o||void 0===o?void 0:o.roomCount)>0)}),t=null===(_o=F)||void 0===_o?void 0:_o.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;
1Object.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),F=[...e,...t],c.A.set("lowestRoom",(null===o||void 0===o?void 0:o[0])||{})}let Dt=null===(fo=F)||void 0===fo?void 0:fo.some(o=>null===o||void 0===o?void 0:o.ratePlans);n()(w).diff(C,"days");const kt=n()(C).diff(n()(),"days");F=null===(mo=F)||void 0===mo?void 0:mo.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&&kt<n.advanceBookingWindow||null!==n&&void 0!==n&&n.lateBookingWindow&&kt>n.lateBookingWindow||(t[l]=i)}),(0,l.A)((0,l.A)({},o),{},{ratePlans:t})}),et=(0,l.A)((0,l.A)({},et),{},{HotelRooms:F}),await Promise.all([ut,vt,pt,ft,mt]),k({type:p.A.SET_IS_RATEPLAN,payload:Dt}),k({type:p.A.SHOW_HOURLY,payload:It}),k({type:p.A.DETAILS,payload:et});const Et=await ct;200===(null===Et||void 0===Et?void 0:Et.status)&&k({type:p.A.SET_TAXES,payload:null===Et||void 0===Et?void 0:Et.data});const _t=[];k({type:p.A.RESET_SELECTED_RATEPLANS}),M.forEach(o=>{const t=F.find(t=>String(t.id)===String(o.roomId));t&&t.ratePlans&&t.ratePlans[o.code]&&_t.push(o)});const Ct=new Set,Pt=_t.filter(o=>{const t="".concat(o.roomId,"_").concat(o.code);return!Ct.has(t)&&(Ct.add(t),!0)});if(!i&&Pt.length>0&&d){var Co,Po,bo,To,So,wo,Oo;const t=+(null!==(Co=null!==(Po=null===o||void 0===o?void 0:o.adultCount)&&void 0!==Po?Po:null===o||void 0===o?void 0:o.totalAdult)&&void 0!==Co?Co:2),e=+(null!==(bo=null!==(To=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!==To?To:null===o||void 0===o?void 0:o.totalChildren)&&void 0!==bo?bo:0),i=+(null!==(wo=null!==(Oo=null===o||void 0===o?void 0:o.infantCount)&&void 0!==Oo?Oo:null===o||void 0===o?void 0:o.totalInfant)&&void 0!==wo?wo:0),n=[];Pt.forEach(o=>{var d,a,r,u,c;const v=F.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=[];if(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)})}
1),n.forEach(o=>{k({type:p.A.SELECT_RP,payload:o})})}else if(!i){const o=[],t={};M.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=F.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=F.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)&&k({type:p.A.SELECT_RP,payload:o})})}let bt;var No,xo;if(Dt)bt=null===(No=F)||void 0===No?void 0:No.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 bt=null===(xo=F)||void 0===xo?void 0:xo.every(o=>null===o||void 0===o?void 0:o.soldOut);if(bt){if(!D){var Yo;if(k({type:p.A.SET_NOTIFY_NO_INVENTORY,payload:!0}),null!==(Yo=et)&&void 0!==Yo&&Yo.chainId)try{var Mo;const t=await(0,r.IB)(null===(Mo=et)||void 0===Mo?void 0:Mo.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?(k({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}))):k({type:p.A.SET_NEARBY_HOTELS,payload:[]})}catch(lt){console.error("Failed to fetch nearby hotels:",lt),k({type:p.A.SET_NEARBY_HOTELS,payload:[]})}return k({type:p.A.FETCHING,payload:!1}),(0,v.fireGtmEvent)("no_rooms_available",P(et,o,"user_selected_dates")),R}if(h)return k({type:p.A.SET_NOTIFY_NO_INVENTORY,payload:!0}),k({type:p.A.FETCHING,payload:!1}),(0,v.fireGtmEvent)("no_rooms_available",P(et,o,"after_next_available_search")),R;try{var Ro,Bo,Fo;const a=(null===(Ro=et)||void 0===Ro?void 0:Ro.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===(Bo=et)||void 0===Bo?void 0:Bo.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===(Fo=f.data)||void 0===Fo?void 0:Fo.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(et,o,"auto_redirected_to_next_available",{redirected_check_in_date:r,redirected_check_out_date:c})),k(b((0,l.A)((0,l.A)({},o),{},{checkInDate:r,checkOutDate:c}),t,e,i,d,!0))}var Ho;if(null!==(Ho=et)&&void 0!==Ho&&Ho.chainId)try{var Go;const t=await(0,r.IB)(null===(Go=et)||void 0===Go?void 0:Go.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?(k({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}))):k({type:p.A.SET_NEARBY_HOTELS,payload:[]})}catch(it){console.error("Failed to fetch nearby hotels:",it),k({type:p.A.SET_NEARBY_HOTELS,payload:[]})}k({type:p.A.SET_NOTIFY_NO_INVENTORY,payload:!0}),k({type:p.A.FETCHING,payload:!1}),(0,v.fireGtmEvent)("no_rooms_available",P(et,o,"no_consecutive_dates",{min_booking_nights:a,dates_found:f.data.length}))}else{var Lo;if(console.log("\u274c No available dates found in API response"),null!==(Lo=et)&&void 0!==Lo&&Lo.chainId)try{var jo;const t=await(0,r.IB)(null===(jo=et)||void 0===jo?void 0:jo.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?(k({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}))):k({type:p.A.SET_NEARBY_HOTELS,payload:[]})}catch(it){console.error("Failed to fetch nearby hotels:",it),k({type:p.A.SET_NEARBY_HOTELS,payload:[]})}k({type:p.A.SET_NOTIFY_NO_INVENTORY,payload:!0}),k({type:p.A.FETCHING,payload:!1}),(0,v.fireGtmEvent)("no_rooms_available",P(et,o,"no_dates_in_month"))}}catch(lt){var Uo;if(null!==(Uo=et)&&void 0!==Uo&&Uo.chainId)try{var Vo;const t=await(0,r.IB)(null===(Vo=et)||void 0===Vo?void 0:Vo.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?(k({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}))):k({type:p.A.SET_NEARBY_HOTELS,payload:[]})}catch(it){console.error("Failed to fetch nearby hotels:",it),k({type:p.A.SET_NEARBY_HOTELS,payload:[]})}k({type:p.A.SET_NOTIFY_NO_INVENTORY,payload:!0}),k({type:p.A.FETCHING,payload:!1}),(0,v.fireGtmEvent)("no_rooms_available",P(et,o,"api_error",{error:(null===lt||void 0===lt?void 0:lt.message)||null}))}}else k({type:p.A.SET_NOTIFY_NO_INVENTORY,payload:!1}),k({type:p.A.SET_NEARBY_HOTELS,payload:[]}),h&&null!==o&&void 0!==o&&o.checkInDate&&null!==o&&void 0!==o&&o.checkOutDate&&k({type:p.A.SET_DATE,payload:{startDate:n()(o.checkInDate,"YYYY/MM/DD"),endDate:n()(o.checkOutDate,"YYYY/MM/DD")}});if(1===(null===(go=et)||void 0===go||null===(Ao=go.HotelType)||void 0===Ao?void 0:Ao.id)&&1===(null===(yo=F)||void 0===yo?void 0:yo.length)&&(null===(Io=F[0])||void 0===Io?void 0:Io.availableRooms)>0&&(null===(Do=E().hotelInfo.selectedRatePlans)||void 0===Do||!Do.length)){const t=F[0],e=null!==t&&void 0!==t&&t.ratePlans?Object.keys(t.ratePlans):[];if(console.log({ratePlanKeys:e}),1===e.length){var zo,qo,Wo,Qo,Ko,Zo;const i=e[0],n=t.ratePlans[i];if(null===t||void 0===t||null===(zo=t.pricing)||void 0===zo||!zo.find(o=>o.ratePlanCode===i))return;const d=parseInt(null!==(qo=null!==(Wo=null===o||void 0===o?void 0:o.adultCount)&&void 0!==Wo?Wo:null===o||void 0===o?void 0:o.totalAdult)&&void 0!==qo?qo:2),a=parseInt(null!==(Qo=null!==(Ko=null!==(Zo=null===o||void 0===o?void 0:o.childCount)&&void 0!==Zo?Zo:null===o||void 0===o?void 0:o.totalChild)&&void 0!==Ko?Ko:null===o||void 0===o?void 0:o.totalChildren)&&void 0!==Qo?Qo: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})};k(S(a,{},d,()=>{}))})}}}}else if(400===(null===(O=R)||void 0===O?void 0:O.status)&&null!==(N=R)&&void 0!==N&&null!==(x=N.message)&&void 0!==x&&x.includes("date"))if(sessionStorage.getItem("dateRedirectAttempted"))sessionStorage.removeItem("dateRedirectAttempted"),u.A.error("These dates are no longer available. Please choose new dates.");else{var Jo,$o,Xo,ot,tt;sessionStorage.setItem("dateRedirectAttempted","1");const t=null===(Jo=R)||void 0===Jo||null===($o=Jo.data)||void 0===$o?void 0:$o.timezone,e=null!==(Xo=null===o||void 0===o?void 0:o.id)&&void 0!==Xo?Xo:null===(ot=R)||void 0===ot||null===(tt=ot.data)||void 0===tt?void 0:tt.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(k({type:p.A.FETCHING,payload:!1}),200===(null===(Y=R)||void 0===Y?void 0:Y.status)){var et;let o=localStorage.getItem("uuid")||"";!(null!==(et=o)&&void 0!==et&&et.length)>0&&(o=a()(),localStorage.setItem("uuid",o)),C()}return R}},T=(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"),sessionStorage.removeItem("isSterlingMemberVerified"),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,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||(!!(0,m.sO)(t)||(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 b={},T=1;if((null===(v=i)||void 0===v||null===(s=v.data)||void 0===s?void 0:s.length)>0){var C;const{data:o}=i;let t=[...o];var P;if(t=t.filter(o=>"coupon"!==(null===o||void 0===o?void 0:o.type)),t.sort((o,t)=>t.discount-o.discount),b=t[0],"bulk"!==(null===(C=b)||void 0===C?void 0:C.type))T=(null===(P=b)||void 0===P?void 0:P.discount)/100}let S=c.A.get("source")||"Hotelzify_Fallback",w=c.A.get("utmObj")||{utmSource:S},O=0,N=c.A.get("showBanner")||null,x=JSON.parse(localStorage.getItem("visited"))||[],Y=c.A.get("isGHC"),M=new URLSearchParams(new URL(window.location.href).search),R=Object.fromEntries(M),B=c.A.get("uuid"),F=c.A.get("locationDetails"),H=c.A.get("lowestRoom")||{},G=c.A.get("checkInDate"),L=c.A.get("checkOutDate");R=(0,l.A)((0,l.A)({},R),{},{shownPrice:null===H||void 0===H||null===(f=H.pricing)||void 0===f||null===(g=f[0])||void 0===g?void 0:g.price,promotionSelected:b,discountPrice:(null===H||void 0===H||null===(A=H.pricing)||void 0===A||null===(y=A[0])||void 0===y?void 0:y.price)-(null===H||void 0===H||null===(I=H.pricing)||void 0===I||null===(D=I[0])||void 0===D?void 0:D.price)*T}),c.A.set("searchParams",R);let j=c.A.get("rooms")||[],U=(0,l.A)({source:S,deviceType:h.RX,locationDetails:F,testId:O,isGHC:Y,isDev:h.Cu,showBanner:N,networkSpeed:(null===(k=window)||void 0===k||null===(E=k.navigator)||void 0===E||null===(_=E.connection)||void 0===_?void 0:_.effectiveType)||"not-set",uuid:B,searchParams:R,checkInDate:G,checkOutDate:L,isAvailable:null===j||void 0===j?void 0:j.some(o=>(null===o||void 0===o?void 0:o.availableRooms)>0),date:n()().format("DD-MM-YYYY hh:mm")},w);x=[...x,(0,l.A)((0,l.A)({},U),{},{hotelId:t})],localStorage.setItem("visited",JSON.stringify(x))}}},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.25c36e8d.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.