bookings.hotelmaya.com.my Open in urlscan Pro
2a02:26f0:3500:1b::1724:a38a  Public Scan

URL: https://bookings.hotelmaya.com.my/js/main-min-eae33caeeb.js
Submission Tags: falconsandbox
Submission: On June 26 via api from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

function applicationError(e,a,t,o,r){return{restrict:"E",template:'<div class="GSplash-wrapper" ng-class="{\'MaxWidthLogo\': fullWidthLogoEnabled}"><div id="overlay" class="GSplash-wrapper-content" ng-show="applicationErrorDisplay"><div class="gsplash-modal-body" style="padding:40px 25px 25px; font-size: 16px;text-align: center;"><span class="gsplash-heading" id="ideal-payment-cancel-modal-title" tabindex="0">{{translate.global_unknownerror_ErrorMgs}}</span><div class="footer row" style="margin-top:20px;"><div><button tabindex="0" class="btn btn-primary btn-primary-cta" type="button"ng-click="clickContinueApplication()">{{translate.global_continue_ContinueUpperLbl}}</button></div></div></div></div><div id="fade" ng-show="applicationErrorDisplay"></div></div>',link:function(n){var i=!0;e.$on("UNKNOWN_APPLICATION_ERROR",function(e,a){!n.applicationErrorDisplay&&i&&(r.eventTrack("Be4ApplicationException",{category:"ApplicationError",label:a.eventLabel}),n.applicationErrorDisplay=!0,n.applicationReset=!!a.applicationReset)}),n.clickContinueApplication=function(){if(n.applicationReset){i=!1,n.applicationErrorDisplay=!1,e.startTime=Date.now(),e.showSpinner=!0,t.destroyAll(),o.sessionStorage.clear();var r=o.location.origin+o.location.pathname;o.location.href=r}else n.applicationErrorDisplay=!1,a.go(a.current,{},{reload:!0})}}}}function accessibilityService(e,a,t,o,r){function n(){m=[];var a=e.findIndex(g,function(e){return e.counter===d});if(-1!=a){var t=document.getElementById(g[a].foregroundParentElement),r=document.querySelectorAll("[tabindex]");e.forEach(r,function(e){"-2"!=angular.copy(e.getAttribute("tabindex"))&&t&&(t.contains(e)?(e.setAttribute("tabindex","0"),m.push(e)):e.setAttribute("tabindex","-1"))}),setTimeout(function(){var e=document.getElementById(g[a].foregroundFocusElement);e&&(e.focus(),e.click())},50),o.trap(t),d++}}function i(){m=[];var a=e.findIndex(g,function(e){return e.counter===d}),t=a>0?a-1:a;if(-1!=t){var r=document.querySelectorAll("[tabindex]"),n=document.getElementById(g[t].foregroundParentElement);o.untrap(),e.forEach(r,function(e){"-2"!=angular.copy(e.getAttribute("tabindex"))&&n&&(0===d?e.setAttribute("tabindex","0"):n.contains(e)?(e.setAttribute("tabindex","0"),m.push(e)):e.setAttribute("tabindex","-1"))}),setTimeout(function(){if(g[a]){var t=document.getElementById(g[a].backgroundFocusElement);t&&t.focus()}g=e.without(g,g[a]),0===d&&(g=[])})}}function s(){m=[],g=[];var a=document.querySelectorAll("[tabindex]");e.forEach(a,function(e){"-2"!=angular.copy(e.getAttribute("tabindex"))&&e.setAttribute("tabindex","0")})}function l(a,t,o,i,s){if(r.hideTrustBadge(),-1==e.findIndex(g,function(e){return e.backgroundFocusElement==a&&e.foregroundParentElement==t&&e.foregroundFocusElement==o})){i&&(g=[],d=0);var l={backgroundFocusElement:a,foregroundParentElement:t,foregroundFocusElement:o,counter:d,isMagicModal:i,closeFunctionHandler:s,arguments:arguments};g.push(l),n()}}function c(){r.showTrustBadge(),d<=0?s():(d--,i())}var d=0,g=[],m=[],u=!0;return/MSIE 10/i.test(navigator.userAgent)?a.isIEEdge=!0:/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)?a.isIEEdge=!0:/Edge\/\d./i.test(navigator.userAgent)?a.isIEEdge=!0:a.isIEEdge=!1,document.addEventListener("keydown",function(a){if(27===a.which&&d>0&&void 0!=g[d-1].closeFunctionHandler&&t(function(){var e=Array.prototype.slice.call(g[d-1].arguments,5);g[d-1].closeFunctionHandler.apply(null,e)},0),9===a.which){u=!0;var o=document.getElementsByClassName("add-outline");e.forEach(o,function(e){e.classList.remove("add-outline")})}if(0!=d){for(var r=m.length-1,n=0;n<m.length;n++)m[n].disabled&&--r;9===a.which&&a.shiftKey?a.target==m[0]&&(a.preventDefault(),m[r].focus()):9===a.which&&a.target==m[r]&&(a.preventDefault(),m[0].focus())}},!0),document.addEventListener("mousedown",function(a){u=!1;var t=document.getElementsByClassName("add-outline");e.forEach(t,function(e){e.classList.remove("add-outline")})},!0),document.addEventListener("focus",function(){setTimeout(function(){var a=document.getElementsByClassName("add-outline");if(e.forEach(a,function(e){e.classList.remove("add-outline")}),u){var t=document.querySelectorAll(":focus");e.forEach(t,function(e){e.classList.add("add-outline")})}},0)},!0),{onModalOpen:l,onModalClose:c}}function accessibilityTrapFocus(){function e(a){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=a.previousSibling;return o?(t.push(o),e(o,t)):t}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=e.nextSibling;return o?(t.push(o),a(o,t)):t}function t(t){return e(t).concat(a(t)).filter(m)}function o(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=e.parentNode;return t?(a.push(t),o(t,a)):a}function r(e){return o(e).filter(g)}function n(e){return r(e).map(function(e){return t(e)}).reduce(u,[])}function i(e,a){return{el:e,cleanValue:e.getAttribute("aria-hidden"),dirtyValue:a}}function s(e){e.el.setAttribute("aria-hidden",e.dirtyValue)}function l(e){e.cleanValue?e.el.setAttribute("aria-hidden",e.cleanValue):e.el.removeAttribute("aria-hidden")}function c(){if(y){v.forEach(function(e){return l(e)}),v=[],p&&p.setAttribute("role","main");var e=document.createEvent("Event");e.initEvent("screenreaderUntrap",!1,!0),y.dispatchEvent(e),y=null}}function d(e){c(),y=e,(p=document.querySelector('main, [role="main"]'))&&p.setAttribute("role","presentation");var a=r(y),o=t(y),l=n(y);v=[i(y,"false")].concat(a.map(function(e){return i(e,"false")})).concat(o.map(function(e){return i(e,"true")})).concat(l.map(function(e){return i(e,"true")})),v.forEach(function(e){return s(e)});var d=document.createEvent("Event");d.initEvent("screenreaderTrap",!1,!0),y.dispatchEvent(d)}var g=function(e){return 1===e.nodeType&&"body"!==e.tagName.toLowerCase()&&"html"!==e.tagName.toLowerCase()},m=function(e){return 1===e.nodeType&&"script"!==e.tagName.toLowerCase()},u=function(e,a){return e.concat(a)},p=void 0,y=void 0,v=void 0;return{trap:d,untrap:c}}function AccommodationController(e,a,t,o,r,n,i,s,l,c,d,g,m,u,p,y,v,h,R,f,C,P,S,A,I,b,D,T,O,E,M){function k(e){if(e.promotionId){var a=v.getPromotionsList(),t=S.findIndex(a,function(a){return a.promotionId==e.promotionId});-1!=t&&f.eventTrack("BookedPromo",{category:"UserNavigation",label:a[t].promoName})}}function N(){if(n.translate.page_accommodations_lblPackages.length>10&&"Web4_Mobile"==v.getMainReservation().posSource.companyName.companyShortName){var e=document.getElementById("packageButton");e.style.flex="1 100%",e.style["-webkit-flex"]="1 100%";var a=document.getElementById("roomButton");a.style.flex="1 100%",a.style["-webkit-flex"]="1 100%"}}function L(e,a){if(1==e.allSelected){l.debug(JSON.stringify(a)+"currentServices"),l.debug(JSON.stringify(e)+"currentService");var t,o,r,i,s,c={};if(e.adult>0&&(t=angular.copy(e.adult),c.adults=t),e.children>0&&(o=angular.copy(e.children),c.children=o),e.room>0&&(i=angular.copy(e.room),c.room=i),void 0==e.serviceDate||"PER_ROOM"==a.servicePricingType&&"PER_PERSON"==a.servicePricingType||(s="PER_RESERVATION"==a.servicePricingType?angular.copy(e.date):angular.copy(e.serviceDate),"PER_PERSON"!=a.servicePricingType&&"PER_ROOM"!=a.servicePricingType&&(c.date=s)),void 0!=e.selectOption&&(r=angular.copy(e.selectOption.serviceOptionId),c.selectOption=r),void 0!=v.getMainReservationArray()){for(var d,g=0;g<v.getMainReservationArray().length;g++)if(v.getMainReservationArray()[g].id==v.getMainReservation().id){d=g,d++;break}n.gmsId=d}f.eventTrack("serviceOptions",{category:"UserNavigation",label:c}),n.gmsId=void 0}}function G(e){g.getUxConfiguration().interactiveMessagesEnabled&&(m.clear(),m.pop({type:"info",title:"",body:e,timeout:3e3}))}function F(){Ie={},n.MRB&&(Pe=v.getMainReservation());var e=Pe.resGlobalInfo.guestCounts,a=Pe.resGlobalInfo.guestCounts.length,t=v.getMainReservation(),o=v.getLanguage();l.debug(o+"Lang in Acc buildOptions"),void 0!=o&&(Ie.languageCode=o),($=O.getIncludeMemberRate())&&(Ie.includeMemberRate=$);var r=v.getAllCode();void 0!=r&&Object.keys(r).length>0&&(Ie.allCodes=r),void 0!=Ce&&(Ie.hotelCode=g.getHotelInfo().hotelCode);for(var i=0;i<a;i++)if("10"==e[i].ageQualifyingCode&&void 0!=e[i].count){l.debug(" in if ");var s=parseInt(e[i].count);Ie.adults=s}if(Q)for(var c=0,i=0;i<a;i++)"8"==e[i].ageQualifyingCode&&(c+=parseInt(e[i].count)),Ie.children=c;else for(var m=0,i=0;i<a;i++)"8"==e[i].ageQualifyingCode&&void 0!==e[i].count&&(m+=parseInt(e[i].count),Ie.children=m);for(var i=0;i<a;i++)if("7"==e[i].ageQualifyingCode&&void 0!=e[i].count){var u=parseInt(e[i].count);Ie.infant=u}for(var i=0;i<a;i++)if("7"==e[i].ageQualifyingCode&&void 0===e[i].count){var u=parseInt(Ae.defaultInfants);Ie.infant=u}if(void 0!=Pe.resGlobalInfo.timeSpan.start){var p=Pe.resGlobalInfo.timeSpan.start;Ie.dateIn=p}if(t.posSource&&t.posSource.companyName&&void 0!=t.posSource.companyName.code&&(Ie.bookerIdentifier=t.posSource.companyName.code),t.posSource&&t.posSource.companyName&&void 0!=t.posSource.companyName.companyShortName&&(Ie.partnerIdentifier=t.posSource.companyName.companyShortName),void 0!=Pe.resGlobalInfo.timeSpan.end){var y=Pe.resGlobalInfo.timeSpan.end;Ie.dateOut=y}if(Q||1==n.MRB){Ie.childrenAges=void 0;for(var f=t.resGlobalInfo.guestCounts,C=[],i=0;i<f.length;i++)if("8"==f[i].ageQualifyingCode&&f[i].count)for(var P=0;P<f[i].count;P++)void 0!=f[i].age&&(C.push(f[i].age.toString()),Ie.childrenAges=C.join(","))}else{var f=t.resGlobalInfo.guestCounts,C=[];if(void 0!=Se.ageList&&0!=Se.ageList.length){Ie.childrenAges=void 0;for(var i=0;i<Se.ageList.length;i++){if(i<Se.ageList.length-1)var S=parseInt(Se.ageList[i].id)+",";else S=parseInt(Se.ageList[i].id);void 0!=Ie.childrenAges?Ie.childrenAges=Ie.childrenAges+S:Ie.childrenAges=S}}else if(void 0!=f){Ie.childrenAges=void 0;for(var i=0;i<f.length;i++)if("8"==f[i].ageQualifyingCode&&f[i].count)for(var P=0;P<f[i].count;P++)void 0!=f[i].age&&(C.push(f[i].age.toString()),Ie.childrenAges=C.join(","))}}if(Q){var I=Pe.roomStays[0].roomRates,b=0;angular.forEach(I,function(e){b+=parseInt(e.numberOfUnits)}),Ie.rooms=b}else if(void 0!=Pe.resGlobalInfo.rooms&&0!=Pe.resGlobalInfo.rooms){var D=parseInt(Pe.resGlobalInfo.rooms);Ie.rooms=D}else{var I=Pe.roomStays[0].roomRates,b=0;angular.forEach(I,function(e){b+=parseInt(e.numberOfUnits)}),Ie.rooms=b}var T=v.getConfirmationCode();void 0!=T&&(Ie.uniqueId=T);var t=v.getMainReservation();if(void 0!=r&&Object.keys(r).length>0){var E=v.getCodeTypes();l.debug(JSON.stringify(v.getMainReservation())+"codetype"),l.debug(JSON.stringify(E)+"  reservation Code type in Acco");for(var i=0;i<E.length;i++)if("group"==E[i].toLowerCase()){Ie.ratePlanType="Group",Ie.groupCode=v.getCodeValue(E[i]),l.debug(Ie.groupCode+"options[groupCode]"),void 0==R.stepsById.accommodations.group&&(R.stepsById.accommodations.group=[]);var M={};M.codeType=E[i].codeType,M.id=E[i].id,void 0!=v.getGroup()&&(M.name=v.getGroup().groupName),R.stepsById.accommodations.group.push(M),R.stepsById.accommodations.placeholder=M.name}else Ie.ratePlanType=void 0}else{l.debug(JSON.stringify(t)+"MainReservation new"),Ie.allCodes=t.posSource.requestorIds;var _=t.posSource.requestorIds;l.debug(t.posSource.requestorIds+"MainReservation.posSource.requestorIds");for(var P=0;P<_.length;P++){if("group"==_[P].codeType){Ie.ratePlanType="Group",Ie.groupCode=_[P].id,n.accommodations=!0,void 0==R.stepsById.accommodations.group&&(R.stepsById.accommodations.group=[]);var M={};M.codeType=_[P].codeType,M.id=_[P].id,void 0!=v.getGroup()&&(M.name=v.getGroup().groupName),R.stepsById.accommodations.group.push(M),R.stepsById.accommodations.placeholder=M.name}"travelagent"==_[P].codeType&&(Ie.taCode=_[P].id),"discount"==_[P].codeType&&(Ie.Discount=_[P].id),"corporate"==_[P].codeType&&(Ie.Corporate=_[P].id)}void 0==t.roomStays[0].discountCode&&(Ie.Discount=void 0),void 0==Ie.Discount&&(Ie.Discount=t.roomStays[0].discountCode)}var k=v.getCurrency()||v.getCurrencyDetails()&&v.getCurrencyDetails().currencyCode;void 0!=k&&(Ie.currencyCode=k),l.debug(JSON.stringify(v.getReservation())+"reservationService.getReservation() in buildOption"),Y&&d.popUpOpenFromSignBookBtn&&d.selectedRoomBeforeSignIn&&(h.checkGmsLogin()||A.getIsLoyaltyUserLogIn())?(Ie.ratePlanCode=d.selectedRoomBeforeSignIn.ratePlanCode,void 0!=R.stepsById.accommodations.package&&(Ie.ratePlanType="package")):void 0!=v.getReservation().roomStays&&void 0!=v.getReservation().roomStays[0].ratePlans&&void 0!=v.getReservation().roomStays[0].ratePlans[0]?("Group"!=v.getReservation().roomStays[0].ratePlans[0].ratePlanType&&void 0!=v.getReservation().roomStays[0].ratePlans[0].ratePlanCode?Ie.ratePlanCode=v.getReservation().roomStays[0].ratePlans[0].ratePlanCode:(Ie.ratePlanCode=void 0,Ie.ratePlanType=void 0),void 0!=Ie.ratePlanCode&&void 0!=v.getReservation().roomStays[0].ratePlans[0].ratePlanType?Ie.ratePlanType=v.getReservation().roomStays[0].ratePlans[0].ratePlanType:Ie.ratePlanType=void 0):void 0==R.stepsById.accommodations.package&&"package"==Ie.ratePlanType?(Ie.ratePlanType=void 0,Ie.ratePlanCode=void 0):void 0!=R.stepsById.accommodations.package&&(Ie.ratePlanType="package",Ie.ratePlanCode=R.stepsById.accommodations.package[0].packageCode),l.debug(JSON.stringify(R.stepsById.accommodations.package)+"navDataFactory.stepsById.accommodations.package"),l.debug(JSON.stringify(Ie)+"Options"),l.debug(Ie+"BuildOptionsinaccomo")}function B(){var e=q&&q.chainInfo&&q.chainInfo.length>0?q.chainInfo[0]:"",a=E.getAudienceEvaluatorCriteria();c.callAudienceEvaluator(q.hotelCode,e,a).then(function(e){E.setAudienceLists(e.data),n.$broadcast("RECALL_MERCHANDISING_API"),d.recallAPI(),Te()},function(e){console.log(e),d.recallAPI()})}function x(){var e=q&&q.chainInfo&&q.chainInfo.length>0?q.chainInfo[0]:"",a=angular.copy(r.loyaltyProfileData);a.xAuthToken&&a.profileMemberID?c.getLoyaltyBookedResDetails(q.hotelCode,e,a.xAuthToken,a.profileMemberID).then(function(e){E.setReservationHistoryObject(e.data),B()},function(e){console.log(e),B()}):B()}function w(){var e,a=v.getMainReservation();if(n.MRB){e=v.getMainReservationArray();for(var t=0;t<e.length;t++)if(void 0!=e[t]&&void 0!=e[t].roomStays&&e[t].roomStays.length>0&&void 0!=e[t].roomStays[0].roomRates&&e[t].roomStays[0].roomRates.length>0&&void 0!=e[t].roomStays[0].roomRates[0].roomTypeCode&&void 0!=e[t].roomStays[0].ratePlans&&e[t].roomStays[0].ratePlans.length>0&&"Group"!=e[t].roomStays[0].ratePlans[0].ratePlanType){a=e[t];break}}1==A.getIsLoyaltyReservationEnabled()&&void 0!=a.roomStays&&a.roomStays.length>0&&void 0!=a.roomStays[0].roomRates&&a.roomStays[0].roomRates.length>0&&void 0!=a.roomStays[0].roomRates[0].roomTypeCode&&void 0!=a.roomStays[0].ratePlans&&a.roomStays[0].ratePlans.length>0&&"Group"!=a.roomStays[0].ratePlans[0].ratePlanType&&(d.continueDeleteRatePlan(),d.continueDeleteRoom(),d.continueDeletePackage(),n.MRB&&(v.revertAllAccommodationsMrb(),R.stepsById.accommodations.placeholderMRB=v.getBookedRoomCount())),d.userLoggedIn=!1,v.setConfig("RES_SELECTION_CHANGE"),d.recallAPI(),se=!0}function U(){var e,a,t=document.getElementsByClassName("HeaderButton Header-selection Header-step")[0];if(void 0!=t&&(e=getComputedStyle(t).backgroundColor),d.showPoliciesTab){var o=document.getElementById("policiesButton");o&&o.focus(),void 0!=e&&void 0!=document.getElementById("policiesButton")&&(document.getElementById("policiesButton").style.borderColor=e,a=getComputedStyle(document.getElementById("policiesButton")).color),void 0!=a&&void 0!=document.getElementById("taxesButton")&&(document.getElementById("taxesButton").style.borderColor=a)}else{var o=document.getElementById("taxesButton");o&&o.focus(),void 0!=e&&void 0!=document.getElementById("taxesButton")&&(document.getElementById("taxesButton").style.borderColor=e,a=getComputedStyle(document.getElementById("taxesButton")).color),void 0!=a&&void 0!=document.getElementById("policiesButton")&&(document.getElementById("policiesButton").style.borderColor=a)}}d.fixedMerchandiseCurrency=v.getFixedMerchandisedCurrency(),d.userInScrolledPosition=!1,p.on("scroll",function(){window.scrollY>0?d.userInScrolledPosition=!0:d.userInScrolledPosition=!1});var H=v.getCurrencyDetails()&&v.getCurrencyDetails().currencyCode;g.getRatePlanMerchandisedCurrencies().indexOf(H)>-1&&(d.removeTopSpaceForMRB=H),d.dpHide=!1,d.status={isopen:!1};var V=!1,$=!1,q=g.getHotelDesc(),Y=g.getMemberRateEnabledGlobalSetting();d.showMemberRateSignInButton=!1,d.showPoliciesTab=!1,d.showTaxesTab=!1,d.userLoggedIn=!1,d.enableExpandedDailyRates=g.getUxConfiguration().reservationAndPaymentConfig.enableExpandedDailyRates,d.popUpOpenFromSignBookBtn=!1,d.tooltipPlacement="right",d.tooltipClassName="inst-multirate-tooltip",d.tooltipFocusAndHover="focus mouseenter",r.innerWidth<=1366&&(d.tooltipPlacement="bottom",d.tooltipClassName="NoClass",d.tooltipFocusAndHover=""),(h.checkGmsLogin()||A.getIsLoyaltyUserLogIn())&&(d.userLoggedIn=!0),d.deleteConfirmationPopup="display-none",g.getUxConfiguration().accomodationsConfig.hideEnhancementScheduling&&(d.removeEnhancementBtnFlag=g.getUxConfiguration().accomodationsConfig.hideEnhancementScheduling),d.isInsuranceEnable=g.getEnableInsurance(),d.keyDownOnAccommodationRatePlanDropDown=function(e){var a,o,r=e.keyCode,i=t("filter")(d.rateAvailPlans,{ratePlanType:"Regular"});if(38==r){for(var s=0;s<i.length;s++)if(d.navFilterData.ratePlanCode.ratePlanCode==i[s].ratePlanCode){a=s;break}if(0==a);else{o=i[a-1].ratePlanCode;for(var s=0;s<d.rateAvailPlans.length&&d.rateAvailPlans[s].ratePlanCode!=o;s++);d.showRescheduleEnhancementsPopupOnRatechange(d.rateAvailPlans[s])}setTimeout(function(){var e=document.getElementById("AccommodationsNav-filter--rates-id");e&&e.setAttribute("aria-hidden",!0);var a=document.getElementById("id-rate-plan-dropdown-id");if(a){var t;t=d.rateAvailPlans[s].available?d.rateAvailPlans[s].ratePlanName+n.translate.page_accommodations_from+d.rateAvailPlans[s].price+n.translate.global_rateplandescript_RateDescriptionTitleLbl:d.rateAvailPlans[s].ratePlanName+"-"+n.translate.page_unavailable_UnavailableLbl+n.translate.global_rateplandescript_RateDescriptionTitleLbl,a.setAttribute("aria-label",t),a.setAttribute("aria-live","assertive"),a.setAttribute("aria-hidden",!1),a.innerHTML="";var o=document.createTextNode(t);a.appendChild(o),setTimeout(function(){a.setAttribute("aria-hidden",!0)},500),setTimeout(function(){var e=document.getElementById("AccommodationsNav-filter--rates-id");e&&e.setAttribute("aria-hidden",!1)},1e3)}}),e.preventDefault()}else if(40==r){for(var s=0;s<i.length;s++)if(d.navFilterData.ratePlanCode.ratePlanCode==i[s].ratePlanCode){a=s;break}if(a==i.length-1);else{o=i[a+1].ratePlanCode;for(var s=0;s<d.rateAvailPlans.length&&d.rateAvailPlans[s].ratePlanCode!=o;s++);d.showRescheduleEnhancementsPopupOnRatechange(d.rateAvailPlans[s])}setTimeout(function(){var e=document.getElementById("AccommodationsNav-filter--rates-id");e&&e.setAttribute("aria-hidden",!0);var a=document.getElementById("id-rate-plan-dropdown-id");if(a){var t;t=d.rateAvailPlans[s].available?d.rateAvailPlans[s].ratePlanName+n.translate.page_accommodations_from+d.rateAvailPlans[s].price+n.translate.global_rateplandescript_RateDescriptionTitleLbl:d.rateAvailPlans[s].ratePlanName+"-"+n.translate.page_unavailable_UnavailableLbl+n.translate.global_rateplandescript_RateDescriptionTitleLbl,a.setAttribute("aria-label",t),a.setAttribute("aria-live","assertive"),a.setAttribute("aria-hidden",!1),a.innerHTML="";var o=document.createTextNode(t);a.appendChild(o),setTimeout(function(){a.setAttribute("aria-hidden",!0)},500),setTimeout(function(){var e=document.getElementById("AccommodationsNav-filter--rates-id");e&&e.setAttribute("aria-hidden",!1)},1e3)}}),e.preventDefault()}},d.dateForPE={},d.dateForPE.timeNow=Date.now(),d.combinedHoldFailure=!1,d.refreshEnhancementsWarning="display-none",d.refreshEnhancementsWarningOnRoomSwitch="display-none",d.showMerchandiseDetailsModal="display-none";var j=!1;d.showAllRatePlanPopup=!1,d.multiRateRadio=[],d.pageNumbers=0,d.pageSize=5,d.extendedPageNumber=[],d.temp=1;var z,W=!1;n.guestsroomsClass="is-disabled",n.datesOfStayClass="is-disabled",n.accommodationClass="is-active",n.totalClass="is-disabled",d.serviceListAccordion=[],d.hasDiscountServices=!1,d.merchandisingInfo={},d.addClassToBanner=function(e,a){var t=e;if(a){if(t.currentRate.showPromotionBanner&&u.is("accommodation.room")){if(1==t.currentRate.geoPricingPromotion)return"pricing-geo-pricing-background pricing-geo-pricing-text";if(0==t.currentRate.geoPricingPromotion)return void 0!=t.currentRate.numberOfNightsToPurchase||void 0!=t.currentRate.numberOfNightsFree||void 0!=t.currentRate.numberOfNightsToDiscount||void 0!=t.currentRate.promotionPercentageDiscount&&void 0==t.currentRate.promotionPercentageDiscount?"pricing-free-night-background pricing-free-night-text":"pricing-sale-background pricing-sale-text"}}else if(t.averageRates[0].showPromotionBanner&&u.is("accommodation.room")){if(1==t.averageRates[0].geoPricingPromotion)return"pricing-geo-pricing-background pricing-geo-pricing-text";if(0==t.averageRates[0].geoPricingPromotion)return void 0!=t.averageRates[0].numberOfNightsToPurchase||void 0!=t.averageRates[0].numberOfNightsFree||void 0!=t.averageRates[0].numberOfNightsToDiscount||void 0!=t.averageRates[0].promotionPercentageDiscount&&void 0==t.averageRates[0].promotionPercentageDiscount?"pricing-free-night-background pricing-free-night-text":"pricing-sale-background pricing-sale-text"}},d.selectRoomOnHoldFailure=function(){e.onModalClose(),d.combinedHoldFailure=!1},d.getRoomIndex=function(e){return S.findIndex(n.reservationArray,function(a){return a.id==e})+1},n.MRB&&1==C.getObjectData("combinedHoldError")&&setTimeout(function(){C.setObjectData("combinedHoldError",!1);var e=v.getFailedRoomsId(),a=t("replaceHashMRB")(n.translate.page_roomisnolongeravl_MRTBRoomSelectorMsg,d.getRoomIndex(e[0]),v.getMainReservationArray().length);m.pop({type:"error",title:"",body:a,timeout:3e3})},0),n.switchRoom="display-none",n.MRB&&(v.setConfig("FIRST_TIME_LAND_CALENDAR"),l.debug(JSON.stringify(v.getMainReservationArray())+"reservationService.getMainReservationArray()")),d.$on("EVENT.GMS_OPENED",function(){d.deleteRoom="display-none",d.deleteRatePlan="display-none",d.deletePackage="display-none",d.showServices="display-none",d.addAnotherPackage="display-none",d.addAnotherRoom="display-none",d.showRatePlanDetail=!1,d.showAllRatePlanPopup=!1}),n.$broadcast("EVENT.TRIGGER_GMS"),1==g.getUxConfiguration().accomodationsConfig.callToActionDisplayPreferance&&(d.disableBook=!0),d.roomDetailRate={},0==g.getUxConfiguration().accomodationsConfig.ratePlanPreviewDisplayPreferance?d.roomDetailRate.showIcon=!0:1==g.getUxConfiguration().accomodationsConfig.ratePlanPreviewDisplayPreferance?d.roomDetailRate.ShowRatePlanDescription=!0:2==g.getUxConfiguration().accomodationsConfig.ratePlanPreviewDisplayPreferance?d.roomDetailRate.ShowGuaranteePolicy=!0:3==g.getUxConfiguration().accomodationsConfig.ratePlanPreviewDisplayPreferance&&(d.roomDetailRate.ShowCancellationPolicy=!0),d.checkElement=function(){return null!=document.getElementById("packageButton")?(N(),void(null==document.getElementById("roomButton")&&(d.checkBox={selected:!0}))):void d.checkElement()},d.autoCloseRatePlanDropdown="always",d.$watch("showServices",function(){"display-block"==d.showServices?v.setConfig("enhancementInAccommodation"):"display-none"==d.showServices&&v.deleteConfig("enhancementInAccommodation")}),n.displayPromo="block",d.crmSettings=g.getUxConfiguration().crmSettings,n.callManageUrlCalender=!1,d.displayWidget=!1,0==g.getUxConfiguration().enableTravelAgencyCodes&&0==g.getUxConfiguration().enablePromotionalCodes&&0==g.getUxConfiguration().enableDiscountCode&&0==g.getUxConfiguration().enableGroupCode&&(d.displayWidget=!0),n.groupExist=!1,void 0!=v.getMainReservation().roomStays&&v.getMainReservation().roomStays.length>0&&void 0!=v.getMainReservation().roomStays[0].ratePlans&&v.getMainReservation().roomStays[0].ratePlans.length>0&&void 0!=v.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode&&"Group"==v.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&void 0!=v.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode&&(n.groupExist=!0),R.navToggle.accommodationSelected=!0,d.addAnotherRoom="display-none",d.deleteRoom="display-none",d.deleteRatePlan="display-none",d.addAnotherPackage="display-none",d.deletePackage="display-none",d.specialCodeEnabled=g.getUxConfiguration(),d.priceSlide={},R.stepsById.accommodations.group=[],n.startTime=Date.now(),d.showRatePlanDetail=!1,n.totalRatePlanIconHide=!1;var K=!1;n.bookedError=!1;var J=function(){1==n.bookedError&&m.clear(),n.bookedError=!1};d.isUpgradedroom=!1;var Q=v.canModifyReservation();d.isModifyResforPkgBtn=v.canModifyReservation(),document.body.addEventListener("click",J,!0),m.clear(),!1===g.getHotelDesc().uxConfiguration.accomodationsConfig.enableImageTags?d.enableImageTags=!1:d.enableImageTags=!0,!0===g.getHotelDesc().uxConfiguration.accomodationsConfig.enableCarouselAutoScroll?d.myInterval=2500:d.myInterval=0;var X=r.keyForVideo,Z=r.accountForVideo,ee=M.isGoogleAnalyticsAllowed();r.addEventListener("sp_consent_change",function(){ee=M.isGoogleAnalyticsAllowed()}),d.trustSrc=function(e,a){0!=d.myInterval&&(d.myInterval=0);var t;return 1==g.getHotelDesc().uxConfiguration.accomodationsConfig.enableVideoAutoPlay?(void 0!=a.sortOrder&&0!=a.sortOrder?t=a.video+"?key="+X+"&account="+Z+"&autoplay=false&tracking="+ee+"#pause":0==a.sortOrder&&(t=a.video+"?key="+X+"&account="+Z+"&autoplay=true&tracking="+ee+"#pause"),1!=e[0].active&&(0==a.active?t=a.video+"?key="+X+"&account="+Z+"&autoplay=false&tracking="+ee:1==a.active&&(t=a.video+"?key="+X+"&account="+Z+"&autoplay=true&tracking="+ee))):(t=a.video+"?key="+X+"&account="+Z+"&autoplay=false&tracking="+ee,0==a.active&&(t=a.video+"?key="+X+"&account="+Z+"&autoplay=false&tracking="+ee+"#pause")),P.trustAsResourceUrl(t)},d.enableDetailIcons=g.getHotelDesc().uxConfiguration.accomodationsConfig.enableRoomDetailIcons,d.enableAmenityIcons=g.getHotelDesc().uxConfiguration.accomodationsConfig.enableRoomAmenityIcons;var ae=g.getHotelDesc().uxConfiguration.accomodationsConfig.enableSkippingPackageReselection;d.noWrapSlides=!1,d.limit=2;var te,oe,re,ne,ie=!1;d.isMemberRatePriceIsLowest=!1;var se=!0;d.$on(o.LANG_CHANGE,function(){if(d.showServices="display-none",v.getMainReservation()&&v.getMainReservation().roomStays[0].roomRates[0].roomTypeCode||(d.enhancementServices=d.copyOfFormattedServicesData,d.listOfSelectedEnhancements=[]),d.enhancementServices)for(var e=0;e<d.enhancementServices.length;e++)for(var a=0;a<d.enhancementServices[e].eachDayRate.length;a++)for(var o=0;o<d.enhancementServices[e].eachDayRate[a].options.length;o++)d.enhancementServices[e].eachDayRate[a].options[o].filteredAdultRate=t("currencyConversionAndSymbol")(d.enhancementServices[e].eachDayRate[a].options[o].adultRate)}),d.showServices="display-none",d.service={checked:!1},d.goBack=function(a){l.debug(JSON.stringify(a)+"currentServices pre");var t=!1;1==a.tempChecked?a.tempChecked=!0:a.tempChecked=void 0,d.showServices="display-none",e.onModalClose(),d.service.checked=!1;for(var o=0;o<a.eachDayRate.length;o++){if(a.eachDayRate[o].allSelected=a.eachDayRate[o].tempAllSelected,void 0==a.eachDayRate[o].dateIsSelected||0==a.eachDayRate[o].dateIsSelected?(delete a.eachDayRate[o].date,delete a.eachDayRate[o].dropdownDate,delete a.eachDayRate[o].dateColor):(a.eachDayRate[o].date=a.eachDayRate[o].tempDate,a.eachDayRate[o].dateColor="#898989",a.eachDayRate[o].dropdownDate="#eaeaea"),void 0==a.eachDayRate[o].adultIsSelected||0==a.eachDayRate[o].adultIsSelected?(delete a.eachDayRate[o].adult,delete a.eachDayRate[o].dropdownAdult,delete a.eachDayRate[o].adultsColor):(a.eachDayRate[o].adult=a.eachDayRate[o].tempAdult,a.eachDayRate[o].adultsColor="#898989",a.eachDayRate[o].dropdownAdult="#eaeaea"),void 0==a.eachDayRate[o].childrenIsSelected||0==a.eachDayRate[o].childrenIsSelected?(delete a.eachDayRate[o].children,delete a.eachDayRate[o].dropdownChildren,delete a.eachDayRate[o].childrenColor):(a.eachDayRate[o].children=a.eachDayRate[o].tempChildren,a.eachDayRate[o].childrenColor="#898989",a.eachDayRate[o].dropdownChildren="#eaeaea"),void 0==a.eachDayRate[o].roomsIsSelected||0==a.eachDayRate[o].roomsIsSelected?(delete a.eachDayRate[o].room,delete a.eachDayRate[o].dropdownRooms,delete a.eachDayRate[o].roomsColor):void 0!=a.eachDayRate[o].selectOptionIsSelected&&0!=a.eachDayRate[o].selectOptionIsSelected&&(t=!0,a.eachDayRate[o].room=a.eachDayRate[o].tempRooms,a.eachDayRate[o].roomsColor="#898989",a.eachDayRate[o].dropdownRooms="#eaeaea"),1==a.eachDayRate[o].tempIsChecked||void 0==a.eachDayRate[o].tempIsChecked?(a.eachDayRate[o].isChecked=!0,a.hideAgain=!0):0==a.eachDayRate[o].tempIsChecked&&(a.eachDayRate[o].isChecked=!1,a.hideAgain=!1),void 0==a.eachDayRate[o].selectOptionIsSelected||0==a.eachDayRate[o].selectOptionIsSelected){if(a.eachDayRate[o].allSelected=!1,delete a.eachDayRate[o].selectOption,delete a.eachDayRate[o].dropdownOptions,delete a.eachDayRate[o].optionsColor,a.eachDayRate[o].options.length>0&&(a.hideAgain=!1),a.eachDayRate[o].isChecked=!1,"PER_RESERVATION"==a.servicePricingType)for(var r=0,n=0,i=0;i<a.eachDayRate[o].options.length>0;i++){a.eachDayRate[o].options=[];for(var s=0;s<a.serviceOptions.length>0;s++){r=a.serviceOptions[s].dailyRates[0].adultUnitPrice-a.serviceOptions[s].dailyRates[0].adultUnitDiscount;for(var c=0;c<a.serviceOptions[s].dailyRates.length>0;c++)r>a.serviceOptions[s].dailyRates[c].adultUnitPrice-a.serviceOptions[s].dailyRates[c].adultUnitDiscount&&(r=a.serviceOptions[s].dailyRates[c].adultUnitPrice-a.serviceOptions[s].dailyRates[c].adultUnitDiscount,n=c);a.eachDayRate[o].options.push(a.serviceOptions[s].dailyRates[n])}}}else{if("PER_RESERVATION"==a.servicePricingType){if(void 0!=a.eachDayRate[o].tempReservationOptions){a.eachDayRate[o].options=a.eachDayRate[o].tempReservationOptions;for(var i=0;i<a.eachDayRate[o].options.length;i++)if(void 0!=a.eachDayRate[o].tempSelectOption&&a.eachDayRate[o].tempSelectOption.serviceOptionId==a.eachDayRate[o].options[i].serviceOptionId){a.eachDayRate[o].selectOption=a.eachDayRate[o].options[i];break}}}else a.eachDayRate[o].selectOption=a.eachDayRate[o].tempSelectOption;"PER_PERSON"!=a.servicePricingType&&"PER_PERSON_PER_NIGHT"!=a.servicePricingType||(void 0!=a.eachDayRate[o].adult&&0!=a.eachDayRate[o].adult&&(t=!0),void 0!=a.eachDayRate[o].children&&0!=a.eachDayRate[o].children&&(t=!0)),a.eachDayRate[o].optionsColor="#898989",a.eachDayRate[o].dropdownOptions="#eaeaea"}l.debug(JSON.stringify(a)+"currentServices")}"PER_PERSON"!=a.servicePricingType&&"PER_PERSON_PER_NIGHT"!=a.servicePricingType||(1==t?(a.tempChecked=!0,a.checked=!0):(a.tempChecked=!1,a.checked=!1));for(var i=a.eachDayRate.length-1;i>=0;i--)1==a.eachDayRate[i].isAdded&&void 0==a.eachDayRate[i].selectOption&&(a.eachDayRate.splice(i,1),a.addAnotherItemVar=a.addAnotherItemVar-1);if("PER_ROOM"==a.servicePricingType){for(var g=!1,i=0;i<a.eachDayRate.length;i++)a.eachDayRate[i].options.length>0&&(g=!0);0==g&&(a.eachDayRate[0].options=a.eachDayRate[0].tempOptions)}d.enhancementFlag=!1;for(var i=0;i<d.enhancementServices.length;i++)1==d.enhancementServices[i].checked&&(d.enhancementFlag=!0);d.subTotalFinalPrice=0,d.totalPrice=0;for(var i=0;i<d.enhancementServices.length;i++)d.enhancementServices[i].discountRuleId||d.enhancementServices[i].finalPriceDisc>0?void 0!=d.subTotalFinalPrice&&void 0!=d.enhancementServices[i].finalPriceDisc?(d.subTotalFinalPrice=d.subTotalFinalPrice+d.enhancementServices[i].finalPriceDisc,d.totalPrice=d.totalPrice+d.enhancementServices[i].priceDisc):void 0!=d.enhancementServices[i].finalPriceDisc&&(d.subTotalFinalPrice=d.enhancementServices[i].finalPriceDisc,d.totalPrice=d.enhancementServices[i].priceDisc):void 0!=d.subTotalFinalPrice&&void 0!=d.enhancementServices[i].finalPrice?(d.subTotalFinalPrice=d.subTotalFinalPrice+d.enhancementServices[i].finalPrice,
d.totalPrice=d.totalPrice+d.enhancementServices[i].price):void 0!=d.enhancementServices[i].finalPrice&&(d.subTotalFinalPrice=d.enhancementServices[i].finalPrice,d.totalPrice=d.enhancementServices[i].price)},d.done=function(a){if(d.enableUpfrontEnhancementsIsActive&&(d.enableUpfrontEnhancementsIsActive=!1),Q&&!a.isReSave&&(a.isReSave=!0),"PER_ROOM"==a.servicePricingType)for(var t=a.eachDayRate.length-1;t>=0;t--)1==a.eachDayRate[t].isAdded&&void 0==a.eachDayRate[t].selectOption?(a.eachDayRate.splice(t,1),a.addAnotherItemVar=a.addAnotherItemVar-1):void 0==a.eachDayRate[t].isAdded&&void 0==a.eachDayRate[t].selectOption&&a.eachDayRate.splice(t,1);var o=!1;d.showServices="display-none",e.onModalClose();for(var r=[],i=0,s=[],g=[],u=0,p=0,y=[],h="",R=0,f=0,t=0;t<a.eachDayRate.length;t++){1==a.eachDayRate[t].allSelected?a.eachDayRate[t].tempAllSelected=!0:a.eachDayRate[t].tempAllSelected=!1,void 0!=a.eachDayRate[t].date?(a.eachDayRate[t].dateIsSelected=!0,a.eachDayRate[t].tempDate=a.eachDayRate[t].date,a.date=a.eachDayRate[t].date):void 0==a.eachDayRate[t].date&&(a.eachDayRate[t].dateIsSelected=!1,delete a.eachDayRate[t].tempDate),1==a.eachDayRate[t].isChecked?(a.eachDayRate[t].tempIsChecked=!0,a.hideAgain=!1):0==a.eachDayRate[t].isChecked&&(a.eachDayRate[t].tempIsChecked=!1,a.hideAgain=!0),void 0!=a.eachDayRate[t].adult&&0!=a.eachDayRate[t].adult&&void 0!=a.eachDayRate[t].selectOption?(a.eachDayRate[t].adultIsSelected=!0,a.eachDayRate[t].tempAdult=a.eachDayRate[t].adult,r.push(a.eachDayRate[t].adult)):void 0==a.eachDayRate[t].adult?(a.eachDayRate[t].adultIsSelected=!1,delete a.eachDayRate[t].tempAdult):0==a.eachDayRate[t].adult&&0!=a.eachDayRate[t].children&&void 0!=a.eachDayRate[t].children&&void 0!=a.eachDayRate[t].selectOption?(a.eachDayRate[t].adultIsSelected=!0,a.eachDayRate[t].tempAdult=a.eachDayRate[t].adult,r.push(a.eachDayRate[t].adult)):0==a.eachDayRate[t].adult&&void 0==a.eachDayRate[t].children&&void 0!=a.eachDayRate[t].selectOption&&(a.eachDayRate[t].adultIsSelected=!1,delete a.eachDayRate[t].adult,delete a.eachDayRate[t].tempAdult,delete a.eachDayRate[t].selectOption,delete a.eachDayRate[t].dropdownOptions,delete a.eachDayRate[t].optionsColor,delete a.eachDayRate[t].tempSelectOption,a.eachDayRate[t].allSelected=!1,a.eachDayRate[t].selectOptionIsSelected=!1),void 0!=a.eachDayRate[t].children&&0!=a.eachDayRate[t].children&&void 0!=a.eachDayRate[t].selectOption?(a.eachDayRate[t].childrenIsSelected=!0,a.eachDayRate[t].tempChildren=a.eachDayRate[t].children,s.push(a.eachDayRate[t].children)):void 0==a.eachDayRate[t].children?(a.eachDayRate[t].childrenIsSelected=!1,delete a.eachDayRate[t].tempChildren):0==a.eachDayRate[t].children&&0!=a.eachDayRate[t].adult&&void 0!=a.eachDayRate[t].adult&&void 0!=a.eachDayRate[t].selectOption?(a.eachDayRate[t].childrenIsSelected=!0,a.eachDayRate[t].tempChildren=a.eachDayRate[t].children,s.push(a.eachDayRate[t].children)):0==a.eachDayRate[t].children&&void 0==a.eachDayRate[t].adult&&void 0!=a.eachDayRate[t].selectOption?(a.eachDayRate[t].childrenIsSelected=!1,delete a.eachDayRate[t].children,delete a.eachDayRate[t].tempChildren,delete a.eachDayRate[t].selectOption,delete a.eachDayRate[t].dropdownOptions,delete a.eachDayRate[t].optionsColor,delete a.eachDayRate[t].tempSelectOption,a.eachDayRate[t].allSelected=!1,a.eachDayRate[t].selectOptionIsSelected=!1):0==a.eachDayRate[t].children&&0==a.eachDayRate[t].adult&&void 0!=a.eachDayRate[t].selectOption&&(a.eachDayRate[t].adultIsSelected=!1,delete a.eachDayRate[t].adult,delete a.eachDayRate[t].tempAdult,delete a.eachDayRate[t].selectOption,delete a.eachDayRate[t].dropdownOptions,delete a.eachDayRate[t].optionsColor,delete a.eachDayRate[t].tempSelectOption,a.eachDayRate[t].childrenIsSelected=!1,delete a.eachDayRate[t].children,delete a.eachDayRate[t].tempChildren,delete a.eachDayRate[t].selectOption,delete a.eachDayRate[t].dropdownOptions,delete a.eachDayRate[t].optionsColor,delete a.eachDayRate[t].tempSelectOption,a.eachDayRate[t].allSelected=!1,a.eachDayRate[t].selectOptionIsSelected=!1),void 0!=a.eachDayRate[t].room&&void 0!=a.eachDayRate[t].selectOption?(a.eachDayRate[t].roomsIsSelected=!0,a.eachDayRate[t].tempRooms=a.eachDayRate[t].room,g.push(a.eachDayRate[t].room)):void 0==a.eachDayRate[t].room&&(a.eachDayRate[t].roomsIsSelected=!1,delete a.eachDayRate[t].tempRooms),1==a.eachDayRate[t].isChecked?a.eachDayRate[t].tempIsChecked=!0:0==a.eachDayRate[t].isChecked&&(a.eachDayRate[t].tempIsChecked=!1),void 0!=a.eachDayRate[t].selectOption?void 0!=a.eachDayRate[t].date||void 0!=a.eachDayRate[t].adult||void 0!=a.eachDayRate[t].children||void 0!=a.eachDayRate[t].room?(a.eachDayRate[t].selectOptionIsSelected=!0,a.eachDayRate[t].tempSelectOption=a.eachDayRate[t].selectOption,"PER_RESERVATION"==a.servicePricingType&&a.eachDayRate[t].options.length>0&&(a.eachDayRate[t].tempReservationOptions=a.eachDayRate[t].options),"PER_PERSON"==a.servicePricingType||"PER_PERSON_PER_NIGHT"==a.servicePricingType?(void 0!=a.eachDayRate[t].adult&&0!=a.eachDayRate[t].adult&&(o=!0),void 0!=a.eachDayRate[t].children&&0!=a.eachDayRate[t].children&&(o=!0)):o=!0):"PER_ROOM"==a.servicePricingType?void 0==a.eachDayRate[t].room&&(delete a.eachDayRate[t].selectOption,delete a.eachDayRate[t].dropdownOptions,delete a.eachDayRate[t].optionsColor,a.eachDayRate[t].selectOptionIsSelected=!1,delete a.eachDayRate[t].tempSelectOption,delete a.eachDayRate[t].isAdded,1!=a.addAnotherItemVar&&(a.addAnotherItemVar=a.addAnotherItemVar-1,a.eachDayRate[t].options=[])):(delete a.eachDayRate[t].selectOption,delete a.eachDayRate[t].dropdownOptions,delete a.eachDayRate[t].optionsColor,a.eachDayRate[t].selectOptionIsSelected=!1,delete a.eachDayRate[t].tempSelectOption,delete a.eachDayRate[t].isAdded):void 0==a.eachDayRate[t].selectOption&&(a.eachDayRate[t].selectOptionIsSelected=!1,delete a.eachDayRate[t].tempSelectOption);var C=T.getTotalEnhancement(a);u=C.totalPrice,p=C.totalfinalPrice,R=C.packageTotalFinalPrice,f=C.packageTotalFinalPriceDisc,u>0&&(d.enhancementFlag=!0,d.zeroDiscountApplied=C.zeroDiscountApplied),a.adult=Math.max.apply(null,r),a.children=Math.max.apply(null,s),a.rooms=Math.max.apply(null,g),((void 0!=a.eachDayRate[t].adult||void 0!=a.eachDayRate[t].room)&&void 0!=a.eachDayRate[t].selectOption&&"PER_PERSON"!=a.servicePricingType&&"PER_ROOM"!=a.servicePricingType||"PER_RESERVATION"==a.servicePricingType&&void 0!=a.eachDayRate[t].selectOption)&&i++}if(a.days=i,a.price=u,a.finalPrice=p,(a.discountRuleId||d.zeroDiscountApplied||f>0&&R>0)&&(a.priceDisc=R,a.finalPriceDisc=f),1==o){a.tempChecked=!0,a.checked=!0;for(var t=0;t<a.eachDayRate.length;t++)void 0!=a.eachDayRate[t].selectOption&&a.eachDayRate[t].selectOption&&a.eachDayRate[t].selectOption.serviceOptionName&&y.indexOf(a.eachDayRate[t].selectOption.serviceOptionName)<0&&(y.push(a.eachDayRate[t].selectOption.serviceOptionName),h=h.length?h+", "+a.eachDayRate[t].selectOption.serviceOptionName:h+a.eachDayRate[t].selectOption.serviceOptionName);a.selectedServiceOptionNamesStr=h}else a.tempChecked=!1,a.checked=!1;d.subTotalFinalPrice=0,d.totalPrice=0;for(var t=0;t<d.enhancementServices.length;t++)d.enhancementServices[t].discountRuleId||d.enhancementServices[t].finalPriceDisc>0&&d.enhancementServices[t].priceDisc>0?void 0!=d.subTotalFinalPrice&&void 0!=d.enhancementServices[t].finalPriceDisc?(d.subTotalFinalPrice=d.subTotalFinalPrice+d.enhancementServices[t].finalPriceDisc,d.totalPrice=d.totalPrice+d.enhancementServices[t].priceDisc):void 0!=d.enhancementServices[t].finalPriceDisc&&(d.subTotalFinalPrice=d.enhancementServices[t].finalPriceDisc,d.totalPrice=d.enhancementServices[t].priceDisc):void 0!=d.subTotalFinalPrice&&void 0!=d.enhancementServices[t].finalPrice?(d.subTotalFinalPrice=d.subTotalFinalPrice+d.enhancementServices[t].finalPrice,d.totalPrice=d.totalPrice+d.enhancementServices[t].price):void 0!=d.enhancementServices[t].finalPrice&&(d.subTotalFinalPrice=d.enhancementServices[t].finalPrice,d.totalPrice=d.enhancementServices[t].price);if("PER_ROOM"==a.servicePricingType&&1==a.addAnotherItemVar)for(var t=0;t<a.eachDayRate.length;t++)if(1==a.eachDayRate[t].isAdded&&void 0!=a.eachDayRate[t].selectOption){a.eachDayRate[0].options=angular.copy(a.eachDayRate[0].tempOptions);for(var P=0;P<a.eachDayRate[0].options.length;P++)a.eachDayRate[t].selectOption.serviceOptionId==a.eachDayRate[0].options[P].serviceOptionId&&(a.eachDayRate[0].selectOption=a.eachDayRate[0].options[P],a.eachDayRate[0].tempSelectOption=a.eachDayRate[0].selectOption,a.eachDayRate[0].selectOptionIsSelected=!0,a.eachDayRate[0].optionsColor="#898989",a.eachDayRate[0].dropdownOptions="#eaeaea",a.eachDayRate[0].allSelected=!0);delete a.eachDayRate[t].selectOption,delete a.eachDayRate[t].dropdownOptions,delete a.eachDayRate[t].optionsColor,a.eachDayRate[t].selectOptionIsSelected=!1,a.eachDayRate[t].allSelected=!1,delete a.eachDayRate[t].tempSelectOption,delete a.eachDayRate[t].isAdded,a.eachDayRate[t].options=[]}d.enhancementFlag=!1;for(var t=0;t<d.enhancementServices.length;t++)1==d.enhancementServices[t].checked&&(d.enhancementFlag=!0);if(d.isModifyReservation){l.debug(JSON.stringify(d.enhancementServices)+"$scope.enhancementServices in total1");var S=v.getMainReservation();S.roomStays[0].discountCode&&(S.allCodes&&!S.allCodes.discount?S.allCodes.discount=S.roomStays[0].discountCode:S.allCodes||(S.allCodes={},S.allCodes.discount=S.roomStays[0].discountCode));var A=n.navData.guestsrooms.placeholder.split("/")[1];A&&d.currentRoom&&v.setAccommodations(A,d.currentRoom),v.removeExistingEnhancements(),v.modifyMainReservation(d.enhancementServices),l.debug(JSON.stringify(d.enhancementServices)+"$scope.enhancementServices in total2");var I=v.getMainReservation();void 0!=I.allCodes&&I.allCodes.discount&&(I.roomStays[0].discountCode=I.allCodes.discount),l.debug("_reservationService"),l.debug(I),l.debug(I.services),c.modifyHoldReservation(Ce,I,!0).success(function(e){v.handleXssVulnerabilities(e),m.clear(),v.setReservation(e),d.enhancementServices=T.deleteOldPriceArray(d.enhancementServices),d.enhancementServices=T.mergeModifyEnhancements(e.services,d.enhancementServices)}).error(function(e){m.clear(),m.pop({type:"error",title:"",body:"Modify hold reservation error"})})}},d.cancelAddCodeDropdown=function(){n.toggle.intlMenu=!1,n.$broadcast("CancelAddCode"),d.cancelAccommodation()};var le,ce=!1,de=function(){l.debug(JSON.stringify(d.enhancementServices)+"$scope.enhancementServices in modify"),l.debug(JSON.stringify(d.selectedEnhancements)+"$scope.selectedEnhancements in modify"),d.enhancementServices=T.deleteOldPriceArray(d.enhancementServices),d.enhancementServices=T.mergeModifyEnhancements(d.selectedEnhancements,d.enhancementServices);for(var e=0;e<d.enhancementServices.length;e++){for(var a=[],t=0,o=[],r=[],n=0,i=0,s=0,c=0,g=0,m=!1,u=[],p="",y=0;y<d.enhancementServices[e].eachDayRate.length;y++){if("PER_PERSON_PER_NIGHT"==d.enhancementServices[e].servicePricingType&&void 0==d.enhancementServices[e].eachDayRate[y].adult&&d.enhancementServices[e].eachDayRate[y].options.length>0)for(var v=0;v<d.selectedEnhancements.length;v++)if(d.selectedEnhancements[v].serviceTypeId==d.enhancementServices[e].serviceTypeId)for(var h=0;h<d.selectedEnhancements[v].serviceOptions.length;h++)for(var R=0;R<d.selectedEnhancements[v].serviceOptions[h].dailyRates.length;R++){for(var f=0;f<d.enhancementServices[e].eachDayRate[y].options.length;f++)d.enhancementServices[e].eachDayRate[y].options[f].serviceDate==d.selectedEnhancements[v].serviceOptions[h].dailyRates[R].serviceDate&&d.enhancementServices[e].eachDayRate[y].options[f].serviceOptionId==d.selectedEnhancements[v].serviceOptions[h].serviceOptionId&&(d.enhancementServices[e].eachDayRate[y].selectOption=d.enhancementServices[e].eachDayRate[y].options[f],d.enhancementServices[e].eachDayRate[y].tempSelectOption=d.enhancementServices[e].eachDayRate[y].options[f],d.enhancementServices[e].eachDayRate[y].selectOptionIsSelected=!0,d.enhancementServices[e].eachDayRate[y].optionsColor="#898989",d.enhancementServices[e].eachDayRate[y].dropdownOptions="#eaeaea");d.selectedEnhancements[v].serviceOptions[h].dailyRates[R].serviceDate==d.enhancementServices[e].eachDayRate[y].serviceDate&&(void 0!=d.selectedEnhancements[v].serviceOptions[h].dailyRates[R].adultQuantity&&(d.enhancementServices[e].eachDayRate[y].oldTotalAdult>0?d.enhancementServices[e].eachDayRate[y].adult=d.enhancementServices[e].eachDayRate[y].oldTotalAdult:d.enhancementServices[e].eachDayRate[y].adult=d.selectedEnhancements[v].serviceOptions[h].dailyRates[R].adultQuantity,d.enhancementServices[e].eachDayRate[y].tempAdult=angular.copy(d.enhancementServices[e].eachDayRate[y].adult),d.enhancementServices[e].eachDayRate[y].adultIsSelected=!0,d.enhancementServices[e].eachDayRate[y].dropdownAdult="#eaeaea",d.enhancementServices[e].eachDayRate[y].adultsColor="#898989",a.push(d.enhancementServices[e].eachDayRate[y].adult)),void 0!=d.selectedEnhancements[v].serviceOptions[h].dailyRates[R].childQuantity&&(d.enhancementServices[e].eachDayRate[y].oldTotalChild>0?d.enhancementServices[e].eachDayRate[y].children=d.enhancementServices[e].eachDayRate[y].oldTotalChild:d.enhancementServices[e].eachDayRate[y].children=d.selectedEnhancements[v].serviceOptions[h].dailyRates[R].childQuantity,d.enhancementServices[e].eachDayRate[y].tempChildren=angular.copy(d.enhancementServices[e].eachDayRate[y].children),d.enhancementServices[e].eachDayRate[y].childrenIsSelected=!0,d.enhancementServices[e].eachDayRate[y].dropdownChildren="#eaeaea",d.enhancementServices[e].eachDayRate[y].childrenColor="#898989",o.push(d.enhancementServices[e].eachDayRate[y].children)))}if("PER_PERSON"==d.enhancementServices[e].servicePricingType&&void 0==d.enhancementServices[e].eachDayRate[y].adult&&d.enhancementServices[e].eachDayRate[y].options.length>0)for(var v=0;v<d.selectedEnhancements.length;v++)if(d.selectedEnhancements[v].serviceTypeId==d.enhancementServices[e].serviceTypeId)for(var h=0;h<d.selectedEnhancements[v].serviceOptions.length;h++)for(var R=0;R<d.selectedEnhancements[v].serviceOptions[h].dailyRates.length;R++){for(var f=0;f<d.enhancementServices[e].eachDayRate[y].options.length;f++)d.enhancementServices[e].eachDayRate[y].options[f].serviceDate==d.selectedEnhancements[v].serviceOptions[h].dailyRates[R].serviceDate&&d.enhancementServices[e].eachDayRate[y].options[f].serviceOptionId==d.selectedEnhancements[v].serviceOptions[h].serviceOptionId&&(d.enhancementServices[e].eachDayRate[y].selectOption=d.enhancementServices[e].eachDayRate[y].options[f],d.enhancementServices[e].eachDayRate[y].tempSelectOption=d.enhancementServices[e].eachDayRate[y].options[f],d.enhancementServices[e].eachDayRate[y].selectOptionIsSelected=!0,d.enhancementServices[e].eachDayRate[y].optionsColor="#898989",d.enhancementServices[e].eachDayRate[y].dropdownOptions="#eaeaea");void 0!=d.enhancementServices[e].eachDayRate[y].selectOption&&d.selectedEnhancements[v].serviceOptions[h].dailyRates[R].serviceDate==d.enhancementServices[e].eachDayRate[y].selectOption.serviceDate&&(void 0!=d.selectedEnhancements[v].serviceOptions[h].dailyRates[R].adultQuantity&&(d.enhancementServices[e].eachDayRate[y].oldTotalAdult>0?d.enhancementServices[e].eachDayRate[y].adult=d.enhancementServices[e].eachDayRate[y].oldTotalAdult:d.enhancementServices[e].eachDayRate[y].adult=d.selectedEnhancements[v].serviceOptions[h].dailyRates[R].adultQuantity,d.enhancementServices[e].eachDayRate[y].tempAdult=angular.copy(d.enhancementServices[e].eachDayRate[y].adult),d.enhancementServices[e].eachDayRate[y].adultIsSelected=!0,d.enhancementServices[e].eachDayRate[y].dropdownAdult="#eaeaea",d.enhancementServices[e].eachDayRate[y].adultsColor="#898989",a.push(d.enhancementServices[e].eachDayRate[y].adult)),void 0!=d.selectedEnhancements[v].serviceOptions[h].dailyRates[R].childQuantity&&(d.enhancementServices[e].eachDayRate[y].oldTotalChild>0?d.enhancementServices[e].eachDayRate[y].children=d.enhancementServices[e].eachDayRate[y].oldTotalChild:d.enhancementServices[e].eachDayRate[y].children=d.selectedEnhancements[v].serviceOptions[h].dailyRates[R].childQuantity,d.enhancementServices[e].eachDayRate[y].tempChildren=angular.copy(d.enhancementServices[e].eachDayRate[y].children),d.enhancementServices[e].eachDayRate[y].childrenIsSelected=!0,d.enhancementServices[e].eachDayRate[y].dropdownChildren="#eaeaea",d.enhancementServices[e].eachDayRate[y].childrenColor="#898989",o.push(d.enhancementServices[e].eachDayRate[y].children)))}if("PER_ROOM_PER_NIGHT"==d.enhancementServices[e].servicePricingType&&void 0==d.enhancementServices[e].eachDayRate[y].room&&d.enhancementServices[e].eachDayRate[y].options.length>0)for(var v=0;v<d.selectedEnhancements.length;v++)if(d.selectedEnhancements[v].serviceTypeId==d.enhancementServices[e].serviceTypeId)for(var h=0;h<d.selectedEnhancements[v].serviceOptions.length;h++)for(var R=0;R<d.selectedEnhancements[v].serviceOptions[h].dailyRates.length;R++){for(var f=0;f<d.enhancementServices[e].eachDayRate[y].options.length;f++)d.enhancementServices[e].eachDayRate[y].options[f].serviceDate==d.selectedEnhancements[v].serviceOptions[h].dailyRates[R].serviceDate&&d.enhancementServices[e].eachDayRate[y].options[f].serviceOptionId==d.selectedEnhancements[v].serviceOptions[h].serviceOptionId&&(d.enhancementServices[e].eachDayRate[y].selectOption=d.enhancementServices[e].eachDayRate[y].options[f],d.enhancementServices[e].eachDayRate[y].tempSelectOption=d.enhancementServices[e].eachDayRate[y].options[f],d.enhancementServices[e].eachDayRate[y].selectOptionIsSelected=!0,d.enhancementServices[e].eachDayRate[y].optionsColor="#898989",d.enhancementServices[e].eachDayRate[y].dropdownOptions="#eaeaea");d.selectedEnhancements[v].serviceOptions[h].dailyRates[R].serviceDate==d.enhancementServices[e].eachDayRate[y].serviceDate&&void 0!=d.selectedEnhancements[v].serviceOptions[h].dailyRates[R].quantity&&(d.enhancementServices[e].eachDayRate[y].oldTotalRoom>0?d.enhancementServices[e].eachDayRate[y].room=d.enhancementServices[e].eachDayRate[y].oldTotalRoom:d.enhancementServices[e].eachDayRate[y].room=d.selectedEnhancements[v].serviceOptions[h].dailyRates[R].quantity,d.enhancementServices[e].eachDayRate[y].tempRooms=angular.copy(d.enhancementServices[e].eachDayRate[y].room),d.enhancementServices[e].eachDayRate[y].roomsIsSelected=!0,d.enhancementServices[e].eachDayRate[y].dropdownRooms="#eaeaea",d.enhancementServices[e].eachDayRate[y].roomsColor="#898989",r.push(d.enhancementServices[e].eachDayRate[y].room))}if("PER_ROOM"==d.enhancementServices[e].servicePricingType&&void 0==d.enhancementServices[e].eachDayRate[y].room&&d.enhancementServices[e].eachDayRate[y].options.length>0&&void 0==d.enhancementServices[e].eachDayRate[y].selectOption)for(var v=0;v<d.selectedEnhancements.length;v++)if(d.selectedEnhancements[v].serviceTypeId==d.enhancementServices[e].serviceTypeId)for(var C,P=!1,h=0;h<d.selectedEnhancements[v].serviceOptions.length;h++)if(0==P){for(var f=0;f<d.enhancementServices[e].eachDayRate[y].options.length;f++)d.enhancementServices[e].eachDayRate[y].options[f].serviceOptionId==d.selectedEnhancements[v].serviceOptions[h].serviceOptionId&&(d.enhancementServices[e].eachDayRate[y].selectOption=d.enhancementServices[e].eachDayRate[y].options[f],d.enhancementServices[e].eachDayRate[y].tempSelectOption=d.enhancementServices[e].eachDayRate[y].options[f],d.enhancementServices[e].eachDayRate[y].selectOptionIsSelected=!0,d.enhancementServices[e].eachDayRate[y].optionsColor="#898989",d.enhancementServices[e].eachDayRate[y].dropdownOptions="#eaeaea",C=y,P=!0,d.enhancementServices[e].addAnotherItemVar=1);d.selectedEnhancements[v].serviceOptions[h].serviceOptionId==d.enhancementServices[e].eachDayRate[y].selectOption.serviceOptionId&&void 0!=d.selectedEnhancements[v].serviceOptions[h].dailyRates[0].quantity&&(d.enhancementServices[e].eachDayRate[y].selectOption.oldTotalRoom>0?d.enhancementServices[e].eachDayRate[y].room=d.enhancementServices[e].eachDayRate[y].selectOption.oldTotalRoom:d.enhancementServices[e].eachDayRate[y].room=d.selectedEnhancements[v].serviceOptions[h].dailyRates[0].quantity,d.enhancementServices[e].eachDayRate[y].tempRooms=angular.copy(d.enhancementServices[e].eachDayRate[y].room),d.enhancementServices[e].eachDayRate[y].roomsIsSelected=!0,d.enhancementServices[e].eachDayRate[y].dropdownRooms="#eaeaea",d.enhancementServices[e].eachDayRate[y].roomsColor="#898989",r.push(d.enhancementServices[e].eachDayRate[y].room))}else{var C=C+1;if(void 0!=d.enhancementServices[e].eachDayRate[C]){d.enhancementServices[e].eachDayRate[C].options=angular.copy(d.enhancementServices[e].eachDayRate[C-1].options),d.enhancementServices[e].eachDayRate[C].tempOptions=angular.copy(d.enhancementServices[e].eachDayRate[C-1].tempOptions);for(var f=0;f<d.enhancementServices[e].eachDayRate[C].options.length;f++)d.enhancementServices[e].eachDayRate[C].options[f].serviceOptionId==d.selectedEnhancements[v].serviceOptions[h].serviceOptionId&&(d.enhancementServices[e].eachDayRate[C].selectOption=d.enhancementServices[e].eachDayRate[C].options[f],d.enhancementServices[e].eachDayRate[C].tempSelectOption=d.enhancementServices[e].eachDayRate[C].options[f],d.enhancementServices[e].eachDayRate[C].selectOptionIsSelected=!0,d.enhancementServices[e].eachDayRate[C].optionsColor="#898989",d.enhancementServices[e].eachDayRate[C].dropdownOptions="#eaeaea",d.enhancementServices[e].addAnotherItemVar=d.enhancementServices[e].addAnotherItemVar+1);d.selectedEnhancements[v].serviceOptions[h].serviceOptionId==d.enhancementServices[e].eachDayRate[C].selectOption.serviceOptionId&&void 0!=d.selectedEnhancements[v].serviceOptions[h].dailyRates[0].quantity&&(d.enhancementServices[e].eachDayRate[C].selectOption.oldTotalRoom>0?d.enhancementServices[e].eachDayRate[C].room=d.enhancementServices[e].eachDayRate[C].selectOption.oldTotalRoom:d.enhancementServices[e].eachDayRate[C].room=d.selectedEnhancements[v].serviceOptions[h].dailyRates[0].quantity,d.enhancementServices[e].eachDayRate[C].tempRooms=angular.copy(d.enhancementServices[e].eachDayRate[C].room),d.enhancementServices[e].eachDayRate[C].roomsIsSelected=!0,d.enhancementServices[e].eachDayRate[C].dropdownRooms="#eaeaea",d.enhancementServices[e].eachDayRate[C].roomsColor="#898989",r.push(d.enhancementServices[e].eachDayRate[C].room))}else{d.enhancementServices[e].eachDayRate[C]=angular.copy(d.enhancementServices[e].eachDayRate[C-1]),d.enhancementServices[e].eachDayRate[C].options=angular.copy(d.enhancementServices[e].eachDayRate[C-1].options),d.enhancementServices[e].eachDayRate[C].tempOptions=angular.copy(d.enhancementServices[e].eachDayRate[C-1].tempOptions);for(var f=0;f<d.enhancementServices[e].eachDayRate[C].options.length;f++)d.enhancementServices[e].eachDayRate[C].options[f].serviceOptionId==d.selectedEnhancements[v].serviceOptions[h].serviceOptionId&&(d.enhancementServices[e].eachDayRate[C].selectOption=d.enhancementServices[e].eachDayRate[C].options[f],d.enhancementServices[e].eachDayRate[C].tempSelectOption=d.enhancementServices[e].eachDayRate[C].options[f],d.enhancementServices[e].eachDayRate[C].selectOptionIsSelected=!0,d.enhancementServices[e].eachDayRate[C].optionsColor="#898989",d.enhancementServices[e].eachDayRate[C].dropdownOptions="#eaeaea",d.enhancementServices[e].addAnotherItemVar=d.enhancementServices[e].addAnotherItemVar+1);d.selectedEnhancements[v].serviceOptions[h].serviceOptionId==d.enhancementServices[e].eachDayRate[C].selectOption.serviceOptionId&&void 0!=d.selectedEnhancements[v].serviceOptions[h].dailyRates[0].quantity&&(d.enhancementServices[e].eachDayRate[C].selectOption.oldTotalRoom>0?d.enhancementServices[e].eachDayRate[C].room=d.enhancementServices[e].eachDayRate[C].selectOption.oldTotalRoom:d.enhancementServices[e].eachDayRate[C].room=d.selectedEnhancements[v].serviceOptions[h].dailyRates[0].quantity,d.enhancementServices[e].eachDayRate[C].tempRooms=angular.copy(d.enhancementServices[e].eachDayRate[C].room),d.enhancementServices[e].eachDayRate[C].roomsIsSelected=!0,d.enhancementServices[e].eachDayRate[C].dropdownRooms="#eaeaea",d.enhancementServices[e].eachDayRate[C].roomsColor="#898989",r.push(d.enhancementServices[e].eachDayRate[C].room))}}if("PER_RESERVATION"==d.enhancementServices[e].servicePricingType&&void 0!=d.enhancementServices[e].eachDayRate[y].serviceDate&&d.enhancementServices[e].eachDayRate[y].options.length>0&&d.enhancementServices[e].eachDayRate[y].serviceDate.length>0){for(var v=0;v<d.selectedEnhancements.length;v++)if(d.selectedEnhancements[v].serviceTypeId==d.enhancementServices[e].serviceTypeId){d.enhancementServices[e].eachDayRate[y].date=d.selectedEnhancements[v].serviceOptions[0].dailyRates[0].serviceDate,d.enhancementServices[e].eachDayRate[y].tempDate=d.selectedEnhancements[v].serviceOptions[0].dailyRates[0].serviceDate,d.enhancementServices[e].eachDayRate[y].dropdownDate="#eaeaea",d.enhancementServices[e].eachDayRate[y].dateIsSelected=!0,d.enhancementServices[e].eachDayRate[y].dateColor="#898989",d.enhancementServices[e].eachDayRate[y].isChecked=!0,d.enhancementServices[e].eachDayRate[y].tempIsChecked=!0;break}d.enhancementServices[e].eachDayRate[y].options=[];for(var h=0;h<d.enhancementServices[e].serviceOptions.length;h++)for(var S=0;S<d.enhancementServices[e].serviceOptions[h].dailyRates.length;S++)d.enhancementServices[e].eachDayRate[y].date?d.enhancementServices[e].eachDayRate[y].date==d.enhancementServices[e].serviceOptions[h].dailyRates[S].serviceDate&&d.enhancementServices[e].eachDayRate[y].options.push(d.enhancementServices[e].serviceOptions[h].dailyRates[S]):d.enhancementServices[e].eachDayRate[y].serviceDate==d.enhancementServices[e].serviceOptions[h].dailyRates[S].serviceDate&&d.enhancementServices[e].eachDayRate[y].options.push(d.enhancementServices[e].serviceOptions[h].dailyRates[S]);for(var v=0;v<d.selectedEnhancements.length;v++)for(var h=0;h<d.enhancementServices[e].eachDayRate[y].options.length;h++)d.enhancementServices[e].eachDayRate[y].options[h].serviceOptionId==d.selectedEnhancements[v].serviceOptions[0].serviceOptionId&&(d.enhancementServices[e].eachDayRate[y].tempReservationOptions=d.enhancementServices[e].eachDayRate[y].options,d.enhancementServices[e].eachDayRate[y].selectOption=d.enhancementServices[e].eachDayRate[y].options[h],d.enhancementServices[e].eachDayRate[y].tempSelectOption=d.enhancementServices[e].eachDayRate[y].options[h],d.enhancementServices[e].eachDayRate[y].selectOptionIsSelected=!0,d.enhancementServices[e].eachDayRate[y].optionsColor="#898989",d.enhancementServices[e].eachDayRate[y].dropdownOptions="#eaeaea")}"PER_PERSON_PER_NIGHT"!=d.enhancementServices[e].servicePricingType&&"PER_PERSON"!=d.enhancementServices[e].servicePricingType||void 0!=d.enhancementServices[e].eachDayRate[y].adult&&void 0!=d.enhancementServices[e].eachDayRate[y].selectOption&&(d.enhancementServices[e].eachDayRate[y].allSelected=!0,d.enhancementServices[e].eachDayRate[y].tempAllSelected=!0,d.enhancementServices[e].checked=!0,d.enhancementServices[e].tempChecked=!0),"PER_ROOM"!=d.enhancementServices[e].servicePricingType&&"PER_ROOM_PER_NIGHT"!=d.enhancementServices[e].servicePricingType||void 0!=d.enhancementServices[e].eachDayRate[y].room&&void 0!=d.enhancementServices[e].eachDayRate[y].selectOption&&(d.enhancementServices[e].eachDayRate[y].allSelected=!0,d.enhancementServices[e].eachDayRate[y].tempAllSelected=!0,d.enhancementServices[e].checked=!0,d.enhancementServices[e].tempChecked=!0),"PER_RESERVATION"==d.enhancementServices[e].servicePricingType&&void 0!=d.enhancementServices[e].eachDayRate[y].selectOption&&void 0!=d.enhancementServices[e].eachDayRate[y].date&&(d.enhancementServices[e].eachDayRate[y].allSelected=!0,d.enhancementServices[e].eachDayRate[y].tempAllSelected=!0,d.enhancementServices[e].checked=!0,d.enhancementServices[e].tempChecked=!0),d.enhancementServices[e].eachDayRate[y].options.length>0&&s++,s>1&&(d.enhancementServices[e].UseSelection=!0);var A=T.getTotalEnhancement(d.enhancementServices[e]);n=A.totalPrice,i=A.totalfinalPrice,c=A.packageTotalFinalPrice,g=A.packageTotalFinalPriceDisc,n>0&&(d.enhancementFlag=!0,m=A.zeroDiscountApplied),d.enhancementServices[e].adult=Math.max.apply(null,a),d.enhancementServices[e].children=Math.max.apply(null,o),d.enhancementServices[e].rooms=Math.max.apply(null,r),((void 0!=d.enhancementServices[e].eachDayRate[y].adult||void 0!=d.enhancementServices[e].eachDayRate[y].room)&&void 0!=d.enhancementServices[e].eachDayRate[y].selectOption&&"PER_PERSON"!=d.enhancementServices[e].servicePricingType&&"PER_ROOM"!=d.enhancementServices[e].servicePricingType||"PER_RESERVATION"==d.enhancementServices[e].servicePricingType&&void 0!=d.enhancementServices[e].eachDayRate[y].selectOption)&&t++}if("PER_PERSON_PER_NIGHT"==d.enhancementServices[e].servicePricingType){for(var I,y=0;y<d.enhancementServices[e].eachDayRate.length;y++)if(d.enhancementServices[e].eachDayRate[y].options.length>0){I=y;break}if(1==d.enhancementServices[e].eachDayRate[I].allSelected)for(var y=0;y<d.enhancementServices[e].eachDayRate.length;y++)if(d.enhancementServices[e].eachDayRate[I].isChecked=!0,d.enhancementServices[e].eachDayRate[y].options.length>0&&y!=I){if(d.enhancementServices[e].eachDayRate[y].adult!=d.enhancementServices[e].eachDayRate[I].adult||void 0==d.enhancementServices[e].eachDayRate[y].adult){delete d.enhancementServices[e].eachDayRate[I].isChecked;break}if(void 0!=d.enhancementServices[e].eachDayRate[I].children&&(d.enhancementServices[e].eachDayRate[y].children!=d.enhancementServices[e].eachDayRate[I].children||void 0==d.enhancementServices[e].eachDayRate[y].children)){delete d.enhancementServices[e].eachDayRate[I].isChecked;break}if(d.enhancementServices[e].eachDayRate[y].selectOption.serviceOptionId!=d.enhancementServices[e].eachDayRate[I].selectOption.serviceOptionId||void 0==d.enhancementServices[e].eachDayRate[y].selectOption){delete d.enhancementServices[e].eachDayRate[I].isChecked;break}}}if("PER_ROOM_PER_NIGHT"==d.enhancementServices[e].servicePricingType){for(var b,y=0;y<d.enhancementServices[e].eachDayRate.length;y++)if(d.enhancementServices[e].eachDayRate[y].options.length>0){b=y;break}if(1==d.enhancementServices[e].eachDayRate[b].allSelected)for(var y=0;y<d.enhancementServices[e].eachDayRate.length;y++)if(d.enhancementServices[e].eachDayRate[b].isChecked=!0,d.enhancementServices[e].eachDayRate[y].options.length>0&&y!=b){if(d.enhancementServices[e].eachDayRate[y].room!=d.enhancementServices[e].eachDayRate[b].room||void 0==d.enhancementServices[e].eachDayRate[y].room){d.enhancementServices[e].eachDayRate[b].isChecked=!1;break}if(d.enhancementServices[e].eachDayRate[y].selectOption.serviceOptionId!=d.enhancementServices[e].eachDayRate[b].selectOption.serviceOptionId||void 0==d.enhancementServices[e].eachDayRate[y].selectOption){d.enhancementServices[e].eachDayRate[b].isChecked=!1;break}}}if("PER_ROOM"==d.enhancementServices[e].servicePricingType)for(var D=angular.copy(d.enhancementServices[e]),y=0;y<d.enhancementServices[e].eachDayRate.length;y++)for(var S=0;S<D.eachDayRate.length;S++)if(d.enhancementServices[e].eachDayRate[y].options.length>0)for(var O=0;O<d.enhancementServices[e].eachDayRate[y].options.length;O++)void 0!=D.eachDayRate[S].selectOption&&d.enhancementServices[e].eachDayRate[y].options[O].serviceOptionId==D.eachDayRate[S].selectOption.serviceOptionId&&y!=S&&d.enhancementServices[e].eachDayRate[y].options.splice(O,1);d.enhancementServices[e].days=t,d.enhancementServices[e].price=n,d.enhancementServices[e].finalPrice=i,(d.enhancementServices[e].discountRuleId||m||g>0&&c>0)&&(d.enhancementServices[e].priceDisc=c,d.enhancementServices[e].finalPriceDisc=g,d.enhancementServices[e].zeroDiscountApplied=m)
;for(var y=0;y<d.enhancementServices[e].eachDayRate.length;y++)void 0!=d.enhancementServices[e].eachDayRate[y].selectOption&&d.enhancementServices[e].eachDayRate[y].selectOption&&d.enhancementServices[e].eachDayRate[y].selectOption.serviceOptionName&&u.indexOf(d.enhancementServices[e].eachDayRate[y].selectOption.serviceOptionName)<0&&(u.push(d.enhancementServices[e].eachDayRate[y].selectOption.serviceOptionName),p=p.length?p+", "+d.enhancementServices[e].eachDayRate[y].selectOption.serviceOptionName:p+d.enhancementServices[e].eachDayRate[y].selectOption.serviceOptionName);d.enhancementServices[e].selectedServiceOptionNamesStr=p}d.subTotalFinalPrice=0,d.totalPrice=0;for(var y=0;y<d.enhancementServices.length;y++)Q&&!d.enhancementServices[y].discountRuleId&&d.enhancementServices[y].checked&&d.enhancementServices[y].zeroDiscountApplied&&0==d.enhancementServices[y].finalPriceDisc&&d.enhancementServices[y].priceDisc>0?void 0!=d.subTotalFinalPrice&&void 0!=d.enhancementServices[y].finalPriceDisc?(d.subTotalFinalPrice=d.subTotalFinalPrice+d.enhancementServices[y].finalPriceDisc,d.totalPrice=d.totalPrice+d.enhancementServices[y].priceDisc):void 0!=d.enhancementServices[y].finalPriceDisc&&(d.subTotalFinalPrice=d.enhancementServices[y].finalPriceDisc,d.totalPrice=d.enhancementServices[y].priceDisc):d.enhancementServices[y].discountRuleId||d.enhancementServices[y].finalPriceDisc>0&&d.enhancementServices[y].priceDisc>0?void 0!=d.subTotalFinalPrice&&void 0!=d.enhancementServices[y].finalPriceDisc?(d.subTotalFinalPrice=d.subTotalFinalPrice+d.enhancementServices[y].finalPriceDisc,d.totalPrice=d.totalPrice+d.enhancementServices[y].priceDisc):void 0!=d.enhancementServices[y].finalPriceDisc&&(d.subTotalFinalPrice=d.enhancementServices[y].finalPriceDisc,d.totalPrice=d.enhancementServices[y].priceDisc):void 0!=d.subTotalFinalPrice&&void 0!=d.enhancementServices[y].finalPrice?(d.subTotalFinalPrice=d.subTotalFinalPrice+d.enhancementServices[y].finalPrice,d.totalPrice=d.totalPrice+d.enhancementServices[y].price):void 0!=d.enhancementServices[y].finalPrice&&(d.subTotalFinalPrice=d.enhancementServices[y].finalPrice,d.totalPrice=d.enhancementServices[y].price);l.debug(JSON.stringify(d.enhancementServices)+"$scope.enhancementServices")},ge=function(){l.debug(JSON.stringify(d.enhancementServices)+"$scope.enhancementServices in modify");for(var e=!1,a=0;a<d.enhancementServices.length;a++){var t=[],o=0,r=[],i=[],s=0,c=0,g=0,m=0,u=0,p=!1,y=[],v="";e=!1;for(var h=0;h<d.selectedEnhancements.length;h++)d.enhancementServices[a].serviceTypeId===d.selectedEnhancements[h].serviceTypeId&&(e=!0);for(var R=0;R<d.enhancementServices[a].eachDayRate.length;R++)if(!e){for(var f,P=0;P<d.enhancementServices[a].serviceOptions.length;P++){rateOfDay=d.enhancementServices[a].serviceOptions[P].dailyRates[0].adultUnitPrice-d.enhancementServices[a].serviceOptions[P].dailyRates[0].adultUnitDiscount,f=d.enhancementServices[a].serviceOptions[P].dailyRates[0].serviceDate;for(var S=0;S<d.enhancementServices[a].serviceOptions[P].dailyRates.length;S++)rateOfDay>d.enhancementServices[a].serviceOptions[P].dailyRates[S].adultUnitPrice-d.enhancementServices[a].serviceOptions[P].dailyRates[S].adultUnitDiscount&&(rateOfDay=d.enhancementServices[a].serviceOptions[P].dailyRates[S].adultUnitPrice-d.enhancementServices[a].serviceOptions[P].dailyRates[S].adultUnitDiscount,f=d.enhancementServices[a].serviceOptions[P].dailyRates[S].serviceDate)}if(Q&&!d.enhancementServices[a].isReSave&&(d.enhancementServices[a].isReSave=!0),("PER_PERSON_PER_NIGHT"==d.enhancementServices[a].servicePricingType||"PER_PERSON"==d.enhancementServices[a].servicePricingType)&&void 0==d.enhancementServices[a].eachDayRate[R].adult&&d.enhancementServices[a].eachDayRate[R].options.length>0&&d.enhancementServices[a].isAutoCheckout&&d.enhancementServices[a].eachDayRate[R].options.length>0&&(d.enhancementServices[a].eachDayRate[R].options[0].adultUnitDiscount===d.enhancementServices[a].eachDayRate[R].options[0].adultUnitPrice||d.enhancementServices[a].eachDayRate[R].options[0].childUnitDiscount===d.enhancementServices[a].eachDayRate[R].options[0].childUnitPrice)){var A=0;d.enhancementServices[a].maxLimit&&0!=d.enhancementServices[a].maxLimit&&(A=d.enhancementServices[a].maxLimit-d.enhancementServices[a].eachDayRate[R].options[0].adultQuantity),d.enhancementServices[a].eachDayRate[R].options[0].serviceDate&&d.enhancementServices[a].eachDayRate[R].options[0].serviceOptionId&&(d.enhancementServices[a].eachDayRate[R].selectOption=d.enhancementServices[a].eachDayRate[R].options[0],d.enhancementServices[a].eachDayRate[R].tempSelectOption=d.enhancementServices[a].eachDayRate[R].options[0],d.enhancementServices[a].eachDayRate[R].selectOptionIsSelected=!0,d.enhancementServices[a].eachDayRate[R].optionsColor="#898989",d.enhancementServices[a].eachDayRate[R].dropdownOptions="#eaeaea"),void 0!=d.enhancementServices[a].eachDayRate[R].selectOption.adultQuantity&&(d.enhancementServices[a].maxLimit&&0!=d.enhancementServices[a].maxLimit?d.enhancementServices[a].eachDayRate[R].adult=d.enhancementServices[a].maxLimit>d.enhancementServices[a].eachDayRate[R].selectOption.adultQuantity?d.enhancementServices[a].eachDayRate[R].selectOption.adultQuantity:d.enhancementServices[a].maxLimit:d.enhancementServices[a].eachDayRate[R].adult=d.enhancementServices[a].eachDayRate[R].selectOption.adultQuantity,d.enhancementServices[a].eachDayRate[R].tempAdult=angular.copy(d.enhancementServices[a].eachDayRate[R].adult),d.enhancementServices[a].eachDayRate[R].adultIsSelected=!0,d.enhancementServices[a].eachDayRate[R].dropdownAdult="#eaeaea",d.enhancementServices[a].eachDayRate[R].adultsColor="#898989",t.push(d.enhancementServices[a].eachDayRate[R].adult)),void 0!=d.enhancementServices[a].eachDayRate[R].selectOption.childQuantity&&A>=0&&(d.enhancementServices[a].maxLimit&&0!=d.enhancementServices[a].maxLimit?d.enhancementServices[a].eachDayRate[R].children=A>d.enhancementServices[a].eachDayRate[R].selectOption.childQuantity?d.enhancementServices[a].eachDayRate[R].selectOption.childQuantity:A:d.enhancementServices[a].eachDayRate[R].children=d.enhancementServices[a].eachDayRate[R].selectOption.childQuantity,d.enhancementServices[a].eachDayRate[R].tempChildren=angular.copy(d.enhancementServices[a].eachDayRate[R].children),d.enhancementServices[a].eachDayRate[R].childrenIsSelected=!0,d.enhancementServices[a].eachDayRate[R].dropdownChildren="#eaeaea",d.enhancementServices[a].eachDayRate[R].childrenColor="#898989",r.push(d.enhancementServices[a].eachDayRate[R].children))}if(("PER_ROOM_PER_NIGHT"==d.enhancementServices[a].servicePricingType||"PER_ROOM"==d.enhancementServices[a].servicePricingType)&&void 0==d.enhancementServices[a].eachDayRate[R].room&&d.enhancementServices[a].eachDayRate[R].options.length>0&&d.enhancementServices[a].isAutoCheckout&&d.enhancementServices[a].eachDayRate[R].options.length>0&&d.enhancementServices[a].eachDayRate[R].options[0].adultUnitDiscount===d.enhancementServices[a].eachDayRate[R].options[0].adultUnitPrice&&(d.enhancementServices[a].eachDayRate[R].options[0].serviceDate&&d.enhancementServices[a].eachDayRate[R].options[0].serviceOptionId&&(d.enhancementServices[a].eachDayRate[R].selectOption=d.enhancementServices[a].eachDayRate[R].options[0],d.enhancementServices[a].eachDayRate[R].tempSelectOption=d.enhancementServices[a].eachDayRate[R].options[0],d.enhancementServices[a].eachDayRate[R].selectOptionIsSelected=!0,d.enhancementServices[a].eachDayRate[R].optionsColor="#898989",d.enhancementServices[a].eachDayRate[R].dropdownOptions="#eaeaea"),void 0!=d.enhancementServices[a].serviceOptions[0].dailyRates[0].quantity)){var I=n.navData.guestsrooms.placeholder.split("/")[1];d.roomsInservice=C.numToArray(parseInt(I)+1),d.roomsInservice.splice(0,1),d.enhancementServices[a].maxLimit&&0!=d.enhancementServices[a].maxLimit?d.enhancementServices[a].eachDayRate[R].room=d.roomsInservice[d.roomsInservice.length-1]>d.enhancementServices[a].maxLimit?d.enhancementServices[a].maxLimit:d.roomsInservice[d.roomsInservice.length-1]:d.enhancementServices[a].eachDayRate[R].room=d.roomsInservice[d.roomsInservice.length-1],d.enhancementServices[a].eachDayRate[R].tempRooms=angular.copy(d.enhancementServices[a].eachDayRate[R].room),d.enhancementServices[a].eachDayRate[R].roomsIsSelected=!0,d.enhancementServices[a].eachDayRate[R].dropdownRooms="#eaeaea",d.enhancementServices[a].eachDayRate[R].roomsColor="#898989",i.push(d.enhancementServices[a].eachDayRate[R].room)}if("PER_RESERVATION"==d.enhancementServices[a].servicePricingType&&void 0!=d.enhancementServices[a].eachDayRate[R].serviceDate&&d.enhancementServices[a].eachDayRate[R].options.length>0&&d.enhancementServices[a].isAutoCheckout&&d.enhancementServices[a].eachDayRate[R].serviceDate.length>0){d.enhancementServices[a].serviceTypeId&&(f===d.enhancementServices[a].eachDayRate[R].serviceDate?d.enhancementServices[a].eachDayRate[R].date=f:d.enhancementServices[a].eachDayRate[R].date=d.enhancementServices[a].serviceOptions[0].dailyRates[0].serviceDate,d.enhancementServices[a].eachDayRate[R].tempDate=d.enhancementServices[a].eachDayRate[R].date,d.enhancementServices[a].eachDayRate[R].dropdownDate="#eaeaea",d.enhancementServices[a].eachDayRate[R].dateIsSelected=!0,d.enhancementServices[a].eachDayRate[R].dateColor="#898989",d.enhancementServices[a].eachDayRate[R].isChecked=!0,d.enhancementServices[a].eachDayRate[R].tempIsChecked=!0),d.enhancementServices[a].eachDayRate[R].options=[];for(var b=0;b<d.enhancementServices[a].serviceOptions.length;b++)for(var D=0;D<d.enhancementServices[a].serviceOptions[b].dailyRates.length;D++)d.enhancementServices[a].eachDayRate[R].date?d.enhancementServices[a].eachDayRate[R].date==d.enhancementServices[a].serviceOptions[b].dailyRates[D].serviceDate&&d.enhancementServices[a].eachDayRate[R].options.push(d.enhancementServices[a].serviceOptions[b].dailyRates[D]):d.enhancementServices[a].eachDayRate[R].serviceDate==d.enhancementServices[a].serviceOptions[b].dailyRates[D].serviceDate&&d.enhancementServices[a].eachDayRate[R].options.push(d.enhancementServices[a].serviceOptions[b].dailyRates[D]);d.enhancementServices[a].eachDayRate[R].options[0].serviceOptionId&&(d.enhancementServices[a].eachDayRate[R].tempReservationOptions=d.enhancementServices[a].eachDayRate[R].options,d.enhancementServices[a].eachDayRate[R].selectOption=d.enhancementServices[a].eachDayRate[R].options[0],d.enhancementServices[a].eachDayRate[R].tempSelectOption=d.enhancementServices[a].eachDayRate[R].options[0],d.enhancementServices[a].eachDayRate[R].selectOptionIsSelected=!0,d.enhancementServices[a].eachDayRate[R].optionsColor="#898989",d.enhancementServices[a].eachDayRate[R].dropdownOptions="#eaeaea")}"PER_PERSON_PER_NIGHT"!=d.enhancementServices[a].servicePricingType&&"PER_PERSON"!=d.enhancementServices[a].servicePricingType||void 0!=d.enhancementServices[a].eachDayRate[R].adult&&void 0!=d.enhancementServices[a].eachDayRate[R].selectOption&&(d.enhancementServices[a].eachDayRate[R].allSelected=!0,d.enhancementServices[a].eachDayRate[R].tempAllSelected=!0,d.enhancementServices[a].checked=!0,d.enhancementServices[a].tempChecked=!0),"PER_ROOM"!=d.enhancementServices[a].servicePricingType&&"PER_ROOM_PER_NIGHT"!=d.enhancementServices[a].servicePricingType||void 0!=d.enhancementServices[a].eachDayRate[R].room&&void 0!=d.enhancementServices[a].eachDayRate[R].selectOption&&(d.enhancementServices[a].eachDayRate[R].allSelected=!0,d.enhancementServices[a].eachDayRate[R].tempAllSelected=!0,d.enhancementServices[a].checked=!0,d.enhancementServices[a].tempChecked=!0),"PER_RESERVATION"==d.enhancementServices[a].servicePricingType&&void 0!=d.enhancementServices[a].eachDayRate[R].selectOption&&void 0!=d.enhancementServices[a].eachDayRate[R].date&&(d.enhancementServices[a].eachDayRate[R].allSelected=!0,d.enhancementServices[a].eachDayRate[R].tempAllSelected=!0,d.enhancementServices[a].checked=!0,d.enhancementServices[a].tempChecked=!0),d.enhancementServices[a].eachDayRate[R].options.length>0&&g++,g>1&&(d.enhancementServices[a].UseSelection=!0);var O=T.getTotalEnhancement(d.enhancementServices[a]);s=O.totalPrice,c=O.totalfinalPrice,m=O.packageTotalFinalPrice,u=O.packageTotalFinalPriceDisc,s>0&&(d.enhancementFlag=!0,p=O.zeroDiscountApplied),d.enhancementServices[a].adult=Math.max.apply(null,t),d.enhancementServices[a].children=Math.max.apply(null,r),d.enhancementServices[a].rooms=Math.max.apply(null,i),((void 0!=d.enhancementServices[a].eachDayRate[R].adult||void 0!=d.enhancementServices[a].eachDayRate[R].room)&&void 0!=d.enhancementServices[a].eachDayRate[R].selectOption&&"PER_PERSON"!=d.enhancementServices[a].servicePricingType&&"PER_ROOM"!=d.enhancementServices[a].servicePricingType||"PER_RESERVATION"==d.enhancementServices[a].servicePricingType&&void 0!=d.enhancementServices[a].eachDayRate[R].selectOption)&&o++}if(!e){if("PER_PERSON_PER_NIGHT"==d.enhancementServices[a].servicePricingType){for(var E,R=0;R<d.enhancementServices[a].eachDayRate.length;R++)if(d.enhancementServices[a].eachDayRate[R].options.length>0){E=R;break}if(1==d.enhancementServices[a].eachDayRate[E].allSelected)for(var R=0;R<d.enhancementServices[a].eachDayRate.length;R++)if(d.enhancementServices[a].eachDayRate[E].isChecked=!0,d.enhancementServices[a].eachDayRate[R].options.length>0&&R!=E){if(d.enhancementServices[a].eachDayRate[R].adult!=d.enhancementServices[a].eachDayRate[E].adult||void 0==d.enhancementServices[a].eachDayRate[R].adult){delete d.enhancementServices[a].eachDayRate[E].isChecked;break}if(void 0!=d.enhancementServices[a].eachDayRate[E].children&&(d.enhancementServices[a].eachDayRate[R].children!=d.enhancementServices[a].eachDayRate[E].children||void 0==d.enhancementServices[a].eachDayRate[R].children)){delete d.enhancementServices[a].eachDayRate[E].isChecked;break}if(d.enhancementServices[a].eachDayRate[R].selectOption.serviceOptionId!=d.enhancementServices[a].eachDayRate[E].selectOption.serviceOptionId||void 0==d.enhancementServices[a].eachDayRate[R].selectOption){delete d.enhancementServices[a].eachDayRate[E].isChecked;break}}}if("PER_ROOM_PER_NIGHT"==d.enhancementServices[a].servicePricingType){for(var M,R=0;R<d.enhancementServices[a].eachDayRate.length;R++)if(d.enhancementServices[a].eachDayRate[R].options.length>0){M=R;break}if(1==d.enhancementServices[a].eachDayRate[M].allSelected)for(var R=0;R<d.enhancementServices[a].eachDayRate.length;R++)if(d.enhancementServices[a].eachDayRate[M].isChecked=!0,d.enhancementServices[a].eachDayRate[R].options.length>0&&R!=M){if(d.enhancementServices[a].eachDayRate[R].room!=d.enhancementServices[a].eachDayRate[M].room||void 0==d.enhancementServices[a].eachDayRate[R].room){d.enhancementServices[a].eachDayRate[M].isChecked=!1;break}if(d.enhancementServices[a].eachDayRate[R].selectOption.serviceOptionId!=d.enhancementServices[a].eachDayRate[M].selectOption.serviceOptionId||void 0==d.enhancementServices[a].eachDayRate[R].selectOption){d.enhancementServices[a].eachDayRate[M].isChecked=!1;break}}}if("PER_ROOM"==d.enhancementServices[a].servicePricingType)for(var _=angular.copy(d.enhancementServices[a]),R=0;R<d.enhancementServices[a].eachDayRate.length;R++)for(var D=0;D<_.eachDayRate.length;D++)if(d.enhancementServices[a].eachDayRate[R].options.length>0)for(var k=0;k<d.enhancementServices[a].eachDayRate[R].options.length;k++)void 0!=_.eachDayRate[D].selectOption&&d.enhancementServices[a].eachDayRate[R].options[k].serviceOptionId==_.eachDayRate[D].selectOption.serviceOptionId&&R!=D&&d.enhancementServices[a].eachDayRate[R].options.splice(k,1);d.enhancementServices[a].days=o,d.enhancementServices[a].price=s,d.enhancementServices[a].finalPrice=c,(d.enhancementServices[a].discountRuleId||p||u>0&&m>0)&&(d.enhancementServices[a].priceDisc=m,d.enhancementServices[a].finalPriceDisc=u,d.enhancementServices[a].zeroDiscountApplied=p);for(var R=0;R<d.enhancementServices[a].eachDayRate.length;R++)void 0!=d.enhancementServices[a].eachDayRate[R].selectOption&&d.enhancementServices[a].eachDayRate[R].selectOption&&d.enhancementServices[a].eachDayRate[R].selectOption.serviceOptionName&&y.indexOf(d.enhancementServices[a].eachDayRate[R].selectOption.serviceOptionName)<0&&(y.push(d.enhancementServices[a].eachDayRate[R].selectOption.serviceOptionName),v=v.length?v+", "+d.enhancementServices[a].eachDayRate[R].selectOption.serviceOptionName:v+d.enhancementServices[a].eachDayRate[R].selectOption.serviceOptionName);d.enhancementServices[a].selectedServiceOptionNamesStr=v}}d.subTotalFinalPrice=0,d.totalPrice=0;for(var R=0;R<d.enhancementServices.length;R++)d.enhancementServices[R].discountRuleId||d.enhancementServices[R].finalPriceDisc>0&&d.enhancementServices[R].priceDisc>0?void 0!=d.subTotalFinalPrice&&void 0!=d.enhancementServices[R].finalPriceDisc?(d.subTotalFinalPrice=d.subTotalFinalPrice+d.enhancementServices[R].finalPriceDisc,d.totalPrice=d.totalPrice+d.enhancementServices[R].priceDisc):void 0!=d.enhancementServices[R].finalPriceDisc&&(d.subTotalFinalPrice=d.enhancementServices[R].finalPriceDisc,d.totalPrice=d.enhancementServices[R].priceDisc):void 0!=d.subTotalFinalPrice&&void 0!=d.enhancementServices[R].finalPrice?(d.subTotalFinalPrice=d.subTotalFinalPrice+d.enhancementServices[R].finalPrice,d.totalPrice=d.totalPrice+d.enhancementServices[R].price):void 0!=d.enhancementServices[R].finalPrice&&(d.subTotalFinalPrice=d.enhancementServices[R].finalPrice,d.totalPrice=d.enhancementServices[R].price);l.debug(JSON.stringify(d.enhancementServices)+"$scope.enhancementServices")};d.copyOfFormattedServicesData=[];var me=angular.copy(v.getMainReservation()),ue=function(e){d.enhancementServices=angular.copy(le);for(var a=d.enhancementServices.length-1;a>0;a--)"SERVICE_REQUEST"==d.enhancementServices[a].serviceCategory&&d.enhancementServices.splice(a,1);for(var t=[],o=[],a=0;a<d.enhancementServices.length;a++)"ENHANCEMENT"==d.enhancementServices[a].serviceCategory&&(S.includes(d.enhancementServices[a].associatedRoomTypeIds,e)||!d.enhancementServices[a].associatedRoomTypeIds||d.prevServiceReqOptions&&"Group"===d.prevServiceReqOptions.ratePlanType)?t.push(d.enhancementServices[a]):"PACKAGE_OPTION"==d.enhancementServices[a].serviceCategory&&o.push(d.enhancementServices[a]);if(d.navFilterData&&d.navFilterData.ratePlanCode&&d.navFilterData.ratePlanCode.ratePlanType&&"package"===d.navFilterData.ratePlanCode.ratePlanType.toLowerCase()&&n.RatesAvail&&n.RatesAvail.roomStays&&d.navFilterData.ratePlanCode.ratePlanCode&&n.RatesAvail.roomStays[0].ratePlans[0].ratePlanCode===d.navFilterData.ratePlanCode.ratePlanCode){var r=n.RatesAvail.roomStays[0].packageTypes;if(r&&r.length>0)for(var i=0;r.length>i;i++)if(d.navFilterData.ratePlanCode.ratePlanCode==r[i].packageCode&&t&&t.length>0&&r[i].inclusions.length>0){t=T.removeDuplicateGeneralEnhancement(t,r[i].inclusions);break}}0!=t.length&&(t=S.sortBy(t,"sortOrder")),0!=o.length&&(o=S.sortBy(o,"sortOrder")),d.enhancementServices=o.concat(t),d.showEnhancement=d.enhancementServices.length>4;for(var s=v.getResStartDate(),l=v.getResEndDate(),c=moment.utc(l).diff(moment.utc(s),"days")+1,m=[],u=0;u<c;u++){var p=moment.utc(s).add(u,"days").format("YYYY-MM-DD");m.push(p)}d.hasDiscountServices=!1,d.merchandisingInfo={};for(var y=0;y<d.enhancementServices.length;y++){!d.hasDiscountServices&&d.enhancementServices[y].discountRuleId&&(d.hasDiscountServices=!0),d.enhancementServices[y].showPriceAsDiscountedPrice=d.enhancementServices[y].showPriceAsDiscountedPrice&&g.getUxConfiguration().strikeThroughPricingEnabled,0===Object.keys(d.merchandisingInfo).length&&d.enhancementServices[y].merchandisingInfo&&(d.merchandisingInfo=d.enhancementServices[y].merchandisingInfo,d.merchandisingInfo.sliderText=[],d.enhancementServices[y].merchandisingInfo.slider1Text&&d.merchandisingInfo.sliderText.push({text:d.enhancementServices[y].merchandisingInfo.slider1Text,cancelClicked:!1}),d.enhancementServices[y].merchandisingInfo.slider2Text&&d.merchandisingInfo.sliderText.push({text:d.enhancementServices[y].merchandisingInfo.slider2Text,cancelClicked:!1}),d.enhancementServices[y].merchandisingInfo.slider3Text&&d.merchandisingInfo.sliderText.push({text:d.enhancementServices[y].merchandisingInfo.slider3Text,cancelClicked:!1}),d.merchandisingInfo.sliderText.length>0&&angular.forEach(d.merchandisingInfo.sliderText,function(e,a){angular.element(document.getElementById("sliderText-"+a)).removeClass("hideMerchandisingSlider")})),0!=d.enhancementServices[y].serviceOptions.length&&(d.enhancementServices[y].serviceOptions=S.sortBy(d.enhancementServices[y].serviceOptions,"sortOrder"));var h=T.getMinimumDayRate(d.enhancementServices[y]),R=h.selectFirstDateOFDiscount,f=h.tempAdultRate,P=h.tempAdultDiscount,A=0;if(void 0==d.enhancementServices[y].minPrice?(d.enhancementServices[y].minPrice=Math.min.apply(Math,f),d.hasDiscountServices&&(A=f.indexOf(Math.min.apply(Math,f)))):d.enhancementServices[y].minPrice>=Math.min.apply(Math,f)&&(d.enhancementServices[y].minPrice=Math.min.apply(Math,f),d.hasDiscountServices&&(A=f.indexOf(Math.min.apply(Math,f)))),d.hasDiscountServices&&(d.enhancementServices[y].discountedPrice=d.enhancementServices[y].minPrice-P[A]),d.enhancementServices[y].checked=!1,d.enhancementServices[y].eachDayRate=[],"PER_PERSON_PER_NIGHT"==d.enhancementServices[y].servicePricingType||"PER_RESERVATION"==d.enhancementServices[y].servicePricingType||"PER_ROOM_PER_NIGHT"==d.enhancementServices[y].servicePricingType)for(var I=0;I<m.length;I++){d.enhancementServices[y].eachDayRate[I]={},d.enhancementServices[y].eachDayRate[I].serviceDate=m[I],d.enhancementServices[y].eachDayRate[I].options=[];for(var b=0;b<d.enhancementServices[y].serviceOptions.length;b++)for(var D=0;D<d.enhancementServices[y].serviceOptions[b].dailyRates.length;D++)d.enhancementServices[y].serviceOptions[b].dailyRates[D].serviceDate==m[I]&&(d.enhancementServices[y].eachDayRate[I].options.push(d.enhancementServices[y].serviceOptions[b].dailyRates[D]),d.enhancementServices[y].eachDayRate[I].options[d.enhancementServices[y].eachDayRate[I].options.length-1].serviceOptionId=d.enhancementServices[y].serviceOptions[b].serviceOptionId,d.enhancementServices[y].eachDayRate[I].options[d.enhancementServices[y].eachDayRate[I].options.length-1].serviceOptionName=d.enhancementServices[y].serviceOptions[b].serviceOptionName,d.enhancementServices[y].eachDayRate[I].options[d.enhancementServices[y].eachDayRate[I].options.length-1].sortOrder=d.enhancementServices[y].serviceOptions[b].sortOrder)}else if("PER_PERSON"==d.enhancementServices[y].servicePricingType||"PER_ROOM"==d.enhancementServices[y].servicePricingType){for(var I=0;I<m.length;I++){d.enhancementServices[y].eachDayRate[I]={},d.enhancementServices[y].eachDayRate[I].serviceDate=m[I],d.enhancementServices[y].eachDayRate[I].options=[];for(var b=0;b<d.enhancementServices[y].serviceOptions.length;b++)for(var D=0;D<d.enhancementServices[y].serviceOptions[b].dailyRates.length;D++)d.enhancementServices[y].serviceOptions[b].dailyRates[D].serviceDate==R&&(d.enhancementServices[y].eachDayRate[I].options.push(d.enhancementServices[y].serviceOptions[b].dailyRates[D]),d.enhancementServices[y].eachDayRate[I].options[d.enhancementServices[y].eachDayRate[I].options.length-1].serviceOptionId=d.enhancementServices[y].serviceOptions[b].serviceOptionId,d.enhancementServices[y].eachDayRate[I].options[d.enhancementServices[y].eachDayRate[I].options.length-1].serviceOptionName=d.enhancementServices[y].serviceOptions[b].serviceOptionName,d.enhancementServices[y].eachDayRate[I].options[d.enhancementServices[y].eachDayRate[I].options.length-1].sortOrder=d.enhancementServices[y].serviceOptions[b].sortOrder,"PER_ROOM"==d.enhancementServices[y].servicePricingType&&(d.enhancementServices[y].eachDayRate[I].tempOptions=angular.copy(d.enhancementServices[y].eachDayRate[I].options)))}for(var O,a=0;d.enhancementServices[y].eachDayRate.length>a;a++)if(O=void 0,d.enhancementServices[y].eachDayRate[a].options.length>0?R===d.enhancementServices[y].eachDayRate[a].serviceDate?(O=d.enhancementServices[y].eachDayRate[a].options,d.enhancementServices[y].eachDayRate[a].options=[],"PER_ROOM"==d.enhancementServices[y].servicePricingType&&(d.enhancementServices[y].eachDayRate[a].tempOptions=[])):(d.enhancementServices[y].eachDayRate[a].options=[],"PER_ROOM"==d.enhancementServices[y].servicePricingType&&(d.enhancementServices[y].eachDayRate[a].tempOptions=[])):d.enhancementServices[y].eachDayRate.splice(a,1),R&&O){if("PER_ROOM"==d.enhancementServices[y].servicePricingType)for(ml=0;O.length>ml;ml++)O[ml].maxLimit=d.enhancementServices[y].maxLimit;d.enhancementServices[y].eachDayRate[a].options=O,"PER_ROOM"==d.enhancementServices[y].servicePricingType&&(d.enhancementServices[y].eachDayRate[a].tempOptions=angular.copy(O))}}var E;if("PER_RESERVATION"==d.enhancementServices[y].servicePricingType){for(var a=0;a<d.enhancementServices[y].eachDayRate.length;a++)if(R===d.enhancementServices[y].eachDayRate[a].serviceDate&&d.enhancementServices[y].eachDayRate[a].options.length>0){d.enhancementServices[y].eachDayRate[a].serviceDates=[],E=a;break}for(var a=0;a<d.enhancementServices[y].eachDayRate.length;a++)d.enhancementServices[y].eachDayRate[a].options.length>0&&(d.enhancementServices[y].eachDayRate[E].serviceDates.push(d.enhancementServices[y].eachDayRate[a].serviceDate),a!=E&&(d.enhancementServices[y].eachDayRate[a].options=[]))}}if(d.servicesLimit=4,d.hideMoreEnhancement=!1,"addRoom"!=d.clickbuttonType&&"book"!=d.clickbuttonType&&C.setUserTiming("Interaction","SelectRoomDetail"),d.copyOfFormattedServicesData=angular.copy(d.enhancementServices),d.selectedEnhancements=[],d.isServiceAPICalled){if(d.isServiceAPICalled=!1,void 0!=me.services&&!ce&&(!d.selectedRoom||d.selectedRoom&&(V||v.getConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR"))&&me.roomStays[0].roomRates.length>0&&me.roomStays[0].roomRates[0].roomTypeCode==d.selectedRoom.roomTypeCode&&me.roomStays[0].ratePlans.length>0&&("Group"!=me.roomStays[0].ratePlans[0].rateTypeCode&&me.roomStays[0].ratePlans[0].ratePlanCode==d.selectedRoom.currentRate.ratePlanCode||"Group"==me.roomStays[0].ratePlans[0].ratePlanType&&me.roomStays[0].ratePlans[0].ratePlanCode==d.selectedRoom.currentRate.roomRateCode)))for(var a=0;a<me.services.length;a++)"ENHANCEMENT"!=me.services[a].serviceCategory&&"PACKAGE_OPTION"!=me.services[a].serviceCategory||d.selectedEnhancements.push(me.services[a]);d.selectedEnhancements.length>0&&de(),!d.enhancementsEnabledFlag||Q||0!==d.selectedEnhancements.length||v.getConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE")&&!v.getConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR")||(v.deleteConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE"),ge()),v.getConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR")&&v.deleteConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR"),d.enhancementServices.length>0?!v.getConfig("enableUpfrontEnhancements")&&d.enhancementDetailsVisible&&d.enableUpfrontEnhancementsIsActive&&(v.setConfig("enableUpfrontEnhancements"),d.enhancementDetailsVisible=!1,d.toEnhancementSectionScroll(d.selectedRoom,d.currentGridRow)):d.enableUpfrontEnhancementsIsActive&&(d.enableUpfrontEnhancementsIsActive=!1,d.enhancementDetailsVisible&&(d.enhancementDetailsVisible=!1,d.updateAccommodations(d.selectedRoom,"book"))),ce=!1}else if(d.listOfSelectedEnhancements.length>0)for(var a=0;a<d.listOfSelectedEnhancements.length;a++)for(var M=0;M<d.enhancementServices.length;M++)d.listOfSelectedEnhancements[a].serviceTypeId===d.enhancementServices[M].serviceTypeId&&(d.enhancementServices[M]=d.listOfSelectedEnhancements[a],d.enhancementFlag=!0);else if(void 0!=v.getReservation().services&&v.getConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR")){for(var a=0;a<v.getReservation().services.length;a++)"ENHANCEMENT"!=v.getReservation().services[a].serviceCategory&&"PACKAGE_OPTION"!=v.getReservation().services[a].serviceCategory||d.selectedEnhancements.push(v.getReservation().services[a]);d.selectedEnhancements.length>0&&de(),v.deleteConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR")}if(d.isSwitchRoomCalledFromBookButton?("addRoom"===d.clickbuttonType?d.updateAccommodations(d.currentRoom,d.clickbuttonType):d.updateAccommodations(d.selectedRoom,d.clickbuttonType),d.closeRoomDetail(d.currentRoom),d.isSwitchRoomCalledFromBookButton=!1):d.isChangedRateplanFromMultiRatePopup&&(d.selectRateAndBook(d.currentRoomInMultiRate,d.selectedRate),d.isChangedRateplanFromMultiRatePopup=!1),d.serviceListAccordion=[],d.hasDiscountServices){var _=[],k=[],N=[];angular.forEach(d.enhancementServices,function(e){e.discountRuleId?k.push(e):N.push(e)}),_&&_.length>0&&(k=_.concat(k)),k&&k.length>0&&d.serviceListAccordion.push({label:"global_complimentaryenhancements-LblComplimentaryEnhancements",isOpen:!0,enhancementList:k}),N&&N.length>0&&d.serviceListAccordion.push({label:"global_otherenhancements-LblOtherEnhancements",isOpen:!0,enhancementList:N})}},pe=!1;d.showRescheduleEnhancementsPopupOnRatechange=function(a,t,o,r){if(o)t.currentCode=d.priceSlide.priceSlide,t.roomTypeCode=t.roomTypeCode.indexOf("M_")>-1?t.roomTypeCode.replace("M_",""):t.roomTypeCode,d.selectedRoomTypeId=parseInt(t.roomTypeCode,10);else{var i=angular.copy(a);i.ratePlanCode=i.ratePlanCode.indexOf("M_")>-1?i.ratePlanCode.replace("M_",""):i.ratePlanCode,d.selectedRate=i}d.currentRoomInMultiRate=t,d.isChangedRateplanFromPricebox=!!o,d.isChangedRateplanFromMultiRatePopup=!!r,d.listOfSelectedEnhancements=[],v.getConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE")&&v.deleteConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE");var s=!1;if(v.getConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR")&&me&&me.services&&me.services.length>0&&me.roomStays[0].roomRates[0].roomTypeCode){for(var l=me.services,c=0;c<l.length;c++)"ENHANCEMENT"==l[c].serviceCategory&&(s=!0);d.listOfSelectedEnhancements=l}else if(d.enhancementServices&&d.enhancementServices.length>0)for(var c=0;c<d.enhancementServices.length;c++)"ENHANCEMENT"==d.enhancementServices[c].serviceCategory&&d.enhancementServices[c].checked&&(s=!0),d.enhancementServices[c].checked&&d.listOfSelectedEnhancements.push(d.enhancementServices[c]);else if(me&&me.services&&me.roomStays[0].roomRates[0].roomTypeCode){for(var l=me.services,c=0;c<l.length;c++)"ENHANCEMENT"==l[c].serviceCategory&&(s=!0);d.listOfSelectedEnhancements=l}s&&(!r||r&&a.ratePlanCode!==t.currentCode)?(d.refreshEnhancementsWarning="display-block",r&&(d.showAllRatePlanPopup=!1),setTimeout(function(){e.onModalOpen("","switch-to-another-rate-parent-id","switch-to-another-rate-title-id",!1,d.refreshEnhancementsWarning)})):o||r?(me.services=[],r&&le?(se=!0,n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,t):d.getEnhancementServices(d.selectedRoomTypeId)):(se=!0,d.getEnhancementServices(d.selectedRoomTypeId,t))):n.displayMultiRateListView?(me.services=[],d.addMultiRateTypeCode(d.currentRoomInMultiRate,d.selectedRate)):(me.services=[],d.setRatePlan(d.selectedRate))};var ye,ve;d.$on(o.CONTINUE_TO_CHANGE_RATE_PLAN,function(a,t){ye=t;var r=!1;if(v.getConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR")&&j&&ve===me.id&&(me.services=[]),v.getConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR")&&me&&me.services&&me.services.length>0&&me.roomStays[0].roomRates[0].roomTypeCode)for(var i=me.services,s=0;s<i.length;s++)"ENHANCEMENT"==i[s].serviceCategory&&(r=!0);else if(d.enhancementServices)for(var s=0;s<d.enhancementServices.length;s++)"ENHANCEMENT"==d.enhancementServices[s].serviceCategory&&d.enhancementServices[s].checked&&(r=!0,j=!1);else if(me&&me.services&&me.roomStays[0].roomRates[0].roomTypeCode)for(var i=me.services,s=0;s<i.length;s++)"ENHANCEMENT"==i[s].serviceCategory&&(r=!0);r&&(d.prevServiceReqOptions||me&&me.services)?(d.refreshEnhancementsWarning="display-block",setTimeout(function(){e.onModalOpen("","switch-to-another-rate-parent-id","switch-to-another-rate-title-id",!1,d.refreshEnhancementsWarning)}),d.showingRateChangePopupOnAddCode=!0):n.$broadcast(o.CONFIRMED_TO_CHANGE_RATE_PLAN,t)}),d.showRescheduleEnhancementsPopupOnRoomSwitch=function(a,t,r,i,s,l){n.toggle.intlMenu=!1,d.enhancementFlag=!1,n.$broadcast("CancelAddCode"),n.$broadcast("CancelAccommodation"),
a.roomTypeCode=a.roomTypeCode.indexOf("M_")>-1?a.roomTypeCode.replace("M_",""):a.roomTypeCode,d.selectedRoom=a,d.currentGridRow=t,d.currentEvent=r,d.enhancementDetailsVisible=!!i,d.isSwitchRoomCalledFromBookButton=!!s,d.clickbuttonType=l||"",d.listOfSelectedEnhancements=[],d.memberRateCurrentRoom&&d.memberRateCurrentRoom.hasOwnProperty("isManageUrlMemberRateSelected")&&(d.memberRateCurrentRoom.isManageUrlMemberRateSelected=!1);var c=v.getCurrency()||v.getCurrencyDetails()&&v.getCurrencyDetails().currencyCode;d.isCurrencyChanged=!(!d.prevServiceReqOptions||d.prevServiceReqOptions.currencyCode==c),d.selectedRoomTypeId=parseInt(a.roomTypeCode,10),d.selectedRoomID=n.displayMultiRateListView||d.toggleAcc.listView?"room"+a.id:a.id,d.rowTypeToShow=n.displayMultiRateListView||d.toggleAcc.listView?"showListRow":"showGridRow",pe=!0;var g=!1,m=v.getPreviousLanguage(),u=v.getLanguage(),p=!1;V=!d.prevServiceReqOptions||!d.prevServiceReqOptions.roomTypeCode;var y=d.prevServiceReqOptions&&a.currentRate&&("Group"!==d.prevServiceReqOptions.ratePlanType&&d.prevServiceReqOptions.ratePlanCode!==a.currentRate.ratePlanCode||"Group"==d.prevServiceReqOptions.ratePlanType&&d.prevServiceReqOptions.ratePlanCode!==a.currentRate.roomRateCode),h=d.prevServiceReqOptions&&a.currentRate&&void 0!=d.prevServiceReqOptions.roomTypeCode&&void 0!=a.currentRate.roomTypeCode&&d.prevServiceReqOptions.roomTypeCode!==a.currentRate.roomTypeCode;if((y||h)&&v.getConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE")&&v.deleteConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE"),v.getConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR")&&me&&me.services&&me.services.length>0&&me.roomStays[0].roomRates[0].roomTypeCode){for(var R=me.services,f=0;f<R.length;f++)"ENHANCEMENT"==R[f].serviceCategory&&R[f].associatedRoomTypeIds&&!S.includes(R[f].associatedRoomTypeIds,d.selectedRoomTypeId)&&(g=!0);d.listOfSelectedEnhancements=R}else if(d.enhancementServices)for(var f=0;f<d.enhancementServices.length;f++)"ENHANCEMENT"==d.enhancementServices[f].serviceCategory&&d.enhancementServices[f].associatedRoomTypeIds&&d.enhancementServices[f].checked&&!S.includes(d.enhancementServices[f].associatedRoomTypeIds,d.selectedRoomTypeId)&&(g=!0),d.enhancementServices[f].checked&&d.listOfSelectedEnhancements.push(d.enhancementServices[f]);else if(me&&me.services&&me.roomStays[0].roomRates[0].roomTypeCode){for(var R=me.services,f=0;f<R.length;f++)"ENHANCEMENT"==R[f].serviceCategory&&R[f].associatedRoomTypeIds&&!S.includes(R[f].associatedRoomTypeIds,d.selectedRoomTypeId)&&(g=!0);d.listOfSelectedEnhancements=R}if(!V&&"Group"!==d.prevServiceReqOptions.ratePlanType&&(!n.displayMultiRateListView&&d.navFilterData.ratePlanCode&&d.prevServiceReqOptions.ratePlanCode===d.navFilterData.ratePlanCode.ratePlanCode||n.displayMultiRateListView&&d.selectedRoom.currentRate&&d.prevServiceReqOptions.ratePlanCode===d.selectedRoom.currentRate.ratePlanCode))if(g)d.refreshEnhancementsWarningOnRoomSwitch="display-block",setTimeout(function(){e.onModalOpen(a.id+"roomCard","switch-to-another-room-parent-id","switch-to-another-room-title-id",!1,d.refreshEnhancementsWarningOnRoomSwitch)});else if(s)v.getConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR")?(se=!0,p=!0,n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,d.selectedRoom):d.getEnhancementServices(d.selectedRoomTypeId)):"addRoom"==l&&le||d.prevServiceReqOptions.roomTypeCode==d.selectedRoomTypeId?ue(d.selectedRoomTypeId):0==d.listOfSelectedEnhancements.length?(se=!0,p=!0,n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,d.selectedRoom):d.getEnhancementServices(d.selectedRoomTypeId)):(d.refreshEnhancementsWarning="display-block",se=!0,setTimeout(function(){e.onModalOpen("","switch-to-another-rate-parent-id","switch-to-another-rate-title-id",!1,d.refreshEnhancementsWarning)}));else if(i&&a.isSelected)d.toEnhancementSectionScroll(a,t),r.stopPropagation();else if(v.getConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR"))if(n.MRB&&n.reservationArray.length>1&&n.navData.accommodations.rooms.length)for(var f=0;f<n.reservationArray.length;f++)1==n.reservationArray[f].selected&&(n.reservationArray[f].roomStays[0].roomRates[0].roomTypeCode==d.selectedRoomTypeId?(se=!0,d.toggleRoomDetail(t,a),d.scrollToNew(a,d.selectedRoomID,r,d.rowTypeToShow,t),p=!0,n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,a):d.getEnhancementServices(d.selectedRoomTypeId),n.$broadcast(o.CONTINUE_TO_SWITCH_ROOM_DETAIL,a),pe=!1):(d.refreshEnhancementsWarningOnRoomSwitch="display-block",se=!0,setTimeout(function(){e.onModalOpen(a.id+"roomCard","switch-to-another-room-parent-id","switch-to-another-room-title-id",!1,d.refreshEnhancementsWarningOnRoomSwitch)})));else(n.MRB&&1==n.reservationArray.length||!n.MRB)&&n.navData.accommodations.rooms.length&&(n.navData.accommodations.rooms[0].roomTypeCode==d.selectedRoomTypeId?(se=!0,d.toggleRoomDetail(t,a),d.scrollToNew(a,d.selectedRoomID,r,d.rowTypeToShow,t),p=!0,n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,a):d.getEnhancementServices(d.selectedRoomTypeId),n.$broadcast(o.CONTINUE_TO_SWITCH_ROOM_DETAIL,a),pe=!1):(d.refreshEnhancementsWarningOnRoomSwitch="display-block",se=!0,setTimeout(function(){e.onModalOpen(a.id+"roomCard","switch-to-another-room-parent-id","switch-to-another-room-title-id",!1,d.refreshEnhancementsWarningOnRoomSwitch)})));else D.getMenubarEnabled()&&A.getIsLoyaltyReservationEnabled()||A.getIsBrandBarDisplay()||!le||V||d.selectedRoomTypeId!=d.prevServiceReqOptions.roomTypeCode||v.getConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR")?0==d.listOfSelectedEnhancements.length?(se=!0,d.toggleRoomDetail(t,a),d.scrollToNew(a,d.selectedRoomID,r,d.rowTypeToShow,t),p=!0,n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,a):d.getEnhancementServices(d.selectedRoomTypeId),n.$broadcast(o.CONTINUE_TO_SWITCH_ROOM_DETAIL,a),pe=!1):d.isCurrencyChanged||d.prevServiceReqOptions.roomTypeCode!=d.selectedRoomTypeId?d.isCurrencyChanged&&d.prevServiceReqOptions.roomTypeCode==d.selectedRoomTypeId?(se=!0,d.toggleRoomDetail(t,a),d.scrollToNew(a,d.selectedRoomID,r,d.rowTypeToShow,t),p=!0,n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,a):d.getEnhancementServices(d.selectedRoomTypeId),n.$broadcast(o.CONTINUE_TO_SWITCH_ROOM_DETAIL,a),pe=!1):(d.refreshEnhancementsWarning="display-block",se=!0,setTimeout(function(){e.onModalOpen("","switch-to-another-rate-parent-id","switch-to-another-rate-title-id",!1,d.refreshEnhancementsWarning)})):(d.toggleRoomDetail(t,a),d.scrollToNew(a,d.selectedRoomID,r,d.rowTypeToShow,t),ue(d.selectedRoomTypeId),n.$broadcast(o.CONTINUE_TO_SWITCH_ROOM_DETAIL,a),pe=!1):0==d.listOfSelectedEnhancements.length?(se=!0,d.toggleRoomDetail(t,a),d.scrollToNew(a,d.selectedRoomID,r,d.rowTypeToShow,t),p=!0,n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,a):d.getEnhancementServices(d.selectedRoomTypeId),n.$broadcast(o.CONTINUE_TO_SWITCH_ROOM_DETAIL,a),pe=!1):(d.toggleRoomDetail(t,a),d.scrollToNew(a,d.selectedRoomID,r,d.rowTypeToShow,t),ue(d.selectedRoomTypeId),n.$broadcast(o.CONTINUE_TO_SWITCH_ROOM_DETAIL,a),pe=!1);else d.listOfSelectedEnhancements.length>0&&d.prevServiceReqOptions&&"Group"!==d.prevServiceReqOptions.ratePlanType&&a.currentRate&&(!s&&d.prevServiceReqOptions.ratePlanCode!==a.currentRate.ratePlanCode||s&&d.prevServiceReqOptions.ratePlanCode!==a.currentCode)?(d.refreshEnhancementsWarning="display-block",se=!0,setTimeout(function(){e.onModalOpen("","switch-to-another-rate-parent-id","switch-to-another-rate-title-id",!1,d.refreshEnhancementsWarning)})):0==d.listOfSelectedEnhancements.length&&d.prevServiceReqOptions&&"Group"!==d.prevServiceReqOptions.ratePlanType&&a.currentRate&&(!s&&d.prevServiceReqOptions.ratePlanCode!==a.currentRate.ratePlanCode||s&&d.prevServiceReqOptions.ratePlanCode!==a.currentCode)?(se=!0,p=!0,n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,d.selectedRoom):d.getEnhancementServices(d.selectedRoomTypeId),s||(d.toggleRoomDetail(t,a),d.scrollToNew(a,d.selectedRoomID,r,d.rowTypeToShow,t),n.$broadcast(o.CONTINUE_TO_SWITCH_ROOM_DETAIL,a),pe=!1)):!d.prevServiceReqOptions&&me&&me.roomStays&&me.roomStays.length>0&&me.roomStays[0].ratePlans&&me.roomStays[0].ratePlans.length>0&&"Group"!==me.roomStays[0].ratePlans[0].ratePlanType&&g?(d.refreshEnhancementsWarningOnRoomSwitch="display-block",setTimeout(function(){e.onModalOpen("","switch-to-another-room-parent-id","switch-to-another-room-title-id",!1,d.refreshEnhancementsWarningOnRoomSwitch)})):s?d.prevServiceReqOptions&&n.displayMultiRateListView&&a.currentRate&&d.prevServiceReqOptions.ratePlanCode!==a.currentRate.ratePlanCode?(se=!0,p=!0,n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,a):d.getEnhancementServices(d.selectedRoomTypeId)):V&&n.navData.accommodations.rooms.length?n.navData.accommodations.rooms[0].roomTypeCode==d.selectedRoomTypeId||n.navData.accommodations.ratePlan&&n.navData.accommodations.ratePlan.length>0&&n.navData.accommodations.ratePlan[0].ratePlanCode!=a.currentRate.ratePlanCode&&j&&!d.currentRoomInMultiRate?(p=!0,n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,a):d.getEnhancementServices(d.selectedRoomTypeId),pe=!0):(d.refreshEnhancementsWarningOnRoomSwitch="display-block",setTimeout(function(){e.onModalOpen("","switch-to-another-room-parent-id","switch-to-another-room-title-id",!1,d.refreshEnhancementsWarningOnRoomSwitch)})):le&&d.selectedRoomTypeId==d.prevServiceReqOptions.roomTypeCode&&!v.getConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR")?ue(d.selectedRoomTypeId):(se=!0,p=!0,n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,d.selectedRoom):d.getEnhancementServices(d.selectedRoomTypeId)):i&&a.isSelected?(d.toEnhancementSectionScroll(a,t),r.stopPropagation()):V&&n.navData.accommodations.rooms.length?n.navData.accommodations.rooms[0].roomTypeCode==d.selectedRoomTypeId||n.navData.accommodations.ratePlan&&n.navData.accommodations.ratePlan.length>0&&n.navData.accommodations.ratePlan[0].ratePlanCode!=a.currentRate.ratePlanCode&&j&&!d.currentRoomInMultiRate?(d.toggleRoomDetail(t,a),d.scrollToNew(a,d.selectedRoomID,r,d.rowTypeToShow,t),n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,a):d.getEnhancementServices(d.selectedRoomTypeId),n.$broadcast(o.CONTINUE_TO_SWITCH_ROOM_DETAIL,a),pe=!1):(d.refreshEnhancementsWarningOnRoomSwitch="display-block",setTimeout(function(){e.onModalOpen("","switch-to-another-room-parent-id","switch-to-another-room-title-id",!1,d.refreshEnhancementsWarningOnRoomSwitch)})):!V&&a.currentRate?d.prevServiceReqOptions.roomTypeCode!=d.selectedRoomTypeId||y?0==d.listOfSelectedEnhancements.length?(se=!0,d.toggleRoomDetail(t,a),d.scrollToNew(a,d.selectedRoomID,r,d.rowTypeToShow,t),p=!0,n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,a):d.getEnhancementServices(d.selectedRoomTypeId),n.$broadcast(o.CONTINUE_TO_SWITCH_ROOM_DETAIL,a),pe=!1):(d.refreshEnhancementsWarning="display-block",se=!0,setTimeout(function(){e.onModalOpen("","switch-to-another-rate-parent-id","switch-to-another-rate-title-id",!1,d.refreshEnhancementsWarning)})):(d.toggleRoomDetail(t,a),d.scrollToNew(a,d.selectedRoomID,r,d.rowTypeToShow,t),n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,a):d.getEnhancementServices(d.selectedRoomTypeId),n.$broadcast(o.CONTINUE_TO_SWITCH_ROOM_DETAIL,a),pe=!1):((y||v.getConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR"))&&(se=!0),d.toggleRoomDetail(t,a),d.scrollToNew(a,d.selectedRoomID,r,d.rowTypeToShow,t),p=!0,n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,a):d.getEnhancementServices(d.selectedRoomTypeId),n.$broadcast(o.CONTINUE_TO_SWITCH_ROOM_DETAIL,a),pe=!1);0==p&&void 0!=m&&m!=u&&(v.setPreviousLanguage(u),n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,a):d.getEnhancementServices(d.selectedRoomTypeId)),setTimeout(function(){var e=document.getElementsByClassName("merchandising-info-section"),a=document.getElementsByClassName("merchandising-slider");e.length>0&&a.length>0&&(e[0].style.minHeight=a[0].offsetHeight+56+"px")},1e3)},d.callToRoomUpgrade=!1,d.showRescheduleEnhancementsPopupOnUpgradeRoom=function(a,t){d.enhancementFlag=!1,d.currentOpenedRoom=t,d.selectedRoom=a,d.selectedRoomTypeId=parseInt(a.roomTypeCode,10),pe=!0;var o=!1;if(d.listOfSelectedEnhancements=[],d.enhancementServices)for(var r=0;r<d.enhancementServices.length;r++)"ENHANCEMENT"==d.enhancementServices[r].serviceCategory&&d.enhancementServices[r].associatedRoomTypeIds&&d.enhancementServices[r].checked&&!S.includes(d.enhancementServices[r].associatedRoomTypeIds,d.selectedRoomTypeId)&&(o=!0),d.enhancementServices[r].checked&&d.listOfSelectedEnhancements.push(d.enhancementServices[r]);d.prevServiceReqOptions&&"Group"!==d.prevServiceReqOptions.ratePlanType&&(!n.displayMultiRateListView&&d.navFilterData.ratePlanCode&&d.prevServiceReqOptions.ratePlanCode===d.navFilterData.ratePlanCode.ratePlanCode||n.displayMultiRateListView&&d.selectedRoom.currentRate&&d.prevServiceReqOptions.ratePlanCode===d.selectedRoom.currentRate.ratePlanCode)?o?(d.refreshEnhancementsWarningOnRoomSwitch="display-block",setTimeout(function(){e.onModalOpen("","switch-to-another-room-parent-id","switch-to-another-room-title-id",!1,d.refreshEnhancementsWarningOnRoomSwitch)}),d.callToRoomUpgrade=!0):(d.UpgradeRoom(a.roomTypeCode,t,!0),ue(d.selectedRoomTypeId),pe=!1):(d.UpgradeRoom(a.roomTypeCode,t,!0),n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,d.selectedRoom):d.getEnhancementServices(d.selectedRoomTypeId),pe=!1)},d.continueToRefreshEnhancementsOnRoomSwitch=function(){d.refreshEnhancementsWarningOnRoomSwitch="display-none",e.onModalClose(),d.callToRoomUpgrade?(d.UpgradeRoom(d.selectedRoomTypeId,d.currentOpenedRoom,!0),ue(d.selectedRoomTypeId),d.callToRoomUpgrade=!1,pe=!1):d.isSwitchRoomCalledFromBookButton?le&&!v.getConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR")?ue(d.selectedRoomTypeId):(se=!0,n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,d.selectedRoom):d.getEnhancementServices(d.selectedRoomTypeId)):(d.toggleRoomDetail(d.currentGridRow,d.selectedRoom),d.scrollToNew(d.selectedRoom,d.selectedRoomID,d.currentEvent,d.rowTypeToShow,d.currentGridRow),d.selectedRoomTypeId&&pe&&(le&&!v.getConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR")?ue(d.selectedRoomTypeId):(se=!0,n.displayMultiRateListView?d.getEnhancementServices(d.selectedRoomTypeId,d.selectedRoom):d.getEnhancementServices(d.selectedRoomTypeId)),n.$broadcast(o.CONTINUE_TO_SWITCH_ROOM_DETAIL,d.selectedRoom),pe=!1))},d.cancelToRefreshEnhancementsOnRoomSwitch=function(){d.refreshEnhancementsWarningOnRoomSwitch="display-none",d.listOfSelectedEnhancements.length>0&&(d.enhancementFlag=!0),e.onModalClose(),d.callToRoomUpgrade=!1},d.continueToRefreshEnhancements=function(){j=!0,d.refreshEnhancementsWarning="display-none",e.onModalClose(),d.enhancementServices=d.copyOfFormattedServicesData,d.listOfSelectedEnhancements=[],me.services=[],ve=n.MRB?angular.copy(me.id):void 0,ce=!0,d.showingRateChangePopupOnAddCode?(d.enhancementServices=S.map(d.enhancementServices,function(e){return S.extend({},e,{checked:!1})}),d.selectedRoomTypeId&&le&&ue(d.selectedRoomTypeId),d.showingRateChangePopupOnAddCode=!1,d.enhancementFlag=!1,n.$broadcast(o.CONFIRMED_TO_CHANGE_RATE_PLAN,ye)):d.isChangedRateplanFromPricebox||d.isChangedRateplanFromMultiRatePopup?(se=!0,d.getEnhancementServices(d.selectedRoomTypeId,d.currentRoomInMultiRate),d.isChangedRateplanFromPricebox=!1):n.displayMultiRateListView?(d.enhancementServices=S.map(d.enhancementServices,function(e){return S.extend({},e,{checked:!1})}),d.enhancementFlag=!1,pe?d.isSwitchRoomCalledFromBookButton?(d.getEnhancementServices(d.selectedRoomTypeId,d.selectedRoom),pe=!1):(d.toggleRoomDetail(d.currentGridRow,d.selectedRoom),d.scrollToNew(d.selectedRoom,d.selectedRoomID,d.currentEvent,d.rowTypeToShow,d.currentGridRow),d.selectedRoomTypeId&&(d.getEnhancementServices(d.selectedRoomTypeId,d.selectedRoom),n.$broadcast(o.CONTINUE_TO_SWITCH_ROOM_DETAIL,d.selectedRoom),pe=!1)):d.addMultiRateTypeCode(d.currentRoomInMultiRate,d.selectedRate)):pe?(d.toggleRoomDetail(d.currentGridRow,d.selectedRoom),d.scrollToNew(d.selectedRoom,d.selectedRoomID,d.currentEvent,d.rowTypeToShow,d.currentGridRow),d.selectedRoomTypeId&&(se=!0,d.getEnhancementServices(d.selectedRoomTypeId),n.$broadcast(o.CONTINUE_TO_SWITCH_ROOM_DETAIL,d.selectedRoom),pe=!1)):d.setRatePlan(d.selectedRate)},d.enhancementsEnabledFlag=g.getHotelDesc().uxConfiguration.enhancementsEnabled,d.roomUpgradeEnabledFlag=g.getHotelDesc().uxConfiguration.roomUpgradeEnabled,void 0==v.getAddedEnhancement()||void 0!=v.getAddedEnhancement()&&0==v.getAddedEnhancement().length?(v.deleteConfig("enableUpfrontEnhancements"),g.getUxConfiguration().accomodationsConfig.enableUpfrontEnhancements&&1==d.enhancementsEnabledFlag&&0==Q?d.enableUpfrontEnhancementsIsActive=!0:d.enableUpfrontEnhancementsIsActive=!1):d.enableUpfrontEnhancementsIsActive=!1;var he=function(e,a,t){y(function(){var o,r=0,n=document.getElementsByTagName("nav")[0].offsetHeight;document.getElementsByClassName("tc-loyalty-navbar")[0]&&(r=document.getElementsByClassName("tc-loyalty-navbar")[0].offsetHeight),"showGridRow"==a?o=document.getElementById("gridstickyrowDetail"+t):"showListRow"==a&&(o=document.getElementById("liststickyrowDetail"+e)),o=window.pageYOffset+o.getBoundingClientRect().top-n-r,p.scrollTop(o,500)},500)},Re=function(){d.subTotalFinalPrice=0,d.totalPrice=0;for(var e=0;e<d.enhancementServices.length;e++)Q&&!d.enhancementServices[e].discountRuleId&&d.enhancementServices[e].checked&&d.enhancementServices[e].zeroDiscountApplied&&0==d.enhancementServices[e].finalPriceDisc&&d.enhancementServices[e].priceDisc>0?void 0!=d.subTotalFinalPrice&&void 0!=d.enhancementServices[e].finalPriceDisc?(d.subTotalFinalPrice=d.subTotalFinalPrice+d.enhancementServices[e].finalPriceDisc,d.totalPrice=d.totalPrice+d.enhancementServices[e].priceDisc):void 0!=d.enhancementServices[e].finalPriceDisc&&(d.subTotalFinalPrice=d.enhancementServices[e].finalPriceDisc,d.totalPrice=d.enhancementServices[e].priceDisc):d.enhancementServices[e].discountRuleId||d.enhancementServices[e].finalPriceDisc>0&&d.enhancementServices[e].priceDisc>0?void 0!=d.subTotalFinalPrice&&void 0!=d.enhancementServices[e].finalPriceDisc?(d.subTotalFinalPrice=d.subTotalFinalPrice+d.enhancementServices[e].finalPriceDisc,d.totalPrice=d.totalPrice+d.enhancementServices[e].priceDisc):void 0!=d.enhancementServices[e].finalPriceDisc&&(d.subTotalFinalPrice=d.enhancementServices[e].finalPriceDisc,d.totalPrice=d.enhancementServices[e].priceDisc):void 0!=d.subTotalFinalPrice&&void 0!=d.enhancementServices[e].finalPrice?(d.subTotalFinalPrice=d.subTotalFinalPrice+d.enhancementServices[e].finalPrice,d.totalPrice=d.totalPrice+d.enhancementServices[e].price):void 0!=d.enhancementServices[e].finalPrice&&(d.subTotalFinalPrice=d.enhancementServices[e].finalPrice,d.totalPrice=d.enhancementServices[e].price)};d.getEnhancementServices=function(e,a){var e=parseInt(e,10);if(d.hideMoreEnhancement=!1,d.servicesLimit=4,d.ratePlanFlag=!1,1==se){l.debug(JSON.stringify(Ie)+"$rootScope.options"),l.debug(JSON.stringify(Ie.allCodes)+"options.allCodes");var t=v.getMainReservation(),o=t.posSource.requestorIds;if(o)for(var i=0;i<o.length;i++)"group"==o[i].codeType&&(Ie.allCodes.Group=o[i].id),"corporate"==o[i].codeType&&(Ie.allCodes.corporate=o[i].id),"travelagent"==o[i].codeType&&(Ie.allCodes.travelagent=o[i].id),"discount"==o[i].codeType&&(Ie.allCodes.discount=o[i].id);l.debug(JSON.stringify(Ie)+"$rootScope.options2"),void 0!=Ie.allCodes?void 0!=Ie.allCodes.Group?(Ie.ratePlanCode=n.RatesAvail.roomStays[0].roomTypes[0].averageRates[0].roomRateCode,d.fixedMerchandiseCurrency=n.RatesAvail.roomStays[0].roomTypes[0].averageRates[0].merchandisedCurrency,Ie.ratePlanType="Group"):void 0!=t.roomStays&&void 0!=t.roomStays[0].ratePlans&&void 0!=t.roomStays[0].ratePlans[0]&&"Group"==t.roomStays[0].ratePlans[0].ratePlanType?(Ie.ratePlanCode=t.roomStays[0].ratePlans[0].ratePlanCode,d.fixedMerchandiseCurrency=t.roomStays[0].ratePlans[0].merchandisedCurrency,Ie.ratePlanType=t.roomStays[0].ratePlans[0].ratePlanType):a?d.selectedRate&&d.selectedRate.ratePlanCode&&a.currentRate.ratePlanCode!==d.selectedRate.ratePlanCode?(Ie.ratePlanCode=d.selectedRate.ratePlanCode,d.fixedMerchandiseCurrency=d.selectedRate.merchandisedCurrency,Ie.ratePlanType=d.selectedRate.ratePlanType,d.isChangedRateplanFromPricebox=!1):(d.isChangedRateplanFromPricebox?Ie.ratePlanCode=a.currentCode:Ie.ratePlanCode=a.currentRate.ratePlanCode,Ie.ratePlanType=a.currentRate.ratePlanType,d.fixedMerchandiseCurrency=a.currentRate.merchandisedCurrency,d.isChangedRateplanFromPricebox=!1):(Ie.ratePlanCode=d.navFilterData.ratePlanCode.ratePlanCode,Ie.ratePlanType=d.navFilterData.ratePlanCode.ratePlanType,d.fixedMerchandiseCurrency=d.navFilterData.ratePlanCode.merchandisedCurrency):void 0!=t.roomStays&&void 0!=t.roomStays[0].ratePlans&&void 0!=t.roomStays[0].ratePlans[0]&&"Group"==t.roomStays[0].ratePlans[0].ratePlanType?(void 0!=n.RatesAvail.roomStays[0].roomTypes[0].averageRates[0].roomRateCode?Ie.ratePlanCode=n.RatesAvail.roomStays[0].roomTypes[0].averageRates[0].roomRateCode:Ie.ratePlanCode=t.roomStays[0].ratePlans[0].ratePlanCode,Ie.ratePlanType=t.roomStays[0].ratePlans[0].ratePlanType,d.fixedMerchandiseCurrency=t.roomStays[0].ratePlans[0].merchandisedCurrency):a?d.selectedRate&&d.selectedRate.ratePlanCode&&a.currentRate.ratePlanCode!==d.selectedRate.ratePlanCode?(Ie.ratePlanCode=d.selectedRate.ratePlanCode,Ie.ratePlanType=d.selectedRate.ratePlanType,d.fixedMerchandiseCurrency=d.selectedRate.merchandisedCurrency,d.isChangedRateplanFromPricebox=!1):(d.isChangedRateplanFromPricebox?Ie.ratePlanCode=a.currentCode:Ie.ratePlanCode=a.currentRate.ratePlanCode,Ie.ratePlanType=a.currentRate.ratePlanType,d.fixedMerchandiseCurrency=a.currentRate.merchandisedCurrency,d.isChangedRateplanFromPricebox=!1):(Ie.ratePlanCode=d.navFilterData.ratePlanCode.ratePlanCode,Ie.ratePlanType=d.navFilterData.ratePlanCode.ratePlanType,d.fixedMerchandiseCurrency=d.navFilterData.ratePlanCode.merchandisedCurrency),void 0!=v.getMainReservation().roomStays&&v.getMainReservation().roomStays.length>0&&(void 0!=v.getMainReservation().roomStays[0].discountCode&&(Ie.Discount=v.getMainReservation().roomStays[0].discountCode),void 0!=v.getMainReservation().roomStays[0].taCode&&(Ie.taCode=v.getMainReservation().roomStays[0].taCode),void 0!=v.getMainReservation().roomStays[0].groupCode&&(Ie.groupCode=v.getMainReservation().roomStays[0].groupCode),void 0!=v.getMainReservation().roomStays[0].corpCode&&(Ie.Corporate=v.getMainReservation().roomStays[0].corpCode)),e&&(Ie.roomTypeCode=e),A.getIsLoyaltyUserLogIn()&&A.getLoyaltyTierId()&&(Ie.loyaltySignIn=A.getLoyaltyTierId());var s=v.getCurrency()||v.getCurrencyDetails()&&v.getCurrencyDetails().currencyCode;void 0!=s&&(Ie.currencyCode=s);var g=angular.copy(Ie);g.ratePlanCode&&(g.ratePlanCode=g.ratePlanCode.indexOf("M_")>-1?g.ratePlanCode.replace("M_",""):g.ratePlanCode),n.finalServices=angular.copy(g),c.getEnhancementServices(g).then(function(a){d.prevServiceReqOptions=angular.copy(n.finalServices),d.showEnhancement=!1,le=a,d.isServiceAPICalled=!0,ue(e),Re(),y(function(){r.innerWidth<992&&"view_rates"==d.clickbuttonType&&he(d.currentRoom.id,d.rowTypeToShow,d.currentGridRow),d.setBtnPositionOnScroll(d.currentGridRow,null)},1e3)},function(e){d.enableUpfrontEnhancementsIsActive&&(d.enableUpfrontEnhancementsIsActive=!1)}),se=!1}else d.prevServiceReqOptions&&"Group"===d.prevServiceReqOptions.ratePlanType&&ue(e);delete Ie.ratePlanType,delete Ie.ratePlanCode},d.showModel=function(a,t,o,i,s){d.hasDiscountServices&&(t=d.enhancementServices.findIndex(function(e){return e.serviceTypeId===a.serviceTypeId})),"ACCOMMODATIONS"!=r.route&&f.eventTrack("SelectEnhancementFromRoom",{category:"UserNavigation",label:a.serviceTypeId}),"PER_ROOM"==a.servicePricingType&&void 0==a.addAnotherItemVar&&(a.addAnotherItemVar=1),l.debug(JSON.stringify(a)+"enhancementService"),d.doneEnable=!0,void 0==a.tempChecked?a.checked=!1:0==a.tempChecked?a.checked=!1:a.checked=!0,d.showServices="display-block";var c=r.pageYOffset;if(r.innerWidth>767&&r.innerWidth<1023){var m=c-40+"px";d.fromTop=m}else if(r.innerWidth>1023&&r.innerWidth<1200){var m=c-150+"px";d.fromTop=m}else{var m=c-80+"px";d.fromTop=m}if("PER_ROOM"==a.servicePricingType)if(!0===a.checked)d.currentServices=a;else{if(d.currentServices=d.enhancementServices[t],void 0!=d.currentServices.eachDayRate[0].options&&void 0!=d.currentServices.eachDayRate[0].tempOptions&&d.currentServices.eachDayRate[0].options.length<d.currentServices.eachDayRate[0].tempOptions.length){a.addAnotherItemVar=1;var u=angular.copy(d.currentServices.eachDayRate[0].tempOptions);d.currentServices.eachDayRate[0].options=u,delete d.currentServices.eachDayRate[0].isAdded}a.checked=!1}else d.currentServices=a;angular.forEach(d.currentServices.eachDayRate,function(e){1==e.allSelected&&(d.doneEnable=!1),"#898989"!=e.dateColor&&(e.dateColor="#d2d2d2"),"#898989"!=e.adultsColor&&(e.adultsColor="#d2d2d2"),"#898989"!=e.childrenColor&&(e.childrenColor="#d2d2d2"),"#898989"!=e.roomsColor&&(e.roomsColor="#d2d2d2"),"#898989"!=e.optionsColor&&(e.optionsColor="#d2d2d2")});for(var p=0;p<d.currentServices.eachDayRate.length;p++)if(d.currentServices.eachDayRate[p].options.length>0){d.firstIndex=p;break}if("PER_PERSON_PER_NIGHT"==a.servicePricingType||"PER_PERSON"==a.servicePricingType)for(var p=0;p<a.eachDayRate.length;p++)if(a.eachDayRate[p].options.length>0){d.adultsInService=C.numToArray(a.eachDayRate[p].options[0].adultQuantity+1),d.childrenInService=C.numToArray(a.eachDayRate[p].options[0].childQuantity+1);break}if("PER_ROOM_PER_NIGHT"==a.servicePricingType||"PER_ROOM"==a.servicePricingType){var y=n.navData.guestsrooms.placeholder.split("/")[1];d.roomsInservice=C.numToArray(parseInt(y)+1),d.roomsInservice.splice(0,1)}if("PER_ROOM"==a.servicePricingType){var v=0;angular.forEach(a.eachDayRate,function(e,t){a.addAnotherItemVar>1&&e.room>0&&e.options.length>0&&(t>0?(e.options[0].maxLimit=a.maxLimit-v==0?-1:a.maxLimit-v,v+=e.room):(v=e.room,e.options[0].maxLimit=a.maxLimit))})}for(var p=0;p<d.currentServices.eachDayRate.length;p++)"PER_PERSON_PER_NIGHT"!=a.servicePricingType&&"PER_PERSON"!=a.servicePricingType||void 0==d.currentServices.eachDayRate[p].adult&&void 0==d.currentServices.eachDayRate[p].children&&d.currentServices.eachDayRate[p].options.length>0&&(d.adultsInService.length>0&&(d.currentServices.eachDayRate[p].adult=d.adultsInService[d.adultsInService.length-1],d.currentServices.eachDayRate[p].adultIsSelected=!0,d.currentServices.eachDayRate[p].adultsColor="#898989",d.currentServices.eachDayRate[p].dropdownAdult="#eaeaea"),d.childrenInService.length>0&&(d.currentServices.eachDayRate[p].children=d.childrenInService[d.childrenInService.length-1],d.currentServices.eachDayRate[p].childrenIsSelected=!0,d.currentServices.eachDayRate[p].childrenColor="#898989",d.currentServices.eachDayRate[p].dropdownChildren="#eaeaea")),"PER_ROOM_PER_NIGHT"!=a.servicePricingType&&"PER_ROOM"!=a.servicePricingType||void 0==a.eachDayRate[p].room&&a.eachDayRate[p].options.length>0&&d.roomsInservice.length>0&&(d.currentServices.eachDayRate[p].room=d.roomsInservice[d.roomsInservice.length-1],d.currentServices.eachDayRate[p].roomsIsSelected=!0,d.currentServices.eachDayRate[p].roomsColor="#898989",d.currentServices.eachDayRate[p].dropdownRooms="#eaeaea"),"PER_ROOM"==a.servicePricingType&&1==a.eachDayRate[p].isAdded&&void 0==a.eachDayRate[p].selectOption&&(delete a.eachDayRate[p].selectOption,delete a.eachDayRate[p].dropdownOptions,delete a.eachDayRate[p].optionsColor,a.eachDayRate[p].selectOptionIsSelected=!1,delete a.eachDayRate[p].tempSelectOption,delete a.eachDayRate[p].isAdded,1!=a.addAnotherItemVar&&(a.addAnotherItemVar=a.addAnotherItemVar-1,a.eachDayRate[p].options=[]));if(1!=d.currentServices.checked&&1==d.currentServices.serviceOptions.length)for(var p=0;p<d.currentServices.eachDayRate.length;p++)void 0==d.currentServices.eachDayRate[p].selectOptionIsSelected&&(d.currentServices.eachDayRate[p].selectOptionIsSelected=!0),"PER_RESERVATION"==d.currentServices.servicePricingType&&1==d.currentServices.eachDayRate[p].selectOptionIsSelected&&(d.currentServices.eachDayRate[p].selectOption=d.currentServices.eachDayRate[p].options[0],d.currentServices.eachDayRate[p].optionsColor="#898989",d.currentServices.eachDayRate[p].dropdownOptions="#eaeaea",d.currentServices.eachDayRate[p].date=d.currentServices.eachDayRate[p].serviceDate,d.currentServices.eachDayRate[p].dateColor="#898989",d.currentServices.eachDayRate[p].dropdownDate="#eaeaea",void 0!=d.currentServices.eachDayRate[p].date&&void 0!=d.currentServices.eachDayRate[p].selectOption&&(d.currentServices.eachDayRate[p].allSelected=!0,d.doneEnable=!1)),"PER_PERSON_PER_NIGHT"!=d.currentServices.servicePricingType&&"PER_PERSON"!=d.currentServices.servicePricingType||1==d.currentServices.eachDayRate[p].selectOptionIsSelected&&(d.currentServices.eachDayRate[p].selectOption=d.currentServices.eachDayRate[p].options[0],d.currentServices.eachDayRate[p].optionsColor="#898989",d.currentServices.eachDayRate[p].dropdownOptions="#eaeaea",void 0!=d.currentServices.eachDayRate[p].adult&&void 0!=d.currentServices.eachDayRate[p].selectOption&&(d.currentServices.eachDayRate[p].allSelected=!0,d.doneEnable=!1)),"PER_ROOM"!=d.currentServices.servicePricingType&&"PER_ROOM_PER_NIGHT"!=d.currentServices.servicePricingType||1==d.currentServices.eachDayRate[p].selectOptionIsSelected&&(d.currentServices.eachDayRate[p].selectOption=d.currentServices.eachDayRate[p].options[0],d.currentServices.eachDayRate[p].optionsColor="#898989",d.currentServices.eachDayRate[p].dropdownOptions="#eaeaea",void 0!=d.currentServices.eachDayRate[p].room&&void 0!=d.currentServices.eachDayRate[p].selectOption&&(d.currentServices.eachDayRate[p].allSelected=!0,d.doneEnable=!1));var h=T.getTotalEnhancement(a),R=h.totalPrice,P=h.totalfinalPrice,S=h.packageTotalFinalPrice,A=h.packageTotalFinalPriceDisc;R>0&&(d.enhancementFlag=!0,d.zeroDiscountApplied=h.zeroDiscountApplied),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(d.totalPrice=parseFloat(R).toFixed(2),d.totalFinalPrice=parseFloat(P).toFixed(2),d.packageTotalFinalPrice=parseFloat(S).toFixed(2),(d.hasDiscountServices||d.zeroDiscountApplied||A>0)&&(d.packageTotalFinalPriceDiscount=parseFloat(A).toFixed(2))):(d.totalPrice=parseFloat(R).toFixed(0),d.totalFinalPrice=parseFloat(P).toFixed(0),d.packageTotalFinalPrice=parseFloat(S).toFixed(0),(d.hasDiscountServices||d.zeroDiscountApplied||A>0)&&(d.packageTotalFinalPriceDiscount=parseFloat(A).toFixed(0))),e.onModalOpen(s,"accommodationPage-enhancement-modal","enhancement-title",!1,d.goBack,a)},d.addAnotherItem=function(e,a){var t=angular.copy(a.eachDayRate[0]);if(t.allSelected=!1,t.roomsIsSelected=!0,t.selectOptionIsSelected=!1,t.roomsColor="#898989",t.optionsColor="#d2d2d2",t.room=d.roomsInservice[d.roomsInservice.length-1],delete t.adultsColor,delete t.dropdownOptions,delete t.temRooms,delete t.selectOption,delete t.tempSelectOption,l.debug(JSON.stringify(a)+"asd"),l.debug(JSON.stringify(t)+"tempEach"),void 0!=a.eachDayRate[a.addAnotherItemVar]){if(l.debug(a.eachDayRate[0].tempOptions.length),a.eachDayRate[a.addAnotherItemVar].tempOptions=a.eachDayRate[0].tempOptions,0==a.eachDayRate[a.addAnotherItemVar].options.length){for(var o=t.options.length-1;o>=0;o--)for(var r=0;r<a.eachDayRate.length;r++)if(void 0!=a.eachDayRate[r].selectOption&&a.eachDayRate[r].selectOption.serviceOptionId==t.options[o].serviceOptionId){t.options.splice(o,1);break}a.eachDayRate[a.addAnotherItemVar]=t,a.eachDayRate[a.addAnotherItemVar].isAdded=!0}}else{for(var o=t.options.length-1;o>=0;o--)for(var r=0;r<a.eachDayRate.length;r++)if(void 0!=a.eachDayRate[r].selectOption&&a.eachDayRate[r].selectOption.serviceOptionId==t.options[o].serviceOptionId){t.options.splice(o,1);break}t.isAdded=!0,
a.eachDayRate.push(t)}if(a.addAnotherItemVar++,l.debug(JSON.stringify(a)+"currentServices"),"PER_ROOM"==a.servicePricingType){var n=0;angular.forEach(a.eachDayRate,function(e,t){a.addAnotherItemVar>1&&a.eachDayRate[0].serviceDate===e.serviceDate&&e.room>0&&e.options.length>0&&(t>0?(e.options[0].maxLimit=a.maxLimit-n==0?-1:a.maxLimit-n,n+=e.room):(n=e.room,e.options[0].maxLimit=a.maxLimit))})}},d.deleteEnhancementConfirmation=function(a,t){d.deleteServiceInfo=a,p.scrollTopAnimated(0,1e3),d.deleteConfirmationPopup="display-block",e.onModalOpen("delete-enhancement--"+t+"-id","delete-enhancement-modal-id","delete-enhancement-modal-header-id",!1,d.canceldeleteEnhancement)},d.canceldeleteEnhancement=function(){d.deleteConfirmationPopup="display-none",e.onModalClose()},d.deleteEnhancement=function(){e.onModalClose();var a=d.deleteServiceInfo;v.deleteEnhancement(a),d.deleteConfirmationPopup="display-none",l.debug(d.enhancementServices),angular.forEach(d.enhancementServices,function(e,t){e.serviceTypeId==a.serviceTypeId&&(d.enhancementServices[t].checked=!1,d.enhancementServices[t].tempChecked=!1)}),d.clearAllSelections(a,d.enhancementServices),v.revertServices(),v.modifyMainReservation(d.enhancementServices);var t=v.getMainReservation();Q&&c.modifyHoldReservation(Ce,t,!0).success(function(e){v.handleXssVulnerabilities(e),b.setMyCheckRefershTokenDetails(e),v.setReservation(e)}).error(function(e){m.clear(),m.pop({type:"error",title:"",body:"Modify hold reservation error in total"})})},d.clearAllSelections=function(e,a,t,o,n){if(1==e.checked)e.checked=!1,d.showModel(e,t,o,n);else if("ACCOMMODATIONS"!=r.route&&f.eventTrack("SelectEnhancementFromRoom",{category:"UserNavigation",label:e.serviceTypeId}),delete e.date,delete e.price,delete e.finalPrice,delete e.priceDisc,delete e.finalPriceDisc,delete e.adult,delete e.children,delete e.rooms,delete e.days,delete e.tempChecked,angular.forEach(e.eachDayRate,function(e){delete e.date,delete e.tempDate,delete e.dateIsSelected,delete e.dateColor,delete e.dropdownDate,delete e.adult,delete e.tempAdult,delete e.adultIsSelected,delete e.adultsColor,delete e.dropdownAdult,delete e.children,delete e.dropdownChildren,delete e.childrenIsSelected,delete e.childrenColor,delete e.dropdownRooms,delete e.roomsIsSelected,delete e.roomsColor,delete e.room,delete e.dropdownOptions,delete e.optionsColor,delete e.tempChecked,delete e.selectOptionIsSelected,delete e.selectOption,delete e.tempSelectOption,delete e.isChecked,delete e.allSelected,delete e.oldPriceArray,delete e.resOwnAmount,delete e.resOwnDiscountAmount,delete e.resOwnServiceDate,delete e.oldTotalAdult,delete e.oldTotalChild,delete e.oldTotalRoom,angular.forEach(e.options,function(e){delete e.oldPriceArray,delete e.oldTotalRoom})}),void 0!=d.enhancementServices){d.subTotalFinalPrice=0,d.totalPrice=0;for(var i=0;i<d.enhancementServices.length;i++)l.debug(JSON.stringify(d.enhancementServices)+"$scope.enhancementServices for final"),d.enhancementServices[i].discountRuleId||d.enhancementServices[i].finalPriceDisc>0?void 0!=d.subTotalFinalPrice&&void 0!=d.enhancementServices[i].finalPriceDisc?(d.subTotalFinalPrice=d.subTotalFinalPrice+d.enhancementServices[i].finalPriceDisc,d.totalPrice=d.totalPrice+d.enhancementServices[i].priceDisc):void 0!=d.enhancementServices[i].finalPriceDisc&&(d.subTotalFinalPrice=d.enhancementServices[i].finalPriceDisc,d.totalPrice=d.enhancementServices[i].priceDisc):void 0!=d.subTotalFinalPrice&&void 0!=d.enhancementServices[i].finalPrice?(d.subTotalFinalPrice=d.subTotalFinalPrice+d.enhancementServices[i].finalPrice,d.totalPrice=d.totalPrice+d.enhancementServices[i].price):void 0!=d.enhancementServices[i].finalPrice&&(d.subTotalFinalPrice=d.enhancementServices[i].finalPrice,d.totalPrice=d.enhancementServices[i].price)}d.enhancementFlag=!1;for(var i=0;i<a.length;i++)1==a[i].checked&&(d.enhancementFlag=!0);if("PER_ROOM"==a.servicePricingType){var s=0;angular.forEach(a.eachDayRate,function(e,t){a.addAnotherItemVar>1&&a.eachDayRate[0].serviceDate===e.serviceDate&&e.room>0&&e.options.length>0&&(t>0?(e.options[0].maxLimit=a.maxLimit-s==0?-1:a.maxLimit-s,s+=e.room):(s=e.room,e.options[0].maxLimit=a.maxLimit))})}if("PER_RESERVATION"==e.servicePricingType)for(var i=0;i<e.eachDayRate.length;i++)if(e.eachDayRate[i].options.length>0){e.eachDayRate[i].options=[],delete e.eachDayRate[i].tempAllSelected,delete e.eachDayRate[i].tempIsSelected,delete e.eachDayRate[i].tempReservationOptions;for(var c=0;c<e.serviceOptions.length;c++)for(var g=0;g<e.serviceOptions[c].dailyRates.length;g++)e.eachDayRate[i].serviceDate==e.serviceOptions[c].dailyRates[g].serviceDate&&e.eachDayRate[i].options.push(e.serviceOptions[c].dailyRates[g])}};var fe=function(e){for(var a=0,t=0;t<e.eachDayRate.length;t++)e.eachDayRate[t].options.length>0&&a++;a>1&&(e.UseSelection=!0);for(var t=0;t<e.eachDayRate.length;t++)void 0!=e.eachDayRate[t].adult||"PER_PERSON_PER_NIGHT"==e.servicePricingType&&"PER_PERSON"==e.servicePricingType||(e.hideAgain=!1),"PER_PERSON_PER_NIGHT"!=e.servicePricingType&&"PER_PERSON"!=e.servicePricingType||(d.doneEnable=!0,void 0!=e.eachDayRate[t].selectOption&&void 0!=e.eachDayRate[t].adult?d.doneEnable=!1:d.doneEnable=!0);for(var o,t=0;t<e.eachDayRate.length;t++){if(!("PER_PERSON_PER_NIGHT"!=e.servicePricingType&&"PER_PERSON"!=e.servicePricingType||(o=!1,void 0==e.eachDayRate[t].selectOption||void 0==e.eachDayRate[t].adult&&void 0==e.eachDayRate[t].children))){o=!0;break}if(("PER_ROOM_PER_NIGHT"==e.servicePricingType||"PER_ROOM"==e.servicePricingType)&&(o=!1,void 0!=e.eachDayRate[t].selectOption&&void 0!=e.eachDayRate[t].room)){o=!0;break}}"PER_RESERVATION"!=e.servicePricingType&&(d.doneEnable=0==o);for(var t=0;t<e.eachDayRate.length;t++)void 0!=e.eachDayRate[t].room||"PER_ROOM"==e.servicePricingType&&"PER_ROOM_PER_NIGHT"==e.servicePricingType||(e.hideAgain=!1);for(var t=0;t<e.eachDayRate.length;t++)void 0!=e.eachDayRate[t].children||void 0==d.childrenInService||"PER_PERSON_PER_NIGHT"!=e.servicePricingType&&"PER_PERSON"!=e.servicePricingType||d.childrenInService.length>1&&(e.hideAgain=!1);for(var t=0;t<e.eachDayRate.length;t++)void 0==e.eachDayRate[t].selectOption&&(e.hideAgain=!1);var r=T.getTotalEnhancement(e),n=r.totalPrice,i=r.totalfinalPrice,s=r.packageTotalFinalPrice,l=r.packageTotalFinalPriceDisc;n>0&&(d.enhancementFlag=!0,d.zeroDiscountApplied=r.zeroDiscountApplied);var c=!0,m=!1;d.totalPrice=n,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(d.totalPrice=parseFloat(n).toFixed(2),d.totalFinalPrice=parseFloat(i).toFixed(2),d.packageTotalFinalPrice=parseFloat(s).toFixed(2),(d.hasDiscountServices||d.zeroDiscountApplied||l>0)&&(d.packageTotalFinalPriceDiscount=parseFloat(l).toFixed(2))):(d.totalPrice=parseFloat(n).toFixed(0),d.totalFinalPrice=parseFloat(i).toFixed(0),d.packageTotalFinalPrice=parseFloat(s).toFixed(0),(d.hasDiscountServices||d.zeroDiscountApplied||l>0)&&(d.packageTotalFinalPriceDiscount=parseFloat(l).toFixed(0)));var u=angular.copy(e);if(S.remove(u.eachDayRate,function(e){return 0===e.options.length?e:""}),"PER_ROOM"==e.servicePricingType){var p=0;angular.forEach(e.eachDayRate,function(a,t){e.addAnotherItemVar>1&&e.eachDayRate[0].serviceDate===a.serviceDate&&a.room>0&&a.options.length>0&&(t>0?(a.options[0].maxLimit=e.maxLimit-p==0?-1:e.maxLimit-p,p+=a.room):(p=a.room,a.options[0].maxLimit=e.maxLimit))})}angular.forEach(u.eachDayRate,function(e){e.allSelected||(c=!1),"PER_PERSON_PER_NIGHT"!=u.servicePricingType&&"PER_PERSON"!=u.servicePricingType||(d.doneEnable=!0,0!=e.options[0].adultQuantity&&0!=e.options[0].childQuantity?void 0!==e.selectOption&&(0===e.options[0].adultQuantity||void 0!==e.adult&&0!==e.adult||0===e.options[0].childQuantity||void 0!==e.children&&0!==e.children)&&(m=!0):void 0!==e.selectOption&&(0===e.options[0].adultQuantity||void 0!==e.adult&&0!==e.adult)&&(0===e.options[0].childQuantity||void 0!==e.children&&0!==e.children)&&(m=!0))}),"PER_PERSON_PER_NIGHT"!=u.servicePricingType&&"PER_PERSON"!=u.servicePricingType||(d.doneEnable=!m),e.eachDayRate[d.firstIndex].isChecked=!!c};d.allSelectedChanged=function(e,a){0==e.allSelected?(delete e.adult,delete e.dropdownAdult,e.adultsColor="#d2d2d2",delete e.children,delete e.dropdownChildren,e.roomsColor="#d2d2d2",delete e.room,delete e.dropdownRooms,e.childrenColor="#d2d2d2",delete e.selectOption,delete e.dropdownOptions,delete e.date,delete e.dropdownDate,e.optionsColor="#d2d2d2",e.dateColor="#d2d2d2",fe(a),"PER_RESERVATION"==a.servicePricingType&&(d.doneEnable=!0),console.log("======================================="),console.log(d.firstIndex),void 0!=d.firstIndex&&(a.eachDayRate[d.firstIndex].isChecked=!1)):((void 0!=d.adultsInService&&d.adultsInService.length>0&&"PER_PERSON_PER_NIGHT"==a.servicePricingType||"PER_PERSON"==a.servicePricingType)&&(e.adult=d.adultsInService[d.adultsInService.length-1],d.changeDropdownAdult(e,a)),void 0!=e.serviceDates&&e.serviceDates.length>0&&"PER_RESERVATION"==a.servicePricingType&&(e.date=e.serviceDates[0],d.changeDropdownDate(e,a)),void 0!=d.childrenInService&&d.childrenInService.length>0&&("PER_PERSON_PER_NIGHT"==a.servicePricingType||"PER_PERSON"==a.servicePricingType)&&(e.children=d.childrenInService[d.childrenInService.length-1],d.changeDropdownChildren(e,a)),void 0!=d.roomsInservice&&d.roomsInservice.length>0&&("PER_ROOM_PER_NIGHT"==a.servicePricingType||"PER_ROOM"==a.servicePricingType)&&(e.room=d.roomsInservice[d.roomsInservice.length-1],d.changeDropdownRoom(e,a)),e.selectOption=e.options[0],d.changeDropdownOptions(e,a));var t=document.getElementById("enhancementDetail");t&&t.focus()},d.totalServices={},d.setUpDateOption=function(e,a){if(e.dateDropdownOption={},e&&e.serviceDates&&a&&a.serviceOptions)for(var t=0;t<e.serviceDates.length;t++)for(var o=0;o<a.serviceOptions.length;o++)for(var r=0;r<a.serviceOptions[o].dailyRates.length;r++)if(e.serviceDates[t]==a.serviceOptions[o].dailyRates[r].serviceDate){var n=e.serviceDates[t];e.dateDropdownOption[n]=a.serviceOptions[o].dailyRates[r];for(var i=0;i<a.eachDayRate.length;i++)void 0!=e.resOwnServiceDate&&e.resOwnServiceDate==e.serviceDates[i]&&void 0!=e.resOwnAmount&&e.dateDropdownOption[e.serviceDates[i]]&&(e.dateDropdownOption[e.serviceDates[i]].resOwnAmount=e.resOwnAmount,e.dateDropdownOption[e.serviceDates[i]].resOwnDiscountAmount=e.resOwnDiscountAmount)}},d.changeDropdownDate=function(e,a){e.dateColor="#898989",e.dropdownDate="#eaeaea";var t;if("PER_RESERVATION"==a.servicePricingType){void 0!=e.date&&void 0!=e.selectOption&&(e.allSelected=!0,d.doneEnable=!1,t=angular.copy(e.selectOption)),e.options=[];for(var o=0;o<a.serviceOptions.length;o++)for(var r=0;r<a.serviceOptions[o].dailyRates.length;r++)e.date==a.serviceOptions[o].dailyRates[r].serviceDate&&e.options.push(a.serviceOptions[o].dailyRates[r]),e.optionsColor="#d2d2d2",delete e.selectOption,delete e.dropdownOptions}if(t)for(var o=0;o<e.options.length;o++)e.options[o].serviceOptionId===t.serviceOptionId&&(e.selectOption=e.options[o],e.optionsColor="#898989",e.dropdownOptions="#eaeaea");L(e,a),fe(a)},d.changeDropdownAdult=function(e,a){if(l.debug(JSON.stringify(e)+"this is adult"),e.adultsColor="#898989",e.dropdownAdult="#eaeaea","PER_PERSON_PER_NIGHT"!=a.servicePricingType&&"PER_PERSON"!=a.servicePricingType||void 0!=e.adult&&void 0!=e.selectOption&&(e.allSelected=!0,d.doneEnable=!1),fe(a),"PER_PERSON_PER_NIGHT"==a.servicePricingType)for(var t=0;t<a.eachDayRate.length;t++)if(1==a.eachDayRate[t].isChecked)for(var o=0;o<a.eachDayRate.length;o++)a.eachDayRate[o].adult!=e.adult&&(a.eachDayRate[t].isChecked=!1);L(e,a)},d.changeDropdownChildren=function(e,a){if(e.childrenColor="#898989",e.dropdownChildren="#eaeaea","PER_PERSON_PER_NIGHT"!=a.servicePricingType&&"PER_PERSON"!=a.servicePricingType||(void 0!=e.adult&&void 0!=e.selectOption&&(e.allSelected=!0,d.doneEnable=!1),void 0!=e.children&&void 0!=e.selectOption&&(e.allSelected=!0,d.doneEnable=!1)),fe(a),"PER_PERSON_PER_NIGHT"==a.servicePricingType)for(var t=0;t<a.eachDayRate.length;t++)if(1==a.eachDayRate[t].isChecked)for(var o=0;o<a.eachDayRate.length;o++)a.eachDayRate[o].children!=e.children&&(a.eachDayRate[t].isChecked=!1);L(e,a)},d.changeDropdownRoom=function(e,a){if(e.roomsColor="#898989",e.dropdownRooms="#eaeaea","PER_ROOM"!=a.servicePricingType&&"PER_ROOM_PER_NIGHT"!=a.servicePricingType||void 0!=e.room&&void 0!=e.selectOption&&(e.allSelected=!0,d.doneEnable=!1),fe(a),"PER_ROOM_PER_NIGHT"==a.servicePricingType)for(var t=0;t<a.eachDayRate.length;t++)if(1==a.eachDayRate[t].isChecked)for(var o=0;o<a.eachDayRate.length;o++)a.eachDayRate[o].room!=e.room&&(a.eachDayRate[t].isChecked=!1);L(e,a)},d.changeDropdownOptions=function(e,a){if(e.optionsColor="#898989",e.dropdownOptions="#eaeaea","PER_PERSON_PER_NIGHT"!=a.servicePricingType&&"PER_PERSON"!=a.servicePricingType||(void 0!=e.adult&&void 0!=e.selectOption&&(e.allSelected=!0,d.doneEnable=!1),void 0!=e.children&&void 0!=e.selectOption&&(e.allSelected=!0,d.doneEnable=!1)),"PER_ROOM"!=a.servicePricingType&&"PER_ROOM_PER_NIGHT"!=a.servicePricingType||void 0!=e.room&&void 0!=e.selectOption&&(e.allSelected=!0,d.doneEnable=!1),"PER_RESERVATION"==a.servicePricingType&&void 0!=e.selectOption&&void 0!=e.date&&(e.allSelected=!0,d.doneEnable=!1),"PER_ROOM"==a.servicePricingType&&(void 0==e.selectOption||e.selectOption.oldPriceArray||angular.forEach(e.options,function(a){!e.selectOption.oldPriceArray&&a.oldPriceArray&&a.oldPriceArray.length>0&&(e.selectOption.oldPriceArray=a.oldPriceArray,e.selectOption.oldDiscountedPerRoomCount=a.oldDiscountedPerRoomCount,e.selectOption.oldTotalRoom=a.oldTotalRoom)})),fe(a),"PER_ROOM_PER_NIGHT"==a.servicePricingType||"PER_PERSON_PER_NIGHT"==a.servicePricingType)for(var t=0;t<a.eachDayRate.length;t++)if(1==a.eachDayRate[t].isChecked)for(var o=0;o<a.eachDayRate.length;o++)void 0!=a.eachDayRate[o].selectOption&&a.eachDayRate[o].selectOption.serviceOptionName!=e.selectOption.serviceOptionName&&(a.eachDayRate[t].isChecked=!1);L(e,a)},d.changedCheckBoxSecond=function(e,a){1==e.isChecked&&(angular.forEach(a.eachDayRate,function(t){if(void 0!=e.adult&&t.options.length>0&&(t.adult=e.adult,t.adultsColor="#898989",t.dropdownAdult="#eaeaea"),void 0!=e.children&&t.options.length>0&&(t.children=e.children,t.childrenColor="#898989",t.dropdownChildren="#eaeaea"),void 0!=e.room&&t.options.length>0&&(t.room=e.room,t.roomsColor="#898989",t.dropdownRooms="#eaeaea"),e.selectOption)for(var o=0;o<t.options.length;o++)t.options[o].serviceOptionId==e.selectOption.serviceOptionId&&(t.selectOption=t.options[o],t.optionsColor="#898989",t.dropdownOptions="#eaeaea");t.allSelected=!0,t.options.length>0&&L(t,a),fe(a)}),a.hideAgain=!0)},d.changeLimit=function(e,a){4==d.servicesLimit?(d.hideMoreEnhancementScrollTop=window.pageYOffset,d.servicesLimit=100,d.hideMoreEnhancement=!0):100==d.servicesLimit&&(p.scrollTop(d.hideMoreEnhancementScrollTop),d.servicesLimit=4,d.hideMoreEnhancement=!1),setTimeout(function(){var t=document.getElementById("edit-enhancement-id-0-"+e+"-"+a);t&&t.focus()}),f.eventTrack("ClickViewMoreEnhancementsFromRoom",{category:"UserNavigation",label:"View more enhancements on the Room details page"})};var Ce=g.getHotelInfo().hotelCode,Pe=v.getMainReservation(),Se=v.getAgeCollection(),Ae=(v.getAllCode(),g.getOccupancyInfo()),Ie=(d.translate,{}),be=Pe.roomStays;(void 0===be||void 0!=be&&be.length>0&&void 0!=be[0].roomRates&&be[0].roomRates.length>0&&void 0==be[0].roomRates[0].roomTypeCode)&&(!1===v.getVisitedAccomodationPage()&&!1===v.getDatesChanged()&&"accommodation.room"==u.current.name?y(function(){G(n.translate.global_message_AccomodationMsg),v.setVisitedAccomodationPage(!0)},0):!0===v.getDatesChanged()&&y(function(){G(n.translate.page_weveadjustedyourdates_ExcellentDatesAdjustMsg),v.setVisitedAccomodationPage(!0),v.setDatesChanged(!1)},0)),d.$on("EVENT.RES_SELECTION_CHANGE_GROUP",function(e,a){var t=v.getAllCode();if(void 0!=t&&Object.keys(t).length>0){var o=v.getCodeTypes();l.debug(JSON.stringify(o)+"  reservation Code type in Acco");for(var r=0;r<o.length;r++)if("group"==o[r].toLowerCase()){n.accommodations=!0,void 0==R.stepsById.accommodations.group&&(R.stepsById.accommodations.group=[]);var i={};i.codeType=o[r],i.id=v.getCodeValue(o[r]),void 0!=v.getGroup()&&(i.name=v.getGroup().groupName),R.stepsById.accommodations.group.push(i),R.stepsById.accommodations.placeholder=i.name}}}),F(),v.getConfig("isAltHotelsReq")&&(Ie.isAltHotelsReq=!0,v.deleteConfig("isAltHotelsReq")),Ie=v.passPromotionIdInApi(Ie);var De;A.getIsLoyaltyUserLogIn()&&A.setRecallAvailAsync(!0),c.getAccommodationRooms(Ie).getAllRooms().then(function(i){function s(){v.getConfig("CLICK_STREAM_Modify_ROOMSELECTOR")?v.deleteConfig("CLICK_STREAM_Modify_ROOMSELECTOR"):d.toggleAcc.roomsView?d.toggleAcc.gridView?f.eventTrack("ClickRoomGridView",{category:"UserNavigation",label:"Grid view from the Rooms page"}):d.toggleAcc.listView&&f.eventTrack("ClickRoomListVIew",{category:"UserNavigation",label:"List view from the Rooms page"}):d.toggleAcc.packageView&&(d.toggleAcc.gridView?f.eventTrack("ClickPackageGridView",{category:"UserNavigation",label:"Grid view from the Packages page"}):d.toggleAcc.listView&&f.eventTrack("ClickPackageListView",{category:"UserNavigation",label:"List view from the Packages page"}))}function P(e){e=e.slice();for(var a=0,t=0;t<e.length;t++)e[t].id=a,a++}function T(e){d.moreOptions=!1,1==!e.isSelected?e.isSelected=!0:e.isSelected=!1}function E(e){d.myGridNumber=e}function M(e){1==!e.isSelected?e.isSelected=!0:e.isSelected=!1}function L(e){d.myPackageGridNumber=e}function B(){y(n.closeDrawer,2e3);var e=R.stepsById.guestsrooms,a=0,t=R.stepsById.accommodations.rooms;angular.forEach(t,function(e){void 0==e.packageCode&&a++}),"S"!==e.placeholder[0]?(n.numberOfGuests=Number(e.placeholder[0]),n.numberOfRooms=Number(e.placeholder.split("/")[1].trim()),Xe=a?n.numberOfRooms-a:n.numberOfRooms):l.debug("You need to set the number of guests for your stay!");var o=R.stepsById.dates;"Select"!==o.placeholder?(void 0==o.endDate&&(o.endDate=v.getMainReservation().resGlobalInfo.timeSpan.end,o.startDate=v.getMainReservation().resGlobalInfo.timeSpan.start),n.numberOfDays=Math.abs(moment.utc(o.endDate).diff(moment.utc(o.startDate),"days"))):l.debug("You need to select the dates of stay for your trip!")}function x(){var e=document.querySelector(".HeaderButton-label"),a=document.querySelector(".gsplash-heading"),t=document.querySelector(".Footer-wrap"),o=document.querySelector(".CardGrid-price")||document.querySelector(".CardList-price"),r="",n="",i="",s="",l="";if(e&&(r=getComputedStyle(e).color,s=".CardGrid.is-selected .CardGrid-summary-offerings .SVGIcon .tile-icon-stroke * {stroke: "+r+"; color:"+r+"}"),a&&(n=getComputedStyle(a).borderColor,s=s+" .CardGrid:not(.is-selected) .CardGrid-summary-offerings .SVGIcon .tile-icon-stroke * { stroke:"+n+"; color:"+n+" } .CardList:not(.is-selected) .CardList-summary-offerings .SVGIcon .tile-icon-stroke * { stroke:"+n+"; color:"+n+" }"),t&&(i=getComputedStyle(t).backgroundColor,s=s+" .room-icon-stroke * {stroke: "+i+"}"),o&&(l=getComputedStyle(o).color,s=s+" .CardGrid-price .icon-container .member-rate-icon .SVGIcon svg * {stroke: "+l+"} .CardList-price .member-rate-icon .SVGIcon svg * {stroke: "+l+"}"),s){var c=document.createElement("style");c.type="text/css",c.innerHTML=s,document.getElementsByTagName("head")&&document.getElementsByTagName("head")[0]&&document.getElementsByTagName("head")[0].appendChild(c)}}v.validateAvailForPromotions(i.data),1==Ie.isAltHotelsReq&&delete Ie.isAltHotelsReq,n.RatesAvail=$?O.createDuplicateRateList(i.data):i.data,De=angular.copy(n.RatesAvail),C.getObjectData("UPDATED_NAV_DATA_MANAGE_URL")||n.$broadcast("EVENT.UPDATE_NAVBAR_FROM_MANAGE_URL"),0!=n.RatesAvail.roomStays[0].roomCategories.length&&n.RatesAvail.roomStays[0].roomCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageCategories&&0!=n.RatesAvail.roomStays[0].packageCategories.length&&n.RatesAvail.roomStays[0].packageCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].ratePlans&&0!=n.RatesAvail.roomStays[0].ratePlans.length&&n.RatesAvail.roomStays[0].ratePlans.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),0!=n.RatesAvail.roomStays[0].roomTypes.length&&n.RatesAvail.roomStays[0].roomTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageTypes&&0!=n.RatesAvail.roomStays[0].packageTypes.length&&n.RatesAvail.roomStays[0].packageTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var w=0;w<n.RatesAvail.roomStays[0].roomCategories.length;w++){for(var H=!1,V=0;V<n.RatesAvail.roomStays[0].roomTypes.length;V++)n.RatesAvail.roomStays[0].roomTypes[V].categoryCode==n.RatesAvail.roomStays[0].roomCategories[w].categoryCode&&(H=!0);0==H&&(n.RatesAvail.roomStays[0].roomCategories.splice(w,1),w--)}if(void 0!=n.RatesAvail.roomStays[0].packageCategories){for(var w=0;w<n.RatesAvail.roomStays[0].packageCategories.length;w++){for(var H=!1,V=0;V<n.RatesAvail.roomStays[0].packageTypes.length;V++)n.RatesAvail.roomStays[0].packageTypes[V].categoryCode==n.RatesAvail.roomStays[0].packageCategories[w].categoryCode&&(H=!0);0==H&&(n.RatesAvail.roomStays[0].packageCategories.splice(w,1),w--)}0==n.RatesAvail.roomStays[0].packageCategories.length&&(d.categorizePackageHide=!0)}else d.categorizePackageHide=!0;if(0==n.RatesAvail.roomStays[0].roomCategories.length&&(d.categorizeHide=!0),void 0!=n.RatesAvail.roomStays[0].packageTypes)for(var w=0;w<n.RatesAvail.roomStays[0].packageTypes.length;w++)n.RatesAvail.roomStays[0].packageTypes[w].inclusions.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});d.toggleAcc={listView:!1,gridView:!1,roomsView:!1,packageView:!1},d.updateStickyArray=function(){Stickyfill.kill();for(var e=document.getElementsByClassName("js-sticky"),a=e.length-1;a>=0;a--)Stickyfill.add(e[a],90);Stickyfill.rebuild()};var q=n.RatesAvail.roomStays[0].roomTypes,J=n.RatesAvail.roomStays[0].packageTypes;q.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"}),void 0!=J&&J.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"}),d.goGrid=function(){if(d.preRoom=null,d.categorized)for(var e=0;e<d.categorized.length;e++)for(var a=0;a<d.categorized[e].categoryRooms.length;a++)for(var t=0;t<d.categorized[e].categoryRooms[a].categoryRoom.length;t++)if(1==d.categorized[e].categoryRooms[a].categoryRoom[t].isSelected){d.closeRoomDetail(d.categorized[e].categoryRooms[a].categoryRoom[t]);for(var o=0;o<d.categorized[e].categoryRooms[a].categoryRoom[t].media.length;o++)0==d.categorized[e].categoryRooms[a].categoryRoom[t].media[o].sortOrder?d.categorized[e].categoryRooms[a].categoryRoom[t].media[o].active=!0:d.categorized[e].categoryRooms[a].categoryRoom[t].media[o].active=!1;d.categorized[e].categoryRooms[a].categoryRoom[t].myStyle="#116eb5"}if(d.categorizedPackages)for(var e=0;e<d.categorizedPackages.length;e++)for(var a=0;a<d.categorizedPackages[e].categoryPackages.length;a++)for(var t=0;t<d.categorizedPackages[e].categoryPackages[a].categoryPackage.length;t++)1==d.categorizedPackages[e].categoryPackages[a].categoryPackage[t].isSelected&&(d.closePackageDetail(d.categorizedPackages[e].categoryPackages[a].categoryPackage[t]),d.categorizedPackages[e].categoryPackages[a].categoryPackage[t].myStyle="#116eb5");if(d.categorized)for(var e=0;e<d.categorized.length;e++)for(var a=0;a<d.categorized[e].categoryRooms.length;a++)for(var t=0;t<d.categorized[e].categoryRooms[a].categoryRoom.length;t++)d.categorized[e].categoryRooms[a].categoryRoom[t].isSelected=!1;if(d.categorizedPackages)for(var e=0;e<d.categorizedPackages.length;e++)for(var a=0;a<d.categorizedPackages[e].categoryPackages.length;a++)for(var t=0;t<d.categorizedPackages[e].categoryPackages[a].categoryPackage.length;t++)d.categorizedPackages[e].categoryPackages[a].categoryPackage[t].isSelected=!1;d.toggleAcc.listView=!1,d.toggleAcc.gridView=!0,d.state="grid",s()},d.goList=function(){if(d.preRoom=null,d.toggleAcc.listView=!0,d.toggleAcc.gridView=!1,d.state="list",void 0!=d.categorized)for(var e=0;e<d.categorized.length;e++)for(var a=0;a<d.categorized[e].categoryRooms.length;a++)for(var t=0;t<d.categorized[e].categoryRooms[a].categoryRoom.length;t++)if(1==d.categorized[e].categoryRooms[a].categoryRoom[t].isSelected&&(d.categorized[e].categoryRooms[a].categoryRoom[t].myStyle="#116eb5",d.priceSlide.priceSlide=void 0,d.closeRoomDetail(d.categorized[e].categoryRooms[a].categoryRoom[t]),void 0!=d.navFilterData.ratePlanCode.ratePlanCode)){d.priceSlide.priceSlide=d.navFilterData.ratePlanCode.ratePlanCode;break}s()};var X,Z,ee,ce=function(){if(d.categorized)for(var e=0;e<d.categorized.length;e++)for(var a=0;a<d.categorized[e].categoryRooms.length;a++)for(var t=0;t<d.categorized[e].categoryRooms[a].categoryRoom.length;t++)1==d.categorized[e].categoryRooms[a].categoryRoom[t].isSelected&&(d.closeRoomDetail(d.categorized[e].categoryRooms[a].categoryRoom[t]),d.categorized[e].categoryRooms[a].categoryRoom[t].myStyle="#116eb5");if(d.categorizedPackages)for(var e=0;e<d.categorizedPackages.length;e++)for(var a=0;a<d.categorizedPackages[e].categoryPackages.length;a++)for(var t=0;t<d.categorizedPackages[e].categoryPackages[a].categoryPackage.length;t++)1==d.categorizedPackages[e].categoryPackages[a].categoryPackage[t].isSelected&&(d.closePackageDetail(d.categorizedPackages[e].categoryPackages[a].categoryPackage[t]),d.categorizedPackages[e].categoryPackages[a].categoryPackage[t].myStyle="#116eb5");if(d.categorized)for(var e=0;e<d.categorized.length;e++)for(var a=0;a<d.categorized[e].categoryRooms.length;a++)for(var t=0;t<d.categorized[e].categoryRooms[a].categoryRoom.length;t++)d.categorized[e].categoryRooms[a].categoryRoom[t].isSelected=!1;if(d.categorizedPackages)for(var e=0;e<d.categorizedPackages.length;e++)for(var a=0;a<d.categorizedPackages[e].categoryPackages.length;a++)for(var t=0;t<d.categorizedPackages[e].categoryPackages[a].categoryPackage.length;t++)d.categorizedPackages[e].categoryPackages[a].categoryPackage[t].isSelected=!1;var o={};d.currentRoom="",d.categorized=[],d.RoomDetailSwitch=!1;var r=n.RatesAvail.roomStays[0].roomTypes,i=n.RatesAvail.roomStays[0].packageTypes,s=angular.copy(r);if(angular.copy(i),void 0!=d.navFilterData){for(var l=0;l<r.length;l++){r[l].upgradeRoom=[],r[l].isSelected=!1,r[l].myStyle="#116eb5";for(var c=0;c<r[l].averageRates.length;c++)r[l].averageRates[c].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode&&(r[l].finalPrice=r[l].averageRates[c].rate-r[l].averageRates[c].discount);if(r[l].roomUpgradeOptions.length>0)for(var m=0;m<r[l].roomUpgradeOptions.length;m++)for(var u=0;u<s.length;u++)if(s[u].roomTypeCode==r[l].roomUpgradeOptions[m].roomTypeCode){s[u].sortOrder=r[l].roomUpgradeOptions[m].sortOrder;for(var p=0;p<s[u].averageRates.length;p++)s[u].averageRates[p].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode&&(s[u].priceChanged=s[u].averageRates[p].rate-s[u].averageRates[p].discount-r[l].finalPrice,s[u].averageRates[p].merchandisedCurrency&&(s[u].merchandisedCurrency=s[u].averageRates[p].merchandisedCurrency));if(0!=s[u].priceChanged){var y=angular.copy(s[u]);r[l].upgradeRoom.push(y)}}}d.rateAvailPlans=n.RatesAvail.roomStays[0].ratePlans;for(var l=0;l<d.rateAvailPlans.length;l++)d.rateAvailPlans[l].price=d.rateAvailPlans[l].leadRate-d.rateAvailPlans[l].discountRate,Y&&d.rateAvailPlans[l].leadMemberRate&&void 0!=d.rateAvailPlans[l].discountMemberRate&&(d.rateAvailPlans[l].memberPrice=d.rateAvailPlans[l].leadMemberRate-d.rateAvailPlans[l].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(d.rateAvailPlans[l].leadRate=parseFloat(d.rateAvailPlans[l].leadRate).toFixed(2),d.rateAvailPlans[l].discountRate=parseFloat(d.rateAvailPlans[l].discountRate).toFixed(2),d.rateAvailPlans[l].price=parseFloat(d.rateAvailPlans[l].price).toFixed(2),void 0!=d.rateAvailPlans[l].memberPrice?(d.rateAvailPlans[l].leadMemberRate=parseFloat(d.rateAvailPlans[l].leadMemberRate).toFixed(2),d.rateAvailPlans[l].discountMemberRate=parseFloat(d.rateAvailPlans[l].discountMemberRate).toFixed(2),d.rateAvailPlans[l].memberPrice=parseFloat(d.rateAvailPlans[l].memberPrice).toFixed(2),d.rateAvailPlans[l].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[l].leadMemberRate)<=Number(d.rateAvailPlans[l].leadRate)):d.rateAvailPlans[l].isMemberRatePriceIsLowest=!1):(d.rateAvailPlans[l].leadRate=parseFloat(d.rateAvailPlans[l].leadRate).toFixed(0),d.rateAvailPlans[l].discountRate=parseFloat(d.rateAvailPlans[l].discountRate).toFixed(0),d.rateAvailPlans[l].price=parseFloat(d.rateAvailPlans[l].price).toFixed(0),void 0!=d.rateAvailPlans[l].memberPrice?(d.rateAvailPlans[l].leadMemberRate=parseFloat(d.rateAvailPlans[l].leadMemberRate).toFixed(0),d.rateAvailPlans[l].discountMemberRate=parseFloat(d.rateAvailPlans[l].discountMemberRate).toFixed(0),d.rateAvailPlans[l].memberPrice=parseFloat(d.rateAvailPlans[l].memberPrice).toFixed(0),d.rateAvailPlans[l].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[l].leadMemberRate)<=Number(d.rateAvailPlans[l].leadRate)):d.rateAvailPlans[l].isMemberRatePriceIsLowest=!1);var v=document.querySelector(".AccommodationsNav-filter--addcode"),h=document.getElementById("AccommodationsNav-filter--rates-id");if(v&&h){var R=getComputedStyle(v).borderColor,f=getComputedStyle(v).backgroundColor;h.style.borderColor=R,h.style.backgroundColor=f}d.rateAvailCategories=n.RatesAvail.roomStays[0].roomCategories,d.rateAvailCategories.forEach(function(e){e.selected=!0}),Le(),d.categorized=[];var C=[{categoryRooms:[]}],S=0,A=0;C[0].categoryRooms[A]={},C[0].categoryRooms[A].categoryRoom=[];for(var p=0;p<r.length;p++)if(!r[p].hasOwnProperty("categoryCode")){r[p].priceTagRate=[],r[p].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var I=0;I<r[p].averageRates.length;I++)if("Regular"==r[p].averageRates[I].ratePlanType&&r[p].averageRates[I].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=r[p].nightlyRates&&r[p].nightlyRates.length>0){r[p].averageRates[I].nightlyRates=[];for(var b=0;b<r[p].nightlyRates.length;b++)r[p].nightlyRates[b].ratePlanCode==r[p].averageRates[I].ratePlanCode&&r[p].averageRates[I].nightlyRates.push(angular.copy(r[p].nightlyRates[b]))}r[p].priceTagRate.push(r[p].averageRates[I])}else if(r[p].averageRates[I].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=r[p].nightlyRates&&r[p].nightlyRates.length>0){r[p].averageRates[I].nightlyRates=[];for(var b=0;b<r[p].nightlyRates.length;b++)"Group"==r[p].averageRates[I].ratePlanType?r[p].nightlyRates[b].ratePlanCode==r[p].averageRates[I].roomRateCode&&r[p].averageRates[I].nightlyRates.push(angular.copy(r[p].nightlyRates[b])):r[p].nightlyRates[b].ratePlanCode==r[p].averageRates[I].ratePlanCode&&r[p].averageRates[I].nightlyRates.push(angular.copy(r[p].nightlyRates[b]))}r[p].priceTagRate.unshift(r[p].averageRates[I])}for(var l=0;l<d.rateAvailPlans.length;l++)for(var m=0;m<r[p].priceTagRate.length;m++)r[p].priceTagRate[m].ratePlanCode==d.rateAvailPlans[l].ratePlanCode&&(r[p].priceTagRate[m].ratePlanName=d.rateAvailPlans[l].ratePlanName,r[p].priceTagRate[m].ratePlanDescription=d.rateAvailPlans[l].ratePlanDescription,r[p].priceTagRate[m].cancellationPolicy=d.rateAvailPlans[l].cancellationPolicy,r[p].priceTagRate[m].guaranteePolicy=d.rateAvailPlans[l].guaranteePolicy,r[p].priceTagRate[m].sortOrder=d.rateAvailPlans[l].sortOrder,void 0!=d.rateAvailPlans[l].packagePolicies&&(r[p].priceTagRate[m].packagePolicies=d.rateAvailPlans[l].packagePolicies));for(var l=0;l<r[p].averageRates.length;l++)d.navFilterData.ratePlanCode.ratePlanCode==r[p].averageRates[l].ratePlanCode&&(r[p].currentRate=r[p].averageRates[l],r[p].currentRate.price=r[p].currentRate.rate-r[p].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(r[p].currentRate.price=r[p].currentRate.price.toFixed(2)),
C[0].categoryRooms[A].categoryRoom.push(r[p]),S++);S%X==0&&0!=S&&(A++,C[0].categoryRooms[A]={},C[0].categoryRooms[A].categoryRoom=[])}if(0!=C[0].categoryRooms[0].categoryRoom.length){for(var D=C[0].categoryRooms.length;D>0;D--)0==C[0].categoryRooms[D-1].categoryRoom.length&&C[0].categoryRooms.splice(D-1,1);d.categorized.push(C[0])}}if(void 0!=i){d.categorizedPackages=[];var T=[{categoryPackages:[]}],S=0,A=0;T[0].categoryPackages[A]={},T[0].categoryPackages[A].categoryPackage=[];for(var p=0;p<i.length;p++)i[p].hasOwnProperty("categoryCode")||(T[0].categoryPackages[A].categoryPackage.push(i[p]),S++),S%X==0&&0!=S&&(A++,T[0].categoryPackages[A]={},T[0].categoryPackages[A].categoryPackage=[]);if(0!=T[0].categoryPackages[0].categoryPackage.length){for(var D=T[0].categoryPackages.length;D>0;D--)0==T[0].categoryPackages[D-1].categoryPackage.length&&T[0].categoryPackages.splice(D-1,1);d.categorizedPackages.push(T[0])}}if(void 0!=d.navFilterData)for(var u=0;u<n.RatesAvail.roomStays[0].roomCategories.length;u++){var S=0,A=0;o={name:n.RatesAvail.roomStays[0].roomCategories[u].categoryName,categoryCode:n.RatesAvail.roomStays[0].roomCategories[u].categoryCode,categoryRooms:[]},o.categoryRooms[0]={},o.categoryRooms[0].categoryRoom=[];for(var p=0;p<r.length;p++){var O=!1;if(r[p].categoryCode==n.RatesAvail.roomStays[0].roomCategories[u].categoryCode){r[p].priceTagRate=[],r[p].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var I=0;I<r[p].averageRates.length;I++)if("Regular"==r[p].averageRates[I].ratePlanType&&r[p].averageRates[I].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=r[p].nightlyRates&&r[p].nightlyRates.length>0){r[p].averageRates[I].nightlyRates=[];for(var b=0;b<r[p].nightlyRates.length;b++)r[p].nightlyRates[b].ratePlanCode==r[p].averageRates[I].ratePlanCode&&r[p].averageRates[I].nightlyRates.push(angular.copy(r[p].nightlyRates[b]))}r[p].priceTagRate.push(r[p].averageRates[I])}else if(r[p].averageRates[I].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=r[p].nightlyRates&&r[p].nightlyRates.length>0){r[p].averageRates[I].nightlyRates=[];for(var b=0;b<r[p].nightlyRates.length;b++)"Group"==r[p].averageRates[I].ratePlanType?r[p].nightlyRates[b].ratePlanCode==r[p].averageRates[I].roomRateCode&&r[p].averageRates[I].nightlyRates.push(angular.copy(r[p].nightlyRates[b])):r[p].nightlyRates[b].ratePlanCode==r[p].averageRates[I].ratePlanCode&&r[p].averageRates[I].nightlyRates.push(angular.copy(r[p].nightlyRates[b]))}r[p].priceTagRate.unshift(r[p].averageRates[I])}for(var l=0;l<r[p].averageRates.length;l++){for(var E=0;E<d.rateAvailPlans.length;E++)d.rateAvailPlans[E].ratePlanCode==r[p].averageRates[l].ratePlanCode&&(r[p].priceTagRate[l].ratePlanName=d.rateAvailPlans[E].ratePlanName,r[p].priceTagRate[l].sortOrder=d.rateAvailPlans[E].sortOrder);d.navFilterData.ratePlanCode.ratePlanCode==r[p].averageRates[l].ratePlanCode&&(r[p].currentRate=r[p].averageRates[l],r[p].currentRate.price=r[p].currentRate.rate-r[p].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(r[p].currentRate.price=r[p].currentRate.price.toFixed(2)),o.categoryRooms[A].categoryRoom.push(r[p]),S++,!0)}for(var l=0;l<d.rateAvailPlans.length;l++)for(var m=0;m<r[p].priceTagRate.length;m++)r[p].priceTagRate[m].ratePlanCode==d.rateAvailPlans[l].ratePlanCode&&(r[p].priceTagRate[m].ratePlanName=d.rateAvailPlans[l].ratePlanName,r[p].priceTagRate[m].ratePlanDescription=d.rateAvailPlans[l].ratePlanDescription,r[p].priceTagRate[m].cancellationPolicy=d.rateAvailPlans[l].cancellationPolicy,r[p].priceTagRate[m].guaranteePolicy=d.rateAvailPlans[l].guaranteePolicy,r[p].priceTagRate[m].sortOrder=d.rateAvailPlans[l].sortOrder,void 0!=d.rateAvailPlans[l].packagePolicies&&(r[p].priceTagRate[m].packagePolicies=d.rateAvailPlans[l].packagePolicies))}S%X==0&&0!=S&&(O=!0,A++,o.categoryRooms[A]={},o.categoryRooms[A].categoryRoom=[])}if(1==O){for(var M=o.categoryRooms.length;M>0;M--)0==o.categoryRooms[M-1].categoryRoom.length&&o.categoryRooms.splice(M-1,1);d.categorized.push(o)}else if(o.categoryRooms[A].categoryRoom.length>0){for(var M=o.categoryRooms.length;M>0;M--)0==o.categoryRooms[M-1].categoryRoom.length&&o.categoryRooms.splice(M-1,1);d.categorized.push(o)}}if(d.isRoomCategoryFlag&&d.changeCatecory(),void 0!=n.RatesAvail.roomStays[0].packageCategories){for(var u=0;u<n.RatesAvail.roomStays[0].packageCategories.length;u++){var S=0,A=0,_={name:n.RatesAvail.roomStays[0].packageCategories[u].categoryName,categoryCode:n.RatesAvail.roomStays[0].packageCategories[u].categoryCode,categoryPackages:[]};_.categoryPackages[0]={},_.categoryPackages[0].categoryPackage=[];for(var p=0;p<i.length;p++){var O=!1;i[p].categoryCode==n.RatesAvail.roomStays[0].packageCategories[u].categoryCode&&(_.categoryPackages[A].categoryPackage.push(i[p]),S++,!0),S%X==0&&0!=S&&(O=!0,A++,_.categoryPackages[A]={},_.categoryPackages[A].categoryPackage=[])}if(1==O){for(var M=_.categoryPackages.length;M>0;M--)0==_.categoryPackages[M-1].categoryPackage.length&&_.categoryPackages.splice(M-1,1);d.categorizedPackages.push(_)}else if(_.categoryPackages[A].categoryPackage.length>0){for(var M=_.categoryPackages.length;M>0;M--)0==_.categoryPackages[M-1].categoryPackage.length&&_.categoryPackages.splice(M-1,1);d.categorizedPackages.push(_)}}P(i),Ee=d.categorizedPackages}},de=function(){n.RatesAvail.roomStays[0].roomCategories=De.roomStays[0].roomCategories,0!=n.RatesAvail.roomStays[0].roomCategories.length&&n.RatesAvail.roomStays[0].roomCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var e=0;e<n.RatesAvail.roomStays[0].roomCategories.length;e++){for(var a=!1,t=0;t<n.RatesAvail.roomStays[0].allRoomTypes.length;t++)n.RatesAvail.roomStays[0].allRoomTypes[t].categoryCode==n.RatesAvail.roomStays[0].roomCategories[e].categoryCode&&(a=!0);0==a&&(n.RatesAvail.roomStays[0].roomCategories.splice(e,1),e--)}if(0==n.RatesAvail.roomStays[0].roomCategories.length?d.categorizeHide=!0:d.categorizeHide=!1,d.categorizedMultirate)for(var o=0;o<d.categorizedMultirate.length;o++)for(var r=0;r<d.categorizedMultirate[o].categoryRooms.length;r++)for(var i=0;i<d.categorizedMultirate[o].categoryRooms[r].categoryRoom.length;i++)1==d.categorizedMultirate[o].categoryRooms[r].categoryRoom[i].isSelected&&(d.closeRoomDetail(d.categorizedMultirate[o].categoryRooms[r].categoryRoom[i]),d.categorizedMultirate[o].categoryRooms[r].categoryRoom[i].myStyle="#116eb5");if(d.categorizedMultirate)for(var o=0;o<d.categorizedMultirate.length;o++)for(var r=0;r<d.categorizedMultirate[o].categoryRooms.length;r++)for(var i=0;i<d.categorizedMultirate[o].categoryRooms[r].categoryRoom.length;i++)d.categorizedMultirate[o].categoryRooms[r].categoryRoom[i].isSelected=!1;var s={};d.currentRoom="",d.categorizedMultirate=[],d.RoomDetailSwitch=!1;var l=n.RatesAvail.roomStays[0].allRoomTypes,c=angular.copy(l);if(void 0!=d.navFilterData){d.rateAvailPlans=n.RatesAvail.roomStays[0].ratePlans;for(var e=0;e<d.rateAvailPlans.length;e++)d.rateAvailPlans[e].price=d.rateAvailPlans[e].leadRate-d.rateAvailPlans[e].discountRate,Y&&d.rateAvailPlans[e].leadMemberRate&&void 0!=d.rateAvailPlans[e].discountMemberRate&&(d.rateAvailPlans[e].memberPrice=d.rateAvailPlans[e].leadMemberRate-d.rateAvailPlans[e].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(d.rateAvailPlans[e].leadRate=parseFloat(d.rateAvailPlans[e].leadRate).toFixed(2),d.rateAvailPlans[e].discountRate=parseFloat(d.rateAvailPlans[e].discountRate).toFixed(2),d.rateAvailPlans[e].price=parseFloat(d.rateAvailPlans[e].price).toFixed(2),void 0!=d.rateAvailPlans[e].memberPrice?(d.rateAvailPlans[e].leadMemberRate=parseFloat(d.rateAvailPlans[e].leadMemberRate).toFixed(2),d.rateAvailPlans[e].discountMemberRate=parseFloat(d.rateAvailPlans[e].discountMemberRate).toFixed(2),d.rateAvailPlans[e].memberPrice=parseFloat(d.rateAvailPlans[e].memberPrice).toFixed(2),d.rateAvailPlans[e].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[e].leadMemberRate)<=Number(d.rateAvailPlans[e].leadRate)):d.rateAvailPlans[e].isMemberRatePriceIsLowest=!1):(d.rateAvailPlans[e].leadRate=parseFloat(d.rateAvailPlans[e].leadRate).toFixed(0),d.rateAvailPlans[e].discountRate=parseFloat(d.rateAvailPlans[e].discountRate).toFixed(0),d.rateAvailPlans[e].price=parseFloat(d.rateAvailPlans[e].price).toFixed(0),void 0!=d.rateAvailPlans[e].memberPrice?(d.rateAvailPlans[e].leadMemberRate=parseFloat(d.rateAvailPlans[e].leadMemberRate).toFixed(0),d.rateAvailPlans[e].discountMemberRate=parseFloat(d.rateAvailPlans[e].discountMemberRate).toFixed(0),d.rateAvailPlans[e].memberPrice=parseFloat(d.rateAvailPlans[e].memberPrice).toFixed(0),d.rateAvailPlans[e].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[e].leadMemberRate)<=Number(d.rateAvailPlans[e].leadRate)):d.rateAvailPlans[e].isMemberRatePriceIsLowest=!1);var m=document.querySelector(".AccommodationsNav-filter--addcode"),u=document.getElementById("AccommodationsNav-filter--rates-id");if(m&&u){var p=getComputedStyle(m).borderColor,y=getComputedStyle(m).backgroundColor;u.style.borderColor=p,u.style.backgroundColor=y}d.rateAvailCategories=n.RatesAvail.roomStays[0].roomCategories,d.rateAvailCategories.forEach(function(e){e.selected=!0}),Le(),d.categorizedMultirate=[];var R=[{categoryRooms:[]}],f=0,C=0;R[0].categoryRooms[C]={},R[0].categoryRooms[C].categoryRoom=[];for(var P=0;P<l.length;P++)if(!l[P].hasOwnProperty("categoryCode")){l[P].priceTagRate=[],l[P].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var S=0;S<l[P].averageRates.length;S++)if("Regular"==l[P].averageRates[S].ratePlanType&&l[P].averageRates[S].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=l[P].nightlyRates&&l[P].nightlyRates.length>0){l[P].averageRates[S].nightlyRates=[];for(var I=0;I<l[P].nightlyRates.length;I++)l[P].nightlyRates[I].ratePlanCode==l[P].averageRates[S].ratePlanCode&&l[P].averageRates[S].nightlyRates.push(angular.copy(l[P].nightlyRates[I]))}l[P].priceTagRate.push(l[P].averageRates[S])}else if(l[P].averageRates[S].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=l[P].nightlyRates&&l[P].nightlyRates.length>0){l[P].averageRates[S].nightlyRates=[];for(var I=0;I<l[P].nightlyRates.length;I++)"Group"==l[P].averageRates[S].ratePlanType?l[P].nightlyRates[I].ratePlanCode==l[P].averageRates[S].roomRateCode&&l[P].averageRates[S].nightlyRates.push(angular.copy(l[P].nightlyRates[I])):l[P].nightlyRates[I].ratePlanCode==l[P].averageRates[S].ratePlanCode&&l[P].averageRates[S].nightlyRates.push(angular.copy(l[P].nightlyRates[I]))}l[P].priceTagRate.unshift(l[P].averageRates[S])}for(var e=0;e<d.rateAvailPlans.length;e++)for(var t=0;t<l[P].priceTagRate.length;t++){var b=l[P].priceTagRate[t].ratePlanCode.indexOf("M_")>-1?l[P].priceTagRate[t].ratePlanCode.replace("M_",""):l[P].priceTagRate[t].ratePlanCode;b==d.rateAvailPlans[e].ratePlanCode&&(l[P].priceTagRate[t].ratePlanName=d.rateAvailPlans[e].ratePlanName,l[P].priceTagRate[t].ratePlanDescription=d.rateAvailPlans[e].ratePlanDescription,l[P].priceTagRate[t].cancellationPolicy=d.rateAvailPlans[e].cancellationPolicy,l[P].priceTagRate[t].guaranteePolicy=d.rateAvailPlans[e].guaranteePolicy,l[P].priceTagRate[t].sortOrder=d.rateAvailPlans[e].sortOrder,l[P].priceTagRate[t].isMultirateRadioClicked=!1,void 0!=d.rateAvailPlans[e].packagePolicies&&(l[P].priceTagRate[t].packagePolicies=d.rateAvailPlans[e].packagePolicies))}if(void 0!=l[P].priceTagRate){l[P].priceTagRate.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var D=0;D<l[P].priceTagRate.length;D++){var b=l[P].priceTagRate[D].ratePlanCode.indexOf("M_")>-1?l[P].priceTagRate[D].ratePlanCode.replace("M_",""):l[P].priceTagRate[D].ratePlanCode;if(b==d.navFilterData.ratePlanCode.ratePlanCode){l[P].priceTagRate.unshift(l[P].priceTagRate[D]),l[P].priceTagRate.splice(D+1,1);break}}for(var D=0;D<l[P].priceTagRate.length;D++){var b=l[P].priceTagRate[D].ratePlanCode.indexOf("M_")>-1?l[P].priceTagRate[D].ratePlanCode.replace("M_",""):l[P].priceTagRate[D].ratePlanCode;if(b==d.navFilterData.ratePlanCode.ratePlanCode&&l[P].priceTagRate[D].isMemberRatePlan){l[P].priceTagRate.unshift(l[P].priceTagRate[D]),l[P].priceTagRate.splice(D+1,1);break}}}if(l[P].averageRates.length>0){for(var T=!1,e=0;e<l[P].averageRates.length;e++){var b=l[P].averageRates[e].ratePlanCode.indexOf("M_")>-1?l[P].averageRates[e].ratePlanCode.replace("M_",""):l[P].averageRates[e].ratePlanCode;if(d.navFilterData.ratePlanCode.ratePlanCode==b&&l[P].averageRates[e].isMemberRatePlan&&v.getReservation().roomStays&&v.getReservation().roomStays.length>0&&void 0===v.getReservation().roomStays[0].total){l[P].currentRate=l[P].averageRates[e],l[P].currentRate.price=l[P].currentRate.rate-l[P].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(l[P].currentRate.price=l[P].currentRate.price.toFixed(2)),f++,!0,T=!0;break}d.navFilterData.ratePlanCode.ratePlanCode==b&&(l[P].currentRate=l[P].averageRates[e],l[P].currentRate.price=l[P].currentRate.rate-l[P].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(l[P].currentRate.price=l[P].currentRate.price.toFixed(2)),f++,T=!0)}if(0==T&&l[P].priceTagRate.length>0&&(l[P].currentRate=l[P].priceTagRate[0],l[P].currentCode=l[P].priceTagRate[0].ratePlanCode),Y&&d.popUpOpenFromSignBookBtn&&(h.checkGmsLogin()||A.getIsLoyaltyUserLogIn())&&l[P].roomTypeCode===d.selectedRoomBeforeSignIn.roomTypeCode)for(var O=0;O<l[P].priceTagRate.length;O++)if(d.selectedRoomBeforeSignIn.ratePlanCode===l[P].priceTagRate[O].ratePlanCode){l[P].currentRate=l[P].priceTagRate[O],l[P].currentCode=l[P].priceTagRate[O].ratePlanCode,d.selectedRoomBeforeSignIn=l[P];break}l[P].id=P,R[0].categoryRooms[C].categoryRoom.push(l[P]),d.multiRateRadio[l[P].roomTypeCode]=l[P].roomTypeCode+"_"+l[P].currentRate.ratePlanCode}f%X==0&&0!=f&&(C++,R[0].categoryRooms[C]={},R[0].categoryRooms[C].categoryRoom=[]),l[P].upgradeRoom=[],l[P].isSelected=!1,l[P].myStyle="#116eb5";for(var E=0;E<l[P].averageRates.length;E++)if(l[P].averageRates[E].upgradeRoomMultirate=[],l[P].averageRates[E].ratePlanCode==l[P].currentRate.ratePlanCode&&(l[P].finalPrice=l[P].averageRates[E].rate-l[P].averageRates[E].discount),void 0!=l[P].averageRates[E].roomUpgradeList&&l[P].averageRates[E].roomUpgradeList.length>0)for(var t=0;t<l[P].averageRates[E].roomUpgradeList.length;t++)for(var M=0;M<c.length;M++)if(c[M].roomTypeCode==l[P].averageRates[E].roomUpgradeList[t].roomTypeCode){for(var o=0;o<c[M].averageRates.length;o++)c[M].averageRates[o].ratePlanCode==l[P].currentRate.ratePlanCode&&(c[M].priceChanged=c[M].averageRates[o].rate-c[M].averageRates[o].discount-l[P].finalPrice,c[M].averageRates[o].merchandisedCurrency&&(c[M].merchandisedCurrency=c[M].averageRates[o].merchandisedCurrency));if(c[M].priceChanged>0){var _=angular.copy(c[M]);l[P].averageRates[E].upgradeRoomMultirate.push(_)}}}if(0!=R[0].categoryRooms[0].categoryRoom.length){for(var k=R[0].categoryRooms.length;k>0;k--)0==R[0].categoryRooms[k-1].categoryRoom.length&&R[0].categoryRooms.splice(k-1,1);d.categorizedMultirate.push(R[0])}}if(void 0!=d.navFilterData)for(var N=0;N<n.RatesAvail.roomStays[0].roomCategories.length;N++){var f=0,C=0;s={name:n.RatesAvail.roomStays[0].roomCategories[N].categoryName,categoryCode:n.RatesAvail.roomStays[0].roomCategories[N].categoryCode,categoryRooms:[]},s.categoryRooms[0]={},s.categoryRooms[0].categoryRoom=[];for(var P=0;P<l.length;P++){var L=!1;if(l[P].categoryCode==n.RatesAvail.roomStays[0].roomCategories[N].categoryCode){l[P].priceTagRate=[],l[P].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var S=0;S<l[P].averageRates.length;S++)if("Regular"==l[P].averageRates[S].ratePlanType&&l[P].averageRates[S].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=l[P].nightlyRates&&l[P].nightlyRates.length>0){l[P].averageRates[S].nightlyRates=[];for(var I=0;I<l[P].nightlyRates.length;I++)l[P].nightlyRates[I].ratePlanCode==l[P].averageRates[S].ratePlanCode&&l[P].averageRates[S].nightlyRates.push(angular.copy(l[P].nightlyRates[I]))}l[P].priceTagRate.push(l[P].averageRates[S])}else if(l[P].averageRates[S].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=l[P].nightlyRates&&l[P].nightlyRates.length>0){l[P].averageRates[S].nightlyRates=[];for(var I=0;I<l[P].nightlyRates.length;I++)"Group"==l[P].averageRates[S].ratePlanType?l[P].nightlyRates[I].ratePlanCode==l[P].averageRates[S].roomRateCode&&l[P].averageRates[S].nightlyRates.push(angular.copy(l[P].nightlyRates[I])):l[P].nightlyRates[I].ratePlanCode==l[P].averageRates[S].ratePlanCode&&l[P].averageRates[S].nightlyRates.push(angular.copy(l[P].nightlyRates[I]))}l[P].priceTagRate.unshift(l[P].averageRates[S])}for(var e=0;e<d.rateAvailPlans.length;e++)for(var t=0;t<l[P].priceTagRate.length;t++){var b=l[P].priceTagRate[t].ratePlanCode.indexOf("M_")>-1?l[P].priceTagRate[t].ratePlanCode.replace("M_",""):l[P].priceTagRate[t].ratePlanCode;b==d.rateAvailPlans[e].ratePlanCode&&(l[P].priceTagRate[t].ratePlanName=d.rateAvailPlans[e].ratePlanName,l[P].priceTagRate[t].ratePlanDescription=d.rateAvailPlans[e].ratePlanDescription,l[P].priceTagRate[t].cancellationPolicy=d.rateAvailPlans[e].cancellationPolicy,l[P].priceTagRate[t].guaranteePolicy=d.rateAvailPlans[e].guaranteePolicy,l[P].priceTagRate[t].sortOrder=d.rateAvailPlans[e].sortOrder,l[P].priceTagRate[t].isMultirateRadioClicked=!1,void 0!=d.rateAvailPlans[e].packagePolicies&&(l[P].priceTagRate[t].packagePolicies=d.rateAvailPlans[e].packagePolicies))}if(void 0!=l[P].priceTagRate){l[P].priceTagRate.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var D=0;D<l[P].priceTagRate.length;D++){var b=l[P].priceTagRate[D].ratePlanCode.indexOf("M_")>-1?l[P].priceTagRate[D].ratePlanCode.replace("M_",""):l[P].priceTagRate[D].ratePlanCode;if(b==d.navFilterData.ratePlanCode.ratePlanCode){l[P].priceTagRate.unshift(l[P].priceTagRate[D]),l[P].priceTagRate.splice(D+1,1);break}}for(var D=0;D<l[P].priceTagRate.length;D++){var b=l[P].priceTagRate[D].ratePlanCode.indexOf("M_")>-1?l[P].priceTagRate[D].ratePlanCode.replace("M_",""):l[P].priceTagRate[D].ratePlanCode;if(b==d.navFilterData.ratePlanCode.ratePlanCode&&l[P].priceTagRate[D].isMemberRatePlan){l[P].priceTagRate.unshift(l[P].priceTagRate[D]),l[P].priceTagRate.splice(D+1,1);break}}}if(l[P].averageRates.length>0){for(var T=!1,e=0;e<l[P].averageRates.length;e++){for(var b=l[P].averageRates[e].ratePlanCode.indexOf("M_")>-1?l[P].averageRates[e].ratePlanCode.replace("M_",""):l[P].averageRates[e].ratePlanCode,G=0;G<d.rateAvailPlans.length;G++)d.rateAvailPlans[G].ratePlanCode;if(d.navFilterData.ratePlanCode.ratePlanCode==b&&l[P].averageRates[e].isMemberRatePlan&&v.getReservation().roomStays&&v.getReservation().roomStays.length>0&&void 0===v.getReservation().roomStays[0].total){l[P].currentRate=l[P].averageRates[e],l[P].currentRate.price=l[P].currentRate.rate-l[P].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(l[P].currentRate.price=l[P].currentRate.price.toFixed(2)),f++,!0,T=!0;break}d.navFilterData.ratePlanCode.ratePlanCode==b&&(l[P].currentRate=l[P].averageRates[e],l[P].currentRate.price=l[P].currentRate.rate-l[P].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(l[P].currentRate.price=l[P].currentRate.price.toFixed(2)),f++,!0,T=!0)}if(0==T&&l[P].priceTagRate.length>0&&(l[P].currentRate=l[P].priceTagRate[0],l[P].currentCode=l[P].priceTagRate[0].ratePlanCode),Y&&d.popUpOpenFromSignBookBtn&&(h.checkGmsLogin()||A.getIsLoyaltyUserLogIn())&&l[P].roomTypeCode===d.selectedRoomBeforeSignIn.roomTypeCode)for(var O=0;O<l[P].priceTagRate.length;O++)if(d.selectedRoomBeforeSignIn.ratePlanCode===l[P].priceTagRate[O].ratePlanCode){l[P].currentRate=l[P].priceTagRate[O],l[P].currentCode=l[P].priceTagRate[O].ratePlanCode,d.selectedRoomBeforeSignIn=l[P];break}l[P].id=P,s.categoryRooms[C].categoryRoom.push(l[P]),d.multiRateRadio[l[P].roomTypeCode]=l[P].roomTypeCode+"_"+l[P].currentRate.ratePlanCode}l[P].upgradeRoom=[],l[P].isSelected=!1,l[P].myStyle="#116eb5";for(var E=0;E<l[P].averageRates.length;E++)if(l[P].averageRates[E].upgradeRoomMultirate=[],l[P].averageRates[E].ratePlanCode==l[P].currentRate.ratePlanCode&&(l[P].finalPrice=l[P].averageRates[E].rate-l[P].averageRates[E].discount),void 0!=l[P].averageRates[E].roomUpgradeList&&l[P].averageRates[E].roomUpgradeList.length>0)for(var t=0;t<l[P].averageRates[E].roomUpgradeList.length;t++)for(var F=0;F<c.length;F++)if(c[F].roomTypeCode==l[P].averageRates[E].roomUpgradeList[t].roomTypeCode){for(var o=0;o<c[F].averageRates.length;o++)c[F].averageRates[o].ratePlanCode==l[P].currentRate.ratePlanCode&&(c[F].priceChanged=c[F].averageRates[o].rate-c[F].averageRates[o].discount-l[P].finalPrice,c[F].averageRates[o].merchandisedCurrency&&(c[F].merchandisedCurrency=c[F].averageRates[o].merchandisedCurrency));if(c[F].priceChanged>0){var _=angular.copy(c[F]);l[P].averageRates[E].upgradeRoomMultirate.push(_)}}}f%X==0&&0!=f&&(L=!0,C++,s.categoryRooms[C]={},s.categoryRooms[C].categoryRoom=[])}if(1==L){for(var B=s.categoryRooms.length;B>0;B--)0==s.categoryRooms[B-1].categoryRoom.length&&s.categoryRooms.splice(B-1,1);d.categorizedMultirate.push(s)}else if(s.categoryRooms[C].categoryRoom.length>0){for(var B=s.categoryRooms.length;B>0;B--)0==s.categoryRooms[B-1].categoryRoom.length&&s.categoryRooms.splice(B-1,1);d.categorizedMultirate.push(s)}}if(d.categorizedMultirate&&Te&&d.isRoomCategoryFlag)for(var x=0;x<d.categorizedMultirate.length;x++)Te.forEach(function(e,a){d.categorizedMultirate[x].categoryCode==e.categoryCode&&(Te[a]=d.categorizedMultirate[x])});d.isRoomCategoryFlag&&d.changeCatecory(),Te=d.categorizedMultirate},ge=function(){if(ce(),1==n.displayMultiRateListView){var e=v.getCodeTypes();1!=d.packageSelected||void 0==d.navFilterData||void 0==d.navFilterData.ratePlanCode||"Package"!=d.navFilterData.ratePlanCode.ratePlanType&&"Group"!=d.navFilterData.ratePlanCode.ratePlanType?v.getReservation().roomStays[0].ratePlans.length>0&&("Package"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType||"Group"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType)?n.displayMultiRateListView=!1:void 0!=e&&(e.indexOf("Group")>-1||e.indexOf("group")>-1)?n.displayMultiRateListView=!1:(d.toggleAcc.gridView=!1,d.toggleAcc.listView=!0,de()):n.displayMultiRateListView=!1}void 0!=d.navFilterData&&(d.navFilterData.ratePlanCode.leadRate=t("currencyConversionAndSymbol")(te,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),d.navFilterData.ratePlanCode.price=t("currencyConversionAndSymbol")(oe,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),Y&&re&&void 0!=ne?(d.isMemberRatePriceIsLowest=Number(re)<=Number(te),d.navFilterData.ratePlanCode.leadMemberRate=t("currencyConversionAndSymbol")(re,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),d.navFilterData.ratePlanCode.memberPrice=t("currencyConversionAndSymbol")(ne,!1,d.navFilterData.ratePlanCode.merchandisedCurrency)):d.isMemberRatePriceIsLowest=!1),n.finalServices=angular.copy(Ie),void 0!=d.navFilterData&&(n.finalServices.ratePlanCode=d.navFilterData.ratePlanCode.ratePlanCode,n.finalServices.ratePlanType=d.navFilterData.ratePlanCode.ratePlanType)},ue=document.getElementsByClassName("HeaderButton Header-selection Header-step")[0];void 0!=ue&&(Z=getComputedStyle(ue).backgroundColor),d.goRooms=function(){if(d.prePackage=null,d.preRoom=null,1!=v.getConfig("OPEN_ROOM_DETAIL")&&1!=v.getConfig("OPEN_PACKAGE_DETAIL")){if(d.toggleAcc.roomsView=!0,d.toggleAcc.packageView=!1,u.go("accommodation.room"),d.categorized=ve,d.currentPackage=null,void 0!=d.navFilterData&&(Ie.ratePlanCode=d.navFilterData.ratePlanCode.ratePlanCode,n.finalServices=angular.copy(Ie)),ce(),1==n.displayMultiRateListView){var e=v.getCodeTypes();1!=d.packageSelected||void 0==d.navFilterData||void 0==d.navFilterData.ratePlanCode||"Package"!=d.navFilterData.ratePlanCode.ratePlanType&&"Group"!=d.navFilterData.ratePlanCode.ratePlanType?v.getReservation().roomStays[0].ratePlans.length>0&&("Package"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType||"Group"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType)?n.displayMultiRateListView=!1:void 0!=e&&(e.indexOf("Group")>-1||e.indexOf("group")>-1)?n.displayMultiRateListView=!1:(d.toggleAcc.gridView=!1,d.toggleAcc.listView=!0,de()):n.displayMultiRateListView=!1}void 0!=d.navFilterData&&(void 0!=d.navFilterData&&0==ie&&(d.navFilterData.ratePlanCode.leadRate=t("currencyConversionAndSymbol")(te,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),d.navFilterData.ratePlanCode.price=t("currencyConversionAndSymbol")(oe,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),Y&&re&&void 0!=ne?(d.isMemberRatePriceIsLowest=Number(re)<=Number(te),d.navFilterData.ratePlanCode.leadMemberRate=t("currencyConversionAndSymbol")(re,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),d.navFilterData.ratePlanCode.memberPrice=t("currencyConversionAndSymbol")(ne,!1,d.navFilterData.ratePlanCode.merchandisedCurrency)):d.isMemberRatePriceIsLowest=!1),n.finalServices=angular.copy(Ie),void 0!=d.navFilterData&&(n.finalServices.ratePlanCode=d.navFilterData.ratePlanCode.ratePlanCode,n.finalServices.ratePlanType=d.navFilterData.ratePlanCode.ratePlanType))}setTimeout(function(){var e=document.getElementById("roomButton");e&&e.focus(),void 0!=Z&&void 0!=document.getElementById("roomButton")&&(document.getElementById("roomButton").style.borderColor=Z,ee=getComputedStyle(document.getElementById("roomButton")).color),void 0!=ee&&void 0!=document.getElementById("packageButton")&&(document.getElementById("packageButton").style.borderColor=ee)}),n.$broadcast("CancelAccommodation"),n.$broadcast("CancelAddCode"),n.toggle.intlMenu=!1},d.goPackages=function(){d.prePackage=null,d.preRoom=null,d.toggleAcc.roomsView=!1,d.toggleAcc.packageView=!0,u.go("accommodation.package"),0==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultDisplayFormat?d.goGrid():1==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultDisplayFormat&&(r.innerWidth<768?d.goGrid():d.goList()),f.eventTrack("ClickPackage",{category:"UserNavigation",label:"List view from the Packages page"}),setTimeout(function(){var e=document.getElementById("packageButton");e&&e.focus(),void 0!=Z&&void 0!=document.getElementById("packageButton")&&(document.getElementById("packageButton").style.borderColor=Z,ee=getComputedStyle(document.getElementById("packageButton")).color),void 0!=ee&&void 0!=document.getElementById("roomButton")&&(document.getElementById("roomButton").style.borderColor=ee)}),n.$broadcast("CancelAddCode"),n.$broadcast("CancelAccommodation"),n.toggle.intlMenu=!1},g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(n.RatesAvail.roomStays[0].roomTypes.forEach(function(e){for(var a=0;a<e.averageRates.length;a++)e.averageRates[a].rate=parseFloat(e.averageRates[a].rate).toFixed(2),e.averageRates[a].discount=parseFloat(e.averageRates[a].discount).toFixed(2)}),void 0!=n.RatesAvail.roomStays[0].ratePlans&&n.RatesAvail.roomStays[0].ratePlans.forEach(function(e){e.leadRate=parseFloat(e.leadRate).toFixed(2)}),void 0!=n.RatesAvail.roomStays[0].packageTypes&&n.RatesAvail.roomStays[0].packageTypes.forEach(function(e){e.leadRate=parseFloat(e.leadRate).toFixed(2),e.discountRate=parseFloat(e.discountRate).toFixed(2)})):(n.RatesAvail.roomStays[0].roomTypes.forEach(function(e){for(var a=0;a<e.averageRates.length;a++)e.averageRates[a].rate=parseFloat(e.averageRates[a].rate).toFixed(0),e.averageRates[a].discount=parseFloat(e.averageRates[a].discount).toFixed(0)}),void 0!=n.RatesAvail.roomStays[0].ratePlans&&n.RatesAvail.roomStays[0].ratePlans.forEach(function(e){e.leadRate=parseFloat(e.leadRate).toFixed(0)}),void 0!=n.RatesAvail.roomStays[0].packageTypes&&n.RatesAvail.roomStays[0].packageTypes.forEach(function(e){e.leadRate=parseFloat(e.leadRate).toFixed(0),e.discountRate=parseFloat(e.discountRate).toFixed(0)})),d.iconShow=g.getHotelDesc().uxConfiguration.accomodationsConfig.displayIconsIndicator,n.rateShow=g.getHotelDesc().uxConfiguration.strikeThroughPricingEnabled;var pe=!0;1==d.isModifyResforPkgBtn&&v.getReservation().roomStays[0].ratePlans.length>0&&"Regular"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType&&(pe=!1),l.debug(JSON.stringify(d.navFilterData)+"$scope.navFilterData"),void 0!=n.RatesAvail.roomStays[0].ratePlans&&(0==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultRatePlanType&&n.RatesAvail.roomStays[0].ratePlans.length>0?1!=n.editPackageInclusions&&(d.goRooms(),C.setUserTiming("PageLoad","AccomRoom")):1!=g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultRatePlanType&&n.RatesAvail.roomStays[0].ratePlans.length>0||1!=n.editPackageInclusions&&(1==pe&&void 0!=n.RatesAvail.roomStays[0].packageTypes&&n.RatesAvail.roomStays[0].packageTypes.length>0&&void 0==R.stepsById.accommodations.package?void 0!=R.stepsById.accommodations.ratePlan&&R.stepsById.accommodations.ratePlan.length>0||void 0!=R.stepsById.accommodations.rooms&&R.stepsById.accommodations.rooms.length>0?(d.goRooms(),C.setUserTiming("PageLoad","AccomRoom")):(d.goPackages(),C.setUserTiming("PageLoad","AcconPkg")):d.goRooms())),1==n.displayMultiRateListView?d.goList():0==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultDisplayFormat?d.goGrid():1==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultDisplayFormat&&(r.innerWidth<768?d.goGrid():d.goList()),d.clickDropdown=function(){n.toggle.intlMenu=!1,n.$broadcast("CancelAddCode"),d.status.isopen=!1,d.dpHide=!d.dpHide},d.$state=u;var ye=angular.element(r);d.$watch(function(){return r.innerWidth},function(e){e<=672?(X=1,ge()):e<1050&&e>672?(X=2,ge()):(X=3,ge()),d.resize=X},!0),ye.bind("resize",function(){d.$apply()});var ve,Re={};d.currentRoom="",d.currentPackage="";var fe=[{categoryRooms:[]}];d.categorized=[],d.categorizedMultirate=[],d.categorizedPackages=[],d.RoomDetailSwitch=!1;var Pe,Se,Ae,be=d.categorized,Te=d.categorizedMultirate,Ee=d.categorizedPackages,Me=[],_e=[];d.rateAvailPlans=n.RatesAvail.roomStays[0].ratePlans;for(var w=0;w<d.rateAvailPlans.length;w++)d.rateAvailPlans[w].price=d.rateAvailPlans[w].leadRate-d.rateAvailPlans[w].discountRate,Y&&d.rateAvailPlans[w].leadMemberRate&&void 0!=d.rateAvailPlans[w].discountMemberRate&&(d.rateAvailPlans[w].memberPrice=d.rateAvailPlans[w].leadMemberRate-d.rateAvailPlans[w].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(d.rateAvailPlans[w].leadRate=parseFloat(d.rateAvailPlans[w].leadRate).toFixed(2),d.rateAvailPlans[w].discountRate=parseFloat(d.rateAvailPlans[w].discountRate).toFixed(2),d.rateAvailPlans[w].price=parseFloat(d.rateAvailPlans[w].price).toFixed(2),void 0!=d.rateAvailPlans[w].memberPrice?(d.rateAvailPlans[w].leadMemberRate=parseFloat(d.rateAvailPlans[w].leadMemberRate).toFixed(2),d.rateAvailPlans[w].discountMemberRate=parseFloat(d.rateAvailPlans[w].discountMemberRate).toFixed(2),d.rateAvailPlans[w].memberPrice=parseFloat(d.rateAvailPlans[w].memberPrice).toFixed(2),d.rateAvailPlans[w].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[w].leadMemberRate)<=Number(d.rateAvailPlans[w].leadRate)):d.rateAvailPlans[w].isMemberRatePriceIsLowest=!1):(d.rateAvailPlans[w].leadRate=parseFloat(d.rateAvailPlans[w].leadRate).toFixed(0),d.rateAvailPlans[w].discountRate=parseFloat(d.rateAvailPlans[w].discountRate).toFixed(0),d.rateAvailPlans[w].price=parseFloat(d.rateAvailPlans[w].price).toFixed(0),void 0!=d.rateAvailPlans[w].memberPrice?(d.rateAvailPlans[w].leadMemberRate=parseFloat(d.rateAvailPlans[w].leadMemberRate).toFixed(0),d.rateAvailPlans[w].discountMemberRate=parseFloat(d.rateAvailPlans[w].discountMemberRate).toFixed(0),d.rateAvailPlans[w].memberPrice=parseFloat(d.rateAvailPlans[w].memberPrice).toFixed(0),d.rateAvailPlans[w].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[w].leadMemberRate)<=Number(d.rateAvailPlans[w].leadRate)):d.rateAvailPlans[w].isMemberRatePriceIsLowest=!1);d.rateAvailCategories=n.RatesAvail.roomStays[0].roomCategories,
d.rateAvailCategoriesPackage=n.RatesAvail.roomStays[0].packageCategories;var ke,Ne=function(){var e=S.findIndex(d.rateAvailCategories,function(e){return e.categoryCode==v.getMainReservation().roomCategoryId});if(-1!=e)d.rateAvailCategories.forEach(function(e){e.selected=!1}),d.rateAvailCategories[e].selected=!0,ke=d.rateAvailCategories[e].categoryName,d.checkBox={selected:!1},Se=!1,d.isRoomCategoryFlag=!0;else{d.checkBox={selected:!0},Se=!0,d.isRoomCategoryFlag=!1;for(var a=0;a<d.rateAvailCategories.length;a++)d.rateAvailCategories[a].selected=!0,Me[a]=!0;d.isRoomCategoryFlag=!1}},Le=function(){if(void 0!=v.getMainReservation().roomCategoryId&&null!=v.getMainReservation().roomCategoryId&&" "!=v.getMainReservation().roomCategoryId&&void 0==v.getMainReservation().roomStays[0].roomRates[0].roomTypeCode)0==R.stepsById.accommodations.rooms.length&&Ne();else{d.checkBox={selected:!0},Se=!0;for(var e=0;e<d.rateAvailCategories.length;e++)d.rateAvailCategories[e].selected=!0,Me[e]=!0;d.isRoomCategoryFlag=!1}};if(void 0!=d.rateAvailCategoriesPackage)for(var w=0;w<d.rateAvailCategoriesPackage.length;w++)d.rateAvailCategoriesPackage[w].selected=!0,_e[w]=!0;d.checkBoxPackage={selected:!0},Ae=!0,d.changeALLRoomSelect=function(){if(1==d.checkBox.selected)for(var e=0;e<d.rateAvailCategories.length;e++)d.rateAvailCategories[e].selected=!0;else d.rateAvailCategories.forEach(function(e){e.selected=!1})},d.changeALLPackageSelect=function(){if(1==d.checkBoxPackage.selected){if(d.rateAvailCategoriesPackage)for(var e=0;e<d.rateAvailCategoriesPackage.length;e++)d.rateAvailCategoriesPackage[e].selected=!0}else for(var e=0;e<d.rateAvailCategoriesPackage.length;e++)d.rateAvailCategoriesPackage[e].selected=!1},d.changeRoomCategoriesSelect=function(){d.rateAvailCategories.forEach(function(e){0==e.selected&&(d.checkBox.selected=!1),1==e.selected&&(ke=e.categoryName)})},d.changePackageCategoriesSelect=function(){d.rateAvailCategoriesPackage.forEach(function(e){0==e.selected&&(d.checkBoxPackage.selected=!1)})},d.$watch("checkBox.selected",function(){if(1==d.checkBox.selected)d.optionsSelected=d.translate.page_accommodations_msgAllRooms;else{for(var e=d.rateAvailCategories.length,a=0;a<d.rateAvailCategories.length;a++)0==d.rateAvailCategories[a].selected&&e--;0==d.checkBox.selected?d.optionsSelected=1==e?ke:e+" "+d.translate.page_accommodations_msgSelected:d.optionsSelected=d.translate.page_accommodations_msgAllRooms}}),d.$watch("checkBoxPackage.selected",function(){if(1==d.checkBoxPackage.selected)d.optionsSelectedPackage=d.translate.page_accommodations_msgAllPackages;else{for(var e=d.rateAvailCategoriesPackage.length,a=0;a<d.rateAvailCategoriesPackage.length;a++)0==d.rateAvailCategoriesPackage[a].selected&&e--;0==d.checkBoxPackage.selected?(d.optionsSelectedPackage=e+d.translate.page_accommodations_msgSelected,l.debug(d.optionsSelectedPackage)):d.optionsSelectedPackage=d.translate.page_accommodations_msgAllPackages}}),d.$watch("translate",function(){if(1==d.checkBox.selected)d.optionsSelected=d.translate.page_accommodations_msgAllRooms;else{for(var e=d.rateAvailCategories.length,a=0;a<d.rateAvailCategories.length;a++)0==d.rateAvailCategories[a].selected&&e--;0==d.checkBox.selected?d.optionsSelected=1==e?ke:e+" "+d.translate.page_accommodations_msgSelected:d.optionsSelected=d.translate.page_accommodations_msgAllRooms}}),d.$watch("translate",function(){if(l.debug(v.getMainReservation()),0==v.getMainReservation().roomStays.length&&(0==R.stepsById.accommodations.rooms.length&&0==R.stepsById.accommodations.group.length&&void 0==R.stepsById.accommodations.package?R.stepsById.accommodations.placeholder=n.translate.global_header_lblSelect:void 0!=R.stepsById.accommodations.package&&0==R.stepsById.accommodations.rooms.length&&0==R.stepsById.accommodations.group.length&&0==R.stepsById.accommodations.package.length&&(R.stepsById.accommodations.placeholder=n.translate.global_header_lblSelect)),1==d.checkBoxPackage.selected)d.optionsSelectedPackage=d.translate.page_accommodations_msgAllPackages;else{for(var e=d.rateAvailCategoriesPackage.length,a=0;a<d.rateAvailCategoriesPackage.length;a++)0==d.rateAvailCategoriesPackage[a].selected&&e--;0==d.checkBoxPackage.selected?d.optionsSelectedPackage=e+"   "+d.translate.page_accommodations_msgSelected:d.optionsSelectedPackage=d.translate.page_accommodations_msgAllPackages}}),d.$watch("rateAvailCategories",function(){for(var e=d.rateAvailCategories.length,a=0;a<d.rateAvailCategories.length;a++)0==d.rateAvailCategories[a].selected&&e--;0==d.checkBox.selected?d.optionsSelected=1==e?ke:e+" "+d.translate.page_accommodations_msgSelected:d.optionsSelected=d.translate.page_accommodations_msgAllRooms},!0),d.$watch("rateAvailCategoriesPackage",function(){if(void 0!=d.rateAvailCategoriesPackage){for(var e=d.rateAvailCategoriesPackage.length,a=0;a<d.rateAvailCategoriesPackage.length;a++)0==d.rateAvailCategoriesPackage[a].selected&&e--;0==d.checkBoxPackage.selected?d.optionsSelectedPackage=e+"   "+d.translate.page_accommodations_msgSelected:d.optionsSelectedPackage=d.translate.page_accommodations_msgAllPackages}},!0);for(var w=0;w<d.rateAvailPlans.length;w++)if(1==d.rateAvailPlans[w].default){d.navFilterData={ratePlanCode:d.rateAvailPlans[w]},d.navFilterData.ratePlanCode.price=d.rateAvailPlans[w].leadRate-d.rateAvailPlans[w].discountRate,Y&&d.rateAvailPlans[w].leadMemberRate&&void 0!=d.rateAvailPlans[w].discountMemberRate&&(d.navFilterData.ratePlanCode.memberPrice=d.rateAvailPlans[w].leadMemberRate-d.rateAvailPlans[w].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(d.navFilterData.ratePlanCode.price=d.navFilterData.ratePlanCode.price.toFixed(2),d.navFilterData.ratePlanCode.memberPrice&&(d.navFilterData.ratePlanCode.memberPrice=d.navFilterData.ratePlanCode.memberPrice.toFixed(2)));break}void 0!=d.navFilterData&&(te=angular.copy(d.navFilterData.ratePlanCode.leadRate),oe=angular.copy(d.navFilterData.ratePlanCode.price),re=angular.copy(d.navFilterData.ratePlanCode.leadMemberRate),ne=angular.copy(d.navFilterData.ratePlanCode.memberPrice),l.debug(d.navFilterData.ratePlanCode.leadRate+" $scope.navFilterData.ratePlanCode.leadRate ")),Pe=g.getHotelInfo(),d.roomCategoriesEnabled=!Pe.roomCategoriesEnabled,d.cancelAccommodation=function(){for(var e=0;e<d.rateAvailCategories.length;e++)d.rateAvailCategories[e].selected=Me[e];d.checkBox.selected=1==Se,d.dpHide=!1;var a=document.getElementById("room-category-dropdown-id");a&&a.focus()},n.$on("CancelAccommodation",function(){for(var e=0;e<d.rateAvailCategories.length;e++)d.rateAvailCategories[e].selected=Me[e];d.checkBox.selected=1==Se;for(var e=0;e<d.rateAvailCategoriesPackage.length;e++)d.rateAvailCategoriesPackage[e].selected=_e[e];d.checkBoxPackage.selected=1==Ae,d.dpHide=!1,d.status.isopen=!1}),d.changeCatecory=function(e){var a,t;if(1==n.displayMultiRateListView){if(1==d.checkBox.selected)d.categorizedMultirate=Te,t=angular.copy(Te),a=t,a.shift(),Se=!0;else{var o=0;Se=!1,d.categorizedMultirate=[];for(var r=0;r<d.rateAvailCategories.length;r++)1==d.rateAvailCategories[r].selected?(Me[r]=!0,Te.forEach(function(e,a){d.rateAvailCategories[r].categoryCode==e.categoryCode&&(d.categorizedMultirate[o]=Te[a],o++)})):Me[r]=!1}d.dpHide=!1}else{if(1==d.checkBox.selected)d.categorized=be,t=angular.copy(be),a=t,a.shift(),Se=!0;else{var o=0;Se=!1,d.categorized=[];for(var r=0;r<d.rateAvailCategories.length;r++)1==d.rateAvailCategories[r].selected?(Me[r]=!0,be.forEach(function(e,a){d.rateAvailCategories[r].categoryCode==e.categoryCode&&(d.categorized[o]=be[a],o++)})):Me[r]=!1;a=d.categorized}d.dpHide=!1;for(var i="",r=0;r<a.length;r++)i+=r==a.length-1?a[r].categoryCode:a[r].categoryCode+",";if(d.selectedRoomCatgCodes=i,e){var s=document.getElementById("room-category-dropdown-id");s&&s.focus()}}},d.cancelAccommodationPackage=function(){for(var e=0;e<d.rateAvailCategoriesPackage.length;e++)d.rateAvailCategoriesPackage[e].selected=_e[e];d.checkBoxPackage.selected=1==Ae,d.dpHide=!1,setTimeout(function(){var e=document.getElementById("package-category-dropdown");e&&e.focus()})},d.changePackageCategory=function(e){if(l.warn(JSON.stringify(Ee)+"cachedAllPackages"),1==d.checkBoxPackage.selected)d.categorizedPackages=Ee,Ae=!0;else{var a=0;Ae=!1,d.categorizedPackages=[];for(var t=0;t<d.rateAvailCategoriesPackage.length;t++)1==d.rateAvailCategoriesPackage[t].selected?(_e[t]=!0,Ee.forEach(function(e,o){d.rateAvailCategoriesPackage[t].categoryCode==e.categoryCode&&(d.categorizedPackages[a]=Ee[o],a++)})):_e[t]=!1}d.dpHide=!1;for(var o=d.categorizedPackages,r="",t=0;t<o.length;t++)r+=t==o.length-1?o[t].categoryCode:o[t].categoryCode+",";d.selectedPackageCatgCodes=r,e&&setTimeout(function(){var e=document.getElementById("package-category-dropdown");e&&e.focus()})};if(P(q),void 0!=J&&P(J),function(){if(void 0!=d.navFilterData){var e=0,a=0;fe[0].categoryRooms[a]={},fe[0].categoryRooms[a].categoryRoom=[];for(var t=0;t<q.length;t++)if(!q[t].hasOwnProperty("categoryCode")){q[t].priceTagRate=[],q[t].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var o=0;o<q[t].averageRates.length;o++)if("Regular"==q[t].averageRates[o].ratePlanType&&q[t].averageRates[o].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=q[t].nightlyRates&&q[t].nightlyRates.length>0){q[t].averageRates[o].nightlyRates=[];for(var r=0;r<q[t].nightlyRates.length;r++)q[t].nightlyRates[r].ratePlanCode==q[t].averageRates[o].ratePlanCode&&q[t].averageRates[o].nightlyRates.push(angular.copy(q[t].nightlyRates[r]))}q[t].priceTagRate.push(q[t].averageRates[o])}else if(q[t].averageRates[o].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=q[t].nightlyRates&&q[t].nightlyRates.length>0){q[t].averageRates[o].nightlyRates=[];for(var r=0;r<q[t].nightlyRates.length;r++)"Group"==q[t].averageRates[o].ratePlanType?q[t].nightlyRates[r].ratePlanCode==q[t].averageRates[o].roomRateCode&&q[t].averageRates[o].nightlyRates.push(angular.copy(q[t].nightlyRates[r])):q[t].nightlyRates[r].ratePlanCode==q[t].averageRates[o].ratePlanCode&&q[t].averageRates[o].nightlyRates.push(angular.copy(q[t].nightlyRates[r]))}q[t].priceTagRate.unshift(q[t].averageRates[o])}for(var i=0;i<d.rateAvailPlans.length;i++)for(var s=0;s<q[t].priceTagRate.length;s++)q[t].priceTagRate[s].ratePlanCode==d.rateAvailPlans[i].ratePlanCode&&(q[t].priceTagRate[s].ratePlanName=d.rateAvailPlans[i].ratePlanName,q[t].priceTagRate[s].ratePlanDescription=d.rateAvailPlans[i].ratePlanDescription,q[t].priceTagRate[s].cancellationPolicy=d.rateAvailPlans[i].cancellationPolicy,q[t].priceTagRate[s].guaranteePolicy=d.rateAvailPlans[i].guaranteePolicy,q[t].priceTagRate[s].sortOrder=d.rateAvailPlans[i].sortOrder,void 0!=d.rateAvailPlans[i].packagePolicies&&(q[t].priceTagRate[s].packagePolicies=d.rateAvailPlans[i].packagePolicies));for(var i=0;i<q[t].averageRates.length;i++){for(var l=0;l<d.rateAvailPlans.length;l++)d.rateAvailPlans[l].ratePlanCode==q[t].averageRates[i].ratePlanCode&&(q[t].priceTagRate[i].ratePlanName=d.rateAvailPlans[l].ratePlanName,q[t].priceTagRate[i].sortOrder=d.rateAvailPlans[l].sortOrder);d.navFilterData.ratePlanCode.ratePlanCode==q[t].averageRates[i].ratePlanCode&&(q[t].currentRate=q[t].averageRates[i],q[t].currentRate.price=q[t].currentRate.rate-q[t].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(q[t].currentRate.price=q[t].currentRate.price.toFixed(2)),fe[0].categoryRooms[a].categoryRoom.push(q[t]),e++)}e%X==0&&0!=e&&(a++,fe[0].categoryRooms[a]={},fe[0].categoryRooms[a].categoryRoom=[])}if(0!=fe[0].categoryRooms[0].categoryRoom.length){for(var c=fe[0].categoryRooms.length;c>0;c--)0==fe[0].categoryRooms[c-1].categoryRoom.length&&fe[0].categoryRooms.splice(c-1,1);d.categorized.push(fe[0])}}if(void 0!=J){d.categorizedPackages=[];var m=[{categoryPackages:[]}],e=0,a=0;m[0].categoryPackages[a]={},m[0].categoryPackages[a].categoryPackage=[];for(var t=0;t<J.length;t++)J[t].hasOwnProperty("categoryCode")||(m[0].categoryPackages[a].categoryPackage.push(J[t]),e++),e%X==0&&0!=e&&(a++,m[0].categoryPackages[a]={},m[0].categoryPackages[a].categoryPackage=[]);if(0!=m[0].categoryPackages[0].categoryPackage.length){for(var c=m[0].categoryPackages.length;c>0;c--)0==m[0].categoryPackages[c-1].categoryPackage.length&&m[0].categoryPackages.splice(c-1,1);d.categorizedPackages.push(m[0])}}if(void 0!=d.navFilterData)for(var u=0;u<n.RatesAvail.roomStays[0].roomCategories.length;u++){e=0,a=0,Re={name:n.RatesAvail.roomStays[0].roomCategories[u].categoryName,categoryCode:n.RatesAvail.roomStays[0].roomCategories[u].categoryCode,categoryRooms:[]},Re.categoryRooms[0]={},Re.categoryRooms[0].categoryRoom=[];for(var t=0;t<q.length;t++){var p=!1;if(q[t].categoryCode==n.RatesAvail.roomStays[0].roomCategories[u].categoryCode){q[t].priceTagRate=[],q[t].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var o=0;o<q[t].averageRates.length;o++)if("Regular"==q[t].averageRates[o].ratePlanType&&q[t].averageRates[o].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=q[t].nightlyRates&&q[t].nightlyRates.length>0){q[t].averageRates[o].nightlyRates=[];for(var r=0;r<q[t].nightlyRates.length;r++)q[t].nightlyRates[r].ratePlanCode==q[t].averageRates[o].ratePlanCode&&q[t].averageRates[o].nightlyRates.push(angular.copy(q[t].nightlyRates[r]))}q[t].priceTagRate.push(q[t].averageRates[o])}else if(q[t].averageRates[o].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=q[t].nightlyRates&&q[t].nightlyRates.length>0){q[t].averageRates[o].nightlyRates=[];for(var r=0;r<q[t].nightlyRates.length;r++)"Group"==q[t].averageRates[o].ratePlanType?q[t].nightlyRates[r].ratePlanCode==q[t].averageRates[o].roomRateCode&&q[t].averageRates[o].nightlyRates.push(angular.copy(q[t].nightlyRates[r])):q[t].nightlyRates[r].ratePlanCode==q[t].averageRates[o].ratePlanCode&&q[t].averageRates[o].nightlyRates.push(angular.copy(q[t].nightlyRates[r]))}q[t].priceTagRate.unshift(q[t].averageRates[o])}for(var i=0;i<q[t].averageRates.length;i++){for(var l=0;l<d.rateAvailPlans.length;l++)d.rateAvailPlans[l].ratePlanCode==q[t].averageRates[i].ratePlanCode&&(q[t].priceTagRate[i].ratePlanName=d.rateAvailPlans[l].ratePlanName,q[t].priceTagRate[i].sortOrder=d.rateAvailPlans[l].sortOrder);d.navFilterData.ratePlanCode.ratePlanCode==q[t].averageRates[i].ratePlanCode&&(q[t].currentRate=q[t].averageRates[i],q[t].currentRate.price=q[t].currentRate.rate-q[t].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(q[t].currentRate.price=q[t].currentRate.price.toFixed(2)),Re.categoryRooms[a].categoryRoom.push(q[t]),e++,!0)}for(var i=0;i<d.rateAvailPlans.length;i++)for(var s=0;s<q[t].priceTagRate.length;s++)q[t].priceTagRate[s].ratePlanCode==d.rateAvailPlans[i].ratePlanCode&&(q[t].priceTagRate[s].ratePlanName=d.rateAvailPlans[i].ratePlanName,q[t].priceTagRate[s].ratePlanDescription=d.rateAvailPlans[i].ratePlanDescription,q[t].priceTagRate[s].cancellationPolicy=d.rateAvailPlans[i].cancellationPolicy,q[t].priceTagRate[s].guaranteePolicy=d.rateAvailPlans[i].guaranteePolicy,q[t].priceTagRate[s].sortOrder=d.rateAvailPlans[i].sortOrder,void 0!=d.rateAvailPlans[i].packagePolicies&&(q[t].priceTagRate[s].packagePolicies=d.rateAvailPlans[i].packagePolicies))}e%X==0&&0!=e&&(p=!0,a++,Re.categoryRooms[a]={},Re.categoryRooms[a].categoryRoom=[])}if(1==p){for(var y=Re.categoryRooms.length;y>0;y--)0==Re.categoryRooms[y-1].categoryRoom.length&&Re.categoryRooms.splice(y-1,1);d.categorized.push(Re)}else if(Re.categoryRooms[a].categoryRoom.length>0){for(var y=Re.categoryRooms.length;y>0;y--)0==Re.categoryRooms[y-1].categoryRoom.length&&Re.categoryRooms.splice(y-1,1);d.categorized.push(Re)}}if(void 0!=n.RatesAvail.roomStays[0].packageCategories)for(var u=0;u<n.RatesAvail.roomStays[0].packageCategories.length;u++){var e=0,a=0,v={name:n.RatesAvail.roomStays[0].packageCategories[u].categoryName,categoryCode:n.RatesAvail.roomStays[0].packageCategories[u].categoryCode,categoryPackages:[]};v.categoryPackages[0]={},v.categoryPackages[0].categoryPackage=[];for(var t=0;t<J.length;t++){var p=!1;J[t].categoryCode==n.RatesAvail.roomStays[0].packageCategories[u].categoryCode&&(v.categoryPackages[a].categoryPackage.push(J[t]),e++,!0),e%X==0&&0!=e&&(p=!0,a++,v.categoryPackages[a]={},v.categoryPackages[a].categoryPackage=[])}if(1==p){for(var y=v.categoryPackages.length;y>0;y--)0==v.categoryPackages[y-1].categoryPackage.length&&v.categoryPackages.splice(y-1,1);d.categorizedPackages.push(v)}else if(v.categoryPackages[a].categoryPackage.length>0){for(var y=v.categoryPackages.length;y>0;y--)0==v.categoryPackages[y-1].categoryPackage.length&&v.categoryPackages.splice(y-1,1);d.categorizedPackages.push(v)}}}(),1==n.displayMultiRateListView){var Ge=v.getCodeTypes();1!=d.packageSelected||void 0==d.navFilterData||void 0==d.navFilterData.ratePlanCode||"Package"!=d.navFilterData.ratePlanCode.ratePlanType&&"Group"!=d.navFilterData.ratePlanCode.ratePlanType?v.getReservation().roomStays[0].ratePlans.length>0&&("Package"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType||"Group"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType)?n.displayMultiRateListView=!1:void 0!=Ge&&(Ge.indexOf("Group")>-1||Ge.indexOf("group")>-1)?n.displayMultiRateListView=!1:function(){var e=[{categoryRooms:[]}],a=n.RatesAvail.roomStays[0].allRoomTypes;if(void 0!=d.navFilterData){var t=0,o=0;e[0].categoryRooms[o]={},e[0].categoryRooms[o].categoryRoom=[];for(var r=0;r<a.length;r++)if(!a[r].hasOwnProperty("categoryCode")){a[r].priceTagRate=[],a[r].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var i=0;i<a[r].averageRates.length;i++)if("Regular"==a[r].averageRates[i].ratePlanType&&a[r].averageRates[i].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=a[r].nightlyRates&&a[r].nightlyRates.length>0){a[r].averageRates[i].nightlyRates=[];for(var s=0;s<a[r].nightlyRates.length;s++)a[r].nightlyRates[s].ratePlanCode==a[r].averageRates[i].ratePlanCode&&a[r].averageRates[i].nightlyRates.push(angular.copy(a[r].nightlyRates[s]))}a[r].priceTagRate.push(a[r].averageRates[i])}else if(a[r].averageRates[i].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=a[r].nightlyRates&&a[r].nightlyRates.length>0){a[r].averageRates[i].nightlyRates=[];for(var s=0;s<a[r].nightlyRates.length;s++)"Group"==a[r].averageRates[i].ratePlanType?a[r].nightlyRates[s].ratePlanCode==a[r].averageRates[i].roomRateCode&&a[r].averageRates[i].nightlyRates.push(angular.copy(a[r].nightlyRates[s])):a[r].nightlyRates[s].ratePlanCode==a[r].averageRates[i].ratePlanCode&&a[r].averageRates[i].nightlyRates.push(angular.copy(a[r].nightlyRates[s]))}a[r].priceTagRate.unshift(a[r].averageRates[i])}for(var l=0;l<d.rateAvailPlans.length;l++)for(var c=0;c<a[r].priceTagRate.length;c++)a[r].priceTagRate[c].ratePlanCode==d.rateAvailPlans[l].ratePlanCode&&(a[r].priceTagRate[c].ratePlanName=d.rateAvailPlans[l].ratePlanName,a[r].priceTagRate[c].ratePlanDescription=d.rateAvailPlans[l].ratePlanDescription,a[r].priceTagRate[c].cancellationPolicy=d.rateAvailPlans[l].cancellationPolicy,a[r].priceTagRate[c].guaranteePolicy=d.rateAvailPlans[l].guaranteePolicy,a[r].priceTagRate[c].sortOrder=d.rateAvailPlans[l].sortOrder,a[r].priceTagRate[c].isMultirateRadioClicked=!1,void 0!=d.rateAvailPlans[l].packagePolicies&&(a[r].priceTagRate[c].packagePolicies=d.rateAvailPlans[l].packagePolicies));if(void 0!=a[r].priceTagRate){a[r].priceTagRate.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var m=0;m<a[r].priceTagRate.length;m++)if(a[r].priceTagRate[m].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){a[r].priceTagRate.unshift(a[r].priceTagRate[m]),a[r].priceTagRate.splice(m+1,1);break}}if(a[r].averageRates.length>0){for(var u=!1,l=0;l<a[r].averageRates.length;l++)d.navFilterData.ratePlanCode.ratePlanCode==a[r].averageRates[l].ratePlanCode&&(a[r].currentRate=a[r].averageRates[l],a[r].currentRate.price=a[r].currentRate.rate-a[r].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(a[r].currentRate.price=a[r].currentRate.price.toFixed(2)),t++,u=!0);0==u&&a[r].priceTagRate.length>0&&(a[r].currentRate=a[r].priceTagRate[0],a[r].currentCode=a[r].priceTagRate[0].ratePlanCode),a[r].id=r,e[0].categoryRooms[o].categoryRoom.push(a[r]),d.multiRateRadio[a[r].roomTypeCode]=a[r].roomTypeCode+"_"+a[r].currentRate.ratePlanCode}t%X==0&&0!=t&&(o++,e[0].categoryRooms[o]={},e[0].categoryRooms[o].categoryRoom=[])}if(0!=e[0].categoryRooms[0].categoryRoom.length){for(var p=e[0].categoryRooms.length;p>0;p--)0==e[0].categoryRooms[p-1].categoryRoom.length&&e[0].categoryRooms.splice(p-1,1);d.categorizedMultirate.push(e[0])}}if(void 0!=d.navFilterData)for(var y=0;y<n.RatesAvail.roomStays[0].roomCategories.length;y++){t=0,o=0,Re={name:n.RatesAvail.roomStays[0].roomCategories[y].categoryName,categoryCode:n.RatesAvail.roomStays[0].roomCategories[y].categoryCode,categoryRooms:[]},Re.categoryRooms[0]={},Re.categoryRooms[0].categoryRoom=[];for(var r=0;r<a.length;r++){var v=!1;if(a[r].categoryCode==n.RatesAvail.roomStays[0].roomCategories[y].categoryCode){a[r].priceTagRate=[],a[r].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var i=0;i<a[r].averageRates.length;i++)if("Regular"==a[r].averageRates[i].ratePlanType&&a[r].averageRates[i].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=a[r].nightlyRates&&a[r].nightlyRates.length>0){a[r].averageRates[i].nightlyRates=[];for(var s=0;s<a[r].nightlyRates.length;s++)a[r].nightlyRates[s].ratePlanCode==a[r].averageRates[i].ratePlanCode&&a[r].averageRates[i].nightlyRates.push(angular.copy(a[r].nightlyRates[s]))}a[r].priceTagRate.push(a[r].averageRates[i])}else if(a[r].averageRates[i].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=a[r].nightlyRates&&a[r].nightlyRates.length>0){a[r].averageRates[i].nightlyRates=[];for(var s=0;s<a[r].nightlyRates.length;s++)"Group"==a[r].averageRates[i].ratePlanType?a[r].nightlyRates[s].ratePlanCode==a[r].averageRates[i].roomRateCode&&a[r].averageRates[i].nightlyRates.push(angular.copy(a[r].nightlyRates[s])):a[r].nightlyRates[s].ratePlanCode==a[r].averageRates[i].ratePlanCode&&a[r].averageRates[i].nightlyRates.push(angular.copy(a[r].nightlyRates[s]))}a[r].priceTagRate.unshift(a[r].averageRates[i])}for(var l=0;l<d.rateAvailPlans.length;l++)for(var c=0;c<a[r].priceTagRate.length;c++)a[r].priceTagRate[c].ratePlanCode==d.rateAvailPlans[l].ratePlanCode&&(a[r].priceTagRate[c].ratePlanName=d.rateAvailPlans[l].ratePlanName,a[r].priceTagRate[c].ratePlanDescription=d.rateAvailPlans[l].ratePlanDescription,a[r].priceTagRate[c].cancellationPolicy=d.rateAvailPlans[l].cancellationPolicy,a[r].priceTagRate[c].guaranteePolicy=d.rateAvailPlans[l].guaranteePolicy,a[r].priceTagRate[c].sortOrder=d.rateAvailPlans[l].sortOrder,a[r].priceTagRate[c].isMultirateRadioClicked=!1,void 0!=d.rateAvailPlans[l].packagePolicies&&(a[r].priceTagRate[c].packagePolicies=d.rateAvailPlans[l].packagePolicies));if(void 0!=a[r].priceTagRate){a[r].priceTagRate.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var m=0;m<a[r].priceTagRate.length;m++)if(a[r].priceTagRate[m].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){a[r].priceTagRate.unshift(a[r].priceTagRate[m]),a[r].priceTagRate.splice(m+1,1);break}}if(a[r].averageRates.length>0){for(var u=!1,l=0;l<a[r].averageRates.length;l++){for(var h=0;h<d.rateAvailPlans.length;h++)d.rateAvailPlans[h].ratePlanCode,a[r].averageRates[l].ratePlanCode;d.navFilterData.ratePlanCode.ratePlanCode==a[r].averageRates[l].ratePlanCode&&(a[r].currentRate=a[r].averageRates[l],a[r].currentRate.price=a[r].currentRate.rate-a[r].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(a[r].currentRate.price=a[r].currentRate.price.toFixed(2)),t++,!0,u=!0)}0==u&&a[r].priceTagRate.length>0&&(a[r].currentRate=a[r].priceTagRate[0],a[r].currentCode=a[r].priceTagRate[0].ratePlanCode),a[r].id=r,Re.categoryRooms[o].categoryRoom.push(a[r]),d.multiRateRadio[a[r].roomTypeCode]=a[r].roomTypeCode+"_"+a[r].currentRate.ratePlanCode}}t%X==0&&0!=t&&(v=!0,o++,Re.categoryRooms[o]={},Re.categoryRooms[o].categoryRoom=[])}if(1==v){for(var R=Re.categoryRooms.length;R>0;R--)0==Re.categoryRooms[R-1].categoryRoom.length&&Re.categoryRooms.splice(R-1,1);d.categorizedMultirate.push(Re)}else if(Re.categoryRooms[o].categoryRoom.length>0){for(var R=Re.categoryRooms.length;R>0;R--)0==Re.categoryRooms[R-1].categoryRoom.length&&Re.categoryRooms.splice(R-1,1);d.categorizedMultirate.push(Re)}}Te=d.categorizedMultirate}():n.displayMultiRateListView=!1}d.resetPackages=function(){v.deleteConfig("OPEN_PACKAGE_DETAIL")},d.addPackage=function(a,o){v.deleteConfig("OPEN_PACKAGE_DETAIL"),n.toggle.intlMenu=!1;var i=function(e,a){if(d.enhancementFlag=!1,d.totalPrice=0,d.subTotalFinalPrice=0,d.packageSelected=!0,se=!0,l.debug(o),void 0!=d.navFilterData&&(te=angular.copy(d.navFilterData.ratePlanCode.leadRate),oe=angular.copy(d.navFilterData.ratePlanCode.price),re=angular.copy(d.navFilterData.ratePlanCode.leadMemberRate),ne=angular.copy(d.navFilterData.ratePlanCode.memberPrice)),a.ratePlanCode=o,a.ratePlanType="package",void 0!=d.navFilterData&&(d.navFilterData.ratePlanCode.ratePlanCode=o,d.navFilterData.ratePlanCode.ratePlanType="package"),d.categorized)for(var i=0;i<d.categorized.length;i++)for(var s=0;s<d.categorized[i].categoryRooms.length;s++)for(var m=0;m<d.categorized[i].categoryRooms[s].categoryRoom.length;m++)1==d.categorized[i].categoryRooms[s].categoryRoom[m].isSelected&&(d.closeRoomDetail(d.categorized[i].categoryRooms[s].categoryRoom[m]),d.categorized[i].categoryRooms[s].categoryRoom[m].myStyle="#116eb5");if(d.categorizedPackages)for(var i=0;i<d.categorizedPackages.length;i++)for(var s=0;s<d.categorizedPackages[i].categoryPackages.length;s++)for(var m=0;m<d.categorizedPackages[i].categoryPackages[s].categoryPackage.length;m++)1==d.categorizedPackages[i].categoryPackages[s].categoryPackage[m].isSelected&&(d.closePackageDetail(d.categorizedPackages[i].categoryPackages[s].categoryPackage[m]),d.categorizedPackages[i].categoryPackages[s].categoryPackage[m].myStyle="#116eb5");if(d.categorized)for(var i=0;i<d.categorized.length;i++)for(var s=0;s<d.categorized[i].categoryRooms.length;s++)for(var m=0;m<d.categorized[i].categoryRooms[s].categoryRoom.length;m++)d.categorized[i].categoryRooms[s].categoryRoom[m].isSelected=!1;if(d.categorizedPackages)for(var i=0;i<d.categorizedPackages.length;i++)for(var s=0;s<d.categorizedPackages[i].categoryPackages.length;s++)for(var m=0;m<d.categorizedPackages[i].categoryPackages[s].categoryPackage.length;m++)d.categorizedPackages[i].categoryPackages[s].categoryPackage[m].isSelected=!1;a=v.passPromotionIdInApi(a),c.getAccommodationRooms(a).getAllRooms().then(function(e){v.validateAvailForPromotions(e.data),n.RatesAvail=$?O.createDuplicateRateList(e.data):e.data,De=angular.copy(n.RatesAvail),d.rateAvailPlans=n.RatesAvail.roomStays[0].ratePlans;for(var a=0;a<d.rateAvailPlans.length;a++)if(1==d.rateAvailPlans[a].default){d.navFilterData={ratePlanCode:d.rateAvailPlans[a]},d.navFilterData.ratePlanCode.price=d.rateAvailPlans[a].leadRate-d.rateAvailPlans[a].discountRate,Y&&d.rateAvailPlans[a].leadMemberRate&&void 0!=d.rateAvailPlans[a].discountMemberRate&&(d.navFilterData.ratePlanCode.memberPrice=d.rateAvailPlans[a].leadMemberRate-d.rateAvailPlans[a].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(d.navFilterData.ratePlanCode.price=d.navFilterData.ratePlanCode.price.toFixed(2),d.navFilterData.ratePlanCode.memberPrice&&(d.navFilterData.ratePlanCode.memberPrice=d.navFilterData.ratePlanCode.memberPrice.toFixed(2)));break}1==n.displayMultiRateListView&&(n.displayMultiRateListView=!1),0!=n.RatesAvail.roomStays[0].roomCategories.length&&n.RatesAvail.roomStays[0].roomCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageCategories&&0!=n.RatesAvail.roomStays[0].packageCategories.length&&n.RatesAvail.roomStays[0].packageCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].ratePlans&&0!=n.RatesAvail.roomStays[0].ratePlans.length&&n.RatesAvail.roomStays[0].ratePlans.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),0!=n.RatesAvail.roomStays[0].roomTypes.length&&n.RatesAvail.roomStays[0].roomTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageTypes&&0!=n.RatesAvail.roomStays[0].packageTypes.length&&n.RatesAvail.roomStays[0].packageTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var a=0;a<n.RatesAvail.roomStays[0].roomCategories.length;a++){for(var t=!1,o=0;o<n.RatesAvail.roomStays[0].roomTypes.length;o++)n.RatesAvail.roomStays[0].roomTypes[o].categoryCode==n.RatesAvail.roomStays[0].roomCategories[a].categoryCode&&(t=!0);0==t&&(n.RatesAvail.roomStays[0].roomCategories.splice(a,1),a--)}if(void 0!=n.RatesAvail.roomStays[0].packageCategories)for(var a=0;a<n.RatesAvail.roomStays[0].packageCategories.length;a++){for(var t=!1,o=0;o<n.RatesAvail.roomStays[0].packageTypes.length;o++)n.RatesAvail.roomStays[0].packageTypes[o].categoryCode==n.RatesAvail.roomStays[0].packageCategories[a].categoryCode&&(t=!0);0==t&&(n.RatesAvail.roomStays[0].packageCategories.splice(a,1),a--)}if(g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator){for(var a=0;a<n.RatesAvail.roomStays[0].roomTypes.length;a++)for(var o=0;o<n.RatesAvail.roomStays[0].roomTypes[a].averageRates.length;o++)n.RatesAvail.roomStays[0].roomTypes[a].averageRates[o].rate=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[o].rate).toFixed(2),n.RatesAvail.roomStays[0].roomTypes[a].averageRates[o].discount=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[o].discount).toFixed(2);if(void 0!=n.RatesAvail.roomStays[0].packageTypes)for(var a=0;a<n.RatesAvail.roomStays[0].packageTypes.length;a++)n.RatesAvail.roomStays[0].packageTypes[a].leadRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].leadRate).toFixed(2),n.RatesAvail.roomStays[0].packageTypes[a].discountRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].discountRate).toFixed(2);n.RatesAvail.roomStays[0].ratePlans.forEach(function(e){e.leadRate=parseFloat(e.leadRate).toFixed(2)})}var i={},s={},l=[],c=[];d.currentRoom="",d.currentPackage="",d.categorized=[],d.categorizedMultirate=[],d.categorizedPackages=[],d.RoomDetailSwitch=!1;var m=n.RatesAvail.roomStays[0].roomTypes,u=n.RatesAvail.roomStays[0].packageTypes,p=angular.copy(m);angular.copy(u),void 0!=u&&u.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"}),m.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"});for(var a=0;a<m.length;a++){m[a].upgradeRoom=[],m[a].isSelected=!1,m[a].myStyle="#116eb5";for(var y=0;y<m[a].averageRates.length;y++)m[a].averageRates[y].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode&&(m[a].finalPrice=m[a].averageRates[y].rate-m[a].averageRates[y].discount);if(m[a].roomUpgradeOptions.length>0)for(var o=0;o<m[a].roomUpgradeOptions.length;o++)for(var h=0;h<p.length;h++)if(p[h].roomTypeCode==m[a].roomUpgradeOptions[o].roomTypeCode){p[h].sortOrder=m[a].roomUpgradeOptions[o].sortOrder;for(var f=0;f<p[h].averageRates.length;f++)p[h].averageRates[f].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode&&(p[h].priceChanged=p[h].averageRates[f].rate-p[h].averageRates[f].discount-m[a].finalPrice,p[h].averageRates[f].merchandisedCurrency&&(p[h].merchandisedCurrency=p[h].averageRates[f].merchandisedCurrency));if(0!=p[h].priceChanged){var C=angular.copy(p[h]);m[a].upgradeRoom.push(C)}}}d.rateAvailPlans=n.RatesAvail.roomStays[0].ratePlans;for(var a=0;a<d.rateAvailPlans.length;a++)d.rateAvailPlans[a].price=d.rateAvailPlans[a].leadRate-d.rateAvailPlans[a].discountRate,
Y&&d.rateAvailPlans[a].leadMemberRate&&void 0!=d.rateAvailPlans[a].discountMemberRate&&(d.rateAvailPlans[a].memberPrice=d.rateAvailPlans[a].leadMemberRate-d.rateAvailPlans[a].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(d.rateAvailPlans[a].leadRate=parseFloat(d.rateAvailPlans[a].leadRate).toFixed(2),d.rateAvailPlans[a].discountRate=parseFloat(d.rateAvailPlans[a].discountRate).toFixed(2),d.rateAvailPlans[a].price=parseFloat(d.rateAvailPlans[a].price).toFixed(2),void 0!=d.rateAvailPlans[a].memberPrice?(d.rateAvailPlans[a].leadMemberRate=parseFloat(d.rateAvailPlans[a].leadMemberRate).toFixed(2),d.rateAvailPlans[a].discountMemberRate=parseFloat(d.rateAvailPlans[a].discountMemberRate).toFixed(2),d.rateAvailPlans[a].memberPrice=parseFloat(d.rateAvailPlans[a].memberPrice).toFixed(2),d.rateAvailPlans[a].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[a].leadMemberRate)<=Number(d.rateAvailPlans[a].leadRate)):d.rateAvailPlans[a].isMemberRatePriceIsLowest=!1):(d.rateAvailPlans[a].leadRate=parseFloat(d.rateAvailPlans[a].leadRate).toFixed(0),d.rateAvailPlans[a].discountRate=parseFloat(d.rateAvailPlans[a].discountRate).toFixed(0),d.rateAvailPlans[a].price=parseFloat(d.rateAvailPlans[a].price).toFixed(0),void 0!=d.rateAvailPlans[a].memberPrice?(d.rateAvailPlans[a].leadMemberRate=parseFloat(d.rateAvailPlans[a].leadMemberRate).toFixed(0),d.rateAvailPlans[a].discountMemberRate=parseFloat(d.rateAvailPlans[a].discountMemberRate).toFixed(0),d.rateAvailPlans[a].memberPrice=parseFloat(d.rateAvailPlans[a].memberPrice).toFixed(0),d.rateAvailPlans[a].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[a].leadMemberRate)<=Number(d.rateAvailPlans[a].leadRate)):d.rateAvailPlans[a].isMemberRatePriceIsLowest=!1);d.rateAvailCategories=n.RatesAvail.roomStays[0].roomCategories,d.rateAvailCategoriesPackage=n.RatesAvail.roomStays[0].packageCategories,d.rateAvailCategories.forEach(function(e){e.selected=!0}),void 0!=d.rateAvailCategoriesPackage&&d.rateAvailCategoriesPackage.forEach(function(e){e.selected=!0});for(var a=0;a<d.rateAvailCategories.length;a++)l[a]=!0;for(var a=0;a<d.rateAvailCategories.length;a++)c[a]=!0;d.categorized=[],d.categorizedMultirate=[];var S=[{categoryRooms:[]}],A=0,I=0;S[0].categoryRooms[I]={},S[0].categoryRooms[I].categoryRoom=[];for(var f=0;f<m.length;f++)if(!m[f].hasOwnProperty("categoryCode")){m[f].priceTagRate=[],m[f].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var b=0;b<m[f].averageRates.length;b++)if("Regular"==m[f].averageRates[b].ratePlanType&&m[f].averageRates[b].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=m[f].nightlyRates&&m[f].nightlyRates.length>0){m[f].averageRates[b].nightlyRates=[];for(var D=0;D<m[f].nightlyRates.length;D++)m[f].nightlyRates[D].ratePlanCode==m[f].averageRates[b].ratePlanCode&&m[f].averageRates[b].nightlyRates.push(angular.copy(m[f].nightlyRates[D]))}m[f].priceTagRate.push(m[f].averageRates[b])}else if(m[f].averageRates[b].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=m[f].nightlyRates&&m[f].nightlyRates.length>0){m[f].averageRates[b].nightlyRates=[];for(var D=0;D<m[f].nightlyRates.length;D++)"Group"==m[f].averageRates[b].ratePlanType?m[f].nightlyRates[D].ratePlanCode==m[f].averageRates[b].roomRateCode&&m[f].averageRates[b].nightlyRates.push(angular.copy(m[f].nightlyRates[D])):m[f].nightlyRates[D].ratePlanCode==m[f].averageRates[b].ratePlanCode&&m[f].averageRates[b].nightlyRates.push(angular.copy(m[f].nightlyRates[D]))}m[f].priceTagRate.unshift(m[f].averageRates[b])}for(var a=0;a<d.rateAvailPlans.length;a++)for(var o=0;o<m[f].priceTagRate.length;o++)m[f].priceTagRate[o].ratePlanCode==d.rateAvailPlans[a].ratePlanCode&&(m[f].priceTagRate[o].ratePlanName=d.rateAvailPlans[a].ratePlanName,m[f].priceTagRate[o].ratePlanDescription=d.rateAvailPlans[a].ratePlanDescription,m[f].priceTagRate[o].cancellationPolicy=d.rateAvailPlans[a].cancellationPolicy,m[f].priceTagRate[o].guaranteePolicy=d.rateAvailPlans[a].guaranteePolicy,m[f].priceTagRate[o].sortOrder=d.rateAvailPlans[a].sortOrder,void 0!=d.rateAvailPlans[a].packagePolicies&&(m[f].priceTagRate[o].packagePolicies=d.rateAvailPlans[a].packagePolicies));for(var a=0;a<m[f].averageRates.length;a++){for(var T=0;T<d.rateAvailPlans.length;T++)d.rateAvailPlans[T].ratePlanCode==m[f].averageRates[a].ratePlanCode&&(m[f].priceTagRate[a].ratePlanName=d.rateAvailPlans[T].ratePlanName,m[f].priceTagRate[a].sortOrder=d.rateAvailPlans[T].sortOrder);d.navFilterData.ratePlanCode.ratePlanCode==m[f].averageRates[a].ratePlanCode&&(m[f].currentRate=m[f].averageRates[a],m[f].currentRate.price=m[f].currentRate.rate-m[f].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(m[f].currentRate.price=m[f].currentRate.price.toFixed(2)),S[0].categoryRooms[I].categoryRoom.push(m[f]),A++)}A%X==0&&0!=A&&(I++,S[0].categoryRooms[I]={},S[0].categoryRooms[I].categoryRoom=[])}if(0!=S[0].categoryRooms[0].categoryRoom.length){for(var E=S[0].categoryRooms.length;E>0;E--)0==S[0].categoryRooms[E-1].categoryRoom.length&&S[0].categoryRooms.splice(E-1,1);d.categorized.push(S[0])}if(void 0!=u){d.categorizedPackages=[];var M=[{categoryPackages:[]}],A=0,I=0;M[0].categoryPackages[I]={},M[0].categoryPackages[I].categoryPackage=[];for(var f=0;f<u.length;f++)u[f].hasOwnProperty("categoryCode")||(M[0].categoryPackages[I].categoryPackage.push(u[f]),A++),A%X==0&&0!=A&&(I++,M[0].categoryPackages[I]={},M[0].categoryPackages[I].categoryPackage=[]);if(0!=M[0].categoryPackages[0].categoryPackage.length){for(var E=M[0].categoryPackages.length;E>0;E--)0==M[0].categoryPackages[E-1].categoryPackage.length&&M[0].categoryPackages.splice(E-1,1);d.categorizedPackages.push(M[0])}}for(var h=0;h<n.RatesAvail.roomStays[0].roomCategories.length;h++){A=0,I=0,i={name:n.RatesAvail.roomStays[0].roomCategories[h].categoryName,categoryCode:n.RatesAvail.roomStays[0].roomCategories[h].categoryCode,categoryRooms:[]},i.categoryRooms[0]={},i.categoryRooms[0].categoryRoom=[];for(var f=0;f<m.length;f++){var _=!1;if(m[f].categoryCode==n.RatesAvail.roomStays[0].roomCategories[h].categoryCode){m[f].priceTagRate=[],m[f].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var b=0;b<m[f].averageRates.length;b++)if("Regular"==m[f].averageRates[b].ratePlanType&&m[f].averageRates[b].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=m[f].nightlyRates&&m[f].nightlyRates.length>0){m[f].averageRates[b].nightlyRates=[];for(var D=0;D<m[f].nightlyRates.length;D++)m[f].nightlyRates[D].ratePlanCode==m[f].averageRates[b].ratePlanCode&&m[f].averageRates[b].nightlyRates.push(angular.copy(m[f].nightlyRates[D]))}m[f].priceTagRate.push(m[f].averageRates[b])}else if(m[f].averageRates[b].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=m[f].nightlyRates&&m[f].nightlyRates.length>0){m[f].averageRates[b].nightlyRates=[];for(var D=0;D<m[f].nightlyRates.length;D++)"Group"==m[f].averageRates[b].ratePlanType?m[f].nightlyRates[D].ratePlanCode==m[f].averageRates[b].roomRateCode&&m[f].averageRates[b].nightlyRates.push(angular.copy(m[f].nightlyRates[D])):m[f].nightlyRates[D].ratePlanCode==m[f].averageRates[b].ratePlanCode&&m[f].averageRates[b].nightlyRates.push(angular.copy(m[f].nightlyRates[D]))}m[f].priceTagRate.unshift(m[f].averageRates[b])}for(var a=0;a<m[f].averageRates.length;a++){for(var T=0;T<d.rateAvailPlans.length;T++)d.rateAvailPlans[T].ratePlanCode==m[f].averageRates[a].ratePlanCode&&(m[f].priceTagRate[a].ratePlanName=d.rateAvailPlans[T].ratePlanName,m[f].priceTagRate[a].sortOrder=d.rateAvailPlans[T].sortOrder);d.navFilterData.ratePlanCode.ratePlanCode==m[f].averageRates[a].ratePlanCode&&(m[f].currentRate=m[f].averageRates[a],m[f].currentRate.price=m[f].currentRate.rate-m[f].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(m[f].currentRate.price=m[f].currentRate.price.toFixed(2)),i.categoryRooms[I].categoryRoom.push(m[f]),A++,!0)}for(var a=0;a<d.rateAvailPlans.length;a++)for(var o=0;o<m[f].priceTagRate.length;o++)m[f].priceTagRate[o].ratePlanCode==d.rateAvailPlans[a].ratePlanCode&&(m[f].priceTagRate[o].ratePlanName=d.rateAvailPlans[a].ratePlanName,m[f].priceTagRate[o].ratePlanDescription=d.rateAvailPlans[a].ratePlanDescription,m[f].priceTagRate[o].cancellationPolicy=d.rateAvailPlans[a].cancellationPolicy,m[f].priceTagRate[o].guaranteePolicy=d.rateAvailPlans[a].guaranteePolicy,m[f].priceTagRate[o].sortOrder=d.rateAvailPlans[a].sortOrder,void 0!=d.rateAvailPlans[a].packagePolicies&&(m[f].priceTagRate[o].packagePolicies=d.rateAvailPlans[a].packagePolicies))}A%X==0&&0!=A&&(_=!0,I++,i.categoryRooms[I]={},i.categoryRooms[I].categoryRoom=[])}if(1==_){for(var k=i.categoryRooms.length;k>0;k--)0==i.categoryRooms[k-1].categoryRoom.length&&i.categoryRooms.splice(k-1,1);d.categorized.push(i)}else if(i.categoryRooms[I].categoryRoom.length>0){for(var k=i.categoryRooms.length;k>0;k--)0==i.categoryRooms[k-1].categoryRoom.length&&i.categoryRooms.splice(k-1,1);d.categorized.push(i)}}if(void 0!=u)for(var h=0;h<n.RatesAvail.roomStays[0].packageCategories.length;h++){var A=0,I=0,s={name:n.RatesAvail.roomStays[0].packageCategories[h].categoryName,categoryCode:n.RatesAvail.roomStays[0].packageCategories[h].categoryCode,categoryPackages:[]};s.categoryPackages[0]={},s.categoryPackages[0].categoryPackage=[];for(var f=0;f<u.length;f++){var _=!1;u[f].categoryCode==n.RatesAvail.roomStays[0].packageCategories[h].categoryCode&&(s.categoryPackages[I].categoryPackage.push(u[f]),A++,!0),A%X==0&&0!=A&&(_=!0,I++,s.categoryPackages[I]={},s.categoryPackages[I].categoryPackage=[])}if(1==_){for(var k=s.categoryPackages.length;k>0;k--)0==s.categoryPackages[k-1].categoryPackage.length&&s.categoryPackages.splice(k-1,1);d.categorizedPackages.push(s)}else if(s.categoryPackages[I].categoryPackage.length>0){for(var k=s.categoryPackages.length;k>0;k--)0==s.categoryPackages[k-1].categoryPackage.length&&s.categoryPackages.splice(k-1,1);d.categorizedPackages.push(s)}}P(m),void 0!=u&&P(u),be=d.categorized,Ee=d.categorizedPackages,d.checkBox.selected=!0,d.changeALLRoomSelect(),d.changeCatecory(),d.Categorized=d.categorized,ve=d.categorized,d.goRooms(),0==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultDisplayFormat?d.goGrid():1==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultDisplayFormat&&(r.innerWidth<768?d.goGrid():d.goList()),G(n.translate.page_nowchoseroom_NowChoseRoom),1==n.MRB&&(R.stepsById.accommodations.placeholderMRB=v.getBookedRoomCount())}),n.openDrawer(),n.accommodations=!0,void 0==R.stepsById.accommodations.package&&(R.stepsById.accommodations.package=[]),R.stepsById.accommodations.package.push(e),R.stepsById.accommodations.placeholder=e.packageName,l.debug(JSON.stringify(R)+"navDataFactory 2"),K=!0,y(n.closeDrawer,2e3),void 0!=d.navFilterData&&(d.navFilterData.ratePlanCode.leadRate=t("currencyConversionAndSymbol")(te,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),d.navFilterData.ratePlanCode.price=t("currencyConversionAndSymbol")(oe,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),Y&&re&&void 0!=ne?(d.isMemberRatePriceIsLowest=Number(re)<=Number(te),d.navFilterData.ratePlanCode.leadMemberRate=t("currencyConversionAndSymbol")(re,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),d.navFilterData.ratePlanCode.memberPrice=t("currencyConversionAndSymbol")(ne,!1,d.navFilterData.ratePlanCode.merchandisedCurrency)):d.isMemberRatePriceIsLowest=!1)};l.debug(JSON.stringify(R)+"navDataFactory");var s=function(a){d.addAnotherPackage="display-block",setTimeout(function(){e.onModalOpen("packageCardGrid"+a,"add-another-package-parent-id","add-another-package-title-id",!1,d.cancelAddAnotherPackage)});var t=r.pageYOffset,o=t+20+"px";document.getElementsByClassName("MaxWidth-logo-wrap")?d.fromTopForAddingAnotherPackage=t+180+"px":d.fromTopForAddingAnotherPackage=o},u=function(){n.accommodations=!1,R.stepsById.accommodations={id:"accommodations",label:"Accommodations",placeholder:"Select",placeholderMRB:R.stepsById.accommodations.placeholderMRB,className:"Header-step--extended",rooms:[]},m.clear(),v.revertAccommadations(),v.revertAccommadationRooms(),v.revertServices(),l.debug(JSON.stringify(v.getReservation())+"reservationService.revertServices() after addPackage"),void 0!=v.getReservation().roomStays[0].roomRates[0].roomTypeCode?Ie.roomTypeCode=v.getReservation().roomStays[0].roomRates[0].roomTypeCode:Ie.roomTypeCode=void 0};d.continueAddAnotherPackage=function(){d.listOfSelectedEnhancements=[],d.enhancementServices=d.copyOfFormattedServicesData,me.services=[],v.getReservation().roomStays[0].ratePlans.length>0&&"Regular"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType&&void 0!=v.getReservation().roomStays[0].ratePlans[0].ratePlanCode?(oa(),v.revertAccommadationRooms(),i(a,Ie),d.addAnotherPackage="display-none",e.onModalClose()):(u(),i(a,Ie),d.addAnotherPackage="display-none",e.onModalClose(),n.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),n.$broadcast("EVENT.REMOVE_RATEPLAN"))},d.cancelAddAnotherPackage=function(){d.addAnotherPackage="display-none",e.onModalClose()},void 0==R.stepsById.accommodations.package||0==R.stepsById.accommodations.package.length?v.getReservation().roomStays[0].ratePlans.length>0&&"Package"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType&&v.getReservation().roomStays[0].ratePlans[0].ratePlanCode!=o?s(o):v.getReservation().roomStays[0].ratePlans.length>0&&"Regular"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType&&void 0!=v.getReservation().roomStays[0].ratePlans[0].ratePlanCode?s(o):_.find(d.enhancementServices,{checked:!0,serviceCategory:"ENHANCEMENT"})?s(o):i(a,Ie):R.stepsById.accommodations.package.length>0&&(void 0!=R.stepsById.accommodations.package[0].packageCode&&R.stepsById.accommodations.package[0].packageCode!=o||v.getReservation().roomStays[0].ratePlans.length>0&&"Package"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType&&v.getReservation().roomStays[0].ratePlans[0].ratePlanCode!=o?s(o):v.getReservation().roomStays[0].ratePlans.length>0&&"Package"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType&&v.getReservation().roomStays[0].ratePlans[0].ratePlanCode==o?s(o):d.continueAddAnotherPackage())},d.setRatePlan=function(e){if(d.preRoom=null,n.startTime=Date.now(),se=!0,d.showMap=!1,d.navFilterData.ratePlanCode=e,void 0!=d.navFilterData&&(te=angular.copy(d.navFilterData.ratePlanCode.leadRate),oe=angular.copy(d.navFilterData.ratePlanCode.price),re=angular.copy(d.navFilterData.ratePlanCode.leadMemberRate),ne=angular.copy(d.navFilterData.ratePlanCode.memberPrice)),d.categorized)for(var a=0;a<d.categorized.length;a++)for(var o=0;o<d.categorized[a].categoryRooms.length;o++)for(var r=0;r<d.categorized[a].categoryRooms[o].categoryRoom.length;r++)1==d.categorized[a].categoryRooms[o].categoryRoom[r].isSelected&&(d.closeRoomDetail(d.categorized[a].categoryRooms[o].categoryRoom[r]),d.categorized[a].categoryRooms[o].categoryRoom[r].myStyle="#116eb5");if(d.categorizedPackages)for(var a=0;a<d.categorizedPackages.length;a++)for(var o=0;o<d.categorizedPackages[a].categoryPackages.length;o++)for(var r=0;r<d.categorizedPackages[a].categoryPackages[o].categoryPackage.length;r++)1==d.categorizedPackages[a].categoryPackages[o].categoryPackage[r].isSelected&&(d.closePackageDetail(d.categorizedPackages[a].categoryPackages[o].categoryPackage[r]),d.categorizedPackages[a].categoryPackages[o].categoryPackage[r].myStyle="#116eb5");if(d.categorized)for(var a=0;a<d.categorized.length;a++)for(var o=0;o<d.categorized[a].categoryRooms.length;o++)for(var r=0;r<d.categorized[a].categoryRooms[o].categoryRoom.length;r++)d.categorized[a].categoryRooms[o].categoryRoom[r].isSelected=!1;if(d.categorizedPackages)for(var a=0;a<d.categorizedPackages.length;a++)for(var o=0;o<d.categorizedPackages[a].categoryPackages.length;o++)for(var r=0;r<d.categorizedPackages[a].categoryPackages[o].categoryPackage.length;r++)d.categorizedPackages[a].categoryPackages[o].categoryPackage[r].isSelected=!1;Ie.ratePlanCode=e.ratePlanCode,v.canModifyReservation()?Ie.ratePlanType=e.ratePlanType:"Regular"==e.ratePlanType&&(void 0!=Ie.allCodes&&Object.keys(Ie.allCodes).length>0||void 0!=Ie.allCodes&&Ie.allCodes.length>0)?Ie.ratePlanType=e.ratePlanType:Ie.ratePlanType=void 0,Ie.roomTypeCode=void 0,Ie=v.passPromotionIdInApi(Ie),c.getAccommodationRooms(Ie,n.MRB).getAllRooms().then(function(e){v.validateAvailForPromotions(e.data),n.RatesAvail=$?O.createDuplicateRateList(e.data):e.data,De=angular.copy(n.RatesAvail),0!=n.RatesAvail.roomStays[0].roomCategories.length&&n.RatesAvail.roomStays[0].roomCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageCategories&&0!=n.RatesAvail.roomStays[0].packageCategories.length&&n.RatesAvail.roomStays[0].packageCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),0!=n.RatesAvail.roomStays[0].ratePlans.length&&n.RatesAvail.roomStays[0].ratePlans.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),0!=n.RatesAvail.roomStays[0].roomTypes.length&&n.RatesAvail.roomStays[0].roomTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageTypes&&0!=n.RatesAvail.roomStays[0].packageTypes.length&&n.RatesAvail.roomStays[0].packageTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var a=0;a<n.RatesAvail.roomStays[0].roomCategories.length;a++){for(var t=!1,o=0;o<n.RatesAvail.roomStays[0].roomTypes.length;o++)n.RatesAvail.roomStays[0].roomTypes[o].categoryCode==n.RatesAvail.roomStays[0].roomCategories[a].categoryCode&&(t=!0);0==t&&(n.RatesAvail.roomStays[0].roomCategories.splice(a,1),a--)}if(void 0!=n.RatesAvail.roomStays[0].packageCategories)for(var a=0;a<n.RatesAvail.roomStays[0].packageCategories.length;a++){for(var t=!1,o=0;o<n.RatesAvail.roomStays[0].packageTypes.length;o++)n.RatesAvail.roomStays[0].packageTypes[o].categoryCode==n.RatesAvail.roomStays[0].packageCategories[a].categoryCode&&(t=!0);0==t&&(n.RatesAvail.roomStays[0].packageCategories.splice(a,1),a--)}if(g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator){for(var a=0;a<n.RatesAvail.roomStays[0].roomTypes.length;a++)for(var o=0;o<n.RatesAvail.roomStays[0].roomTypes[a].averageRates.length;o++)n.RatesAvail.roomStays[0].roomTypes[a].averageRates[o].rate=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[o].rate).toFixed(2),n.RatesAvail.roomStays[0].roomTypes[a].averageRates[o].discount=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[o].discount).toFixed(2);if(void 0!=n.RatesAvail.roomStays[0].packageTypes)for(var a=0;a<n.RatesAvail.roomStays[0].packageTypes.length;a++)n.RatesAvail.roomStays[0].packageTypes[a].leadRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].leadRate).toFixed(2),n.RatesAvail.roomStays[0].packageTypes[a].discountRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].discountRate).toFixed(2);n.RatesAvail.roomStays[0].ratePlans.forEach(function(e){e.leadRate=parseFloat(e.leadRate).toFixed(2)})}var r={},i={},s=[],l=[];d.currentRoom="",d.currentPackage="",d.categorized=[],d.categorizedPackages=[],d.RoomDetailSwitch=!1;var c=n.RatesAvail.roomStays[0].roomTypes,m=n.RatesAvail.roomStays[0].packageTypes,u=angular.copy(c);angular.copy(m),void 0!=m&&m.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"}),c.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"});for(var a=0;a<c.length;a++){c[a].upgradeRoom=[],c[a].isSelected=!1,c[a].myStyle="#116eb5";for(var p=0;p<c[a].averageRates.length;p++)c[a].averageRates[p].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode&&(c[a].finalPrice=c[a].averageRates[p].rate-c[a].averageRates[p].discount);if(c[a].roomUpgradeOptions.length>0)for(var o=0;o<c[a].roomUpgradeOptions.length;o++)for(var y=0;y<u.length;y++)if(u[y].roomTypeCode==c[a].roomUpgradeOptions[o].roomTypeCode){u[y].sortOrder=c[a].roomUpgradeOptions[o].sortOrder;for(var h=0;h<u[y].averageRates.length;h++)u[y].averageRates[h].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode&&(u[y].priceChanged=u[y].averageRates[h].rate-u[y].averageRates[h].discount-c[a].finalPrice,u[y].averageRates[h].merchandisedCurrency&&(u[y].merchandisedCurrency=u[y].averageRates[h].merchandisedCurrency));if(0!=u[y].priceChanged){var R=angular.copy(u[y]);c[a].upgradeRoom.push(R)}}}d.rateAvailPlans=n.RatesAvail.roomStays[0].ratePlans;for(var a=0;a<d.rateAvailPlans.length;a++)d.rateAvailPlans[a].price=d.rateAvailPlans[a].leadRate-d.rateAvailPlans[a].discountRate,Y&&d.rateAvailPlans[a].leadMemberRate&&void 0!=d.rateAvailPlans[a].discountMemberRate&&(d.rateAvailPlans[a].memberPrice=d.rateAvailPlans[a].leadMemberRate-d.rateAvailPlans[a].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(d.rateAvailPlans[a].leadRate=parseFloat(d.rateAvailPlans[a].leadRate).toFixed(2),d.rateAvailPlans[a].discountRate=parseFloat(d.rateAvailPlans[a].discountRate).toFixed(2),d.rateAvailPlans[a].price=parseFloat(d.rateAvailPlans[a].price).toFixed(2),void 0!=d.rateAvailPlans[a].memberPrice?(d.rateAvailPlans[a].leadMemberRate=parseFloat(d.rateAvailPlans[a].leadMemberRate).toFixed(2),d.rateAvailPlans[a].discountMemberRate=parseFloat(d.rateAvailPlans[a].discountMemberRate).toFixed(2),d.rateAvailPlans[a].memberPrice=parseFloat(d.rateAvailPlans[a].memberPrice).toFixed(2),d.rateAvailPlans[a].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[a].leadMemberRate)<=Number(d.rateAvailPlans[a].leadRate)):d.rateAvailPlans[a].isMemberRatePriceIsLowest=!1):(d.rateAvailPlans[a].leadRate=parseFloat(d.rateAvailPlans[a].leadRate).toFixed(0),d.rateAvailPlans[a].discountRate=parseFloat(d.rateAvailPlans[a].discountRate).toFixed(0),d.rateAvailPlans[a].price=parseFloat(d.rateAvailPlans[a].price).toFixed(0),void 0!=d.rateAvailPlans[a].memberPrice?(d.rateAvailPlans[a].leadMemberRate=parseFloat(d.rateAvailPlans[a].leadMemberRate).toFixed(0),d.rateAvailPlans[a].discountMemberRate=parseFloat(d.rateAvailPlans[a].discountMemberRate).toFixed(0),d.rateAvailPlans[a].memberPrice=parseFloat(d.rateAvailPlans[a].memberPrice).toFixed(0),d.rateAvailPlans[a].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[a].leadMemberRate)<=Number(d.rateAvailPlans[a].leadRate)):d.rateAvailPlans[a].isMemberRatePriceIsLowest=!1);d.rateAvailCategories=n.RatesAvail.roomStays[0].roomCategories,d.rateAvailCategoriesPackage=n.RatesAvail.roomStays[0].packageCategories,d.rateAvailCategories.forEach(function(e){e.selected=!0}),void 0!=d.rateAvailCategoriesPackage&&d.rateAvailCategoriesPackage.forEach(function(e){e.selected=!0});for(var a=0;a<d.rateAvailCategories.length;a++)s[a]=!0;for(var a=0;a<d.rateAvailCategories.length;a++)l[a]=!0;d.categorized=[];var f=[{categoryRooms:[]}],S=0,A=0;f[0].categoryRooms[A]={},f[0].categoryRooms[A].categoryRoom=[];for(var h=0;h<c.length;h++)if(!c[h].hasOwnProperty("categoryCode")){c[h].priceTagRate=[],c[h].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var I=0;I<c[h].averageRates.length;I++)if("Regular"==c[h].averageRates[I].ratePlanType&&c[h].averageRates[I].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=c[h].nightlyRates&&c[h].nightlyRates.length>0){c[h].averageRates[I].nightlyRates=[];for(var b=0;b<c[h].nightlyRates.length;b++)c[h].nightlyRates[b].ratePlanCode==c[h].averageRates[I].ratePlanCode&&c[h].averageRates[I].nightlyRates.push(angular.copy(c[h].nightlyRates[b]))}c[h].priceTagRate.push(c[h].averageRates[I])}else if(c[h].averageRates[I].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=c[h].nightlyRates&&c[h].nightlyRates.length>0){c[h].averageRates[I].nightlyRates=[];for(var b=0;b<c[h].nightlyRates.length;b++)"Group"==c[h].averageRates[I].ratePlanType?c[h].nightlyRates[b].ratePlanCode==c[h].averageRates[I].roomRateCode&&c[h].averageRates[I].nightlyRates.push(angular.copy(c[h].nightlyRates[b])):c[h].nightlyRates[b].ratePlanCode==c[h].averageRates[I].ratePlanCode&&c[h].averageRates[I].nightlyRates.push(angular.copy(c[h].nightlyRates[b]))}c[h].priceTagRate.unshift(c[h].averageRates[I])}for(var a=0;a<d.rateAvailPlans.length;a++)for(var o=0;o<c[h].priceTagRate.length;o++)c[h].priceTagRate[o].ratePlanCode==d.rateAvailPlans[a].ratePlanCode&&(c[h].priceTagRate[o].ratePlanName=d.rateAvailPlans[a].ratePlanName,c[h].priceTagRate[o].ratePlanDescription=d.rateAvailPlans[a].ratePlanDescription,c[h].priceTagRate[o].cancellationPolicy=d.rateAvailPlans[a].cancellationPolicy,c[h].priceTagRate[o].guaranteePolicy=d.rateAvailPlans[a].guaranteePolicy,c[h].priceTagRate[o].sortOrder=d.rateAvailPlans[a].sortOrder,void 0!=d.rateAvailPlans[a].packagePolicies&&(c[h].priceTagRate[o].packagePolicies=d.rateAvailPlans[a].packagePolicies));for(var a=0;a<c[h].averageRates.length;a++){for(var D=0;D<d.rateAvailPlans.length;D++)d.rateAvailPlans[D].ratePlanCode==c[h].averageRates[a].ratePlanCode&&(c[h].priceTagRate[a].ratePlanName=d.rateAvailPlans[D].ratePlanName,c[h].priceTagRate[a].sortOrder=d.rateAvailPlans[D].sortOrder);d.navFilterData.ratePlanCode.ratePlanCode==c[h].averageRates[a].ratePlanCode&&(c[h].currentRate=c[h].averageRates[a],c[h].currentRate.price=c[h].currentRate.rate-c[h].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(c[h].currentRate.price=c[h].currentRate.price.toFixed(2)),f[0].categoryRooms[A].categoryRoom.push(c[h]),S++)}S%X==0&&0!=S&&(A++,f[0].categoryRooms[A]={},f[0].categoryRooms[A].categoryRoom=[])}if(0!=f[0].categoryRooms[0].categoryRoom.length){for(var T=f[0].categoryRooms.length;T>0;T--)0==f[0].categoryRooms[T-1].categoryRoom.length&&f[0].categoryRooms.splice(T-1,1);d.categorized.push(f[0])}if(void 0!=m){d.categorizedPackages=[];var E=[{categoryPackages:[]}],S=0,A=0;E[0].categoryPackages[A]={},E[0].categoryPackages[A].categoryPackage=[];for(var h=0;h<m.length;h++)m[h].hasOwnProperty("categoryCode")||(E[0].categoryPackages[A].categoryPackage.push(m[h]),S++),S%X==0&&0!=S&&(A++,E[0].categoryPackages[A]={},E[0].categoryPackages[A].categoryPackage=[]);if(0!=E[0].categoryPackages[0].categoryPackage.length){for(var T=E[0].categoryPackages.length;T>0;T--)0==E[0].categoryPackages[T-1].categoryPackage.length&&E[0].categoryPackages.splice(T-1,1);d.categorizedPackages.push(E[0])}}for(var y=0;y<n.RatesAvail.roomStays[0].roomCategories.length;y++){S=0,A=0,r={name:n.RatesAvail.roomStays[0].roomCategories[y].categoryName,categoryCode:n.RatesAvail.roomStays[0].roomCategories[y].categoryCode,categoryRooms:[]},r.categoryRooms[0]={},r.categoryRooms[0].categoryRoom=[];for(var h=0;h<c.length;h++){var M=!1;if(c[h].categoryCode==n.RatesAvail.roomStays[0].roomCategories[y].categoryCode){c[h].priceTagRate=[],c[h].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var I=0;I<c[h].averageRates.length;I++)if("Regular"==c[h].averageRates[I].ratePlanType&&c[h].averageRates[I].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=c[h].nightlyRates&&c[h].nightlyRates.length>0){c[h].averageRates[I].nightlyRates=[];for(var b=0;b<c[h].nightlyRates.length;b++)c[h].nightlyRates[b].ratePlanCode==c[h].averageRates[I].ratePlanCode&&c[h].averageRates[I].nightlyRates.push(angular.copy(c[h].nightlyRates[b]))}c[h].priceTagRate.push(c[h].averageRates[I])}else if(c[h].averageRates[I].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=c[h].nightlyRates&&c[h].nightlyRates.length>0){c[h].averageRates[I].nightlyRates=[];for(var b=0;b<c[h].nightlyRates.length;b++)"Group"==c[h].averageRates[I].ratePlanType?c[h].nightlyRates[b].ratePlanCode==c[h].averageRates[I].roomRateCode&&c[h].averageRates[I].nightlyRates.push(angular.copy(c[h].nightlyRates[b])):c[h].nightlyRates[b].ratePlanCode==c[h].averageRates[I].ratePlanCode&&c[h].averageRates[I].nightlyRates.push(angular.copy(c[h].nightlyRates[b]))}c[h].priceTagRate.unshift(c[h].averageRates[I])}for(var a=0;a<c[h].averageRates.length;a++){for(var D=0;D<d.rateAvailPlans.length;D++)d.rateAvailPlans[D].ratePlanCode==c[h].averageRates[a].ratePlanCode&&(c[h].priceTagRate[a].ratePlanName=d.rateAvailPlans[D].ratePlanName,c[h].priceTagRate[a].sortOrder=d.rateAvailPlans[D].sortOrder);d.navFilterData.ratePlanCode.ratePlanCode==c[h].averageRates[a].ratePlanCode&&(c[h].currentRate=c[h].averageRates[a],c[h].currentRate.price=c[h].currentRate.rate-c[h].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(c[h].currentRate.price=c[h].currentRate.price.toFixed(2)),r.categoryRooms[A].categoryRoom.push(c[h]),S++)}for(var a=0;a<d.rateAvailPlans.length;a++)for(var o=0;o<c[h].priceTagRate.length;o++)c[h].priceTagRate[o].ratePlanCode==d.rateAvailPlans[a].ratePlanCode&&(c[h].priceTagRate[o].ratePlanName=d.rateAvailPlans[a].ratePlanName,c[h].priceTagRate[o].ratePlanDescription=d.rateAvailPlans[a].ratePlanDescription,c[h].priceTagRate[o].cancellationPolicy=d.rateAvailPlans[a].cancellationPolicy,c[h].priceTagRate[o].guaranteePolicy=d.rateAvailPlans[a].guaranteePolicy,c[h].priceTagRate[o].sortOrder=d.rateAvailPlans[a].sortOrder,void 0!=d.rateAvailPlans[a].packagePolicies&&(c[h].priceTagRate[o].packagePolicies=d.rateAvailPlans[a].packagePolicies))}S%X==0&&0!=S&&(M=!0,A++,r.categoryRooms[A]={},r.categoryRooms[A].categoryRoom=[])}if(1==M){for(var _=r.categoryRooms.length;_>0;_--)0==r.categoryRooms[_-1].categoryRoom.length&&r.categoryRooms.splice(_-1,1);d.categorized.push(r)}else if(r.categoryRooms[A].categoryRoom.length>0){for(var _=r.categoryRooms.length;_>0;_--)0==r.categoryRooms[_-1].categoryRoom.length&&r.categoryRooms.splice(_-1,1);d.categorized.push(r)}}if(void 0!=m)for(var y=0;y<n.RatesAvail.roomStays[0].packageCategories.length;y++){var S=0,A=0,i={name:n.RatesAvail.roomStays[0].packageCategories[y].categoryName,categoryCode:n.RatesAvail.roomStays[0].packageCategories[y].categoryCode,categoryPackages:[]};i.categoryPackages[0]={},i.categoryPackages[0].categoryPackage=[];for(var h=0;h<m.length;h++){var M=!1;m[h].categoryCode==n.RatesAvail.roomStays[0].packageCategories[y].categoryCode&&(i.categoryPackages[A].categoryPackage.push(m[h]),S++),S%X==0&&0!=S&&(M=!0,A++,i.categoryPackages[A]={},i.categoryPackages[A].categoryPackage=[])}if(1==M){for(var _=i.categoryPackages.length;_>0;_--)0==i.categoryPackages[_-1].categoryPackage.length&&i.categoryPackages.splice(_-1,1);d.categorizedPackages.push(i)}else if(i.categoryPackages[A].categoryPackage.length>0){for(var _=i.categoryPackages.length;_>0;_--)0==i.categoryPackages[_-1].categoryPackage.length&&i.categoryPackages.splice(_-1,1);d.categorizedPackages.push(i)}}P(c),void 0!=m&&P(m),be=d.categorized,Ee=d.categorizedPackages,d.checkBox.selected=!0,d.changeALLRoomSelect(),d.changeCatecory(),d.Categorized=d.categorized,C.setUserTiming("Interaction","ChangeRatePlan")}),void 0!=d.navFilterData&&(d.navFilterData.ratePlanCode.leadRate=t("currencyConversionAndSymbol")(te,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),d.navFilterData.ratePlanCode.price=t("currencyConversionAndSymbol")(oe,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),Y&&re&&void 0!=ne?(d.isMemberRatePriceIsLowest=Number(re)<=Number(te),d.navFilterData.ratePlanCode.leadMemberRate=t("currencyConversionAndSymbol")(re,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),d.navFilterData.ratePlanCode.memberPrice=t("currencyConversionAndSymbol")(ne,!1,d.navFilterData.ratePlanCode.merchandisedCurrency)):d.isMemberRatePriceIsLowest=!1)};var Fe=function(){if(d.categorized)for(var e=0;e<d.categorized.length;e++)for(var a=0;a<d.categorized[e].categoryRooms.length;a++)for(var o=0;o<d.categorized[e].categoryRooms[a].categoryRoom.length;o++)1==d.categorized[e].categoryRooms[a].categoryRoom[o].isSelected&&d.closeRoomDetail(d.categorized[e].categoryRooms[a].categoryRoom[o])
;if(d.categorizedPackages)for(var e=0;e<d.categorizedPackages.length;e++)for(var a=0;a<d.categorizedPackages[e].categoryPackages.length;a++)for(var o=0;o<d.categorizedPackages[e].categoryPackages[a].categoryPackage.length;o++)1==d.categorizedPackages[e].categoryPackages[a].categoryPackage[o].isSelected&&(d.closePackageDetail(d.categorizedPackages[e].categoryPackages[a].categoryPackage[o]),d.categorizedPackages[e].categoryPackages[a].categoryPackage[o].myStyle="#116eb5");if(d.categorized)for(var e=0;e<d.categorized.length;e++)for(var a=0;a<d.categorized[e].categoryRooms.length;a++)for(var o=0;o<d.categorized[e].categoryRooms[a].categoryRoom.length;o++)d.categorized[e].categoryRooms[a].categoryRoom[o].isSelected=!1;if(d.categorizedPackages)for(var e=0;e<d.categorizedPackages.length;e++)for(var a=0;a<d.categorizedPackages[e].categoryPackages.length;a++)for(var o=0;o<d.categorizedPackages[e].categoryPackages[a].categoryPackage.length;o++)d.categorizedPackages[e].categoryPackages[a].categoryPackage[o].isSelected=!1;Ie=v.passPromotionIdInApi(Ie),c.getAccommodationRooms(Ie).getAllRooms().then(function(e){v.validateAvailForPromotions(e.data),n.RatesAvail=$?O.createDuplicateRateList(e.data):e.data,De=angular.copy(n.RatesAvail),0!=n.RatesAvail.roomStays[0].roomCategories.length&&n.RatesAvail.roomStays[0].roomCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageCategories&&0!=n.RatesAvail.roomStays[0].packageCategories.length&&n.RatesAvail.roomStays[0].packageCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),0!=n.RatesAvail.roomStays[0].ratePlans.length&&n.RatesAvail.roomStays[0].ratePlans.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),0!=n.RatesAvail.roomStays[0].roomTypes.length&&n.RatesAvail.roomStays[0].roomTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageTypes&&0!=n.RatesAvail.roomStays[0].packageTypes.length&&n.RatesAvail.roomStays[0].packageTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var a=0;a<n.RatesAvail.roomStays[0].roomCategories.length;a++){for(var o=!1,i=0;i<n.RatesAvail.roomStays[0].roomTypes.length;i++)n.RatesAvail.roomStays[0].roomTypes[i].categoryCode==n.RatesAvail.roomStays[0].roomCategories[a].categoryCode&&(o=!0);0==o&&(n.RatesAvail.roomStays[0].roomCategories.splice(a,1),a--)}if(void 0!=n.RatesAvail.roomStays[0].packageCategories)for(var a=0;a<n.RatesAvail.roomStays[0].packageCategories.length;a++){for(var o=!1,i=0;i<n.RatesAvail.roomStays[0].packageTypes.length;i++)n.RatesAvail.roomStays[0].packageTypes[i].categoryCode==n.RatesAvail.roomStays[0].packageCategories[a].categoryCode&&(o=!0);0==o&&(n.RatesAvail.roomStays[0].packageCategories.splice(a,1),a--)}if(void 0!=n.RatesAvail.roomStays[0].packageCategories?0==n.RatesAvail.roomStays[0].packageCategories.length&&(d.categorizePackageHide=!0):d.categorizePackageHide=!0,0==n.RatesAvail.roomStays[0].roomCategories.length&&(d.categorizeHide=!0),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator){for(var a=0;a<n.RatesAvail.roomStays[0].roomTypes.length;a++)for(var i=0;i<n.RatesAvail.roomStays[0].roomTypes[a].averageRates.length;i++)n.RatesAvail.roomStays[0].roomTypes[a].averageRates[i].rate=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[i].rate).toFixed(2),n.RatesAvail.roomStays[0].roomTypes[a].averageRates[i].discount=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[i].discount).toFixed(2);if(void 0!=n.RatesAvail.roomStays[0].packageTypes)for(var a=0;a<n.RatesAvail.roomStays[0].packageTypes.length;a++)n.RatesAvail.roomStays[0].packageTypes[a].leadRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].leadRate).toFixed(2),n.RatesAvail.roomStays[0].packageTypes[a].discountRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].discountRate).toFixed(2);n.RatesAvail.roomStays[0].ratePlans.forEach(function(e){e.leadRate=parseFloat(e.leadRate).toFixed(2)})}else{for(var a=0;a<n.RatesAvail.roomStays[0].roomTypes.length;a++)for(var i=0;i<n.RatesAvail.roomStays[0].roomTypes[a].averageRates.length;i++)n.RatesAvail.roomStays[0].roomTypes[a].averageRates[i].rate=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[i].rate).toFixed(0),n.RatesAvail.roomStays[0].roomTypes[a].averageRates[i].discount=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[i].discount).toFixed(0);if(void 0!=n.RatesAvail.roomStays[0].packageTypes)for(var a=0;a<n.RatesAvail.roomStays[0].packageTypes.length;a++)n.RatesAvail.roomStays[0].packageTypes[a].leadRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].leadRate).toFixed(0),n.RatesAvail.roomStays[0].packageTypes[a].discountRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].discountRate).toFixed(0);n.RatesAvail.roomStays[0].ratePlans.forEach(function(e){e.leadRate=parseFloat(e.leadRate).toFixed(0)})}d.iconShow=g.getHotelDesc().uxConfiguration.accomodationsConfig.displayIconsIndicator,d.rateShow=g.getHotelDesc().uxConfiguration.strikeThroughPricingEnabled,ie=!0;for(var a=0;a<n.RatesAvail.roomStays[0].ratePlans.length;a++)1==n.RatesAvail.roomStays[0].ratePlans[a].default&&(d.navFilterData.ratePlanCode=n.RatesAvail.roomStays[0].ratePlans[a],d.navFilterData.ratePlanCode.price=n.RatesAvail.roomStays[0].ratePlans[a].leadRate-n.RatesAvail.roomStays[0].ratePlans[a].discountRate,n.RatesAvail.roomStays[0].ratePlans[a].leadMemberRate&&n.RatesAvail.roomStays[0].ratePlans[a].discountMemberRate&&(d.navFilterData.ratePlanCode.memberPrice=n.RatesAvail.roomStays[0].ratePlans[a].leadMemberRate-n.RatesAvail.roomStays[0].ratePlans[a].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(d.navFilterData.ratePlanCode.price=d.navFilterData.ratePlanCode.price.toFixed(2),d.navFilterData.ratePlanCode.memberPrice&&(d.navFilterData.ratePlanCode.memberPrice=parseFloat(d.navFilterData.ratePlanCode.memberPrice).toFixed(2))));0==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultRatePlanType?d.goRooms():1==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultRatePlanType&&(1==pe&&void 0!=n.RatesAvail.roomStays[0].packageTypes&&n.RatesAvail.roomStays[0].packageTypes.length>0&&void 0==R.stepsById.accommodations.package?d.goPackages():d.goRooms()),0==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultDisplayFormat?d.goGrid():1==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultDisplayFormat&&(r.innerWidth<768?d.goGrid():d.goList());var s={},l={},c=[],m=[];d.currentRoom="",d.currentPackage="",d.categorized=[],d.categorizedPackages=[],d.RoomDetailSwitch=!1;var u=n.RatesAvail.roomStays[0].roomTypes,p=n.RatesAvail.roomStays[0].packageTypes,y=angular.copy(u);angular.copy(p),void 0!=p&&p.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"}),u.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"});for(var a=0;a<u.length;a++){u[a].upgradeRoom=[],u[a].isSelected=!1,u[a].myStyle="#116eb5";for(var h=0;h<u[a].averageRates.length;h++)u[a].averageRates[h].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode&&(u[a].finalPrice=u[a].averageRates[h].rate-u[a].averageRates[h].discount);if(u[a].roomUpgradeOptions.length>0)for(var i=0;i<u[a].roomUpgradeOptions.length;i++)for(var f=0;f<y.length;f++)if(y[f].roomTypeCode==u[a].roomUpgradeOptions[i].roomTypeCode){y[f].sortOrder=u[a].roomUpgradeOptions[i].sortOrder;for(var C=0;C<y[f].averageRates.length;C++)y[f].averageRates[C].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode&&(y[f].priceChanged=y[f].averageRates[C].rate-y[f].averageRates[C].discount-u[a].finalPrice,y[f].averageRates[C].merchandisedCurrency&&(y[f].merchandisedCurrency=y[f].averageRates[C].merchandisedCurrency));if(0!=y[f].priceChanged){var S=angular.copy(y[f]);u[a].upgradeRoom.push(S)}}}d.rateAvailPlans=n.RatesAvail.roomStays[0].ratePlans;for(var a=0;a<d.rateAvailPlans.length;a++)d.rateAvailPlans[a].price=d.rateAvailPlans[a].leadRate-d.rateAvailPlans[a].discountRate,Y&&d.rateAvailPlans[a].leadMemberRate&&void 0!=d.rateAvailPlans[a].discountMemberRate&&(d.rateAvailPlans[a].memberPrice=d.rateAvailPlans[a].leadMemberRate-d.rateAvailPlans[a].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(d.rateAvailPlans[a].leadRate=parseFloat(d.rateAvailPlans[a].leadRate).toFixed(2),d.rateAvailPlans[a].discountRate=parseFloat(d.rateAvailPlans[a].discountRate).toFixed(2),d.rateAvailPlans[a].price=parseFloat(d.rateAvailPlans[a].price).toFixed(2),void 0!=d.rateAvailPlans[a].memberPrice?(d.rateAvailPlans[a].leadMemberRate=parseFloat(d.rateAvailPlans[a].leadMemberRate).toFixed(2),d.rateAvailPlans[a].discountMemberRate=parseFloat(d.rateAvailPlans[a].discountMemberRate).toFixed(2),d.rateAvailPlans[a].memberPrice=parseFloat(d.rateAvailPlans[a].memberPrice).toFixed(2),d.rateAvailPlans[a].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[a].leadMemberRate)<=Number(d.rateAvailPlans[a].leadRate)):d.rateAvailPlans[a].isMemberRatePriceIsLowest=!1):(d.rateAvailPlans[a].leadRate=parseFloat(d.rateAvailPlans[a].leadRate).toFixed(0),d.rateAvailPlans[a].discountRate=parseFloat(d.rateAvailPlans[a].discountRate).toFixed(0),d.rateAvailPlans[a].price=parseFloat(d.rateAvailPlans[a].price).toFixed(0),void 0!=d.rateAvailPlans[a].memberPrice?(d.rateAvailPlans[a].leadMemberRate=parseFloat(d.rateAvailPlans[a].leadMemberRate).toFixed(0),d.rateAvailPlans[a].discountMemberRate=parseFloat(d.rateAvailPlans[a].discountMemberRate).toFixed(0),d.rateAvailPlans[a].memberPrice=parseFloat(d.rateAvailPlans[a].memberPrice).toFixed(0),d.rateAvailPlans[a].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[a].leadMemberRate)<=Number(d.rateAvailPlans[a].leadRate)):d.rateAvailPlans[a].isMemberRatePriceIsLowest=!1);d.rateAvailCategories=n.RatesAvail.roomStays[0].roomCategories,d.rateAvailCategories.forEach(function(e){e.selected=!0});for(var a=0;a<d.rateAvailCategories.length;a++)c[a]=!0;d.categorized=[];var A=[{categoryRooms:[]}];d.rateAvailCategoriesPackage=n.RatesAvail.roomStays[0].packageCategories,void 0!=d.rateAvailCategoriesPackage&&d.rateAvailCategoriesPackage.forEach(function(e){e.selected=!0});for(var a=0;a<d.rateAvailCategories.length;a++)m[a]=!0;d.categorizedPackages=[];var I=[{categoryPackages:[]}],b=0,D=0;A[0].categoryRooms[D]={},A[0].categoryRooms[D].categoryRoom=[];for(var C=0;C<u.length;C++)if(!u[C].hasOwnProperty("categoryCode")){u[C].priceTagRate=[],u[C].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var T=0;T<u[C].averageRates.length;T++)if("Regular"==u[C].averageRates[T].ratePlanType&&u[C].averageRates[T].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=u[C].nightlyRates&&u[C].nightlyRates.length>0){u[C].averageRates[T].nightlyRates=[];for(var E=0;E<u[C].nightlyRates.length;E++)u[C].nightlyRates[E].ratePlanCode==u[C].averageRates[T].ratePlanCode&&u[C].averageRates[T].nightlyRates.push(angular.copy(u[C].nightlyRates[E]))}u[C].priceTagRate.push(u[C].averageRates[T])}else if(u[C].averageRates[T].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=u[C].nightlyRates&&u[C].nightlyRates.length>0){u[C].averageRates[T].nightlyRates=[];for(var E=0;E<u[C].nightlyRates.length;E++)"Group"==u[C].averageRates[T].ratePlanType?u[C].nightlyRates[E].ratePlanCode==u[C].averageRates[T].roomRateCode&&u[C].averageRates[T].nightlyRates.push(angular.copy(u[C].nightlyRates[E])):u[C].nightlyRates[E].ratePlanCode==u[C].averageRates[T].ratePlanCode&&u[C].averageRates[T].nightlyRates.push(angular.copy(u[C].nightlyRates[E]))}u[C].priceTagRate.unshift(u[C].averageRates[T])}for(var a=0;a<d.rateAvailPlans.length;a++)for(var i=0;i<u[C].priceTagRate.length;i++)u[C].priceTagRate[i].ratePlanCode==d.rateAvailPlans[a].ratePlanCode&&(u[C].priceTagRate[i].ratePlanName=d.rateAvailPlans[a].ratePlanName,u[C].priceTagRate[i].ratePlanDescription=d.rateAvailPlans[a].ratePlanDescription,u[C].priceTagRate[i].cancellationPolicy=d.rateAvailPlans[a].cancellationPolicy,u[C].priceTagRate[i].guaranteePolicy=d.rateAvailPlans[a].guaranteePolicy,u[C].priceTagRate[i].sortOrder=d.rateAvailPlans[a].sortOrder,void 0!=d.rateAvailPlans[a].packagePolicies&&(u[C].priceTagRate[i].packagePolicies=d.rateAvailPlans[a].packagePolicies));for(var a=0;a<u[C].averageRates.length;a++)d.navFilterData.ratePlanCode.ratePlanCode==u[C].averageRates[a].ratePlanCode&&(u[C].currentRate=u[C].averageRates[a],u[C].currentRate.price=u[C].currentRate.rate-u[C].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(u[C].currentRate.price=u[C].currentRate.price.toFixed(2)),A[0].categoryRooms[D].categoryRoom.push(u[C]),b++);b%X==0&&0!=b&&(D++,A[0].categoryRooms[D]={},A[0].categoryRooms[D].categoryRoom=[])}if(0!=A[0].categoryRooms[0].categoryRoom.length){for(var M=A[0].categoryRooms.length;M>0;M--)0==A[0].categoryRooms[M-1].categoryRoom.length&&A[0].categoryRooms.splice(M-1,1);d.categorized.push(A[0])}if(void 0!=p){d.categorizedPackages=[];var I=[{categoryPackages:[]}],b=0,D=0;I[0].categoryPackages[D]={},I[0].categoryPackages[D].categoryPackage=[];for(var C=0;C<p.length;C++)p[C].hasOwnProperty("categoryCode")||(I[0].categoryPackages[D].categoryPackage.push(p[C]),b++),b%X==0&&0!=b&&(D++,I[0].categoryPackages[D]={},I[0].categoryPackages[D].categoryPackage=[]);if(0!=I[0].categoryPackages[0].categoryPackage.length){for(var M=I[0].categoryPackages.length;M>0;M--)0==I[0].categoryPackages[M-1].categoryPackage.length&&I[0].categoryPackages.splice(M-1,1);d.categorizedPackages.push(I[0])}}for(var f=0;f<n.RatesAvail.roomStays[0].roomCategories.length;f++){b=0,D=0,s={name:n.RatesAvail.roomStays[0].roomCategories[f].categoryName,categoryCode:n.RatesAvail.roomStays[0].roomCategories[f].categoryCode,categoryRooms:[]},s.categoryRooms[0]={},s.categoryRooms[0].categoryRoom=[];for(var C=0;C<u.length;C++){var _=!1;if(u[C].categoryCode==n.RatesAvail.roomStays[0].roomCategories[f].categoryCode){u[C].priceTagRate=[],u[C].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var T=0;T<u[C].averageRates.length;T++)if("Regular"==u[C].averageRates[T].ratePlanType&&u[C].averageRates[T].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=u[C].nightlyRates&&u[C].nightlyRates.length>0){u[C].averageRates[T].nightlyRates=[];for(var E=0;E<u[C].nightlyRates.length;E++)u[C].nightlyRates[E].ratePlanCode==u[C].averageRates[T].ratePlanCode&&u[C].averageRates[T].nightlyRates.push(angular.copy(u[C].nightlyRates[E]))}u[C].priceTagRate.push(u[C].averageRates[T])}else if(u[C].averageRates[T].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=u[C].nightlyRates&&u[C].nightlyRates.length>0){u[C].averageRates[T].nightlyRates=[];for(var E=0;E<u[C].nightlyRates.length;E++)"Group"==u[C].averageRates[T].ratePlanType?u[C].nightlyRates[E].ratePlanCode==u[C].averageRates[T].roomRateCode&&u[C].averageRates[T].nightlyRates.push(angular.copy(u[C].nightlyRates[E])):u[C].nightlyRates[E].ratePlanCode==u[C].averageRates[T].ratePlanCode&&u[C].averageRates[T].nightlyRates.push(angular.copy(u[C].nightlyRates[E]))}u[C].priceTagRate.unshift(u[C].averageRates[T])}for(var a=0;a<u[C].averageRates.length;a++){for(var k=0;k<d.rateAvailPlans.length;k++)d.rateAvailPlans[k].ratePlanCode==u[C].averageRates[a].ratePlanCode&&(u[C].priceTagRate[a].ratePlanName=d.rateAvailPlans[k].ratePlanName,u[C].priceTagRate[a].sortOrder=d.rateAvailPlans[k].sortOrder);d.navFilterData.ratePlanCode.ratePlanCode==u[C].averageRates[a].ratePlanCode&&(u[C].currentRate=u[C].averageRates[a],u[C].currentRate.price=u[C].currentRate.rate-u[C].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(u[C].currentRate.price=u[C].currentRate.price.toFixed(2)),s.categoryRooms[D].categoryRoom.push(u[C]),b++,!0)}for(var a=0;a<d.rateAvailPlans.length;a++)for(var i=0;i<u[C].priceTagRate.length;i++)u[C].priceTagRate[i].ratePlanCode==d.rateAvailPlans[a].ratePlanCode&&(u[C].priceTagRate[i].ratePlanName=d.rateAvailPlans[a].ratePlanName,u[C].priceTagRate[i].ratePlanDescription=d.rateAvailPlans[a].ratePlanDescription,u[C].priceTagRate[i].cancellationPolicy=d.rateAvailPlans[a].cancellationPolicy,u[C].priceTagRate[i].guaranteePolicy=d.rateAvailPlans[a].guaranteePolicy,u[C].priceTagRate[i].sortOrder=d.rateAvailPlans[a].sortOrder,void 0!=d.rateAvailPlans[a].packagePolicies&&(u[C].priceTagRate[i].packagePolicies=d.rateAvailPlans[a].packagePolicies))}b%X==0&&0!=b&&(_=!0,D++,s.categoryRooms[D]={},s.categoryRooms[D].categoryRoom=[])}if(1==_){for(var N=s.categoryRooms.length;N>0;N--)0==s.categoryRooms[N-1].categoryRoom.length&&s.categoryRooms.splice(N-1,1);d.categorized.push(s)}else if(s.categoryRooms[D].categoryRoom.length>0){for(var N=s.categoryRooms.length;N>0;N--)0==s.categoryRooms[N-1].categoryRoom.length&&s.categoryRooms.splice(N-1,1);d.categorized.push(s)}}if(void 0!=p)for(var f=0;f<n.RatesAvail.roomStays[0].packageCategories.length;f++){var b=0,D=0,l={name:n.RatesAvail.roomStays[0].packageCategories[f].categoryName,categoryCode:n.RatesAvail.roomStays[0].packageCategories[f].categoryCode,categoryPackages:[]};l.categoryPackages[0]={},l.categoryPackages[0].categoryPackage=[];for(var C=0;C<p.length;C++){var _=!1;p[C].categoryCode==n.RatesAvail.roomStays[0].packageCategories[f].categoryCode&&(l.categoryPackages[D].categoryPackage.push(p[C]),b++,!0),b%X==0&&0!=b&&(_=!0,D++,l.categoryPackages[D]={},l.categoryPackages[D].categoryPackage=[])}if(1==_){for(var N=l.categoryPackages.length;N>0;N--)0==l.categoryPackages[N-1].categoryPackage.length&&l.categoryPackages.splice(N-1,1);d.categorizedPackages.push(l)}else if(l.categoryPackages[D].categoryPackage.length>0){for(var N=l.categoryPackages.length;N>0;N--)0==l.categoryPackages[N-1].categoryPackage.length&&l.categoryPackages.splice(N-1,1);d.categorizedPackages.push(l)}}if(P(u),be=d.categorized,void 0!=p&&(P(p),Ee=d.categorizedPackages),1==n.displayMultiRateListView){var L=v.getCodeTypes();1!=d.packageSelected||void 0==d.navFilterData||void 0==d.navFilterData.ratePlanCode||"Package"!=d.navFilterData.ratePlanCode.ratePlanType&&"Group"!=d.navFilterData.ratePlanCode.ratePlanType?v.getReservation().roomStays[0].ratePlans.length>0&&("Package"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType||"Group"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType)?n.displayMultiRateListView=!1:void 0!=L&&(L.indexOf("Group")>-1||L.indexOf("group")>-1)?n.displayMultiRateListView=!1:(d.toggleAcc.gridView=!1,d.toggleAcc.listView=!0,de()):n.displayMultiRateListView=!1}d.checkBox.selected=!0,d.checkBoxPackage.selected=!0,d.changeALLRoomSelect(),d.changeALLPackageSelect(),d.changeCatecory(),d.changePackageCategory(),d.Categorized=d.categorized,void 0!=d.navFilterData&&(te=angular.copy(d.navFilterData.ratePlanCode.leadRate),oe=angular.copy(d.navFilterData.ratePlanCode.price),re=angular.copy(d.navFilterData.ratePlanCode.leadMemberRate),ne=angular.copy(d.navFilterData.ratePlanCode.memberPrice)),void 0!=d.navFilterData&&(d.navFilterData.ratePlanCode.leadRate=t("currencyConversionAndSymbol")(te,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),d.navFilterData.ratePlanCode.price=t("currencyConversionAndSymbol")(oe,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),Y&&re&&void 0!=ne?(d.isMemberRatePriceIsLowest=Number(re)<=Number(te),d.navFilterData.ratePlanCode.leadMemberRate=t("currencyConversionAndSymbol")(re,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),d.navFilterData.ratePlanCode.memberPrice=t("currencyConversionAndSymbol")(ne,!1,d.navFilterData.ratePlanCode.merchandisedCurrency)):d.isMemberRatePriceIsLowest=!1),ie=!1})};d.$on(o.RES_SELECTION_CHANGE,function(){v.setConfig("RES_SELECTION_CHANGE"),d.userLoggedIn=h.checkGmsLogin(),d.recallAPI(),se=!0}),n.gmsPromoCodeValidated&&(n.gmsPromoCodeValidated=!1,function(){if("package"!=Ie.ratePlanType&&(Ie.ratePlanCode=void 0),void 0==Ie.ratePlanCode&&(Ie.ratePlanType=void 0),F(),d.categorized)for(var e=0;e<d.categorized.length;e++)for(var a=0;a<d.categorized[e].categoryRooms.length;a++)for(var o=0;o<d.categorized[e].categoryRooms[a].categoryRoom.length;o++)1==d.categorized[e].categoryRooms[a].categoryRoom[o].isSelected&&d.closeRoomDetail(d.categorized[e].categoryRooms[a].categoryRoom[o]);if(d.categorizedPackages)for(var e=0;e<d.categorizedPackages.length;e++)for(var a=0;a<d.categorizedPackages[e].categoryPackages.length;a++)for(var o=0;o<d.categorizedPackages[e].categoryPackages[a].categoryPackage.length;o++)1==d.categorizedPackages[e].categoryPackages[a].categoryPackage[o].isSelected&&(d.closePackageDetail(d.categorizedPackages[e].categoryPackages[a].categoryPackage[o]),d.categorizedPackages[e].categoryPackages[a].categoryPackage[o].myStyle="#116eb5");if(d.categorized)for(var e=0;e<d.categorized.length;e++)for(var a=0;a<d.categorized[e].categoryRooms.length;a++)for(var o=0;o<d.categorized[e].categoryRooms[a].categoryRoom.length;o++)d.categorized[e].categoryRooms[a].categoryRoom[o].isSelected=!1;if(d.categorizedPackages)for(var e=0;e<d.categorizedPackages.length;e++)for(var a=0;a<d.categorizedPackages[e].categoryPackages.length;a++)for(var o=0;o<d.categorizedPackages[e].categoryPackages[a].categoryPackage.length;o++)d.categorizedPackages[e].categoryPackages[a].categoryPackage[o].isSelected=!1;l.debug("finalOptions1:  "+JSON.stringify(v.getMainReservation())),l.debug("finalOptions :   "+JSON.stringify(Ie)),Ie=v.passPromotionIdInApi(Ie),c.getAccommodationRooms(Ie).getAllRooms().then(function(e){v.validateAvailForPromotions(e.data),"Group"==Ie.ratePlanType?n.groupExist=!0:n.groupExist=!1,n.RatesAvail=$?O.createDuplicateRateList(e.data):e.data,De=angular.copy(n.RatesAvail),0!=n.RatesAvail.roomStays[0].roomCategories.length&&n.RatesAvail.roomStays[0].roomCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageCategories&&0!=n.RatesAvail.roomStays[0].packageCategories.length&&n.RatesAvail.roomStays[0].packageCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),0!=n.RatesAvail.roomStays[0].ratePlans.length&&n.RatesAvail.roomStays[0].ratePlans.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),0!=n.RatesAvail.roomStays[0].roomTypes.length&&n.RatesAvail.roomStays[0].roomTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageTypes&&0!=n.RatesAvail.roomStays[0].packageTypes.length&&n.RatesAvail.roomStays[0].packageTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var a=0;a<n.RatesAvail.roomStays[0].roomCategories.length;a++){for(var o=!1,r=0;r<n.RatesAvail.roomStays[0].roomTypes.length;r++)n.RatesAvail.roomStays[0].roomTypes[r].categoryCode==n.RatesAvail.roomStays[0].roomCategories[a].categoryCode&&(o=!0);0==o&&(n.RatesAvail.roomStays[0].roomCategories.splice(a,1),a--)}if(void 0!=n.RatesAvail.roomStays[0].packageCategories){for(var a=0;a<n.RatesAvail.roomStays[0].packageCategories.length;a++){for(var o=!1,r=0;r<n.RatesAvail.roomStays[0].packageTypes.length;r++)n.RatesAvail.roomStays[0].packageTypes[r].categoryCode==n.RatesAvail.roomStays[0].packageCategories[a].categoryCode&&(o=!0);0==o&&(n.RatesAvail.roomStays[0].packageCategories.splice(a,1),a--)}0==n.RatesAvail.roomStays[0].packageCategories.length&&(d.categorizePackageHide=!0)}if(0==n.RatesAvail.roomStays[0].roomCategories.length&&(d.categorizeHide=!0),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator){for(var a=0;a<n.RatesAvail.roomStays[0].roomTypes.length;a++)for(var r=0;r<n.RatesAvail.roomStays[0].roomTypes[a].averageRates.length;r++)n.RatesAvail.roomStays[0].roomTypes[a].averageRates[r].rate=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[r].rate).toFixed(2),n.RatesAvail.roomStays[0].roomTypes[a].averageRates[r].discount=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[r].discount).toFixed(2);if(void 0!=n.RatesAvail.roomStays[0].packageTypes)for(var a=0;a<n.RatesAvail.roomStays[0].packageTypes.length;a++)n.RatesAvail.roomStays[0].packageTypes[a].leadRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].leadRate).toFixed(2),n.RatesAvail.roomStays[0].packageTypes[a].discountRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].discountRate).toFixed(2);n.RatesAvail.roomStays[0].ratePlans.forEach(function(e){e.leadRate=parseFloat(e.leadRate).toFixed(2)})}else{for(var a=0;a<n.RatesAvail.roomStays[0].roomTypes.length;a++)for(var r=0;r<n.RatesAvail.roomStays[0].roomTypes[a].averageRates.length;r++)n.RatesAvail.roomStays[0].roomTypes[a].averageRates[r].rate=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[r].rate).toFixed(0),n.RatesAvail.roomStays[0].roomTypes[a].averageRates[r].discount=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[r].discount).toFixed(0);if(void 0!=n.RatesAvail.roomStays[0].packageTypes)for(var a=0;a<n.RatesAvail.roomStays[0].packageTypes.length;a++)n.RatesAvail.roomStays[0].packageTypes[a].leadRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].leadRate).toFixed(0),n.RatesAvail.roomStays[0].packageTypes[a].discountRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].discountRate).toFixed(0);n.RatesAvail.roomStays[0].ratePlans.forEach(function(e){e.leadRate=parseFloat(e.leadRate).toFixed(0)})}d.iconShow=g.getHotelDesc().uxConfiguration.accomodationsConfig.displayIconsIndicator,d.rateShow=g.getHotelDesc().uxConfiguration.strikeThroughPricingEnabled;for(var a=0;a<n.RatesAvail.roomStays[0].ratePlans.length;a++)1==n.RatesAvail.roomStays[0].ratePlans[a].default&&(d.navFilterData.ratePlanCode=n.RatesAvail.roomStays[0].ratePlans[a],d.navFilterData.ratePlanCode.price=n.RatesAvail.roomStays[0].ratePlans[a].leadRate-n.RatesAvail.roomStays[0].ratePlans[a].discountRate,n.RatesAvail.roomStays[0].ratePlans[a].leadMemberRate&&n.RatesAvail.roomStays[0].ratePlans[a].discountMemberRate&&(d.navFilterData.ratePlanCode.memberPrice=n.RatesAvail.roomStays[0].ratePlans[a].leadMemberRate-n.RatesAvail.roomStays[0].ratePlans[a].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(d.navFilterData.ratePlanCode.price=d.navFilterData.ratePlanCode.price.toFixed(2),d.navFilterData.ratePlanCode.memberPrice&&(d.navFilterData.ratePlanCode.memberPrice=d.navFilterData.ratePlanCode.memberPrice.toFixed(2))));var i={},s={},l=[],c=[];d.currentRoom="",d.currentPackage="",d.categorized=[],d.categorizedPackages=[],d.RoomDetailSwitch=!1;var m=n.RatesAvail.roomStays[0].roomTypes,u=n.RatesAvail.roomStays[0].packageTypes,p=angular.copy(m);angular.copy(u),void 0!=u&&u.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"}),m.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"});for(var a=0;a<m.length;a++){m[a].upgradeRoom=[],m[a].isSelected=!1,m[a].myStyle="#116eb5";for(var y=0;y<m[a].averageRates.length;y++)m[a].averageRates[y].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode&&(m[a].finalPrice=m[a].averageRates[y].rate-m[a].averageRates[y].discount);if(m[a].roomUpgradeOptions.length>0)for(var r=0;r<m[a].roomUpgradeOptions.length;r++)for(var h=0;h<p.length;h++)if(p[h].roomTypeCode==m[a].roomUpgradeOptions[r].roomTypeCode){p[h].sortOrder=m[a].roomUpgradeOptions[r].sortOrder;for(var R=0;R<p[h].averageRates.length;R++)p[h].averageRates[R].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode&&(p[h].priceChanged=p[h].averageRates[R].rate-p[h].averageRates[R].discount-m[a].finalPrice,p[h].averageRates[R].merchandisedCurrency&&(p[h].merchandisedCurrency=p[h].averageRates[R].merchandisedCurrency));if(0!=p[h].priceChanged){var f=angular.copy(p[h]);m[a].upgradeRoom.push(f)}}}d.rateAvailPlans=n.RatesAvail.roomStays[0].ratePlans;for(var a=0;a<d.rateAvailPlans.length;a++)d.rateAvailPlans[a].price=d.rateAvailPlans[a].leadRate-d.rateAvailPlans[a].discountRate,Y&&d.rateAvailPlans[a].leadMemberRate&&void 0!=d.rateAvailPlans[a].discountMemberRate&&(d.rateAvailPlans[a].memberPrice=d.rateAvailPlans[a].leadMemberRate-d.rateAvailPlans[a].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(d.rateAvailPlans[a].leadRate=parseFloat(d.rateAvailPlans[a].leadRate).toFixed(2),d.rateAvailPlans[a].discountRate=parseFloat(d.rateAvailPlans[a].discountRate).toFixed(2),d.rateAvailPlans[a].price=parseFloat(d.rateAvailPlans[a].price).toFixed(2),void 0!=d.rateAvailPlans[a].memberPrice?(d.rateAvailPlans[a].leadMemberRate=parseFloat(d.rateAvailPlans[a].leadMemberRate).toFixed(2),d.rateAvailPlans[a].discountMemberRate=parseFloat(d.rateAvailPlans[a].discountMemberRate).toFixed(2),d.rateAvailPlans[a].memberPrice=parseFloat(d.rateAvailPlans[a].memberPrice).toFixed(2),d.rateAvailPlans[a].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[a].leadMemberRate)<=Number(d.rateAvailPlans[a].leadRate)):d.rateAvailPlans[a].isMemberRatePriceIsLowest=!1):(d.rateAvailPlans[a].leadRate=parseFloat(d.rateAvailPlans[a].leadRate).toFixed(0),d.rateAvailPlans[a].discountRate=parseFloat(d.rateAvailPlans[a].discountRate).toFixed(0),d.rateAvailPlans[a].price=parseFloat(d.rateAvailPlans[a].price).toFixed(0),void 0!=d.rateAvailPlans[a].memberPrice?(d.rateAvailPlans[a].leadMemberRate=parseFloat(d.rateAvailPlans[a].leadMemberRate).toFixed(0),d.rateAvailPlans[a].discountMemberRate=parseFloat(d.rateAvailPlans[a].discountMemberRate).toFixed(0),d.rateAvailPlans[a].memberPrice=parseFloat(d.rateAvailPlans[a].memberPrice).toFixed(0),d.rateAvailPlans[a].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[a].leadMemberRate)<=Number(d.rateAvailPlans[a].leadRate)):d.rateAvailPlans[a].isMemberRatePriceIsLowest=!1);d.rateAvailCategories=n.RatesAvail.roomStays[0].roomCategories,d.rateAvailCategories.forEach(function(e){e.selected=!0});for(var a=0;a<d.rateAvailCategories.length;a++)l[a]=!0;d.categorized=[];var C=[{categoryRooms:[]}];if(void 0!=n.RatesAvail.roomStays[0].packageCategories){d.rateAvailCategoriesPackage=n.RatesAvail.roomStays[0].packageCategories,d.rateAvailCategoriesPackage.forEach(function(e){e.selected=!0});for(var a=0;a<d.rateAvailCategories.length;a++)c[a]=!0}d.categorizedPackages=[];var S=[{categoryPackages:[]}],A=0,I=0;C[0].categoryRooms[I]={},C[0].categoryRooms[I].categoryRoom=[];for(var R=0;R<m.length;R++)if(!m[R].hasOwnProperty("categoryCode")){m[R].priceTagRate=[],m[R].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var b=0;b<m[R].averageRates.length;b++)if("Regular"==m[R].averageRates[b].ratePlanType&&m[R].averageRates[b].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=m[R].nightlyRates&&m[R].nightlyRates.length>0){m[R].averageRates[b].nightlyRates=[];for(var D=0;D<m[R].nightlyRates.length;D++)m[R].nightlyRates[D].ratePlanCode==m[R].averageRates[b].ratePlanCode&&m[R].averageRates[b].nightlyRates.push(angular.copy(m[R].nightlyRates[D]))}m[R].priceTagRate.push(m[R].averageRates[b])}else if(m[R].averageRates[b].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=m[R].nightlyRates&&m[R].nightlyRates.length>0){m[R].averageRates[b].nightlyRates=[];for(var D=0;D<m[R].nightlyRates.length;D++)"Group"==m[R].averageRates[b].ratePlanType?m[R].nightlyRates[D].ratePlanCode==m[R].averageRates[b].roomRateCode&&m[R].averageRates[b].nightlyRates.push(angular.copy(m[R].nightlyRates[D])):m[R].nightlyRates[D].ratePlanCode==m[R].averageRates[b].ratePlanCode&&m[R].averageRates[b].nightlyRates.push(angular.copy(m[R].nightlyRates[D]))}m[R].priceTagRate.unshift(m[R].averageRates[b])}for(var a=0;a<d.rateAvailPlans.length;a++)for(var r=0;r<m[R].priceTagRate.length;r++)m[R].priceTagRate[r].ratePlanCode==d.rateAvailPlans[a].ratePlanCode&&(m[R].priceTagRate[r].ratePlanName=d.rateAvailPlans[a].ratePlanName,m[R].priceTagRate[r].ratePlanDescription=d.rateAvailPlans[a].ratePlanDescription,m[R].priceTagRate[r].cancellationPolicy=d.rateAvailPlans[a].cancellationPolicy,m[R].priceTagRate[r].guaranteePolicy=d.rateAvailPlans[a].guaranteePolicy,m[R].priceTagRate[r].sortOrder=d.rateAvailPlans[a].sortOrder,
void 0!=d.rateAvailPlans[a].packagePolicies&&(m[R].priceTagRate[r].packagePolicies=d.rateAvailPlans[a].packagePolicies));for(var a=0;a<m[R].averageRates.length;a++)d.navFilterData.ratePlanCode.ratePlanCode==m[R].averageRates[a].ratePlanCode&&(m[R].currentRate=m[R].averageRates[a],m[R].currentRate.price=m[R].currentRate.rate-m[R].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(m[R].currentRate.price=m[R].currentRate.price.toFixed(2)),C[0].categoryRooms[I].categoryRoom.push(m[R]),A++);A%X==0&&0!=A&&(I++,C[0].categoryRooms[I]={},C[0].categoryRooms[I].categoryRoom=[])}if(0!=C[0].categoryRooms[0].categoryRoom.length){for(var T=C[0].categoryRooms.length;T>0;T--)0==C[0].categoryRooms[T-1].categoryRoom.length&&C[0].categoryRooms.splice(T-1,1);d.categorized.push(C[0])}if(void 0!=u){d.categorizedPackages=[];var S=[{categoryPackages:[]}],A=0,I=0;S[0].categoryPackages[I]={},S[0].categoryPackages[I].categoryPackage=[];for(var R=0;R<u.length;R++)u[R].hasOwnProperty("categoryCode")||(S[0].categoryPackages[I].categoryPackage.push(u[R]),A++),A%X==0&&0!=A&&(I++,S[0].categoryPackages[I]={},S[0].categoryPackages[I].categoryPackage=[]);if(0!=S[0].categoryPackages[0].categoryPackage.length){for(var T=S[0].categoryPackages.length;T>0;T--)0==S[0].categoryPackages[T-1].categoryPackage.length&&S[0].categoryPackages.splice(T-1,1);d.categorizedPackages.push(S[0])}}for(var h=0;h<n.RatesAvail.roomStays[0].roomCategories.length;h++){A=0,I=0,i={name:n.RatesAvail.roomStays[0].roomCategories[h].categoryName,categoryCode:n.RatesAvail.roomStays[0].roomCategories[h].categoryCode,categoryRooms:[]},i.categoryRooms[0]={},i.categoryRooms[0].categoryRoom=[];for(var R=0;R<m.length;R++){var E=!1;if(m[R].categoryCode==n.RatesAvail.roomStays[0].roomCategories[h].categoryCode){m[R].priceTagRate=[],m[R].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var b=0;b<m[R].averageRates.length;b++)if("Regular"==m[R].averageRates[b].ratePlanType&&m[R].averageRates[b].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=m[R].nightlyRates&&m[R].nightlyRates.length>0){m[R].averageRates[b].nightlyRates=[];for(var D=0;D<m[R].nightlyRates.length;D++)m[R].nightlyRates[D].ratePlanCode==m[R].averageRates[b].ratePlanCode&&m[R].averageRates[b].nightlyRates.push(angular.copy(m[R].nightlyRates[D]))}m[R].priceTagRate.push(m[R].averageRates[b])}else if(m[R].averageRates[b].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=m[R].nightlyRates&&m[R].nightlyRates.length>0){m[R].averageRates[b].nightlyRates=[];for(var D=0;D<m[R].nightlyRates.length;D++)"Group"==m[R].averageRates[b].ratePlanType?m[R].nightlyRates[D].ratePlanCode==m[R].averageRates[b].roomRateCode&&m[R].averageRates[b].nightlyRates.push(angular.copy(m[R].nightlyRates[D])):m[R].nightlyRates[D].ratePlanCode==m[R].averageRates[b].ratePlanCode&&m[R].averageRates[b].nightlyRates.push(angular.copy(m[R].nightlyRates[D]))}m[R].priceTagRate.unshift(m[R].averageRates[b])}for(var a=0;a<m[R].averageRates.length;a++){for(var M=0;M<d.rateAvailPlans.length;M++)d.rateAvailPlans[M].ratePlanCode==m[R].averageRates[a].ratePlanCode&&(m[R].priceTagRate[a].ratePlanName=d.rateAvailPlans[M].ratePlanName,m[R].priceTagRate[a].sortOrder=d.rateAvailPlans[M].sortOrder);d.navFilterData.ratePlanCode.ratePlanCode==m[R].averageRates[a].ratePlanCode&&(m[R].currentRate=m[R].averageRates[a],m[R].currentRate.price=m[R].currentRate.rate-m[R].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(m[R].currentRate.price=m[R].currentRate.price.toFixed(2)),i.categoryRooms[I].categoryRoom.push(m[R]),A++,!0)}for(var a=0;a<d.rateAvailPlans.length;a++)for(var r=0;r<m[R].priceTagRate.length;r++)m[R].priceTagRate[r].ratePlanCode==d.rateAvailPlans[a].ratePlanCode&&(m[R].priceTagRate[r].ratePlanName=d.rateAvailPlans[a].ratePlanName,m[R].priceTagRate[r].ratePlanDescription=d.rateAvailPlans[a].ratePlanDescription,m[R].priceTagRate[r].cancellationPolicy=d.rateAvailPlans[a].cancellationPolicy,m[R].priceTagRate[r].guaranteePolicy=d.rateAvailPlans[a].guaranteePolicy,m[R].priceTagRate[r].sortOrder=d.rateAvailPlans[a].sortOrder,void 0!=d.rateAvailPlans[a].packagePolicies&&(m[R].priceTagRate[r].packagePolicies=d.rateAvailPlans[a].packagePolicies))}A%X==0&&0!=A&&(E=!0,I++,i.categoryRooms[I]={},i.categoryRooms[I].categoryRoom=[])}if(1==E){for(var _=i.categoryRooms.length;_>0;_--)0==i.categoryRooms[_-1].categoryRoom.length&&i.categoryRooms.splice(_-1,1);d.categorized.push(i)}else if(i.categoryRooms[I].categoryRoom.length>0){for(var _=i.categoryRooms.length;_>0;_--)0==i.categoryRooms[_-1].categoryRoom.length&&i.categoryRooms.splice(_-1,1);d.categorized.push(i)}}if(void 0!=u)for(var h=0;h<n.RatesAvail.roomStays[0].packageCategories.length;h++){var A=0,I=0,s={name:n.RatesAvail.roomStays[0].packageCategories[h].categoryName,categoryCode:n.RatesAvail.roomStays[0].packageCategories[h].categoryCode,categoryPackages:[]};s.categoryPackages[0]={},s.categoryPackages[0].categoryPackage=[];for(var R=0;R<u.length;R++){var E=!1;u[R].categoryCode==n.RatesAvail.roomStays[0].packageCategories[h].categoryCode&&(s.categoryPackages[I].categoryPackage.push(u[R]),A++,!0),A%X==0&&0!=A&&(E=!0,I++,s.categoryPackages[I]={},s.categoryPackages[I].categoryPackage=[])}if(1==E){for(var _=s.categoryPackages.length;_>0;_--)0==s.categoryPackages[_-1].categoryPackage.length&&s.categoryPackages.splice(_-1,1);d.categorizedPackages.push(s)}else if(s.categoryPackages[I].categoryPackage.length>0){for(var _=s.categoryPackages.length;_>0;_--)0==s.categoryPackages[_-1].categoryPackage.length&&s.categoryPackages.splice(_-1,1);d.categorizedPackages.push(s)}}if(P(m),void 0!=u&&P(u),be=d.categorized,Ee=d.categorizedPackages,1==n.displayMultiRateListView){var k=v.getCodeTypes();1!=d.packageSelected||void 0==d.navFilterData||void 0==d.navFilterData.ratePlanCode||"Package"!=d.navFilterData.ratePlanCode.ratePlanType&&"Group"!=d.navFilterData.ratePlanCode.ratePlanType?v.getReservation().roomStays[0].ratePlans.length>0&&("Package"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType||"Group"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType)?n.displayMultiRateListView=!1:void 0!=k&&(k.indexOf("Group")>-1||k.indexOf("group")>-1)?n.displayMultiRateListView=!1:(d.toggleAcc.gridView=!1,d.toggleAcc.listView=!0,de()):n.displayMultiRateListView=!1}d.checkBox.selected=!0,d.checkBoxPackage.selected=!0,d.changeALLRoomSelect(),d.changeALLPackageSelect(),d.changeCatecory(),d.changePackageCategory(),d.Categorized=d.categorized,void 0!=d.navFilterData&&(te=angular.copy(d.navFilterData.ratePlanCode.leadRate),oe=angular.copy(d.navFilterData.ratePlanCode.price),re=angular.copy(d.navFilterData.ratePlanCode.leadMemberRate),ne=angular.copy(d.navFilterData.ratePlanCode.memberPrice),d.navFilterData.ratePlanCode.leadRate=t("currencyConversionAndSymbol")(te,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),d.navFilterData.ratePlanCode.price=t("currencyConversionAndSymbol")(oe,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),Y&&re&&void 0!=ne?(d.isMemberRatePriceIsLowest=Number(re)<=Number(te),d.navFilterData.ratePlanCode.leadMemberRate=t("currencyConversionAndSymbol")(re,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),d.navFilterData.ratePlanCode.memberPrice=t("currencyConversionAndSymbol")(ne,!1,d.navFilterData.ratePlanCode.merchandisedCurrency)):d.isMemberRatePriceIsLowest=!1)})}()),d.UpgradeRoom=function(e,a,t){if(d.categorized)for(var r=0;r<d.categorized.length;r++)for(var i=0;i<d.categorized[r].categoryRooms.length;i++)for(var s=0;s<d.categorized[r].categoryRooms[i].categoryRoom.length;s++)1==d.categorized[r].categoryRooms[i].categoryRoom[s].isSelected&&(d.closeRoomDetail(d.categorized[r].categoryRooms[i].categoryRoom[s]),d.categorized[r].categoryRooms[i].categoryRoom[s].myStyle="#116eb5");if(d.categorized)for(var r=0;r<d.categorized.length;r++)for(var i=0;i<d.categorized[r].categoryRooms.length;i++)for(var s=0;s<d.categorized[r].categoryRooms[i].categoryRoom.length;s++)d.categorized[r].categoryRooms[i].categoryRoom[s].isSelected=!1;F(),f.eventTrack("ClickRoomUpgrade",{category:"UserNavigation",label:e}),Ie=v.passPromotionIdInApi(Ie),t&&a.currentRate&&(Ie.ratePlanCode=a.currentRate.ratePlanCode,Ie.ratePlanType=a.currentRate.ratePlanType),c.getAccommodationRooms(Ie).getAllRooms().then(function(a){v.validateAvailForPromotions(a.data),d.isUpgradedroom=!0,n.RatesAvail=$?O.createDuplicateRateList(a.data):a.data,De=angular.copy(n.RatesAvail),0!=n.RatesAvail.roomStays[0].roomCategories.length&&n.RatesAvail.roomStays[0].roomCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageCategories&&0!=n.RatesAvail.roomStays[0].packageCategories.length&&n.RatesAvail.roomStays[0].packageCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].ratePlans&&0!=n.RatesAvail.roomStays[0].ratePlans.length&&n.RatesAvail.roomStays[0].ratePlans.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),0!=n.RatesAvail.roomStays[0].roomTypes.length&&n.RatesAvail.roomStays[0].roomTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageTypes&&0!=n.RatesAvail.roomStays[0].packageTypes.length&&n.RatesAvail.roomStays[0].packageTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var t=0;t<n.RatesAvail.roomStays[0].roomCategories.length;t++){for(var r=!1,i=0;i<n.RatesAvail.roomStays[0].roomTypes.length;i++)n.RatesAvail.roomStays[0].roomTypes[i].categoryCode==n.RatesAvail.roomStays[0].roomCategories[t].categoryCode&&(r=!0);0==r&&(n.RatesAvail.roomStays[0].roomCategories.splice(t,1),t--)}if(void 0!=n.RatesAvail.roomStays[0].packageCategories){for(var t=0;t<n.RatesAvail.roomStays[0].packageCategories.length;t++){for(var r=!1,i=0;i<n.RatesAvail.roomStays[0].packageTypes.length;i++)n.RatesAvail.roomStays[0].packageTypes[i].categoryCode==n.RatesAvail.roomStays[0].packageCategories[t].categoryCode&&(r=!0);0==r&&(n.RatesAvail.roomStays[0].packageCategories.splice(t,1),t--)}0==n.RatesAvail.roomStays[0].packageCategories.length&&(d.categorizePackageHide=!0)}else d.categorizePackageHide=!0;if(0==n.RatesAvail.roomStays[0].roomCategories.length&&(d.categorizeHide=!0),void 0!=n.RatesAvail.roomStays[0].packageTypes)for(var t=0;t<n.RatesAvail.roomStays[0].packageTypes.length;t++)n.RatesAvail.roomStays[0].packageTypes[t].inclusions.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});if(g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator){for(var t=0;t<n.RatesAvail.roomStays[0].roomTypes.length;t++)for(var i=0;i<n.RatesAvail.roomStays[0].roomTypes[t].averageRates.length;i++)n.RatesAvail.roomStays[0].roomTypes[t].averageRates[i].rate=parseFloat(n.RatesAvail.roomStays[0].roomTypes[t].averageRates[i].rate).toFixed(2),n.RatesAvail.roomStays[0].roomTypes[t].averageRates[i].discount=parseFloat(n.RatesAvail.roomStays[0].roomTypes[t].averageRates[i].discount).toFixed(2);if(void 0!=n.RatesAvail.roomStays[0].packageTypes)for(var t=0;t<n.RatesAvail.roomStays[0].packageTypes.length;t++)n.RatesAvail.roomStays[0].packageTypes[t].leadRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[t].leadRate).toFixed(2),n.RatesAvail.roomStays[0].packageTypes[t].discountRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[t].discountRate).toFixed(2);n.RatesAvail.roomStays[0].ratePlans.forEach(function(e){e.leadRate=parseFloat(e.leadRate).toFixed(2)})}else{for(var t=0;t<n.RatesAvail.roomStays[0].roomTypes.length;t++)for(var i=0;i<n.RatesAvail.roomStays[0].roomTypes[t].averageRates.length;i++)n.RatesAvail.roomStays[0].roomTypes[t].averageRates[i].rate=parseFloat(n.RatesAvail.roomStays[0].roomTypes[t].averageRates[i].rate).toFixed(0),n.RatesAvail.roomStays[0].roomTypes[t].averageRates[i].discount=parseFloat(n.RatesAvail.roomStays[0].roomTypes[t].averageRates[i].discount).toFixed(0);if(void 0!=n.RatesAvail.roomStays[0].packageTypes)for(var t=0;t<n.RatesAvail.roomStays[0].packageTypes.length;t++)n.RatesAvail.roomStays[0].packageTypes[t].leadRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[t].leadRate).toFixed(0),n.RatesAvail.roomStays[0].packageTypes[t].discountRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[t].discountRate).toFixed(0);n.RatesAvail.roomStays[0].ratePlans.forEach(function(e){e.leadRate=parseFloat(e.leadRate).toFixed(0)})}var s={},c={},m=[];d.currentRoom="",d.currentPackage="",d.categorized=[],d.categorizedPackages=[],d.RoomDetailSwitch=!1,d.memberRateCurrentRoom="";var u=n.RatesAvail.roomStays[0].roomTypes,p=n.RatesAvail.roomStays[0].packageTypes,h=angular.copy(u);angular.copy(p),void 0!=p&&p.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"}),u.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"});for(var t=0;t<u.length;t++){u[t].upgradeRoom=[],u[t].isSelected=!1,u[t].myStyle="#116eb5";for(var R=0;R<u[t].averageRates.length;R++)u[t].averageRates[R].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode&&(u[t].finalPrice=u[t].averageRates[R].rate-u[t].averageRates[R].discount);if(u[t].roomUpgradeOptions.length>0)for(var i=0;i<u[t].roomUpgradeOptions.length;i++)for(var f=0;f<h.length;f++)if(h[f].roomTypeCode==u[t].roomUpgradeOptions[i].roomTypeCode){h[f].sortOrder=u[t].roomUpgradeOptions[i].sortOrder;for(var C=0;C<h[f].averageRates.length;C++)h[f].averageRates[C].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode&&(h[f].priceChanged=h[f].averageRates[C].rate-h[f].averageRates[C].discount-u[t].finalPrice,h[f].averageRates[C].merchandisedCurrency&&(h[f].merchandisedCurrency=h[f].averageRates[C].merchandisedCurrency));if(0!=h[f].priceChanged){var A=angular.copy(h[f]);u[t].upgradeRoom.push(A)}}}d.rateAvailPlans=n.RatesAvail.roomStays[0].ratePlans;for(var t=0;t<d.rateAvailPlans.length;t++)d.rateAvailPlans[t].price=d.rateAvailPlans[t].leadRate-d.rateAvailPlans[t].discountRate,Y&&d.rateAvailPlans[t].leadMemberRate&&void 0!=d.rateAvailPlans[t].discountMemberRate&&(d.rateAvailPlans[t].memberPrice=d.rateAvailPlans[t].leadMemberRate-d.rateAvailPlans[t].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(d.rateAvailPlans[t].leadRate=parseFloat(d.rateAvailPlans[t].leadRate).toFixed(2),d.rateAvailPlans[t].discountRate=parseFloat(d.rateAvailPlans[t].discountRate).toFixed(2),d.rateAvailPlans[t].price=parseFloat(d.rateAvailPlans[t].price).toFixed(2),void 0!=d.rateAvailPlans[t].memberPrice?(d.rateAvailPlans[t].leadMemberRate=parseFloat(d.rateAvailPlans[t].leadMemberRate).toFixed(2),d.rateAvailPlans[t].discountMemberRate=parseFloat(d.rateAvailPlans[t].discountMemberRate).toFixed(2),d.rateAvailPlans[t].memberPrice=parseFloat(d.rateAvailPlans[t].memberPrice).toFixed(2),d.rateAvailPlans[t].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[t].leadMemberRate)<=Number(d.rateAvailPlans[t].leadRate)):d.rateAvailPlans[t].isMemberRatePriceIsLowest=!1):(d.rateAvailPlans[t].leadRate=parseFloat(d.rateAvailPlans[t].leadRate).toFixed(0),d.rateAvailPlans[t].discountRate=parseFloat(d.rateAvailPlans[t].discountRate).toFixed(0),d.rateAvailPlans[t].price=parseFloat(d.rateAvailPlans[t].price).toFixed(0),void 0!=d.rateAvailPlans[t].memberPrice?(d.rateAvailPlans[t].leadMemberRate=parseFloat(d.rateAvailPlans[t].leadMemberRate).toFixed(0),d.rateAvailPlans[t].discountMemberRate=parseFloat(d.rateAvailPlans[t].discountMemberRate).toFixed(0),d.rateAvailPlans[t].memberPrice=parseFloat(d.rateAvailPlans[t].memberPrice).toFixed(0),d.rateAvailPlans[t].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[t].leadMemberRate)<=Number(d.rateAvailPlans[t].leadRate)):d.rateAvailPlans[t].isMemberRatePriceIsLowest=!1);d.rateAvailCategories=n.RatesAvail.roomStays[0].roomCategories,d.rateAvailCategories.forEach(function(e){e.selected=!0});for(var t=0;t<d.rateAvailCategories.length;t++)m[t]=!0;d.categorized=[];var I=[{categoryRooms:[]}],b=0,D=0;I[0].categoryRooms[D]={},I[0].categoryRooms[D].categoryRoom=[];for(var C=0;C<u.length;C++)if(!u[C].hasOwnProperty("categoryCode")){u[C].priceTagRate=[],u[C].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var T=0;T<u[C].averageRates.length;T++)if("Regular"==u[C].averageRates[T].ratePlanType&&u[C].averageRates[T].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=u[C].nightlyRates&&u[C].nightlyRates.length>0){u[C].averageRates[T].nightlyRates=[];for(var E=0;E<u[C].nightlyRates.length;E++)u[C].nightlyRates[E].ratePlanCode==u[C].averageRates[T].ratePlanCode&&u[C].averageRates[T].nightlyRates.push(angular.copy(u[C].nightlyRates[E]))}u[C].priceTagRate.push(u[C].averageRates[T])}else if(u[C].averageRates[T].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=u[C].nightlyRates&&u[C].nightlyRates.length>0){u[C].averageRates[T].nightlyRates=[];for(var E=0;E<u[C].nightlyRates.length;E++)"Group"==u[C].averageRates[T].ratePlanType?u[C].nightlyRates[E].ratePlanCode==u[C].averageRates[T].roomRateCode&&u[C].averageRates[T].nightlyRates.push(angular.copy(u[C].nightlyRates[E])):u[C].nightlyRates[E].ratePlanCode==u[C].averageRates[T].ratePlanCode&&u[C].averageRates[T].nightlyRates.push(angular.copy(u[C].nightlyRates[E]))}u[C].priceTagRate.unshift(u[C].averageRates[T])}for(var t=0;t<d.rateAvailPlans.length;t++)for(var i=0;i<u[C].priceTagRate.length;i++)u[C].priceTagRate[i].ratePlanCode==d.rateAvailPlans[t].ratePlanCode&&(u[C].priceTagRate[i].ratePlanName=d.rateAvailPlans[t].ratePlanName,u[C].priceTagRate[i].ratePlanDescription=d.rateAvailPlans[t].ratePlanDescription,u[C].priceTagRate[i].cancellationPolicy=d.rateAvailPlans[t].cancellationPolicy,u[C].priceTagRate[i].guaranteePolicy=d.rateAvailPlans[t].guaranteePolicy,u[C].priceTagRate[i].sortOrder=d.rateAvailPlans[t].sortOrder,void 0!=d.rateAvailPlans[t].packagePolicies&&(u[C].priceTagRate[i].packagePolicies=d.rateAvailPlans[t].packagePolicies));if(u[C].roomTypeCode==e&&(d.currentRoom=u[C]),u[C].roomTypeCode.indexOf("M_")>-1){var M=u[C].roomTypeCode.replace("M_","");M===e&&(d.memberRateCurrentRoom=u[C])}for(var t=0;t<u[C].averageRates.length;t++){for(var _=0;_<d.rateAvailPlans.length;_++)d.rateAvailPlans[_].ratePlanCode==u[C].averageRates[t].ratePlanCode&&(u[C].priceTagRate[t].ratePlanName=d.rateAvailPlans[_].ratePlanName,u[C].priceTagRate[t].sortOrder=d.rateAvailPlans[_].sortOrder);d.navFilterData.ratePlanCode.ratePlanCode==u[C].averageRates[t].ratePlanCode&&(u[C].currentRate=u[C].averageRates[t],u[C].currentRate.price=u[C].currentRate.rate-u[C].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(u[C].currentRate.price=u[C].currentRate.price.toFixed(2)),I[0].categoryRooms[D].categoryRoom.push(u[C]),b++)}if(void 0!=d.currentRoom.priceTagRate){d.currentRoom.priceTagRate.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var k=0;k<d.currentRoom.priceTagRate.length;k++)if(d.currentRoom.priceTagRate[k].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){d.currentRoom.priceTagRate.unshift(d.currentRoom.priceTagRate[k]),d.currentRoom.priceTagRate.splice(k+1,1);break}}b%X==0&&0!=b&&(D++,I[0].categoryRooms[D]={},I[0].categoryRooms[D].categoryRoom=[])}if(0!=I[0].categoryRooms[0].categoryRoom.length){for(var N=I[0].categoryRooms.length;N>0;N--)0==I[0].categoryRooms[N-1].categoryRoom.length&&I[0].categoryRooms.splice(N-1,1);d.categorized.push(I[0])}var L,G=0,F=0;if(void 0==d.currentRoom.categoryCode)for(var B=0;B<I[0].categoryRooms.length;B++)for(var x=0;x<I[0].categoryRooms[B].categoryRoom.length;x++)F++,I[0].categoryRooms[B].categoryRoom[x].roomTypeCode==d.currentRoom.roomTypeCode&&(G=F);if(void 0!=p){d.categorizedPackages=[];var w=[{categoryPackages:[]}],b=0,D=0;w[0].categoryPackages[D]={},w[0].categoryPackages[D].categoryPackage=[];for(var C=0;C<p.length;C++)p[C].hasOwnProperty("categoryCode")||(w[0].categoryPackages[D].categoryPackage.push(p[C]),b++),b%X==0&&0!=b&&(D++,w[0].categoryPackages[D]={},w[0].categoryPackages[D].categoryPackage=[]),p[C].packageCode==e&&(d.currentPackage=p[C]);if(0!=w[0].categoryPackages[0].categoryPackage.length){for(var N=w[0].categoryPackages.length;N>0;N--)0==w[0].categoryPackages[N-1].categoryPackage.length&&w[0].categoryPackages.splice(N-1,1);d.categorizedPackages.push(w[0])}}var L,G=0,F=0;if(void 0==d.currentPackage.categoryCode&&void 0!=w)for(var B=0;B<w[0].categoryPackages.length;B++)for(var x=0;x<w[0].categoryPackages[B].categoryPackage.length;x++)F++,w[0].categoryPackages[B].categoryPackage[x].packageCode==d.currentPackage.packageCode&&(G=F);for(var U,f=0;f<n.RatesAvail.roomStays[0].roomCategories.length;f++){b=0,D=0,s={name:n.RatesAvail.roomStays[0].roomCategories[f].categoryName,categoryCode:n.RatesAvail.roomStays[0].roomCategories[f].categoryCode,categoryRooms:[]},s.categoryRooms[0]={},s.categoryRooms[0].categoryRoom=[];for(var C=0;C<u.length;C++){var H=!1;if(u[C].roomTypeCode==e&&(d.currentRoom=u[C],U=u[C].categoryCode),u[C].categoryCode==n.RatesAvail.roomStays[0].roomCategories[f].categoryCode){u[C].priceTagRate=[],u[C].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var T=0;T<u[C].averageRates.length;T++)if("Regular"==u[C].averageRates[T].ratePlanType&&u[C].averageRates[T].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=u[C].nightlyRates&&u[C].nightlyRates.length>0){u[C].averageRates[T].nightlyRates=[];for(var E=0;E<u[C].nightlyRates.length;E++)u[C].nightlyRates[E].ratePlanCode==u[C].averageRates[T].ratePlanCode&&u[C].averageRates[T].nightlyRates.push(angular.copy(u[C].nightlyRates[E]))}u[C].priceTagRate.push(u[C].averageRates[T])}else if(u[C].averageRates[T].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=u[C].nightlyRates&&u[C].nightlyRates.length>0){u[C].averageRates[T].nightlyRates=[];for(var E=0;E<u[C].nightlyRates.length;E++)"Group"==u[C].averageRates[T].ratePlanType?u[C].nightlyRates[E].ratePlanCode==u[C].averageRates[T].roomRateCode&&u[C].averageRates[T].nightlyRates.push(angular.copy(u[C].nightlyRates[E])):u[C].nightlyRates[E].ratePlanCode==u[C].averageRates[T].ratePlanCode&&u[C].averageRates[T].nightlyRates.push(angular.copy(u[C].nightlyRates[E]))}u[C].priceTagRate.unshift(u[C].averageRates[T])}for(var t=0;t<u[C].averageRates.length;t++){for(var _=0;_<d.rateAvailPlans.length;_++)d.rateAvailPlans[_].ratePlanCode==u[C].averageRates[t].ratePlanCode&&(u[C].priceTagRate[t].ratePlanName=d.rateAvailPlans[_].ratePlanName,u[C].priceTagRate[t].sortOrder=d.rateAvailPlans[_].sortOrder);d.navFilterData.ratePlanCode.ratePlanCode==u[C].averageRates[t].ratePlanCode&&(u[C].currentRate=u[C].averageRates[t],u[C].currentRate.price=u[C].currentRate.rate-u[C].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(u[C].currentRate.price=u[C].currentRate.price.toFixed(2)),s.categoryRooms[D].categoryRoom.push(u[C]),b++,!0)}for(var t=0;t<d.rateAvailPlans.length;t++)for(var i=0;i<u[C].priceTagRate.length;i++)u[C].priceTagRate[i].ratePlanCode==d.rateAvailPlans[t].ratePlanCode&&(u[C].priceTagRate[i].ratePlanName=d.rateAvailPlans[t].ratePlanName,u[C].priceTagRate[i].ratePlanDescription=d.rateAvailPlans[t].ratePlanDescription,u[C].priceTagRate[i].cancellationPolicy=d.rateAvailPlans[t].cancellationPolicy,u[C].priceTagRate[i].guaranteePolicy=d.rateAvailPlans[t].guaranteePolicy,u[C].priceTagRate[i].sortOrder=d.rateAvailPlans[t].sortOrder,void 0!=d.rateAvailPlans[t].packagePolicies&&(u[C].priceTagRate[i].packagePolicies=d.rateAvailPlans[t].packagePolicies))}if(void 0!=d.currentRoom.priceTagRate){d.currentRoom.priceTagRate.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var k=0;k<d.currentRoom.priceTagRate.length;k++)if(d.currentRoom.priceTagRate[k].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){d.currentRoom.priceTagRate.unshift(d.currentRoom.priceTagRate[k]),d.currentRoom.priceTagRate.splice(k+1,1);break}}b%X==0&&0!=b&&(H=!0,D++,s.categoryRooms[D]={},s.categoryRooms[D].categoryRoom=[])}if(1==H){for(var V=s.categoryRooms.length;V>0;V--)0==s.categoryRooms[V-1].categoryRoom.length&&s.categoryRooms.splice(V-1,1);d.categorized.push(s)}else if(s.categoryRooms[D].categoryRoom.length>0){for(var V=s.categoryRooms.length;V>0;V--)0==s.categoryRooms[V-1].categoryRoom.length&&s.categoryRooms.splice(V-1,1);d.categorized.push(s)}}for(var t=0;t<d.categorized.length;t++)if(d.categorized[t].categoryCode==U){F=0;for(var B=0;B<d.categorized[t].categoryRooms.length;B++)for(var x=0;x<d.categorized[t].categoryRooms[B].categoryRoom.length;x++)F++,d.categorized[t].categoryRooms[B].categoryRoom[x].roomTypeCode==d.currentRoom.roomTypeCode&&(G=F)}if(void 0!=p)for(var f=0;f<n.RatesAvail.roomStays[0].packageCategories.length;f++){var b=0,D=0,c={name:n.RatesAvail.roomStays[0].packageCategories[f].categoryName,categoryCode:n.RatesAvail.roomStays[0].packageCategories[f].categoryCode,categoryPackages:[]};c.categoryPackages[0]={},c.categoryPackages[0].categoryPackage=[];for(var C=0;C<p.length;C++){var H=!1;p[C].packageCode==e&&(d.currentPackage=p[C],U=p[C].categoryCode),p[C].categoryCode==n.RatesAvail.roomStays[0].packageCategories[f].categoryCode&&(c.categoryPackages[D].categoryPackage.push(p[C]),b++,!0),b%X==0&&0!=b&&(H=!0,D++,c.categoryPackages[D]={},c.categoryPackages[D].categoryPackage=[])}if(1==H){for(var V=c.categoryPackages.length;V>0;V--)0==c.categoryPackages[V-1].categoryPackage.length&&c.categoryPackages.splice(V-1,1);d.categorizedPackages.push(c)}else if(c.categoryPackages[D].categoryPackage.length>0){for(var V=c.categoryPackages.length;V>0;V--)0==c.categoryPackages[V-1].categoryPackage.length&&c.categoryPackages.splice(V-1,1);d.categorizedPackages.push(c)}}if(void 0!=d.categorizedPackages)for(var t=0;t<d.categorizedPackages.length;t++)if(d.categorizedPackages[t].categoryCode==U){F=0;for(var B=0;B<d.categorizedPackages[t].categoryPackages.length;B++)for(var x=0;x<d.categorizedPackages[t].categoryPackages[B].categoryPackage.length;x++)F++,d.categorizedPackages[t].categoryPackages[B].categoryPackage[x].packageCode==d.currentPackage.packageCode&&(G=F)}if(P(u),void 0!=p&&P(p),be=d.categorized,Ee=d.categorizedPackages,1==n.displayMultiRateListView){for(var t=0;t<n.RatesAvail.roomStays[0].ratePlans.length;t++)1==n.RatesAvail.roomStays[0].ratePlans[t].default&&(d.navFilterData.ratePlanCode=n.RatesAvail.roomStays[0].ratePlans[t],d.navFilterData.ratePlanCode.price=n.RatesAvail.roomStays[0].ratePlans[t].leadRate-n.RatesAvail.roomStays[0].ratePlans[t].discountRate,n.RatesAvail.roomStays[0].ratePlans[t].leadMemberRate&&n.RatesAvail.roomStays[0].ratePlans[t].discountMemberRate&&(d.navFilterData.ratePlanCode.memberPrice=n.RatesAvail.roomStays[0].ratePlans[t].leadMemberRate-n.RatesAvail.roomStays[0].ratePlans[t].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(d.navFilterData.ratePlanCode.price=d.navFilterData.ratePlanCode.price.toFixed(2),d.navFilterData.ratePlanCode.memberPrice&&(d.navFilterData.ratePlanCode.memberPrice=d.navFilterData.ratePlanCode.memberPrice.toFixed(2))));var q=v.getCodeTypes();if(1!=d.packageSelected||void 0==d.navFilterData||void 0==d.navFilterData.ratePlanCode||"Package"!=d.navFilterData.ratePlanCode.ratePlanType&&"Group"!=d.navFilterData.ratePlanCode.ratePlanType)if(v.getReservation().roomStays[0].ratePlans.length>0&&("Package"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType||"Group"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType))n.displayMultiRateListView=!1;else if(void 0!=q&&(q.indexOf("Group")>-1||q.indexOf("group")>-1))n.displayMultiRateListView=!1;else{d.toggleAcc.gridView=!1,d.toggleAcc.listView=!0,de(),d.limit=4;for(var j=n.RatesAvail.roomStays[0].allRoomTypes,C=0;C<j.length;C++)j[C].roomTypeCode==e&&(d.currentRoom=j[C],d.currentRoom.id=C);if(void 0==d.currentRoom.categoryCode)for(var B=0;B<d.categorizedMultirate[0].categoryRooms.length;B++){F=0;for(var x=0;x<d.categorizedMultirate[0].categoryRooms[B].categoryRoom.length;x++)F++,d.categorizedMultirate[0].categoryRooms[B].categoryRoom[x].roomTypeCode==d.currentRoom.roomTypeCode&&(G=F)}for(var f=0;f<n.RatesAvail.roomStays[0].roomCategories.length;f++)for(var C=0;C<j.length;C++)j[C].roomTypeCode==e&&(d.currentRoom=j[C],d.currentRoom.id=C,U=j[C].categoryCode);if(void 0!=d.currentRoom.categoryCode)for(var t=0;t<d.categorizedMultirate.length;t++)if(d.categorizedMultirate[t].categoryCode==U){F=0;for(var B=0;B<d.categorizedMultirate[t].categoryRooms.length;B++)for(var x=0;x<d.categorizedMultirate[t].categoryRooms[B].categoryRoom.length;x++)F++,d.categorizedMultirate[t].categoryRooms[B].categoryRoom[x].roomTypeCode==d.currentRoom.roomTypeCode&&(G=F)}}else n.displayMultiRateListView=!1}d.checkBox.selected=!0,d.checkBoxPackage.selected=!0,d.changeALLRoomSelect(),d.changeALLPackageSelect(),d.changeCatecory(),d.changePackageCategory(),L=G%X==0?~~(G/X)-1:~~(G/X),l.warn(L),void 0!=U&&(L=U+L);var z=S.findIndex(d.currentRoom.averageMemberRates,function(e){return e.ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode});d.currentRoom&&(d.currentRoom.currentRate.ratePlanCode.indexOf("M_")>-1||d.currentRoom.averageMemberRates.length>0&&z>-1&&v.getReservation().roomStays&&v.getReservation().roomStays.length>0&&!v.getReservation().roomStays[0].total)?(d.memberRateCurrentRoom.isManageUrlMemberRateSelected=!0,v.deleteConfig("OPEN_ROOM_DETAIL")):1==v.getConfig("OPEN_ROOM_DETAIL")?(d.toggleRoomDetail(L,d.currentRoom),d.isUpgradedroom=!1,d.priceSlide.priceSlide=d.navFilterData.ratePlanCode.ratePlanCode,n.$broadcast(o.CHANGE_PLACEHOLDER),v.deleteConfig("OPEN_ROOM_DETAIL"),Ve=L,$e=d.currentRoom.id,y(function(){var e=n.displayMultiRateListView||d.toggleAcc.listView?"room"+d.currentRoom.id:d.currentRoom.id,a=n.displayMultiRateListView||d.toggleAcc.listView?"showListRow":"showGridRow";d.scrollToNew(d.currentRoom,e,null,a,L)},1800),setTimeout(function(){d.$broadcast("EVENT.CHANGE_RADIOBUTTON")},1e3),d.currentRoom.myStyle="white"):1==v.getConfig("OPEN_PACKAGE_DETAIL")||1==v.getConfig("OPEN_PACKAGE_DETAIL_PROMOTIONS")?(n.$broadcast("EVENT.CHANGE_PLACEHOLDER"),d.isUpgradedroom=!1,1==ae&&void 0!=d.currentPackage&&1==d.currentPackage.available&&1!=v.getConfig("OPEN_PACKAGE_MRBDRAWER")?(d.addPackage(d.currentPackage,d.currentPackage.packageCode),v.deleteConfig("OPEN_PACKAGE_DETAIL")):(d.goPackages(),d.togglePackageDetail(L,d.currentPackage),y(function(){var e=d.toggleAcc.listView?"package"+d.currentPackage.id:d.currentPackage.id,a=d.toggleAcc.listView?"showListRow":"showGridRow";d.PackagescrollToNew(e,null,d.currentPackage,a,L)},1800),v.deleteConfig("OPEN_PACKAGE_DETAIL"),v.deleteConfig("OPEN_PACKAGE_DETAIL_PROMOTIONS"),v.deleteConfig("OPEN_PACKAGE_MRBDRAWER"),ze=L,Ye=d.currentPackage.id)):1==v.getConfig("LOAD_ROOM_DETAIL")?(d.toggleRoomDetail(L,d.currentRoom),d.isUpgradedroom=!1,n.$broadcast(o.CHANGE_PLACEHOLDER),v.deleteConfig("LOAD_ROOM_DETAIL"),Ve=L,$e=d.currentRoom.id,d.priceSlide.priceSlide=d.navFilterData.ratePlanCode.ratePlanCode,y(function(){var e=n.displayMultiRateListView||d.toggleAcc.listView?"room"+d.currentRoom.id:d.currentRoom.id,a=n.displayMultiRateListView||d.toggleAcc.listView?"showListRow":"showGridRow";d.scrollToNew(d.currentRoom,e,null,a,L)},1800),d.currentRoom.myStyle="white"):(d.toggleRoomDetail(L,d.currentRoom),d.isUpgradedroom=!1,y(function(){var e=n.displayMultiRateListView||d.toggleAcc.listView?"room"+d.currentRoom.id:d.currentRoom.id,a=n.displayMultiRateListView||d.toggleAcc.listView?"showListRow":"showGridRow";d.scrollToNew(d.currentRoom,e,null,a,L)},1800),Ve=L,$e=d.currentRoom.id,d.currentRoom.myStyle="white",d.priceSlide.priceSlide=d.navFilterData.ratePlanCode.ratePlanCode)})};var Be=function(){if(se=!0,void 0==Ie.allCodes||void 0==Ie.allCodes.Group&&void 0==Ie.allCodes.group?void 0!=d.navFilterData&&(Ie.ratePlanCode=d.navFilterData.ratePlanCode.ratePlanCode):Ie.ratePlanCode=void 0,l.debug(JSON.stringify(Ie)+"options"),F(),
d.categorized)for(var e=0;e<d.categorized.length;e++)for(var a=0;a<d.categorized[e].categoryRooms.length;a++)for(var o=0;o<d.categorized[e].categoryRooms[a].categoryRoom.length;o++)1==d.categorized[e].categoryRooms[a].categoryRoom[o].isSelected&&(d.closeRoomDetail(d.categorized[e].categoryRooms[a].categoryRoom[o]),d.categorized[e].categoryRooms[a].categoryRoom[o].myStyle="#116eb5");if(d.categorizedPackages)for(var e=0;e<d.categorizedPackages.length;e++)for(var a=0;a<d.categorizedPackages[e].categoryPackages.length;a++)for(var o=0;o<d.categorizedPackages[e].categoryPackages[a].categoryPackage.length;o++)1==d.categorizedPackages[e].categoryPackages[a].categoryPackage[o].isSelected&&(d.closePackageDetail(d.categorizedPackages[e].categoryPackages[a].categoryPackage[o]),d.categorizedPackages[e].categoryPackages[a].categoryPackage[o].myStyle="#116eb5");if(d.categorized)for(var e=0;e<d.categorized.length;e++)for(var a=0;a<d.categorized[e].categoryRooms.length;a++)for(var o=0;o<d.categorized[e].categoryRooms[a].categoryRoom.length;o++)d.categorized[e].categoryRooms[a].categoryRoom[o].isSelected=!1;if(d.categorizedPackages)for(var e=0;e<d.categorizedPackages.length;e++)for(var a=0;a<d.categorizedPackages[e].categoryPackages.length;a++)for(var o=0;o<d.categorizedPackages[e].categoryPackages[a].categoryPackage.length;o++)d.categorizedPackages[e].categoryPackages[a].categoryPackage[o].isSelected=!1;Ie.roomTypeCode=angular.copy(d.roomTypeCode),Ie=v.passPromotionIdInApi(Ie),c.getAccommodationRooms(Ie).getAllRooms().then(function(e){if(v.validateAvailForPromotions(e.data),N(),n.RatesAvail=$?O.createDuplicateRateList(e.data):e.data,De=angular.copy(n.RatesAvail),1==Ze){if(void 0!=e.data.roomStays[0].packageTypes)for(var a=0;a<e.data.roomStays[0].packageTypes.length;a++)if(void 0!=d.navFilterData&&e.data.roomStays[0].packageTypes[a].packageCode==d.navFilterData.ratePlanCode.ratePlanCode&&e.data.roomStays[0].packageTypes[a].inclusions.length>0){for(var o=0;o<e.data.roomStays[0].packageTypes[a].inclusions.length;o++)0==e.data.roomStays[0].packageTypes[a].inclusions[o].autoSchedule&&(ia(e.data),d.roomTypeCode=angular.copy(Ie.roomTypeCode));na(e.data),v.modifyPackageInclusions(d.inclusionsServicesAuto),l.debug(JSON.stringify(v.getMainReservation())+"this is reservation.getMainMain")}Ie.roomTypeCode=void 0}0!=n.RatesAvail.roomStays[0].roomCategories.length&&n.RatesAvail.roomStays[0].roomCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageCategories&&0!=n.RatesAvail.roomStays[0].packageCategories.length&&n.RatesAvail.roomStays[0].packageCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),0!=n.RatesAvail.roomStays[0].ratePlans.length&&n.RatesAvail.roomStays[0].ratePlans.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),0!=n.RatesAvail.roomStays[0].roomTypes.length&&n.RatesAvail.roomStays[0].roomTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageTypes&&0!=n.RatesAvail.roomStays[0].packageTypes.length&&n.RatesAvail.roomStays[0].packageTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var a=0;a<n.RatesAvail.roomStays[0].roomCategories.length;a++){for(var i=!1,s=0;s<n.RatesAvail.roomStays[0].roomTypes.length;s++)n.RatesAvail.roomStays[0].roomTypes[s].categoryCode==n.RatesAvail.roomStays[0].roomCategories[a].categoryCode&&(i=!0);0==i&&(n.RatesAvail.roomStays[0].roomCategories.splice(a,1),a--)}if(void 0!=n.RatesAvail.roomStays[0].packageCategories){for(var a=0;a<n.RatesAvail.roomStays[0].packageCategories.length;a++){for(var i=!1,s=0;s<n.RatesAvail.roomStays[0].packageTypes.length;s++)n.RatesAvail.roomStays[0].packageTypes[s].categoryCode==n.RatesAvail.roomStays[0].packageCategories[a].categoryCode&&(i=!0);0==i&&(n.RatesAvail.roomStays[0].packageCategories.splice(a,1),a--)}0==n.RatesAvail.roomStays[0].packageCategories.length&&(d.categorizePackageHide=!0)}if(0==n.RatesAvail.roomStays[0].roomCategories.length&&(d.categorizeHide=!0),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator){for(var a=0;a<n.RatesAvail.roomStays[0].roomTypes.length;a++)for(var s=0;s<n.RatesAvail.roomStays[0].roomTypes[a].averageRates.length;s++)n.RatesAvail.roomStays[0].roomTypes[a].averageRates[s].rate=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[s].rate).toFixed(2),n.RatesAvail.roomStays[0].roomTypes[a].averageRates[s].discount=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[s].discount).toFixed(2);if(void 0!=n.RatesAvail.roomStays[0].packageTypes)for(var a=0;a<n.RatesAvail.roomStays[0].packageTypes.length;a++)n.RatesAvail.roomStays[0].packageTypes[a].leadRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].leadRate).toFixed(2),n.RatesAvail.roomStays[0].packageTypes[a].discountRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].discountRate).toFixed(2);n.RatesAvail.roomStays[0].ratePlans.forEach(function(e){e.leadRate=parseFloat(e.leadRate).toFixed(2)})}else{for(var a=0;a<n.RatesAvail.roomStays[0].roomTypes.length;a++)for(var s=0;s<n.RatesAvail.roomStays[0].roomTypes[a].averageRates.length;s++)n.RatesAvail.roomStays[0].roomTypes[a].averageRates[s].rate=n.RatesAvail.roomStays[0].roomTypes[a].averageRates[s].rate.toFixed(0),n.RatesAvail.roomStays[0].roomTypes[a].averageRates[s].discount=n.RatesAvail.roomStays[0].roomTypes[a].averageRates[s].discount.toFixed(0);if(void 0!=n.RatesAvail.roomStays[0].packageTypes)for(var a=0;a<n.RatesAvail.roomStays[0].packageTypes.length;a++)n.RatesAvail.roomStays[0].packageTypes[a].leadRate=n.RatesAvail.roomStays[0].packageTypes[a].leadRate.toFixed(0),n.RatesAvail.roomStays[0].packageTypes[a].discountRate=n.RatesAvail.roomStays[0].packageTypes[a].discountRate.toFixed(0);n.RatesAvail.roomStays[0].ratePlans.forEach(function(e){e.leadRate=parseFloat(e.leadRate).toFixed(0)})}d.iconShow=g.getHotelDesc().uxConfiguration.accomodationsConfig.displayIconsIndicator,d.rateShow=g.getHotelDesc().uxConfiguration.strikeThroughPricingEnabled,0==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultDisplayFormat?d.goGrid():1==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultDisplayFormat&&(r.innerWidth<768?d.goGrid():d.goList());for(var a=0;a<n.RatesAvail.roomStays[0].ratePlans.length;a++)1==n.RatesAvail.roomStays[0].ratePlans[a].default&&(d.navFilterData.ratePlanCode=n.RatesAvail.roomStays[0].ratePlans[a],d.navFilterData.ratePlanCode.price=n.RatesAvail.roomStays[0].ratePlans[a].leadRate-n.RatesAvail.roomStays[0].ratePlans[a].discountRate,n.RatesAvail.roomStays[0].ratePlans[a].leadMemberRate&&n.RatesAvail.roomStays[0].ratePlans[a].discountMemberRate&&(d.navFilterData.ratePlanCode.memberPrice=n.RatesAvail.roomStays[0].ratePlans[a].leadMemberRate-n.RatesAvail.roomStays[0].ratePlans[a].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(d.navFilterData.ratePlanCode.price=d.navFilterData.ratePlanCode.price.toFixed(2),d.navFilterData.ratePlanCode.memberPrice&&(d.navFilterData.ratePlanCode.memberPrice=d.navFilterData.ratePlanCode.memberPrice.toFixed(2))));var c={},m={},u=[],p=[];d.currentRoom="",d.currentPackage="",d.categorized=[],d.categorizedPackages=[],d.RoomDetailSwitch=!1;var y=n.RatesAvail.roomStays[0].roomTypes,h=n.RatesAvail.roomStays[0].packageTypes,R=angular.copy(y);if(angular.copy(h),void 0!=h&&h.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"}),y.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"}),void 0!=d.navFilterData)for(var a=0;a<y.length;a++){y[a].upgradeRoom=[],y[a].isSelected=!1,y[a].myStyle="#116eb5";for(var f=0;f<y[a].averageRates.length;f++)y[a].averageRates[f].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode&&(y[a].finalPrice=y[a].averageRates[f].rate-y[a].averageRates[f].discount);if(y[a].roomUpgradeOptions.length>0)for(var s=0;s<y[a].roomUpgradeOptions.length;s++)for(var C=0;C<R.length;C++)if(R[C].roomTypeCode==y[a].roomUpgradeOptions[s].roomTypeCode){R[C].sortOrder=y[a].roomUpgradeOptions[s].sortOrder;for(var o=0;o<R[C].averageRates.length;o++)R[C].averageRates[o].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode&&(R[C].priceChanged=R[C].averageRates[o].rate-R[C].averageRates[o].discount-y[a].finalPrice,R[C].averageRates[o].merchandisedCurrency&&(R[C].merchandisedCurrency=R[C].averageRates[o].merchandisedCurrency));if(0!=R[C].priceChanged){var S=angular.copy(R[C]);y[a].upgradeRoom.push(S)}}}d.rateAvailPlans=n.RatesAvail.roomStays[0].ratePlans;for(var a=0;a<d.rateAvailPlans.length;a++)d.rateAvailPlans[a].price=d.rateAvailPlans[a].leadRate-d.rateAvailPlans[a].discountRate,Y&&d.rateAvailPlans[a].leadMemberRate&&void 0!=d.rateAvailPlans[a].discountMemberRate&&(d.rateAvailPlans[a].memberPrice=d.rateAvailPlans[a].leadMemberRate-d.rateAvailPlans[a].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(d.rateAvailPlans[a].leadRate=parseFloat(d.rateAvailPlans[a].leadRate).toFixed(2),d.rateAvailPlans[a].discountRate=parseFloat(d.rateAvailPlans[a].discountRate).toFixed(2),d.rateAvailPlans[a].price=parseFloat(d.rateAvailPlans[a].price).toFixed(2),void 0!=d.rateAvailPlans[a].memberPrice?(d.rateAvailPlans[a].leadMemberRate=parseFloat(d.rateAvailPlans[a].leadMemberRate).toFixed(2),d.rateAvailPlans[a].discountMemberRate=parseFloat(d.rateAvailPlans[a].discountMemberRate).toFixed(2),d.rateAvailPlans[a].memberPrice=parseFloat(d.rateAvailPlans[a].memberPrice).toFixed(2),d.rateAvailPlans[a].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[a].leadMemberRate)<=Number(d.rateAvailPlans[a].leadRate)):d.rateAvailPlans[a].isMemberRatePriceIsLowest=!1):(d.rateAvailPlans[a].leadRate=parseFloat(d.rateAvailPlans[a].leadRate).toFixed(0),d.rateAvailPlans[a].discountRate=parseFloat(d.rateAvailPlans[a].discountRate).toFixed(0),d.rateAvailPlans[a].price=parseFloat(d.rateAvailPlans[a].price).toFixed(0),void 0!=d.rateAvailPlans[a].memberPrice?(d.rateAvailPlans[a].leadMemberRate=parseFloat(d.rateAvailPlans[a].leadMemberRate).toFixed(0),d.rateAvailPlans[a].discountMemberRate=parseFloat(d.rateAvailPlans[a].discountMemberRate).toFixed(0),d.rateAvailPlans[a].memberPrice=parseFloat(d.rateAvailPlans[a].memberPrice).toFixed(0),d.rateAvailPlans[a].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[a].leadMemberRate)<=Number(d.rateAvailPlans[a].leadRate)):d.rateAvailPlans[a].isMemberRatePriceIsLowest=!1);d.rateAvailCategories=n.RatesAvail.roomStays[0].roomCategories,d.rateAvailCategories.forEach(function(e){e.selected=!0});for(var a=0;a<d.rateAvailCategories.length;a++)u[a]=!0;d.categorized=[];var A=[{categoryRooms:[]}];d.rateAvailCategoriesPackage=n.RatesAvail.roomStays[0].packageCategories,void 0!=d.rateAvailCategoriesPackage&&d.rateAvailCategoriesPackage.forEach(function(e){e.selected=!0});for(var a=0;a<d.rateAvailCategories.length;a++)p[a]=!0;d.categorizedPackages=[];var I=[{categoryPackages:[]}],b=0,D=0;if(A[0].categoryRooms[D]={},A[0].categoryRooms[D].categoryRoom=[],void 0!=d.navFilterData)for(var o=0;o<y.length;o++)if(!y[o].hasOwnProperty("categoryCode")){y[o].priceTagRate=[],y[o].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var T=0;T<y[o].averageRates.length;T++)if("Regular"==y[o].averageRates[T].ratePlanType&&y[o].averageRates[T].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=y[o].nightlyRates&&y[o].nightlyRates.length>0){y[o].averageRates[T].nightlyRates=[];for(var E=0;E<y[o].nightlyRates.length;E++)y[o].nightlyRates[E].ratePlanCode==y[o].averageRates[T].ratePlanCode&&y[o].averageRates[T].nightlyRates.push(angular.copy(y[o].nightlyRates[E]))}y[o].priceTagRate.push(y[o].averageRates[T])}else if(y[o].averageRates[T].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=y[o].nightlyRates&&y[o].nightlyRates.length>0){y[o].averageRates[T].nightlyRates=[];for(var E=0;E<y[o].nightlyRates.length;E++)"Group"==y[o].averageRates[T].ratePlanType?y[o].nightlyRates[E].ratePlanCode==y[o].averageRates[T].roomRateCode&&y[o].averageRates[T].nightlyRates.push(angular.copy(y[o].nightlyRates[E])):y[o].nightlyRates[E].ratePlanCode==y[o].averageRates[T].ratePlanCode&&y[o].averageRates[T].nightlyRates.push(angular.copy(y[o].nightlyRates[E]))}y[o].priceTagRate.unshift(y[o].averageRates[T])}for(var a=0;a<d.rateAvailPlans.length;a++)for(var s=0;s<y[o].priceTagRate.length;s++)y[o].priceTagRate[s].ratePlanCode==d.rateAvailPlans[a].ratePlanCode&&(y[o].priceTagRate[s].ratePlanName=d.rateAvailPlans[a].ratePlanName,y[o].priceTagRate[s].ratePlanDescription=d.rateAvailPlans[a].ratePlanDescription,y[o].priceTagRate[s].cancellationPolicy=d.rateAvailPlans[a].cancellationPolicy,y[o].priceTagRate[s].guaranteePolicy=d.rateAvailPlans[a].guaranteePolicy,y[o].priceTagRate[s].sortOrder=d.rateAvailPlans[a].sortOrder,void 0!=d.rateAvailPlans[a].packagePolicies&&(y[o].priceTagRate[s].packagePolicies=d.rateAvailPlans[a].packagePolicies));for(var a=0;a<y[o].averageRates.length;a++)d.navFilterData.ratePlanCode.ratePlanCode==y[o].averageRates[a].ratePlanCode&&(y[o].currentRate=y[o].averageRates[a],y[o].currentRate.price=y[o].currentRate.rate-y[o].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(y[o].currentRate.price=y[o].currentRate.price.toFixed(2)),A[0].categoryRooms[D].categoryRoom.push(y[o]),b++);b%X==0&&0!=b&&(D++,A[0].categoryRooms[D]={},A[0].categoryRooms[D].categoryRoom=[])}if(0!=A[0].categoryRooms[0].categoryRoom.length){for(var M=A[0].categoryRooms.length;M>0;M--)0==A[0].categoryRooms[M-1].categoryRoom.length&&A[0].categoryRooms.splice(M-1,1);d.categorized.push(A[0])}if(void 0!=h){d.categorizedPackages=[];var I=[{categoryPackages:[]}],b=0,D=0;I[0].categoryPackages[D]={},I[0].categoryPackages[D].categoryPackage=[];for(var o=0;o<h.length;o++)h[o].hasOwnProperty("categoryCode")||(I[0].categoryPackages[D].categoryPackage.push(h[o]),b++),b%X==0&&0!=b&&(D++,I[0].categoryPackages[D]={},I[0].categoryPackages[D].categoryPackage=[]);if(0!=I[0].categoryPackages[0].categoryPackage.length){for(var M=I[0].categoryPackages.length;M>0;M--)0==I[0].categoryPackages[M-1].categoryPackage.length&&I[0].categoryPackages.splice(M-1,1);d.categorizedPackages.push(I[0])}}if(void 0!=d.navFilterData)for(var C=0;C<n.RatesAvail.roomStays[0].roomCategories.length;C++){b=0,D=0,c={name:n.RatesAvail.roomStays[0].roomCategories[C].categoryName,categoryCode:n.RatesAvail.roomStays[0].roomCategories[C].categoryCode,categoryRooms:[]},c.categoryRooms[0]={},c.categoryRooms[0].categoryRoom=[];for(var o=0;o<y.length;o++){var _=!1;if(y[o].categoryCode==n.RatesAvail.roomStays[0].roomCategories[C].categoryCode){y[o].priceTagRate=[],y[o].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var T=0;T<y[o].averageRates.length;T++)if("Regular"==y[o].averageRates[T].ratePlanType&&y[o].averageRates[T].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=y[o].nightlyRates&&y[o].nightlyRates.length>0){y[o].averageRates[T].nightlyRates=[];for(var E=0;E<y[o].nightlyRates.length;E++)y[o].nightlyRates[E].ratePlanCode==y[o].averageRates[T].ratePlanCode&&y[o].averageRates[T].nightlyRates.push(angular.copy(y[o].nightlyRates[E]))}y[o].priceTagRate.push(y[o].averageRates[T])}else if(y[o].averageRates[T].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=y[o].nightlyRates&&y[o].nightlyRates.length>0){y[o].averageRates[T].nightlyRates=[];for(var E=0;E<y[o].nightlyRates.length;E++)"Group"==y[o].averageRates[T].ratePlanType?y[o].nightlyRates[E].ratePlanCode==y[o].averageRates[T].roomRateCode&&y[o].averageRates[T].nightlyRates.push(angular.copy(y[o].nightlyRates[E])):y[o].nightlyRates[E].ratePlanCode==y[o].averageRates[T].ratePlanCode&&y[o].averageRates[T].nightlyRates.push(angular.copy(y[o].nightlyRates[E]))}y[o].priceTagRate.unshift(y[o].averageRates[T])}for(var a=0;a<y[o].averageRates.length;a++){for(var k=0;k<d.rateAvailPlans.length;k++)d.rateAvailPlans[k].ratePlanCode==y[o].averageRates[a].ratePlanCode&&(y[o].priceTagRate[a].ratePlanName=d.rateAvailPlans[k].ratePlanName,y[o].priceTagRate[a].sortOrder=d.rateAvailPlans[k].sortOrder);d.navFilterData.ratePlanCode.ratePlanCode==y[o].averageRates[a].ratePlanCode&&(y[o].currentRate=y[o].averageRates[a],y[o].currentRate.price=y[o].currentRate.rate-y[o].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(y[o].currentRate.price=y[o].currentRate.price.toFixed(2)),c.categoryRooms[D].categoryRoom.push(y[o]),b++,!0)}for(var a=0;a<d.rateAvailPlans.length;a++)for(var s=0;s<y[o].priceTagRate.length;s++)y[o].priceTagRate[s].ratePlanCode==d.rateAvailPlans[a].ratePlanCode&&(y[o].priceTagRate[s].ratePlanName=d.rateAvailPlans[a].ratePlanName,y[o].priceTagRate[s].ratePlanDescription=d.rateAvailPlans[a].ratePlanDescription,y[o].priceTagRate[s].cancellationPolicy=d.rateAvailPlans[a].cancellationPolicy,y[o].priceTagRate[s].guaranteePolicy=d.rateAvailPlans[a].guaranteePolicy,y[o].priceTagRate[s].sortOrder=d.rateAvailPlans[a].sortOrder,void 0!=d.rateAvailPlans[a].packagePolicies&&(y[o].priceTagRate[s].packagePolicies=d.rateAvailPlans[a].packagePolicies))}b%X==0&&0!=b&&(_=!0,D++,c.categoryRooms[D]={},c.categoryRooms[D].categoryRoom=[])}if(1==_){for(var L=c.categoryRooms.length;L>0;L--)0==c.categoryRooms[L-1].categoryRoom.length&&c.categoryRooms.splice(L-1,1);d.categorized.push(c)}else if(c.categoryRooms[D].categoryRoom.length>0){for(var L=c.categoryRooms.length;L>0;L--)0==c.categoryRooms[L-1].categoryRoom.length&&c.categoryRooms.splice(L-1,1);d.categorized.push(c)}}if(void 0!=h)for(var C=0;C<n.RatesAvail.roomStays[0].packageCategories.length;C++){var b=0,D=0,m={name:n.RatesAvail.roomStays[0].packageCategories[C].categoryName,categoryCode:n.RatesAvail.roomStays[0].packageCategories[C].categoryCode,categoryPackages:[]};m.categoryPackages[0]={},m.categoryPackages[0].categoryPackage=[];for(var o=0;o<h.length;o++){var _=!1;h[o].categoryCode==n.RatesAvail.roomStays[0].packageCategories[C].categoryCode&&(m.categoryPackages[D].categoryPackage.push(h[o]),b++,!0),b%X==0&&0!=b&&(_=!0,D++,m.categoryPackages[D]={},m.categoryPackages[D].categoryPackage=[])}if(1==_){for(var L=m.categoryPackages.length;L>0;L--)0==m.categoryPackages[L-1].categoryPackage.length&&m.categoryPackages.splice(L-1,1);d.categorizedPackages.push(m)}else if(m.categoryPackages[D].categoryPackage.length>0){for(var L=m.categoryPackages.length;L>0;L--)0==m.categoryPackages[L-1].categoryPackage.length&&m.categoryPackages.splice(L-1,1);d.categorizedPackages.push(m)}}if(P(y),void 0!=h&&P(h),be=d.categorized,Ee=d.categorizedPackages,1==n.displayMultiRateListView){var G=v.getCodeTypes();1!=d.packageSelected||void 0==d.navFilterData||void 0==d.navFilterData.ratePlanCode||"Package"!=d.navFilterData.ratePlanCode.ratePlanType&&"Group"!=d.navFilterData.ratePlanCode.ratePlanType?v.getReservation().roomStays[0].ratePlans.length>0&&("Package"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType||"Group"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType)?n.displayMultiRateListView=!1:void 0!=G&&(G.indexOf("Group")>-1||G.indexOf("group")>-1)?n.displayMultiRateListView=!1:(d.toggleAcc.gridView=!1,d.toggleAcc.listView=!0,de()):n.displayMultiRateListView=!1}d.checkBox.selected=!0,d.checkBoxPackage.selected=!0,d.changeALLRoomSelect(),void 0!=h&&d.changeALLPackageSelect(),d.changeCatecory(),void 0!=h&&d.changePackageCategory(),d.Categorized=d.categorized,void 0!=d.navFilterData&&(te=angular.copy(d.navFilterData.ratePlanCode.leadRate),oe=angular.copy(d.navFilterData.ratePlanCode.price),re=angular.copy(d.navFilterData.ratePlanCode.leadMemberRate),ne=angular.copy(d.navFilterData.ratePlanCode.memberPrice),d.navFilterData.ratePlanCode.leadRate=t("currencyConversionAndSymbol")(te,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),d.navFilterData.ratePlanCode.price=t("currencyConversionAndSymbol")(oe,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),Y&&re&&void 0!=ne?(d.isMemberRatePriceIsLowest=Number(re)<=Number(te),d.navFilterData.ratePlanCode.leadMemberRate=t("currencyConversionAndSymbol")(re,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),d.navFilterData.ratePlanCode.memberPrice=t("currencyConversionAndSymbol")(ne,!1,d.navFilterData.ratePlanCode.merchandisedCurrency)):d.isMemberRatePriceIsLowest=!1)})};d.$on(o.LANG_CHANGE,function(e,r){if(n.recallAPIFromHTML5Geolocation?(1==v.getConfig("OPEN_ROOM_DETAIL_FOR_HTML5GEOLOCATION")?v.setConfig("OPEN_ROOM_DETAIL"):1==v.getConfig("OPEN_PACKAGE_DETAIL_FOR_HTML5GEOLOCATION")&&(ze=null,v.setConfig("OPEN_PACKAGE_DETAIL")),1==v.getConfig("OPEN_ROOM_DETAIL")?setTimeout(function(){d.getEnhancementServices(),0!=R.stepsById.accommodations.rooms.length?(d.UpgradeRoom(R.stepsById.accommodations.rooms[0].roomTypeCode,1),n.$broadcast(o.CHANGE_PLACEHOLDER),d.toggleAcc.roomsView=!0,d.toggleAcc.packageView=!1):void 0!=v.getMainReservation().roomStays[0].roomRates[0].roomTypeCode?(d.UpgradeRoom(v.getMainReservation().roomStays[0].roomRates[0].roomTypeCode,1),n.$broadcast(o.CHANGE_PLACEHOLDER),d.toggleAcc.roomsView=!0,d.toggleAcc.packageView=!1):(Be(),v.deleteConfig("OPEN_ROOM_DETAIL"),n.$broadcast(o.CHANGE_PLACEHOLDER)),d.activeRoomDetail=!0},1e3):1==v.getConfig("OPEN_PACKAGE_DETAIL")?setTimeout(function(){void 0!=R.stepsById.accommodations.package&&0!=R.stepsById.accommodations.package.length?(void 0!=R.stepsById.accommodations.package[0].packageCode?d.UpgradeRoom(R.stepsById.accommodations.package[0].packageCode,1):void 0!=R.stepsById.accommodations.package[0].ratePlanCode&&d.UpgradeRoom(R.stepsById.accommodations.package[0].ratePlanCode,1),n.$broadcast(o.CHANGE_PLACEHOLDER),d.toggleAcc.roomsView=!1,d.toggleAcc.packageView=!0):void 0!=v.getMainReservation().roomStays[0].ratePlans&&void 0!=v.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode?(d.UpgradeRoom(v.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode,1),d.toggleAcc.roomsView=!1,d.toggleAcc.packageView=!0):(v.deleteConfig("OPEN_PACKAGE_DETAIL"),n.$broadcast(o.CHANGE_PLACEHOLDER),d.toggleAcc.roomsView=!1,d.toggleAcc.packageView=!0),d.activePackageDetail=!0},1e3):Be()):Be(),R.stepsById.accommodations.rooms.length>0){var i=v.getMainReservation();if(Q)n.gmsPromoCode&&v.addGmsRateAccessCodeInReservation(i),c.modifyHoldReservation(Ce,i,!0).success(function(e){v.handleXssVulnerabilities(e),b.setMyCheckRefershTokenDetails(e),n.gmsPromoCode&&v.removeRateAccessCodeInReservation(e,i),k(i),m.clear(),v.setReservation(e),R.stepsById.accommodations.placeholder=e.roomStays[0].roomRates[0].roomTypeName;var a=e,t=a.roomStays[0].roomRates,o=a.roomStays[0].ratePlans;if(R.stepsById.accommodations.rooms=[],R.stepsById.accommodations.ratePlan=[],l.debug(a),angular.forEach(t,function(e){R.stepsById.accommodations.rooms.push(e),R.stepsById.accommodations.placeholder=e.roomTypeName}),"Package"!=o[0].ratePlanType&&"group"!=o[0].ratePlanType.toLowerCase()?(R.stepsById.accommodations.ratePlan=o,void 0!=a.merchandisedPromoData&&(R.stepsById.accommodations.merchandisedPromotionData=a.merchandisedPromoData)):(R.stepsById.accommodations.package=[],"Package"==o[0].ratePlanType&&(R.stepsById.accommodations.package=o,R.stepsById.accommodations.placeholder=o[0].ratePlanName)),"group"==o[0].ratePlanType.toLowerCase()){R.stepsById.accommodations.group=[];var r={};r.codeType=o[0].ratePlanType;var s,d=v.getMainReservation(),u=d.posSource.requestorIds;angular.forEach(u,function(e){"group"==e.codeType.toLowerCase()&&(s=e.id)}),r.id=s;var p=g.getHotelInfo().hotelCode,y=v.getLanguage();y||(y=g.getCurrentLanguages().languageCode),c.getGSplashDetails(p,o[0].ratePlanType,s,y).then(function(e){v.setGroup(e.data),C.setUserTiming("Interaction","CodeWIdget"),void 0!=v.getGroup().groupName&&(r.name=v.getGroup().groupName),R.stepsById.accommodations.group.push(r),R.stepsById.accommodations.placeholder=r.name})}}).error(function(){m.clear(),m.pop({type:"error",title:"",body:n.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}),l.debug(JSON.stringify(i)),a.clearAll()});else{if(n.MRB){for(var s=v.getMainReservation().id,u=0,p=!1,y=!1,h=0;h<v.getMainReservationArray().length;h++)void 0!=v.getMainReservationArray()[h].roomStays&&v.getMainReservationArray()[h].roomStays.length>0&&void 0!=v.getMainReservationArray()[h].roomStays[0].roomRates&&v.getMainReservationArray()[h].roomStays[0].roomRates.length>0&&void 0!=v.getMainReservationArray()[h].roomStays[0].roomRates[0].roomTypeCode&&void 0!=v.getMainReservationArray()[h].roomStays[0].total||(v.getMainReservationArray()[h].id==s&&(p=!0),u++,y=!0);d.oneRoomLeft=!(1!=u&&0!=u||1!=p&&0!=y),v.setMainReservationArrayById(s,v.getMainReservation());var P=angular.copy(v.getMainReservationArray());l.debug(JSON.stringify(v.getMainReservationArray())+"reservationService.getMainReservationArray() before")}if(l.debug(JSON.stringify(v.getMainReservation())+"reservationService.getMainReservation before"),n.MRB){var D=S.filter(n.RatesAvail.roomStays[0].ratePlans,{ratePlanCode:i.roomStays[0].ratePlans[0].ratePlanCode});if(void 0!=D){var T={roomId:i.id,rateInfo:D};v.setRatePlanInfoObject(T)}}n.gmsPromoCode&&Oe(i,P),c.callHoldReservation(Ce,i,P,d.oneRoomLeft,n.MRB).success(function(e){if(v.setConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE"),b.setMyCheckRefershTokenDetails(e),n.gmsPromoCode&&(n.MRB?v.removeRateAccessCodeInReservation(e.reservationResponses,P):v.removeRateAccessCodeInReservation(e,i)),!d.oneRoomLeft&&n.gmsPromoCode&&n.MRB&&(i.posSource.requestorIds=[]),A.getBurnPoints()&&f.eventTrack("RemoveAppliedPoints",{category:"UserNavigation",label:"RemoveAppliedPoints"}),I.resetVoucherDetails(),A.setBurnPoints(void 0),k(i),n.MRB&&void 0!=e.reservationResponses&&1==e.reservationResponses.length){var a;1==n.MRB&&1!=d.oneRoomLeft&&(a={},a=angular.copy(e.reservationResponses[0]),a.hotelCode=angular.copy(e.hotelCode),a.languageCode=angular.copy(e.languageCode),a.currencyCode=angular.copy(e.currencyCode),e=a)}var r;if(1==n.MRB){if(1!=d.oneRoomLeft&&0!=y||1!=n.MRB)v.setReservation(e),r=e;else{v.setMrbItineraryTotals(e.itineraryTotals),v.setMrbItineraryPaymentInfo(e.itineraryPaymentInfo);if(1!=v.setMainReservationByEqual(e.reservationResponses)){if(n.$broadcast(o.MODIFY_RESERVATION),d.failedRoomsId=v.getFailedRoomsId(),d.failedRoomsId.length>1)d.combinedHoldFailure=!0;else{var u=t("replaceHashMRB")(n.translate.page_roomisnolongeravl_MRTBRoomSelectorMsg,d.getRoomIndex(d.failedRoomsId[0]),n.reservationArray.length);m.pop({type:"error",title:"",body:u,timeout:3e3})}return void d.recallAPI(!0)}for(var p=0;p<v.getMainReservationArray().length;p++)if(v.getMainReservationArray()[p].id==s){v.setReservation(v.getMainReservationArray()[p]),r=v.getMainReservationArray()[p];break}}R.stepsById.accommodations.placeholderMRB=v.getBookedRoomCount()}else v.setReservation(e),r=e;m.clear(),R.stepsById.accommodations.placeholder=r.roomStays[0].roomRates[0].roomTypeName;var h=r.roomStays[0].roomRates,S=r.roomStays[0].ratePlans;if(R.stepsById.accommodations.rooms=[],R.stepsById.accommodations.ratePlan=[],l.debug(r),angular.forEach(h,function(e){R.stepsById.accommodations.rooms.push(e),R.stepsById.accommodations.placeholder=e.roomTypeName}),"Package"!=S[0].ratePlanType&&"group"!=S[0].ratePlanType.toLowerCase()?(R.stepsById.accommodations.ratePlan=S,void 0!=r.merchandisedPromoData&&(R.stepsById.accommodations.merchandisedPromotionData=r.merchandisedPromoData)):(R.stepsById.accommodations.package=[],"Package"==S[0].ratePlanType&&(R.stepsById.accommodations.package=S,R.stepsById.accommodations.placeholder=S[0].ratePlanName)),"group"==S[0].ratePlanType.toLowerCase()){R.stepsById.accommodations.group=[];var D={};D.codeType=S[0].ratePlanType;var T,O=v.getMainReservation(),E=O.posSource.requestorIds;angular.forEach(E,function(e){"group"==e.codeType.toLowerCase()&&(T=e.id)}),D.id=T;var M=g.getHotelInfo().hotelCode,_=v.getLanguage();_||(_=g.getCurrentLanguages().languageCode),c.getGSplashDetails(M,S[0].ratePlanType,T,_).then(function(e){v.setGroup(e.data),C.setUserTiming("Interaction","CodeWIdget"),void 0!=v.getGroup().groupName&&(D.name=v.getGroup().groupName),R.stepsById.accommodations.group.push(D),R.stepsById.accommodations.placeholder=D.name})}}).error(function(){m.clear(),m.pop({type:"error",title:"",body:n.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}),l.debug(JSON.stringify(i)),a.clearAll()})}}}),d.$on("EVENT.CURRENCY_CHANGE",function(){0==R.stepsById.accommodations.rooms.length&&"accommodation.room"===u.current.name&&n.$broadcast("EVENT.RECALL_HOLD_API_ON_CHANGE_CURRENCY")});var xe=null,we=null;d.toggleSelect=function(e){var a=e;a.id!==xe?(T(a),we&&(we.myStyle="#116eb5",T(we)),xe=a.id,we=a):(T(a),xe=null,we=null)};var Ue,He=function(e){var a=n.RatesAvail.roomStays[0].allRoomTypes;if(e.currentRate.upgradeRoomMultirate=[],e.finalPrice=e.currentRate.rate-e.currentRate.discount,void 0!=e.currentRate.roomUpgradeList&&e.currentRate.roomUpgradeList.length>0)for(var t=0;t<e.currentRate.roomUpgradeList.length;t++)for(var o=0;o<a.length;o++)if(a[o].roomTypeCode==e.currentRate.roomUpgradeList[t].roomTypeCode){a[o].sortOrder=e.currentRate.roomUpgradeList[t].sortOrder;for(var r=0;r<a[o].averageRates.length;r++)a[o].averageRates[r].ratePlanCode==e.currentRate.ratePlanCode&&(a[o].priceChanged=a[o].averageRates[r].rate-a[o].averageRates[r].discount-e.finalPrice,a[o].currentRate=a[o].averageRates[r],a[o].averageRates[r].merchandisedCurrency&&(a[o].merchandisedCurrency=a[o].averageRates[r].merchandisedCurrency));if(a[o].priceChanged>0){var i=angular.copy(a[o]);e.currentRate.upgradeRoomMultirate.push(i)}}},Ve=null,$e=null,qe=null;d.activeRoomDetail=!1;d.toggleRoomDetail=function(e,a){if(1==n.displayMultiRateListView&&a&&He(a),n.toggle.intlMenu=!1,n.$broadcast("CancelAddCode"),n.$broadcast("CancelAccommodation"),1!=d.flagForVideo&&a){for(var t=0;t<a.media.length;t++)0==a.media[t].sortOrder?a.media[t].active=!0:a.media[t].active=!1;!0===g.getHotelDesc().uxConfiguration.accomodationsConfig.enableCarouselAutoScroll?d.myInterval=2500:d.myInterval=0}d.flagForVideo=!1,"rooms-icon-color-block"==d.roomsIcon?d.roomsIcon="rooms-icon-color":d.roomsIcon="rooms-icon-color-block",null!=e&&(n.startTime=Date.now()),d.toggleSelect(a);var o=a.id;if(qe=angular.copy(Ve),Ve==e?$e!=o?n.recallAPIFromHTML5Geolocation=!1:(n.recallAPIFromHTML5Geolocation=!1,l.debug("enter"),E(null)):E(e),d.currentRoom=a,d.showMemberRateSignInButton=!!d.isMemberRateSignIn(d.currentRoom),void 0!=d.currentRoom.priceTagRate){d.currentRoom.priceTagRate.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var i=0;i<d.currentRoom.priceTagRate.length;i++)if(d.currentRoom.priceTagRate[i].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){d.currentRoom.priceTagRate.unshift(d.currentRoom.priceTagRate[i]),d.currentRoom.priceTagRate.splice(i+1,1);break}for(var i=0;i<d.currentRoom.priceTagRate.length;i++){if((d.currentRoom.priceTagRate[i].ratePlanCode.indexOf("M_")>-1?d.currentRoom.priceTagRate[i].ratePlanCode.replace("M_",""):d.currentRoom.priceTagRate[i].ratePlanCode)==d.navFilterData.ratePlanCode.ratePlanCode&&d.currentRoom.priceTagRate[i].isMemberRatePlan){d.currentRoom.priceTagRate.unshift(d.currentRoom.priceTagRate[i]),d.currentRoom.priceTagRate.splice(i+1,1);break}}}if(void 0!=d.currentRoom.priceTagRate)for(var t=d.currentRoom.priceTagRate.length-1;t>=0;t--)void 0==d.currentRoom.priceTagRate[t].ratePlanName&&d.currentRoom.priceTagRate.splice(t,1);Ve=d.myGridNumber,$e=o,o>=0&&null!==e&&"ACCOMMODATIONS"!=r.route&&0==d.isUpgradedroom&&f.eventTrack("ClickRoom",{category:"UserNavigation",label:a.roomTypeCode});for(var s=document.getElementsByClassName("js-sticky"),t=s.length-1;t>=0;t--)Stickyfill.add(s[t],90);null!=e&&a.available?(d.showCallToActionBtnGrid=!0,d.showCallToActionBtnList=!0):(d.showCallToActionBtnGrid=!1,d.showCallToActionBtnList=!1),
void 0!=v.getMainReservation().roomCategoryId&&null!=v.getMainReservation().roomCategoryId&&" "!=v.getMainReservation().roomCategoryId&&v.getMainReservation().roomCategoryId==d.currentRoom.categoryCode&&Ne(),d.isRoomCategoryFlag&&d.changeCatecory(),null==e?setTimeout(function(){var e=document.getElementById(a.id+"roomCard");e&&e.focus()},1e3):setTimeout(function(){var e=document.getElementById("room-detail-header"+a.roomTypeCode);e&&e.focus()},1e3)},d.closeRoomDetail=function(e){d.toggleRoomDetail(null,e)},d.preScrollTop=null,d.scrollToButton=function(e,a,t){d.preRoom=null,d.prePackage=null;var o=t.target.getBoundingClientRect().top+window.pageYOffset;p.scrollTop(o-700,1e3)},d.scrollToNew=function(e,a,t,o,n){if(null!=d.preRoom&&d.preRoom.id===e.id&&t){var i=t.target.getBoundingClientRect().top+window.pageYOffset;p.scrollTop(i-700,1e3),d.preRoom=null}else y(function(){var t=document.getElementsByTagName("nav-bar")[0].offsetHeight;if(document.getElementsByClassName("tc-loyalty-navbar")[0]&&(t+=document.getElementsByClassName("tc-loyalty-navbar")[0].offsetHeight),document.getElementsByClassName("CardGrid")[0])var i=document.getElementsByClassName("CardGrid")[0].offsetHeight+12;if(document.getElementsByClassName("CardList")[0])var s=document.getElementsByClassName("CardList")[0].offsetHeight-10;document.getElementsByClassName("MaxWidth-logo-wrap")[0]&&(t+=document.getElementsByClassName("MaxWidth-logo-wrap")[0].offsetHeight),r.innerWidth<992&&"view_rates"==d.clickbuttonType?he(e.id,o,n):(Ue=document.getElementById(a.toString()),"showGridRow"==o?Je=Ue.getBoundingClientRect().top+window.pageYOffset+i:"showListRow"==o&&(Je=Ue.getBoundingClientRect().top+window.pageYOffset+s),p.scrollTop(Je-t-40,500)),d.setBtnPositionOnScroll(n,qe),d.preRoom=e},200)},d.toEnhancementSectionScroll=function(e,a){setTimeout(function(){var t="enhancementHeader_"+a+"_"+e.roomTypeCode,o=document.getElementById(t);if(o){var r=o.getBoundingClientRect().top+window.pageYOffset,i=document.getElementsByTagName("nav-bar")[0].offsetHeight;document.getElementsByClassName("tc-loyalty-navbar")[0]&&(i+=document.getElementsByClassName("tc-loyalty-navbar")[0].offsetHeight),document.getElementsByClassName("MaxWidth-logo-wrap")[0]&&(i+=document.getElementsByClassName("MaxWidth-logo-wrap")[0].offsetHeight),p.scrollTop(r-(i+70),500),d.enableUpfrontEnhancementsIsActive=!1}m.clear(),m.pop({type:"info",title:"",body:n.translate.page_dontmissoutontheseoffers_UrgencyMsg,timeout:3e3})},500)};var Ye=null,je=null;d.toggleSelectPackage=function(e){var a=e;a.id!==Ye?(M(a),je&&(je.myStyle="#116eb5",M(je)),Ye=a.id,je=a):(M(a),Ye=null,je=null)};var ze=null,We=null,Ke=null,Je=0,Qe=60;d.activePackageDetail=!1;d.togglePackageDetail=function(e,a){n.toggle.intlMenu=!1,n.$broadcast("CancelAddCode"),n.$broadcast("CancelAccommodation"),d.toggleSelectPackage(a);var t=a.id;if(l.debug(t+"selectedDetailId"),l.debug(We+"currentPackageDetailId"),Ke=angular.copy(ze),ze==e?We!=t?n.recallAPIFromHTML5Geolocation=!1:(n.recallAPIFromHTML5Geolocation=!1,l.debug("enter"),L(null)):L(e),null!=ze){var o=document.getElementById("rowDetail"+ze);null!=o&&void 0!=o&&(Je=o.getBoundingClientRect().top+window.pageYOffset,Qe=o.scrollHeight)}d.currentPackage=a,ze=d.myPackageGridNumber,We=t;var r=a.packageCode;f.eventTrack("ClickViewPackageDetails",{category:"UserNavigation",label:r}),null==e?setTimeout(function(){if(d.currentPackage){var e=document.getElementById("packageCardGrid"+d.currentPackage.packageCode);e&&e.focus()}},1e3):setTimeout(function(){var e=document.getElementById("package-detail-header");e&&e.focus()},1e3)},d.focusOnPackageList=function(e){setTimeout(function(){var a=document.getElementById("packageCardGrid"+e.packageCode);a&&a.focus()})},d.closePackageDetail=function(e){d.prePackage=null,d.togglePackageDetail(null,e)},d.preScrollTop=null,g.getHotelDesc().position,g.getHotelDesc().hotelName,d.setBtnPositionOnScroll=function(e,a){if(r.innerWidth<768){p[0].getElementById("selectRoomBtn"+e).style.position="inherit";var t=p[0].getElementById("selectRoomBtn"+e);d.btnPosition=t.getBoundingClientRect().top,d.btnPosition=d.btnPosition-r.innerHeight+r.pageYOffset,d.currTop=p[0].getElementById("rowDetail"+e).getBoundingClientRect().top,d.currTop=d.currTop-r.innerHeight+r.pageYOffset;var o=p[0].getElementById("room-detail-close-"+e);if(d.closeBtnPosition=o.getBoundingClientRect().top,!0===n.fullWidthLogoEnabled?d.closeBtnPosition=d.closeBtnPosition+r.pageYOffset-230:d.closeBtnPosition=d.closeBtnPosition+r.pageYOffset-155,d.currRowDetailId=e,a){var i=p[0].getElementById("rowDetail"+a).getBoundingClientRect().top,s=p[0].getElementById("rowDetail"+a).clientHeight;d.currTop>i&&(d.btnPosition=d.btnPosition-s,d.currTop=d.currTop-s,d.closeBtnPosition=d.closeBtnPosition-s)}p[0].getElementById("selectRoomBtn"+e).style.position="fixed"}},d.PackagescrollToNew=function(e,a,t,o,r){if(null!=d.prePackage&&d.prePackage.id===t.id&&a){var n=a.target.getBoundingClientRect().top+window.pageYOffset;p.scrollTop(n-700,1e3),d.prePackage=null}else y(function(){var a=document.getElementsByTagName("nav-bar")[0].offsetHeight;if(document.getElementsByClassName("tc-loyalty-navbar")[0]&&(a+=document.getElementsByClassName("tc-loyalty-navbar")[0].offsetHeight),document.getElementsByClassName("CardGrid")[0])var n=document.getElementsByClassName("CardGrid")[0].offsetHeight+12;if(document.getElementsByClassName("CardList")[0])var i=document.getElementsByClassName("CardList")[0].offsetHeight-10;document.getElementsByClassName("MaxWidth-logo-wrap")[0]&&(a+=document.getElementsByClassName("MaxWidth-logo-wrap")[0].offsetHeight),Ue=document.getElementById(e.toString()),"showGridRow"==o?Je=Ue.getBoundingClientRect().top+window.pageYOffset+n:"showListRow"==o&&(Je=Ue.getBoundingClientRect().top+window.pageYOffset+i),p.scrollTop(Je-a,500),d.setBtnPositionOnScroll(r,Ke),d.prePackage=t},200);void 0!=t.tag&&f.eventTrack("ClickPackageWithTag",{category:"UserNavigation",label:t.packageCode})};var Xe;B(),d.recallAPI=function(e){if(F(),l.debug(JSON.stringify(Ie)+"recall API"),d.categorized)for(var a=0;a<d.categorized.length;a++)for(var i=0;i<d.categorized[a].categoryRooms.length;i++)for(var s=0;s<d.categorized[a].categoryRooms[i].categoryRoom.length;s++)1==d.categorized[a].categoryRooms[i].categoryRoom[s].isSelected&&d.closeRoomDetail(d.categorized[a].categoryRooms[i].categoryRoom[s]);if(d.categorizedPackages)for(var a=0;a<d.categorizedPackages.length;a++)for(var i=0;i<d.categorizedPackages[a].categoryPackages.length;i++)for(var s=0;s<d.categorizedPackages[a].categoryPackages[i].categoryPackage.length;s++)1==d.categorizedPackages[a].categoryPackages[i].categoryPackage[s].isSelected&&(d.closePackageDetail(d.categorizedPackages[a].categoryPackages[i].categoryPackage[s]),d.categorizedPackages[a].categoryPackages[i].categoryPackage[s].myStyle="#116eb5");if(d.categorized)for(var a=0;a<d.categorized.length;a++)for(var i=0;i<d.categorized[a].categoryRooms.length;i++)for(var s=0;s<d.categorized[a].categoryRooms[i].categoryRoom.length;s++)d.categorized[a].categoryRooms[i].categoryRoom[s].isSelected=!1;if(d.categorizedPackages)for(var a=0;a<d.categorizedPackages.length;a++)for(var i=0;i<d.categorizedPackages[a].categoryPackages.length;i++)for(var s=0;s<d.categorizedPackages[a].categoryPackages[i].categoryPackage.length;s++)d.categorizedPackages[a].categoryPackages[i].categoryPackage[s].isSelected=!1;Ie=v.passPromotionIdInApi(Ie),c.getAccommodationRooms(Ie,e).getAllRooms().then(function(e){v.getConfig("SINGLE_ROOM_TIMER_OUT")&&(m.clear(),y(function(){m.pop({type:"error",title:"",body:n.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg,timeout:3e3})}),v.deleteConfig("SINGLE_ROOM_TIMER_OUT")),v.validateAvailForPromotions(e.data),n.RatesAvail=$?O.createDuplicateRateList(e.data):e.data,De=angular.copy(n.RatesAvail),0!=n.RatesAvail.roomStays[0].roomCategories.length&&n.RatesAvail.roomStays[0].roomCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageCategories&&0!=n.RatesAvail.roomStays[0].packageCategories.length&&n.RatesAvail.roomStays[0].packageCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),0!=n.RatesAvail.roomStays[0].ratePlans.length&&n.RatesAvail.roomStays[0].ratePlans.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),0!=n.RatesAvail.roomStays[0].roomTypes.length&&n.RatesAvail.roomStays[0].roomTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageTypes&&0!=n.RatesAvail.roomStays[0].packageTypes.length&&n.RatesAvail.roomStays[0].packageTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var a=0;a<n.RatesAvail.roomStays[0].roomCategories.length;a++){for(var i=!1,s=0;s<n.RatesAvail.roomStays[0].roomTypes.length;s++)n.RatesAvail.roomStays[0].roomTypes[s].categoryCode==n.RatesAvail.roomStays[0].roomCategories[a].categoryCode&&(i=!0);0==i&&(n.RatesAvail.roomStays[0].roomCategories.splice(a,1),a--)}if(void 0!=n.RatesAvail.roomStays[0].packageCategories)for(var a=0;a<n.RatesAvail.roomStays[0].packageCategories.length;a++){for(var i=!1,s=0;s<n.RatesAvail.roomStays[0].packageTypes.length;s++)n.RatesAvail.roomStays[0].packageTypes[s].categoryCode==n.RatesAvail.roomStays[0].packageCategories[a].categoryCode&&(i=!0);0==i&&(n.RatesAvail.roomStays[0].packageCategories.splice(a,1),a--)}if(0==n.RatesAvail.roomStays[0].roomCategories.length&&(d.categorizeHide=!0),void 0!=n.RatesAvail.roomStays[0].packageCategories&&0==n.RatesAvail.roomStays[0].packageCategories.length&&(d.categorizePackageHide=!0),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator){for(var a=0;a<n.RatesAvail.roomStays[0].roomTypes.length;a++)for(var s=0;s<n.RatesAvail.roomStays[0].roomTypes[a].averageRates.length;s++)n.RatesAvail.roomStays[0].roomTypes[a].averageRates[s].rate=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[s].rate).toFixed(2),n.RatesAvail.roomStays[0].roomTypes[a].averageRates[s].discount=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[s].discount).toFixed(2);if(void 0!=n.RatesAvail.roomStays[0].packageTypes)for(var a=0;a<n.RatesAvail.roomStays[0].packageTypes.length;a++)n.RatesAvail.roomStays[0].packageTypes[a].leadRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].leadRate).toFixed(2),n.RatesAvail.roomStays[0].packageTypes[a].discountRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].discountRate).toFixed(2);n.RatesAvail.roomStays[0].ratePlans.forEach(function(e){e.leadRate=parseFloat(e.leadRate).toFixed(2)})}else{for(var a=0;a<n.RatesAvail.roomStays[0].roomTypes.length;a++)for(var s=0;s<n.RatesAvail.roomStays[0].roomTypes[a].averageRates.length;s++)n.RatesAvail.roomStays[0].roomTypes[a].averageRates[s].rate=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[s].rate).toFixed(0),n.RatesAvail.roomStays[0].roomTypes[a].averageRates[s].discount=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[s].discount).toFixed(0);if(void 0!=n.RatesAvail.roomStays[0].packageTypes)for(var a=0;a<n.RatesAvail.roomStays[0].packageTypes.length;a++)n.RatesAvail.roomStays[0].packageTypes[a].leadRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].leadRate).toFixed(0),n.RatesAvail.roomStays[0].packageTypes[a].discountRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].discountRate).toFixed(0);n.RatesAvail.roomStays[0].ratePlans.forEach(function(e){e.leadRate=parseFloat(e.leadRate).toFixed(0)})}d.iconShow=g.getHotelDesc().uxConfiguration.accomodationsConfig.displayIconsIndicator,d.rateShow=g.getHotelDesc().uxConfiguration.strikeThroughPricingEnabled;for(var a=0;a<n.RatesAvail.roomStays[0].ratePlans.length;a++)1==n.RatesAvail.roomStays[0].ratePlans[a].default&&(d.navFilterData.ratePlanCode=angular.copy(n.RatesAvail.roomStays[0].ratePlans[a]),d.navFilterData.ratePlanCode.price=n.RatesAvail.roomStays[0].ratePlans[a].leadRate-n.RatesAvail.roomStays[0].ratePlans[a].discountRate,n.RatesAvail.roomStays[0].ratePlans[a].leadMemberRate&&n.RatesAvail.roomStays[0].ratePlans[a].discountMemberRate&&(d.navFilterData.ratePlanCode.memberPrice=n.RatesAvail.roomStays[0].ratePlans[a].leadMemberRate-n.RatesAvail.roomStays[0].ratePlans[a].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(d.navFilterData.ratePlanCode.price=d.navFilterData.ratePlanCode.price.toFixed(2),d.navFilterData.ratePlanCode.memberPrice&&(d.navFilterData.ratePlanCode.memberPrice=d.navFilterData.ratePlanCode.memberPrice.toFixed(2))));C.isMultiRateListView(r.innerWidth),1==v.getConfig("RES_SELECTION_CHANGE")?v.deleteConfig("RES_SELECTION_CHANGE"):void 0!=n.RatesAvail.roomStays[0].ratePlans&&(0==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultRatePlanType&&n.RatesAvail.roomStays[0].ratePlans.length>0?1!=n.editPackageInclusions&&(n.MRB&&1==W&&1==pe&&void 0!=n.RatesAvail.roomStays[0].packageTypes&&n.RatesAvail.roomStays[0].packageTypes.length>0&&void 0==R.stepsById.accommodations.package?(d.goPackages(),C.setUserTiming("PageLoad","AcconPkg")):(d.goRooms(),C.setUserTiming("PageLoad","AccomRoom"))):1!=g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultRatePlanType&&n.RatesAvail.roomStays[0].ratePlans.length>0||1!=n.editPackageInclusions&&(1==pe&&void 0!=n.RatesAvail.roomStays[0].packageTypes&&n.RatesAvail.roomStays[0].packageTypes.length>0&&void 0==R.stepsById.accommodations.package?void 0!=R.stepsById.accommodations.ratePlan&&R.stepsById.accommodations.ratePlan.length>0||void 0!=R.stepsById.accommodations.rooms&&R.stepsById.accommodations.rooms.length>0?(d.goRooms(),C.setUserTiming("PageLoad","AccomRoom")):(d.goPackages(),C.setUserTiming("PageLoad","AcconPkg")):d.goRooms())),"list"==d.state?r.innerWidth<768?d.goGrid():d.goList():d.goGrid();for(var a=0;a<n.RatesAvail.roomStays[0].ratePlans.length;a++)1==n.RatesAvail.roomStays[0].ratePlans[a].default&&(d.navFilterData.ratePlanCode=n.RatesAvail.roomStays[0].ratePlans[a],d.navFilterData.ratePlanCode.price=n.RatesAvail.roomStays[0].ratePlans[a].leadRate-n.RatesAvail.roomStays[0].ratePlans[a].discountRate,n.RatesAvail.roomStays[0].ratePlans[a].leadMemberRate&&n.RatesAvail.roomStays[0].ratePlans[a].discountMemberRate&&(d.navFilterData.ratePlanCode.memberPrice=n.RatesAvail.roomStays[0].ratePlans[a].leadMemberRate-n.RatesAvail.roomStays[0].ratePlans[a].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(d.navFilterData.ratePlanCode.price=d.navFilterData.ratePlanCode.price.toFixed(2),d.navFilterData.ratePlanCode.memberPrice&&(d.navFilterData.ratePlanCode.memberPrice=d.navFilterData.ratePlanCode.memberPrice.toFixed(2))));var l={},c={},u=[],p=[];d.currentRoom="",d.currentPackage="",d.categorized=[],d.categorizedPackages=[],d.RoomDetailSwitch=!1;var f=n.RatesAvail.roomStays[0].roomTypes,I=n.RatesAvail.roomStays[0].packageTypes,b=angular.copy(f);if(angular.copy(I),void 0!=I&&I.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"}),f.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"}),void 0!=d.navFilterData)for(var a=0;a<f.length;a++){f[a].upgradeRoom=[],f[a].isSelected=!1,f[a].myStyle="#116eb5";for(var T=0;T<f[a].averageRates.length;T++)f[a].averageRates[T].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode&&(f[a].finalPrice=f[a].averageRates[T].rate-f[a].averageRates[T].discount);if(f[a].roomUpgradeOptions.length>0)for(var s=0;s<f[a].roomUpgradeOptions.length;s++)for(var E=0;E<b.length;E++)if(b[E].roomTypeCode==f[a].roomUpgradeOptions[s].roomTypeCode){b[E].sortOrder=f[a].roomUpgradeOptions[s].sortOrder;for(var M=0;M<b[E].averageRates.length;M++)b[E].averageRates[M].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode&&(b[E].priceChanged=b[E].averageRates[M].rate-b[E].averageRates[M].discount-f[a].finalPrice,b[E].averageRates[M].merchandisedCurrency&&(b[E].merchandisedCurrency=b[E].averageRates[M].merchandisedCurrency));if(0!=b[E].priceChanged){var _=angular.copy(b[E]);f[a].upgradeRoom.push(_)}}}d.rateAvailPlans=n.RatesAvail.roomStays[0].ratePlans;for(var a=0;a<d.rateAvailPlans.length;a++)d.rateAvailPlans[a].price=d.rateAvailPlans[a].leadRate-d.rateAvailPlans[a].discountRate,Y&&d.rateAvailPlans[a].leadMemberRate&&void 0!=d.rateAvailPlans[a].discountMemberRate&&(d.rateAvailPlans[a].memberPrice=d.rateAvailPlans[a].leadMemberRate-d.rateAvailPlans[a].discountMemberRate),g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(d.rateAvailPlans[a].leadRate=parseFloat(d.rateAvailPlans[a].leadRate).toFixed(2),d.rateAvailPlans[a].discountRate=parseFloat(d.rateAvailPlans[a].discountRate).toFixed(2),d.rateAvailPlans[a].price=parseFloat(d.rateAvailPlans[a].price).toFixed(2),void 0!=d.rateAvailPlans[a].memberPrice?(d.rateAvailPlans[a].leadMemberRate=parseFloat(d.rateAvailPlans[a].leadMemberRate).toFixed(2),d.rateAvailPlans[a].discountMemberRate=parseFloat(d.rateAvailPlans[a].discountMemberRate).toFixed(2),d.rateAvailPlans[a].memberPrice=parseFloat(d.rateAvailPlans[a].memberPrice).toFixed(2),d.rateAvailPlans[a].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[a].leadMemberRate)<=Number(d.rateAvailPlans[a].leadRate)):d.rateAvailPlans[a].isMemberRatePriceIsLowest=!1):(d.rateAvailPlans[a].leadRate=parseFloat(d.rateAvailPlans[a].leadRate).toFixed(0),d.rateAvailPlans[a].discountRate=parseFloat(d.rateAvailPlans[a].discountRate).toFixed(0),d.rateAvailPlans[a].price=parseFloat(d.rateAvailPlans[a].price).toFixed(0),void 0!=d.rateAvailPlans[a].memberPrice?(d.rateAvailPlans[a].leadMemberRate=parseFloat(d.rateAvailPlans[a].leadMemberRate).toFixed(0),d.rateAvailPlans[a].discountMemberRate=parseFloat(d.rateAvailPlans[a].discountMemberRate).toFixed(0),d.rateAvailPlans[a].memberPrice=parseFloat(d.rateAvailPlans[a].memberPrice).toFixed(0),d.rateAvailPlans[a].isMemberRatePriceIsLowest=Number(d.rateAvailPlans[a].leadMemberRate)<=Number(d.rateAvailPlans[a].leadRate)):d.rateAvailPlans[a].isMemberRatePriceIsLowest=!1);d.rateAvailCategories=n.RatesAvail.roomStays[0].roomCategories,d.rateAvailCategoriesPackage=n.RatesAvail.roomStays[0].packageCategories,d.rateAvailCategories.forEach(function(e){e.selected=!0}),void 0!=d.rateAvailCategoriesPackage&&d.rateAvailCategoriesPackage.forEach(function(e){e.selected=!0});for(var a=0;a<d.rateAvailCategories.length;a++)u[a]=!0;for(var a=0;a<d.rateAvailCategories.length;a++)p[a]=!0;if(void 0!=d.navFilterData){d.categorized=[];var k=[{categoryRooms:[]}],N=0,L=0;k[0].categoryRooms[L]={},k[0].categoryRooms[L].categoryRoom=[];for(var M=0;M<f.length;M++)if(!f[M].hasOwnProperty("categoryCode")){f[M].priceTagRate=[],f[M].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var G=0;G<f[M].averageRates.length;G++)if("Regular"==f[M].averageRates[G].ratePlanType&&f[M].averageRates[G].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=f[M].nightlyRates&&f[M].nightlyRates.length>0){f[M].averageRates[G].nightlyRates=[];for(var F=0;F<f[M].nightlyRates.length;F++)f[M].nightlyRates[F].ratePlanCode==f[M].averageRates[G].ratePlanCode&&f[M].averageRates[G].nightlyRates.push(angular.copy(f[M].nightlyRates[F]))}f[M].priceTagRate.push(f[M].averageRates[G])}else if(f[M].averageRates[G].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=f[M].nightlyRates&&f[M].nightlyRates.length>0){f[M].averageRates[G].nightlyRates=[];for(var F=0;F<f[M].nightlyRates.length;F++)"Group"==f[M].averageRates[G].ratePlanType?f[M].nightlyRates[F].ratePlanCode==f[M].averageRates[G].roomRateCode&&f[M].averageRates[G].nightlyRates.push(angular.copy(f[M].nightlyRates[F])):f[M].nightlyRates[F].ratePlanCode==f[M].averageRates[G].ratePlanCode&&f[M].averageRates[G].nightlyRates.push(angular.copy(f[M].nightlyRates[F]))}f[M].priceTagRate.unshift(f[M].averageRates[G])}for(var a=0;a<d.rateAvailPlans.length;a++)for(var s=0;s<f[M].priceTagRate.length;s++)f[M].priceTagRate[s].ratePlanCode==d.rateAvailPlans[a].ratePlanCode&&(f[M].priceTagRate[s].ratePlanName=d.rateAvailPlans[a].ratePlanName,f[M].priceTagRate[s].ratePlanDescription=d.rateAvailPlans[a].ratePlanDescription,f[M].priceTagRate[s].cancellationPolicy=d.rateAvailPlans[a].cancellationPolicy,f[M].priceTagRate[s].guaranteePolicy=d.rateAvailPlans[a].guaranteePolicy,f[M].priceTagRate[s].sortOrder=d.rateAvailPlans[a].sortOrder,void 0!=d.rateAvailPlans[a].packagePolicies&&(f[M].priceTagRate[s].packagePolicies=d.rateAvailPlans[a].packagePolicies));for(var a=0;a<f[M].averageRates.length;a++)d.navFilterData.ratePlanCode.ratePlanCode==f[M].averageRates[a].ratePlanCode&&(f[M].currentRate=f[M].averageRates[a],f[M].currentRate.price=f[M].currentRate.rate-f[M].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(f[M].currentRate.price=f[M].currentRate.price.toFixed(2)),k[0].categoryRooms[L].categoryRoom.push(f[M]),N++);if(N%X==0&&0!=N&&(L++,k[0].categoryRooms[L]={},k[0].categoryRooms[L].categoryRoom=[]),Y&&d.popUpOpenFromSignBookBtn&&!n.displayMultiRateListView&&(h.checkGmsLogin()||A.getIsLoyaltyUserLogIn())&&f[M].roomTypeCode===d.selectedRoomBeforeSignIn.roomTypeCode)for(var B=0;B<f[M].priceTagRate.length;B++)if(d.selectedRoomBeforeSignIn.ratePlanCode===f[M].priceTagRate[B].ratePlanCode){f[M].currentRate=f[M].priceTagRate[B],f[M].currentCode=f[M].priceTagRate[B].ratePlanCode,d.selectedRoomBeforeSignIn=f[M];break}}if(0!=k[0].categoryRooms[0].categoryRoom.length){for(var x=k[0].categoryRooms.length;x>0;x--)0==k[0].categoryRooms[x-1].categoryRoom.length&&k[0].categoryRooms.splice(x-1,1);d.categorized.push(k[0])}if(Y&&d.popUpOpenFromSignBookBtn&&!n.displayMultiRateListView&&(h.checkGmsLogin()||A.getIsLoyaltyUserLogIn())){var w,U=0,H=0;if(void 0==d.selectedRoomBeforeSignIn.categoryCode)for(var V=0;V<k[0].categoryRooms.length;V++)for(var q=0;q<k[0].categoryRooms[V].categoryRoom.length;q++)H++,k[0].categoryRooms[V].categoryRoom[q].roomTypeCode==d.selectedRoomBeforeSignIn.roomTypeCode&&(U=H);w=U%X==0?~~(U/X)-1:~~(U/X),d.selectedGridRow=w}}if(void 0!=I){d.categorizedPackages=[];var j=[{categoryPackages:[]}],N=0,L=0;j[0].categoryPackages[L]={},j[0].categoryPackages[L].categoryPackage=[];for(var M=0;M<I.length;M++)I[M].hasOwnProperty("categoryCode")||(j[0].categoryPackages[L].categoryPackage.push(I[M]),N++),N%X==0&&0!=N&&(L++,j[0].categoryPackages[L]={},j[0].categoryPackages[L].categoryPackage=[]);if(0!=j[0].categoryPackages[0].categoryPackage.length){for(var x=j[0].categoryPackages.length;x>0;x--)0==j[0].categoryPackages[x-1].categoryPackage.length&&j[0].categoryPackages.splice(x-1,1);d.categorizedPackages.push(j[0])}}if(void 0!=d.navFilterData){for(var E=0;E<n.RatesAvail.roomStays[0].roomCategories.length;E++){N=0,L=0,l={name:n.RatesAvail.roomStays[0].roomCategories[E].categoryName,categoryCode:n.RatesAvail.roomStays[0].roomCategories[E].categoryCode,categoryRooms:[]},l.categoryRooms[0]={},l.categoryRooms[0].categoryRoom=[];for(var M=0;M<f.length;M++){var z=!1;if(f[M].categoryCode==n.RatesAvail.roomStays[0].roomCategories[E].categoryCode){f[M].priceTagRate=[],f[M].currentCode=d.navFilterData.ratePlanCode.ratePlanCode;for(var G=0;G<f[M].averageRates.length;G++)if("Regular"==f[M].averageRates[G].ratePlanType&&f[M].averageRates[G].ratePlanCode!=d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=f[M].nightlyRates&&f[M].nightlyRates.length>0){f[M].averageRates[G].nightlyRates=[];for(var F=0;F<f[M].nightlyRates.length;F++)f[M].nightlyRates[F].ratePlanCode==f[M].averageRates[G].ratePlanCode&&f[M].averageRates[G].nightlyRates.push(angular.copy(f[M].nightlyRates[F]))}f[M].priceTagRate.push(f[M].averageRates[G])}else if(f[M].averageRates[G].ratePlanCode==d.navFilterData.ratePlanCode.ratePlanCode){if(void 0!=f[M].nightlyRates&&f[M].nightlyRates.length>0){f[M].averageRates[G].nightlyRates=[];for(var F=0;F<f[M].nightlyRates.length;F++)f[M].nightlyRates[F].ratePlanCode==f[M].averageRates[G].ratePlanCode&&f[M].averageRates[G].nightlyRates.push(angular.copy(f[M].nightlyRates[F]))}f[M].priceTagRate.unshift(f[M].averageRates[G])}for(var a=0;a<f[M].averageRates.length;a++){for(var K=0;K<d.rateAvailPlans.length;K++)d.rateAvailPlans[K].ratePlanCode==f[M].averageRates[a].ratePlanCode&&(f[M].priceTagRate[a].ratePlanName=d.rateAvailPlans[K].ratePlanName,f[M].priceTagRate[a].sortOrder=d.rateAvailPlans[K].sortOrder);d.navFilterData.ratePlanCode.ratePlanCode==f[M].averageRates[a].ratePlanCode&&(f[M].currentRate=f[M].averageRates[a],f[M].currentRate.price=f[M].currentRate.rate-f[M].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(f[M].currentRate.price=f[M].currentRate.price.toFixed(2)),l.categoryRooms[L].categoryRoom.push(f[M]),N++,!0)}for(var a=0;a<d.rateAvailPlans.length;a++)for(var s=0;s<f[M].priceTagRate.length;s++)f[M].priceTagRate[s].ratePlanCode==d.rateAvailPlans[a].ratePlanCode&&(f[M].priceTagRate[s].ratePlanName=d.rateAvailPlans[a].ratePlanName,f[M].priceTagRate[s].ratePlanDescription=d.rateAvailPlans[a].ratePlanDescription,f[M].priceTagRate[s].cancellationPolicy=d.rateAvailPlans[a].cancellationPolicy,f[M].priceTagRate[s].guaranteePolicy=d.rateAvailPlans[a].guaranteePolicy,f[M].priceTagRate[s].sortOrder=d.rateAvailPlans[a].sortOrder,void 0!=d.rateAvailPlans[a].packagePolicies&&(f[M].priceTagRate[s].packagePolicies=d.rateAvailPlans[a].packagePolicies));if(Y&&d.popUpOpenFromSignBookBtn&&!n.displayMultiRateListView&&(h.checkGmsLogin()||A.getIsLoyaltyUserLogIn())&&f[M].roomTypeCode===d.selectedRoomBeforeSignIn.roomTypeCode&&d.selectedRoomBeforeSignIn.categoryCode===f[M].categoryCode)for(var B=0;B<f[M].priceTagRate.length;B++)if(d.selectedRoomBeforeSignIn.ratePlanCode===f[M].priceTagRate[B].ratePlanCode){f[M].currentRate=f[M].priceTagRate[B],f[M].currentCode=f[M].priceTagRate[B].ratePlanCode,d.selectedRoomBeforeSignIn=f[M];break}}N%X==0&&0!=N&&(z=!0,L++,l.categoryRooms[L]={},l.categoryRooms[L].categoryRoom=[])}if(1==z){for(var J=l.categoryRooms.length;J>0;J--)0==l.categoryRooms[J-1].categoryRoom.length&&l.categoryRooms.splice(J-1,1);d.categorized.push(l)}else if(l.categoryRooms[L].categoryRoom.length>0){for(var J=l.categoryRooms.length;J>0;J--)0==l.categoryRooms[J-1].categoryRoom.length&&l.categoryRooms.splice(J-1,1);d.categorized.push(l)}}if(Y&&d.popUpOpenFromSignBookBtn&&!n.displayMultiRateListView&&(h.checkGmsLogin()||A.getIsLoyaltyUserLogIn())){for(var w,U=0,H=0,a=0;a<d.categorized.length;a++)if(d.categorized[a].categoryCode==d.selectedRoomBeforeSignIn.categoryCode){H=0;for(var V=0;V<d.categorized[a].categoryRooms.length;V++)for(var q=0;q<d.categorized[a].categoryRooms[V].categoryRoom.length;q++)H++,d.categorized[a].categoryRooms[V].categoryRoom[q].roomTypeCode==d.selectedRoomBeforeSignIn.roomTypeCode&&(U=H)}w=U%X==0?~~(U/X)-1:~~(U/X),void 0!=d.selectedRoomBeforeSignIn.categoryCode&&(w=d.selectedRoomBeforeSignIn.categoryCode+w),d.selectedGridRow=w}}if(void 0!=I)for(var E=0;E<n.RatesAvail.roomStays[0].packageCategories.length;E++){var N=0,L=0,c={name:n.RatesAvail.roomStays[0].packageCategories[E].categoryName,categoryCode:n.RatesAvail.roomStays[0].packageCategories[E].categoryCode,categoryPackages:[]};c.categoryPackages[0]={},c.categoryPackages[0].categoryPackage=[];for(var M=0;M<I.length;M++){var z=!1;I[M].categoryCode==n.RatesAvail.roomStays[0].packageCategories[E].categoryCode&&(c.categoryPackages[L].categoryPackage.push(I[M]),N++,!0),N%X==0&&0!=N&&(z=!0,L++,c.categoryPackages[L]={},c.categoryPackages[L].categoryPackage=[])}if(1==z){for(var J=c.categoryPackages.length;J>0;J--)0==c.categoryPackages[J-1].categoryPackage.length&&c.categoryPackages.splice(J-1,1);d.categorizedPackages.push(c)}else if(c.categoryPackages[L].categoryPackage.length>0){for(var J=c.categoryPackages.length;J>0;J--)0==c.categoryPackages[J-1].categoryPackage.length&&c.categoryPackages.splice(J-1,1);d.categorizedPackages.push(c)}}if(P(f),void 0!=I&&P(I),be=d.categorized,Ee=d.categorizedPackages,1==n.displayMultiRateListView){var Q=v.getCodeTypes();1!=d.packageSelected||void 0==d.navFilterData||void 0==d.navFilterData.ratePlanCode||"Package"!=d.navFilterData.ratePlanCode.ratePlanType&&"Group"!=d.navFilterData.ratePlanCode.ratePlanType?v.getReservation().roomStays[0].ratePlans.length>0&&("Package"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType||"Group"==v.getReservation().roomStays[0].ratePlans[0].ratePlanType)?n.displayMultiRateListView=!1:void 0!=Q&&(Q.indexOf("Group")>-1||Q.indexOf("group")>-1)?n.displayMultiRateListView=!1:(d.toggleAcc.gridView=!1,d.toggleAcc.listView=!0,de()):n.displayMultiRateListView=!1}d.checkBox.selected=!0,d.changeALLRoomSelect(),d.changeCatecory(),d.Categorized=d.categorized,void 0!=d.navFilterData&&(te=angular.copy(d.navFilterData.ratePlanCode.leadRate),oe=angular.copy(d.navFilterData.ratePlanCode.price),re=angular.copy(d.navFilterData.ratePlanCode.leadMemberRate),ne=angular.copy(d.navFilterData.ratePlanCode.memberPrice),d.navFilterData.ratePlanCode.leadRate=t("currencyConversionAndSymbol")(te,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),d.navFilterData.ratePlanCode.price=t("currencyConversionAndSymbol")(oe,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),Y&&re&&void 0!=ne?(d.isMemberRatePriceIsLowest=Number(re)<=Number(te),d.navFilterData.ratePlanCode.leadMemberRate=t("currencyConversionAndSymbol")(re,!1,d.navFilterData.ratePlanCode.merchandisedCurrency),d.navFilterData.ratePlanCode.memberPrice=t("currencyConversionAndSymbol")(ne,!1,d.navFilterData.ratePlanCode.merchandisedCurrency)):d.isMemberRatePriceIsLowest=!1),n.MRB&&(S.forEach(d.enhancementServices,function(e){e.checked=!1}),n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1);var Z=v.getMainReservation();Z.promotionId&&v.getPromotionInContext()&&I&&Z.roomStays&&Z.roomStays.length>0&&Z.roomStays[0].ratePlans&&Z.roomStays[0].ratePlans.length>0&&"Package"==Z.roomStays[0].ratePlans[0].ratePlanType&&!Z.roomStays[0].total&&setTimeout(function(){void 0!=v.getMainReservation().roomStays[0].ratePlans&&void 0!=v.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode&&(v.setConfig("OPEN_PACKAGE_DETAIL_PROMOTIONS"),d.UpgradeRoom(v.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode,1),n.$broadcast(o.CHANGE_PLACEHOLDER),d.toggleAcc.roomsView=!1,d.toggleAcc.packageView=!0,d.activePackageDetail=!0)},1e3),v.getConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR")&&!v.getConfig("RES_CHANGED_AFTER_ADD_REMOVE_CODE")||n.MRB&&v.getConfig("RES_CHANGED_AFTER_ADD_REMOVE_CODE")?(me=angular.copy(v.getMainReservation()),d.prevServiceReqOptions=void 0,me&&me.roomStays&&me.roomStays.length>0&&me.roomStays[0].ratePlans&&me.roomStays[0].ratePlans.length>0&&(d.prevServiceReqOptions={},d.prevServiceReqOptions.ratePlanCode=me.roomStays[0].ratePlans[0].ratePlanCode,d.prevServiceReqOptions.ratePlanType=me.roomStays[0].ratePlans[0].ratePlanType),v.getConfig("RES_CHANGED_AFTER_ADD_REMOVE_CODE")&&(d.enhancementServices=void 0,le=void 0)):n.MRB||!v.getConfig("RES_CHANGED_AFTER_ADD_REMOVE_CODE")||me&&me.services&&me.services.length||(d.enhancementServices=d.copyOfFormattedServicesData),v.deleteConfig("RES_CHANGED_AFTER_ADD_REMOVE_CODE"),Y&&d.popUpOpenFromSignBookBtn&&(h.checkGmsLogin()||A.getIsLoyaltyUserLogIn()&&(A.getIsBrandBarDisplay()||D.getMenubarEnabled()&&"sign-in"===n.loyaltyGuestAction))&&n.$broadcast("VIEW_ROOM_DETAILS")},function(e){var a=v.getMainReservation();"NOT_FOUND"==e.data.errors[0].errorCode&&a.promotionId&&v.getPromotionInContext()&&J&&a.roomStays&&a.roomStays.length>0&&a.roomStays[0].ratePlans&&a.roomStays[0].ratePlans.length>0&&"Package"==a.roomStays[0].ratePlans[0].ratePlanType&&!a.roomStays[0].total&&n.$broadcast("PROMOTION_DOES_NOT_QUALIFY_RESERVATION")})},l.debug(R.stepsById.accommodations.placeholder+"navDataFactory.stepsById.accommodations.placeholder"),1==v.getConfig("OPEN_ROOM_DETAIL")&&setTimeout(function(){0!=R.stepsById.accommodations.rooms.length?(d.getEnhancementServices(R.stepsById.accommodations.rooms[0].roomTypeCode),d.UpgradeRoom(R.stepsById.accommodations.rooms[0].roomTypeCode,1),n.$broadcast(o.CHANGE_PLACEHOLDER),d.toggleAcc.roomsView=!0,
d.toggleAcc.packageView=!1):void 0!=v.getMainReservation().roomStays[0].roomRates[0].roomTypeCode?(d.getEnhancementServices(v.getMainReservation().roomStays[0].roomRates[0].roomTypeCode),d.UpgradeRoom(v.getMainReservation().roomStays[0].roomRates[0].roomTypeCode,1),n.$broadcast(o.CHANGE_PLACEHOLDER),d.toggleAcc.roomsView=!0,d.toggleAcc.packageView=!1):(d.getEnhancementServices(),v.deleteConfig("OPEN_ROOM_DETAIL"),n.$broadcast(o.CHANGE_PLACEHOLDER)),d.activeRoomDetail=!0},1e3),1==v.getConfig("LOAD_ROOM_DETAIL")&&setTimeout(function(){0!=R.stepsById.accommodations.rooms.length?(d.getEnhancementServices(R.stepsById.accommodations.rooms[0].roomTypeCode),d.UpgradeRoom(R.stepsById.accommodations.rooms[0].roomTypeCode,1),n.$broadcast(o.CHANGE_PLACEHOLDER),d.toggleAcc.roomsView=!0,d.toggleAcc.packageView=!1):void 0!=v.getMainReservation().roomStays[0].roomRates[0].roomTypeCode?(d.getEnhancementServices(v.getMainReservation().roomStays[0].roomRates[0].roomTypeCode),d.UpgradeRoom(v.getMainReservation().roomStays[0].roomRates[0].roomTypeCode,1),n.$broadcast(o.CHANGE_PLACEHOLDER),d.toggleAcc.roomsView=!0,d.toggleAcc.packageView=!1):d.getEnhancementServices(),d.activeRoomDetail=!0},1e3),1==v.getConfig("OPEN_PACKAGE_DETAIL")&&setTimeout(function(){void 0!=R.stepsById.accommodations.package&&0!=R.stepsById.accommodations.package.length?(void 0!=R.stepsById.accommodations.package[0].packageCode?d.UpgradeRoom(R.stepsById.accommodations.package[0].packageCode,1):void 0!=R.stepsById.accommodations.package[0].ratePlanCode&&d.UpgradeRoom(R.stepsById.accommodations.package[0].ratePlanCode,1),n.$broadcast(o.CHANGE_PLACEHOLDER),d.toggleAcc.roomsView=!1,d.toggleAcc.packageView=!0):void 0!=v.getMainReservation().roomStays[0].ratePlans&&void 0!=v.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode?(d.UpgradeRoom(v.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode,1),n.$broadcast(o.CHANGE_PLACEHOLDER),d.toggleAcc.roomsView=!1,d.toggleAcc.packageView=!0):(v.deleteConfig("OPEN_PACKAGE_DETAIL"),n.$broadcast(o.CHANGE_PLACEHOLDER),d.toggleAcc.roomsView=!1,d.toggleAcc.packageView=!0),d.activePackageDetail=!0},1e3),v.getConfig("OPEN_PACKAGE_DETAIL_PROMOTIONS")&&J&&v.getPromotionInContext()?setTimeout(function(){void 0!=v.getMainReservation().roomStays[0].ratePlans&&void 0!=v.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode&&(d.UpgradeRoom(v.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode,1),n.$broadcast(o.CHANGE_PLACEHOLDER),d.toggleAcc.roomsView=!1,d.toggleAcc.packageView=!0,d.activePackageDetail=!0)},1e3):v.deleteConfig("OPEN_PACKAGE_DETAIL_PROMOTIONS"),d.$on("EVENT.REVIEW_PACKAGE",function(){setTimeout(function(){void 0!=R.stepsById.accommodations.package&&0!=R.stepsById.accommodations.package.length?(void 0!=R.stepsById.accommodations.package[0].packageCode?d.UpgradeRoom(R.stepsById.accommodations.package[0].packageCode,1):void 0!=R.stepsById.accommodations.package[0].ratePlanCode&&d.UpgradeRoom(R.stepsById.accommodations.package[0].ratePlanCode,1),n.$broadcast(o.CHANGE_PLACEHOLDER),d.toggleAcc.roomsView=!1,d.toggleAcc.packageView=!0):void 0!=v.getMainReservation().roomStays[0].ratePlans&&void 0!=v.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode?(d.UpgradeRoom(v.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode,1),n.$broadcast(o.CHANGE_PLACEHOLDER),d.toggleAcc.roomsView=!1,d.toggleAcc.packageView=!0):(v.deleteConfig("OPEN_PACKAGE_DETAIL"),n.$broadcast(o.CHANGE_PLACEHOLDER),d.toggleAcc.roomsView=!1,d.toggleAcc.packageView=!0),d.activePackageDetail=!0},1e3)}),1==v.getConfig("SET_GROUP_PLACEHOLDER")&&(n.accommodations=!0,R.stepsById.accommodations.placeholder=v.getMainReservation().roomStays[0].ratePlans[0].ratePlanName,v.deleteConfig("SET_GROUP_PLACEHOLDER"));var Ze,ea,aa=function(i){d.flagForVideo=!0,m.clear(),R.stepsById.accommodations.rooms=[],v.setContinueChangeReservation(),n.startTime=Date.now(),l.debug(JSON.stringify(i)+"this is the room"),n.MRB&&F(),Ze=!1,v.revertServices(),Ie.roomTypeCode=i.roomTypeCode,l.debug(JSON.stringify(v.getMainReservation())+"reservationService.getMainReservation() in updateAccommodtaion"),void 0==Ie.groupCode&&void 0!=d.navFilterData&&void 0!=d.navFilterData.ratePlanCode&&void 0!=d.navFilterData.ratePlanCode.ratePlanCode?(Ie.ratePlanCode=d.navFilterData.ratePlanCode.ratePlanCode,Ie.ratePlanType=d.navFilterData.ratePlanCode.ratePlanType):void 0!=v.getMainReservation().roomStays&&v.getMainReservation().roomStays.length>0&&void 0!=v.getMainReservation().roomStays[0].ratePlans&&v.getMainReservation().roomStays[0].ratePlans.length>0&&void 0!=v.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&"Group"==v.getMainReservation().roomStays[0].ratePlans[0].ratePlanType?(Ie.ratePlanType=void 0,Ie.ratePlanCode=void 0):void 0==Ie.ratePlanCode&&void 0!=v.getMainReservation().roomStays&&v.getMainReservation().roomStays.length>0&&void 0!=v.getMainReservation().roomStays[0].ratePlans&&v.getMainReservation().roomStays[0].ratePlans.length>0&&void 0!=v.getMainReservation().roomStays[0].ratePlans[0].ratePlanType?(Ie.ratePlanType=v.getReservation().roomStays[0].ratePlans[0].ratePlanType,Ie.ratePlanCode=v.getReservation().roomStays[0].ratePlans[0].ratePlanCode):void 0==Ie.ratePlanCode&&void 0!=R.stepsById.accommodations.package&&(Ie.ratePlanType="package",Ie.ratePlanCode=R.stepsById.accommodations.package[0].packageCode),l.debug(JSON.stringify(Ie)+"options in updateAccommodation"),n.MRB&&(n.MULRIROOM_AVAILCALL=!0,n.showSpinner=!0);var s=function(){if(d.roomForInclusions=i,d.numRoomsCheck=angular.copy(Xe),Ie.roomTypeCode=void 0,0==Ze)if(Xe>0){var s=Xe;if(n.accommodations=!0,n.openDrawer(),null!==i){R.stepsById.accommodations.rooms||(R.stepsById.accommodations.rooms=[]),void 0!=R.stepsById.accommodations.rooms[0]&&void 0!=R.stepsById.accommodations.rooms[0].packageCode&&(K||void 0!=R.stepsById.accommodations.rooms[0].packageCode||(R.stepsById.accommodations.rooms=[])),d.roomToAdd=n.navData.guestsrooms.placeholder.split("/")[1];var h=angular.copy(d.roomToAdd);l.debug(d.roomToAdd+"this is roomToAdd");for(var P=0;P<h;P++)l.debug(JSON.stringify(i)+"this is room"),1==n.MRB?v.setAccommodations(1,i):v.setAccommodations(h,i);y(n.closeDrawer,2e3),Xe--,R.navToggle.totalSelected=!0,v.setHotelCode(Ce),v.modifyMainReservation(d.enhancementServices);var D=v.getMainReservation();if(void 0!=D.allCodes&&D.allCodes.discount&&(D.roomStays[0].discountCode=D.allCodes.discount),n.MRB){for(var T=angular.copy(v.getMainReservationArray()),P=0;P<T.length;P++)void 0!=T[P].allCodes&&T[P].allCodes.Discount&&(T[P].roomStays[0].discountCode=angular.copy(T[P].allCodes.Discount));v.setMainReservationByEqual(T)}var O=v.getLanguage();if(O||(O=g.getCurrentLanguages().languageCode),D.languageCode=O,Q)n.gmsPromoCode&&v.addGmsRateAccessCodeInReservation(D),c.modifyHoldReservation(Ce,D,!0).success(function(e){v.handleXssVulnerabilities(e),b.setMyCheckRefershTokenDetails(e),n.gmsPromoCode&&v.removeRateAccessCodeInReservation(e,D),k(D),m.clear();for(var a=0;a<h;a++)R.stepsById.accommodations.rooms.push(i),void 0!=R.stepsById.accommodations.package||void 0==R.stepsById.accommodations.group||R.stepsById.accommodations.group.length>0||(R.stepsById.accommodations.placeholder=i.roomTypeName),void 0==R.stepsById.accommodations.package&&void 0==R.stepsById.accommodations.group&&(R.stepsById.accommodations.placeholder=i.roomTypeName);C.setUserTiming("Interaction","Book"),R.stepsById.accommodations.ratePlan=[],l.debug("rate plans"),l.debug(e.roomStays[0]),R.stepsById.accommodations.ratePlan=e.roomStays[0].ratePlans,l.debug(JSON.stringify(R.stepsById.accommodations)+"navDataFactory.stepsById.accommodations"),u.go("total"),v.setReservation(e),R.stepsById.total.placeholder=v.getTotalReservationAmount(),R.navToggle.totalSelected=!0,n.MRB&&(n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1)}).error(function(){n.MRB&&(n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1),Xe=s,v.revertAccommadationRooms(),m.clear(),m.pop({type:"error",title:"",body:n.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}),n.bookedError=!0,l.debug(JSON.stringify(D)),a.clearAll(),d.recallAPI()});else{if(n.MRB){for(var E=v.getMainReservation().id,M=0,_=!1,N=!1,P=0;P<v.getMainReservationArray().length;P++)void 0!=v.getMainReservationArray()[P].roomStays&&v.getMainReservationArray()[P].roomStays.length>0&&void 0!=v.getMainReservationArray()[P].roomStays[0].roomRates&&v.getMainReservationArray()[P].roomStays[0].roomRates.length>0&&void 0!=v.getMainReservationArray()[P].roomStays[0].roomRates[0].roomTypeCode&&void 0!=v.getMainReservationArray()[P].roomStays[0].total||(v.getMainReservationArray()[P].id==E&&(_=!0),M++,N=!0);1!=M&&0!=M||1!=_&&0!=N?d.oneRoomLeft=!1:(d.oneRoomLeft=!0,n.MULRIROOM_COMBINEDHOLD=!0),v.setMainReservationArrayById(E,v.getMainReservation());var L=angular.copy(v.getMainReservationArray());l.debug(JSON.stringify(v.getMainReservation())+"reservationService.getMainReservation before"),l.debug(JSON.stringify(v.getMainReservationArray())+"reservationService.getMainReservationArray() before")}if(n.MRB){var F=S.filter(n.RatesAvail.roomStays[0].ratePlans,{ratePlanCode:D.roomStays[0].ratePlans[0].ratePlanCode});if(void 0!=F){var x={roomId:D.id,rateInfo:F};v.setRatePlanInfoObject(x)}}n.gmsPromoCode&&Oe(D,L),c.callHoldReservation(Ce,D,L,d.oneRoomLeft,n.MRB).success(function(a){if(v.setConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE"),b.setMyCheckRefershTokenDetails(a),n.gmsPromoCode&&(n.MRB?v.removeRateAccessCodeInReservation(a.reservationResponses,L):v.removeRateAccessCodeInReservation(a,D)),!d.oneRoomLeft&&n.gmsPromoCode&&n.MRB&&(D.posSource.requestorIds=[]),A.getBurnPoints()&&f.eventTrack("RemoveAppliedPoints",{category:"UserNavigation",label:"RemoveAppliedPoints"}),I.resetVoucherDetails(),A.setBurnPoints(void 0),k(D),n.MRB&&void 0!=a.reservationResponses&&1==a.reservationResponses.length){var r;1==n.MRB&&1!=d.oneRoomLeft&&(r={},r=angular.copy(a.reservationResponses[0]),r.hotelCode=angular.copy(a.hotelCode),r.languageCode=angular.copy(a.languageCode),r.currencyCode=angular.copy(a.currencyCode),a=r)}if(m.clear(),1!=n.MRB){var s=a.merchandisedPromoData;R.stepsById.accommodations.merchandisedPromotionData=s}for(var c=0;c<h;c++)R.stepsById.accommodations.rooms.push(i),l.debug("navDataFactory.stepsById.accommodations.placeholder"),l.debug(R.stepsById.accommodations.placeholder),void 0!=R.stepsById.accommodations.package||void 0==R.stepsById.accommodations.group||R.stepsById.accommodations.group.length>0||(R.stepsById.accommodations.placeholder=i.roomTypeName),void 0==R.stepsById.accommodations.package&&void 0==R.stepsById.accommodations.group&&(R.stepsById.accommodations.placeholder=i.roomTypeName);if(C.setUserTiming("Interaction","Book"),R.stepsById.accommodations.ratePlan=[],1==n.MRB&&1==d.oneRoomLeft){var g=S.findIndex(a.reservationResponses,function(e){return e.id==E});r=angular.copy(a.reservationResponses[g]),void 0!=r.roomStays&&(void 0!=r.merchandisedPromoData&&(R.stepsById.accommodations.merchandisedPromotionData=r.merchandisedPromoData),R.stepsById.accommodations.ratePlan=r.roomStays[0].ratePlans)}else R.stepsById.accommodations.ratePlan=a.roomStays[0].ratePlans,a.selected=!0;if(l.debug(JSON.stringify(R.stepsById.accommodations)+"navDataFactory.stepsById.accommodations"),1==n.MRB){if(1!=d.oneRoomLeft&&0!=N||1!=n.MRB){var y,P=!1;a.id=E,v.setMainReservationArrayById(E,a);for(var T=0;T<v.getMainReservationArray().length;T++)if(!(void 0!=v.getMainReservationArray()[T].roomStays[0].ratePlans&&v.getMainReservationArray()[T].roomStays[0].ratePlans.length>0&&void 0!=v.getMainReservationArray()[T].roomStays[0].ratePlans[0].ratePlanType&&v.getMainReservationArray()[T].roomStays[0].roomRates.length>0&&void 0!=v.getMainReservationArray()[T].roomStays[0].roomRates[0].roomTypeCode&&void 0!=v.getMainReservationArray()[T].roomStays[0].total)){y=v.getMainReservationArray()[T].id,P=!0,h=1,Xe=1;break}v.setReservation(a),void 0!=y&&(v.changeSelectRoom(y),n.$broadcast(o.MODIFY_RESERVATION))}else{for(var c=0;c<a.reservationResponses.length;c++)if(a.reservationResponses[c].id==E){a.reservationResponses[c].selected=!0;break}v.setMrbItineraryTotals(a.itineraryTotals),v.setMrbItineraryPaymentInfo(a.itineraryPaymentInfo);var O=v.setMainReservationByEqual(a.reservationResponses),P=!1;if(0!=O)for(var c=0;c<v.getMainReservationArray().length;c++)if(v.getMainReservationArray()[c].id==E){v.setReservation(v.getMainReservationArray()[c]);break}n.reservationArray=v.getMainReservationArray()}for(var M,_=0;_<v.getMainReservationArray().length;_++)if(v.getMainReservationArray()[_].id==E){M=v.getMainReservationArray()[_];break}if(W=M.roomStays[0].ratePlans.length>0&&"Package"==M.roomStays[0].ratePlans[0].ratePlanType,l.debug(JSON.stringify(v.getMainReservationArray())+"reservationService.getMainReservationArray() after commit hold call"),n.reservationArray=angular.copy(v.getMainReservationArray()),1!=P&&0!=O)R.stepsById.total.placeholder=v.getTotalReservationAmount(),R.navToggle.totalSelected=!0,u.go("total");else{if(d.packageSelected=!1,m.clear(),0==O)if(n.$broadcast(o.MODIFY_RESERVATION),d.failedRoomsId=v.getFailedRoomsId(),d.failedRoomsId.length>1)d.combinedHoldFailure=!0,e("","combined-hold-failure-accommodations","combined-hold-failure-title-0",!1);else{var F=t("replaceHashMRB")(n.translate.page_roomisnolongeravl_MRTBRoomSelectorMsg,d.getRoomIndex(d.failedRoomsId[0]),n.reservationArray.length);m.pop({type:"error",title:"",body:F,timeout:3e3})}d.recallAPI(!0),0!=O&&(m.clear(),G(n.translate.global_makeselectionsfornextroom_MRTBSelectorInteractiveMsg),p.scrollTopAnimated(0,1e3)),se=!0}R.stepsById.accommodations.placeholderMRB=v.getBookedRoomCount()}else v.setReservation(a),R.stepsById.total.placeholder=v.getTotalReservationAmount(),R.navToggle.totalSelected=!0,u.go("total");n.MRB&&(n.MULRIROOM_COMBINEDHOLD=!1,n.MULRIROOM_AVAILCALL=!1,setTimeout(function(){n.showSpinner=!1},1500))}).error(function(){n.MRB&&(n.MULRIROOM_COMBINEDHOLD=!1,n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1),Xe=s,v.revertAccommadationRooms(),m.clear(),m.pop({type:"error",title:"",body:n.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}),n.bookedError=!0,l.debug(JSON.stringify(D)),a.clearAll(),d.recallAPI()})}}}else{var w=function(){delete R.stepsById.accommodations.ratePlan,R.stepsById.accommodations.id="accommodations",R.stepsById.accommodations.label="Accommodations",void 0==R.stepsById.accommodations.package&&void 0==R.stepsById.accommodations.group?(R.stepsById.accommodations.placeholder=n.translate.global_header_lblSelect,n.accommodations=!1):void 0==R.stepsById.accommodations.package||R.stepsById.accommodations.package.length>0||void 0!=R.stepsById.accommodations.group||R.stepsById.accommodations.group.length>0||(R.stepsById.accommodations.placeholder=n.translate.global_header_lblSelect,n.accommodations=!1),R.stepsById.accommodations.className="Header-step--extended",R.stepsById.accommodations.rooms=[],B(),v.revertAccommadationRooms()};d.cancelAddAnotherRoom=function(){d.addAnotherRoom="display-none",e.onModalClose()},d.continueAddAnotherRoom=function(){var r=v.getMainReservation();if(r.roomStays[0].discountCode&&(r.allCodes&&!r.allCodes.discount?r.allCodes.discount=r.roomStays[0].discountCode:r.allCodes||(r.allCodes={},r.allCodes.discount=r.roomStays[0].discountCode)),v.setContinueChangeReservation(),w(),n.accommodations=!0,n.openDrawer(),null!==i){R.stepsById.accommodations.rooms||(R.stepsById.accommodations.rooms=[]),void 0!=R.stepsById.accommodations.rooms[0]&&void 0!=R.stepsById.accommodations.rooms[0].packageCode&&(K||void 0!=R.stepsById.accommodations.rooms[0].packageCode||(R.stepsById.accommodations.rooms=[])),d.roomToAdd=n.navData.guestsrooms.placeholder.split("/")[1];for(var s=angular.copy(d.roomToAdd),h=0;h<s;h++)v.setAccommodations(s,i),void 0!=R.stepsById.accommodations.package||void 0==R.stepsById.accommodations.group||R.stepsById.accommodations.group.length>0||(R.stepsById.accommodations.placeholder=i.roomTypeName),void 0==R.stepsById.accommodations.package&&void 0==R.stepsById.accommodations.group&&(R.stepsById.accommodations.placeholder=i.roomTypeName);y(n.closeDrawer,2e3),Xe--,R.navToggle.totalSelected=!0,v.setHotelCode(Ce),v.modifyMainReservation(d.enhancementServices);var C=v.getLanguage();C||(C=g.getCurrentLanguages().languageCode);var P=v.getMainReservation();if(P.languageCode=C,l.debug(JSON.stringify(P)+"_reservation for Lang Code"),void 0!=P.allCodes&&P.allCodes.discount&&(P.roomStays[0].discountCode=P.allCodes.discount),n.MRB){for(var D=angular.copy(v.getMainReservationArray()),h=0;h<D.length;h++)void 0!=D[h].allCodes&&D[h].allCodes.Discount&&(D[h].roomStays[0].discountCode=angular.copy(D[h].allCodes.Discount));v.setMainReservationByEqual(D)}if(l.debug(JSON.stringify(R.stepsById.accommodations)+"this is navDataFactory.stepsById.accommodations2"),Q)n.gmsPromoCode&&v.addGmsRateAccessCodeInReservation(P),c.modifyHoldReservation(Ce,P,!0).success(function(a){v.handleXssVulnerabilities(a),b.setMyCheckRefershTokenDetails(a),n.gmsPromoCode&&v.removeRateAccessCodeInReservation(a,P),k(P),d.addAnotherRoom="display-none",e.onModalClose(),m.clear(),n.navData.total.placeholder=t("currencyConversionWithTwoDecimalPlaces")(a.roomStays[0].total.amountAfterTax),R.navToggle.totalSelected=!0;for(var o=0;o<s;o++)R.stepsById.accommodations.rooms.push(i),void 0!=R.stepsById.accommodations.rooms[0].packageCode||void 0==R.stepsById.accommodations.group||R.stepsById.accommodations.group.length>0||(R.stepsById.accommodations.placeholder=i.roomTypeName),void 0==R.stepsById.accommodations.package&&void 0==R.stepsById.accommodations.group&&(R.stepsById.accommodations.placeholder=i.roomTypeName);u.go("total"),v.setReservation(a),n.MRB&&(n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1)}).error(function(){n.MRB&&(n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1),d.addAnotherRoom="display-none",e.onModalClose(),v.revertAccommadationRooms(),m.clear(),m.pop({type:"error",title:"",body:n.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}),n.bookedError=!0,l.debug(JSON.stringify(P)),a.clearAll(),d.recallAPI()});else{if(n.MRB){for(var T=v.getMainReservation().id,O=0,E=!1,M=!1,h=0;h<v.getMainReservationArray().length;h++)void 0!=v.getMainReservationArray()[h].roomStays&&v.getMainReservationArray()[h].roomStays.length>0&&void 0!=v.getMainReservationArray()[h].roomStays[0].roomRates&&v.getMainReservationArray()[h].roomStays[0].roomRates.length>0&&void 0!=v.getMainReservationArray()[h].roomStays[0].roomRates[0].roomTypeCode&&void 0!=v.getMainReservationArray()[h].roomStays[0].total||(v.getMainReservationArray()[h].id==T&&(E=!0),M=!0,O++);d.oneRoomLeft=!(1!=O&&0!=O||1!=E&&0!=M),v.setMainReservationArrayById(T,v.getMainReservation());var _=angular.copy(v.getMainReservationArray());l.debug(JSON.stringify(v.getMainReservationArray())+"reservationService.getMainReservationArray() before")}if(l.debug(JSON.stringify(v.getMainReservation())+"reservationService.getMainReservation before"),n.MRB){var N=S.filter(n.RatesAvail.roomStays[0].ratePlans,{ratePlanCode:P.roomStays[0].ratePlans[0].ratePlanCode});if(void 0!=N){var L={roomId:P.id,rateInfo:N};v.setRatePlanInfoObject(L)}}n.gmsPromoCode&&Oe(P,_),c.callHoldReservation(Ce,P,_,d.oneRoomLeft,n.MRB).success(function(a){if(v.setConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE"),b.setMyCheckRefershTokenDetails(a),n.gmsPromoCode&&(n.MRB?v.removeRateAccessCodeInReservation(a.reservationResponses,_):v.removeRateAccessCodeInReservation(a,P)),!d.oneRoomLeft&&n.gmsPromoCode&&n.MRB&&(P.posSource.requestorIds=[]),A.getBurnPoints()&&f.eventTrack("RemoveAppliedPoints",{category:"UserNavigation",label:"RemoveAppliedPoints"}),I.resetVoucherDetails(),A.setBurnPoints(void 0),k(P),void 0!=a.reservationResponses&&1==a.reservationResponses.length){var r;1==n.MRB&&1!=d.oneRoomLeft&&(r={},r=angular.copy(a.reservationResponses[0]),r.hotelCode=angular.copy(a.hotelCode),r.languageCode=angular.copy(a.languageCode),r.currencyCode=angular.copy(a.currencyCode),a=r)}d.addAnotherRoom="display-none",e.onModalClose(),m.clear();var c=a.merchandisedPromoData;R.stepsById.accommodations.merchandisedPromotionData=c,1!=n.MRB&&(n.navData.total.placeholder=t("currencyConversionWithTwoDecimalPlaces")(a.roomStays[0].total.amountAfterTax)),R.navToggle.totalSelected=!0;for(var g=0;g<s;g++)R.stepsById.accommodations.rooms.push(i),void 0!=R.stepsById.accommodations.package||void 0==R.stepsById.accommodations.group||R.stepsById.accommodations.group.length>0||(R.stepsById.accommodations.placeholder=i.roomTypeName),void 0==R.stepsById.accommodations.package&&void 0==R.stepsById.accommodations.group&&(R.stepsById.accommodations.placeholder=i.roomTypeName);if(1==n.MRB&&1==d.oneRoomLeft){var y=S.findIndex(a.reservationResponses,function(e){return e.id==T});r=angular.copy(a.reservationResponses[y]),void 0!=r.roomStays&&(void 0!=r.merchandisedPromoData&&(R.stepsById.accommodations.merchandisedPromotionData=r.merchandisedPromoData),R.stepsById.accommodations.ratePlan=r.roomStays[0].ratePlans)}else R.stepsById.accommodations.ratePlan=a.roomStays[0].ratePlans,a.selected=!0;if(1==n.MRB){if(1!=d.oneRoomLeft&&0!=M||1!=n.MRB){v.setReservation(a);var h,C=!1;a.id=T,v.setMainReservationArrayById(T,a);for(var D=0;D<v.getMainReservationArray().length;D++)if(!(void 0!=v.getMainReservationArray()[D].roomStays[0].ratePlans&&v.getMainReservationArray()[D].roomStays[0].ratePlans.length>0&&void 0!=v.getMainReservationArray()[D].roomStays[0].ratePlans[0].ratePlanType&&void 0!=v.getMainReservationArray()[D].roomStays[0].total)){h=v.getMainReservationArray()[D].id,C=!0,s=1,Xe=1;break}void 0!=h&&(v.changeSelectRoom(h),n.$broadcast(o.MODIFY_RESERVATION)),l.debug(JSON.stringify(v.getMainReservationArray())+"reservationService.getMainReservationArray() after commit hold call")}else{for(var g=0;g<a.reservationResponses.length;g++)if(a.reservationResponses[g].id==T){a.reservationResponses[g].selected=!0;break}v.setMrbItineraryTotals(a.itineraryTotals),v.setMrbItineraryPaymentInfo(a.itineraryPaymentInfo);var O=v.setMainReservationByEqual(a.reservationResponses),C=!1;if(0!=O)for(var g=0;g<v.getMainReservationArray().length;g++)if(v.getMainReservationArray()[g].id==T){v.setReservation(v.getMainReservationArray()[g]);break}n.reservationArray=v.getMainReservationArray()}for(var E,N=0;N<v.getMainReservationArray().length;N++)if(v.getMainReservationArray()[N].id==T){E=v.getMainReservationArray()[N];break}if(W=E.roomStays[0].ratePlans.length>0&&"Package"==E.roomStays[0].ratePlans[0].ratePlanType,n.reservationArray=angular.copy(v.getMainReservationArray()),1!=C&&0!=O)R.stepsById.total.placeholder=v.getTotalReservationAmount(),R.navToggle.totalSelected=!0,u.go("total");else{if(d.packageSelected=!1,0==O)if(n.$broadcast(o.MODIFY_RESERVATION),d.failedRoomsId=v.getFailedRoomsId(),d.failedRoomsId.length>1)d.combinedHoldFailure=!0,e("","combined-hold-failure-accommodations","combined-hold-failure-title-0",!1);else{var L=t("replaceHashMRB")(n.translate.page_roomisnolongeravl_MRTBRoomSelectorMsg,d.getRoomIndex(d.failedRoomsId[0]),n.reservationArray.length);m.pop({type:"error",title:"",body:L,timeout:3e3})}d.recallAPI(!0),0!=O&&(m.clear(),G(n.translate.global_makeselectionsfornextroom_MRTBSelectorInteractiveMsg),p.scrollTopAnimated(0,1e3)),se=!0}R.stepsById.accommodations.placeholderMRB=v.getBookedRoomCount()}else v.setReservation(a),u.go("total");n.MRB&&(n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1)}).error(function(){n.MRB&&(n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1),d.addAnotherRoom="display-none",e.onModalClose(),v.revertAccommadationRooms(),m.clear(),m.pop({type:"error",title:"",body:n.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}),n.bookedError=!0,l.debug(JSON.stringify(P)),a.clearAll(),d.recallAPI()})}}},Q?n.continueModifyReservation?d.continueAddAnotherRoom():setTimeout(function(){var a=r.pageYOffset,t=a+20+"px";d.addAnotherRoom="display-block",setTimeout(function(){e.onModalOpen("roomButton","add-another-room-parent-id","add-another-room-title-id",!1,d.cancelAddAnotherRoom)}),document.getElementsByClassName("MaxWidth-logo-wrap")?d.fromTopForAddingAnotherRoom=a+100+"px":d.fromTopForAddingAnotherRoom=t},1100):d.continueAddAnotherRoom()}};"package"==Ie.ratePlanType||"Package"==Ie.ratePlanType?(Ie=v.passPromotionIdInApi(Ie),c.getAccommodationRooms(Ie).getAllRooms().then(function(e){if(v.validateAvailForPromotions(e.data),l.debug(JSON.stringify(e.data)+"response in updateAccommodation"),void 0!=e.data.roomStays[0].packageTypes)for(var a=0;a<e.data.roomStays[0].packageTypes.length;a++)if(e.data.roomStays[0].packageTypes[a].packageCode==d.navFilterData.ratePlanCode.ratePlanCode&&e.data.roomStays[0].packageTypes[a].inclusions.length>0){for(var t=0;t<e.data.roomStays[0].packageTypes[a].inclusions.length;t++)0==e.data.roomStays[0].packageTypes[a].inclusions[t].autoSchedule&&(u.go("accommodation.inclusions"),ia(e.data),d.roomTypeCode=angular.copy(Ie.roomTypeCode),Ze=!0,n.MRB&&(n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1));na(e.data),v.modifyPackageInclusions(d.inclusionsServicesAuto),l.debug(JSON.stringify(v.getMainReservation())+"this is reservation.getMainMain"),setTimeout(function(){var e=document.getElementById("inclusion-header-id");e&&e.focus()},500)}s()},function(e){n.MRB&&(n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1),m.clear(),"NUM_CHILD_EXCEEDS_MAX_CHILD"==e.data.errors[0].errorCode&&m.pop({type:"error",title:"",body:"Child Occupancy is exceeded for this room type"})})):s()};d.updateAccommodations=function(a,t){n.toggle.intlMenu=!1,0==a.left?(n.timerInContext=!0,m.clear(),y(function(){m.pop({type:"error",title:"",body:n.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})}),v.setConfig("SINGLE_ROOM_TIMER_OUT"),d.recallAPI(!0)):(v.pushToTimer(a),ea=a,1==v.getConfig("modifyRetrieveEH")?(d.showModifyRetrieveEHModal="display-block",setTimeout(function(){e.onModalOpen("","modify-retreieve-eh-parent-accommodation-id","modify-retreieve-eh-title-accommodation-id",!1,d.cancelModifyRetrieveEH)})):(aa(a),y(function(){if(void 0!=v.getMainReservationArray()){for(var e,a=0;a<v.getMainReservationArray().length;a++)if(v.getMainReservationArray()[a].id==v.getMainReservation().id){e=a,e++;break}n.gmsId=e}"book"==t?f.eventTrack("ClickRoomBook",{category:"UserNavigation",label:ea.currentRate.roomTypeCode}):f.eventTrack("ClickAddRoomCheckout",{category:"UserNavigation",label:ea.currentRate.roomTypeCode}),n.gmsId=void 0},2e3)))},d.cancelModifyRetrieveEH=function(){v.setPromotionObjectInModifyReservation(void 0),d.showModifyRetrieveEHModal="display-none",e.onModalClose()},d.continueModifyReservationEH=function(){c.cancelExtendHold(n.extendHoldHotelCode,n.extendHoldConfirmationCode,n.extendHoldEmail).success(function(){var a=v.getPromotionObjectInModifyReservation();a&&(v.setPromotionInContext(a),n.$broadcast("DISABLE_RIGHT_RAIL")),v.setPromotionObjectInModifyReservation(void 0),1==v.getConfig("extendhold_remove_room")?(v.deleteConfig("extendhold_remove_room"),R.stepsById.accommodations.rooms=[],ta(),d.showModifyRetrieveEHModal="display-none",e.onModalClose(),n.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),F(),Fe(),se=!0):1==v.getConfig("extendhold_remove_rateplan")?(R.stepsById.accommodations.rooms=[],oa(),d.showModifyRetrieveEHModal="display-none",e.onModalClose(),n.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),F(),Fe(),se=!0):1==v.getConfig("extendhold_remove_package")?(v.deleteConfig("extendhold_remove_package"),ra(),d.showModifyRetrieveEHModal="display-none",e.onModalClose(),n.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),F(),Fe(),se=!0,d.packageSelected=!1):(d.showModifyRetrieveEHModal="display-none",e.onModalClose(),aa(ea)),v.deleteUniqueId(),v.deleteConfig("modifyRetrieveEH")}).error(function(){})},ve=d.categorized,void 0!=R.stepsById.accommodations.package&&1==n.isPackage&&(d.goPackages(),n.isPackage=!1);var ta=function(){delete R.stepsById.accommodations.ratePlan,R.stepsById.accommodations.id="accommodations",R.stepsById.accommodations.label="Accommodations",void 0==R.stepsById.accommodations.package&&void 0==R.stepsById.accommodations.group?(R.stepsById.accommodations.placeholder=n.translate.global_header_lblSelect,n.accommodations=!1):void 0==R.stepsById.accommodations.package?(R.stepsById.accommodations.placeholder=n.translate.global_header_lblSelect,n.accommodations=!1):void 0==R.stepsById.accommodations.package||R.stepsById.accommodations.package.length>0||(n.accommodations=!1),R.stepsById.accommodations.className="Header-step--extended",R.stepsById.accommodations.rooms=[],R.stepsById.accommodations.ratePlan=[],B(),v.revertAccommadationRooms(),v.revertServices()};d.continueDeleteRoom=function(){if(d.listOfSelectedEnhancements=[],d.enhancementServices=d.copyOfFormattedServicesData,me.services=[],d.prevServiceReqOptions=void 0,v.getConfig("delete_room_in_roomselector")){var a=!0;v.getMainReservationArray().length>0||(a=!1);for(var t=0;t<v.getMainReservationArray().length;t++)if(void 0==v.getMainReservationArray()[t].roomStays[0].total){a=!1;break}n.$broadcast(o.REMOVE_CONFIRM_DELETE_ROOM_ROOMSELECTOR),v.deleteConfig("delete_room_in_roomselector"),a&&n.$broadcast(o.DELETE_ROOM_AFTER_LAND_TOTAL)}else n.MRB?(v.dropPromotion(),R.stepsById.accommodations.rooms=[],ta(),n.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),F(),Fe(),se=!0,n.reservationArray=v.getMainReservationArray()):(v.dropPromotion(),R.stepsById.accommodations.rooms=[],ta(),n.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),F(),Fe(),se=!0);e.onModalClose(),d.deleteRoom="display-none"},d.$on(o.REMOVE_ACCOMMODATION,function(){d.deleteRoom="display-block",setTimeout(function(){e.onModalOpen("manage-rooms-link-id","delete-room-parent-id","delete-room-title-id",!1,d.cancelDeleteRoom)}),p.scrollTopAnimated(0,1e3),d.cancelDeleteRoom=function(){e.onModalClose(),d.deleteRoom="display-none",n.MRB&&d.OpenSwitchRoom(),v.deleteConfig("delete_room_in_roomselector")}}),d.$on(o.EXTENDHOLD_REMOVE_ROOM,function(){d.showModifyRetrieveEHModal="display-block",setTimeout(function(){e.onModalOpen("","modify-retreieve-eh-parent-accommodation-id","modify-retreieve-eh-title-accommodation-id",!1,d.cancelModifyRetrieveEH)}),v.setConfig("extendhold_remove_room")});var oa=function(){l.debug(JSON.stringify(R.stepsById.accommodations)+"rate navDataFactory.stepsById.accommodations"),delete R.stepsById.accommodations.ratePlan,R.stepsById.accommodations.id="accommodations",R.stepsById.accommodations.label="Accommodations",void 0==R.stepsById.accommodations.package?(R.stepsById.accommodations.placeholder=n.translate.global_header_lblSelect,n.accommodations=!1):R.stepsById.accommodations.package.length>0||(R.stepsById.accommodations.placeholder=n.translate.global_header_lblSelect,n.accommodations=!1),R.stepsById.accommodations.className="Header-step--extended",R.stepsById.accommodations.rooms=[],R.stepsById.accommodations.ratePlan=[],B(),v.revertAccommadationRatePlan(),v.revertServices()};d.continueDeleteRatePlan=function(){d.listOfSelectedEnhancements=[],d.enhancementServices=d.copyOfFormattedServicesData,me.services=[],d.prevServiceReqOptions=void 0,v.getConfig("delete_room_in_roomselector")?(n.$broadcast(o.REMOVE_CONFIRM_DELETE_ROOM_ROOMSELECTOR),v.deleteConfig("delete_room_in_roomselector")):n.MRB?(v.getMainReservationArray().length>1&&void 0!=n.deleteRateFromRoom&&n.deleteRateFromRoom.id!=v.getMainReservation().id&&(v.changeSelectRoom(n.deleteRateFromRoom.id),n.$broadcast(o.MODIFY_RESERVATION),n.deleteRateFromRoom={}),v.dropPromotion(),R.stepsById.accommodations.rooms=[],ta(),n.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),F(),Fe(),se=!0,n.reservationArray=v.getMainReservationArray(),R.stepsById.accommodations.placeholderMRB=v.getBookedRoomCount()):(v.dropPromotion(),R.stepsById.accommodations.rooms=[],ta(),n.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),F(),Fe(),se=!0),d.deleteRatePlan="display-none"},d.$on(o.REMOVE_RATEPLAN,function(){d.deleteRatePlan="display-block",p.scrollTopAnimated(0,1e3),d.cancelDeleteRatePlan=function(){d.deleteRatePlan="display-none"}}),
d.$on(o.EXTENDHOLD_REMOVE_RATEPLAN,function(){d.showModifyRetrieveEHModal="display-block",setTimeout(function(){e.onModalOpen("","modify-retreieve-eh-parent-accommodation-id","modify-retreieve-eh-title-accommodation-id",!1,d.cancelModifyRetrieveEH)}),v.setConfig("extendhold_remove_rateplan")});var ra=function(){n.accommodations=!1,R.stepsById.accommodations={id:"accommodations",label:"Accommodations",placeholder:"Select",placeholderMRB:R.stepsById.accommodations.placeholderMRB,className:"Header-step--extended",rooms:[]},m.clear(),v.revertAccommadationRooms(),v.revertAccommadationRatePlan(),v.revertServices(),v.revertAccommadationRatePlan(),void 0!=v.getReservation().roomStays[0].roomRates[0].roomTypeCode?Ie.roomTypeCode=v.getReservation().roomStays[0].roomRates[0].roomTypeCode:Ie.roomTypeCode=void 0};d.continueDeletePackage=function(){n.MRB&&v.getMainReservationArray().length>1&&void 0!=n.deletePackageFromRoom&&n.deletePackageFromRoom.id!=v.getMainReservation().id&&(v.changeSelectRoom(n.deletePackageFromRoom.id),n.$broadcast(o.MODIFY_RESERVATION),n.deletePackageFromRoom={}),d.listOfSelectedEnhancements=[],d.enhancementServices=d.copyOfFormattedServicesData,me.services=[],d.prevServiceReqOptions=void 0,v.dropPromotion(),ra(),d.deletePackage="display-none",n.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),F(),Fe(),se=!0,d.packageSelected=!1,n.MRB&&(n.reservationArray=v.getMainReservationArray(),R.stepsById.accommodations.placeholderMRB=v.getBookedRoomCount())},d.$on(o.REMOVE_PACKAGE,function(){d.deletePackage="display-block",d.deletePackageWindow=r.pageYOffset+180+"px",d.cancelDeletePackage=function(){d.deletePackage="display-none"}}),d.$on(o.EXTENDHOLD_REMOVE_PACKAGE,function(){d.showModifyRetrieveEHModal="display-block",setTimeout(function(){e.onModalOpen("","modify-retreieve-eh-parent-accommodation-id","modify-retreieve-eh-title-accommodation-id",!1,d.cancelModifyRetrieveEH)}),v.setConfig("extendhold_remove_package")});var na=function(e){for(var a=0;a<e.roomStays[0].packageTypes.length;a++)if(e.roomStays[0].packageTypes[a].packageCode==d.navFilterData.ratePlanCode.ratePlanCode){d.inclusionsServicesAuto=[];for(var t=0;t<e.roomStays[0].packageTypes[a].inclusions.length;t++)1==e.roomStays[0].packageTypes[a].inclusions[t].autoSchedule&&d.inclusionsServicesAuto.push(e.roomStays[0].packageTypes[a].inclusions[t])}l.debug(JSON.stringify(d.inclusionsServicesAuto)+"before$scope.inclusionsServicesAuto"),0!=d.inclusionsServicesAuto.length&&d.inclusionsServicesAuto.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var o=v.getResStartDate(),r=v.getResEndDate(),i=moment.utc(r).diff(moment.utc(o),"days")+1,s=[],c=0;c<i;c++){var g=moment.utc(o).add(c,"days").format("YYYY-MM-DD");s.push(g)}for(var m=0;m<d.inclusionsServicesAuto.length;m++){0!=d.inclusionsServicesAuto[m].serviceOptions.length&&d.inclusionsServicesAuto[m].serviceOptions.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var u=[],p=0;p<d.inclusionsServicesAuto[m].serviceOptions.length;p++)for(var y=0;y<d.inclusionsServicesAuto[m].serviceOptions[p].dailyRates.length;y++)void 0==u[p]?u[p]=d.inclusionsServicesAuto[m].serviceOptions[p].dailyRates[y].adultUnitPrice:d.inclusionsServicesAuto[m].serviceOptions[p].dailyRates[y].adultRate<=u[p]&&(u[p]=d.inclusionsServicesAuto[m].serviceOptions[p].dailyRates[y].adultUnitPrice);if(void 0==d.inclusionsServicesAuto[m].minPrice?d.inclusionsServicesAuto[m].minPrice=Math.min.apply(Math,u):d.inclusionsServicesAuto[m].minPrice>=Math.min.apply(Math,u)&&(d.inclusionsServicesAuto[m].minPrice=Math.min.apply(Math,u)),d.inclusionsServicesAuto[m].checked=!1,d.inclusionsServicesAuto[m].eachDayRate=[],"PER_PERSON_PER_NIGHT"==d.inclusionsServicesAuto[m].servicePricingType||"PER_RESERVATION"==d.inclusionsServicesAuto[m].servicePricingType||"PER_ROOM_PER_NIGHT"==d.inclusionsServicesAuto[m].servicePricingType)for(var h=0;h<s.length;h++){d.inclusionsServicesAuto[m].eachDayRate[h]={},d.inclusionsServicesAuto[m].eachDayRate[h].serviceDate=s[h],d.inclusionsServicesAuto[m].eachDayRate[h].options=[];for(var R=0;R<d.inclusionsServicesAuto[m].serviceOptions.length;R++)for(var f=0;f<d.inclusionsServicesAuto[m].serviceOptions[R].dailyRates.length;f++)d.inclusionsServicesAuto[m].serviceOptions[R].dailyRates[f].serviceDate==s[h]&&(d.inclusionsServicesAuto[m].eachDayRate[h].options.push(d.inclusionsServicesAuto[m].serviceOptions[R].dailyRates[f]),d.inclusionsServicesAuto[m].eachDayRate[h].options[d.inclusionsServicesAuto[m].eachDayRate[h].options.length-1].serviceOptionId=d.inclusionsServicesAuto[m].serviceOptions[R].serviceOptionId,d.inclusionsServicesAuto[m].eachDayRate[h].options[d.inclusionsServicesAuto[m].eachDayRate[h].options.length-1].serviceOptionName=d.inclusionsServicesAuto[m].serviceOptions[R].serviceOptionName,d.inclusionsServicesAuto[m].eachDayRate[h].options[d.inclusionsServicesAuto[m].eachDayRate[h].options.length-1].sortOrder=d.inclusionsServicesAuto[m].serviceOptions[R].sortOrder)}else if("PER_PERSON"==d.inclusionsServicesAuto[m].servicePricingType||"PER_ROOM"==d.inclusionsServicesAuto[m].servicePricingType){for(var h=0;h<s.length;h++){d.inclusionsServicesAuto[m].eachDayRate[h]={},d.inclusionsServicesAuto[m].eachDayRate[h].serviceDate=s[h],d.inclusionsServicesAuto[m].eachDayRate[h].options=[];for(var R=0;R<d.inclusionsServicesAuto[m].serviceOptions.length;R++){for(var f=0;f<d.inclusionsServicesAuto[m].serviceOptions[R].dailyRates.length;f++)d.inclusionsServicesAuto[m].serviceOptions[R].dailyRates[f].serviceDate==s[h]&&(d.inclusionsServicesAuto[m].eachDayRate[h].options.push(d.inclusionsServicesAuto[m].serviceOptions[R].dailyRates[f]),d.inclusionsServicesAuto[m].eachDayRate[h].options[d.inclusionsServicesAuto[m].eachDayRate[h].options.length-1].serviceOptionId=d.inclusionsServicesAuto[m].serviceOptions[R].serviceOptionId,d.inclusionsServicesAuto[m].eachDayRate[h].options[d.inclusionsServicesAuto[m].eachDayRate[h].options.length-1].serviceOptionName=d.inclusionsServicesAuto[m].serviceOptions[R].serviceOptionName,d.inclusionsServicesAuto[m].eachDayRate[h].options[d.inclusionsServicesAuto[m].eachDayRate[h].options.length-1].sortOrder=d.inclusionsServicesAuto[m].serviceOptions[R].sortOrder);"PER_ROOM"==d.inclusionsServicesAuto[m].servicePricingType&&(d.inclusionsServicesAuto[m].eachDayRate[h].tempOptions=angular.copy(d.inclusionsServicesAuto[m].eachDayRate[h].options))}}for(var P,t=d.inclusionsServicesAuto[m].eachDayRate.length-1;t>=0;t--)d.inclusionsServicesAuto[m].eachDayRate[t].options.length>0?(P=d.inclusionsServicesAuto[m].eachDayRate[t].options,d.inclusionsServicesAuto[m].eachDayRate[t].options=[],"PER_ROOM"==d.inclusionsServicesAuto[m].servicePricingType&&(d.inclusionsServicesAuto[m].eachDayRate[t].tempOptions=[])):d.inclusionsServicesAuto[m].eachDayRate.splice(t,1);d.inclusionsServicesAuto[m].eachDayRate[0].options=P,"PER_ROOM"==d.inclusionsServicesAuto[m].servicePricingType&&(d.inclusionsServicesAuto[m].eachDayRate[0].tempOptions=angular.copy(P))}var S;if("PER_RESERVATION"==d.inclusionsServicesAuto[m].servicePricingType){for(var t=0;t<d.inclusionsServicesAuto[m].eachDayRate.length;t++)if(d.inclusionsServicesAuto[m].eachDayRate[t].options.length>0){d.inclusionsServicesAuto[m].eachDayRate[t].serviceDates=[],S=t;break}for(var t=0;t<d.inclusionsServicesAuto[m].eachDayRate.length;t++)d.inclusionsServicesAuto[m].eachDayRate[t].options.length>0&&(d.inclusionsServicesAuto[m].eachDayRate[S].serviceDates.push(d.inclusionsServicesAuto[m].eachDayRate[t].serviceDate),t!=S&&(d.inclusionsServicesAuto[m].eachDayRate[t].options=[]))}if("PER_ROOM_PER_NIGHT"==d.inclusionsServicesAuto[m].servicePricingType||"PER_ROOM"==d.inclusionsServicesAuto[m].servicePricingType){var A=n.navData.guestsrooms.placeholder.split("/")[1];d.roomsInservice=C.numToArray(parseInt(A)+1),d.roomsInservice.splice(0,1)}for(var t=0;t<d.inclusionsServicesAuto[m].eachDayRate.length;t++)"PER_PERSON_PER_NIGHT"!=d.inclusionsServicesAuto[m].servicePricingType&&"PER_PERSON"!=d.inclusionsServicesAuto[m].servicePricingType||(void 0==d.inclusionsServicesAuto[m].eachDayRate[t].adult&&d.inclusionsServicesAuto[m].eachDayRate[t].options.length>0&&void 0!=d.inclusionsServicesAuto[m].eachDayRate[t].options[0].adultQuantity&&(d.inclusionsServicesAuto[m].eachDayRate[t].adult=d.inclusionsServicesAuto[m].eachDayRate[t].options[0].adultQuantity,d.inclusionsServicesAuto[m].eachDayRate[t].adultIsSelected=!0,d.inclusionsServicesAuto[m].eachDayRate[t].selectOption=d.inclusionsServicesAuto[m].eachDayRate[t].options[0]),void 0==d.inclusionsServicesAuto[m].eachDayRate[t].children&&d.inclusionsServicesAuto[m].eachDayRate[t].options.length>0&&void 0!=d.inclusionsServicesAuto[m].eachDayRate[t].options[0].childQuantity&&(d.inclusionsServicesAuto[m].eachDayRate[t].children=d.inclusionsServicesAuto[m].eachDayRate[t].options[0].childQuantity,d.inclusionsServicesAuto[m].eachDayRate[t].childrenIsSelected=!0)),"PER_ROOM_PER_NIGHT"!=d.inclusionsServicesAuto[m].servicePricingType&&"PER_ROOM"!=d.inclusionsServicesAuto[m].servicePricingType||void 0==d.inclusionsServicesAuto[m].eachDayRate[t].room&&d.inclusionsServicesAuto[m].eachDayRate[t].options.length>0&&d.roomsInservice.length>0&&(d.inclusionsServicesAuto[m].eachDayRate[t].room=d.roomsInservice[d.roomsInservice.length-1],d.inclusionsServicesAuto[m].eachDayRate[t].roomsIsSelected=!0,d.inclusionsServicesAuto[m].eachDayRate[t].selectOption=d.inclusionsServicesAuto[m].eachDayRate[t].options[0]),"PER_RESERVATION"==d.inclusionsServicesAuto[m].servicePricingType&&void 0!=d.inclusionsServicesAuto[m].eachDayRate[t].serviceDate&&d.inclusionsServicesAuto[m].eachDayRate[t].options.length>0&&d.inclusionsServicesAuto[m].eachDayRate[t].serviceDate.length>0&&(d.inclusionsServicesAuto[m].eachDayRate[t].date=d.inclusionsServicesAuto[m].eachDayRate[t].serviceDates[0],d.inclusionsServicesAuto[m].eachDayRate[t].roomsIsSelected=!0,d.inclusionsServicesAuto[m].eachDayRate[t].selectOption=d.inclusionsServicesAuto[m].eachDayRate[t].options[0])}l.debug(JSON.stringify(d.inclusionsServices)+"finally$scope.inclusionsServices")},ia=function(e){for(var a=0;a<e.roomStays[0].packageTypes.length;a++)if(e.roomStays[0].packageTypes[a].packageCode==d.navFilterData.ratePlanCode.ratePlanCode){d.inclusionsServices=[];for(var t=0;t<e.roomStays[0].packageTypes[a].inclusions.length;t++)0==e.roomStays[0].packageTypes[a].inclusions[t].autoSchedule&&d.inclusionsServices.push(e.roomStays[0].packageTypes[a].inclusions[t])}0!=d.inclusionsServices.length&&d.inclusionsServices.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var o=v.getResStartDate(),r=v.getResEndDate(),i=moment.utc(r).diff(moment.utc(o),"days")+1,s=[],c=0;c<i;c++){var g=moment.utc(o).add(c,"days").format("YYYY-MM-DD");s.push(g)}for(var m=0;m<d.inclusionsServices.length;m++){0!=d.inclusionsServices[m].serviceOptions.length&&d.inclusionsServices[m].serviceOptions.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var u=[],p=0;p<d.inclusionsServices[m].serviceOptions.length;p++)for(var y=0;y<d.inclusionsServices[m].serviceOptions[p].dailyRates.length;y++)void 0==u[p]?u[p]=d.inclusionsServices[m].serviceOptions[p].dailyRates[y].adultUnitPrice:d.inclusionsServices[m].serviceOptions[p].dailyRates[y].adultRate<=u[p]&&(u[p]=d.inclusionsServices[m].serviceOptions[p].dailyRates[y].adultUnitPrice);if(void 0==d.inclusionsServices[m].minPrice?d.inclusionsServices[m].minPrice=Math.min.apply(Math,u):d.inclusionsServices[m].minPrice>=Math.min.apply(Math,u)&&(d.inclusionsServices[m].minPrice=Math.min.apply(Math,u)),d.inclusionsServices[m].checked=!1,d.inclusionsServices[m].eachDayRate=[],"PER_PERSON_PER_NIGHT"==d.inclusionsServices[m].servicePricingType||"PER_RESERVATION"==d.inclusionsServices[m].servicePricingType||"PER_ROOM_PER_NIGHT"==d.inclusionsServices[m].servicePricingType)for(var h=0;h<s.length;h++){d.inclusionsServices[m].eachDayRate[h]={},d.inclusionsServices[m].eachDayRate[h].serviceDate=s[h],d.inclusionsServices[m].eachDayRate[h].options=[];for(var R=0;R<d.inclusionsServices[m].serviceOptions.length;R++)for(var f=0;f<d.inclusionsServices[m].serviceOptions[R].dailyRates.length;f++)d.inclusionsServices[m].serviceOptions[R].dailyRates[f].serviceDate==s[h]&&(d.inclusionsServices[m].eachDayRate[h].options.push(d.inclusionsServices[m].serviceOptions[R].dailyRates[f]),d.inclusionsServices[m].eachDayRate[h].options[d.inclusionsServices[m].eachDayRate[h].options.length-1].serviceOptionId=d.inclusionsServices[m].serviceOptions[R].serviceOptionId,d.inclusionsServices[m].eachDayRate[h].options[d.inclusionsServices[m].eachDayRate[h].options.length-1].serviceOptionName=d.inclusionsServices[m].serviceOptions[R].serviceOptionName,d.inclusionsServices[m].eachDayRate[h].options[d.inclusionsServices[m].eachDayRate[h].options.length-1].sortOrder=d.inclusionsServices[m].serviceOptions[R].sortOrder)}else if("PER_PERSON"==d.inclusionsServices[m].servicePricingType||"PER_ROOM"==d.inclusionsServices[m].servicePricingType){for(var h=0;h<s.length;h++){d.inclusionsServices[m].eachDayRate[h]={},d.inclusionsServices[m].eachDayRate[h].serviceDate=s[h],d.inclusionsServices[m].eachDayRate[h].options=[];for(var R=0;R<d.inclusionsServices[m].serviceOptions.length;R++){for(var f=0;f<d.inclusionsServices[m].serviceOptions[R].dailyRates.length;f++)d.inclusionsServices[m].serviceOptions[R].dailyRates[f].serviceDate==s[h]&&(d.inclusionsServices[m].eachDayRate[h].options.push(d.inclusionsServices[m].serviceOptions[R].dailyRates[f]),d.inclusionsServices[m].eachDayRate[h].options[d.inclusionsServices[m].eachDayRate[h].options.length-1].serviceOptionId=d.inclusionsServices[m].serviceOptions[R].serviceOptionId,d.inclusionsServices[m].eachDayRate[h].options[d.inclusionsServices[m].eachDayRate[h].options.length-1].serviceOptionName=d.inclusionsServices[m].serviceOptions[R].serviceOptionName,d.inclusionsServices[m].eachDayRate[h].options[d.inclusionsServices[m].eachDayRate[h].options.length-1].sortOrder=d.inclusionsServices[m].serviceOptions[R].sortOrder);"PER_ROOM"==d.inclusionsServices[m].servicePricingType&&(d.inclusionsServices[m].eachDayRate[h].tempOptions=angular.copy(d.inclusionsServices[m].eachDayRate[h].options))}}for(var P,t=d.inclusionsServices[m].eachDayRate.length-1;t>=0;t--)d.inclusionsServices[m].eachDayRate[t].options.length>0?(P=d.inclusionsServices[m].eachDayRate[t].options,d.inclusionsServices[m].eachDayRate[t].options=[],"PER_ROOM"==d.inclusionsServices[m].servicePricingType&&(d.inclusionsServices[m].eachDayRate[t].tempOptions=[])):d.inclusionsServices[m].eachDayRate.splice(t,1);d.inclusionsServices[m].eachDayRate[0].options=P,"PER_ROOM"==d.inclusionsServices[m].servicePricingType&&(d.inclusionsServices[m].eachDayRate[0].tempOptions=angular.copy(P))}var S;if("PER_RESERVATION"==d.inclusionsServices[m].servicePricingType){for(var t=0;t<d.inclusionsServices[m].eachDayRate.length;t++)if(d.inclusionsServices[m].eachDayRate[t].options.length>0){d.inclusionsServices[m].eachDayRate[t].serviceDates=[],S=t;break}for(var t=0;t<d.inclusionsServices[m].eachDayRate.length;t++)d.inclusionsServices[m].eachDayRate[t].options.length>0&&(d.inclusionsServices[m].eachDayRate[S].serviceDates.push(d.inclusionsServices[m].eachDayRate[t].serviceDate),t!=S&&(d.inclusionsServices[m].eachDayRate[t].options=[]))}if("PER_ROOM_PER_NIGHT"==d.inclusionsServices[m].servicePricingType||"PER_ROOM"==d.inclusionsServices[m].servicePricingType){var A=n.navData.guestsrooms.placeholder.split("/")[1];d.roomsInservice=C.numToArray(parseInt(A)+1),d.roomsInservice.splice(0,1)}for(var t=0;t<d.inclusionsServices[m].eachDayRate.length;t++)"PER_PERSON_PER_NIGHT"!=d.inclusionsServices[m].servicePricingType&&"PER_PERSON"!=d.inclusionsServices[m].servicePricingType||(void 0==d.inclusionsServices[m].eachDayRate[t].adult&&d.inclusionsServices[m].eachDayRate[t].options.length>0&&void 0!=d.inclusionsServices[m].eachDayRate[t].options[0].adultQuantity&&(d.inclusionsServices[m].eachDayRate[t].adult=d.inclusionsServices[m].eachDayRate[t].options[0].adultQuantity,d.inclusionsServices[m].eachDayRate[t].adultIsSelected=!0,d.inclusionsServices[m].eachDayRate[t].selectOption=d.inclusionsServices[m].eachDayRate[t].options[0]),void 0==d.inclusionsServices[m].eachDayRate[t].children&&d.inclusionsServices[m].eachDayRate[t].options.length>0&&void 0!=d.inclusionsServices[m].eachDayRate[t].options[0].childQuantity&&(d.inclusionsServices[m].eachDayRate[t].children=d.inclusionsServices[m].eachDayRate[t].options[0].childQuantity,d.inclusionsServices[m].eachDayRate[t].childrenIsSelected=!0)),"PER_ROOM_PER_NIGHT"!=d.inclusionsServices[m].servicePricingType&&"PER_ROOM"!=d.inclusionsServices[m].servicePricingType||void 0==d.inclusionsServices[m].eachDayRate[t].room&&d.inclusionsServices[m].eachDayRate[t].options.length>0&&d.roomsInservice.length>0&&(d.inclusionsServices[m].eachDayRate[t].room=d.roomsInservice[d.roomsInservice.length-1],d.inclusionsServices[m].eachDayRate[t].roomsIsSelected=!0,d.inclusionsServices[m].eachDayRate[t].selectOption=d.inclusionsServices[m].eachDayRate[t].options[0]),"PER_RESERVATION"==d.inclusionsServices[m].servicePricingType&&void 0!=d.inclusionsServices[m].eachDayRate[t].serviceDate&&d.inclusionsServices[m].eachDayRate[t].options.length>0&&d.inclusionsServices[m].eachDayRate[t].serviceDate.length>0&&(d.inclusionsServices[m].eachDayRate[t].date=d.inclusionsServices[m].eachDayRate[t].serviceDates[0],d.inclusionsServices[m].eachDayRate[t].roomsIsSelected=!0,d.inclusionsServices[m].eachDayRate[t].selectOption=d.inclusionsServices[m].eachDayRate[t].options[0])}l.debug(JSON.stringify(d.inclusionsServices)+"finally$scope.inclusionsServices")};d.changeInclusionsDropdownDate=function(e,a){if("PER_RESERVATION"==a.servicePricingType){void 0!=e.date&&void 0!=e.selectOption&&(e.allSelected=!0,d.doneEnable=!1),e.options=[];for(var t=0;t<a.serviceOptions.length;t++)for(var o=0;o<a.serviceOptions[t].dailyRates.length;o++)e.date==a.serviceOptions[t].dailyRates[o].serviceDate&&e.options.push(a.serviceOptions[t].dailyRates[o]),delete e.selectOption;e.selectOption=e.options[0]}},d.changeInclusionsDropdownOptions=function(e,a){"PER_PERSON_PER_NIGHT"!=a.servicePricingType&&"PER_PERSON"!=a.servicePricingType||void 0!=e.adult&&void 0!=e.selectOption&&(e.allSelected=!0),"PER_ROOM"!=a.servicePricingType&&"PER_ROOM_PER_NIGHT"!=a.servicePricingType||void 0!=e.room&&void 0!=e.selectOption&&(e.allSelected=!0),"PER_RESERVATION"==a.servicePricingType&&void 0!=e.selectOption&&void 0!=e.date&&(e.allSelected=!0),l.debug(JSON.stringify(d.inclusionsServices)+"after modify")},d.inclusionsGoBack=function(){for(var e=0;e<d.inclusionsServices.length;e++){if("PER_PERSON"==d.inclusionsServices[e].servicePricingType)for(var a=0;a<d.inclusionsServices[e].eachDayRate.length;a++)void 0!=d.inclusionsServices[e].eachDayRate[a].selectOption&&delete d.inclusionsServices[e].eachDayRate[a].selectOption;if("PER_ROOM"==d.inclusionsServices[e].servicePricingType)for(var a=0;a<d.inclusionsServices[e].eachDayRate.length;a++)void 0!=d.inclusionsServices[e].eachDayRate[a].selectOption&&delete d.inclusionsServices[e].eachDayRate[a].selectOption;if("PER_PERSON_PER_NIGHT"==d.inclusionsServices[e].servicePricingType)for(var a=0;a<d.inclusionsServices[e].eachDayRate.length;a++)void 0!=d.inclusionsServices[e].eachDayRate[a].selectOption&&delete d.inclusionsServices[e].eachDayRate[a].selectOption;if("PER_ROOM_PER_NIGHT"==d.inclusionsServices[e].servicePricingType)for(var a=0;a<d.inclusionsServices[e].eachDayRate.length;a++)void 0!=d.inclusionsServices[e].eachDayRate[a].selectOption&&delete d.inclusionsServices[e].eachDayRate[a].selectOption;if("PER_RESERVATION"==d.inclusionsServices[e].servicePricingType)for(var a=0;a<d.inclusionsServices[e].eachDayRate.length;a++)void 0!=d.inclusionsServices[e].eachDayRate[a].selectOption&&(delete d.inclusionsServices[e].eachDayRate[a].serviceDate,delete d.inclusionsServices[e].eachDayRate[a].selectOption)}l.debug(JSON.stringify(d.inclusionsServices)+"final final $scope.inclusionsServices"),1!=n.editPackageInclusions?u.go("accommodation.room"):(u.go("total"),n.editPackageInclusions=!1)},d.inclusionsBook=function(){if(n.MRB&&(n.MULRIROOM_AVAILCALL=!0,n.showSpinner=!0),f.eventTrack("ClickCheckout",{category:"UserNavigation",label:d.navFilterData.ratePlanCode.ratePlanCode}),v.setContinueChangeReservation(),1!=n.editPackageInclusions){var r=d.roomForInclusions,i=Number(R.stepsById.guestsrooms.placeholder.split("/")[1].trim());if(i>0){var s=i;if(n.accommodations=!0,n.openDrawer(),null!==r){void 0!=R.stepsById.accommodations.rooms&&(R.stepsById.accommodations.rooms=[]),d.roomToAdd=n.navData.guestsrooms.placeholder.split("/")[1];var h=angular.copy(d.roomToAdd);l.debug(d.roomToAdd+"this is roomToAdd");for(var C=0;C<h;C++)l.debug(JSON.stringify(r)+"this is room"),v.setAccommodations(h,r),void 0==R.stepsById.accommodations.package&&(R.stepsById.accommodations.placeholder=r.roomTypeName);y(n.closeDrawer,2e3),i--,R.navToggle.totalSelected=!0,v.setHotelCode(Ce),v.revertServices(),v.modifyMainReservation(d.enhancementServices),l.debug(JSON.stringify(d.inclusionsServices)+"this is $scope.inclusionsServices"),v.modifyPackageInclusions(d.inclusionsServices);var P=v.getMainReservation();if(void 0!=P.allCodes&&P.allCodes.discount&&(P.roomStays[0].discountCode=P.allCodes.discount),n.MRB){for(var D=angular.copy(v.getMainReservationArray()),C=0;C<D.length;C++)void 0!=D[C].allCodes&&D[C].allCodes.Discount&&(D[C].roomStays[0].discountCode=angular.copy(D[C].allCodes.Discount));v.setMainReservationByEqual(D)}var T=v.getLanguage();T||(T=g.getCurrentLanguages().languageCode),P.languageCode=T,d._reservationService=v.getMainReservation(),l.debug(JSON.stringify(d._reservationService)+"final reservation");var O=v.canModifyReservation();if(O)c.modifyHoldReservation(Ce,d._reservationService,!0).success(function(e){v.handleXssVulnerabilities(e),b.setMyCheckRefershTokenDetails(e),k(P),m.clear();for(var a=0;a<h;a++)R.stepsById.accommodations.rooms.push(r),void 0!=R.stepsById.accommodations.package||void 0==R.stepsById.accommodations.group||R.stepsById.accommodations.group.length>0||(R.stepsById.accommodations.placeholder=r.roomTypeName),void 0==R.stepsById.accommodations.package&&(R.stepsById.accommodations.placeholder=r.roomTypeName);u.go("total"),v.setReservation(e),R.stepsById.total.placeholder=v.getTotalReservationAmount(),R.navToggle.totalSelected=!0,n.MRB&&(n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1)}).error(function(){n.MRB&&(n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1),i=s,v.revertAccommadationRooms(),m.clear(),m.pop({type:"error",title:"",body:n.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}),n.bookedError=!0,a.clearAll(),d.recallAPI()});else{if(n.MRB){for(var E=v.getMainReservation().id,M=0,_=!1,N=!1,C=0;C<v.getMainReservationArray().length;C++)void 0!=v.getMainReservationArray()[C].roomStays&&v.getMainReservationArray()[C].roomStays.length>0&&void 0!=v.getMainReservationArray()[C].roomStays[0].roomRates&&v.getMainReservationArray()[C].roomStays[0].roomRates.length>0&&void 0!=v.getMainReservationArray()[C].roomStays[0].roomRates[0].roomTypeCode&&void 0!=v.getMainReservationArray()[C].roomStays[0].total||(v.getMainReservationArray()[C].id==E&&(_=!0),M++,N=!0);d.oneRoomLeft=!(1!=M&&0!=M||1!=_&&0!=N),v.setMainReservationArrayById(E,v.getMainReservation());var L=angular.copy(v.getMainReservationArray());l.debug(JSON.stringify(v.getMainReservationArray())+"reservationService.getMainReservationArray() before")}if(l.debug(JSON.stringify(v.getMainReservation())+"reservationService.getMainReservation before"),n.MRB){var F=S.filter(n.RatesAvail.roomStays[0].ratePlans,{ratePlanCode:P.roomStays[0].ratePlans[0].ratePlanCode});if(void 0!=F){var B={roomId:P.id,rateInfo:F};v.setRatePlanInfoObject(B)}}c.callHoldReservation(Ce,P,L,d.oneRoomLeft,n.MRB).success(function(e){if(v.setConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE"),b.setMyCheckRefershTokenDetails(e),A.getBurnPoints()&&f.eventTrack("RemoveAppliedPoints",{category:"UserNavigation",label:"RemoveAppliedPoints"}),I.resetVoucherDetails(),A.setBurnPoints(void 0),k(P),void 0!=e.reservationResponses&&1==e.reservationResponses.length){var a;1==n.MRB&&1!=d.oneRoomLeft&&(a={},a=angular.copy(e.reservationResponses[0]),a.hotelCode=angular.copy(e.hotelCode),a.languageCode=angular.copy(e.languageCode),a.currencyCode=angular.copy(e.currencyCode),e=a)}m.clear();for(var s=0;s<h;s++)R.stepsById.accommodations.rooms.push(r),void 0!=R.stepsById.accommodations.package||void 0==R.stepsById.accommodations.group||R.stepsById.accommodations.group.length>0||(R.stepsById.accommodations.placeholder=r.roomTypeName),void 0==R.stepsById.accommodations.package&&(R.stepsById.accommodations.placeholder=r.roomTypeName);if(1==n.MRB){if(1!=d.oneRoomLeft&&0!=N||1!=n.MRB){v.setReservation(e);var c,g=!1;e.id=E,v.setMainReservationArrayById(E,e);for(var y=0;y<v.getMainReservationArray().length;y++)if(!(void 0!=v.getMainReservationArray()[y].roomStays[0].ratePlans&&v.getMainReservationArray()[y].roomStays[0].ratePlans.length>0&&void 0!=v.getMainReservationArray()[y].roomStays[0].ratePlans[0].ratePlanType&&void 0!=v.getMainReservationArray()[y].roomStays[0].total)){c=v.getMainReservationArray()[y].id,g=!0,h=1,i=1;break}void 0!=c&&(v.changeSelectRoom(c),n.$broadcast(o.MODIFY_RESERVATION)),l.debug(JSON.stringify(v.getMainReservationArray())+"reservationService.getMainReservationArray() after commit hold call")}else{for(var s=0;s<e.reservationResponses.length;s++)if(e.reservationResponses[s].id==E){e.reservationResponses[s].selected=!0;break}v.setMrbItineraryTotals(e.itineraryTotals),v.setMrbItineraryPaymentInfo(e.itineraryPaymentInfo);var C=v.setMainReservationByEqual(e.reservationResponses),g=!1;if(0!=C)for(var s=0;s<v.getMainReservationArray().length;s++)if(v.getMainReservationArray()[s].id==E){v.setReservation(v.getMainReservationArray()[s]);break}n.reservationArray=v.getMainReservationArray()}for(var S,D=0;D<v.getMainReservationArray().length;D++)if(v.getMainReservationArray()[D].id==E){S=v.getMainReservationArray()[D];break}if(W=S.roomStays[0].ratePlans.length>0&&"Package"==S.roomStays[0].ratePlans[0].ratePlanType,n.reservationArray=angular.copy(v.getMainReservationArray()),1!=g&&0!=C)n.MRB&&(n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1),u.go("total");else{if(d.packageSelected=!1,0==C)if(n.$broadcast(o.MODIFY_RESERVATION),d.failedRoomsId=v.getFailedRoomsId(),d.failedRoomsId.length>1)d.combinedHoldFailure=!0;else{var T=t("replaceHashMRB")(n.translate.page_roomisnolongeravl_MRTBRoomSelectorMsg,d.getRoomIndex(d.failedRoomsId[0]),n.reservationArray.length);m.pop({type:"error",title:"",body:T,timeout:3e3})}d.recallAPI(!0),0!=C&&(m.clear(),G(n.translate.global_makeselectionsfornextroom_MRTBSelectorInteractiveMsg),p.scrollTopAnimated(0,1e3)),se=!0}R.stepsById.accommodations.placeholderMRB=v.getBookedRoomCount()}else n.MRB&&(n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1),v.setReservation(e),u.go("total");R.stepsById.total.placeholder=v.getTotalReservationAmount(),R.navToggle.totalSelected=!0}).error(function(){n.MRB&&(n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1),i=s,v.revertAccommadationRooms(),m.clear(),m.pop({type:"error",title:"",body:n.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}),n.bookedError=!0,a.clearAll(),d.recallAPI()})}}}}else{v.modifyPackageInclusions(n.inclusionsServices),d._reservationService=v.getMainReservation(),P=angular.copy(v.getMainReservation()),l.debug(JSON.stringify(d._reservationService)+"final reservation for packageInclusion");var O=v.canModifyReservation();if(O)c.modifyHoldReservation(Ce,d._reservationService,!0).success(function(e){v.handleXssVulnerabilities(e),b.setMyCheckRefershTokenDetails(e),k(P),m.clear();for(var a=0;a<h;a++)R.stepsById.accommodations.rooms.push(r),void 0!=R.stepsById.accommodations.package||void 0==R.stepsById.accommodations.group||R.stepsById.accommodations.group.length>0||(R.stepsById.accommodations.placeholder=r.roomTypeName),void 0==R.stepsById.accommodations.package&&(R.stepsById.accommodations.placeholder=r.roomTypeName);u.go("total"),v.setReservation(e),R.stepsById.total.placeholder=v.getTotalReservationAmount(),R.navToggle.totalSelected=!0,n.MRB&&(n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1)}).error(function(){n.MRB&&(n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1),i=s,v.revertAccommadationRooms(),m.clear(),m.pop({type:"error",title:"",body:n.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}),n.bookedError=!0,a.clearAll(),d.recallAPI()});else{if(n.MRB){for(var E=v.getMainReservation().id,M=0,_=!1,N=!1,C=0;C<v.getMainReservationArray().length;C++)void 0!=v.getMainReservationArray()[C].roomStays&&v.getMainReservationArray()[C].roomStays.length>0&&void 0!=v.getMainReservationArray()[C].roomStays[0].roomRates&&v.getMainReservationArray()[C].roomStays[0].roomRates.length>0&&void 0!=v.getMainReservationArray()[C].roomStays[0].roomRates[0].roomTypeCode&&void 0!=v.getMainReservationArray()[C].roomStays[0].total||(v.getMainReservationArray()[C].id==E&&(_=!0),M++,N=!0);d.oneRoomLeft=!(1!=M&&0!=M||1!=_&&0!=N),v.setMainReservationArrayById(E,v.getMainReservation());var L=angular.copy(v.getMainReservationArray());l.debug(JSON.stringify(v.getMainReservationArray())+"reservationService.getMainReservationArray() before")}if(l.debug(JSON.stringify(v.getMainReservation())+"reservationService.getMainReservation before"),n.MRB){var F=S.filter(n.RatesAvail.roomStays[0].ratePlans,{ratePlanCode:P.roomStays[0].ratePlans[0].ratePlanCode});if(void 0!=F){var B={roomId:P.id,rateInfo:F};v.setRatePlanInfoObject(B)}}c.callHoldReservation(Ce,P,L,d.oneRoomLeft,n.MRB).success(function(a){if(v.setConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE"),b.setMyCheckRefershTokenDetails(a),A.getBurnPoints()&&f.eventTrack("RemoveAppliedPoints",{category:"UserNavigation",label:"RemoveAppliedPoints"}),I.resetVoucherDetails(),A.setBurnPoints(void 0),k(P),void 0!=a.reservationResponses&&1==a.reservationResponses.length){var s;1==n.MRB&&1!=d.oneRoomLeft&&(s={},s=angular.copy(a.reservationResponses[0]),s.hotelCode=angular.copy(a.hotelCode),s.languageCode=angular.copy(a.languageCode),s.currencyCode=angular.copy(a.currencyCode),a=s)}m.clear();for(var c=0;c<h;c++)R.stepsById.accommodations.rooms.push(r),void 0!=R.stepsById.accommodations.package||void 0==R.stepsById.accommodations.group||R.stepsById.accommodations.group.length>0||(R.stepsById.accommodations.placeholder=r.roomTypeName),void 0==R.stepsById.accommodations.package&&(R.stepsById.accommodations.placeholder=r.roomTypeName);if(1==n.MRB){if(1!=d.oneRoomLeft&&0!=M||1!=n.MRB){v.setReservation(a);var g,y=!1;a.id=E,v.setMainReservationArrayById(E,a);for(var C=0;C<v.getMainReservationArray().length;C++)if(!(void 0!=v.getMainReservationArray()[C].roomStays[0].ratePlans&&v.getMainReservationArray()[C].roomStays[0].ratePlans.length>0&&void 0!=v.getMainReservationArray()[C].roomStays[0].ratePlans[0].ratePlanType&&void 0!=v.getMainReservationArray()[C].roomStays[0].total)){g=v.getMainReservationArray()[C].id,y=!0,h=1,i=1;break}void 0!=g&&(v.changeSelectRoom(g),n.$broadcast(o.MODIFY_RESERVATION),Fe()),l.debug(JSON.stringify(v.getMainReservationArray())+"reservationService.getMainReservationArray() after commit hold call")}else{for(var c=0;c<a.reservationResponses.length;c++)if(a.reservationResponses[c].id==E){a.reservationResponses[c].selected=!0;break}v.setMrbItineraryTotals(a.itineraryTotals),v.setMrbItineraryPaymentInfo(a.itineraryPaymentInfo);var S=v.setMainReservationByEqual(a.reservationResponses),y=!1;if(0!=S)for(var c=0;c<v.getMainReservationArray().length;c++)if(v.getMainReservationArray()[c].id==E){v.setReservation(v.getMainReservationArray()[c]);break}n.reservationArray=v.getMainReservationArray()}for(var D,T=0;T<v.getMainReservationArray().length;T++)if(v.getMainReservationArray()[T].id==E){D=v.getMainReservationArray()[T];break}
if(W=D.roomStays[0].ratePlans.length>0&&"Package"==D.roomStays[0].ratePlans[0].ratePlanType,n.reservationArray=angular.copy(v.getMainReservationArray()),1!=y&&0!=S)u.go("total");else{if(0==S)if(n.$broadcast(o.MODIFY_RESERVATION),d.failedRoomsId=v.getFailedRoomsId(),d.failedRoomsId.length>1)d.combinedHoldFailure=!0,e("","combined-hold-failure-accommodations","combined-hold-failure-title-0",!1);else{var O=t("replaceHashMRB")(n.translate.page_roomisnolongeravl_MRTBRoomSelectorMsg,d.getRoomIndex(d.failedRoomsId[0]),n.reservationArray.length);m.pop({type:"error",title:"",body:O,timeout:3e3})}d.recallAPI(!0),0!=S&&(m.clear(),G(n.translate.global_makeselectionsfornextroom_MRTBSelectorInteractiveMsg),p.scrollTopAnimated(0,1e3))}R.stepsById.accommodations.placeholderMRB=v.getBookedRoomCount()}else v.setReservation(a),u.go("total");n.MRB&&(n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1),R.stepsById.total.placeholder=v.getTotalReservationAmount(),R.navToggle.totalSelected=!0}).error(function(){n.MRB&&(n.MULRIROOM_AVAILCALL=!1,n.showSpinner=!1),i=s,v.revertAccommadationRooms(),m.clear(),m.pop({type:"error",title:"",body:n.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}),n.bookedError=!0,a.clearAll(),d.recallAPI()})}}},d.showRatePolicies=function(a,t,o,i,s,l){d.autoCloseRatePlanDropdown="disabled",d.ratePlanDetails=a,d.showRatePlanDetail=!0,d.scrollTopRPPopup=r.pageYOffset+"px",d.clickFromRatePlanDropdown=t,d.isGroupRatePlan="Group"===a.ratePlanType,d.isConfidentialRatePlan=!(a.rate-a.discount!=0||n.hidePriceFromAttendees||!a.available),d.isMemberRatePlanTransparent=!1,void 0!=a.memberRateTransparent&&(l?(d.ratePlanDetails.roomTypeCode=l.roomTypeCode,d.isMemberRatePlanTransparent=!a.memberRateTransparent&&d.isMemberRateSignIn(l)):d.isMemberRatePlanTransparent=!a.memberRateTransparent&&d.isMemberRateSignIn(a)),d.clickFromRatePlanDropdown||d.isGroupRatePlan||d.isConfidentialRatePlan||d.isMemberRatePlanTransparent||(d.breakDown=!0,d.showPoliciesTab=!0,d.showTaxesTab=!1,U()),s?e.onModalOpen("PricingBox-info-circle-id-detail-"+a.ratePlanCode+"-"+o+"-"+i,"rate-plan-detail-popup-id","rate-plan-detail-title-id",!1,d.hideRatePolicies):t?e.onModalOpen("PricingBox-info-circle-id-"+a.ratePlanCode+"-rpFilter","rate-plan-detail-popup-id","rate-plan-detail-title-id",!1,d.hideRatePolicies):e.onModalOpen("PricingBox-info-circle-id-"+a.ratePlanCode+"-"+o+"-"+i,"rate-plan-detail-popup-id","rate-plan-detail-title-id",!1,d.hideRatePolicies)},d.hideRatePolicies=function(){d.showRatePlanDetail=!1,d.showPoliciesTab=!0,d.showTaxesTab=!1,setTimeout(function(){d.autoCloseRatePlanDropdown="always"},0),e.onModalClose()},v.getConfig("SHOW_ERROR_MESSAGE")&&(m.clear(),m.pop({type:"error",title:"",body:n.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}),d.navToggle.totalSelected=!1,v.deleteConfig("SHOW_ERROR_MESSAGE")),void 0!=d.navFilterData&&f.eventTrack("SelectRateFromList",{category:"UserNavigation",label:d.navFilterData.ratePlanCode.ratePlanCode}),d.addMultiRateTypeCode=function(e,a){e.currentCode=a.ratePlanCode,e.currentRate=a,d.multiRateCurrRatePlan=a,se=!0,1==e.isSelected?(e.myStyle="white",d.priceSlide.priceSlide=a.ratePlanCode,!0===e.currentRate.available?d.showCallToActionBtnList=!0:d.showCallToActionBtnList=!1,d.toggleRoomDetail(null,e)):(y(function(){e.myStyle="#116eb5"},800),d.showCallToActionBtnList=!1)},d.changeClickedRateBg=function(e){void 0!=z&&(z.isMultirateRadioClicked=!1),e.isMultirateRadioClicked=!0,z=e},d.viewAllRatePlans=function(a,t,o){d.temp=1,d.multiRateCurrentRoom=a,d.allRatePlans=a.priceTagRate;var n=r.pageYOffset;for(d.scrollTopallRPPopup=n+50+"px",d.showAllRatePlanPopup=!0,d.extendedPageNumber=[],d.selectedGridRow=t,w=0;w<d.multiRateCurrentRoom.priceTagRate.length;w++)d.multiRateCurrentRoom.priceTagRate[w].isToggle=!0;if(d.multiRateCurrentRoom.priceTagRate.length>5)for(d.pageNumbers=Math.ceil(d.allRatePlans.length/d.pageSize),w=0;w<d.pageNumbers;w++)d.extendedPageNumber.push(w+1);o?e.onModalOpen("view-all-rateplans-detail-"+a.roomTypeCode+"-"+t,"all-rate-plan-popup-id","all-rate-plan-title-id",!1,d.hideRatePolicies):e.onModalOpen("view-all-rateplans-"+a.roomTypeCode+"-"+t,"all-rate-plan-popup-id","all-rate-plan-title-id",!1,d.hideRatePolicies)},d.pagination=function(e){d.allRatePlans=[],d.temp=e;var a=d.pageSize*(e-1),t=d.pageSize*(e-1)+(d.pageSize-1);d.allRatePlans=d.multiRateCurrentRoom.priceTagRate.slice(a,t+1)},d.selectRateAndBook=function(a,t){a.currentCode=t.ratePlanCode,d.showAllRatePlanPopup=!1,e.onModalClose(),d.updateAccommodations(a)},d.rateDetailClick=function(e){for(w=0;w<d.multiRateCurrentRoom.priceTagRate.length;w++)d.multiRateCurrentRoom.priceTagRate[w].ratePlanCode==e.ratePlanCode?d.multiRateCurrentRoom.priceTagRate[w].isToggle=!d.multiRateCurrentRoom.priceTagRate[w].isToggle:d.multiRateCurrentRoom.priceTagRate[w].isToggle=!0},(v.getConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR")||n.displayMultiRateListView)&&(me=angular.copy(v.getMainReservation()),d.prevServiceReqOptions=void 0,me&&me.roomStays&&me.roomStays.length>0&&me.roomStays[0].ratePlans&&me.roomStays[0].ratePlans.length>0&&(d.prevServiceReqOptions={},d.prevServiceReqOptions.ratePlanCode=me.roomStays[0].ratePlans[0].ratePlanCode,d.prevServiceReqOptions.ratePlanType=me.roomStays[0].ratePlans[0].ratePlanType)),d.refreshEnhancementsWarning="display-none",d.refreshEnhancementsWarningOnRoomSwitch="display-none",j=!1,!A.getRecallAvailAsync()&&A.getIsLoyaltyUserLogIn()&&(A.setRecallAvailAsync(!0),d.$broadcast("LOYALTY_USER_LOGIN_SUCCESS")),A.setRecallAvailAsync(!0),setTimeout(x,1e3)}),window.innerWidth>786?d.hideEnhancementCheckBox=!0:d.hideEnhancementCheckBox=!1;var Te=function(){var e=v.getMainReservation();e&&e.services.length>0&&d.isModifyReservation&&(d.getEnhancementServices(),se=!0)};d.$on("LOYALTY_USER_LOGIN_SUCCESS",function(){A.getRecallAvailAsync()&&(v.setConfig("RES_SELECTION_CHANGE"),d.userLoggedIn=A.getIsLoyaltyUserLogIn(),E.isAudienceEvaluatorEnabled()?x():(d.recallAPI(),Te()),se=!0)}),d.$on("RECALL_AVAIL_API",function(e,a){var t=v.getMainReservation();t&&t.roomStays&&t.roomStays.length>0&&t.roomStays[0].ratePlans&&t.roomStays[0].ratePlans.length>0&&"Package"==t.roomStays[0].ratePlans[0].ratePlanType?d.packageSelected=!0:d.packageSelected=!1,a.recallApi&&d.recallAPI()}),d.$on("EVENT.GMS_REMOVE_PRIVATEOFFERS",function(){d.userLoggedIn=!1;var e,a=v.getMainReservation();if(n.MRB){e=v.getMainReservationArray();for(var t=0;t<e.length;t++)if(void 0!=e[t]&&void 0!=e[t].roomStays&&e[t].roomStays.length>0&&void 0!=e[t].roomStays[0].roomRates&&e[t].roomStays[0].roomRates.length>0&&void 0!=e[t].roomStays[0].roomRates[0].roomTypeCode&&void 0!=e[t].roomStays[0].ratePlans&&e[t].roomStays[0].ratePlans.length>0&&"Group"!=e[t].roomStays[0].ratePlans[0].ratePlanType){a=e[t];break}}var o=v.getGmsLoginState();d.enhancementServices=d.copyOfFormattedServicesData,d.listOfSelectedEnhancements=[],1==o&&void 0!=a.roomStays&&a.roomStays.length>0&&void 0!=a.roomStays[0].roomRates&&a.roomStays[0].roomRates.length>0&&void 0!=a.roomStays[0].roomRates[0].roomTypeCode&&void 0!=a.roomStays[0].ratePlans&&a.roomStays[0].ratePlans.length>0&&"Group"!=a.roomStays[0].ratePlans[0].ratePlanType&&(d.continueDeleteRatePlan(),d.continueDeleteRoom(),d.continueDeletePackage(),n.MRB&&(v.revertAllAccommodationsMrb(),R.stepsById.accommodations.placeholderMRB=v.getBookedRoomCount()))}),d.$on("LOYALTY_USER_LOGOUT_SUCCESS",function(){if(E.isAudienceEvaluatorEnabled()){E.resetAudienceLists(),E.resetReservationHistoryObject();var e=E.getAudienceEvaluatorCriteria(),a=g.getHotelDesc(),t=a&&a.chainInfo&&a.chainInfo.length?a.chainInfo[0]:"";c.callAudienceEvaluator(a.hotelCode,t,e).then(function(e){E.setAudienceLists(e.data),n.$broadcast("RECALL_MERCHANDISING_API"),w()},function(e){console.log(e),n.$broadcast("RECALL_MERCHANDISING_API"),w()})}else w()});var Oe=function(e,a){n.MRB?v.addGmsRateAccessCodeInReservation(a):v.addGmsRateAccessCodeInReservation(e),!d.oneRoomLeft&&n.gmsPromoCode&&n.MRB&&(e.posSource.requestorIds=a[0].posSource.requestorIds)};d.showMerchandisingDetailsModal=function(){d.showMerchandiseDetailsModal="display-block";var a=r.pageYOffset;if(r.innerWidth>767&&r.innerWidth<1023){var t=a-40+"px";d.fromTop=t}else if(r.innerWidth>1023&&r.innerWidth<1200){var t=a-150+"px";d.fromTop=t}else{var t=a-40+"px";d.fromTop=t}setTimeout(function(){e.onModalOpen("merchandising-detail-link","merchandising-details-parent-id","merchandising-details-title-id",!1,d.cancelMerchandisingDetails)})},d.cancelMerchandisingDetails=function(){d.showMerchandiseDetailsModal="display-none",e.onModalClose()},d.hideMerchandisingSlider=function(e){setTimeout(function(){angular.element(document.getElementById(e)).addClass("hideMerchandisingSlider")},1e3)},d.findAdultObject=function(e,a){return T.adultEnhancementPriceObj(e,a)},d.findChildObject=function(e,a){return T.childEnhancementPriceObj(e,a)},d.findRoomObject=function(e,a){return T.roomEnhancementPriceObj(e,a)},d.adultPriceBreakUp=function(e,a,t){return T.adultPriceBreakUp(e,a,t)},d.childPriceBreakUp=function(e,a,t){return T.childPriceBreakUp(e,a,t)},d.showDiscountedChildOnly=function(e,a,t){return T.showDiscountedChildOnly(e,a,t)},d.showSignInPopup=function(e,a,t,i){var s=angular.copy(e),l=angular.copy(t),c={};d.popUpOpenFromSignBookBtn=!0,a&&(d.selectedGridRow=a),d.clickEvent=i,null!=e&&null!=t?(l.ratePlanCode=l.ratePlanCode.indexOf("M_")>-1?l.ratePlanCode.replace("M_",""):l.ratePlanCode,c.roomTypeCode=s.roomTypeCode,c.ratePlanCode=l.ratePlanCode):(s.currentRate.ratePlanCode=s.currentRate.ratePlanCode.indexOf("M_")>-1?s.currentRate.ratePlanCode.replace("M_",""):s.currentRate.ratePlanCode,c.roomTypeCode=s.roomTypeCode.indexOf("M_")>-1?s.roomTypeCode.replace("M_",""):s.roomTypeCode,c.ratePlanCode=s.currentRate.ratePlanCode),e.categoryCode&&(c.categoryCode=e.categoryCode),d.selectedRoomBeforeSignIn=c,Y&&(A.getIsBrandBarDisplay()?A.fireLoyaltyEvent("MEMBER_RATE_LOYALTY_LOGIN"):D.getMenubarEnabled()&&A.getIsLoyaltyReservationEnabled()?r.TCCommonService.EventService.broadcast(document,"loyalty_guest_member_rate_signIn_modal"):q&&q.privateOffersEnabled&&n.$broadcast(o.GMS_SHOW_SIGNIN_FORM)),setTimeout(function(){p.scrollTopAnimated(0,1e3)},100)},n.$on("VIEW_ROOM_DETAILS",function(){Y&&d.popUpOpenFromSignBookBtn&&(d.popUpOpenFromSignBookBtn=!1,d.showRescheduleEnhancementsPopupOnRoomSwitch(d.selectedRoomBeforeSignIn,d.selectedGridRow,d.clickEvent))}),d.isMemberRateSignIn=function(e){var a=e.isMemberRatePlan,t=d.userLoggedIn;return!(!Y||a&&t||!a||t)},d.goPolicies=function(){d.showPoliciesTab=!0,d.showTaxesTab=!1,U()},d.goTaxes=function(e){if(d.showPoliciesTab=!1,d.showTaxesTab=!0,U(),d.roomInfo={},d.roomInfo.formattedTotal={rate:0,discount:0,taxesTotalAmount:0,roomTaxAmount:0,packagesTaxAmount:0},d.roomInfo.datesOfStay=[],d.roomInfo.packageInclusions=[],d.roomInfo.nightsCollapse=!d.enableExpandedDailyRates,d.roomInfo.breakDownNightsCollapse=!d.enableExpandedDailyRates,n.displayMultiRateListView){for(var a=n.RatesAvail.roomStays[0].allRoomTypes,o=0;o<a.length;o++)if(e.roomTypeCode===a[o].roomTypeCode){d.roomInfo.roomTypeName=a[o].roomTypeName;for(var r=0;r<a[o].priceTagRate.length;r++)if(e.ratePlanCode===a[o].priceTagRate[r].ratePlanCode){d.roomInfo.ratePlanType=a[o].priceTagRate[r].ratePlanType,d.roomInfo.available=a[o].priceTagRate[r].available,d.roomInfo.formattedTotal.rate=a[o].priceTagRate[r].rate,d.roomInfo.formattedTotal.discount=a[o].priceTagRate[r].discount;break}for(var i=0;i<a[o].nightlyRates.length;i++)e.ratePlanCode===a[o].nightlyRates[i].ratePlanCode&&("Package"===d.roomInfo.ratePlanType?d.roomInfo.datesOfStay.push({formattedDate:t("formatServicesDate")(a[o].nightlyRates[i].date),price:0===a[o].nightlyRates[i].amtBeforeTax?a[o].nightlyRates[i].amtBeforeTax:d.roomInfo.formattedTotal.rate,freeNightsDiscount:a[o].nightlyRates[i].discount}):d.roomInfo.datesOfStay.push({formattedDate:t("formatServicesDate")(a[o].nightlyRates[i].date),price:a[o].nightlyRates[i].amtBeforeTax,freeNightsDiscount:a[o].nightlyRates[i].discount}),d.roomInfo.formattedTotal.roomTaxAmount+=a[o].nightlyRates[i].totalExclusiveTaxes+a[o].nightlyRates[i].outTotalExclusiveTaxes);break}}else for(var s=n.RatesAvail.roomStays[0].roomTypes,o=0;o<s.length;o++)if(e.roomTypeCode===s[o].roomTypeCode){d.roomInfo.roomTypeName=s[o].roomTypeName;for(var r=0;r<s[o].priceTagRate.length;r++)if(e.ratePlanCode===s[o].priceTagRate[r].ratePlanCode){d.roomInfo.available=s[o].priceTagRate[r].available,d.roomInfo.ratePlanType=s[o].priceTagRate[r].ratePlanType,d.roomInfo.formattedTotal.rate=s[o].priceTagRate[r].rate,d.roomInfo.formattedTotal.discount=s[o].priceTagRate[r].discount;break}for(var i=0;i<s[o].nightlyRates.length;i++)e.ratePlanCode===s[o].nightlyRates[i].ratePlanCode&&("Package"===d.roomInfo.ratePlanType?d.roomInfo.datesOfStay.push({formattedDate:t("formatServicesDate")(s[o].nightlyRates[i].date),price:0===s[o].nightlyRates[i].amtBeforeTax?s[o].nightlyRates[i].amtBeforeTax:d.roomInfo.formattedTotal.rate,freeNightsDiscount:s[o].nightlyRates[i].discount}):d.roomInfo.datesOfStay.push({formattedDate:t("formatServicesDate")(s[o].nightlyRates[i].date),price:s[o].nightlyRates[i].amtBeforeTax,freeNightsDiscount:s[o].nightlyRates[i].discount}),d.roomInfo.formattedTotal.roomTaxAmount+=s[o].nightlyRates[i].totalExclusiveTaxes+s[o].nightlyRates[i].outTotalExclusiveTaxes);break}d.roomInfo.guestCounts={adults:0,children:0,infants:0};var l=v.getMainReservation().resGlobalInfo.guestCounts;angular.forEach(l,function(e,a){"10"===e.ageQualifyingCode?d.roomInfo.guestCounts.adults+=Number(e.count):"8"===e.ageQualifyingCode?d.roomInfo.guestCounts.children+=Number(e.count):"7"===e.ageQualifyingCode&&(d.roomInfo.guestCounts.infants+=Number(e.count))}),n.MRB?d.roomInfo.roomsCount=1:d.roomInfo.roomsCount=n.numberOfRooms;var c=v.getMainReservation().resGlobalInfo.timeSpan.end,m=v.getMainReservation().resGlobalInfo.timeSpan.start;if(d.roomInfo.numberOfDays=Math.abs(moment.utc(c).diff(moment.utc(m),"days")),"Package"===d.roomInfo.ratePlanType){for(var u=n.RatesAvail.roomStays[0].packageTypes,p=[],o=0;o<u.length;o++)if(e.ratePlanCode===u[o].packageCode){p=u[o].inclusions;break}angular.forEach(p,function(e){if("PACKAGE_INCLUSION"===e.serviceCategory){var a=[],o=0,r=0,i=0,s=0,l={serviceTypeId:e.serviceTypeId,serviceName:e.serviceName,servicePricingType:e.servicePricingType,serviceCategory:e.serviceCategory,sortOrder:e.sortOrder,discountRuleId:e.discountRuleId,quantities:{},daysArray:[]};if(angular.forEach(e.serviceOptions,function(t){var r=S.uniq(t.dailyRates,"serviceDate");o+=r.length;var n=angular.copy(t.dailyRates);angular.forEach(t.dailyRates,function(t){if(("PER_PERSON"===e.servicePricingType||"PER_PERSON_PER_NIGHT"===e.servicePricingType)&&n.length>0){for(var o=0,r=0,i=0;n.length>i;i++)n[i].serviceDate===t.serviceDate&&(o+=n[i].adultQuantity,r+=n[i].childQuantity);a.push({quantity:o+r,adultsCount:o,childrenCount:r})}})}),"PER_RESERVATION"===e.servicePricingType?l.quantities={}:"PER_PERSON"===e.servicePricingType||"PER_PERSON_PER_NIGHT"===e.servicePricingType?(r=S.last(S.sortBy(a,"quantity")).adultsCount,i=S.last(S.sortBy(a,"quantity")).childrenCount,"PER_PERSON"===e.servicePricingType?l.quantities={adultsCount:r,childCount:i}:"PER_PERSON_PER_NIGHT"===e.servicePricingType&&(l.quantities={adultsCount:r,childCount:i,nightsCount:o})):"PER_ROOM"!==e.servicePricingType&&"PER_ROOM_PER_NIGHT"!==e.servicePricingType||(s=n.MRB?1:n.numberOfRooms,"PER_ROOM"===e.servicePricingType?l.quantities={roomsCount:s}:"PER_ROOM_PER_NIGHT"===e.servicePricingType&&(l.quantities={roomsCount:s,nightsCount:o})),"PER_RESERVATION"===e.servicePricingType||"PER_ROOM"===e.servicePricingType){var c=e.serviceOptions[0].dailyRates[0];l.daysArray.push({formattedDate:t("formatServicesDate")(c.serviceDate),price:c.price[0].taxAmount})}else if("PER_PERSON"===e.servicePricingType){var g=e.serviceOptions[0].dailyRates[0],m=0;angular.forEach(g.price,function(e){m+=e.taxAmount}),l.daysArray.push({formattedDate:t("formatServicesDate")(g.serviceDate),price:m})}else angular.forEach(e.serviceOptions,function(a){var o=e.serviceOptions[0].dailyRates;angular.forEach(o,function(e){var a=0;angular.forEach(e.price,function(e){a+=e.taxAmount}),l.daysArray.push({formattedDate:t("formatServicesDate")(e.serviceDate),price:a})})});"PACKAGE_INCLUSION"===e.serviceCategory&&d.roomInfo.packageInclusions.push(l)}}),angular.forEach(d.roomInfo.packageInclusions,function(e){angular.forEach(e.daysArray,function(e){d.roomInfo.formattedTotal.packagesTaxAmount+=e.price})})}d.roomInfo.formattedTotal.taxesTotalAmount=d.roomInfo.formattedTotal.roomTaxAmount+d.roomInfo.formattedTotal.packagesTaxAmount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?d.roomInfo.formattedTotal.taxesTotalAmount=parseFloat(d.roomInfo.formattedTotal.taxesTotalAmount).toFixed(2):d.roomInfo.formattedTotal.taxesTotalAmount=parseFloat(d.roomInfo.formattedTotal.taxesTotalAmount).toFixed(0)},d.installmentTooltipShowHide=function(e){var a=document.querySelectorAll(".tooltip");"installmentLinkID"==e.target.id&&a.length?(a[0].style.display="block",a[0].style.visibility="visible",a[0].style.opacity="1"):a.length&&(a[0].style.display="none",a[0].style.visibility="hidden",a[0].style.opacity="0")}}function accommodationFilterPosition(e){return{restrict:"A",link:function(a,t){if(e.isProgressBarEnabled){var o=0;a.$watch(function(){var e=document.getElementById("accommodation-room-package-button-id");e&&o!=e.offsetHeight&&t&&t.length&&t[0]&&(t[0].style.marginTop=e.offsetHeight+"px",o=e.offsetHeight)})}}}}function timer(e,a){function t(t,o,r){var n,i;t.$watch("time",function(){n=t.time,i=Math.floor((n-Date.now())/1e3);var o=a(function(){t.left=n-Date.now(),i=Math.floor((n-Date.now())/1e3),Math.floor((n-Date.now())/1e3)<=0&&(a.cancel(o),i=0,t.left=0),t.text=e.dhms(i)},1e3)})}return{scope:{left:"=",time:"=",text:"="},transclude:!0,restrict:"E",link:t,template:' <span class="timeCountDown"><span ng-transclude></span> {{text}}</span>'}}function accommodationPackageDetailList(e,a,t,o){function r(e,t,o){e.closeIcon=function(e){1==e.isSelected?e.myStyle="white":a(function(){e.myStyle="#116eb5"},800)}}return{restrict:"E",templateUrl:"./accommodation/accommodationPackageDetailList.html",link:r}}function accommodationRoomDetail(e,a,t,o){function r(e,r,n){e.setCarousel=function(e){for(var a=0;a<e.length;a++)0==e[a].sortOrder?e[a].active=!0:e[a].active=!1},e.addRateTypeCode=function(a){a.currentCode=e.priceSlide.priceSlide},e.makeUndefined=function(){},e.setRadioButton=function(a){for(var o=0;o<a.priceTagRate.length;o++)a.priceTagRate[o].policiesVisble=!1;a.currentCode=e.navFilterData.ratePlanCode.ratePlanCode,e.moreOptions=!1,e.limit=2,1==a.isSelected?(a.myStyle="white",e.priceSlide.priceSlide=e.navFilterData.ratePlanCode.ratePlanCode,!0===a.currentRate.available?e.showCallToActionBtnGrid=!0:e.showCallToActionBtnGrid=!1):e.showCallToActionBtnGrid=!1,void 0!=a.tag&&t.eventTrack("ClickRoomWithTag",{category:"UserNavigation",label:a.roomTypeCode})},e.closeIcon=function(e){1==e.isSelected?e.myStyle="white":a(function(){e.myStyle="#116eb5"},800)},e.showPolicies=function(e,a){for(var t=0;t<e.priceTagRate.length;t++)e.priceTagRate[t].ratePlanCode==a.ratePlanCode&&(e.priceTagRate[t].policiesVisble=!e.priceTagRate[t].policiesVisble)},e.showMoreOptions=function(a,t,o,r){document.getElementById(t),angular.element(a.currentTarget.offsetParent)[0].getElementsByClassName("PricingBox-content--itemized")[0],window.innerHeight,e.moreOptions=!e.moreOptions,0==e.moreOptions?e.limit=2:e.limit=200,setTimeout(function(){var e=document.getElementById("rate-plan-pricing-box-grid-0-"+o+"-"+r);e&&e.focus()})},e.$on(o.CONTINUE_TO_SWITCH_ROOM_DETAIL,function(a,t){e.setRadioButton(t),e.setCarousel(t.media)})}return{restrict:"E",templateUrl:"./accommodation/accommodationRoomDetail.html",link:r}}function accommodationRoomDetailList(e,a,t,o){function r(r,n,i,s){r.setCarousel=function(e){for(var a=0;a<e.length;a++)0==e[a].sortOrder?e[a].active=!0:e[a].active=!1},r.addRateTypeCode=function(e){e.currentCode=r.priceSlide.priceSlide},r.makeUndefined=function(){e.debug("undefined"),r.priceSlide.priceSlide=void 0},r.setRadioButton=function(e){for(var o=0;o<e.priceTagRate.length;o++)e.priceTagRate[o].policiesVisble=!1;e.currentCode=r.navFilterData.ratePlanCode.ratePlanCode,r.moreOptions=!1,r.limit=2,1==e.isSelected?(e.myStyle="white",r.priceSlide.priceSlide=r.navFilterData.ratePlanCode.ratePlanCode,!0===e.currentRate.available?r.showCallToActionBtnList=!0:r.showCallToActionBtnList=!1):(r.priceSlide.priceSlide=void 0,a(function(){e.myStyle="#116eb5"},800),r.showCallToActionBtnList=!1),void 0!=e.tag&&t.eventTrack("ClickRoomWithTag",{category:"UserNavigation",label:e.roomTypeCode})},r.closeIcon=function(e){1==e.isSelected?e.myStyle="white":a(function(){e.myStyle="#116eb5"},800)},r.showPolicies=function(e,a){for(var t=0;t<e.priceTagRate.length;t++)e.priceTagRate[t].ratePlanCode==a.ratePlanCode&&(e.priceTagRate[t].policiesVisble=!e.priceTagRate[t].policiesVisble)},r.showMoreOptions=function(e,a,t,o){document.getElementById(a),angular.element(e.currentTarget.offsetParent)[0].getElementsByClassName("PricingBox-content--itemized")[0],window.innerHeight,r.moreOptions=!r.moreOptions,0==r.moreOptions?r.limit=2:r.limit=200,setTimeout(function(){var e=document.getElementById("rate-plan-pricing-box-list-0-"+t+"-"+o);e&&e.focus()})},r.$on(o.CONTINUE_TO_SWITCH_ROOM_DETAIL,function(e,a){r.setRadioButton(a),r.setCarousel(a.media)})}return{restrict:"E",templateUrl:"./accommodation/accommodationRoomDetailList.html",link:r}}function accommodationPackageDetail(e,a,t,o){function r(e,t,o){e.closeIcon=function(e){1==e.isSelected?e.myStyle="white":a(function(){e.myStyle="#116eb5"},800)}}return{restrict:"E",templateUrl:"./accommodation/accommodationPackageDetail.html",link:r}}function accommodationPList(e){function a(a,t,o){a.changeSVG=function(a){1==a.isSelected?a.myStyle="white":e(function(){a.myStyle="#116eb5"},800)}}return{restrict:"E",templateUrl:"./accommodation/accommodationPList.html",link:a}}function accommodationRowpackage(){return{restrict:"E",templateUrl:"./accommodation/accommodationRowpackage.html",link:function(e,a,t){e.gridRowPackage=t.specificRow}}}function accommodationRow(){return{restrict:"E",templateUrl:"./accommodation/accommodationRow.html",link:function(e,a,t){e.gridRow=t.specificRow}}}function accommodationGridRow(e){return{restrict:"E",templateUrl:"./accommodation/accommodationGridRow.html",link:function(e,a,t){e.gridRow=t.specificRow}}}function accommodationListRow(){return{restrict:"E",templateUrl:"./accommodation/accommodationListRow.html",link:function(e,a,t){e.gridRow=t.specificRow}}}function accommodationGrid(){return{restrict:"E",templateUrl:"./accommodation/accommodationGrid.html"}}function accommodationGridPackage(){return{restrict:"E",templateUrl:"./accommodation/accommodationGridPackage.html"}}function accommodationList(e,a){function t(t,o,r){t.gridRow=r.specificRow,t.changeSVG=function(a){1==a.isSelected?a.myStyle="#116eb5":e(function(){a.myStyle="#116eb5"},800)},t.$on(a.CONTINUE_TO_SWITCH_ROOM_DETAIL,function(e,a){t.changeSVG(a)})}return{restrict:"E",templateUrl:"./accommodation/accommodationList.html",link:t}}function accommodationListPackage(){return{restrict:"E",templateUrl:"./accommodation/accommodationListPackage.html",link:function(e,a,t){e.gridRowPackage=t.specificRow}}}function showRatePlanDetail(){return{restrict:"E",replace:!0,templateUrl:"./accommodation/showRatePlanDetail.html"}}function accommodationGetOffset(e,a,t,o,r){return{restrict:"A",scope:{containerId:"=",layoutType:"@"},link:function(e,o,n){function i(){var a=document.getElementById(e.layoutType+"-sticky-anchor"+e.containerId),t=document.getElementById(e.layoutType+"view"+e.containerId),o=document.getElementById(e.layoutType+"sticky"+e.containerId);if(a&&t&&o){var r=document.documentElement,n=(window.pageYOffset||r.scrollTop)-(r.clientTop||0),i=a.getBoundingClientRect().top+window.pageYOffset-10,m=window.pageYOffset+t.getBoundingClientRect().top+t.offsetHeight-l;n+d>i?(o.classList.add("stick"),o.style.top=d+"px",o.style.width=g):o.classList.remove("stick");n+d-(s?c:s)>m&&o.classList.remove("stick");var u=t.getElementsByClassName("RoomDetail-pricingBox")[0];if(u){var p=window.outerHeight,y=u.offsetHeight;if(d+y>p){var v=u.getElementsByClassName("PricingBox-content")[0];pricingBoxBodyElementHeight=v.offsetHeight,v.style.height=p-(y-pricingBoxBodyElementHeight+d)+"px"}window.pageYOffset+u.offsetHeight+160>m&&o.classList.remove("stick")}}}var s=0,l=0,c=0,c=document.getElementsByTagName("nav-bar")[0].offsetHeight;document.getElementsByClassName("header-multiroom-info")[0]&&(l=document.getElementsByClassName("header-multiroom-info")[0].clientHeight),l+=50;var d=c+s+l,g="320px";navigator.userAgent.match(/iPad/i)&&(g="310px"),a.on("scroll",function(){t.innerWidth>991&&r.includes("accommodation")&&i()})}}}function accommodationCustomBookBtn(e,a,t,o){return{restrict:"A",link:function(e,r,n){function i(e,a){for(var t in a)e.style[t]=a[t]}var s=r[0].getElementsByClassName("accommodation-detail-bookNow");a[0].querySelector(".AccommodationsGrid-row .AccommodationsGrid-card")&&a[0].querySelector(".AccommodationsGrid-row .AccommodationsGrid-card").getBoundingClientRect().height,a.on("scroll",function(r){if(t.innerWidth<768){angular.forEach(s,function(e){e.classList.remove("PackageDetails-button-second")});var n,l,c=e.btnPosition,d=e.currTop;void 0!=e.currRowDetailId&&(n=a[0].getElementById("room-detail-close-"+e.currRowDetailId),a&&a.length>0&&a[0].getElementById("rowDetail"+e.currRowDetailId)&&(l=a[0].getElementById("rowDetail"+e.currRowDetailId).offsetHeight));var g=e.closeBtnPosition;l=l+g-150;var m=a.scrollTop();angular.forEach(s,function(e){c>m&&m>d?i(e,{position:"fixed",bottom:0}):i(e,{position:"inherit"})}),void 0!=n&&(g<m&&l>m?1==o.fullWidthLogoEnabled?i(n,{position:"fixed",top:"135px"}):i(n,{position:"fixed",top:"80px"}):i(n,{position:"absolute",top:"15px"}))}})}}}function svgImport(){return{restrict:"A",scope:{url:"@"},controller:["$scope","svgCacheService",function(e,a){e.loadSvg=a.getSvgFile}],link:function(e,a,t){function o(e,a,t,o,r,n,i){if(angular.element(a).attr("focusable",!1),angular.element(a).attr("aria-hidden",!0),angular.element(a).attr("role","none"),void 0!==typeof t&&angular.element(a).attr("id",t),void 0!==typeof o){var s=void 0!==angular.element(a).attr("class")?angular.element(a).attr("class"):"";angular.element(a).attr("class",o+" "+s+" replaced-svg")}void 0!==typeof r&&angular.element(a).attr("data-url",r),angular.forEach(n,function(e,t){a[0].setAttribute("data-"+e,t)});var l=parseFloat(angular.element(a).attr("width")),c=parseFloat(angular.element(a).attr("height"));i.w&&i.h?(angular.element(a).attr("width",i.w),angular.element(a).attr("height",i.h)):i.w?(angular.element(a).attr("width",i.w),angular.element(a).attr("height",c/l*i.w)):i.h&&(angular.element(a).attr("height",i.h),angular.element(a).attr("width",l/c*i.h)),e.replaceWith(a)}var r=e.url;if(r){var n=a.attr("id"),i=a.attr("class"),s=a.clone(!0).data();a.css("visibility","hidden");var l={w:a.attr("width"),h:a.attr("height")};e.loadSvg(r,function(e){var t,c=document.createElement("x");c.innerHTML=e,t=c.getElementsByTagName("svg")[0],o(a,t,n,i,r,s,l)})}}}}function equalizeHeight(e){return{restrict:"A",controller:["$scope",function(a){var t=[];this.addElement=function(e){t.push(e)},this.resize=function(){e(function(){var e,a=0;angular.forEach(t,function(t){(e=t[0].offsetHeight)>a&&(a=e)}),angular.forEach(t,function(e){e[0].style.height=a+"px"})},0)}}]}}function equalizeHeightAdd(e){return{restrict:"A",require:"^^equalizeHeight",link:function(e,a,t,o){o.addElement(a),e.$last&&o.resize()}}}function accommodationMultirateList(e,a){function t(t,o,r){t.gridRow=r.specificRow,e(function(){if(void 0==document.getElementById("multiratePriceCss")){var e=document.getElementsByClassName("CardList-price");if(e[0]){var a=getComputedStyle(e[0]).color,t=getComputedStyle(e[0]).backgroundColor,o=document.createElement("style");o.type="text/css",o.id="multiratePriceCss",o.innerHTML=".PricingBox-option-multirate:hover {background-color: "+t+"!important;color:"+a+"!important;}.is-multirate-radio-clicked{background-color: "+t+"!important;color:"+a+"!important;}",document.getElementsByTagName("head")[0]&&document.getElementsByTagName("head")[0].appendChild(o)}}},0),t.changeSVG=function(a){1==a.isSelected?a.myStyle="#116eb5":e(function(){a.myStyle="#116eb5"},800)},t.$on(a.CONTINUE_TO_SWITCH_ROOM_DETAIL,function(e,a){t.changeSVG(a)})}return{restrict:"E",replace:!0,templateUrl:"./accommodation/accommodationMultirateList.html",link:t}}function multirateRoomDetailList(e,a,t){function o(o,r,n){o.setCarousel=function(e){for(var a=0;a<e.length;a++)0==e[a].sortOrder?e[a].active=!0:e[a].active=!1},o.addRateTypeCode=function(e,a){e.currentCode=a.ratePlanCode,e.currentRate=a,o.multiRateCurrRatePlan=a},o.setRadioButton=function(t){var r=o.multiRateRadio[t.roomTypeCode];r=r.split("_"),void 0!=r&&r.length>0&&(r="M"!==r[1]?r[1]:r[1].concat("_",r[2])),t.currentCode=r,o.limit=4;for(var n=0;n<t.priceTagRate.length;n++)t.priceTagRate[n].policiesVisble=!1,t.priceTagRate[n].ratePlanCode==r&&(o.multiRateCurrRatePlan=t.priceTagRate[n]);1==t.isSelected?(t.myStyle="white",o.priceSlide.priceSlide=r,!0===t.currentRate.available?o.showCallToActionBtnList=!0:o.showCallToActionBtnList=!1):(e(function(){t.myStyle="#116eb5"},800),o.showCallToActionBtnList=!1),void 0!=t.tag&&a.eventTrack("ClickRoomWithTag",{category:"UserNavigation",label:t.roomTypeCode})},o.closeIcon=function(a){1==a.isSelected?a.myStyle="white":e(function(){a.myStyle="#116eb5"},800)},o.$on(t.CONTINUE_TO_SWITCH_ROOM_DETAIL,function(e,a){o.setRadioButton(a),o.setCarousel(a.media)})}return{restrict:"E",templateUrl:"./accommodation/multirateRoomDetailList.html",link:o}}function allRatePlansPopup(e){return{restrict:"E",replace:!0,templateUrl:"./accommodation/allRatePlansPopup.html",link:function(a,t,o){a.hideAllRateplanPopup=function(){e.onModalClose(),a.showAllRatePlanPopup=!1}}}}function ellipsisFilterForGeoPricing(){return function(e,a,t){return void 0!=e&&e.length>a&&1==t?e.substr(0,a)+"...":e}}function unescapeFilter(){function e(e){if(t[e])return t[e];null===a&&(a=document.createElement("textarea")),a.innerHTML=e;var o=a.firstChild.nodeValue;return t[e]=o,o}var a=null,t={};return function(a){return e(a)}}function htmlUnicodeFilter(e){return function(a){return e.trustAsHtml(a)}}function ellipsisFilter(){return function(e,a){return void 0!=e&&e.length>a?e.substr(0,a)+"...":e}}function capitlizeFilter(){return function(e,a){var t=a?/([^\W_]+[^\s-]*) */g:/([^\W_]+[^\s-]*)/;return e?e.replace(t,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()}):""}}function ratePlanFilter(){return function(e){return e.price=e.leadRate-e.discountRate,e.ratePlanName+" - "+e.price}}function guestsFilter(e){return function(a){return a>1?a+"  "+e.translate.page_guests_PriceBoxLbl:a+" "+e.translate.page_guest_GuestLbl}}function daysFilter(){return function(e){return 1===e?e+" Day":e+" Days"}}function nightsFilter(e){return function(a){return a>1?a+"  "+e.translate.page_accommodations_msgNights:a+" "+e.translate.global_Night_NightLbl}}function roomSizeFilter(e,a){return function(t){return void 0!=t&&t.indexOf("Sq m")>-1&&t.indexOf("Sq ft")>-1?(t=t.replace("Sq m",e.translate.page_meterssquared_UniversalMetricLbl),t=t.replace("Sq ft",e.translate.page_feetsquared_UniversalImperialLbl),a.trustAsHtml(t)):t}}function ConfirmationController(e,a,t,o,r,n,i,s,l,c,d,g,m,u,p,y,v,h,R,f,C,P,S,A,I){function b(){if(document.querySelector(".Footer-wrap")){var e=getComputedStyle(document.querySelector(".Footer-wrap")).backgroundColor,a=document.createElement("style");a.type="text/css";var t=".room-icon-stroke * {stroke: "+e+"}";a.innerHTML=t,
document.getElementsByTagName("head")&&document.getElementsByTagName("head")[0]&&document.getElementsByTagName("head")[0].appendChild(a)}}function D(e,a){t.getEnhancementServices(e).then(function(e){J=e;var t=angular.copy(c.getMainReservation().roomStays[0]);t.roomRates[0].currentRate||(t.roomRates[0].currentRate=t.ratePlans[0]);var o=a||t.roomRates[0];Q(o),i.enhancementServices&&0==i.enhancementServices.length&&i.isEnhancementUpsellEnabled&&(i.showEnhancementsUnavailModal=!0,h.onModalOpen("","enhance-unavail-modal-body","enhancements-unavail-title-id",!1,i.closeEnhancementsUnavailModal))})}function T(a,t){if(1==a.allSelected){e.debug(JSON.stringify(t)+"currentServices"),e.debug(JSON.stringify(a)+"currentService");var o,r,i,s,l,d={};if(a.adult>0&&(o=angular.copy(a.adult),d.adults=o),a.children>0&&(r=angular.copy(a.children),d.children=r),a.room>0&&(s=angular.copy(a.room),d.room=s),void 0==a.serviceDate||"PER_ROOM"==t.servicePricingType&&"PER_PERSON"==t.servicePricingType||(l="PER_RESERVATION"==t.servicePricingType?angular.copy(a.date):angular.copy(a.serviceDate),"PER_PERSON"!=t.servicePricingType&&"PER_ROOM"!=t.servicePricingType&&(d.date=l)),void 0!=a.selectOption&&(i=angular.copy(a.selectOption.serviceOptionId),d.selectOption=i),void 0!=c.getMainReservationArray()){for(var g,u=0;u<c.getMainReservationArray().length;u++)if(c.getMainReservationArray()[u].id==c.getMainReservation().id){g=u,g++;break}n.gmsId=g}m.eventTrack("serviceOptions",{category:"UserNavigation",label:d}),n.gmsId=void 0}}function O(e){return e.length>0}g.getEnableInsurance()&&(i.insuranceData=I.getSelectedInsurance(),i.insuranceData&&i.insuranceData.insuranceErrorData&&i.insuranceData.insuranceErrorData.errorCode&&(i.insuranceData.insuranceErrorData.translationErrorMessage=n.translate["page_failedtobookinsurance-Msgfailedtobooktheinsurance"])),g.getUxConfiguration().accomodationsConfig.hideEnhancementScheduling&&(i.removeEnhancementBtnFlag=g.getUxConfiguration().accomodationsConfig.hideEnhancementScheduling),i.isFinalConfirmation=!0,c.setTaxBreakDownFinalConfirmation(!0),setTimeout(b,1e3),i.voucherPaymentProvidersList=f.getVoucherPaymentProvidersList(),i.fixedMerchandiseCurrency=c.getFixedMerchandisedCurrency();var E=!1;i.isPaidThroughLoyalty=!1,i.isPaidThroughVoucher=!1,n.enablePromotionBanner=!1,i.taxBreakoutEnabled=!1,i.currencyDetail=c.getCurrencyDetails();var M=c.canModifyReservation();i.isConfidentialRatePlanSelected=!1,i.enableExpandedDailyRates=g.getUxConfiguration().reservationAndPaymentConfig.enableExpandedDailyRates,i.isEnhancementUpsellEnabled=c.isUpsellEnabled()&&"services"===c.getUpsellParams().type,i.showUpsellSuccessModal=!1,i.showEnhancementsUnavailModal=!1,i.upsellPerformed=!1,n.hideModifyCancelResLinkforUpsellEnhancements="confirmation"===s.current.name&&i.isEnhancementUpsellEnabled,i.showMerchandiseDetailsModal="display-none",i.merchandisingInfo={},c.getConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK")?c.getConfig("SHOW_MERCHANDISED_CURRENCY")&&i.currencyDetail.isMerchandisedCurrency?i.isSelectedCurrencyMerchandised=!0:i.isSelectedCurrencyMerchandised=!1:c.getConfig("POST_BOOKING_ENHANCEMENT")&&i.currencyDetail.isMerchandisedCurrency?i.isSelectedCurrencyMerchandised=!0:i.isSelectedCurrencyMerchandised=i.currencyDetail.isMerchandisedCurrency,i.isSelectedCurrencyMerchandised||R.fireLoyaltyEvent("currency_changed",{detail:{currency:g.getCurrentCurrency().currencyCode}});var _=i.isSelectedCurrencyMerchandised?"currencyConversionWithTwoDecimalPlaces":i.fixedMerchandiseCurrency?"currencyConversionWithTwoDecimalPlaces":"defaultCurrencySymbol";if(function(){var e=g.getDefaultCurrency().currencyCode,a=c.getFixedMerchandisedCurrency();i.currencyMsg="",M?i.currencyMsg="":i.currencyDetail.isMerchandisedCurrency&&!a?i.currencyMsg=y("replaceHashMRB")(n.translate.global_alertmerchandise_PricesAreShownMsg,i.currencyDetail.currencyCode,e):i.currencyDetail.isDefaultCurrency||a?i.currencyMsg="":i.currencyMsg=y("replaceHashMRB")(n.translate.page_alertnonmerchandise_PricesInShownMsg,i.currencyDetail.currencyCode,e)}(),n.MRB&&1==c.getMainReservationArray().length||!n.MRB){var k=c.getMainReservation();k.promotionObject?(n.promotionBannerObject=k.promotionObject,n.enablePromotionBanner=!0):n.enablePromotionBanner=!1}else n.enablePromotionBanner=!1;if(n.MRB){i.mainReservationArray=angular.copy(c.getMainReservationArray()),i.postBookingRoomInContext=i.mainReservationArray[0];var N=0;if(i.mainReservationArray.length>1){i.itineraryTotals=angular.copy(c.getMrbItineraryTotals()),"currencyConversionWithTwoDecimalPlaces"==_&&i.fixedMerchandiseCurrency&&(E=i.fixedMerchandiseCurrency),i.itineraryTotals.formattedItineraryRoomSubTotal=y(_)(i.itineraryTotals.itineraryRoomSubTotal,E);var L=0;i.itineraryTotals.itineraryRoomTotalTaxes&&(i.itineraryTotals.itineraryResortFeeTotal&&(L+=Number(i.itineraryTotals.itineraryResortFeeTotal)),i.itineraryTotals.itineraryServiceChargeTotal&&(L+=Number(i.itineraryTotals.itineraryServiceChargeTotal)),i.itineraryTotals.itineraryRoomTotalTaxes=Number(i.itineraryTotals.itineraryRoomTotalTaxes)-Number(L)),i.itineraryTotals.formattedItineraryRoomTotalTaxes=y(_)(i.itineraryTotals.itineraryRoomTotalTaxes,E),i.itineraryTotals.formattedItineraryResortFeeTotal=y(_)(i.itineraryTotals.itineraryResortFeeTotal,E),i.itineraryTotals.formattedItineraryServiceChargeTotal=y(_)(i.itineraryTotals.itineraryServiceChargeTotal,E),i.itineraryTotals.formattedItineraryRoomGrandTotal=y(_)(i.itineraryTotals.itineraryRoomGrandTotal,E),i.itineraryTotals.formattedItineraryOutTotalInclusiveResortFeeTotal=y(_)(i.itineraryTotals.itineraryOutTotalInclusiveResortFeeTotal,i.fixedMerchandiseCurrency),i.itineraryTotals.formattedItineraryOutTotalInclusiveServiceChargeTotal=y(_)(i.itineraryTotals.itineraryOutTotalInclusiveServiceChargeTotal,i.fixedMerchandiseCurrency),i.itineraryTotals.formattedItineraryOutTotalInclusiveTaxTotal=y(_)(i.itineraryTotals.itineraryOutTotalInclusiveTaxTotal,i.fixedMerchandiseCurrency),i.itineraryTotals.formattedItineraryOutTotalExclusiveResortFeeTotal=y(_)(i.itineraryTotals.itineraryOutTotalExclusiveResortFeeTotal,i.fixedMerchandiseCurrency),i.itineraryTotals.formattedItineraryOutTotalExclusiveServiceChargeTotal=y(_)(i.itineraryTotals.itineraryOutTotalExclusiveServiceChargeTotal,i.fixedMerchandiseCurrency),i.itineraryTotals.formattedItineraryOutTotalExclusiveTaxTotal=y(_)(i.itineraryTotals.itineraryOutTotalExclusiveTaxTotal,i.fixedMerchandiseCurrency),i.itineraryTotals.hasOutTotalInclusive=i.itineraryTotals.itineraryOutTotalInclusiveResortFeeTotal>0||i.itineraryTotals.itineraryOutTotalInclusiveServiceChargeTotal>0||i.itineraryTotals.itineraryOutTotalInclusiveTaxTotal>0,i.itineraryTotals.hasOutTotalExclusive=i.itineraryTotals.itineraryOutTotalExclusiveResortFeeTotal>0||i.itineraryTotals.itineraryOutTotalExclusiveServiceChargeTotal>0||i.itineraryTotals.itineraryOutTotalExclusiveTaxTotal>0,p.forEach(i.mainReservationArray,function(e){e.isConfidential&&(i.isConfidentialRatePlanSelected=!0),c.setMainReservation(e.id),e.totalRoomData=c.getFormattedReservationData(_),e.totalRoomData.roomsData[0].nightsCollapse=!i.enableExpandedDailyRates,e.totalRoomData.roomsData[0].breakDownNightsCollapse=!i.enableExpandedDailyRates,e.totalRoomData.formattedSubtotalExcludeDiscount=y(_)(e.totalRoomData.subtotalExcludeDiscount,E),e.totalRoomData.formattedSubtotal=y(_)(e.totalRoomData.subtotal,E),e.totalRoomData.formattedTaxes=y(_)(e.totalRoomData.taxes,E),e.totalRoomData.formattedResortFees=y(_)(e.totalRoomData.resortFees,E),e.totalRoomData.formattedServiceCharge=y(_)(e.totalRoomData.serviceCharge,E),e.totalRoomData.formattedTotal=y(_)(e.totalRoomData.total,E),i.taxBreakoutEnabled=i.taxBreakoutEnabled||e.totalRoomData.taxBreakoutEnabled,angular.forEach(e.totalRoomData.roomsData,function(e,a){e.formattedTotalRoomPrice=y(_)(e.totalRoomPrice,E),angular.forEach(e.datesOfStay,function(e){e.formattedDate=y("formatServicesDate")(e.date),e.formattedPrice=y(_)(e.price,E)})}),angular.forEach(e.totalRoomData.packageInclusions,function(e,a){angular.forEach(e.daysArray,function(e){e.formattedDate=y("formatServicesDate")(e.date),e.formattedPrice=y(_)(e.price,E)})}),angular.forEach(e.totalRoomData.enhancements,function(e,a){e.formattedServiceTotalPrice=y(_)(e.serviceTotalPrice,E),angular.forEach(e.daysArray,function(e){e.formattedDate=y("formatServicesDate")(e.date),e.formattedPrice=y(_)(e.price,E)})}),void 0!=e.resGlobalInfo.comments[0]&&void 0!=e.resGlobalInfo.comments[0].comment?e.commentFlag=O(e.resGlobalInfo.comments[0].comment):e.commentFlag=!1})}c.setMainReservation(c.getMainReservationArray()[0].id)}if(!n.MRB||n.MRB&&1==c.getMainReservationArray().length){var G=c.getMainReservation();i.isConfidentialRatePlanSelected=!!G.isConfidential}if(R.getIsLoyaltyReservationEnabled()||f.getEnableVoucherPayment())if("currencyConversionWithTwoDecimalPlaces"==_&&i.fixedMerchandiseCurrency&&(E=i.fixedMerchandiseCurrency),R.getLoyaltyConfig()&&(i.programName=R.getLoyaltyConfig().programName,i.programCurrency=R.getLoyaltyConfig().programCurrency),n.MRB){var N=0,F=0,B=angular.copy(c.getMrbItineraryTotals());if(p.forEach(i.mainReservationArray,function(e){e&&e.resGlobalInfo&&e.resGlobalInfo.guaranteesAccepted&&e.resGlobalInfo.guaranteesAccepted.length>0&&(e.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&e.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption.length>0&&e.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&p.forEach(e.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption,function(e){e.redemptionQuantity&&(i.isPaidThroughLoyalty=!0)}),e.resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&e.resGlobalInfo.guaranteesAccepted[0].voucherRedemption.redemptionQuantity&&e.resGlobalInfo.guaranteesAccepted[0].voucherRedemption.billingNumber&&(i.isPaidThroughVoucher=!0,i.voucherTransactionID=e.resGlobalInfo.guaranteesAccepted[0].voucherRedemption.billingNumber))}),p.forEach(i.mainReservationArray,function(e){var a=0,t=0;if(e&&e.resGlobalInfo&&e.resGlobalInfo.guaranteesAccepted&&e.resGlobalInfo.guaranteesAccepted.length>0&&(e.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&e.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption.length>0&&e.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&p.forEach(e.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption,function(e){e.redemptionQuantity&&(a=parseFloat(e.redemptionQuantity),N+=a)}),e.resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&e.resGlobalInfo.guaranteesAccepted[0].voucherRedemption.redemptionQuantity&&(t=e.resGlobalInfo.guaranteesAccepted[0].voucherRedemption.redemptionQuantity,F+=t)),i.isPaidThroughVoucher&&c.getMainReservationArray().length>1&&(e.totalRoomData.voucherRedemptionQuantity=t,e.totalRoomData.voucherRedemptionQuantityFormatted=y(_)(t)),i.isPaidThroughLoyalty&&c.getMainReservationArray().length>1&&(e.totalRoomData.redemptionQuantity=a,e.totalRoomData.redemptionQuantityFormatted=y(_)(a,E)),(i.isPaidThroughLoyalty||i.isPaidThroughVoucher)&&c.getMainReservationArray().length>1){if(e.totalRoomData.paidByOtherMethod=0,e.roomStays[0].depositPayments.depositAmt&&parseFloat(e.roomStays[0].depositPayments.depositAmt)&&parseFloat(e.roomStays[0].depositPayments.depositAmt)>0){e.totalRoomData.paidByOtherMethod=parseFloat(e.roomStays[0].depositPayments.depositAmt),e.totalRoomData.formattedPaidByOtherMethod=y(_)(e.totalRoomData.paidByOtherMethod,E);var o=e.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardCode;o&&(e.totalRoomData.paidByMethod=o.charAt(0).toUpperCase()+o.substr(1).toLowerCase())}var r=0;if(e.totalRoomData.redemptionQuantity&&(r+=e.totalRoomData.redemptionQuantity),e.totalRoomData.voucherRedemptionQuantity){r+=E?parseFloat(c.getCurrencyDetails().exchangeRate*e.totalRoomData.voucherRedemptionQuantity):e.totalRoomData.voucherRedemptionQuantity}e.totalRoomData.roomRemainingTotal=e.roomStays[0].total.amountAfterTax-e.totalRoomData.paidByOtherMethod-r,e.totalRoomData.formattedRoomRemainingTotal=y(_)(e.totalRoomData.roomRemainingTotal,E)}}),N&&i.isPaidThroughLoyalty&&(i.redemptionQuantityConfirmation=angular.copy(parseFloat(N)),i.redemptionQuantityConfirmationFormatted=y(_)(i.redemptionQuantityConfirmation,E),i.paidByOtherMethod=0),F&&i.isPaidThroughVoucher&&(i.voucherRedemptionQuantityConfirmation=angular.copy(parseFloat(F)),i.voucherRedemptionQuantityConfirmationFormatted=y(_)(i.voucherRedemptionQuantityConfirmation)),N&&i.isPaidThroughLoyalty||F&&i.isPaidThroughVoucher){i.paidByOtherMethod=0;var x=angular.copy(c.getMrbItineraryPaymentInfo()),w=void 0!=x&&x.itineraryDepositAmt?parseFloat(x.itineraryDepositAmt):void 0;if(w&&parseFloat(w)&&parseFloat(w)>0){i.paidByOtherMethod=w,i.formattedPaidByOtherMethod=y(_)(i.paidByOtherMethod,E);var k=c.getMainReservationArray()[0],U=k.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardCode;U&&(i.paidByMethod=U.charAt(0).toUpperCase()+U.substr(1).toLowerCase())}var H=0;if(i.redemptionQuantityConfirmation&&(H+=i.redemptionQuantityConfirmation),i.voucherRedemptionQuantityConfirmation){var V=E?parseFloat(c.getCurrencyDetails().exchangeRate*i.voucherRedemptionQuantityConfirmation):i.voucherRedemptionQuantityConfirmation;H+=V}i.remainingResAmountConfirmation=B.itineraryRoomGrandTotal-i.paidByOtherMethod-H,i.formattedRemainingResAmountConfirmation=y(_)(i.remainingResAmountConfirmation,E)}}else{var $,k=c.getMainReservation(),q=0;if(k&&k.resGlobalInfo&&k.resGlobalInfo.guaranteesAccepted&&k.resGlobalInfo.guaranteesAccepted.length>0&&(k.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&k.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption.length>0&&k.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&p.forEach(k.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption,function(e){e.redemptionQuantity&&($=parseFloat(e.redemptionQuantity),i.isPaidThroughLoyalty=!0)}),k.resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&k.resGlobalInfo.guaranteesAccepted[0].voucherRedemption.redemptionQuantity&&k.resGlobalInfo.guaranteesAccepted[0].voucherRedemption.billingNumber&&(i.isPaidThroughVoucher=!0,q=k.resGlobalInfo.guaranteesAccepted[0].voucherRedemption.redemptionQuantity,i.voucherTransactionID=k.resGlobalInfo.guaranteesAccepted[0].voucherRedemption.billingNumber)),i.isPaidThroughLoyalty&&$&&(i.redemptionQuantityConfirmation=angular.copy($),i.redemptionQuantityConfirmationFormatted=y(_)(i.redemptionQuantityConfirmation,E)),i.isPaidThroughVoucher&&q&&(i.voucherRedemptionQuantityConfirmation=angular.copy(q),i.voucherRedemptionQuantityConfirmationFormatted=y(_)(i.voucherRedemptionQuantityConfirmation)),i.isPaidThroughLoyalty&&$||i.isPaidThroughVoucher&&q){if(i.paidByOtherMethod=0,k.roomStays[0].depositPayments.depositAmt&&parseFloat(k.roomStays[0].depositPayments.depositAmt)&&parseFloat(k.roomStays[0].depositPayments.depositAmt)>0){var Y=parseFloat(k.roomStays[0].depositPayments.depositAmt);i.paidByOtherMethod=Y,i.formattedPaidByOtherMethod=y(_)(i.paidByOtherMethod,E);var U=k.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardCode;U&&(i.paidByMethod=U.charAt(0).toUpperCase()+U.substr(1).toLowerCase())}var H=0;if(i.redemptionQuantityConfirmation&&(H+=i.redemptionQuantityConfirmation),i.voucherRedemptionQuantityConfirmation){var V=E?parseFloat(c.getCurrencyDetails().exchangeRate*i.voucherRedemptionQuantityConfirmation):i.voucherRedemptionQuantityConfirmation;H+=V}i.remainingResAmountConfirmation=k.roomStays[0].total.amountAfterTax-i.paidByOtherMethod-H,i.formattedRemainingResAmountConfirmation=y(_)(i.remainingResAmountConfirmation,E)}}i.showNOR1=!0,c.setConfig("Land_On_Confirmation"),i.trustAsHtml=v.trustAsHtml,i.roomUpgradeEnabled=g.getUxConfiguration().roomUpgradeEnabled,n.displayPromo="none";var j=function(e){t.getAccommodationRooms(e).getAllRooms().then(function(e){n.RatesAvail=e.data,i.rateAvailPlans=n.RatesAvail.roomStays[0].ratePlans;for(var a=0;a<i.rateAvailPlans.length;a++)if(1==i.rateAvailPlans[a].default){i.navFilterData={ratePlanCode:i.rateAvailPlans[a]},i.navFilterData.ratePlanCode.price=i.rateAvailPlans[a].leadRate-i.rateAvailPlans[a].discountRate,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(i.navFilterData.ratePlanCode.price=parseFloat(i.navFilterData.ratePlanCode.price).toFixed(2));break}0!=n.RatesAvail.roomStays[0].roomCategories.length&&n.RatesAvail.roomStays[0].roomCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageCategories&&0!=n.RatesAvail.roomStays[0].packageCategories.length&&n.RatesAvail.roomStays[0].packageCategories.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].ratePlans&&0!=n.RatesAvail.roomStays[0].ratePlans.length&&n.RatesAvail.roomStays[0].ratePlans.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),0!=n.RatesAvail.roomStays[0].roomTypes.length&&n.RatesAvail.roomStays[0].roomTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),void 0!=n.RatesAvail.roomStays[0].packageTypes&&0!=n.RatesAvail.roomStays[0].packageTypes.length&&n.RatesAvail.roomStays[0].packageTypes.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var a=0;a<n.RatesAvail.roomStays[0].roomCategories.length;a++){for(var t=!1,o=0;o<n.RatesAvail.roomStays[0].roomTypes.length;o++)n.RatesAvail.roomStays[0].roomTypes[o].categoryCode==n.RatesAvail.roomStays[0].roomCategories[a].categoryCode&&(t=!0);0==t&&(n.RatesAvail.roomStays[0].roomCategories.splice(a,1),a--)}if(void 0!=n.RatesAvail.roomStays[0].packageCategories)for(var a=0;a<n.RatesAvail.roomStays[0].packageCategories.length;a++){for(var t=!1,o=0;o<n.RatesAvail.roomStays[0].packageTypes.length;o++)n.RatesAvail.roomStays[0].packageTypes[o].categoryCode==n.RatesAvail.roomStays[0].packageCategories[a].categoryCode&&(t=!0);0==t&&(n.RatesAvail.roomStays[0].packageCategories.splice(a,1),a--)}if(g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator){for(var a=0;a<n.RatesAvail.roomStays[0].roomTypes.length;a++)for(var o=0;o<n.RatesAvail.roomStays[0].roomTypes[a].averageRates.length;o++)n.RatesAvail.roomStays[0].roomTypes[a].averageRates[o].rate=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[o].rate).toFixed(2),n.RatesAvail.roomStays[0].roomTypes[a].averageRates[o].discount=parseFloat(n.RatesAvail.roomStays[0].roomTypes[a].averageRates[o].discount).toFixed(2);if(void 0!=n.RatesAvail.roomStays[0].packageTypes)for(var a=0;a<n.RatesAvail.roomStays[0].packageTypes.length;a++)n.RatesAvail.roomStays[0].packageTypes[a].leadRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].leadRate).toFixed(2),n.RatesAvail.roomStays[0].packageTypes[a].discountRate=parseFloat(n.RatesAvail.roomStays[0].packageTypes[a].discountRate).toFixed(2);n.RatesAvail.roomStays[0].ratePlans.forEach(function(e){e.leadRate=parseFloat(e.leadRate).toFixed(2)})}var r={},s={},l=[],m=[];i.currentRoom="",i.currentPackage="",i.categorized=[],i.categorizedPackages=[],i.RoomDetailSwitch=!1;var u=n.RatesAvail.roomStays[0].roomTypes,p=n.RatesAvail.roomStays[0].packageTypes,y=angular.copy(u);angular.copy(p),void 0!=p&&p.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"}),u.forEach(function(e){e.isSelected=!1,e.myStyle="#116eb5"});for(var a=0;a<u.length;a++){u[a].upgradeRoom=[],u[a].isSelected=!1,u[a].myStyle="#116eb5";for(var v=0;v<u[a].averageRates.length;v++)u[a].averageRates[v].ratePlanCode==i.navFilterData.ratePlanCode.ratePlanCode&&(u[a].finalPrice=u[a].averageRates[v].rate-u[a].averageRates[v].discount);if(u[a].roomUpgradeOptions.length>0)for(var o=0;o<u[a].roomUpgradeOptions.length;o++)for(var h=0;h<y.length;h++)if(y[h].roomTypeCode==u[a].roomUpgradeOptions[o].roomTypeCode){y[h].sortOrder=u[a].roomUpgradeOptions[o].sortOrder;for(var R=0;R<y[h].averageRates.length;R++)y[h].averageRates[R].ratePlanCode==i.navFilterData.ratePlanCode.ratePlanCode&&(y[h].priceChanged=y[h].averageRates[R].rate-y[h].averageRates[R].discount-u[a].finalPrice);if(0!=y[h].priceChanged){var f=angular.copy(y[h]);u[a].upgradeRoom.push(f)}}}i.rateAvailPlans=n.RatesAvail.roomStays[0].ratePlans;for(var a=0;a<i.rateAvailPlans.length;a++)i.rateAvailPlans[a].price=i.rateAvailPlans[a].leadRate-i.rateAvailPlans[a].discountRate,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(i.rateAvailPlans[a].leadRate=parseFloat(i.rateAvailPlans[a].leadRate).toFixed(2),i.rateAvailPlans[a].discountRate=parseFloat(i.rateAvailPlans[a].discountRate).toFixed(2),i.rateAvailPlans[a].price=parseFloat(i.rateAvailPlans[a].price).toFixed(2)):(i.rateAvailPlans[a].leadRate=parseFloat(i.rateAvailPlans[a].leadRate).toFixed(0),i.rateAvailPlans[a].discountRate=parseFloat(i.rateAvailPlans[a].discountRate).toFixed(0),i.rateAvailPlans[a].price=parseFloat(i.rateAvailPlans[a].price).toFixed(0));i.rateAvailCategories=n.RatesAvail.roomStays[0].roomCategories,i.rateAvailCategoriesPackage=n.RatesAvail.roomStays[0].packageCategories,i.rateAvailCategories.forEach(function(e){e.selected=!0}),void 0!=i.rateAvailCategoriesPackage&&i.rateAvailCategoriesPackage.forEach(function(e){e.selected=!0});for(var a=0;a<i.rateAvailCategories.length;a++)l[a]=!0;for(var a=0;a<i.rateAvailCategories.length;a++)m[a]=!0;i.categorized=[];var C=[{categoryRooms:[]}],P=0,S=0;C[0].categoryRooms[S]={},C[0].categoryRooms[S].categoryRoom=[];for(var R=0;R<u.length;R++)if(!u[R].hasOwnProperty("categoryCode")){u[R].priceTagRate=[],u[R].currentCode=i.navFilterData.ratePlanCode.ratePlanCode;for(var A=0;A<u[R].averageRates.length;A++)"Regular"==u[R].averageRates[A].ratePlanType&&u[R].averageRates[A].ratePlanCode!=i.navFilterData.ratePlanCode.ratePlanCode?u[R].priceTagRate.push(u[R].averageRates[A]):u[R].averageRates[A].ratePlanCode==i.navFilterData.ratePlanCode.ratePlanCode&&u[R].priceTagRate.unshift(u[R].averageRates[A]);for(var a=0;a<i.rateAvailPlans.length;a++)for(var o=0;o<u[R].priceTagRate.length;o++)u[R].priceTagRate[o].ratePlanCode==i.rateAvailPlans[a].ratePlanCode&&(u[R].priceTagRate[o].ratePlanDescription=i.rateAvailPlans[a].ratePlanDescription,u[R].priceTagRate[o].cancellationPolicy=i.rateAvailPlans[a].cancellationPolicy,u[R].priceTagRate[o].guaranteePolicy=i.rateAvailPlans[a].guaranteePolicy,void 0!=i.rateAvailPlans[a].packagePolicies&&(u[R].priceTagRate[o].packagePolicies=i.rateAvailPlans[a].packagePolicies));for(var a=0;a<u[R].averageRates.length;a++){for(var I=0;I<i.rateAvailPlans.length;I++)i.rateAvailPlans[I].ratePlanCode==u[R].averageRates[a].ratePlanCode&&(u[R].priceTagRate[a].ratePlanName=i.rateAvailPlans[I].ratePlanName);i.navFilterData.ratePlanCode.ratePlanCode==u[R].averageRates[a].ratePlanCode&&(u[R].currentRate=u[R].averageRates[a],u[R].currentRate.price=u[R].currentRate.rate-u[R].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(u[R].currentRate.price=parseFloat(u[R].currentRate.price).toFixed(2)),C[0].categoryRooms[S].categoryRoom.push(u[R]),P++)}P%3==0&&0!=P&&(S++,C[0].categoryRooms[S]={},C[0].categoryRooms[S].categoryRoom=[])}if(0!=C[0].categoryRooms[0].categoryRoom.length){for(var b=C[0].categoryRooms.length;b>0;b--)0==C[0].categoryRooms[b-1].categoryRoom.length&&C[0].categoryRooms.splice(b-1,1);i.categorized.push(C[0])}if(void 0!=p){i.categorizedPackages=[];var D=[{categoryPackages:[]}],P=0,S=0;D[0].categoryPackages[S]={},D[0].categoryPackages[S].categoryPackage=[];for(var R=0;R<p.length;R++)p[R].hasOwnProperty("categoryCode")||(D[0].categoryPackages[S].categoryPackage.push(p[R]),P++),P%3==0&&0!=P&&(S++,D[0].categoryPackages[S]={},D[0].categoryPackages[S].categoryPackage=[]);if(0!=D[0].categoryPackages[0].categoryPackage.length){for(var b=D[0].categoryPackages.length;b>0;b--)0==D[0].categoryPackages[b-1].categoryPackage.length&&D[0].categoryPackages.splice(b-1,1);i.categorizedPackages.push(D[0])}}for(var h=0;h<n.RatesAvail.roomStays[0].roomCategories.length;h++){P=0,S=0,r={name:n.RatesAvail.roomStays[0].roomCategories[h].categoryName,categoryCode:n.RatesAvail.roomStays[0].roomCategories[h].categoryCode,categoryRooms:[]},r.categoryRooms[0]={},r.categoryRooms[0].categoryRoom=[];for(var R=0;R<u.length;R++){var T=!1;if(u[R].categoryCode==n.RatesAvail.roomStays[0].roomCategories[h].categoryCode){u[R].priceTagRate=[],u[R].currentCode=i.navFilterData.ratePlanCode.ratePlanCode;for(var A=0;A<u[R].averageRates.length;A++)"Regular"==u[R].averageRates[A].ratePlanType&&u[R].averageRates[A].ratePlanCode!=i.navFilterData.ratePlanCode.ratePlanCode?u[R].priceTagRate.push(u[R].averageRates[A]):u[R].averageRates[A].ratePlanCode==i.navFilterData.ratePlanCode.ratePlanCode&&u[R].priceTagRate.unshift(u[R].averageRates[A]);for(var a=0;a<u[R].averageRates.length;a++){for(var I=0;I<i.rateAvailPlans.length;I++)i.rateAvailPlans[I].ratePlanCode==u[R].averageRates[a].ratePlanCode&&(u[R].priceTagRate[a].ratePlanName=i.rateAvailPlans[I].ratePlanName);i.navFilterData.ratePlanCode.ratePlanCode==u[R].averageRates[a].ratePlanCode&&(u[R].currentRate=u[R].averageRates[a],u[R].currentRate.price=u[R].currentRate.rate-u[R].currentRate.discount,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator&&(u[R].currentRate.price=parseFloat(u[R].currentRate.price).toFixed(2)),r.categoryRooms[S].categoryRoom.push(u[R]),P++,!0)}for(var a=0;a<i.rateAvailPlans.length;a++)for(var o=0;o<u[R].priceTagRate.length;o++)u[R].priceTagRate[o].ratePlanCode==i.rateAvailPlans[a].ratePlanCode&&(u[R].priceTagRate[o].ratePlanDescription=i.rateAvailPlans[a].ratePlanDescription,u[R].priceTagRate[o].cancellationPolicy=i.rateAvailPlans[a].cancellationPolicy,u[R].priceTagRate[o].guaranteePolicy=i.rateAvailPlans[a].guaranteePolicy,void 0!=i.rateAvailPlans[a].packagePolicies&&(u[R].priceTagRate[o].packagePolicies=i.rateAvailPlans[a].packagePolicies))}P%3==0&&0!=P&&(T=!0,S++,r.categoryRooms[S]={},r.categoryRooms[S].categoryRoom=[])}if(1==T){for(var O=r.categoryRooms.length;O>0;O--)0==r.categoryRooms[O-1].categoryRoom.length&&r.categoryRooms.splice(O-1,1);i.categorized.push(r)}else if(r.categoryRooms[S].categoryRoom.length>0){for(var O=r.categoryRooms.length;O>0;O--)0==r.categoryRooms[O-1].categoryRoom.length&&r.categoryRooms.splice(O-1,1);i.categorized.push(r)}}if(void 0!=p)for(var h=0;h<n.RatesAvail.roomStays[0].packageCategories.length;h++){var P=0,S=0,s={name:n.RatesAvail.roomStays[0].packageCategories[h].categoryName,categoryCode:n.RatesAvail.roomStays[0].packageCategories[h].categoryCode,categoryPackages:[]};s.categoryPackages[0]={},s.categoryPackages[0].categoryPackage=[];for(var R=0;R<p.length;R++){var T=!1;p[R].categoryCode==n.RatesAvail.roomStays[0].packageCategories[h].categoryCode&&(s.categoryPackages[S].categoryPackage.push(p[R]),P++,!0),P%3==0&&0!=P&&(T=!0,S++,s.categoryPackages[S]={},s.categoryPackages[S].categoryPackage=[])}if(1==T){for(var O=s.categoryPackages.length;O>0;O--)0==s.categoryPackages[O-1].categoryPackage.length&&s.categoryPackages.splice(O-1,1);i.categorizedPackages.push(s)}else if(s.categoryPackages[S].categoryPackage.length>0){for(var O=s.categoryPackages.length;O>0;O--)0==s.categoryPackages[O-1].categoryPackage.length&&s.categoryPackages.splice(O-1,1);i.categorizedPackages.push(s)}}for(var E=0;E<i.categorized.length;E++)for(var M=0;M<i.categorized[E].categoryRooms.length;M++)for(var _=0;_<i.categorized[E].categoryRooms[M].categoryRoom.length;_++)if(i.categorized[E].categoryRooms[M].categoryRoom[_].roomTypeCode==c.getMainReservation().roomStays[0].roomRates[0].roomTypeCode){i.upgradeRoom=i.categorized[E].categoryRooms[M].categoryRoom[_].upgradeRoom;break}d.setUserTiming("PageLoad","Confirmation")})};i.urlParamNor1=function(){var e=c.getMainReservation(),a="";if(void 0!=e){a="PCD=IH"+e.hotelCode,a=a+"&EBC="+e.uniqueId,a=a+"&PID="+nor1PID,a=a+"&PET="+nor1PET,a=a+"&PCH="+nor1PCH,a+="&PCC=WEB";var t=e.languageCode;if(void 0!=t&&(t=t.substring(0,2),a=a+"&LNG="+t),void 0!=e.roomStays&&e.roomStays.length>0&&(e.roomStays[0].roomRates.length>0&&(void 0!=e.roomStays[0].roomRates[0].roomExternalCode&&(a=a+"&RCC="+e.roomStays[0].roomRates[0].roomExternalCode),void 0!=e.roomStays[0].roomRates[0].numberOfUnits&&(a=a+"&GNR="+e.roomStays[0].roomRates[0].numberOfUnits),void 0!=e.roomStays[0].roomRates[0].roomTypeName&&(a=a+"&PCN="+e.roomStays[0].roomRates[0].roomTypeName)),e.roomStays[0].ratePlans.length>0&&void 0!=e.roomStays[0].ratePlans[0].rateExternalCode&&(a=a+"&PRC="+e.roomStays[0].ratePlans[0].rateExternalCode),void 0!=e.roomStays[0].total&&void 0!=e.roomStays[0].total.amountAfterTax&&(a=a+"&TBP="+e.roomStays[0].total.amountAfterTax)),void 0!=e.resGlobalInfo&&(void 0!=e.resGlobalInfo.timeSpan&&(void 0!=e.resGlobalInfo.timeSpan.start&&(a=a+"&GAD="+moment(e.resGlobalInfo.timeSpan.start).format("YYYYMMDD")),void 0!=e.resGlobalInfo.timeSpan.duration&&(a=a+"&NMN="+e.resGlobalInfo.timeSpan.duration),void 0!=e.resGlobalInfo.timeSpan.end&&(a=a+"&GDD="+moment(e.resGlobalInfo.timeSpan.end).format("YYYYMMDD"))),void 0!=e.resGlobalInfo.guestCounts)){var o=y("filter")(e.resGlobalInfo.guestCounts,{ageQualifyingCode:"10"}),r=y("filter")(e.resGlobalInfo.guestCounts,{ageQualifyingCode:"8"});0!=o.length&&(a=a+"&NOA="+o[0].count),0!=r.length&&(a=a+"&NOC="+r[0].count)}if(e.resGuests.length>0&&void 0!=e.resGuests[0].profile&&void 0!=e.resGuests[0].profile.customer){if(void 0!=e.resGuests[0].profile.customer.email&&(a=a+"&GEM="+e.resGuests[0].profile.customer.email),void 0!=e.resGuests[0].profile.customer.surName&&(a=a+"&GLN="+e.resGuests[0].profile.customer.surName),void 0!=e.resGuests[0].profile.customer.givenName&&(a=a+"&GFN="+e.resGuests[0].profile.customer.givenName),void 0!=e.resGuests[0].profile.customer.namePrefix&&(a=a+"&GSL="+e.resGuests[0].profile.customer.namePrefix),e.resGuests[0].profile.customer.address.length>0&&(void 0!=e.resGuests[0].profile.customer.address[0].postalCode&&(a=a+"&GPC="+e.resGuests[0].profile.customer.address[0].postalCode),void 0!=e.resGuests[0].profile.customer.address[0].stateName&&(a=a+"&GST="+e.resGuests[0].profile.customer.address[0].stateName),void 0!=e.resGuests[0].profile.customer.address[0].countryCode&&(a=a+"&GCC="+e.resGuests[0].profile.customer.address[0].countryCode),void 0!=e.resGuests[0].profile.customer.address[0].cityName&&(a=a+"&GCT="+e.resGuests[0].profile.customer.address[0].cityName),void 0!=e.resGuests[0].profile.customer.address[0].addressLine1)){var n=e.resGuests[0].profile.customer.address[0].addressLine1;void 0!=e.resGuests[0].profile.customer.address[0].addressLine2&&(n=n+" "+e.resGuests[0].profile.customer.address[0].addressLine2),a=a+"&GAR="+n}var i=c.getFormattedReservationData(_),s=[];if(i.roomsData.length>0){var l=i.roomsData[0].datesOfStay;if(0!=l.length)for(var d=0;d<l.length;d++)s[d]=l[d].price+";"}0!=s.length&&(a=a+"&GDR="+s.join("")),e.resGuests[0].profile.customer.telephone.length>0&&void 0!=e.resGuests[0].profile.customer.telephone[0].phoneNumber&&(a=a+"&GPN="+e.resGuests[0].profile.customer.telephone[0].phoneNumber)}var g,m=c.getGroup();void 0!=m&&void 0!=(g=m.groupCode)&&(a=a+"&SRP="+g);var u,p=c.getCurrencyDetails();void 0!=p&&void 0!=(u=p.currencyCode)&&(a=a+"&CUR="+u)}return a};var z;i.nor1Enabled=g.getHotelDesc().nor1Enabled;var W=c.getMainReservation();W.roomStays.length>0&&W.roomStays[0].ratePlans.length>0&&void 0!=W.roomStays[0].ratePlans[0].ratePlanType&&"Package"==W.roomStays[0].ratePlans[0].ratePlanType&&(i.nor1Enabled=!1),1==i.nor1Enabled&&(z=i.urlParamNor1()),i.nor1RefUrl=nor1BaseUrl+"?"+z,i.nor1ImgUrl=nor1BaseUrl+"/dynLink?"+z,n.startTime=Date.now(),e.debug(JSON.stringify(c.getMainReservation())+"before111  $rootScope.finalServices"),i.$state=s;var K=g.getUxConfiguration().confirmationConfig;i.enhancementsEnabledFlag=g.getHotelDesc().uxConfiguration.enhancementsEnabled,i.enableNewReservation=K.enableNewReservation,i.enablePostCheckoutEnhancement=K.enablePostCheckoutEnhancement,i.enablePostCheckoutUpgrade=K.enablePostCheckoutUpgrade,i.isModifyReservation=c.canModifyReservation(),1==c.getConfig("POST_BOOKING_ENHANCEMENT")&&(i.isModifyReservation=!0),c.deleteConfig("POST_BOOKING_ENHANCEMENT"),
W.roomStays[0].ratePlans[0].ratePlanCode&&(i.selectedRatePlanCode=W.roomStays[0].ratePlans[0].ratePlanCode),i.depositAmount=W.roomStays[0].depositPayments.depositAmt,n.MRB&&(i.itineraryPaymentInfo=angular.copy(c.getMrbItineraryPaymentInfo()),i.itineraryDepositAmt=void 0!=i.itineraryPaymentInfo&&i.itineraryPaymentInfo.itineraryDepositAmt?i.itineraryPaymentInfo.itineraryDepositAmt:void 0,i.depositAmount=angular.copy(i.itineraryDepositAmt)),e.debug("$scope.depositAmount"),e.debug(i.depositAmount),i.depositAmt=y("currencyConversionWithTwoDecimalPlaces")(i.depositAmount,E),i.paymentMethodSection=!1,i.toggleConfirm=!0,i.enableStartNewReservation=!0,i.showTCModal="display-none",i.ResAndPayConfig=g.getUxConfiguration().reservationAndPaymentConfig,i.privacyPolicyEnabled=i.ResAndPayConfig.privacyPolicyEnabled,i.mainReservation=c.getMainReservation(),i.textualPolicies=i.mainReservation.policies.textualPolicies;i.isModifyReservation||function(){var e=g.getHotelInfo().hotelCode,a=c.getMainReservation(),r=c.getMainReservationArray(),i=c.getSubChan();i&&function(){var s=(new Date).toISOString(),l=0,d=0,m=0,u=0,p="",y=0,v=0,h=!1,R=0,f="",C="",P="",S=0,A="",I=c.getFixedMerchandisedCurrency()?c.getFixedMerchandisedCurrency():c.getCurrency()?c.getCurrency():g.getCurrentCurrency().currencyCode,b=o.get("pageCache");if(b){var D=b.get("/page/landingUrl");void 0!==D&&(A=D)}var T="MetaSearchPixelCookieTime_"+e,O="MetaSearchUtmCookie_"+e,E=document.cookie,M="",_="",k="",N="",L=JSON.stringify({booking_engine:"BE4"});if(E){E=E.split(";");for(var G=0;G<E.length;G++)if(E[G]&&E[G].trim().startsWith(T)){var F=E[G].indexOf("="),B=E[G].substring(F+1,E[G].length).trim();L=JSON.stringify({booking_engine:"BE4",interaction_ts:B})}for(var x=0;x<E.length;x++)if(E[x]&&E[x].trim().startsWith(O)){var F=E[x].indexOf("="),B=E[x].substring(F+1,E[x].length);B=B.trim();for(var w=B.split("&"),U=0;U<w.length;U++){if(w[U]&&w[U].trim().startsWith("utm_source")){var F=w[U].indexOf("=");M=w[U].substring(F+1,w[U].length)}if(w[U]&&w[U].trim().startsWith("utm_medium")){var F=w[U].indexOf("=");_=w[U].substring(F+1,w[U].length)}if(w[U]&&w[U].trim().startsWith("utm_content")){var F=w[U].indexOf("=");k=w[U].substring(F+1,w[U].length)}if(w[U]&&w[U].trim().startsWith("utm_campaign")){var F=w[U].indexOf("=");N=w[U].substring(F+1,w[U].length)}}break}}if(p=a.metaSubchannelSpecialId?a.metaSubchannelSpecialId:"",n.MRB){for(var G=0;G<r.length;G++)for(var H=r[G].resGlobalInfo.guestCounts,x=0;x<H.length;x++)H[x].ageQualifyingCode&&"10"===H[x].ageQualifyingCode?H[x].count&&H[x].count>0&&(y+=parseInt(H[x].count)):H[x].ageQualifyingCode&&"8"===H[x].ageQualifyingCode&&H[x].count&&(v+=parseInt(H[x].count));if(r.length>0&&r[0].resGlobalInfo&&r[0].resGlobalInfo.timeSpan&&r[0].resGlobalInfo.timeSpan.start&&r[0].resGlobalInfo.timeSpan.end&&(f=r[0].resGlobalInfo.timeSpan.start,C=r[0].resGlobalInfo.timeSpan.end),r&&r.length>0&&r[0].uniqueId&&(P=r[0].uniqueId),a.roomStays&&a.roomStays.length>0&&a.roomStays[0].total){for(var G=0;G<r.length;G++)r[G].roomStays[0].total&&r[G].roomStays[0].total.taxAmountTotal&&(l+=r[G].roomStays[0].total.taxAmountTotal),r[G].roomStays[0].total&&r[G].roomStays[0].total.amountBeforeTax&&(d+=r[G].roomStays[0].total.amountBeforeTax),r[G].roomStays[0].total&&r[G].roomStays[0].total.amountBeforeTax&&(m+=r[G].roomStays[0].total.amountBeforeTax);u=m&&l?m+l:m&&!l?m:0}r.length>0&&a.roomStays[0].roomRates[0].numberOfUnits&&(S=r.length)}else{var H=a.resGlobalInfo.guestCounts;angular.forEach(H,function(e){e.ageQualifyingCode&&"10"===e.ageQualifyingCode?e.count&&e.count>0&&(y=e.count,h=!0):e.ageQualifyingCode&&"8"===e.ageQualifyingCode&&e.count&&e.count>0&&(R+=e.count)}),h&&(v=R),a.resGlobalInfo.timeSpan&&a.resGlobalInfo.timeSpan.start&&a.resGlobalInfo.timeSpan.end&&(f=a.resGlobalInfo.timeSpan.start,C=a.resGlobalInfo.timeSpan.end),a&&a.uniqueId&&(P=a.uniqueId),a.roomStays&&a.roomStays.length>0&&a.roomStays[0]&&a.roomStays[0].total&&(a.roomStays[0].total.taxAmountTotal&&(l=a.roomStays[0].total.taxAmountTotal),a.roomStays[0].total.amountBeforeTax&&(d=a.roomStays[0].total.amountBeforeTax),a.roomStays[0].total.amountBeforeTax&&(m=a.roomStays[0].total.amountBeforeTax)),u=m&&l?m+l:m&&!l?m:0,a.resGlobalInfo.rooms?S=a.resGlobalInfo.rooms:a.roomStays[0].roomRates[0].numberOfUnits&&(S=a.roomStays[0].roomRates[0].numberOfUnits)}var V=JSON.stringify({adults:0===y||y?y.toString():y,amountWithTax:0===u||u?u.toString():u,amountWithoutTax:0===d||d?d.toString():d,bookDate:s,checkInDate:f,checkOutDate:C,childrens:0===v||v?v.toString():v,clickId:p,confirmId:P,crsType:"IHotelier",currency:I,hotelId:e,managedURL:A,optionalFields:L,rooms:0===S||S?S.toString():S,subchan:i,utmCampaign:N,utmContent:k,utmMedium:_,utmSource:M});t.setMediaMetaCollectionContent(V).then(function(e){console.log("***Meta Collection API Success Response**** "+e)},function(e){console.log("***Error while sending data to store MetaData APi**** "+e)})}()}(),i.showTCModalPopup=function(e,a){a?"TC"==e?h.onModalOpen("confirmation-page-tc-id-"+a.id,"confirmationPage-TermsAndConditions-parent","confPage-terms-and-conditions-header-id",!1,i.closeTCPopup):"PP"==e&&h.onModalOpen("confirmation-page-pp-id-"+a.id,"confirmationPage-TermsAndConditions-parent","confPage-terms-and-conditions-header-id",!1,i.closeTCPopup):"TC"==e?h.onModalOpen("confirmation-page-tc-id","confirmationPage-TermsAndConditions-parent","confPage-terms-and-conditions-header-id",!1,i.closeTCPopup):"PP"==e&&h.onModalOpen("confirmation-page-pp-id","confirmationPage-TermsAndConditions-parent","confPage-terms-and-conditions-header-id",!1,i.closeTCPopup),n.MRB&&c.getMainReservationArray().length>1&&void 0!=a?i.selectedReservation=a:i.selectedReservation=c.getMainReservation(),i.textualPolicies=i.selectedReservation.policies.textualPolicies,i.showTCModal="display-block",i.TCPopupWindow=r.pageYOffset+40+"px";var t=0;setTimeout(function(){"TC"==e?t=angular.element(document.getElementById("roomPolicies")).prop("offsetTop"):"PP"==e&&(t=angular.element(document.getElementById("tc1")).prop("offsetTop")),angular.element(document.getElementById("divWrap")).scrollTop(t-25)},100)},i.closeTCPopup=function(){i.showTCModal="display-none",h.onModalClose()},i.toggleCofirmView=function(){i.toggleConfirm=!i.toggleConfirm},i.startNewReservation=function(){m.eventTrack("ClickStartNewReservation",{category:"UserNavigation",label:"Start a new reservation"}),l(function(){d.startNewReservation()},1e3)};var J,Q=function(e){i.listOfSelectedEnhancements=angular.copy(i.enhancementServices),i.enhancementServices=angular.copy(J);var a,t=parseInt(e.roomTypeCode,10);if(i.hasDiscountServices=!1,i.merchandisingInfo={},i.displayMerchandising=!1,void 0!=c.getMainReservation().services&&(a=c.getMainReservation().services),i.enhancementServices.length>0)for(var o=i.enhancementServices.length-1;o>-1;o--)if(!i.hasDiscountServices&&i.enhancementServices[o].discountRuleId&&(i.hasDiscountServices=!0),i.enhancementServices[o].showPriceAsDiscountedPrice=i.enhancementServices[o].showPriceAsDiscountedPrice&&g.getUxConfiguration().strikeThroughPricingEnabled,0===Object.keys(i.merchandisingInfo).length&&i.enhancementServices[o].merchandisingInfo&&(i.merchandisingInfo=i.enhancementServices[o].merchandisingInfo),a.length>0)for(var r=0;r<a.length;r++)if(i.enhancementServices[o].serviceTypeId==a[r].serviceTypeId){i.enhancementServices.splice(o,1);break}for(var r=i.enhancementServices.length-1;r>0;r--)"SERVICE_REQUEST"==i.enhancementServices[r].serviceCategory&&i.enhancementServices.splice(r,1);for(var n=[],s=[],r=0;r<i.enhancementServices.length;r++)"ENHANCEMENT"!=i.enhancementServices[r].serviceCategory||!p.includes(i.enhancementServices[r].associatedRoomTypeIds,t)&&i.enhancementServices[r].associatedRoomTypeIds&&"Group"!==c.getMainReservation().roomStays[0].ratePlans[0].ratePlanType?"PACKAGE_OPTION"==i.enhancementServices[r].serviceCategory&&s.push(i.enhancementServices[r]):n.push(i.enhancementServices[r]);if(0!=n.length&&(n=p.sortBy(n,"sortOrder")),0!=s.length&&(s=p.sortBy(s,"sortOrder")),i.enhancementServices=s.concat(n),i.isEnhancementUpsellEnabled&&i.enhancementServices&&i.enhancementServices.length>0){var l=c.getUpsellParams().upsellId,m=p.findIndex(i.enhancementServices,function(e){return e.serviceTypeId==l});if(-1!=m){var u=i.enhancementServices.splice(m,1);i.enhancementServices=u.concat(i.enhancementServices)}}i.enhancementServices.length<2&&(i.configFlag=!0);for(var y=c.getResStartDate(),v=c.getResEndDate(),h=moment.utc(v).diff(moment.utc(y),"days")+1,R=[],f=0;f<h;f++){var C=moment.utc(y).add(f,"days").format("YYYY-MM-DD");R.push(C)}angular.forEach(i.enhancementServices,function(e){0!=e.serviceOptions.length&&(e.serviceOptions=p.sortBy(e.serviceOptions,"sortOrder"));for(var a,t=0,o=[],r=[],n=0;n<e.serviceOptions.length;n++){t=e.serviceOptions[n].dailyRates[0].adultUnitPrice-e.serviceOptions[n].dailyRates[0].adultUnitDiscount,a=e.serviceOptions[n].dailyRates[0].serviceDate,void 0==o[n]&&(o[n]=e.serviceOptions[n].dailyRates[0].adultUnitPrice,i.hasDiscountServices&&(r[n]=e.serviceOptions[n].dailyRates[0].adultUnitDiscount));for(var s=0;s<e.serviceOptions[n].dailyRates.length;s++)t>e.serviceOptions[n].dailyRates[s].adultUnitPrice-e.serviceOptions[n].dailyRates[s].adultUnitDiscount&&(t=e.serviceOptions[n].dailyRates[s].adultUnitPrice-e.serviceOptions[n].dailyRates[s].adultUnitDiscount,a=e.serviceOptions[n].dailyRates[s].serviceDate,o[n]=e.serviceOptions[n].dailyRates[s].adultUnitPrice,i.hasDiscountServices&&(r[n]=e.serviceOptions[n].dailyRates[s].adultUnitDiscount))}var l=0;if(void 0==e.minPrice?(e.minPrice=Math.min.apply(Math,o),i.hasDiscountServices&&(l=o.indexOf(Math.min.apply(Math,o)))):e.minPrice>=Math.min.apply(Math,o)&&(e.minPrice=Math.min.apply(Math,o),i.hasDiscountServices&&(l=o.indexOf(Math.min.apply(Math,o)))),i.hasDiscountServices&&(e.discountedPrice=e.minPrice-r[l]),e.checked=!1,e.eachDayRate=[],"PER_PERSON_PER_NIGHT"==e.servicePricingType||"PER_RESERVATION"==e.servicePricingType||"PER_ROOM_PER_NIGHT"==e.servicePricingType)for(var c=0;c<R.length;c++){e.eachDayRate[c]={},e.eachDayRate[c].serviceDate=R[c],e.eachDayRate[c].options=[];for(var d=0;d<e.serviceOptions.length;d++)for(var g=0;g<e.serviceOptions[d].dailyRates.length;g++)e.serviceOptions[d].dailyRates[g].serviceDate==R[c]&&(e.eachDayRate[c].options.push(e.serviceOptions[d].dailyRates[g]),e.eachDayRate[c].options[e.eachDayRate[c].options.length-1].serviceOptionId=e.serviceOptions[d].serviceOptionId,e.eachDayRate[c].options[e.eachDayRate[c].options.length-1].serviceOptionName=e.serviceOptions[d].serviceOptionName,e.eachDayRate[c].options[e.eachDayRate[c].options.length-1].sortOrder=e.serviceOptions[d].sortOrder)}else if("PER_PERSON"==e.servicePricingType||"PER_ROOM"==e.servicePricingType){for(var c=0;c<R.length;c++){e.eachDayRate[c]={},e.eachDayRate[c].serviceDate=R[c],e.eachDayRate[c].options=[];for(var d=0;d<e.serviceOptions.length;d++)for(var g=0;g<e.serviceOptions[d].dailyRates.length;g++)e.serviceOptions[d].dailyRates[g].serviceDate==a&&(e.eachDayRate[c].options.push(e.serviceOptions[d].dailyRates[g]),e.eachDayRate[c].options[e.eachDayRate[c].options.length-1].serviceOptionId=e.serviceOptions[d].serviceOptionId,e.eachDayRate[c].options[e.eachDayRate[c].options.length-1].serviceOptionName=e.serviceOptions[d].serviceOptionName,e.eachDayRate[c].options[e.eachDayRate[c].options.length-1].sortOrder=e.serviceOptions[d].sortOrder,"PER_ROOM"==e.servicePricingType&&(e.eachDayRate[c].tempOptions=angular.copy(e.eachDayRate[c].options)))}for(var m,u=0;e.eachDayRate.length>u;u++)if(m=void 0,e.eachDayRate[u].options.length>0?a===e.eachDayRate[u].serviceDate?(m=e.eachDayRate[u].options,e.eachDayRate[u].options=[],"PER_ROOM"==e.servicePricingType&&(e.eachDayRate[u].tempOptions=[])):(e.eachDayRate[u].options=[],"PER_ROOM"==e.servicePricingType&&(e.eachDayRate[u].tempOptions=[])):e.eachDayRate.splice(u,1),a&&m){if("PER_ROOM"==e.servicePricingType)for(ml=0;m.length>ml;ml++)m[ml].maxLimit=e.maxLimit;e.eachDayRate[u].options=m,"PER_ROOM"==e.servicePricingType&&(e.eachDayRate[u].tempOptions=angular.copy(m))}}var y;if("PER_RESERVATION"==e.servicePricingType){for(var u=0;u<e.eachDayRate.length;u++)if(a===e.eachDayRate[u].serviceDate&&e.eachDayRate[u].options.length>0){e.eachDayRate[u].serviceDates=[],y=u;break}for(var u=0;u<e.eachDayRate.length;u++)e.eachDayRate[u].options.length>0&&(e.eachDayRate[y].serviceDates.push(e.eachDayRate[u].serviceDate),u!=y&&(e.eachDayRate[u].options=[]))}});for(var r=0;r<i.enhancementServices.length;r++)if(i.listOfSelectedEnhancements)for(var o=0;o<i.listOfSelectedEnhancements.length;o++)i.enhancementServices[r].serviceTypeId==i.listOfSelectedEnhancements[o].serviceTypeId&&i.listOfSelectedEnhancements[o].checked&&(i.enhancementServices[r]=i.listOfSelectedEnhancements[o]);if(i.servicesLimit=3,i.hideMoreEnhancement=!1,i.serviceListAccordion=[],i.hasDiscountServices){var P=[],S=[],A=[];angular.forEach(i.enhancementServices,function(e){e.discountRuleId?S.push(e):A.push(e)}),P&&P.length>0&&(S=P.concat(S)),S&&S.length>0&&(i.displayMerchandising=!0,i.serviceListAccordion.push({label:"global_complimentaryenhancements-LblComplimentaryEnhancements",isOpen:!0,enhancementList:S})),A&&A.length>0&&i.serviceListAccordion.push({label:"global_otherenhancements-LblOtherEnhancements",isOpen:!0,enhancementList:A})}d.setUserTiming("PageLoad","Confirmation")};if(void 0!=n.finalServices&&(!n.MRB||n.MRB&&1==c.getMainReservationArray().length))var X=angular.copy(n.finalServices);else{var X=c.buildOptions();X.dateIn=c.getMainReservation().resGlobalInfo.timeSpan.start,X.dateOut=c.getMainReservation().resGlobalInfo.timeSpan.end,X.ratePlanCode=c.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode,X.ratePlanType=c.getMainReservation().roomStays[0].ratePlans[0].ratePlanType}e.debug(JSON.stringify(X)+"options");var Z=c.buildOptions();Z.dateIn=c.getMainReservation().resGlobalInfo.timeSpan.start,Z.dateOut=c.getMainReservation().resGlobalInfo.timeSpan.end,Z.ratePlanCode=c.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode,Z.ratePlanType=c.getMainReservation().roomStays[0].ratePlans[0].ratePlanType,void 0!=c.getMainReservation().roomStays[0].discountCode&&(Z.allCodes={},Z.allCodes.discount=c.getMainReservation().roomStays[0].discountCode),void 0!=c.getMainReservation().roomStays&&c.getMainReservation().roomStays.length>0&&(void 0!=c.getMainReservation().roomStays[0].discountCode&&(X.Discount=c.getMainReservation().roomStays[0].discountCode),void 0!=c.getMainReservation().roomStays[0].taCode&&(X.taCode=c.getMainReservation().roomStays[0].taCode),void 0!=c.getMainReservation().roomStays[0].groupCode&&(X.groupCode=c.getMainReservation().roomStays[0].groupCode),void 0!=c.getMainReservation().roomStays[0].corpCode&&(X.Corporate=c.getMainReservation().roomStays[0].corpCode)),delete Z.roomTypeCode,j(Z),D(X),e.debug(JSON.stringify(c.getMainReservation())+"2.5  $rootScope.finalServices"),i.$on(a.LANG_CHANGE,function(){if(i.showServices="display-none",i.enhancementServices)for(var e=0;e<i.enhancementServices.length;e++)for(var a=0;a<i.enhancementServices[e].eachDayRate.length;a++)for(var t=0;t<i.enhancementServices[e].eachDayRate[a].options.length;t++)i.enhancementServices[e].eachDayRate[a].options[t].filteredAdultRate=y("currencyConversionAndSymbol")(i.enhancementServices[e].eachDayRate[a].options[t].adultRate,i.fixedMerchandiseCurrency)}),i.showServices="display-none",i.service={checked:!1},i.submitEnable=!0,i.goBack=function(e){var a=!1;1==e.tempChecked?e.tempChecked=!0:e.tempChecked=void 0,i.showServices="display-none",h.onModalClose(),i.service.checked=!1,angular.forEach(e.eachDayRate,function(t){if(t.allSelected=t.tempAllSelected,void 0==t.dateIsSelected||0==t.dateIsSelected?(delete t.date,delete t.dropdownDate,delete t.dateColor):(t.date=t.tempDate,t.dateColor="#898989",t.dropdownDate="#eaeaea"),void 0==t.adultIsSelected||0==t.adultIsSelected?(delete t.adult,delete t.dropdownAdult,delete t.adultsColor):(t.adult=t.tempAdult,t.adultsColor="#898989",t.dropdownAdult="#eaeaea"),void 0==t.childrenIsSelected||0==t.childrenIsSelected?(delete t.children,delete t.dropdownChildren,delete t.childrenColor):(t.children=t.tempChildren,t.childrenColor="#898989",t.dropdownChildren="#eaeaea"),void 0==t.roomsIsSelected||0==t.roomsIsSelected?(delete t.room,delete t.dropdownRooms,delete t.roomsColor):void 0!=t.selectOptionIsSelected&&0!=t.selectOptionIsSelected&&(a=!0,t.room=t.tempRooms,t.roomsColor="#898989",t.dropdownRooms="#eaeaea"),1==t.tempIsChecked?(t.isChecked=!0,e.hideAgain=!0):0==t.tempIsChecked&&(t.isChecked=!1,e.hideAgain=!1),void 0==t.selectOptionIsSelected||0==t.selectOptionIsSelected){if(t.allSelected=!1,delete t.selectOption,delete t.dropdownOptions,delete t.optionsColor,t.options.length>0&&(e.hideAgain=!1),t.isChecked=!1,"PER_RESERVATION"==e.servicePricingType)for(var o=0,r=0,n=0;n<t.options.length>0;n++){t.options=[];for(var i=0;i<e.serviceOptions.length>0;i++){o=e.serviceOptions[i].dailyRates[0].adultUnitPrice-e.serviceOptions[i].dailyRates[0].adultUnitDiscount;for(var s=0;s<e.serviceOptions[i].dailyRates.length>0;s++)o>e.serviceOptions[i].dailyRates[s].adultUnitPrice-e.serviceOptions[i].dailyRates[s].adultUnitDiscount&&(o=e.serviceOptions[i].dailyRates[s].adultUnitPrice-e.serviceOptions[i].dailyRates[s].adultUnitDiscount,r=s);t.options.push(e.serviceOptions[i].dailyRates[r])}}}else{if("PER_RESERVATION"==e.servicePricingType){if(void 0!=t.tempReservationOptions){t.options=t.tempReservationOptions;for(var n=0;n<t.options.length;n++)if(void 0!=t.tempSelectOption&&t.tempSelectOption.serviceOptionId==t.options[n].serviceOptionId){t.selectOption=t.options[n];break}}}else t.selectOption=t.tempSelectOption;"PER_PERSON"!=e.servicePricingType&&"PER_PERSON_PER_NIGHT"!=e.servicePricingType||(void 0!=t.adult&&0!=t.adult&&(a=!0),void 0!=t.children&&0!=t.children&&(a=!0)),t.optionsColor="#898989",t.dropdownOptions="#eaeaea"}}),"PER_PERSON"!=e.servicePricingType&&"PER_PERSON_PER_NIGHT"!=e.servicePricingType||(1==a?(e.tempChecked=!0,e.checked=!0):(e.tempChecked=!1,e.checked=!1));for(var t=e.eachDayRate.length-1;t>0;t--)1==e.eachDayRate[t].isAdded&&void 0==e.eachDayRate[t].selectOption&&(e.eachDayRate.splice(t,1),e.addAnotherItemVar=e.addAnotherItemVar-1)},i.done=function(e){if("PER_ROOM"==e.servicePricingType)for(var a=e.eachDayRate.length-1;a>=0;a--)1==e.eachDayRate[a].isAdded&&void 0==e.eachDayRate[a].selectOption?(e.eachDayRate.splice(a,1),e.addAnotherItemVar=e.addAnotherItemVar-1):void 0==e.eachDayRate[a].isAdded&&void 0==e.eachDayRate[a].selectOption&&e.eachDayRate.splice(a,1);var t=!1;i.showServices="display-none",h.onModalClose();for(var o=[],r=0,n=[],s=[],l=0,c=0,a=0;a<e.eachDayRate.length;a++){if(1==e.eachDayRate[a].allSelected?e.eachDayRate[a].tempAllSelected=!0:e.eachDayRate[a].tempAllSelected=!1,void 0!=e.eachDayRate[a].date?(e.eachDayRate[a].dateIsSelected=!0,e.eachDayRate[a].tempDate=e.eachDayRate[a].date,e.date=e.eachDayRate[a].date):void 0==e.eachDayRate[a].date&&(e.eachDayRate[a].dateIsSelected=!1,delete e.eachDayRate[a].tempDate),1==e.eachDayRate[a].isChecked?(e.eachDayRate[a].tempIsChecked=!0,e.hideAgain=!1):0==e.eachDayRate[a].isChecked&&(e.eachDayRate[a].tempIsChecked=!1,e.hideAgain=!0),void 0!=e.eachDayRate[a].adult&&0!=e.eachDayRate[a].adult?(e.eachDayRate[a].adultIsSelected=!0,e.eachDayRate[a].tempAdult=e.eachDayRate[a].adult,o.push(e.eachDayRate[a].adult)):void 0==e.eachDayRate[a].adult?(e.eachDayRate[a].adultIsSelected=!1,delete e.eachDayRate[a].tempAdult):0==e.eachDayRate[a].adult&&0!=e.eachDayRate[a].children&&void 0!=e.eachDayRate[a].children&&(e.eachDayRate[a].adultIsSelected=!0,e.eachDayRate[a].tempAdult=e.eachDayRate[a].adult,o.push(e.eachDayRate[a].adult)),void 0!=e.eachDayRate[a].children?(e.eachDayRate[a].childrenIsSelected=!0,e.eachDayRate[a].tempChildren=e.eachDayRate[a].children,n.push(e.eachDayRate[a].children)):void 0==e.eachDayRate[a].children&&(e.eachDayRate[a].childrenIsSelected=!1,delete e.eachDayRate[a].tempChildren),void 0!=e.eachDayRate[a].room?(e.eachDayRate[a].roomsIsSelected=!0,e.eachDayRate[a].tempRooms=e.eachDayRate[a].room,s.push(e.eachDayRate[a].room)):void 0==e.eachDayRate[a].room&&(e.eachDayRate[a].roomsIsSelected=!1,delete e.eachDayRate[a].tempRooms),1==e.eachDayRate[a].isChecked?e.eachDayRate[a].tempIsChecked=!0:0==e.eachDayRate[a].isChecked&&(e.eachDayRate[a].tempIsChecked=!1),void 0!=e.eachDayRate[a].selectOption?void 0!=e.eachDayRate[a].date||void 0!=e.eachDayRate[a].adult||void 0!=e.eachDayRate[a].children||void 0!=e.eachDayRate[a].room?(e.eachDayRate[a].selectOptionIsSelected=!0,e.eachDayRate[a].tempSelectOption=e.eachDayRate[a].selectOption,"PER_RESERVATION"==e.servicePricingType&&e.eachDayRate[a].options.length>0&&(e.eachDayRate[a].tempReservationOptions=e.eachDayRate[a].options),t=!0):"PER_ROOM"==e.servicePricingType?(delete e.eachDayRate[a].selectOption,delete e.eachDayRate[a].dropdownOptions,delete e.eachDayRate[a].optionsColor,e.eachDayRate[a].selectOptionIsSelected=!1,delete e.eachDayRate[a].tempSelectOption,delete e.eachDayRate[a].isAdded,e.eachDayRate[a].options=[],e.addAnotherItemVar=e.addAnotherItemVar-1):(delete e.eachDayRate[a].selectOption,delete e.eachDayRate[a].dropdownOptions,delete e.eachDayRate[a].optionsColor,e.eachDayRate[a].selectOptionIsSelected=!1,delete e.eachDayRate[a].tempSelectOption,delete e.eachDayRate[a].isAdded):void 0==e.eachDayRate[a].selectOption&&(e.eachDayRate[a].selectOptionIsSelected=!1,delete e.eachDayRate[a].tempSelectOption),void 0!=e.eachDayRate[a].adult&&void 0!=e.eachDayRate[a].selectOption)var d=e.eachDayRate[a].adult*e.eachDayRate[a].selectOption.adultUnitPrice;else var d=0;if("PER_RESERVATION"==e.servicePricingType&&void 0!=e.eachDayRate[a].selectOption)var d=e.eachDayRate[a].selectOption.adultUnitPrice;else if("PER_PERSON_PER_NIGHT"!=e.servicePricingType&&"PER_PERSON"!=e.servicePricingType)var d=0;if(void 0!=e.eachDayRate[a].children&&void 0!=e.eachDayRate[a].selectOption)var g=e.eachDayRate[a].children*e.eachDayRate[a].selectOption.childUnitPrice;else var g=0;if(void 0!=e.eachDayRate[a].room&&void 0!=e.eachDayRate[a].selectOption)var m=e.eachDayRate[a].room*e.eachDayRate[a].selectOption.adultUnitPrice;else var m=0;void 0!=e.eachDayRate[a].selectOption&&void 0!=e.eachDayRate[a].adult&&(i.enhancementFlag=!0,l=l+d+g,c=c+d+g-e.eachDayRate[a].selectOption.discountRate*(e.eachDayRate[a].selectOption.adultUnitPrice+e.eachDayRate[a].selectOption.childUnitPrice)*e.eachDayRate[a].adult),void 0!=e.eachDayRate[a].selectOption&&void 0==e.eachDayRate[a].adult&&void 0!=e.eachDayRate[a].children&&(l+=g,c=c+g-e.eachDayRate[a].selectOption.discountRate*e.eachDayRate[a].selectOption.childUnitPrice*e.eachDayRate[a].children*(1+e.eachDayRate[a].selectOption.taxRate)),void 0!=e.eachDayRate[a].selectOption&&void 0!=e.eachDayRate[a].room&&(i.enhancementFlag=!0,l+=m,c=c+m-e.eachDayRate[a].selectOption.discountRate*e.eachDayRate[a].selectOption.adultUnitPrice*e.eachDayRate[a].room),"PER_RESERVATION"==e.servicePricingType&&void 0!=e.eachDayRate[a].selectOption&&(i.enhancementFlag=!0,l+=d,c=c+d-e.eachDayRate[a].selectOption.discountRate*e.eachDayRate[a].selectOption.adultUnitPrice),e.adult=Math.max.apply(null,o),e.children=Math.max.apply(null,n),e.rooms=Math.max.apply(null,s),((void 0!=e.eachDayRate[a].adult||void 0!=e.eachDayRate[a].room)&&void 0!=e.eachDayRate[a].selectOption&&"PER_PERSON"!=e.servicePricingType&&"PER_ROOM"!=e.servicePricingType||"PER_RESERVATION"==e.servicePricingType&&void 0!=e.eachDayRate[a].selectOption)&&r++}e.days=r,e.price=l,e.finalPrice=c,1==t?(e.tempChecked=!0,e.checked=!0):(e.tempChecked=!1,e.checked=!1),i.subTotalFinalPrice=0;for(var a=0;a<i.enhancementServices.length;a++)void 0!=i.subTotalFinalPrice&&void 0!=i.enhancementServices[a].finalPrice?i.subTotalFinalPrice=i.subTotalFinalPrice+i.enhancementServices[a].finalPrice:void 0!=i.enhancementServices[a].finalPrice&&(i.subTotalFinalPrice=i.enhancementServices[a].finalPrice);for(var u=!1,a=0;a<i.enhancementServices.length;a++)1==i.enhancementServices[a].checked&&(u=!0);i.submitEnable=1!=u,i.enableCompleteUpsell=!1,i.isEnhancementUpsellEnabled?i.enableCompleteUpsell=!0:i.enableCompleteUpsell=!1},i.showModel=function(e,a){i.hasDiscountServices&&(a=i.enhancementServices.findIndex(function(a){return a.serviceTypeId===e.serviceTypeId})),"PER_ROOM"==e.servicePricingType&&void 0==e.addAnotherItemVar&&(e.addAnotherItemVar=1),i.doneEnable=!0,void 0==e.tempChecked?e.checked=!1:0==e.tempChecked?e.checked=!1:e.checked=!0;var t=r.pageYOffset,o=t+20+"px";if(i.showServices="display-block",i.fromTop=o,"PER_ROOM"==e.servicePricingType)if(!0===e.checked)i.currentServices=e;else{if(i.currentServices=i.enhancementServices[a],void 0!=i.currentServices.eachDayRate[0].options&&void 0!=i.currentServices.eachDayRate[0].tempOptions&&i.currentServices.eachDayRate[0].options.length<i.currentServices.eachDayRate[0].tempOptions.length){e.addAnotherItemVar=1;var n=angular.copy(i.currentServices.eachDayRate[0].tempOptions);i.currentServices.eachDayRate[0].options=n,delete i.currentServices.eachDayRate[0].isAdded}e.checked=!1}else i.currentServices=e;angular.forEach(i.currentServices.eachDayRate,function(e){1==e.allSelected&&(i.doneEnable=!1),"#898989"!=e.dateColor&&(e.dateColor="#d2d2d2"),"#898989"!=e.adultsColor&&(e.adultsColor="#d2d2d2"),"#898989"!=e.childrenColor&&(e.childrenColor="#d2d2d2"),"#898989"!=e.roomsColor&&(e.roomsColor="#d2d2d2"),"#898989"!=e.optionsColor&&(e.optionsColor="#d2d2d2")});for(var s=0;s<i.currentServices.eachDayRate.length;s++)if(i.currentServices.eachDayRate[s].options.length>0){i.firstIndex=s;break}if("PER_PERSON_PER_NIGHT"==e.servicePricingType||"PER_PERSON"==e.servicePricingType)for(var s=0;s<e.eachDayRate.length;s++)if(e.eachDayRate[s].options.length>0){i.adultsInService=d.numToArray(e.eachDayRate[s].options[0].adultQuantity+1),i.childrenInService=d.numToArray(e.eachDayRate[s].options[0].childQuantity+1);break}if("PER_ROOM_PER_NIGHT"!=e.servicePricingType&&"PER_ROOM"!=e.servicePricingType||(i.roomsInservice=d.numToArray(X.rooms+1),i.roomsInservice.splice(0,1)),"PER_ROOM"==e.servicePricingType){var l=0;angular.forEach(e.eachDayRate,function(a,t){e.addAnotherItemVar>1&&a.room>0&&a.options.length>0&&(t>0?(a.options[0].maxLimit=e.maxLimit-l==0?-1:e.maxLimit-l,l+=a.room):(l=a.room,a.options[0].maxLimit=e.maxLimit))})}for(var s=0;s<i.currentServices.eachDayRate.length;s++)"PER_PERSON_PER_NIGHT"!=e.servicePricingType&&"PER_PERSON"!=e.servicePricingType||void 0==i.currentServices.eachDayRate[s].adult&&void 0==i.currentServices.eachDayRate[s].children&&i.currentServices.eachDayRate[s].options.length>0&&(i.adultsInService.length>0&&(i.currentServices.eachDayRate[s].adult=i.adultsInService[i.adultsInService.length-1],i.currentServices.eachDayRate[s].adultIsSelected=!0,i.currentServices.eachDayRate[s].adultsColor="#898989",i.currentServices.eachDayRate[s].dropdownAdult="#eaeaea"),i.childrenInService.length>0&&(i.currentServices.eachDayRate[s].children=i.childrenInService[i.childrenInService.length-1],i.currentServices.eachDayRate[s].childrenIsSelected=!0,i.currentServices.eachDayRate[s].childrenColor="#898989",i.currentServices.eachDayRate[s].dropdownChildren="#eaeaea")),"PER_ROOM_PER_NIGHT"!=e.servicePricingType&&"PER_ROOM"!=e.servicePricingType||void 0==e.eachDayRate[s].room&&e.eachDayRate[s].options.length>0&&i.roomsInservice.length>0&&(i.currentServices.eachDayRate[s].room=i.roomsInservice[i.roomsInservice.length-1],i.currentServices.eachDayRate[s].roomsIsSelected=!0,i.currentServices.eachDayRate[s].roomsColor="#898989",i.currentServices.eachDayRate[s].dropdownRooms="#eaeaea"),"PER_ROOM"==e.servicePricingType&&1==e.eachDayRate[s].isAdded&&void 0==e.eachDayRate[s].selectOption&&(delete e.eachDayRate[s].selectOption,delete e.eachDayRate[s].dropdownOptions,delete e.eachDayRate[s].optionsColor,e.eachDayRate[s].selectOptionIsSelected=!1,delete e.eachDayRate[s].tempSelectOption,delete e.eachDayRate[s].isAdded,1!=e.addAnotherItemVar&&(e.addAnotherItemVar=e.addAnotherItemVar-1,e.eachDayRate[s].options=[]));if(1!=i.currentServices.checked&&1==i.currentServices.serviceOptions.length)for(var s=0;s<i.currentServices.eachDayRate.length;s++)void 0==i.currentServices.eachDayRate[s].selectOptionIsSelected&&(i.currentServices.eachDayRate[s].selectOptionIsSelected=!0),"PER_RESERVATION"==i.currentServices.servicePricingType&&1==i.currentServices.eachDayRate[s].selectOptionIsSelected&&(i.currentServices.eachDayRate[s].selectOption=i.currentServices.eachDayRate[s].options[0],i.currentServices.eachDayRate[s].optionsColor="#898989",i.currentServices.eachDayRate[s].dropdownOptions="#eaeaea",i.currentServices.eachDayRate[s].date=i.currentServices.eachDayRate[s].serviceDate,i.currentServices.eachDayRate[s].dateColor="#898989",i.currentServices.eachDayRate[s].dropdownDate="#eaeaea",void 0!=i.currentServices.eachDayRate[s].date&&void 0!=i.currentServices.eachDayRate[s].selectOption&&(i.currentServices.eachDayRate[s].allSelected=!0,i.doneEnable=!1)),"PER_PERSON_PER_NIGHT"!=i.currentServices.servicePricingType&&"PER_PERSON"!=i.currentServices.servicePricingType||1==i.currentServices.eachDayRate[s].selectOptionIsSelected&&(i.currentServices.eachDayRate[s].selectOption=i.currentServices.eachDayRate[s].options[0],i.currentServices.eachDayRate[s].optionsColor="#898989",i.currentServices.eachDayRate[s].dropdownOptions="#eaeaea",void 0!=i.currentServices.eachDayRate[s].adult&&void 0!=i.currentServices.eachDayRate[s].selectOption&&(i.currentServices.eachDayRate[s].allSelected=!0,i.doneEnable=!1)),"PER_ROOM"!=i.currentServices.servicePricingType&&"PER_ROOM_PER_NIGHT"!=i.currentServices.servicePricingType||1==i.currentServices.eachDayRate[s].selectOptionIsSelected&&(i.currentServices.eachDayRate[s].selectOption=i.currentServices.eachDayRate[s].options[0],i.currentServices.eachDayRate[s].optionsColor="#898989",i.currentServices.eachDayRate[s].dropdownOptions="#eaeaea",void 0!=i.currentServices.eachDayRate[s].room&&void 0!=i.currentServices.eachDayRate[s].selectOption&&(i.currentServices.eachDayRate[s].allSelected=!0,i.doneEnable=!1));var c=A.getTotalEnhancement(e),m=c.totalPrice,u=c.totalfinalPrice,p=c.packageTotalFinalPrice,y=c.packageTotalFinalPriceDisc;i.totalPrice=m,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(i.totalPrice=parseFloat(m).toFixed(2),i.totalFinalPrice=parseFloat(u).toFixed(2),i.packageTotalFinalPrice=parseFloat(p).toFixed(2),i.hasDiscountServices&&(i.packageTotalFinalPriceDiscount=parseFloat(y).toFixed(2))):(i.totalPrice=parseFloat(m).toFixed(0),i.totalFinalPrice=parseFloat(u).toFixed(0),i.packageTotalFinalPrice=parseFloat(p).toFixed(0),i.hasDiscountServices&&(i.packageTotalFinalPriceDiscount=parseFloat(y).toFixed(0)));var v="enhancement-"+a+"-id";h.onModalOpen(v,"confirmationPage-enhancement-modal","confirmationPage-enhancement-title",!1,i.goBack,e)},i.addAnotherItem=function(e,a){var t=angular.copy(a.eachDayRate[0]);if(t.allSelected=!1,t.roomsIsSelected=!0,t.selectOptionIsSelected=!1,t.roomsColor="#898989",t.optionsColor="#d2d2d2",t.room=i.roomsInservice[i.roomsInservice.length-1],delete t.adultsColor,delete t.dropdownOptions,delete t.temRooms,delete t.selectOption,delete t.tempSelectOption,void 0!=a.eachDayRate[a.addAnotherItemVar]){if(a.eachDayRate[a.addAnotherItemVar].tempOptions=a.eachDayRate[0].tempOptions,0==a.eachDayRate[a.addAnotherItemVar].options.length){for(var o=0;o<t.options.length;o++)for(var r=0;r<a.eachDayRate.length;r++)void 0!=a.eachDayRate[r].selectOption&&a.eachDayRate[r].selectOption.serviceOptionId==t.options[o].serviceOptionId&&t.options.splice(o,1);a.eachDayRate[a.addAnotherItemVar]=t,a.eachDayRate[a.addAnotherItemVar].isAdded=!0}}else{for(var o=0;o<t.options.length;o++)for(var r=0;r<a.eachDayRate.length;r++)void 0!=a.eachDayRate[r].selectOption&&a.eachDayRate[r].selectOption.serviceOptionId==t.options[o].serviceOptionId&&t.options.splice(o,1);t.isAdded=!0,a.eachDayRate.push(t)}a.addAnotherItemVar++},i.clearAllSelections=function(e,a){if(1==e.checked)e.checked=!1,
i.showModel(e,a);else if(delete e.date,delete e.price,delete e.finalPrice,delete e.adult,delete e.children,delete e.rooms,delete e.days,delete e.tempChecked,angular.forEach(e.eachDayRate,function(e){delete e.date,delete e.tempDate,delete e.dateIsSelected,delete e.dateColor,delete e.dropdownDate,delete e.adult,delete e.tempAdult,delete e.adultIsSelected,delete e.adultsColor,delete e.dropdownAdult,delete e.children,delete e.dropdownChildren,delete e.childrenIsSelected,delete e.childrenColor,delete e.dropdownRooms,delete e.roomsIsSelected,delete e.roomsColor,delete e.room,delete e.dropdownOptions,delete e.optionsColor,delete e.tempChecked,delete e.selectOptionIsSelected,delete e.selectOption,delete e.tempSelectOption,delete e.isChecked,delete e.allSelected}),void 0!=i.enhancementServices){i.subTotalFinalPrice=0;for(var t=0;t<i.enhancementServices.length;t++)void 0!=i.subTotalFinalPrice&&void 0!=i.enhancementServices[t].finalPrice?i.subTotalFinalPrice=i.subTotalFinalPrice+i.enhancementServices[t].finalPrice:void 0!=i.enhancementServices[t].finalPrice&&(i.subTotalFinalPrice=i.enhancementServices[t].finalPrice)}for(var o=!1,t=0;t<i.enhancementServices.length;t++)1==i.enhancementServices[t].checked&&(o=!0);i.submitEnable=1!=o};var ee=function(e){for(var a=0,t=0;t<e.eachDayRate.length;t++)e.eachDayRate[t].options.length>0&&a++;a>1&&(e.UseSelection=!0);for(var t=0;t<e.eachDayRate.length;t++)e.eachDayRate[t].isChecked=!1,void 0!=e.eachDayRate[t].adult||"PER_PERSON_PER_NIGHT"==e.servicePricingType&&"PER_PERSON"==e.servicePricingType||(e.hideAgain=!1),"PER_PERSON_PER_NIGHT"!=e.servicePricingType&&"PER_PERSON"!=e.servicePricingType||(i.doneEnable=!0,void 0==e.eachDayRate[t].selectOption||void 0==e.eachDayRate[t].adult||0==e.eachDayRate[t].adult&&0==e.eachDayRate[t].children?i.doneEnable=!0:i.doneEnable=!1);for(var o,t=0;t<e.eachDayRate.length;t++){if(!("PER_PERSON_PER_NIGHT"!=e.servicePricingType&&"PER_PERSON"!=e.servicePricingType||(o=!1,void 0==e.eachDayRate[t].selectOption||void 0==e.eachDayRate[t].adult&&void 0==e.eachDayRate[t].children))){o=!0;break}if(("PER_ROOM_PER_NIGHT"==e.servicePricingType||"PER_ROOM"==e.servicePricingType)&&(o=!1,void 0!=e.eachDayRate[t].selectOption&&void 0!=e.eachDayRate[t].room)){o=!0;break}}"PER_RESERVATION"!=e.servicePricingType&&(i.doneEnable=0==o);for(var t=0;t<e.eachDayRate.length;t++)void 0!=e.eachDayRate[t].room||"PER_ROOM"==e.servicePricingType&&"PER_ROOM_PER_NIGHT"==e.servicePricingType||(e.hideAgain=!1);for(var t=0;t<e.eachDayRate.length;t++)void 0!=e.eachDayRate[t].children||void 0==i.childrenInService||"PER_PERSON_PER_NIGHT"!=e.servicePricingType&&"PER_PERSON"!=e.servicePricingType||i.childrenInService.length>1&&(e.hideAgain=!1);for(var t=0;t<e.eachDayRate.length;t++)void 0==e.eachDayRate[t].selectOption&&(e.hideAgain=!1);var r=!0,n=!1,s=A.getTotalEnhancement(e),l=s.totalPrice,c=s.totalfinalPrice,d=s.packageTotalFinalPrice,m=s.packageTotalFinalPriceDisc;l>0&&(i.enhancementFlag=!0),i.totalPrice=l,g.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(i.totalPrice=parseFloat(l).toFixed(2),i.totalFinalPrice=parseFloat(c).toFixed(2),i.packageTotalFinalPrice=parseFloat(d).toFixed(2),i.hasDiscountServices&&(i.packageTotalFinalPriceDiscount=parseFloat(m).toFixed(2))):(i.totalPrice=parseFloat(l).toFixed(0),i.totalFinalPrice=parseFloat(c).toFixed(0),i.packageTotalFinalPrice=parseFloat(d).toFixed(0),i.hasDiscountServices&&(i.packageTotalFinalPriceDiscount=parseFloat(m).toFixed(0)));var u=angular.copy(e);if(p.remove(u.eachDayRate,function(e){return 0===e.options.length?e:""}),"PER_ROOM"==e.servicePricingType){var y=0;angular.forEach(e.eachDayRate,function(a,t){e.addAnotherItemVar>1&&e.eachDayRate[0].serviceDate===a.serviceDate&&a.room>0&&a.options.length>0&&(t>0?(a.options[0].maxLimit=e.maxLimit-y==0?-1:e.maxLimit-y,y+=a.room):(y=a.room,a.options[0].maxLimit=e.maxLimit))})}angular.forEach(u.eachDayRate,function(e){e.allSelected||(r=!1),"PER_PERSON_PER_NIGHT"!=u.servicePricingType&&"PER_PERSON"!=u.servicePricingType||(i.doneEnable=!0,0!=e.options[0].adultQuantity&&0!=e.options[0].childQuantity?void 0!==e.selectOption&&(0===e.options[0].adultQuantity||void 0!==e.adult&&0!==e.adult||0===e.options[0].childQuantity||void 0!==e.children&&0!==e.children)&&(n=!0):void 0!==e.selectOption&&(0===e.options[0].adultQuantity||void 0!==e.adult&&0!==e.adult)&&(0===e.options[0].childQuantity||void 0!==e.children&&0!==e.children)&&(n=!0))}),"PER_PERSON_PER_NIGHT"!=u.servicePricingType&&"PER_PERSON"!=u.servicePricingType||(i.doneEnable=!n),e.eachDayRate[i.firstIndex].isChecked=!!r};if(i.allSelectedChanged=function(e,a){0==e.allSelected?(delete e.adult,delete e.dropdownAdult,e.adultsColor="#d2d2d2",delete e.children,delete e.dropdownChildren,e.roomsColor="#d2d2d2",delete e.room,delete e.dropdownRooms,e.childrenColor="#d2d2d2",delete e.selectOption,delete e.dropdownOptions,delete e.date,delete e.dropdownDate,e.optionsColor="#d2d2d2",e.dateColor="#d2d2d2",ee(a),"PER_RESERVATION"==a.servicePricingType&&(i.doneEnable=!0),void 0!=i.firstIndex&&(a.eachDayRate[i.firstIndex].isChecked=!1)):((void 0!=i.adultsInService&&i.adultsInService.length>0&&"PER_PERSON_PER_NIGHT"==a.servicePricingType||"PER_PERSON"==a.servicePricingType)&&(e.adult=i.adultsInService[i.adultsInService.length-1],i.changeDropdownAdult(e,a)),void 0!=e.serviceDates&&e.serviceDates.length>0&&"PER_RESERVATION"==a.servicePricingType&&(e.date=e.serviceDates[0],i.changeDropdownDate(e,a)),void 0!=i.childrenInService&&i.childrenInService.length>0&&("PER_PERSON_PER_NIGHT"==a.servicePricingType||"PER_PERSON"==a.servicePricingType)&&(e.children=i.childrenInService[i.childrenInService.length-1],i.changeDropdownChildren(e,a)),void 0!=i.roomsInservice&&i.roomsInservice.length>0&&("PER_ROOM_PER_NIGHT"==a.servicePricingType||"PER_ROOM"==a.servicePricingType)&&(e.room=i.roomsInservice[i.roomsInservice.length-1],i.changeDropdownRoom(e,a)),e.selectOption=e.options[0],i.changeDropdownOptions(e,a));var t=document.getElementById("enhancementDetail");t&&t.focus()},i.totalServices={},i.setUpDateOption=function(e,a){if(e.dateDropdownOption={},e&&e.serviceDates&&a&&a.serviceOptions)for(var t=0;t<e.serviceDates.length;t++)for(var o=0;o<a.serviceOptions.length;o++)for(var r=0;r<a.serviceOptions[o].dailyRates.length;r++)if(e.serviceDates[t]==a.serviceOptions[o].dailyRates[r].serviceDate){var n=e.serviceDates[t];e.dateDropdownOption[n]=a.serviceOptions[o].dailyRates[r];for(var i=0;i<a.eachDayRate.length;i++)void 0!=e.resOwnServiceDate&&e.resOwnServiceDate==e.serviceDates[i]&&void 0!=e.resOwnAmount&&(e.dateDropdownOption[e.serviceDates[i]].resOwnAmount=e.resOwnAmount,e.dateDropdownOption[e.serviceDates[i]].resOwnDiscountAmount=e.resOwnDiscountAmount)}},i.changeDropdownDate=function(e,a){e.dateColor="#898989",e.dropdownDate="#eaeaea";var t;if("PER_RESERVATION"==a.servicePricingType){void 0!=e.date&&void 0!=e.selectOption&&(e.allSelected=!0,i.doneEnable=!1,t=angular.copy(e.selectOption)),e.options=[];for(var o=0;o<a.serviceOptions.length;o++)for(var r=0;r<a.serviceOptions[o].dailyRates.length;r++)e.date==a.serviceOptions[o].dailyRates[r].serviceDate&&e.options.push(a.serviceOptions[o].dailyRates[r]),e.optionsColor="#d2d2d2",delete e.selectOption,delete e.dropdownOptions}if(t)for(var o=0;o<e.options.length;o++)e.options[o].serviceOptionId===t.serviceOptionId&&(e.selectOption=e.options[o],e.optionsColor="#898989",e.dropdownOptions="#eaeaea");T(e,a),ee(a)},i.changeDropdownAdult=function(e,a){if(e.adultsColor="#898989",e.dropdownAdult="#eaeaea","PER_PERSON_PER_NIGHT"!=a.servicePricingType&&"PER_PERSON"!=a.servicePricingType||void 0!=e.adult&&void 0!=e.selectOption&&(e.allSelected=!0,i.doneEnable=!1),ee(a),"PER_PERSON_PER_NIGHT"==a.servicePricingType)for(var t=0;t<a.eachDayRate.length;t++)if(1==a.eachDayRate[t].isChecked)for(var o=0;o<a.eachDayRate.length;o++)a.eachDayRate[o].adult!=e.adult&&(a.eachDayRate[t].isChecked=!1);T(e,a)},i.changeDropdownChildren=function(e,a){if(e.childrenColor="#898989",e.dropdownChildren="#eaeaea","PER_PERSON_PER_NIGHT"!=a.servicePricingType&&"PER_PERSON"!=a.servicePricingType||(void 0!=e.adult&&void 0!=e.selectOption&&(e.allSelected=!0,i.doneEnable=!1),void 0!=e.children&&void 0!=e.selectOption&&(e.allSelected=!0,i.doneEnable=!1)),ee(a),"PER_PERSON_PER_NIGHT"==a.servicePricingType)for(var t=0;t<a.eachDayRate.length;t++)if(1==a.eachDayRate[t].isChecked)for(var o=0;o<a.eachDayRate.length;o++)a.eachDayRate[o].children!=e.children&&(a.eachDayRate[t].isChecked=!1);T(e,a)},i.changeDropdownRoom=function(e,a){if(e.roomsColor="#898989",e.dropdownRooms="#eaeaea","PER_ROOM"!=a.servicePricingType&&"PER_ROOM_PER_NIGHT"!=a.servicePricingType||void 0!=e.room&&void 0!=e.selectOption&&(e.allSelected=!0,i.doneEnable=!1),ee(a),"PER_ROOM_PER_NIGHT"==a.servicePricingType)for(var t=0;t<a.eachDayRate.length;t++)if(1==a.eachDayRate[t].isChecked)for(var o=0;o<a.eachDayRate.length;o++)a.eachDayRate[o].room!=e.room&&(a.eachDayRate[t].isChecked=!1);T(e,a)},i.changeDropdownOptions=function(e,a){if(e.optionsColor="#898989",e.dropdownOptions="#eaeaea","PER_PERSON_PER_NIGHT"!=a.servicePricingType&&"PER_PERSON"!=a.servicePricingType||(void 0!=e.adult&&void 0!=e.selectOption&&(e.allSelected=!0,i.doneEnable=!1),void 0!=e.children&&void 0!=e.selectOption&&(e.allSelected=!0,i.doneEnable=!1)),"PER_ROOM"!=a.servicePricingType&&"PER_ROOM_PER_NIGHT"!=a.servicePricingType||void 0!=e.room&&void 0!=e.selectOption&&(e.allSelected=!0,i.doneEnable=!1),"PER_RESERVATION"==a.servicePricingType&&void 0!=e.selectOption&&void 0!=e.date&&(e.allSelected=!0,i.doneEnable=!1),ee(a),"PER_ROOM_PER_NIGHT"==a.servicePricingType||"PER_PERSON_PER_NIGHT"==a.servicePricingType)for(var t=0;t<a.eachDayRate.length;t++)if(1==a.eachDayRate[t].isChecked)for(var o=0;o<a.eachDayRate.length;o++)void 0!=a.eachDayRate[o].selectOption&&a.eachDayRate[o].selectOption.serviceOptionName!=e.selectOption.serviceOptionName&&(a.eachDayRate[t].isChecked=!1);T(e,a)},i.changedCheckBoxSecond=function(e,a){1==e.isChecked&&(angular.forEach(a.eachDayRate,function(t){if(void 0!=e.adult&&t.options.length>0&&(t.adult=e.adult,t.adultsColor="#898989",t.dropdownAdult="#eaeaea"),void 0!=e.children&&t.options.length>0&&(t.children=e.children,t.childrenColor="#898989",t.dropdownChildren="#eaeaea"),void 0!=e.room&&t.options.length>0&&(t.room=e.room,t.roomsColor="#898989",t.dropdownRooms="#eaeaea"),e.selectOption)for(var o=0;o<t.options.length;o++)t.options[o].serviceOptionId==e.selectOption.serviceOptionId&&(t.selectOption=t.options[o],t.optionsColor="#898989",t.dropdownOptions="#eaeaea");t.allSelected=!0,t.options.length>0&&T(t,a),ee(a)}),a.hideAgain=!0)},i.changeLimit=function(){e.debug(JSON.stringify(c.getMainReservation())+"ok"),3==i.servicesLimit?(i.servicesLimit=100,i.hideMoreEnhancement=!0):100==i.servicesLimit&&(i.servicesLimit=3,i.hideMoreEnhancement=!1),m.eventTrack("ClickVIewMoreEnhancementsFromConfirm",{category:"UserNavigation",label:"View more enhancements on the Confirmation page"}),setTimeout(function(){var e=document.getElementById("enhancement-0-id");e&&e.focus()})},i.submitEnableForUpgradeRoom=!0,i.selectUpgradeRoom=function(e){for(var a=0;a<i.upgradeRoom.length;++a)i.upgradeRoom[a].roomTypeCode!=e.roomTypeCode&&1==i.upgradeRoom[a].checked&&(i.upgradeRoom[a].checked=!1);if(1==e.checked)i.UpgradeRoom=e,i.submitEnableForUpgradeRoom=!1,Q(i.UpgradeRoom);else{i.UpgradeRoom=void 0,i.submitEnableForUpgradeRoom=!0;var t;t=n.MRB?angular.copy(i.postBookingRoomInContext.roomStays[0]):angular.copy(c.getMainReservation().roomStays[0]),t.roomRates[0].currentRate||(t.roomRates[0].currentRate=t.ratePlans[0]),Q(t.roomRates[0])}m.eventTrack("ClickConfirmUpgrade",{category:"UserNavigation",label:e.roomTypeCode})},i.modifyReservation=function(){var a,o=c.getMainReservation();if(o&&o.merchandisedPromoData&&o.merchandisedPromoData.promotionId&&(a=o.merchandisedPromoData.promotionId),c.removePromotionDataOnModifyReservation(a),n.MRB&&(n.MRB=!1),m.eventTrack("PostBooking",{category:"UserNavigation",label:"Modify reservation"}),c.setPolicyOverrideIndicator(),e.debug(JSON.stringify(c.getMainReservation())+"before$rootScope.finalServices"),c.modifyFinalConfirmation(i.enhancementServices),e.debug(JSON.stringify(c.getMainReservation())+"reservationService.getMainReservation() final"),i._reservationService=c.getMainReservation(),void 0!=i.UpgradeRoom){i._reservationService.roomStays[0].roomRates[0].roomTypeCode=i.UpgradeRoom.roomTypeCode,i._reservationService.roomStays[0].roomRates[0].roomTypeName=i.UpgradeRoom.roomTypeName;for(var r=angular.copy(J),l=[],d=parseInt(i.UpgradeRoom.roomTypeCode,10),g=0;g<r.length;g++)for(var u=0;u<i._reservationService.services.length;u++)r[g].serviceTypeId!==i._reservationService.services[u].serviceTypeId||!p.includes(r[g].associatedRoomTypeIds,d)&&r[g].associatedRoomTypeIds||l.push(i._reservationService.services[u]);for(var u=0;u<i._reservationService.services.length;u++)"PACKAGE_INCLUSION"===i._reservationService.services[u].serviceCategory&&l.push(i._reservationService.services[u]);i._reservationService.services=l;for(var g=0;g<i.enhancementServices.length;g++)if(i.enhancementServices[g].checked){var y=!1;for(u=0;u<i._reservationService.services.length;u++)i.enhancementServices[g].serviceTypeId===i._reservationService.services[u].serviceTypeId&&(y=!0);y||i._reservationService.services.push(i.enhancementServices[g])}}var v=i._reservationService.hotelCode;t.modifyHoldReservation(v,i._reservationService,!0).success(function(a){c.handleXssVulnerabilities(a),P.setMyCheckRefershTokenDetails(a),n.arrivedConfirmation=!1,c.setModifyFlowFlag(),c.setReservationFromRetrieve(a),setTimeout(function(){i.$broadcast("EVENT.ADD_ANOTHER_ENHANCEMENT")},2e3),c.setConfig("policyOverrideIndicator"),s.go("total"),n.arrivedConfirmation=!0,e.debug(JSON.stringify(a)+"final reservationService.getMainReservation()"),c.setConfig("POST_BOOKING_ENHANCEMENT")}).error(function(){})},i.totalData=c.getFormattedReservationData(_),i.taxBreakoutEnabled=i.totalData.taxBreakoutEnabled,i.finalReservation=c.getMainReservation(),n.MRB&&(i.finalMultiRoomReservation=c.getMainReservationArray()[0]),e.debug("$scope.finalReservation"),e.debug(i.finalReservation),(!n.MRB||n.MRB&&1==c.getMainReservationArray().length)&&(i.finalReservation&&i.finalReservation.resGlobalInfo&&i.finalReservation.resGlobalInfo.comments&&i.finalReservation.resGlobalInfo.comments.length>0&&void 0!=i.finalReservation.resGlobalInfo.comments[0].comment?i.commentFlag=O(i.finalReservation.resGlobalInfo.comments[0].comment):i.commentFlag=!1),e.debug(JSON.stringify(i.totalData)+"totalData"),e.debug(JSON.stringify(i.finalReservation)+"$scope.finalReservation"),!n.MRB&&i.finalReservation.resGlobalInfo.guaranteesAccepted[0].paymentCard&&void 0!=i.finalReservation.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardNumber&&(i.paymentMethodSection=!0),n.MRB&&i.finalMultiRoomReservation.resGlobalInfo.guaranteesAccepted[0].paymentCard){void 0!=i.finalMultiRoomReservation.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardNumber&&(i.paymentMethodSection=!0);var U=i.finalMultiRoomReservation.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardCode;U&&(i.finalMultiRoomReservation.resGlobalInfo.guaranteesAccepted[0].paymentCard.capitalizeCardCode=U.charAt(0).toUpperCase()+U.substr(1).toLowerCase())}if(n.MRB){var ae=p.findIndex(i.finalMultiRoomReservation.resGuests[0].profile.customer.address,function(e){return"3"==e.useType});i.multiRoomBillingAddress=ae>-1?i.finalMultiRoomReservation.resGuests[0].profile.customer.address[ae]:i.finalMultiRoomReservation.resGuests[0].profile.customer.address[0]}if(!n.MRB){var ae=p.findIndex(i.finalReservation.resGuests[0].profile.customer.address,function(e){return"3"==e.useType});i.nonMultiRoomBillingAddress=ae>-1?i.finalReservation.resGuests[0].profile.customer.address[ae]:i.finalReservation.resGuests[0].profile.customer.address[0]}if(i.postBookingRoomToggle=function(e){if(i.showNOR1=!1,i.nor1RefUrl="",i.nor1ImgUrl="",i.submitEnable=!0,i.submitEnableForUpgradeRoom=!0,i.postBookingRoomInContext=e,c.setMainReservation(e.id),1==i.nor1Enabled)setTimeout(function(){var e=i.urlParamNor1();i.nor1RefUrl=nor1BaseUrl+"?"+e,i.nor1ImgUrl=nor1BaseUrl+"/dynLink?"+e,i.showNOR1=!0},0);else{var a=c.buildOptions();a.dateIn=c.getMainReservation().resGlobalInfo.timeSpan.start,a.dateOut=c.getMainReservation().resGlobalInfo.timeSpan.end,a.ratePlanCode=c.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode,a.ratePlanType=c.getMainReservation().roomStays[0].ratePlans[0].ratePlanType,void 0!=c.getMainReservation().roomStays[0].discountCode&&(a.allCodes={},a.allCodes.discount=c.getMainReservation().roomStays[0].discountCode),delete a.roomTypeCode;var t=c.buildOptions();t.dateIn=c.getMainReservation().resGlobalInfo.timeSpan.start,t.dateOut=c.getMainReservation().resGlobalInfo.timeSpan.end,t.ratePlanCode=c.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode,t.ratePlanType=c.getMainReservation().roomStays[0].ratePlans[0].ratePlanType,j(a),D(t)}},i.getIndex=function(e){return e+1},i.$on("$locationChangeStart",function(e,a,t){t.indexOf("/confirmation")>-1&&1==n.arrivedConfirmation&&e.preventDefault()}),i.keyDownOnRoomsDropdown=function(e){var a=i.mainReservationArray.length;if(38==e.keyCode){var t=i.mainReservationArray.indexOf(i.postBookingRoomInContext);t>0?i.postBookingRoomToggle(i.mainReservationArray[t-1]):i.postBookingRoomToggle(i.mainReservationArray[a-1]),e.preventDefault()}else if(40==e.keyCode){var t=i.mainReservationArray.indexOf(i.postBookingRoomInContext);t<a-1?i.postBookingRoomToggle(i.mainReservationArray[t+1]):i.postBookingRoomToggle(i.mainReservationArray[0]),e.preventDefault()}},window.innerWidth>786?i.hideEnhancementCheckBox=!0:i.hideEnhancementCheckBox=!1,R.getIsLoyaltyUserLogIn()){var te,oe=R.getAvailablePoints()?parseFloat(R.getAvailablePoints()):0,re=R.getBurnPoints()&&i.redemptionQuantityConfirmation?parseFloat(R.getBurnPoints()):0;if(!n.MRB||n.MRB&&1==c.getMainReservationArray().length){var k=c.getMainReservation();te=k.roomStays[0].total.amountAfterTax}else te=c.getMrbItineraryTotals().itineraryRoomGrandTotal;var ne=parseFloat(R.getMaxPointsToEnter(te)),ie=0;oe>0&&(re>0&&(ie=Math.round(re/ne*100)),ie<5?ie=0:ie>95&&(ie=100),m.eventTrack("PointsApplied",{category:"UserNavigation",label:ie}))}i.isPaidThroughLoyalty&&(S.getMenubarEnabled()&&r.TCCommonService.EventService.broadcast(document,"loyalty_guest_details_reload"),R.fireLoyaltyEvent("REFRESH_LOYALTY_INFO")),i.openTaxBreakdown=function(){i.showTaxBreakdown=!0},i.hideTaxBreakdown=function(){i.showTaxBreakdown=!1},i.completeUpsell=function(){c.modifyFinalConfirmation(i.enhancementServices);var e=c.getMainReservation(),a=e.hotelCode,o=e.uniqueId;t.upsellEnhancements(a,o,e).success(function(e){c.handleXssVulnerabilities(e),i.submitEnable=!0,c.setReservationFromRetrieve(e),i.totalData=c.getFormattedReservationData(_),i.isPaidThroughLoyalty&&(i.remainingResAmountConfirmation=i.totalData.total-i.paidByOtherMethod-H,i.formattedRemainingResAmountConfirmation=y(_)(i.remainingResAmountConfirmation,E)),i.getFormattedDatePrices(),i.showUpsellSuccessModal=!0,i.upsellPerformed=!0,h.onModalOpen("","upsell-success-modal-body","upsell-success-title-id",!1,i.closeUpsellModal)}).error(function(){C.clear(),C.pop({type:"error",title:"",body:n.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg,timeout:3e3}),c.revertServices()})},i.closeUpsellModal=function(){i.showUpsellSuccessModal=!1,h.onModalClose()},i.closeEnhancementsUnavailModal=function(){i.showEnhancementsUnavailModal=!1,h.onModalClose()},i.showMerchandisingDetailsModal=function(){i.showMerchandiseDetailsModal="display-block";var e=r.pageYOffset;if(r.innerWidth>767&&r.innerWidth<1023){var a=e-40+"px";i.fromTop=a}else if(r.innerWidth>1023&&r.innerWidth<1200){var a=e-150+"px";i.fromTop=a}else{var a=e-40+"px";i.fromTop=a}setTimeout(function(){h.onModalOpen("merchandising-detail-link","merchandising-details-parent-id","merchandising-details-title-id",!1,i.cancelMerchandisingDetails)})},i.cancelMerchandisingDetails=function(){i.showMerchandiseDetailsModal="display-none",h.onModalClose()},i.isBookerInformationEnabled=c.isBookerInformation(i.finalReservation)}function confirmEnhance(){return{restrict:"E",templateUrl:"./confirmation/confirmEnhance.html"}}function upgradeRoom(){return{restrict:"E",templateUrl:"./confirmation/upgradeRoom.html"}}function confirmGetAround(e,a,t){return{restrict:"E",templateUrl:"./confirmation/confirmGetAround.html",replace:"true",link:function(t){var o=a.getHotelDesc(),r=o.position.latitude,n=o.position.longitude;t.confirmationMap={address:o.address,airportDirections:o.generalInformation.airportDirections,confirmationConfigFlags:a.getUxConfiguration().confirmationConfig,gmapURL:"https://www.google.com/maps/place/"+r+"+"+n+"/@"+r+","+n+",15z"},t.confirmationMap.confirmationConfigFlags.displayLocation||t.confirmationMap.confirmationConfigFlags.displayMapsIndicator||t.confirmationMap.confirmationConfigFlags.displayTransportation||t.confirmationMap.confirmationConfigFlags.displayDirections?t.showGettingAroundSection=!0:t.showGettingAroundSection=!1,t.newWindowWithGmap=function(){e.open(t.confirmationMap.gmapURL,"")}}}}function customGoogleMap(e,a){return{restrict:"A",link:function(a,t){var o=e.getHotelDesc();a.positionLatitude=Number(o.position.latitude),a.positionLongitude=Number(o.position.longitude),a.hotelName=o.hotelName;var r=new google.maps.Map(t[0],{center:new google.maps.LatLng(a.positionLatitude,a.positionLongitude),zoom:15,mapTypeId:google.maps.MapTypeId.ROADMAP}),n=new google.maps.InfoWindow;!function(e,a){var t=new google.maps.Marker(e);a&&google.maps.event.addListener(t,"click",function(){n.setContent(a),n.open(e.map,this)})}({position:new google.maps.LatLng(a.positionLatitude,a.positionLongitude),map:r},a.hotelName)}}}function CurrencyDropdownController(e,a,t,o,r,n){a.flagForCurrency=t.getUxConfiguration().enableMultipleCurrencyDisplay,e.currentCurrency=a.currency,a.changeCurrency=function(a){e.$broadcast(o.CALL_CURRENCY_CHANGE_MENUBAR,a)},a.topCurrencies=n.getTopCurrencies(),a.currencies=n.getCurrencies(),a.setSelectedCurrency=function(e){e&&(a.currency=e.currencyCode)},e.$on(o.BROADCAST_CURRENCY_TO_CURRENCY_DROPDOWN,function(e,t){a.currency=t}),a.trackGAEventIntl=function(e,a){"currency"===e&&r.eventTrack("ChangeCurrency",{category:"UserNavigation",label:a})}}function currencyBar(){return{restrict:"E",templateUrl:"./currency-dropdown/currency-dropdown.html",controller:CurrencyDropdownController}}function distanceConvert(){return function(e){return parseFloat(e).toFixed(1)}}function calRatesFilter(e,a,t,o){return function(t){var r=!e.getUxConfiguration().calendarConfig.aggregateRateDisplayEnabled&&e.getHotelDesc().enableMultiRoomTypeBookings&&!o.getMainReservation().isModifiable;if(t){if(0==t.isAvailable){var n=!1,i=!1;return angular.forEach(t.availability,function(e){"CTA"!=e.availStatus&&"CTD"!=e.availStatus||(n=!0),"ClosedOut"!=e.availStatus&&"NoAvailability"!=e.availStatus||(i=!0)}),1==n&&0==i?(t.isAvailable=!0,r?t.rate.lowestMinRate:t.rate.minRate):""}if(1==t.isAvailable&&void 0!=t.date&&0==t.rate.discount&&void 0!=t.rate.discount){if(r)var s=t.rate.lowestMinRate;else var s=t.rate.minRate;var l=Math.round(s);return a("currencyConversionAndSymbolDisplayLogic")(l,o.getFixedMerchandisedCurrency()?o.getFixedMerchandisedCurrency():t.rate.ratePlanCurrency)}if(1==t.isAvailable&&void 0!=t.date&&t.rate.discount>0&&void 0!=t.rate.discount){if(r)var s=parseFloat(t.rate.lowestMinRate).toFixed(2);else var s=parseFloat(t.rate.minRate).toFixed(2);var c,d=s;c=r?t.rate.discountOnLowestMinRate:t.rate.discount;var g=parseFloat(c),l=Math.round(d-g);return a("currencyConversionAndSymbolDisplayLogic")(l,o.getFixedMerchandisedCurrency()?o.getFixedMerchandisedCurrency():t.rate.ratePlanCurrency)}}}}function calRatesFilters(e,a,t,o){return function(t){var r=!e.getUxConfiguration().calendarConfig.aggregateRateDisplayEnabled&&e.getHotelDesc().enableMultiRoomTypeBookings&&!o.getMainReservation().isModifiable;if(t){if(!r&&1==t.isAvailable&&void 0!=t.date&&t.rate.discount>0&&void 0!=t.rate.discount&&1==e.getUxConfiguration().strikeThroughPricingEnabled){var n;n=t.rate.minRate;var i=Math.round(n);return a("currencyConversionAndSymbolDisplayLogic")(i,o.getFixedMerchandisedCurrency()?o.getFixedMerchandisedCurrency():t.rate.ratePlanCurrency)}if(r&&1==t.isAvailable&&void 0!=t.date&&t.rate.discountOnLowestMinRate>0&&void 0!=t.rate.discountOnLowestMinRate&&1==e.getUxConfiguration().strikeThroughPricingEnabled){var n;n=t.rate.lowestMinRate;var i=Math.round(n);return a("currencyConversionAndSymbolDisplayLogic")(i,o.getFixedMerchandisedCurrency()?o.getFixedMerchandisedCurrency():t.rate.ratePlanCurrency)}}}}function paymentProcess(){return{restrict:"E",templateUrl:"./datesofstay/paymentprocess.html"}}function calendarDays(){return{restrict:"E",templateUrl:"./datesofstay/calendardays.html",link:function(e,a,t){moment(new Date).format("YYYY-MM-DD")}}}function deleteRoom(){return{restrict:"E",templateUrl:"./datesofstay/deleteRoom.html"}}function deleteRatePlan(){return{restrict:"E",templateUrl:"./datesofstay/deleteRatePlan.html"}}function deletePackage(){return{restrict:"E",templateUrl:"./datesofstay/deletePackage.html"}}function deleteGroup(){return{restrict:"E",templateUrl:"./datesofstay/deleteGroup.html"}}function alternateProperties(){return{restrict:"E",templateUrl:"./datesofstay/alternateProperties.html"}}function monthYearDropdown(e,a,t,o){return{restrict:"E",scope:{dateIn:"=",translate:"=",visibleMonths:"=",todaysDate:"="},link:function(t,o,r){function n(e){for(var a=0;a<t.monthYearArray.length;a++)if(moment(e).format("MM")===moment(t.monthYearArray[a].id).format("MM")&&moment(e).format("YYYY")===moment(t.monthYearArray[a].id).format("YYYY")){t.selectedMonthYear=t.monthYearArray[a];break}}t.status={isopen:!1},t.autoCloseRatePlanDropdown="always",t.monthsToLookAheadCalendarConfig=e.getCalConfigInfo().monthsToLookAhead,t.keyDownOnMonthYearDropDown=function(e){var a,o=e.keyCode;if(38==o){for(var r=0;r<t.monthYearArray.length;r++)if(t.selectedMonthYear==t.monthYearArray[r]){a=r;break}0==a?(t.selectedMonthYear=t.monthYearArray[0],t.onSelectionChange(t.selectedMonthYear)):(t.selectedMonthYear=t.monthYearArray[a-1],t.onSelectionChange(t.selectedMonthYear)),setTimeout(function(){var e=document.getElementById("month-year-filter-id");if(e){var o=t.monthYearArray[a-1];e.setAttribute("aria-label",o),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-hidden",!1),e.innerHTML="";var r=document.createTextNode(o);e.appendChild(r),setTimeout(function(){e.setAttribute("aria-hidden",!0)},500)}}),e.preventDefault()}else if(40==o){for(var r=0;r<t.monthYearArray.length;r++)if(t.selectedMonthYear==t.monthYearArray[r]){a=r;break}a==t.monthYearArray.length-1||(t.selectedMonthYear=t.monthYearArray[a+1],t.onSelectionChange(t.selectedMonthYear)),setTimeout(function(){var e=document.getElementById("month-year-filter-id");if(e){var o=t.monthYearArray[a+1];e.setAttribute("aria-label",o),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-hidden",!1),e.innerHTML="";var r=document.createTextNode(o);e.appendChild(r),setTimeout(function(){e.setAttribute("aria-hidden",!0)},500)}}),e.preventDefault()}},t.onSelectionChange=function(e){var a,o;t.selectedObj=e,t.selectedMonthYear=t.selectedObj,t.selectedObj===t.monthYearArray[t.monthYearArray.length-1]&&2===t.visibleMonths?(a=moment(t.selectedObj.id,"YYYY-MM").startOf("month").format("YYYY-MM-DD"),newInputDateIn=moment.utc(a).subtract(1,"months").startOf("month").format("YYYY-MM-DD")):newInputDateIn=e.id,o=moment(newInputDateIn).toDate(),t.$emit("EVENT.MONTH_SELECTED",o),t.selectedMonthYear=t.selectedObj};var i=function(){var e,o;if(void 0!=t.monthYearArray&&t.monthYearArray.length>0)for(var r=0;r<t.monthYearArray.length;r++)e=moment(t.monthYearArray[r].id).format("YYYY"),o=moment(t.monthYearArray[r].id).format("M"),t.monthYearArray[r].name=a.translateMonthName(o)+" "+e;void 0!=t.dateIn&&(t.currentMonthName=a.translateMonthName(moment(t.dateIn).format("M")))};(function(){t.monthYearArray=[];var e,o,r,n={id:Date,name:String},i="";e=moment(t.todaysDate).format("YYYY-MM-DD");for(var s=0;s<t.monthsToLookAheadCalendarConfig;s++)o=moment(e).format("YYYY"),r=moment(e).format("M"),i=a.translateMonthName(r)+" "+o,n={id:e,name:i},t.monthYearArray.push(n),e=moment.utc(e).add(1,"months").startOf("month").format("YYYY-MM-DD");t.selectedMonthYear=t.monthYearArray[0]})(),t.$watch("dateIn",function(){t.currentMonthName=a.translateMonthName(moment(t.dateIn).format("M")),t.currentYear=moment(t.dateIn).format("YYYY"),n(t.dateIn)}),t.$watch("translate",function(){i()})},templateUrl:"./datesofstay/monthyearDropdown.html"}}function calendarWeeks(){return{restrict:"E",templateUrl:"./datesofstay/calendarweeks.html",link:function(e,a,t){e.weekIndex=t.weekAttribute}}}function DatesOfStayController(e,a,t,o,r,n,i,s,l,c,d,g,m,u,p,y,v,h,R,f,C,P,S){function A(){r.hideLeadRateForPackage=d.canHideLeadRatesForPackage(c)}function I(e){g.getUxConfiguration().interactiveMessagesEnabled&&i.pop({type:"info",title:"",body:e,timeout:3e3})}function b(){r.visibleMonths=Be.visibleMonths,0===Be.weekFormat?r.daysNameArray=[o.translate.global_day_shortSun,o.translate.global_day_shortMon,o.translate.global_day_shortTue,o.translate.global_day_shortWed,o.translate.global_day_shortThu,o.translate.global_day_shortFri,o.translate.global_day_shortSat]:1===Be.weekFormat&&(xe=-1,r.daysNameArray=[o.translate.global_day_shortMon,o.translate.global_day_shortTue,o.translate.global_day_shortWed,o.translate.global_day_shortThu,o.translate.global_day_shortFri,o.translate.global_day_shortSat,o.translate.global_day_shortSun])}function D(e){var a=m.numToArray(e);return a=a.map(function(e){return w(e+1)})}function T(e){return 0===moment(e).startOf("month").weekday()&&1===Be.weekFormat?startOfDay=6:startOfDay=moment(e).startOf("month").weekday()+xe,startOfDay}function O(e){var a=d.getAllCode(),i=!1;void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].roomRates&&d.getMainReservation().roomStays[0].roomRates.length>0&&void 0!=d.getMainReservation().roomStays[0].roomRates[0].roomTypeCode&&(he.roomTypeCode=d.getMainReservation().roomStays[0].roomRates[0].roomTypeCode),n.debug(JSON.stringify(d.getMainReservation())+"reservationService.getMainReservation()"),void 0!=d.getMainReservation().uniqueId&&void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].ratePlans&&d.getMainReservation().roomStays[0].ratePlans.length>0&&(he.ratePlanType=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType,he.ratePlanCode=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode,"Group"!=he.ratePlanType&&"group"!=he.ratePlanType||(i=!0)),void 0!=a&&Object.keys(a).length>0&&(he.allCodes=a),r.dateInSelected=he.dateIn,n.debug(JSON.stringify(he)+"allcodes in datesofstay"),s.getBasicAvail(he,d.getMainReservationArray(),d.getMainReservation(),o.MRB,d.getConfig("FIRST_TIME_LAND_CALENDAR"),!1,d.getSupplementalObj(),d.getloyaltyReqParams()).getAllDates().then(function(a){d.resetLoyaltyParams(a),1==i&&(he.ratePlanCode=void 0,he.ratePlanType=void 0),r.BasicAvailbilityInfo=a,r.dateChecks();var s=k(a);ye[ve]=s,n.debug(JSON.stringify(ye)+"data in new"),nextMonthDate=he.dateIn,nextMonthYear=moment(nextMonthDate).format("YYYY"),nextMonthMM=moment(nextMonthDate).format("MM"),nextMonthDD=moment(nextMonthDate).format("DD"),Ee=nextMonthMM,r.currentYear=nextMonthYear,r.calendarDayDate=D(Fe),r.calendarDayDateNextMonth=D(Ne),r.currentMonthName=m.translateMonthName(moment(he.dateIn).format("M")),r.currentYear=moment(he.dateIn).format("YYYY"),r.secondCurrentMonthName=m.translateMonthName(moment(he.dateOut).format("M")),r.secondMonthYearName=moment(he.dateOut).format("YYYY"),H(),U(),d.buildOptions(),
void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(he.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?he.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:he.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),r.BasicAvailbilityInfo.dates,r.calendarCells.forEach(function(e,a){0!=a&&(a-=1),r.applyDefaultClasses(e,r.calendarCells[a],a),r.enablePreviousMonth()}),r.enableNextMonth();var g=moment.utc(he.dateIn).startOf("month").format("YYYY-MM-DD");switch(r.allCalMonthData[g]=r.calendarCells,We){case"next":We="default",m.setUserTiming("Interaction","DatesOfStayNextBtn");break;case"previous":We="default",m.setUserTiming("Interaction","DatesOfStayPreviousBtn");break;default:m.setUserTiming("PageLoad","DatesOfStay")}if(r.previousMonthOptions=angular.copy(he),_(he),r.cacheStartDate=angular.copy(r.startDate),r.cacheEndDate=angular.copy(r.endDate),N(),m.getObjectData("UPDATED_NAV_DATA_MANAGE_URL")||o.$broadcast("EVENT.UPDATE_NAVBAR_FROM_MANAGE_URL"),r.$broadcast(t.NEXT_MONTH_LOADED),e&&"datesofstay"===l.current.name&&o.$broadcast("EVENT.RECALL_HOLD_API_ON_CHANGE_CURRENCY"),d.getConfig("add_special_codes")){if(void 0==d.getMainReservation().resGlobalInfo||void 0==d.getMainReservation().resGlobalInfo.timeSpan||void 0==d.getMainReservation().resGlobalInfo.timeSpan.start){if(r.startDate&&K(r.startDate,"is-start-date"),r.endDate&&K(r.endDate,"is-end-date"),r.startDate&&r.endDate){for(var u=moment.utc(r.endDate).diff(moment.utc(r.startDate),"days"),p=1;p<u;p++){var y=moment.utc(r.startDate,Me).add(p,"day").format(Me);K(y,"is-in-range")}r.checkInOutSelected=!1}}else r.startDate=d.getMainReservation().resGlobalInfo.timeSpan.start,r.endDate=d.getMainReservation().resGlobalInfo.timeSpan.end;d.deleteConfig("add_special_codes")}})}function E(e){var a=d.getAllCode();void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].roomRates&&d.getMainReservation().roomStays[0].roomRates.length>0&&void 0!=d.getMainReservation().roomStays[0].roomRates[0].roomTypeCode?he.roomTypeCode=d.getMainReservation().roomStays[0].roomRates[0].roomTypeCode:he.roomTypeCode=void 0,void 0!=a&&Object.keys(a).length>0&&(e.allCodes=a),n.debug(JSON.stringify(e)+"new options"),s.getBasicAvail(he,d.getMainReservationArray(),d.getMainReservation(),o.MRB,d.getConfig("FIRST_TIME_LAND_CALENDAR"),!1,d.getSupplementalObj(),d.getloyaltyReqParams()).getAllDates().then(function(e){d.resetLoyaltyParams(e),r.BasicAvailbilityInfo=e,r.dateChecks();var a=k(e);ye[ve]=a,nextMonthDate=he.dateIn,nextMonthYear=moment(nextMonthDate).format("YYYY"),nextMonthMM=moment(nextMonthDate).format("MM"),nextMonthDD=moment(nextMonthDate).format("DD"),Ee=nextMonthMM,r.currentYear=nextMonthYear,r.calendarDayDate=D(Fe),r.calendarDayDateNextMonth=D(Ne),r.currentMonthName=m.translateMonthName(moment(he.dateIn).format("M")),r.currentYear=moment(he.dateIn).format("YYYY"),r.secondCurrentMonthName=m.translateMonthName(moment(he.dateOut).format("M")),r.secondMonthYearName=moment(he.dateOut).format("YYYY"),H(),U(),d.buildOptions(),void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(he.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?he.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:he.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),r.BasicAvailbilityInfo.dates,r.calendarCells.forEach(function(e,a){r.applyDefaultClasses(e,r.calendarCells[a-1],a-1),r.enablePreviousMonth()}),r.enableNextMonth(),r.previousMonthOptions=angular.copy(he),_(he),N()})}function M(){b();var e=d.getMainReservation();if(void 0==e.resGlobalInfo.timeSpan.start&&void 0==e.resGlobalInfo.timeSpan.end&&void 0!=e&&e.roomStays[0].ratePlans.length>0&&"Package"==e.roomStays[0].ratePlans[0].ratePlanType&&moment(e.roomStays[0].ratePlans[0].packageStartDate).toDate()>r.today?(r.today<moment(e.roomStays[0].ratePlans[0].packageStartDate).toDate()&&moment(e.roomStays[0].ratePlans[0].packageStartDate).toDate()<moment(r.today).endOf("month")?firstDatePackageStart=moment(r.today).format(Me):firstDatePackageStart=moment(e.roomStays[0].ratePlans[0].packageStartDate).startOf("month").format(Me),he.dateIn=firstDatePackageStart):r.today>moment(qe).toDate()?he.dateIn=moment(r.today).format(Me):he.dateIn=qe,he.currencyCode=ae?ae.currencyCode:te.currencyCode,1===r.visibleMonths)if(moment(r.firstDayOfCalendar).format(Me)===moment(r.firstDayOfCalendar).endOf("month").format(Me)){he.dateOut=moment(r.firstDayOfCalendar).add(1,"months").startOf("month").format(Me);var a=moment.utc(he.dateIn).diff(moment.utc(he.dateOut),"days");a>0&&(he.dateOut=moment(he.dateIn).endOf("month").format(Me)),Ve=42}else 1===r.visibleMonths&&moment(r.firstDayOfCalendar).format(Me)!=moment(r.firstDayOfCalendar).endOf("month").format(Me)&&(he.dateOut=moment(he.dateIn).endOf("month").format(Me),Ve=42);else if(2===r.visibleMonths){Ne=moment(he.dateIn).add(1,"months").daysInMonth();var t=moment(he.dateIn).add(1,"months").endOf("month");he.dateOut=t.format(Me),Te=moment(he.dateOut).format("YYYY"),Oe=moment(he.dateOut).format("MM"),Ge=T(he.dateOut),r.secondCurrentMonthName=m.translateMonthName(moment(he.dateOut).format("M")),r.secondMonthYearName=moment(he.dateOut).format("YYYY"),Ve=84}Le=T(he.dateIn),Fe=moment(he.dateIn).daysInMonth(),Ne=moment(he.dateOut).daysInMonth(),d.buildOptions(),void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(he.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?he.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:he.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),r.calendarCells=m.numToArray(Ve);var n=he.dateIn;r.currentMonthName=m.translateMonthName(moment(n).format("M"));var i=d.getSupplementalObj(),s=d.getloyaltyReqParams();!o.gmsPromoCode&&!d.getValidCodeApi()&&i&&void 0!=i.guestInfo&&void 0!=i.guestInfo.loyalty&&i.guestInfo.loyalty.length>0&&!0===i.guestInfo.loyalty[0].requireRestrictionCheck&&s&&void 0!=s.offerId&&void 0!=s.guestId||O()}function _(e){o.preFetch=!0;var a=angular.copy(e),t=angular.copy(e),n=moment(e.dateIn).add(-1,"months").startOf("month").format(Me),i=moment(e.dateOut).add(-1,"months").endOf("month").format(Me),l=moment(r.today).format(Me);o.bgHideSpinner=!1,!moment(i).toDate()<moment(l).toDate()&&(a.dateIn=n,moment(a.dateIn).toDate()<moment(i).toDate()&&n>=l&&(a.dateOut=i,s.getBasicAvail(a,d.getMainReservationArray(),d.getMainReservation(),o.MRB,d.getConfig("FIRST_TIME_LAND_CALENDAR"),!0,d.getSupplementalObj(),d.getloyaltyReqParams()).getAllDates().then(function(e){d.resetLoyaltyParams(e)}))),t.dateIn=moment(e.dateIn).add(1,"months").startOf("month").format(Me),t.dateOut=moment(e.dateOut).add(1,"months").endOf("month").format(Me),s.getBasicAvail(t,d.getMainReservationArray(),d.getMainReservation(),o.MRB,d.getConfig("FIRST_TIME_LAND_CALENDAR"),!0,d.getSupplementalObj(),d.getloyaltyReqParams()).getAllDates().then(function(e){d.resetLoyaltyParams(e)}),o.preFetch=!1}function k(e){var a={},t=moment().format("MM"),o=moment().format("SSS");return a.month=t,a.timeStamp=o,a.requestData=e,ye.splice(0,1,a),a}function N(){r.checkInOutSelected=!0,y.forEach(r.calendarCells,function(e,a){if((void 0!=r.cacheStartDate||void 0!=r.cacheEndDate)&&0==e.isAvailable){var t=!1,n=!1;angular.forEach(e.availability,function(e){"CTA"!=e.availStatus&&"CTD"!=e.availStatus||(t=!0),"ClosedOut"!=e.availStatus&&"NoAvailability"!=e.availStatus||(n=!0)}),1==t&&0==n&&(e.isAvailable=!0)}if(e.date===r.cacheStartDate&&void 0!=r.cacheStartDate){if("ALTERNATE_HOTEL_SPLASH"!==p.route&&"EXTENDED_HOLD_PAGE"!==p.route&&0==r.loadNextPrevCalender&&1==o.callManageUrlCalender){r.checkCache=!1;var i=r.selectDates(e);if(r.checkCache=!0,0==i)return r.cacheStartDate=void 0,o.datesOfStay=!1,!1}e.startDate=!0,e.cellHeader=o.translate.page_calendar_lblCheckIn,calledFromController=!0}else if(e.date===r.cacheEndDate&&void 0!=r.cacheEndDate){if("ALTERNATE_HOTEL_SPLASH"!==p.route&&"EXTENDED_HOLD_PAGE"!==p.route&&0==r.loadNextPrevCalender&&1==o.callManageUrlCalender){r.checkCache=!1;var i=r.selectDates(e);if(r.checkCache=!0,0==i||r.isUnAvailableCheck)return o.datesOfStay=!1,r.cacheEndDate=void 0,!1}calledFromController=!0,e.endDate=!0,e.cellHeader=o.translate.page_calendar_CheckoutLbl,r.checkInOutSelected=!1}else e.date>=r.cacheStartDate&&e.date<=r.cacheEndDate&&(e.inRangeDate=!0)})}function L(){we=2==Ue?r.monthsToLookAheadCalendarConfig-1:r.monthsToLookAheadCalendarConfig;var e,a,t=moment(r.today).startOf("month").format(Me);a=moment.utc(he.dateIn).diff(moment.utc(t),"month"),e=we-a,we=e,$e=we}function G(){var e,a=2==Ue?r.monthsToLookAheadCalendarConfig-1:r.monthsToLookAheadCalendarConfig;if(Ee=moment(he.dateIn).format("MM"),He<Ee){e=a-(Ee-He)}$e=e>0?e:a}function F(){a(o.closeDrawer,2e3);var e=c.stepsById.guestsrooms,t=0,r=c.stepsById.accommodations.rooms;angular.forEach(r,function(e){void 0==e.packageCode&&t++}),"S"!==e.placeholder[0]?(o.numberOfGuests=Number(e.placeholder[0]),o.numberOfRooms=Number(e.placeholder.split("/")[1].trim()),t?o.numberOfRooms:o.numberOfRooms):n.debug("You need to set the number of guests for your stay!");var i=c.stepsById.dates;"S"!==i.placeholder[0]?o.numberOfDays=Math.abs(moment(i.endDate).diff(moment(i.startDate),"days")):n.debug("You need to select the dates of stay for your trip!")}function B(e){for(var a=!1,t=!1,o=e;o>=0;o--){if(r.calendarCells[o].date&&!0===r.calendarCells[o].isAvailable)return!0;if(r.calendarCells[o].date&&!1===r.calendarCells[o].isAvailable){for(var n=r.calendarCells[o].availability,o=0;o<n.length;o++)"CTA"!=n[o].availStatus&&"CTD"!=n[o].availStatus||(a=!0),"ClosedOut"!=n[o].availStatus&&"NoAvailability"!=n[o].availStatus||(t=!0);return 1==a&&0==t}}}function x(e){if(0==e.isAvailable){var a=!1,t=!1,o=!1;return angular.forEach(e.availability,function(e){"CTA"!=e.availStatus&&"CTD"!=e.availStatus||(a=!0),"ClosedOut"!=e.availStatus&&"NoAvailability"!=e.availStatus||(t=!0),"CTD"==e.availStatus&&(o=!0)}),1==t&&1==o?(r.dateUnavailable=!0,!0):1!=a||0!=t}return!1}function w(e){var a=e+"";return 1===a.length?"0"+a:a}function U(){var e=r.BasicAvailbilityInfo.dates;r.calendarCells.forEach(function(a,t){if(a.dayIndex){if(t<42)var o=r.currentYear+"-"+Ee+"-"+a.dayIndex;else var o=Te+"-"+Oe+"-"+a.dayIndex;r.calendarCells[t]=y.merge(y.where(e,{date:o})[0],r.calendarCells[t]),r.calendarCells[t]||(r.calendarCells[t]={startDate:!1,endDate:!1,inRangeDate:!1,soldOutDate:!1,disabledDate:!1,pastDate:!1,todayDate:!1,blankDate:!1,enableCheckout:!1}),Q(t)}})}function H(){for(var e=0;e<Ve;e++)r.calendarCells[e]=e<42?{dayIndex:r.calendarDayDate[e-Le],startDate:!1,endDate:!1,inRangeDate:!1,soldOutDate:!1,disabledDate:!1,pastDate:!1,todayDate:!1,blankDate:!1,enableCheckout:!1}:{dayIndex:r.calendarDayDateNextMonth[e-42-Ge],startDate:!1,endDate:!1,inRangeDate:!1,soldOutDate:!1,disabledDate:!1,pastDate:!1,todayDate:!1,blankDate:!1,enableCheckout:!1}}function V(e){var a=document.documentElement,t=e.getBoundingClientRect(),o=t.top+window.pageYOffset-a.clientTop;return{left:t.left+window.pageXOffset-a.clientLeft,top:o}}function $(){r.isCTDError=!0,i.clear(),i.error({title:"",body:r.translate.page_calendar_msgCTD})}function q(){r.unavailableDateError=!0,i.clear(),i.error({title:"",body:r.translate.page_calendar_msgCTA})}function Y(){r.isUnavailableDatesError=!0,setTimeout(function(){i.clear(),i.error({title:"",body:r.translate.page_calendar_msgUnavailableDates})},50)}function j(){i.clear(),i.error({title:"",body:r.translate.page_calendar_msgDBeforeA})}function z(){var e=r.minLengthOfStayStayT?r.minLengthOfStayStayT:Ze||aa,a=r.translate.page_calendar_MinLOSMsg.replace("%NIGHTS%",e);r.isMinLOSError=!0,i.clear(),i.error({title:"",body:a})}function W(){var e=r.maxLengthOfStayStayT?r.maxLengthOfStayStayT:ea||aa,a=r.translate.page_calendar_MaxLOSMsg.replace("%NIGHTS%",e);r.isMaxLOSError=!0,i.clear(),i.error({title:"",body:a})}function K(e,a){var t=y.findIndex(r.calendarCells,function(a){return a.date==e});if(t>=0)switch(a){case"is-start-date":r.calendarCells[t].startDate=!0,r.calendarCells[t].endDate=!1,r.calendarCells[t].inRangeDate=!1,r.calendarCells[t].cellHeader=o.translate.page_calendar_lblCheckIn;break;case"is-end-date":r.calendarCells[t].startDate=!1,r.calendarCells[t].endDate=!0,r.calendarCells[t].inRangeDate=!1,r.calendarCells[t].cellHeader=o.translate.page_calendar_CheckoutLbl;break;case"is-in-range":r.calendarCells[t].startDate=!1,r.calendarCells[t].endDate=!1,r.calendarCells[t].inRangeDate=!0,r.calendarCells[t].cellHeader=null;break;case"is-today":r.calendarCells[t].cellHeader=o.translate.page_calendar_todayLbl}}function J(){r.startDate=null,r.endDate=null,r.calendarCells.forEach(function(e,a){e.startDate=!1,e.endDate=!1,e.inRangeDate=!1,e.cellHeader=null,Q(a)})}function Q(e){r.calendarCells[e]&&r.calendarCells[e].date===_e&&(r.calendarCells[e].cellHeader=o.translate.page_calendar_todayLbl)}function X(){var e=g.getHotelDesc(),a=e&&e.chainInfo&&e.chainInfo.length>0?e.chainInfo[0]:"",t=P.getAudienceEvaluatorCriteria();s.callAudienceEvaluator(e.hotelCode,a,t).then(function(e){P.setAudienceLists(e.data),o.$broadcast("RECALL_MERCHANDISING_API"),O()},function(e){console.log(e),O()})}function Z(){var e=g.getHotelDesc(),a=e&&e.chainInfo&&e.chainInfo.length>0?e.chainInfo[0]:"",t=angular.copy(p.loyaltyProfileData);t.xAuthToken&&t.profileMemberID?s.getLoyaltyBookedResDetails(e.hotelCode,a,t.xAuthToken,t.profileMemberID).then(function(e){P.setReservationHistoryObject(e.data),X()},function(e){console.log(e),X()}):X()}function ee(){var e,a=d.getMainReservation();if(o.MRB){e=d.getMainReservationArray();for(var t=0;t<e.length;t++)if(void 0!=e[t]&&void 0!=e[t].roomStays&&e[t].roomStays.length>0&&void 0!=e[t].roomStays[0].roomRates&&e[t].roomStays[0].roomRates.length>0&&void 0!=e[t].roomStays[0].roomRates[0].roomTypeCode&&void 0!=e[t].roomStays[0].ratePlans&&e[t].roomStays[0].ratePlans.length>0&&"Group"!=e[t].roomStays[0].ratePlans[0].ratePlanType){a=e[t];break}}1==R.getIsLoyaltyReservationEnabled()&&void 0!=a.roomStays&&a.roomStays.length>0&&void 0!=a.roomStays[0].roomRates&&a.roomStays[0].roomRates.length>0&&void 0!=a.roomStays[0].roomRates[0].roomTypeCode&&void 0!=a.roomStays[0].ratePlans&&a.roomStays[0].ratePlans.length>0&&"Group"!=a.roomStays[0].ratePlans[0].ratePlanType&&(r.continueDeleteRatePlan(),r.continueDeleteRoom(),r.continueDeletePackage(),o.MRB&&(d.revertAllAccommodationsMrb(),c.stepsById.accommodations.placeholderMRB=d.getBookedRoomCount())),O()}o.recallAPIFromHTML5Geolocation=!1,setTimeout(function(){var e=document.getElementById("defaultFocus");e&&e.focus()},50),r.selectedDates={checkIn:void 0,checkOut:void 0};var ae=d.getCurrencyDetails();r.isCurrencyLeadRateEnabledFlag=ae.leadRateDisplayEnabled,r.strikeThroughPricingEnabled=g.getUxConfiguration().strikeThroughPricingEnabled,r.currencyDisplayRightEnabled=ae.displayRightEnabled,r.currencySymbol=ae.currencySymbol,r.monthsToLookAheadCalendarConfig=g.getCalConfigInfo().monthsToLookAhead;var te=g.getDefaultCurrency(),oe=g.getRatePlanMerchandisedCurrencies(),re=oe.indexOf(o.currentCurrency)>-1,ne=p.navigator.userLanguage||p.navigator.language,ie=new Date(2012,11,25),se=ie.toLocaleDateString(ne);25==se.substring(0,2)&&12==se.substring(3,5)?r.dateFormat="dd/MM/yyyy":12==se.substring(0,2)&&25==se.substring(3,5)?r.dateFormat="MM/dd/yyyy":r.dateFormat="yyyy/MM/dd";var le=!1;r.checkInDisplay=!1,r.changeCheckInDisplay=function(){r.checkInDisplay=!0;var e=setInterval(function(){if(document.getElementById("startDate")&&1!=o.showSpinner){var a=document.getElementById("startDate");a&&a.focus(),clearInterval(e)}},500)};var ce=!1;r.changeCheckOutDisplay=function(){if(r.selectedDates.checkIn&&0==r.disableCheckedout){r.showFormattedCheckOutDate=!1,ce=!0,r.checkOutDisplay=!0;var e=setInterval(function(){if(document.getElementById("endDate")&&1!=o.showSpinner){if(1==o.MRB){var a=document.getElementById("endDate");a&&a.focus()}else setTimeout(function(){var e=document.getElementById("endDate");e&&e.focus()},1500);clearInterval(e)}},1e3)}};var de=g.getCalConfigInfo().monthsToLookAhead,ge=new Date,me=new Date(ge.setMonth(ge.getMonth()+de-1));me=e("date")(new Date(me.getFullYear(),me.getMonth()+1,0),"yyyy-MM-dd");var ue=navigator.userAgent.toLowerCase(),pe=ue.indexOf("android")>-1;r.isAndroidDevice=pe,r.IEEnable=pe||function(e){return e=e||navigator.userAgent,e.indexOf("MSIE ")>-1||e.indexOf("Trident/")>-1||e.indexOf("Edge/")>-1}(),r.focusedOnCheckedIn=function(){if(void 0==r.selectedDates.checkOut&&void 0==r.selectedDates.checkIn||void 0!=r.selectedDates.checkOut&&void 0!=r.selectedDates.checkIn){r.checkInDisplay=!0,r.showFormattedCheckInDate=!1;var a;r.IEEnable&&void 0!=r.selectedDates.checkIn&&(a=e("date")(new Date(r.selectedDates.checkIn),r.dateFormat)),r.IEEnable&&void 0!=a&&(r.selectedDates.checkIn=a);var t=setInterval(function(){document.getElementById("startDate")&&1!=o.showSpinner&&(setTimeout(function(){var e=document.getElementById("startDate");e&&e.focus()},0),clearInterval(t))},500)}},r.focusedOnCheckedOut=function(){if(1!=r.disableCheckedout&&void 0!=r.selectedDates.checkIn){var a;r.IEEnable&&void 0!=r.selectedDates.checkOut&&(a=e("date")(new Date(r.selectedDates.checkOut),r.dateFormat)),r.selectedDates.checkOut=void 0,r.checkOutDisplay=!0,r.showFormattedCheckOutDate=!1,setTimeout(function(){r.IEEnable&&void 0!=a&&(r.selectedDates.checkOut=a),r.selectedDates.checkOut=null;var e=document.getElementById("endDate");e&&e.focus()},0)}},r.$watch("startDate",function(){if(r.startDate){r.checkInDisplay=!0;var e=r.startDate.split("-");r.selectedDates.checkIn=new Date(e[0],e[1]-1,e[2]),r.showFormattedCheckInDate=!0,r.disableCheckedout=!1}else 1!=r.donotChangeCheckInFiled&&(r.checkInDisplay=!1),r.donotChangeCheckInFiled=!1,r.checkOutDisplay=!1,r.selectedDates.checkIn=null,r.showFormattedCheckInDate=!1}),r.$watch("endDate",function(){if(void 0==r.endDate&&void 0==r.startDate&&(r.checkInOutSelected=!0),r.endDate){r.checkOutDisplay=!0;var e=r.endDate.split("-");r.selectedDates.checkOut=new Date(e[0],e[1]-1,e[2]),r.showFormattedCheckOutDate=!0,r.disableCheckedout=!0}else 1!=ce?(r.checkOutDisplay=!1,r.selectedDates.checkOut=null,void 0!=r.startDate&&(r.disableCheckedout=!1)):null==r.endDate&&void 0!=r.startDate&&(r.disableCheckedout=!1);ce=!1}),Date.prototype.addHours=function(e){return this.setHours(this.getHours()+e),this},r.shiftFocusToCheckOut=function(e){9!=e.which||e.shiftKey||setTimeout(function(){var e=document.getElementById("checkOutDisplayText"),a=document.getElementById("checkOutDisplay");e?e.focus():a&&a.focus()},0)},r.getCheckInDate=function(a){r.showFormattedCheckInDate=!1,i.clear(),r.selectedDates.checkOut=void 0;var n=e("date")(new Date(r.selectedDates.checkIn).addHours(1),"yyyy-MM-dd"),s=!1,l=!1;if(n>=e("date")(new Date,"yyyy-MM-dd")&&n<=me){var c=function(){s=!1,r.checkOutDisplay=!1,r.selectedDates.checkOut=null,r.firstDateInCurrentPage=void 0,r.lastDateInCurrentPage=void 0;for(var e=r.calendarCells.length-1;e>=0;e--)void 0==r.lastDateInCurrentPage&&void 0!=r.calendarCells[e].date&&(r.lastDateInCurrentPage=angular.copy(r.calendarCells[e].date));for(var a=0;a<r.calendarCells.length;a++)if(void 0==r.firstDateInCurrentPage&&void 0!=r.calendarCells[a].date&&(r.firstDateInCurrentPage=angular.copy(r.calendarCells[a].date)),r.calendarCells[a].date==n){ce=!0;var t=r.selectDates(r.calendarCells[a]);0==t||void 0==r.startDate?(r.checkInDisplay=!1,r.selectedDates.checkIn=null,setTimeout(function(){r.checkInDisplay=!0;var e=setInterval(function(){if(document.getElementById("startDate")&&1!=o.showSpinner){var a=document.getElementById("startDate");a&&(a.focus(),r.showFormattedCheckOutDate=!1,r.checkOutDisplay=!1),clearInterval(e)}},500)},0)):r.showFormattedCheckInDate=!0,s=!0;break}0==s&&(l=!1,n>r.lastDateInCurrentPage?(l=!0,r.loadAnotherMonth()):n<r.firstDateInCurrentPage&&(l=!0,r.loadPreviousMonth()))};n!=r.startDate?(r.disableCheckedout=!1,c(),a.relatedTarget&&"checkOutDisplayText"==a.relatedTarget.id&&setTimeout(function(){var e=document.getElementById("checkOutDisplay");e&&e.focus()},0)):(r.disableCheckedout=!0,r.showFormattedCheckInDate=!0),r.$on(t.NEXT_MONTH_LOADED,function(){1==l&&(l=!1,c())})}else void 0!=r.selectedDates.checkIn&&(n>me||n<=e("date")(new Date))?(J(),r.donotChangeCheckInFiled=!0,r.checkInDisplay=!1,r.selectedDates.checkIn=null,setTimeout(function(){r.checkInDisplay=!0;var e=setInterval(function(){if(document.getElementById("startDate")&&1!=o.showSpinner){var a=document.getElementById("startDate");a&&a.focus(),clearInterval(e)}},500)},0),r.checkOutDisplay=!1):"Invalid Date"==n?(J(),r.donotChangeCheckInFiled=!0,setTimeout(function(){r.selectedDates.checkIn=null,r.checkInDisplay=!0;var e=document.getElementById("startDate");e&&e.focus()},0),r.checkOutDisplay=!1):(r.checkInDisplay=!1,r.checkOutDisplay=!1,setTimeout(function(){if(document.getElementById("checkOutDisplay")==document.activeElement){var e=document.getElementById("checkOutDisplay");e&&e.focus()}},0));if(r.endDate){r.checkOutDisplay=!0;var d=r.endDate.split("-");r.selectedDates.checkOut=new Date(d[0],d[1]-1,d[2])}else r.checkOutDisplay&&(r.selectedDates.checkOut=void 0);if(r.startDate){r.checkInDisplay=!0;var d=r.startDate.split("-");r.selectedDates.checkIn=new Date(d[0],d[1]-1,d[2])}else r.selectedDates.checkIn=null},r.getCheckOutDate=function(){r.showFormattedCheckOutDate=!1,i.clear();var a=e("date")(new Date(r.selectedDates.checkOut).addHours(1),"yyyy-MM-dd"),n=!1,s=!1;if(a>=e("date")(new Date,"yyyy-MM-dd")&&a<=me){var l=function(e){n=!1,r.firstDateInCurrentPage=void 0,r.lastDateInCurrentPage=void 0;for(var a=r.calendarCells.length-1;a>=0;a--)void 0==r.lastDateInCurrentPage&&void 0!=r.calendarCells[a].date&&(r.lastDateInCurrentPage=angular.copy(r.calendarCells[a].date));for(var t=0;t<r.calendarCells.length;t++)if(void 0==r.firstDateInCurrentPage&&void 0!=r.calendarCells[t].date&&(r.firstDateInCurrentPage=angular.copy(r.calendarCells[t].date)),r.calendarCells[t].date==e){var i=r.selectDates(r.calendarCells[t]);0==i||void 0==r.endDate?(r.checkOutDisplay=!1,r.selectedDates.checkOut=null,setTimeout(function(){r.checkOutDisplay=!0,r.disableCheckedout=!1;var e=setInterval(function(){if(document.getElementById("endDate")&&1!=o.showSpinner){var a=document.getElementById("endDate");a&&a.focus(),clearInterval(e)}},500)},0)):r.showFormattedCheckOutDate=!0,n=!0;break}0==n&&(s=!1,e>r.lastDateInCurrentPage?(s=!0,r.loadAnotherMonth()):e<r.firstDateInCurrentPage&&(s=!0,r.loadPreviousMonth()))};a!=r.endDate?(l(a),r.disableCheckedout=!0):(r.disableCheckedout=!0,r.showFormattedCheckOutDate=!0),r.$on(t.NEXT_MONTH_LOADED,function(){1==s&&(s=!1,l(a))})}else void 0!=r.selectedDates.checkOut&&(a>me||a<=e("date")(new Date,"yyyy-MM-dd"))?(r.checkOutDisplay=!1,r.selectedDates.checkOut=null,setTimeout(function(){r.checkOutDisplay=!0;var e=setInterval(function(){if(document.getElementById("endDate")&&1!=o.showSpinner){var a=document.getElementById("endDate");a&&a.focus(),clearInterval(e)}},500)},0)):"Invalid Date"==a?(J(),setTimeout(function(){r.selectedDates.checkOut=null},0),r.checkOutDisplay=!1,i.clear()):r.checkOutDisplay=!1;if(r.endDate){r.checkOutDisplay=!0;var c=r.endDate.split("-");r.selectedDates.checkOut=new Date(c[0],c[1]-1,c[2])}else r.checkOutDisplay&&(r.selectedDates.checkOut=null);if(r.startDate){r.checkInDisplay=!0;var c=r.startDate.split("-");r.selectedDates.checkIn=new Date(c[0],c[1]-1,c[2])}else r.selectedDates.checkIn=null},1==o.MRB&&"GUEST_AND_ROOMS"===p.route&&0==d.getMainReservationArray().length&&(d.setMainReservationByEqual(angular.copy(p.multiRoomReservation)),d.assignIdForReservationArray(),d.assignIdForReservation(),d.setMainReservation(d.getMainReservationArray()[0].id)),n.debug(JSON.stringify(d.getMainReservationArray())+"reservationServiceArray"),n.debug(JSON.stringify(d.getMainReservation())+"reservationService"),A(),o.switchRoom="display-none",r.$on("EVENT.GMS_OPENED",function(){r.deleteRoom="display-none",r.deleteRatePlan="display-none",r.deletePackage="display-none"}),o.$broadcast("EVENT.TRIGGER_GMS"),r.noWrapSlides=!1,r.crmSettings=g.getUxConfiguration().crmSettings,r.checkCache=!0,r.loadNextPrevCalender=!1,o.displayPromo="block",r.previousMonthOptions={},r.showBackToAsBtn=!1,r.isUnAvailableCheck=!1,!0===g.getHotelDesc().uxConfiguration.accomodationsConfig.enableCarouselAutoScroll?r.alterInterval={alterInterval:2500}:r.alterInterval={alterInterval:0},r.alternateProperties=function(){f.executeAfterCookieBanner().then(function(){r.alternatepropertiesgsplash="display-block",o.navBarDisabled=!0,u.scrollTopAnimated(0,1e3),setTimeout(function(){h.onModalOpen("","alternate-property-parent-id","alternate-property-title-id",!0,r.emptyDates)})})},r.closealternatepropertiesPopup=function(){r.showBackToAsBtn=!1,o.navBarDisabled=!1,r.alternatepropertiesgsplash="display-none",h.onModalClose()},r.emptyDates=function(){r.showBackToAsBtn=!1,o.navBarDisabled=!1,J(),r.checkInOutSelected=!0,r.alternatepropertiesgsplash="display-none",h.onModalClose(),setTimeout(function(){var e=document.getElementById("defaultFocus");e&&e.focus()},50)},r.redirectToAS=function(){try{p.location=p.ibeClientSearchUrl+p.baseRes.portalSymbol}catch(e){}},r.jumpToOtherHotel=function(e){var a,t=e.hotelUrl,o=e.hotelCode,r=e.hotelName;a=t.replace(/\\/g,""),v.eventTrack("ClickAlternateProperty",{category:"UserNavigation",label:"IH Alternate Property ID : "+o+" and iH Alternate Property : "+r}),p.open(a,"_blank")},r.applyDefaultClasses=function(e,a,t){r.dateUnavailable=!1,"object"==typeof e&&(e.date==_e?(e.todayDate=!0,e.cellHeader=o.translate.page_calendar_todayLbl,1==x(e)&&(e.disabledDate=!0,e.soldOutDate=!0)):moment(e.date)<moment(_e)?(e.disabledDate=!0,e.pastDate=!0):1==x(e)?(a&&0==r.dateUnavailable&&(!1===x(a)&&a.date?e.enableCheckout=!0:void 0===a.date||e==a?!0===B(t)?e.enableCheckout=!0:e.date==ke&&(e.enableCheckout=!0):e.enableCheckout=!1),e.disabledDate=!0,e.soldOutDate=!0):void 0===e.date&&(e.blankDate=!0,e.disabledDate=!0))},r.enablePreviousMonth=function(){r.BasicAvailbilityInfo.dates,r.calendarCells.forEach(function(e,a){var t=moment(he.dateIn).format(Me),o=moment(e.date).format(Me);return t<=o?(r.calBackDisabled=!0,r.calBackDisabled):t>o?(r.calBackDisabled=!1,r.calBackDisabled):void 0})},r.enableNextMonth=function(){r.calForwordDisabled=we<2},r.displayWidget=!1,0==g.getUxConfiguration().enableTravelAgencyCodes&&0==g.getUxConfiguration().enablePromotionalCodes&&0==g.getUxConfiguration().enableDiscountCode&&0==g.getUxConfiguration().enableGroupCode&&(r.displayWidget=!0),o.editPackageInclusions=!1,c.navToggle.datesSelected=!0,1!=d.getConfig("ALTERNATE_HOTEL_SPLASH")&&(o.startTime=Date.now());var ye=[],ve=[];ve.push(0),r.deleteRoom="display-none",r.deleteRatePlan="display-none",r.deletePackage="display-none",r.alternatepropertiesgsplash="display-none",r.specialCodeEnabled=g.getUxConfiguration();var he=d.buildOptions();void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(he.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?he.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:he.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),r.translate,o.guestsroomsClass="is-disabled",o.datesOfStayClass="is-active",o.accommodationClass="is-disabled",o.totalClass="is-disabled";var Re=d.getMainReservation(),fe=Re.resGlobalInfo.timeSpan.start,Ce=Re.resGlobalInfo.timeSpan.end,Pe=Re.resGlobalInfo.timeSpan.startMonth;g.getHotelInfo().hotelCode,r.retrieveConfirmationPopup="display-none",r.showModifyRetrieveEHModal="display-none";var Se=d.canModifyReservation();r.cacheStartDate=fe,r.cacheEndDate=Ce,r.$on(t.RES_SELECTION_CHANGE,function(){O()}),r.$on("EVENT.RECALL_BASIC_AVAIL_COSMO",function(){O()}),r.$on("EVENT.CALL_BASICAVAIL_API_ON_HOLD_ERROR",function(){"datesofstay"===l.current.name&&O()}),o.$on("EVENT.RECALL_BASIC_AVAIL",function(){var e=d.getMainReservation();e.roomStays&&e.roomStays.length>0&&e.roomStays[0].ratePlans&&e.roomStays[0].ratePlans.length>0&&e.roomStays[0].ratePlans[0].ratePlanCode?(he.ratePlanCode=e.roomStays[0].ratePlans[0].ratePlanCode,he.ratePlanType=e.roomStays[0].ratePlans[0].ratePlanType):(delete he.ratePlanCode,delete he.ratePlanType),O()}),r.$on(t.LANG_CHANGE,function(e,a){r.unavailableDateError&&q(),r.isCTDError&&$(),r.isUnavailableDatesError&&Y(),r.isMinLOSError&&z(),r.isMaxLOSError&&W()}),r.$on("EVENT.CURRENCY_CHANGE",function(){ae=d.getCurrencyDetails(),r.isCurrencyLeadRateEnabledFlag=ae.leadRateDisplayEnabled,r.strikeThroughPricingEnabled=g.getUxConfiguration().strikeThroughPricingEnabled,r.currencyDisplayRightEnabled=ae.displayRightEnabled,r.currencySymbol=ae.currencySymbol,te=g.getDefaultCurrency(),he.currencyCode=ae?ae.currencyCode:te.currencyCode,O(!0)}),r.checkInOutSelected=!0,r.$state=l,r.calBackDisabled=!0,r.isLeadRateEnabled=g.getCalConfigInfo().leadRateDisplayEnabled;var Ae=moment.utc().utcOffset(60*g.getTimeZone().gmtOffset);if(Ae.format("YYYY-MM-DD"),r.today=moment(Ae.format("YYYY-MM-DD")).toDate(),r.daysNameArray=[],void 0!=fe)r.firstDayOfCalendar=moment(fe).toDate(),r.checkInOutSelected=!0;else if(void 0!=d.getGroup())r.firstDayOfCalendar=moment(d.getGroup().groupRules.earliestCheckInDate).toDate();else if(void 0!=Pe&&""!=Pe){var Ie=moment([moment.utc(Pe,"YYYY-MM").year(),moment.utc(Pe,"YYYY-MM").month()]),be=moment([moment.utc(r.today).year(),moment.utc(r.today).month()]);if(Ie.diff(be,"months")>0&&Ie.diff(be,"years")>=0){var De=moment.utc(Pe,"YYYY-MM").startOf("month").format("YYYY-MM-DD");r.firstDayOfCalendar=moment(De).toDate()}else r.firstDayOfCalendar=r.today}else r.firstDayOfCalendar=r.today;r.currentYear=r.firstDayOfCalendar.getFullYear();var Te,Oe,Ee=moment(r.firstDayOfCalendar).format("MM"),Me="YYYY-MM-DD",_e=moment(r.today).format(Me),ke="";r.allCalMonthData={};var Ne,Le,Ge,Fe=moment(r.today).daysInMonth(),Be=g.getCalConfigInfo(),xe=0;r.calendarDayDate=m.numToArray(Fe);var we=g.getCalConfigInfo().monthsToLookAhead,Ue=Be.visibleMonths;we=2==Ue?we-1:we;var He=moment(r.today).format("MM");if(He<Ee){we-=Ee-He}var Ve,$e=we,qe=moment(r.firstDayOfCalendar).startOf("month").format(Me);r.$watch("translate",function(){b(),r.translate_check_out_only=o.translate.page_datesOfStay_checkOutOnlyLbl?o.translate.page_datesOfStay_checkOutOnlyLbl:"CHECK-OUT ONLY",r.currentLanguage=d.getLanguage(),r.currentMonthName=m.translateMonthName(moment(he.dateIn).format("M")),r.secondCurrentMonthName=m.translateMonthName(moment(he.dateOut).format("M")),r.buttonMsg=void 0!==fe&&void 0!==Ce?o.translate.page_calendar_updateDatesBtn:o.translate.page_calendar_confirmDatesBtn,r.startDate&&K(r.startDate,"is-start-date"),r.endDate&&K(r.endDate,"is-end-date"),moment().month()===moment(he.dateIn).month()&&K(_e,"is-today")});var Ye=p.errorList;if(void 0!=Ye&&void 0!=Ye.errors&&Ye.errors.length>0&&!fe&&!d.getConfig("is_stay_exceeded_message_shown")){var je=y.findIndex(Ye.errors,function(e){return e.errorCode.toLowerCase()==="DATE_RANGE_TOO_HIGH".toLowerCase()});if(-1!=je){var ze=g.getHotelPhoneNumber();i.clear(),i.error({title:"",body:e("replaceHash")(r.translate["global_pleasecallforstaylongerthan90nights-PleaseCallForStaysOver90NightsMsg"],ze)}),d.setConfig("is_stay_exceeded_message_shown")}je<0&&(void 0==fe||null==fe)&&I(o.translate.page_nowtellusyourcheckindate_YourCheckInDatesMgs)}else void 0!=fe&&null!=fe||I(o.translate.page_nowtellusyourcheckindate_YourCheckInDatesMgs);r.dateChecks=function(){if(moment(he.dateIn).format(Me)>moment(he.dateIn).startOf("month").format(Me))for(var e=moment(he.dateIn).diff(moment(he.dateIn).startOf("month"),"days"),a=0;a<e;a++){var t=moment(he.dateIn).subtract(a+1,"days").format(Me);r.BasicAvailbilityInfo.dates.unshift({date:t})}};var We="default";r.continueDeleteRatePlan=function(){if(d.getConfig("delete_room_in_roomselector"))o.$broadcast(t.REMOVE_CONFIRM_DELETE_ROOM_ROOMSELECTOR),
d.deleteConfig("delete_room_in_roomselector");else if(o.MRB){d.getMainReservationArray().length>1&&void 0!=o.deleteRateFromRoom&&o.deleteRateFromRoom.id!=d.getMainReservation().id&&(d.changeSelectRoom(o.deleteRateFromRoom.id),o.$broadcast(t.MODIFY_RESERVATION),o.deleteRateFromRoom={}),d.dropPromotion(),Ke(),o.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),d.buildOptions(),void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(he.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?he.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:he.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),n.debug(JSON.stringify(he)+"this is new options");var e=d.buildOptions();void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(e.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?e.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:e.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),e.dateIn=he.dateIn,e.dateOut=he.dateOut,E(e),M(),he=e,n.debug(JSON.stringify(d.getMainReservation())+"after delete"),o.reservationArray=d.getMainReservationArray(),c.stepsById.accommodations.placeholderMRB=d.getBookedRoomCount()}else{d.dropPromotion(),Ke(),o.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),d.buildOptions(),void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(he.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?he.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:he.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),n.debug(JSON.stringify(he)+"this is new options");var e=d.buildOptions();void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(e.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?e.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:e.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),e.dateIn=he.dateIn,e.dateOut=he.dateOut,E(e),M(),he=e,n.debug(JSON.stringify(d.getMainReservation())+"after delete")}r.deleteRatePlan="display-none"};var Ke=function(){c.stepsById.accommodations.rooms=[],delete c.stepsById.accommodations.ratePlan,c.stepsById.accommodations.id="accommodations",c.stepsById.accommodations.label="Accommodations",void 0==c.stepsById.accommodations.package?(c.stepsById.accommodations.placeholder=o.translate.global_header_lblSelect,o.accommodations=!1):c.stepsById.accommodations.package.length>0||(c.stepsById.accommodations.placeholder=o.translate.global_header_lblSelect,o.accommodations=!1),F(),d.revertAccommadationRooms(),d.revertServices()},Je=function(){o.accommodations=!1,c.stepsById.accommodations={id:"accommodations",label:"Accommodations",placeholder:"Select",placeholderMRB:c.stepsById.accommodations.placeholderMRB,className:"Header-step--extended",rooms:[]},i.clear(),d.revertAccommadationRooms(),d.revertAccommadationRatePlan(),d.revertServices(),d.revertAccommadationRatePlan(),void 0!=d.getReservation().roomStays[0].roomRates[0].roomTypeCode?he.roomTypeCode=d.getReservation().roomStays[0].roomRates[0].roomTypeCode:he.roomTypeCode=void 0,A()};r.continueDeletePackage=function(){o.MRB&&d.getMainReservationArray().length>1&&void 0!=o.deletePackageFromRoom&&o.deletePackageFromRoom.id!=d.getMainReservation().id&&(d.changeSelectRoom(o.deletePackageFromRoom.id),o.$broadcast(t.MODIFY_RESERVATION),o.deletePackageFromRoom={}),d.dropPromotion(),Je(),r.deletePackage="display-none",r.deletePackage="display-none",o.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),d.buildOptions(),n.debug(JSON.stringify(he)+"this is new options");var e=d.buildOptions();e.dateIn=he.dateIn,e.dateOut=he.dateOut,E(e),M(),he=e,o.MRB&&(o.reservationArray=d.getMainReservationArray(),c.stepsById.accommodations.placeholderMRB=d.getBookedRoomCount())},r.$on("EVENT.MONTH_SELECTED",function(e,a){r.firstDayOfCalendar=a,r.currentYear=r.firstDayOfCalendar.getFullYear(),qe=moment(r.firstDayOfCalendar).startOf("month").format(Me),M(),L()}),function(){if(p.manageUrlParams&&p.manageUrlParams.rateplanid&&c.stepsById.accommodations.ratePlan&&c.stepsById.accommodations.ratePlan.length>0&&c.stepsById.accommodations.ratePlan[0].ratePlanCode&&o.ratePlanList&&o.ratePlanList.length>0&&!d.canModifyReservation()&&!S.checkGmsLogin()&&!R.getIsLoyaltyUserLogIn()){o.ratePlanList.filter(function(e){return c.stepsById.accommodations.ratePlan[0].ratePlanCode===e.ratePlanCode&&e.isAbstract}).length>0&&(Ke(),he=d.buildOptions())}}(),function(){var e=d.getMainReservation();if(p.manageUrlParams&&(p.manageUrlParams.packageid||p.manageUrlParams.prodid)&&void 0!=e.roomStays&&e.roomStays.length>0&&void 0!=e.roomStays[0].ratePlans&&e.roomStays[0].ratePlans.length>0&&o.packageList&&o.packageList.length>0&&!d.canModifyReservation()&&!S.checkGmsLogin()&&!R.getIsLoyaltyUserLogIn()){o.packageList.filter(function(e){return(p.manageUrlParams.packageid||p.manageUrlParams.prodid)===e.ratePlanCode&&e.isAbstract}).length>0&&(Je(),he=d.buildOptions())}}(),M(),r.loadAnotherMonth=function(){o.startTime=Date.now(),We="next",r.loadNextPrevCalender=!0;var e;void 0!==r.previousMonthOptions.dateIn?void 0!=r.previousMonthOptions.dateIn&&(e=r.previousMonthOptions.dateIn):e=void 0;var a=parseInt(ve)+1;ve.length=0,ve.push(a);var t=moment.utc(e).add(1,"months").startOf("month").format("YYYY-MM-DD");c.stepsById.dates.startDate=r.startDate,he.dateIn=t,r.allCalMonthData[t]=r.calendarCells;var n=moment.utc(e).endOf("month").format("YYYY-MM-DD");if(ke="",r.calendarCells.forEach(function(e){e.date==n&&e.isAvailable&&(ke=t)}),2==r.visibleMonths){var i=moment(t).add(1,"months").endOf("month").format("YYYY-MM-DD");he.dateOut=i,Ge=T(he.dateOut),Te=moment(he.dateOut).format("YYYY"),Oe=moment(he.dateOut).format("MM")}else{var s=moment(t).endOf("month").format("YYYY-MM-DD");he.dateOut=s}Le=T(he.dateIn),Fe=moment(he.dateIn).daysInMonth(),Ne=moment(he.dateOut).daysInMonth(),r.calendarCells=m.numToArray(Ve),r.cacheStartDate=angular.copy(r.startDate),r.cacheEndDate=angular.copy(r.endDate),we--,we<1&&(we=1),O()};var Qe=function(){c.stepsById.accommodations.rooms=[],delete c.stepsById.accommodations.ratePlan,c.stepsById.accommodations.rooms=[],c.stepsById.accommodations.id="accommodations",c.stepsById.accommodations.label="Accommodations",void 0==c.stepsById.accommodations.package&&void 0==c.stepsById.accommodations.group?(c.stepsById.accommodations.placeholder=o.translate.global_header_lblSelect,o.accommodations=!1):void 0==c.stepsById.accommodations.package&&(c.stepsById.accommodations.placeholder=o.translate.global_header_lblSelect,o.accommodations=!1),d.revertAccommadationRooms(),d.revertServices(),F()};r.continueDeleteRoom=function(){if(i.clear(),d.getConfig("delete_room_in_roomselector")){var e=!0;d.getMainReservationArray().length>0||(e=!1);for(var a=0;a<d.getMainReservationArray().length;a++)if(void 0==d.getMainReservationArray()[a].roomStays[0].total){e=!1;break}o.$broadcast(t.REMOVE_CONFIRM_DELETE_ROOM_ROOMSELECTOR),d.deleteConfig("delete_room_in_roomselector"),e&&o.$broadcast(t.DELETE_ROOM_AFTER_LAND_TOTAL)}else if(o.MRB){d.dropPromotion(),Qe(),o.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),d.buildOptions(),void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(he.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?he.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:he.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),n.debug(JSON.stringify(he)+"this is new options");var s=d.buildOptions();void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(s.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?s.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:s.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),s.dateIn=he.dateIn,s.dateOut=he.dateOut,E(s),M(),he=s,n.debug(JSON.stringify(d.getMainReservation())+"after delete"),o.reservationArray=d.getMainReservationArray()}else{d.dropPromotion(),Qe(),o.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),d.buildOptions(),void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(he.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?he.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:he.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),n.debug(JSON.stringify(he)+"this is new options");var s=d.buildOptions();void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(s.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?s.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:s.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),s.dateIn=he.dateIn,s.dateOut=he.dateOut,E(s),M(),he=s,n.debug(JSON.stringify(d.getMainReservation())+"after delete")}h.onModalClose(),r.deleteRoom="display-none"},r.$on(t.REMOVE_ACCOMMODATION,function(){r.deleteRoom="display-block",setTimeout(function(){h.onModalOpen("manage-rooms-link-id","delete-room-parent-id","delete-room-title-id",!1,r.cancelDeleteRoom)}),u.scrollTopAnimated(0,1e3),r.cancelDeleteRoom=function(){h.onModalClose(),r.deleteRoom="display-none",o.MRB&&r.OpenSwitchRoom(),d.deleteConfig("delete_room_in_roomselector")}}),r.$on(t.EXTENDHOLD_REMOVE_ROOM,function(){u.scrollTopAnimated(0,1e3),r.showModifyRetrieveEHModal="display-block",setTimeout(function(){h.onModalOpen("","modify-retreieve-eh-parent-datesOfStay-id","modify-retreieve-eh-title-datesOfStay-id",!1,r.cancelModifyRetrieveEH)}),d.setConfig("extendhold_remove_room")}),r.$on(t.REMOVE_RATEPLAN,function(){r.deleteRatePlan="display-block",r.cancelDeleteRatePlan=function(){r.deleteRatePlan="display-none"}}),r.$on(t.EXTENDHOLD_REMOVE_RATEPLAN,function(){u.scrollTopAnimated(0,1e3),r.showModifyRetrieveEHModal="display-block",setTimeout(function(){h.onModalOpen("","modify-retreieve-eh-parent-datesOfStay-id","modify-retreieve-eh-title-datesOfStay-id",!1,r.cancelModifyRetrieveEH)}),d.setConfig("extendhold_remove_rateplan")}),r.$on(t.REMOVE_PACKAGE,function(){r.deletePackage="display-block",r.deletePackageWindow=p.pageYOffset+180+"px",r.cancelDeletePackage=function(){r.deletePackage="display-none"}}),r.$on(t.EXTENDHOLD_REMOVE_PACKAGE,function(){u.scrollTopAnimated(0,1e3),r.showModifyRetrieveEHModal="display-block",setTimeout(function(){h.onModalOpen("","modify-retreieve-eh-parent-datesOfStay-id","modify-retreieve-eh-title-datesOfStay-id",!1,r.cancelModifyRetrieveEH)}),d.setConfig("extendhold_remove_package")}),r.loadPreviousMonth=function(){o.startTime=Date.now(),We="previous",r.loadNextPrevCalender=!0;var e=moment.utc(r.previousMonthOptions.dateIn).subtract(1,"months").startOf("month").format("YYYY-MM-DD"),a=moment.utc(e).endOf("month").format("YYYY-MM-DD");he=d.buildOptions(),void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(he.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?he.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:he.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),c.stepsById.dates.startDate=r.startDate;var t=moment.utc(e).subtract(1,"months").startOf("month").format("YYYY-MM-DD"),n=moment.utc(a).subtract(1,"months").endOf("month").format("YYYY-MM-DD");ke="",r.prevPrevmonthCalData=r.allCalMonthData[t],void 0!=r.prevPrevmonthCalData&&r.prevPrevmonthCalData.forEach(function(a){a.date==n&&a.isAvailable&&(ke=e)}),_e!==e&&_e<e?he.dateIn=e:_e!==e&&_e>e?he.dateIn=_e:_e==e?he.dateIn=_e:1==r.visibleMonths&&_e!==a&&(he.dateIn=e,he.dateOut=a),1==r.visibleMonths&&_e==a&&(he.dateIn=a,he.dateOut=moment().add(1,"months").startOf("month").format("YYYY-MM-DD")),2==r.visibleMonths?(he.dateOut=moment(he.dateIn).add(1,"months").endOf("month").format("YYYY-MM-DD"),Ge=T(he.dateOut),Te=moment(he.dateOut).format("YYYY"),Oe=moment(he.dateOut).format("MM")):_e!==e&&_e<e?he.dateOut=a:_e!==e&&_e>e&&_e!=a?he.dateOut=a:_e!==a?he.dateOut=a:2==r.visibleMonths&&_e==a&&(he.dateOut=moment().add(1,"months").startOf("month").format("YYYY-MM-DD")),Le=T(he.dateIn),Fe=moment(he.dateIn).daysInMonth(),Ne=moment(he.dateOut).daysInMonth(),r.calendarCells=m.numToArray(Ve),d.buildOptions(),void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(he.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?he.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:he.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),r.cacheStartDate=angular.copy(r.startDate),r.cacheEndDate=angular.copy(r.endDate),G(),we++,we>$e&&(we=$e),O()},r.calendarDayDate=r.calendarDayDate.map(function(e){return w(e+1)}),r.numToArray=function(e){return m.numToArray(e)},function(){if(fe&&null!==fe&&Ce&&null!==Ce){var e;K(fe,"is-start-date"),K(Ce,"is-end-date"),r.checkInOutSelected=!1;for(var a=moment(Ce).diff(moment(fe),"days"),t=1;t<a;t++)e=moment(fe,Me).add(t,"day").format(Me),K(e,"is-in-range");r.startDate=fe,r.endDate=Ce,r.buttonMsg=o.translate.page_calendar_updateDatesBtn}else r.buttonMsg=o.translate.page_calendar_confirmDatesBtn}();var Xe,Ze=void 0,ea=void 0,aa=void 0;r.selectDates=function(e){r.unavailableDateError=!1,r.isMinLOSError=!1,r.isMaxLOSError=!1,r.isCTDError=!1,r.isUnavailableDatesError=!1,aa=void 0;var a=!1,t=!1;r.minLengthOfStayStayT,r.maxLengthOfStayStayT,i.clear(),r.checkInOutSelected=!0;var s=e.date;if(s){if(e.lengthOfStay&&(Xe=e.lengthOfStay),r.startDate&&e.date===r.startDate&&r.checkCache)return void J();if(!e.isAvailable&&!e.enableCheckout)return e.date>r.startDate&&null===r.endDate?(K(r.startDate,"is-start-date"),$(),!1):(J(),q(),!1);if(moment(s)<moment(_e))return;if(r.startDate&&r.endDate){if(e.enableCheckout)return J(),q(),!1;var l=!1;return e.availability.forEach(function(e){"CTA"==e.availStatus&&(l=!0)}),l?(J(),q(),!1):(Xe?(Ze="A"===Xe.minLOSType?Xe.minLOS:void 0,ea="A"===Xe.maxLOSType?Xe.maxLOS:void 0):(Ze=void 0,ea=void 0),J(),r.startDate=s,K(r.startDate,"is-start-date"),void v.eventTrack("SelectDatesCheckIn",{category:"UserNavigation",label:r.startDate}))}if(r.startDate&&!r.endDate){if(moment(s,Me)<moment(r.startDate,Me)){var l=!1;if(e.availability.forEach(function(e){"CTA"==e.availStatus&&(l=!0)}),l||e.enableCheckout)return q(),!1;if(J(),r.startDate=s,K(r.startDate,"is-start-date"),v.eventTrack("SelectDatesCheckIn",{category:"UserNavigation",label:r.startDate}),e.enableCheckout)return q(),!1;var l=!1;return e.availability.forEach(function(e){"CTA"==e.availStatus&&(l=!0)}),l?(q(),!1):(J(),r.startDate=s,I(o.translate.page_chooseyourcheckoutdate_ChooseCheckOutDateMsg),K(r.startDate,"is-start-date"),v.eventTrack("SelectDatesCheckIn",{category:"UserNavigation",label:r.startDate}),void(Xe?(Ze="A"===Xe.minLOSType?Xe.minLOS:"S"===Xe.minLOSType?Xe.minLOS:void 0,ea="A"===Xe.maxLOSType?Xe.maxLOS:"S"===Xe.maxLOSType?Xe.maxLOS:void 0):(Ze=void 0,ea=void 0)))}var c=!1;if(e.availability.forEach(function(e){"CTD"==e.availStatus&&(c=!0)}),c)return moment(s,Me)<moment(r.startDate,Me)?(j(),!1):($(),!1);aa=Math.abs(moment.utc(s).diff(moment.utc(r.startDate),"days")),n.debug("******************************************************* "+aa+"LOS value");for(var d=[],g=[],m=0;m<aa;m++){var p=!1;if((P=moment.utc(r.startDate,Me).add(m,"day").format(Me))==moment.utc(s,Me))return;ye.forEach(function(e){e.requestData.dates.forEach(function(e){P==e.date&&e.lengthOfStay&&("S"===e.lengthOfStay.minLOSType&&(a=!0,void 0!=e.lengthOfStay.minLOS&&-1==d.indexOf(e.lengthOfStay.minLOS)&&d.push(e.lengthOfStay.minLOS)),"S"===e.lengthOfStay.maxLOSType&&(t=!0,void 0!=e.lengthOfStay.maxLOS&&-1==g.indexOf(e.lengthOfStay.maxLOS)&&g.push(e.lengthOfStay.maxLOS)))})})}d.length>0&&(r.minLengthOfStayStayT=Math.max.apply(null,d)),g.length>0&&(r.maxLengthOfStayStayT=Math.min.apply(null,g));for(var y=aa-1,m=0;m<y;m++){var p=!1;r.isUnAvailableCheck=!1;var h=m+1;if(P=moment.utc(r.startDate,Me).add(h,"day").format(Me),ye.forEach(function(e){e.requestData.dates.forEach(function(e){if(!1===e.isAvailable&&P==e.date){Y();var a=r.startDate;return J(),r.startDate=a,K(r.startDate,"is-start-date"),v.eventTrack("SelectDatesCheckIn",{category:"UserNavigation",label:r.startDate}),p=!0,r.isUnAvailableCheck=!0,!1}})}),p)return;K(P,"is-in-range")}if(p){var R=r.startDate;return J(),r.startDate=R,K(r.startDate,"is-start-date"),void v.eventTrack("SelectDatesCheckIn",{category:"UserNavigation",label:r.startDate})}var f=a?r.minLengthOfStayStayT:Ze,C=t?r.maxLengthOfStayStayT:ea;if(f=f||aa,C=C||aa,aa>=f&&aa<=C){i.clear();var P=moment(r.startDate,Me).format(Me);if(moment(s,Me)<moment(r.startDate,Me)){var R=r.startDate;return J(),r.startDate=R,K(r.startDate,"is-start-date"),v.eventTrack("SelectDatesCheckIn",{category:"UserNavigation",label:r.startDate}),j(),!1}r.endDate=s;var S=V(document.getElementsByClassName("Dates-cta--update")[0]).top;u.scrollTopAnimated(S,1e3),K(r.endDate,"is-end-date"),v.eventTrack("SelectDatesCheckOut",{category:"UserNavigation",label:r.endDate}),r.checkInOutSelected=!1}else{if(aa<f){var R=r.startDate;return J(),r.startDate=R,K(r.startDate,"is-start-date"),v.eventTrack("SelectDatesCheckIn",{category:"UserNavigation",label:r.startDate}),z(),!1}if(aa>C){var R=r.startDate;return J(),r.startDate=R,K(r.startDate,"is-start-date"),v.eventTrack("SelectDatesCheckIn",{category:"UserNavigation",label:r.startDate}),W(),!1}}}else{if(e.enableCheckout)return q(),!1;var l=!1;if(e.availability.forEach(function(e){"CTA"==e.availStatus&&(l=!0)}),l)return q(),!1;J(),r.startDate=s,I(o.translate.page_chooseyourcheckoutdate_ChooseCheckOutDateMsg),K(r.startDate,"is-start-date"),v.eventTrack("SelectDatesCheckIn",{category:"UserNavigation",label:r.startDate}),Xe?(Ze="A"===Xe.minLOSType?Xe.minLOS:"S"===Xe.minLOSType?Xe.minLOS:void 0,ea="A"===Xe.maxLOSType?Xe.maxLOS:"S"===Xe.maxLOSType?Xe.maxLOS:void 0):(Ze=void 0,ea=void 0)}}};var ta,oa,ra=function(){var a=d.buildUpdateOptions();void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].ratePlans&&d.getMainReservation().roomStays[0].ratePlans.length>0&&"Group"!=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType?(a.ratePlanType=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType,a.ratePlanCode=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode,a.uniqueId=d.getMainReservation().uniqueId):void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(a.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?a.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:a.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),le=C.getIncludeMemberRate(),le&&(a.includeMemberRate=le),o.$broadcast("EVENT.CONTINUE_MODIFY"),a=d.passPromotionIdInApi(a),s.getAccommodationRooms(a).getAllRooms().success(function(e){d.getConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE")&&d.deleteConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE"),d.validateAvailForPromotions(e);var a=!0,t=!0;if(void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].roomRates&&d.getMainReservation().roomStays[0].roomRates.length>0&&void 0!=d.getMainReservation().roomStays[0].roomRates[0].roomTypeCode&&void 0!=e.roomStays[0].roomTypes&&e.roomStays[0].roomTypes.length>0){a=!1;for(var o=0;o<e.roomStays[0].roomTypes.length;o++)e.roomStays[0].roomTypes[o].roomTypeCode==d.getMainReservation().roomStays[0].roomRates[0].roomTypeCode&&(a=!0)}if(void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].ratePlans&&d.getMainReservation().roomStays[0].ratePlans.length>0&&void 0!=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode&&"Group"!=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&void 0!=e.roomStays[0].ratePlans&&e.roomStays[0].ratePlans.length>0){t=!1;for(var o=0;o<e.roomStays[0].ratePlans.length;o++)e.roomStays[0].ratePlans[o].ratePlanCode==d.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode&&(t=!0)}void 0!=e.roomStays[0].ratePlans&&e.roomStays[0].ratePlans.length>0&&void 0==e.roomStays[0].ratePlans[0].ratePlanCode?(ta=!0,i.clear(),i.error({title:"",body:r.translate.page_noroomsareavailablepleaseselectnewdate_NoRoomsAreAvailablePleaseSelectNewDatesMsg})):0==a||0==t?(ta=!0,i.clear(),i.error({title:"",body:r.translate.page_noroomsareavailablepleaseselectnewdate_NoRoomsAreAvailablePleaseSelectNewDatesMsg})):1==a&&(void 0!=fe&&d.setDatesChanged(!0),m.setUserTiming("Interaction","SelectDates"),d.setConfig("LOAD_ROOM_DETAIL"),c.navToggle.accommodationSelected=!0,0==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultRatePlanType?l.go("accommodation.room"):1==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultRatePlanType&&(void 0!=e.roomStays[0].packageTypes&&e.roomStays[0].packageTypes.length>0&&void 0==c.stepsById.accommodations.package?l.go("accommodation.package"):l.go("accommodation.room")))}).error(function(a){if(i.clear(),a.errors)if(a.errors.length>0&&a.errors[0].errorCode&&a.errors[0].errorCode.toLowerCase()==="DATE_RANGE_TOO_HIGH".toLowerCase()){var t=g.getHotelPhoneNumber();i.pop({type:"error",title:"",body:e("replaceHash")(r.translate["global_pleasecallforstaylongerthan90nights-PleaseCallForStaysOver90NightsMsg"],t)})}else i.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})})};if(r.submitDates=function(){if(o.startTime=Date.now(),ta=!1,oa=!1,r.startDate&&r.endDate){if(o.datesOfStay=!0,Se)return o.continueModifyReservation?r.continueModifyReservation():(r.retrieveConfirmationPopup="display-block",setTimeout(function(){h.onModalOpen("","dos-retrieve-confirmation-parent-id","dos-retrieve-confirmation-title-id",!1,r.cancelModifyReservation)})),u.scrollTopAnimated(0,1e3),!1;if(1==d.getConfig("modifyRetrieveEH"))r.showModifyRetrieveEHModal="display-block",setTimeout(function(){h.onModalOpen("","modify-retreieve-eh-parent-datesOfStay-id","modify-retreieve-eh-title-datesOfStay-id",!1,r.cancelModifyRetrieveEH)}),u.scrollTopAnimated(0,1e3);else{void 0!=d.getMainReservation().resGlobalInfo.timeSpan&&(r.startDate==d.getMainReservation().resGlobalInfo.timeSpan.start&&d.getMainReservation().resGlobalInfo.timeSpan.end==r.endDate||d.revertServices()),d.setTimeSpan(r.startDate,r.endDate),c.stepsById.dates.placeholder=d.formatNavDates(),c.stepsById.dates.startDate=r.startDate,c.stepsById.dates.endDate=r.endDate,o.$broadcast("EVENT.CHANGE_TOTAL_PLACEHOLDER");var a=d.buildUpdateOptions();void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].ratePlans&&d.getMainReservation().roomStays[0].ratePlans.length>0&&"Group"!=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&(a.ratePlanCode=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode,a.ratePlanType=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType),void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(a.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?a.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:a.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),void 0==a.roomTypeCode&&void 0==a.ratePlanType&&void 0==a.ratePlanCode&&void 0==a.allCodes&&void 0==a.groupCode?(a.isAltHotelsReq=!0,d.setConfig("isAltHotelsReq")):void 0!=a.isAltHotelsReq&&delete a.isAltHotelsReq,le=C.getIncludeMemberRate(),le&&(a.includeMemberRate=le),n.debug(JSON.stringify(a)+"newOptions"),a=d.passPromotionIdInApi(a),s.getAccommodationRooms(a).getAllRooms().success(function(e){d.getConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE")&&d.deleteConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE"),d.validateAvailForPromotions(e),delete a.isAltHotelsReq;var n=!0,s=!0;if(void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].roomRates&&d.getMainReservation().roomStays[0].roomRates.length>0&&void 0!=d.getMainReservation().roomStays[0].roomRates[0].roomTypeCode&&e.roomStays.length>0&&void 0!=e.roomStays[0].roomTypes&&e.roomStays[0].roomTypes.length>0){n=!1;for(var u=0;u<e.roomStays[0].roomTypes.length;u++)e.roomStays[0].roomTypes[u].roomTypeCode==d.getMainReservation().roomStays[0].roomRates[0].roomTypeCode&&(n=!0)}if(void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].ratePlans&&d.getMainReservation().roomStays[0].ratePlans.length>0&&void 0!=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode&&"Group"!=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&e.roomStays.length>0&&void 0!=e.roomStays[0].ratePlans&&e.roomStays[0].ratePlans.length>0){s=!1;for(var u=0;u<e.roomStays[0].ratePlans.length;u++)e.roomStays[0].ratePlans[u].ratePlanCode==d.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode&&(s=!0)}0==e.roomStays.length?(ta=!0,i.clear(),void 0!=e.alternateHotels&&e.alternateHotels.length>0?(r.testHotels=e,r.alternateProperties()):i.error({title:"",body:r.translate.page_noroomsareavailablepleaseselectnewdate_NoRoomsAreAvailablePleaseSelectNewDatesMsg})):e.roomStays.length>0&&void 0!=e.roomStays[0].ratePlans&&e.roomStays[0].ratePlans.length>0&&void 0==e.roomStays[0].ratePlans[0].ratePlanCode?(ta=!0,i.clear(),void 0!=e.alternateHotels&&e.alternateHotels.length>0?(r.testHotels=e,r.alternateProperties()):i.error({title:"",body:r.translate.page_noroomsareavailablepleaseselectnewdate_NoRoomsAreAvailablePleaseSelectNewDatesMsg})):0==n||0==s?(ta=!0,i.clear(),void 0!=e.alternateHotels&&e.alternateHotels.length>0?(r.testHotels=e,r.alternateProperties()):i.error({title:"",body:r.translate.page_noroomsareavailablepleaseselectnewdate_NoRoomsAreAvailablePleaseSelectNewDatesMsg})):(void 0!=fe&&d.setDatesChanged(!0),1==d.getConfig("SET_PACKAGE")&&d.setConfig("OPEN_PACKAGE_DETAIL"),m.setUserTiming("Interaction","SelectDates"),c.navToggle.accommodationSelected=!0,re||(o.enabelRoomSelector=!0),0==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultRatePlanType?(d.setConfig("LAND_ACCOMMODATION_SUCCESSFUL"),l.go("accommodation.room")):1==g.getHotelDesc().uxConfiguration.accomodationsConfig.defaultRatePlanType&&(d.setConfig("LAND_ACCOMMODATION_SUCCESSFUL"),void 0!=e.roomStays[0].packageTypes&&e.roomStays[0].packageTypes.length>0&&void 0==c.stepsById.accommodations.package?l.go("accommodation.package"):l.go("accommodation.room")),o.MRB&&(d.deleteTotal(d.getMainReservation().id),o.$broadcast(t.MODIFY_RESERVATION)))}).error(function(a){if(ta=!0,i.clear(),a.errors)if(a.errors.length>0&&a.errors[0].errorCode&&a.errors[0].errorCode.toLowerCase()==="DATE_RANGE_TOO_HIGH".toLowerCase()){var t=g.getHotelPhoneNumber();oa=!0,i.pop({type:"error",title:"",body:e("replaceHash")(r.translate["global_pleasecallforstaylongerthan90nights-PleaseCallForStaysOver90NightsMsg"],t)})}else i.error({title:"",body:r.translate.page_noroomsareavailablepleaseselectnewdate_NoRoomsAreAvailablePleaseSelectNewDatesMsg})})}}n.debug(JSON.stringify(d.getMainReservation())+"datesofstay"),o.toggle.intlMenu=!1},r.$watch("translate",function(){if(oa){var a=g.getHotelPhoneNumber();i.pop({type:"error",title:"",body:e("replaceHash")(r.translate["global_pleasecallforstaylongerthan90nights-PleaseCallForStaysOver90NightsMsg"],a)})}else 1==ta&&(i.clear(),i.error({title:"",body:r.translate.page_noroomsareavailablepleaseselectnewdate_NoRoomsAreAvailablePleaseSelectNewDatesMsg}))}),r.cancelModifyRetrieveEH=function(){d.setPromotionObjectInModifyReservation(void 0),r.showModifyRetrieveEHModal="display-none",h.onModalClose(),J(),r.startDate=fe,r.endDate=Ce,r.startDate&&K(r.startDate,"is-start-date"),r.endDate&&K(r.endDate,"is-end-date");for(var e=moment.utc(Ce).diff(moment.utc(fe),"days"),a=1;a<e;a++){K(moment.utc(fe,Me).add(a,"day").format(Me),"is-in-range")}},r.cancelModifyReservation=function(){d.setPromotionObjectInModifyReservation(void 0),r.retrieveConfirmationPopup="display-none",h.onModalClose(),J(),r.startDate=fe,r.endDate=Ce,r.startDate&&K(r.startDate,"is-start-date"),r.endDate&&K(r.endDate,"is-end-date");for(var e=moment.utc(Ce).diff(moment(fe),"days"),a=1;a<e;a++){K(moment.utc(fe,Me).add(a,"day").format(Me),"is-in-range")}},r.continueModifyReservationEH=function(){void 0==d.getMainReservation().resGlobalInfo.timeSpan||r.startDate==d.getMainReservation().resGlobalInfo.timeSpan.start&&d.getMainReservation().resGlobalInfo.timeSpan.end==r.endDate||(d.revertServices(),d.setTimeSpan(r.startDate,r.endDate),c.stepsById.dates.placeholder=d.formatNavDates(),c.stepsById.dates.startDate=r.startDate,c.stepsById.dates.endDate=r.endDate),s.cancelExtendHold(o.extendHoldHotelCode,o.extendHoldConfirmationCode,o.extendHoldEmail).success(function(){var e=d.getPromotionObjectInModifyReservation();if(e&&(d.setPromotionInContext(e),o.$broadcast("DISABLE_RIGHT_RAIL"),r.showModifyRetrieveEHModal="display-none"),d.setPromotionObjectInModifyReservation(void 0),1==d.getConfig("extendhold_remove_room")){d.deleteConfig("extendhold_remove_room"),Qe(),r.showModifyRetrieveEHModal="display-none",h.onModalClose(),o.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),d.buildOptions(),void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(he.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?he.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:he.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode);var a=d.buildOptions();void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(a.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?a.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:a.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),a.dateIn=he.dateIn,a.dateOut=he.dateOut,E(a),M(),he=a}else if(1==d.getConfig("extendhold_remove_rateplan")){d.deleteConfig("extendhold_remove_rateplan"),Ke(),r.showModifyRetrieveEHModal="display-none",h.onModalClose(),o.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),d.buildOptions();var a=d.buildOptions();a.dateIn=he.dateIn,a.dateOut=he.dateOut,E(a),M(),he=a}else if(1==d.getConfig("extendhold_remove_package")){d.deleteConfig("extendhold_remove_package"),Je(),r.showModifyRetrieveEHModal="display-none",h.onModalClose(),o.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),d.buildOptions();var a=d.buildOptions();a.dateIn=he.dateIn,a.dateOut=he.dateOut,E(a),M(),he=a}else d.setContinueChangeReservation(),r.retrieveConfirmationPopup="display-none",h.onModalClose(),ra();d.deleteUniqueId(),d.deleteConfig("modifyRetrieveEH")}).error(function(){})},r.continueModifyReservation=function(){void 0==d.getMainReservation().resGlobalInfo.timeSpan||r.startDate==d.getMainReservation().resGlobalInfo.timeSpan.start&&d.getMainReservation().resGlobalInfo.timeSpan.end==r.endDate||(d.revertServices(),d.setTimeSpan(r.startDate,r.endDate),c.stepsById.dates.placeholder=d.formatNavDates(),c.stepsById.dates.startDate=r.startDate,c.stepsById.dates.endDate=r.endDate);var e=d.getPromotionObjectInModifyReservation();e&&(d.setPromotionInContext(e),o.$broadcast("DISABLE_RIGHT_RAIL")),d.setPromotionObjectInModifyReservation(void 0),d.setContinueChangeReservation(),r.retrieveConfirmationPopup="display-none",h.onModalClose(),ra()},1==d.getConfig("ALTERNATE_HOTEL_SPLASH")&&(!o.MRB||o.MRB&&1==d.getMainReservationArray().length)){d.revertAccommadationRatePlan(),o.ALTERNATE_HOTEL_SPLASH=!0,o.showSpinner=!0;var na=d.buildUpdateOptions()
;void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].ratePlans&&d.getMainReservation().roomStays[0].ratePlans.length>0&&"Group"!=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&void 0!=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&(na.ratePlanCode=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode,na.ratePlanType=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType),void 0!=c.stepsById.accommodations.package&&c.stepsById.accommodations.package.length>0&&(na.ratePlanType="package",void 0!=c.stepsById.accommodations.package[0].packageCode?na.ratePlanCode=c.stepsById.accommodations.package[0].packageCode:na.ratePlanCode=c.stepsById.accommodations.package[0].ratePlanCode),void 0==na.roomTypeCode&&void 0==na.ratePlanType&&void 0==na.ratePlanCode&&void 0==na.allCodes&&void 0==na.groupCode?na.isAltHotelsReq=!0:void 0!=na.isAltHotelsReq&&delete na.isAltHotelsReq,le=C.getIncludeMemberRate(),le&&(na.includeMemberRate=le),p.baseRes&&p.baseRes.portalSymbol&&(r.showBackToAsBtn=!0),o.startTime=Date.now(),na=d.passPromotionIdInApi(na),s.getAccommodationRooms(na).getAllRooms().success(function(e){d.getConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE")&&d.deleteConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE"),d.validateAvailForPromotions(e),o.ALTERNATE_HOTEL_SPLASH=void 0,o.showSpinner=!1,delete na.isAltHotelsReq,r.testHotels=e,r.alternateProperties(),d.deleteConfig("ALTERNATE_HOTEL_SPLASH")}).error(function(a){if(o.ALTERNATE_HOTEL_SPLASH=void 0,i.clear(),a.errors)if(a.errors.length>0&&a.errors[0].errorCode&&a.errors[0].errorCode.toLowerCase()==="DATE_RANGE_TOO_HIGH".toLowerCase()){var t=g.getHotelPhoneNumber();i.pop({type:"error",title:"",body:e("replaceHash")(r.translate["global_pleasecallforstaylongerthan90nights-PleaseCallForStaysOver90NightsMsg"],t)})}else i.error({title:"",body:r.translate.page_noroomsareavailablepleaseselectnewdate_NoRoomsAreAvailablePleaseSelectNewDatesMsg})})}for(var ia=0;ia<d.getMainReservationArray().length;ia++)d.getMainReservationArray()[ia].id==d.getMainReservation().id?d.getMainReservationArray()[ia].selected=!0:d.getMainReservationArray()[ia].selected=!1;o.reservationArray=d.getMainReservationArray(),n.debug(JSON.stringify(o.reservationArray)+"$rootScope.reservationArray"),r.$on(t.CHANGE_ROOM_SELECTOR,function(){J(),Re=d.getMainReservation(),fe=Re.resGlobalInfo.timeSpan.start,Ce=Re.resGlobalInfo.timeSpan.end,r.startDate=fe,r.endDate=Ce,r.cacheStartDate=angular.copy(r.startDate),r.cacheEndDate=angular.copy(r.endDate),r.startDate&&K(r.startDate,"is-start-date"),r.endDate&&K(r.endDate,"is-end-date");for(var e=moment.utc(Ce).diff(moment(fe),"days"),a=1;a<e;a++){K(moment.utc(fe,Me).add(a,"day").format(Me),"is-in-range")}A()}),r.$on("EVENT.GMS_REMOVE_PRIVATEOFFERS",function(){var e,a=d.getMainReservation();if(o.MRB){e=d.getMainReservationArray();for(var t=0;t<e.length;t++)if(void 0!=e[t]&&void 0!=e[t].roomStays&&e[t].roomStays.length>0&&void 0!=e[t].roomStays[0].roomRates&&e[t].roomStays[0].roomRates.length>0&&void 0!=e[t].roomStays[0].roomRates[0].roomTypeCode&&void 0!=e[t].roomStays[0].ratePlans&&e[t].roomStays[0].ratePlans.length>0&&"Group"!=e[t].roomStays[0].ratePlans[0].ratePlanType){a=e[t];break}}1==d.getGmsLoginState()&&void 0!=a.roomStays&&a.roomStays.length>0&&void 0!=a.roomStays[0].roomRates&&a.roomStays[0].roomRates.length>0&&void 0!=a.roomStays[0].roomRates[0].roomTypeCode&&void 0!=a.roomStays[0].ratePlans&&a.roomStays[0].ratePlans.length>0&&"Group"!=a.roomStays[0].ratePlans[0].ratePlanType&&(r.continueDeleteRatePlan(),r.continueDeleteRoom(),r.continueDeletePackage(),o.MRB&&(d.revertAllAccommodationsMrb(),c.stepsById.accommodations.placeholderMRB=d.getBookedRoomCount()))}),r.$on("LOYALTY_USER_LOGIN_SUCCESS",function(){P.isAudienceEvaluatorEnabled()?Z():O()}),r.$on("LOYALTY_USER_LOGOUT_SUCCESS",function(){if(P.isAudienceEvaluatorEnabled()){P.resetAudienceLists(),P.resetReservationHistoryObject();var e=P.getAudienceEvaluatorCriteria(),a=g.getHotelDesc(),t=a&&a.chainInfo&&a.chainInfo.length?a.chainInfo[0]:"";s.callAudienceEvaluator(a.hotelCode,t,e).then(function(e){P.setAudienceLists(e.data),o.$broadcast("RECALL_MERCHANDISING_API"),ee()},function(e){console.log(e),o.$broadcast("RECALL_MERCHANDISING_API"),ee()})}else ee()})}function datesOfStayFunction(e,a){}function replaceHashDiscountMRB(e){return function(a,t,o,r,n){if(void 0!=a)if(1==o&&1!=n){var i;if("Flat"==t){var s=e("currencyConversionAndSymbol")(r);return i=a.replace(/#/,s),i.replace(/#/,n)}if("Percent"==t){var l=r+"%";return i=a.replace(/#/,l),i.replace(/#/,n)}}else if(1!=o&&1==n){var i;if("Flat"==t){i=a.replace(/#/,o);var s=e("currencyConversionAndSymbol")(r),c=i.replace(/#/,s);return c}if("Percent"==t){i=a.replace(/#/,o);var l=r+"%",c=i.replace(/#/,l);return c}}else if(1!=o&&1!=n){var i;if("Flat"==t){i=a.replace(/#/,o);var s=e("currencyConversionAndSymbol")(r),c=i.replace(/#/,s);return c.replace(/#/,n)}if("Percent"==t){i=a.replace(/#/,o);var l=r+"%",c=i.replace(/#/,l);return c.replace(/#/,n)}}else if(1==o&&1==n){var i;if("Flat"==t){var s=e("currencyConversionAndSymbol")(r);return i=a.replace(/#/,s)}if("Percent"==t){var l=r+"%";return i=a.replace(/#/,l)}}}}function replaceHashFreeNights(e){return function(a,t,o,r){if(void 0!=a)if(1!=r){var n;if("Flat"==t){n=a.replace(/#/,r);var i=e("currencyConversionAndSymbol")(o);return n.replace(/#/,i)}if("Percent"==t){n=a.replace(/#/,r);var s=o+"%";return n.replace(/#/,s)}}else if(1==r){if("Flat"==t){var i=e("currencyConversionAndSymbol")(o);return a.replace(/#/,i)}if("Percent"==t){var s=o+"%";return a.replace(/#/,s)}}}}function replaceUserName(){return function(e,a){if(void 0!=e)return e.replace("%Guest Email ID%",a)}}function replaceHotelName(){return function(e,a){if(void 0!=e)return e.replace(/#/,a)}}function alternateAvailCurrency(e,a,t){var o=t.getRatePlanMerchandisedCurrencies();return function(r,n,i){if(void 0!=r){for(var s,l,c,d,g,m=0;m<t.getCurrencies().length;m++)t.getCurrencies()[m].currencyCode==n&&(s=t.getCurrencies()[m]);l=r/s.exchangeRate,c=a.getCurrencyDetails(),d=-1!=o.indexOf(c.currencyCode)&&i&&c.currencyCode==i?1*l:l*c.exchangeRate,d=t.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?parseFloat(d).toFixed(2):parseFloat(d).toFixed(0),0==c.currencyDisplayFormat.precision&&(d=Math.round(d));var u=c.currencySymbol;g=e("currency")(d,u),g=g.replace(/,/g,";"),g=g.replace(/\./g,c.currencyDisplayFormat.decimalSeparator),g=g.replace(/;/g,c.currencyDisplayFormat.unitSeparator),0!=c.currencyDisplayFormat.precision&&t.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator||(g=""!=c.currencyDisplayFormat.decimalSeparator?g.substring(0,g.length-3):g.substring(0,g.length-2));if(c.displayRightEnabled){var p=g.replace(u,"");return g=p+" "+u}var p=g.replace(u,"");return g=u+" "+p}}}function replaceHash(){return function(e,a){if(void 0!=e)return e.replace(/#/g,a)}}function replaceDollerOneToAmount(){return function(e,a){if(void 0!=e)return e.replace(/#/g,a)}}function replaceHashWithPercent(){return function(e,a){if(void 0!=e)return e.replace(/#/g,a+"%")}}function replaceHashMRB(){return function(e,a,t){if(void 0!=e){return e.replace(/#/,a).replace(/#/,t)}}}function currencyConversionAndSymbolDisplayLogic(e,a,t,o){var r=o.getRatePlanMerchandisedCurrencies();return function(n,i){var s,l=a.getCurrencyDetails();if(s=-1!=r.indexOf(l.currencyCode)&&i&&l.currencyCode==i?1*n:n*l.exchangeRate,!isNaN(n)&&void 0!=n&&null!=n&&parseFloat(n)!=parseFloat(s)&&(0==s||void 0==s||null==s||isNaN(s)))return void e.$broadcast("UNKNOWN_APPLICATION_ERROR",{applicationReset:!0,eventLabel:"CurrencyExchangeRateException"});var c=l.currencySymbol;l&&l.currencyDisplayFormat&&0==l.currencyDisplayFormat.precision&&(s=Math.round(s));var d,g;d=t("currency")(s,c),d=d.replace(/,/g,";"),d=d.replace(/\./g,l.currencyDisplayFormat.decimalSeparator),d=d.replace(/;/g,l.currencyDisplayFormat.unitSeparator),d=""!=l.currencyDisplayFormat.decimalSeparator?d.substring(0,d.length-3):d.substring(0,d.length-2);var m=l.displayRightEnabled,u=l.leadRateDisplayEnabled;if(m){var p=d.replace(c,"");d=p+" "+c}else{var p=d.replace(c,"");d=c+" "+p}return!0===o.getUxConfiguration().strikeThroughPricingEnabled&&!1===u?(g=d,g=g.replace(c,"")):g=d,g}}function currencyConversionAndSymbol(e,a,t,o){var r=o.getRatePlanMerchandisedCurrencies();return function(n,i,s){var l,c=i||a.getCurrencyDetails();if(l=-1!=r.indexOf(c.currencyCode)&&s&&c.currencyCode==s?1*n:n*c.exchangeRate,!isNaN(n)&&void 0!=n&&null!=n&&parseFloat(n)!=parseFloat(l)&&(0==l||void 0==l||null==l||isNaN(l)))return void e.$broadcast("UNKNOWN_APPLICATION_ERROR",{applicationReset:!0,eventLabel:"CurrencyExchangeRateException"});var d;l=o.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?parseFloat(l).toFixed(2):parseFloat(l).toFixed(0),void 0!=c.currencyDisplayFormat&&0==c.currencyDisplayFormat.precision&&(l=Math.round(l));var g=c.currencySymbol;if(d=t("currency")(l,g),d=d.replace(/,/g,";"),void 0!=c.currencyDisplayFormat&&(d=d.replace(/\./g,c.currencyDisplayFormat.decimalSeparator),d=d.replace(/;/g,c.currencyDisplayFormat.unitSeparator)),void 0==c.currencyDisplayFormat||0!=c.currencyDisplayFormat.precision&&o.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator||(d=""!=c.currencyDisplayFormat.decimalSeparator?d.substring(0,d.length-3):d.substring(0,d.length-2)),c.displayRightEnabled){var m=d.replace(g,"");return d=m+" "+g}var m=d.replace(g,"");return d=g+" "+m}}function defaultCurrencySymbol(e,a,t,o){return function(e,r){var n,i=r||a.getCurrencyDetails(),s=o.getDefaultCurrency()?o.getDefaultCurrency().currencySymbol:"",l=o.getDefaultCurrency()?o.getDefaultCurrency().currencyDisplayFormat:"",c="";if(c=void 0!=i.currencyDisplayFormat&&0==i.currencyDisplayFormat.precision?Math.round(e):parseFloat(e).toFixed(2),n=t("currency")(c,s),n=n.replace(/,/g,";"),n=n.replace(/\./g,l.decimalSeparator),n=n.replace(/;/g,l.unitSeparator),0==l.precision&&(n=""!=l.decimalSeparator?n.substring(0,n.length-3):n.substring(0,n.length-2)),o.getDefaultCurrency().displayRightEnabled){var d=n.replace(s,"");return n=d+" "+s}var d=n.replace(s,"");return n=s+" "+d}}function currencyConversionWithTwoDecimalPlaces(e,a,t,o){var r=o.getRatePlanMerchandisedCurrencies();return function(n,i){var s,l=a.getCurrencyDetails(),c=l.currencySymbol?l.currencySymbol:o.getDefaultCurrency()?o.getDefaultCurrency().currencySymbol:"";if(a.getZeroDollarExceptionFlag()&&!l.exchangeRate)return void e.$broadcast("UNKNOWN_APPLICATION_ERROR",{applicationReset:!0,eventLabel:"CurrencyExchangeRateException"});l.exchangeRate||(l.exchangeRate=0);var d;if(d=-1!=r.indexOf(l.currencyCode)&&i&&l.currencyCode==i?1*n:n*l.exchangeRate,!isNaN(n)&&void 0!=n&&null!=n&&parseFloat(n)!=parseFloat(d)&&(0==d||void 0==d||null==d||isNaN(d)))return void e.$broadcast("UNKNOWN_APPLICATION_ERROR",{applicationReset:!0,eventLabel:"CurrencyExchangeRateException"});if(d=o.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?parseFloat(d).toFixed(2):parseFloat(d).toFixed(0),void 0!=l.currencyDisplayFormat&&0==l.currencyDisplayFormat.precision&&(d=Math.round(d)),void 0!=l.currencyDisplayFormat)s=t("currency")(d,c),s=s.replace(/,/g,";"),s=s.replace(/\./g,l.currencyDisplayFormat.decimalSeparator),s=s.replace(/;/g,l.currencyDisplayFormat.unitSeparator),0!=l.currencyDisplayFormat.precision&&o.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator||(s=""!=l.currencyDisplayFormat.decimalSeparator?s.substring(0,s.length-3):s.substring(0,s.length-2));else{var g="";g=parseFloat(d).toFixed(2),s=c+g}if(l.displayRightEnabled){var m=s.replace(c,"");return s=m+" "+c}var m=s.replace(c,"");return s=c+" "+m}}function formatDates(e){return function(a,t){if(void 0!=a){var o=e.translateMonthShortName(moment.utc(a).format("M")),r=e.translateMonthShortName(moment.utc(t).format("M")),n=moment.utc(a).format("D"),i=moment.utc(t).format("D");return o===r?o+" "+n+"-"+i:o+" "+n+"-"+r+" "+i}}}function formatServicesDate(e){return function(a){var t=e.translateMonthShortName(moment.utc(a).format("M")),o=moment.utc(a).format("D"),r=moment.utc(a).format("YYYY");return e.translateWeekShortName(moment.utc(a).day())+", "+t+" "+o+", "+r}}function formatPackageDate(e){return function(a){return e.translateMonthShortName(moment.utc(a).format("M"))+" "+moment.utc(a).format("D")+", "+moment.utc(a).format("YYYY")}}function formatGroupDate(e){return function(a){var t=e.translateMonthShortName(moment.utc(a).format("M")),o=moment.utc(a).format("D"),r=moment.utc(a).format("YYYY");return e.translateWeekShortName(moment.utc(a).day())+", "+o+" "+t+" "+r}}function formatDateMMMDDYYYY(e){return function(a){var t=e.translateMonthShortName(moment.utc(a).format("M")),o=moment.utc(a).format("D"),r=moment.utc(a).format("YYYY");return e.translateWeekShortName(moment.utc(a).day()),t+" "+o+", "+r}}function formatDateMMMDDYYYYInDatesofStay(e){return function(a){var t=e.translateMonthShortName(moment(a).format("M")),o=moment(a).format("D"),r=moment(a).format("YYYY");return e.translateWeekShortName(moment(a).day()),t+" "+o+", "+r}}function imageUrlFilter(){return function(e){var a=new RegExp("/assets/","i");return e.replace(a,"")}}function replaceByProgramName(){return function(e,a){if(e)return e.replace("#",a)}}function replaceByProgramCurrency(){return function(e,a,t){if(void 0!=e){return e.replace(/#/,a).replace(/#/,t)}}}function newline(e){return function(e){return e.replace(/\n/g,"<br/>")}}function packageFeatures(){return function(e,a){var t;return a.forEach(function(a){e==a.serviceRPH&&(t=a.serviceName)}),t}}function packageFeaturesImage(){return function(e,a){var t;return a.forEach(function(a){e==a.serviceRPH&&(t=a.image.imageSource)}),t}}function rangeFilter(){return function(e,a,t){for(var o=a;o<=t;o++)e.push(o);return e}}function flexTaxes(e){return{restrict:"E",templateUrl:"./flexTaxes/total.flexTax.html",scope:{prodTaxes:"=",inTotal:"=",translate:"="}}}function showTaxBreakdown(){return{restrict:"E",replace:!0,templateUrl:"./flexTaxes/showTaxBreakdown.html"}}function FooterController(e,a,t,o,r,n,i,s,l,c,d,g,m,u,p,y,v,h,R,f,C,P,S,A,I,b){function D(e){var a;if(e)a=[],a.push({eventName:"abandonementOpt",labelName:t.gmsSpecialOffer}),a.push({eventName:"abandonmentSubmitted",labelName:o.current.name});else{a=[];var r={eventName:"",labelName:o.current.name};"display-block"===t.showGmsAbandonmentModal?r.eventName="abandonmentOpen":"display-none"===t.showGmsAbandonmentModal&&(r.eventName="abandonmentClose"),a.push(r)}angular.forEach(a,function(e){p.eventTrack(e.eventName,{category:"UserNavigation",label:e.labelName})})}function T(){var e=r.getHotelDescUpdated().consents;angular.forEach(e,function(e){"extended_hold"===e.category.toLowerCase()?(t.extendedHoldConsents=e,t.specialOffer=t.extendedHoldConsents.isPreChecked?1:0):"abandonment_email"===e.category.toLowerCase()&&(t.abandonmentEmailConsent=e,t.gmsSpecialOffer=t.abandonmentEmailConsent.isPreChecked?1:0)}),t.extendedHoldConsents||(t.specialOffer=0)}function O(){1==i.getConfig("EXTENDED_HOLD_PAGE")&&(y.debug(JSON.stringify(i.getMainReservation())+"reservationService.getMainReservation()in extendhold"),i.deleteConfig("EXTENDED_HOLD_PAGE"),"H"==i.getMainReservation().ebhResStatus?(t.showExtendHoldResumeModal="display-block",setTimeout(function(){h.onModalOpen("","extended-hold-resume-parent-id","extended-hold-title-parent-id",!0,t.closeExtendHoldResumePopup)},500)):"R"==i.getMainReservation().ebhResStatus?(t.showExtendHoldReservedModal="display-block",setTimeout(function(){h.onModalOpen("","extended-hold-reserved-modal-parent-id","extended-hold-reserved-modal-title-id",!0,t.closeExtendHoldReservedModal)},500)):"C"==i.getMainReservation().ebhResStatus||"E"==i.getMainReservation().ebhResStatus?(t.showExtendHoldExpiredModal="display-block",setTimeout(function(){h.onModalOpen("","extended-hold-expiry-parent-id","extended-hold-expiry-title-id",!0,t.closeExtendHoldExpiredModal)},500)):void 0==i.getMainReservation().ebhResStatus&&(i.deleteUniqueId(),l.pop({type:"error",title:"",body:"We cannot find your held reservation, please contact us at "+r.getHotelDesc().address.telephone[0].phoneNumber,timeout:5e3})))}function E(){i.getConfig("RETRIEVE_RESERVATION_POPUP")&&q&&(t.welcomeBack(),t.welcomeBackObj.confirmationNumber=i.getMainReservation().uniqueId)}function M(e,a){a||(a=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var t=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)"),o=t.exec(a);return o?o[2]?decodeURIComponent(o[2].replace(/\+/g," ")):"":null}function _(e){e&&e.roomStays&&e.roomStays.length&&e.roomStays[0]&&e.roomStays[0].ratePlans&&e&&e.roomStays&&e.roomStays.length&&e.roomStays[0]&&e.roomStays[0].ratePlans.length&&e&&e.roomStays&&e.roomStays.length&&e.roomStays[0]&&e.roomStays[0].ratePlans[0].merchandisedCurrency?(i.setConfig("SHOW_RATE_PLAN_MERCHANDISED_CURRENCY"),i.setCurrency(e.roomStays[0].ratePlans[0].merchandisedCurrency),i.setCurrencyDetails(k(e.roomStays[0].ratePlans[0].merchandisedCurrency)),a.$broadcast(u.UPDATE_CURRENCY)):i.deleteConfig("SHOW_RATE_PLAN_MERCHANDISED_CURRENCY")}function k(e){for(var a=r.getCurrencies(),t=0;t<a.length;t++)if(a[t].currencyCode===e)return a[t]}function N(){var e=new Date(t.startDate),a=e.getUTCDay(),o=c.translateWeekShortName(a),r=e.getUTCMonth(),n=c.translateMonthShortName((r+1).toString());t.startDateUpd=o+", "+n+" "+e.getUTCDate().toString()+", "+e.getUTCFullYear();var i=new Date(t.endDate),s=i.getUTCDay(),l=c.translateWeekShortName(s),d=i.getUTCMonth(),g=c.translateMonthShortName((d+1).toString());t.endDateUpd=l+", "+g+" "+i.getUTCDate().toString()+", "+i.getUTCFullYear()}t.showPromotionQualify=!1;var L=angular.copy(d.ts);t.showMessageBeforeRefreshBE=!1,t.alertVariable=!0,t.showSessionError="display-none",t.cancellationCommentConfigFlag={},t.submitCancellation=!1,t.isInsuranceReservation=!1,t.insuranceCancellationMessage={type:"warn",message:a.translate["page_travelinsurancecancellation-Msgtravelinsurancecancellation"]},r.getHotelDesc().uxConfiguration&&r.getHotelDesc().uxConfiguration.cancellationComment&&(t.cancellationCommentConfigFlag=r.getHotelDesc().uxConfiguration.cancellationComment);var G=r.getHotelDesc().paymentProviders;void 0!=G&&G.length>0&&("creditcard-adyen"==G[0].vendorKey&&1==G[0].paymentMethod||"3DSecure-adyen"==G[0].vendorKey&&2==G[0].paymentMethod||"hosting-adyen"==G[0].vendorKey&&(14==G[0].paymentMethod||15==G[0].paymentMethod||16==G[0].paymentMethod||17==G[0].paymentMethod||18==G[0].paymentMethod||19==G[0].paymentMethod||20==G[0].paymentMethod||21==G[0].paymentMethod||G[0].paymentMethod),"creditcard-mycheck"==G[0].vendorKey&&1==G[0].paymentMethod||"altpayment-mycheck"==G[0].vendorKey&&(4==G[0].paymentMethod||24==G[0].paymentMethod||G[0].paymentMethod),i.isBrainTreePaymentEnabled(),i.isAmadeusPaymentEnabled()),function(){var e="test";try{return sessionStorage.setItem(e,e),sessionStorage.removeItem(e),!0}catch(e){return!1}}()&&function(){try{var e="test",a=d.sessionStorage;return a.setItem(e,"1"),a.removeItem(e),!0}catch(e){return!1}}()||(t.showSessionError="display-block",h.onModalOpen("","session-error-parent-id","session-error-title-id",!0),i.setConfig("SHOW_SESSION_ERROR")),T(),t.$on("EVENT.HOTEL_DATA_UPDATED",function(e){T()}),a.$on(u.AUTH_ERROR,function(){a.startTime=Date.now(),c.startNewReservation()}),t.showSignUpSucessModal="display-none",a.$on(u.GMS_SIGNUP_SUCCESS,function(){t.showSignUpSucessModal="display-none",g.scrollTopAnimated(0,1e3)}),t.closeSignUpSuccessModal=function(){t.showSignUpSucessModal="display-none"},a.propertyDetailsGSplash="display-none",t.hotelDescData=r.getHotelDesc();var F=angular.copy(t.hotelDescData.brandInfo);t.hotelAddressDetail=t.hotelDescData.address,t.shortDescription="",t.propertyDescription="",t.checkPromo=i.getPromoCache(),a.totalRatePlanIconHide=!1,void 0!=d.route&&(t.fromRes=d.route||""),void 0==a.displayPromo&&(a.displayPromo="block"),1==t.checkPromo?a.displayPromo="none":1==t.closePromoBtn?a.displayPromo="none":"EXTENDED_HOLD_PAGE"!==t.fromRes&&"ALTERNATE_PAYMENT_RESPONSE"!==t.fromRes&&"ALTERNATE_HOTEL_SPLASH"!==t.fromRes&&"GMS_SOCIAL_LOGIN_SUCCESS"!==t.fromRes&&"NAVBAR_SOCIAL_LOGIN_SUCCESS"!==t.fromRes&&"GROUP_SPLASH"!==t.fromRes||(a.displayPromo="none",t.closePromoBtn=!0),t.$watch("displayPromo",function(){1==t.checkPromo&&(a.displayPromo="none"),1==t.closePromoBtn&&(a.displayPromo="none"),document.getElementById("promoInfo").style.display=a.displayPromo}),t.$watch("fromRes",function(){"EXTENDED_HOLD_PAGE"!==t.fromRes&&"ALTERNATE_PAYMENT_RESPONSE"!==t.fromRes&&"ALTERNATE_HOTEL_SPLASH"!==t.fromRes&&"GMS_SOCIAL_LOGIN_SUCCESS"!==t.fromRes&&"NAVBAR_SOCIAL_LOGIN_SUCCESS"!==t.fromRes&&"GROUP_SPLASH"!==t.fromRes||(t.closePromoBtn=!0,a.displayPromo="none"),document.getElementById("promoInfo").style.display=a.displayPromo}),angular.forEach(t.hotelDescData.generalInformation.additional,function(e){"shortDescription"==e.type?t.shortDescription=e.text:"Hotel Description"==e.type&&(t.propertyDescription=e.text)}),angular.forEach(t.hotelAddressDetail.telephone,function(e){"Voice"==e.phoneTechType&&(t.hotelAddressDetail.contactNumber=e.phoneNumber)});var B,x=r.getPromoInfo();x.hasOwnProperty("promoInfo")?(t.promoInfo=x.promoInfo,x.promoInfo.hasOwnProperty("media")?""!=(B=x.promoInfo.media[0].promoInfoUrl||"")&&B.indexOf("?")>-1&&(t.params=function(e){e.indexOf("?")>-1&&(e=e.split("?")[1]);var a=e.split("&"),t={};return a.forEach(function(e){e=e.split("="),t[e[0]]=decodeURIComponent(e[1]||"")}),t}(B.split("?")[1])):B=""):(t.promoInfo={},B="",t.closePromoBtn=!0,a.displayPromo="none"),""==B&&(document.getElementById("promoLink").style.pointerEvents="none");var w=/reservations(-t\d)*.travelclick.com/;B.match(w)?t.checkDomain=!0:t.checkDomain=!1,document.getElementById("promoLink").onclick=function(){1==t.checkDomain?(c.clearCache(),a.displayPromo="none",t.closePromoBtn=!0,i.setPromoCache()):(a.displayPromo="none",t.closePromoBtn=!0,i.setPromoCache())},t.closePromo=function(){t.closePromoBtn=!0,a.displayPromo="none"},t.$on(u.LANG_CHANGE,function(e,o){s.getInfo(r.getHotelInfo().hotelCode,a.languages).then(function(e){t.hotelDescData=e,t.hotelDescData.brandInfo=F,t.hotelAddressDetail=t.hotelDescData.address,t.shortDescription="",angular.forEach(t.hotelDescData.generalInformation.additional,function(e){"shortDescription"==e.type?t.shortDescription=e.text:"Hotel Description"==e.type&&(t.propertyDescription=e.text)}),angular.forEach(t.hotelAddressDetail.telephone,function(e){"Voice"==e.phoneTechType&&(t.hotelAddressDetail.contactNumber=e.phoneNumber)}),r.setHotelDescUpdated(e),a.$broadcast("EVENT.HOTEL_DATA_UPDATED")},function(){})}),t.$on(u.LANG_CHANGE_AFTER_API,function(e){var t=i.getMainReservation();t.roomStays.length>0?0!=n.stepsById.accommodations.rooms.length||void 0!=n.stepsById.accommodations.group&&0!=n.stepsById.accommodations.group.length||void 0!=n.stepsById.accommodations.package||void 0!=t.roomStays[0].ratePlans&&0!=t.roomStays[0].ratePlans.length||void 0!=t.roomStays[0].roomRates[0].roomTypeName?void 0!=n.stepsById.accommodations.package&&(0!=n.stepsById.accommodations.rooms.length||void 0!=n.stepsById.accommodations.group&&0!=n.stepsById.accommodations.group.length||0!=n.stepsById.accommodations.package.length||void 0!=t.roomStays[0].ratePlans&&0!=t.roomStays[0].ratePlans.length||(n.stepsById.accommodations.placeholder=a.translate.global_header_lblSelect)):n.stepsById.accommodations.placeholder=a.translate.global_header_lblSelect:void 0==n.stepsById.accommodations.package&&void 0==n.stepsById.accommodations.group&&(n.stepsById.accommodations.placeholder=a.translate.global_header_lblSelect)}),t.$on("EVENT.RECALL_HOLD_API_ON_CHANGE_CURRENCY",function(){var e,d,g=r.getHotelInfo().hotelCode,m=[],y=!1;if(a.MRB){var v=i.getMainReservationArray();angular.forEach(v,function(e){e.roomStays[0].total&&m.push(e),e.selected&&(d=e.id)}),e=m[0]}else e=i.getMainReservation();e&&(y=!!e.roomStays[0].total),y&&s.callHoldReservation(g,e,m,a.MRB,a.MRB).success(function(e){if(A.setMyCheckRefershTokenDetails(e),a.MRB){f.getBurnPoints()&&p.eventTrack("RemoveAppliedPoints",{category:"UserNavigation",label:"RemoveAppliedPoints"}),P.resetVoucherDetails(),f.setBurnPoints(void 0),angular.forEach(e.reservationResponses,function(e){e.id==d?e.selected=!0:e.selected=!1}),i.setMrbItineraryTotals(e.itineraryTotals),i.setMrbItineraryPaymentInfo(e.itineraryPaymentInfo);if(i.setMainReservationByEqualOnCurrencyChange(e.reservationResponses))a.$broadcast("EVENT.REFRESH_MANAGE_ROOM_DATA");else if(t.failedRoomsId=i.getFailedRoomsId(),t.failedRoomsId=i.getFailedRoomsId(),t.failedRoomsId.length>1)t.combinedHoldFailureFlag=!0,h.onModalOpen("","combined-hold-failure-switchRoom","combined-hold-failure-title-0",!1);else if(o.includes("accommodation")){a.$broadcast(u.MODIFY_RESERVATION);var r=b("replaceHashMRB")(a.translate.page_roomisnolongeravl_MRTBRoomSelectorMsg,t.getRoomIndex(t.failedRoomsId[0]),a.reservationArray.length);l.pop({type:"error",title:"",body:r,timeout:3e3}),t.recallAPI(!0)}else c.setObjectData("combinedHoldError",!0),o.go("accommodation")}else n.stepsById.accommodations.ratePlan=e.roomStays[0].ratePlans,i.setReservation(e),n.stepsById.total.placeholder=i.getTotalReservationAmount(),n.navToggle.totalSelected=!0}).error(function(){l.clear(),l.pop({type:"error",title:"",body:a.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}),a.bookedError=!0,a.$broadcast("EVENT.CALL_BASICAVAIL_API_ON_HOLD_ERROR")})});var U=function(){var e=new MobileDetect(window.navigator.userAgent);return"Web4_Desktop"===(e.tablet()?"Web4_Tablet":e.mobile()||e.phone()?"Web4_Mobile":"Web4_Desktop")},H=function(){var e=!1;if(c.getObjectData("disableAbondmentPopupForGroup"))return!0;c.deleteObjectData("disableAbondmentPopupForGroup");var a=Y.uxConfiguration.crmSettings.disableAbandonmentEmailForGroups,t=i.getMainReservation().posSource.requestorIds,o=i.getCodeTypes()?i.getCodeTypes():[];return t.length?angular.forEach(t,function(a){"group"===a.codeType.toLowerCase()&&(e=!0)}):o.length&&angular.forEach(o,function(a){"group"===a.toLowerCase()&&(e=!0)}),!(!e||!a||(c.setObjectData("disableAbondmentPopupForGroup",!0),0))};t.$on("EVENT.TRIGGER_EXTEND_HOLD",function(){if(!a.MRB||a.MRB&&1==i.getMainReservationArray().length){var r;r=!a.timerInContext||i.getTimer().length>0&&void 0!=i.getTimer()[0].time&&60*i.getMainReservation().extendedBookHoldDuration*60*1e3+Date.now()<i.getTimer()[0].time,i.setConfig("gmsAbandonment"),setTimeout(function(){var s=i.canModifyReservation();if(r&&1!=U()&&void 0!=i.getMainReservation().extendedBookHoldDuration&&0!=i.getMainReservation().extendedBookHoldDuration&&null!=i.getMainReservation().extendedBookHoldDuration&&1==n.navToggle.totalSelected&&!s&&void 0!=i.getMainReservation().uniqueId&&"confirmation"!=o.current.name&&1!=i.getConfig("extendBooking")&&1!=i.getConfig("enhancementInTotal")&&1!=i.getConfig("enhancementInAccommodation")&&1!=i.getConfig("GMS_POPUP_OPEN")){p.eventTrack("ExtendedHoldShown",{category:"UserNavigation",label:"mobile_tablet"}),t.extendedBookHoldDuration=i.getMainReservation().extendedBookHoldDuration,i.setConfig("extendBooking"),a.navBarDisabled=!0,void 0!=e.getGmsProfile().profile&&void 0!=e.getGmsProfile().profile.customer&&void 0!=e.getGmsProfile().profile.customer.email&&(t.extendHoldObject.email=e.getGmsProfile().profile.customer.email),a.$broadcast("EVENT.GMS_OPENED"),t.showExtendHoldModal="display-block",t.extendHoldFlag=!0;var l=d.pageYOffset;t.topFinal=a.MRB?l+150+"px":l+100+"px",t.$apply(),h.onModalOpen("","extended-hold-parent","extended-hold-title",!0,t.closeExtendBookingPopup)}1!=U()&&a.$broadcast("EVENT.SEND_GUESTINFO_TO_GMS")},1e3*d.extendHoldTimeOut)}});var V=setTimeout(function(){i.setConfig("gmsAbandonment");var n,s=r.getHotelDesc().uxConfiguration.crmSettings.enabledAbandonmentEmail,l=i.canModifyReservation();d.__GMS_ABANDONMENT_VALUES__&&(n=d.__GMS_ABANDONMENT_VALUES__.pushListId||void 0),1==U()||H()||!s||"confirmation"==o.current.name||1==t.extendHoldFlag||1==i.getConfig("gmsAbandonmentShown")||l||1==a.showSpinner||n||a.isSocialLogin||q||(a.navBarDisabled=!0,void 0!=e.getGmsProfile().profile&&void 0!=e.getGmsProfile().profile.customer&&void 0!=e.getGmsProfile().profile.customer.email&&(t.extendHoldObject.email=e.getGmsProfile().profile.customer.email),i.setConfig("gmsAbandonmentShown"),I.executeAfterCookieBanner().then(function(){t.showGmsAbandonmentModal="display-block",setTimeout(function(){h.onModalOpen("","abandonment-parent-id","abandonment-title-id",!0,t.closeGmsAbandonmentModal)});var e=d.pageYOffset;t.topFinal=a.MRB?e+150+"px":e+100+"px"}))},1e3*d.extendHoldTimeOut);t.$on("EVENT.TRIGGER_GMS",function(){clearTimeout(V),i.setConfig("gmsAbandonment");var n,s=r.getHotelDesc().uxConfiguration.crmSettings.enabledAbandonmentEmail,l=i.canModifyReservation();d.__GMS_ABANDONMENT_VALUES__&&(n=d.__GMS_ABANDONMENT_VALUES__.pushListId||void 0),V=setTimeout(function(){1==U()||H()||!s||"confirmation"==o.current.name||1==t.extendHoldFlag||1==i.getConfig("gmsAbandonmentShown")||l||1==a.showSpinner||n||a.isSocialLogin||q||(a.navBarDisabled=!0,void 0!=e.getGmsProfile().profile&&void 0!=e.getGmsProfile().profile.customer&&void 0!=e.getGmsProfile().profile.customer.email&&(t.extendHoldObject.email=e.getGmsProfile().profile.customer.email),i.setConfig("gmsAbandonmentShown"),I.executeAfterCookieBanner().then(function(){t.showGmsAbandonmentModal="display-block",a.$broadcast("EVENT.GMS_OPENED");var e=d.pageYOffset;t.topFinal=a.MRB?e+150+"px":e+100+"px",t.$apply(),setTimeout(function(){h.onModalOpen("","abandonment-parent-id","abandonment-title-id",!0,t.closeGmsAbandonmentModal)})}))},1e3*d.extendHoldTimeOut)}),t.extendHoldObject={},t.showExtendHoldModal="display-none",t.showExtendHoldConfirmationModal="display-none",t.showExtendHoldReservedModal="display-none",t.showExtendHoldExpiredModal="display-none",t.showExtendHoldResumeModal="display-none",t.showModifyRetrieveEHModal="display-none",t.showGmsAbandonmentModal="display-none",I.executeAfterCookieBanner().then(function(){O()}),t.$on(u.GDPR_SELECTED,function(){O(),E()});(function(e,a,t){void 0!==e.addEventListener?e.addEventListener(a,t,!1):e.attachEvent&&e.attachEvent("on"+a,t)})(document,"mouseout",function(s){if(!(I.isSPOverlayVisible()||void 0===a.GDPREnabled&&r.getUxConfiguration().enableGeoAndCurrencyPricingConsent)){s=s||window.event;var l=s.relatedTarget||s.toElement,c=i.canModifyReservation(),g=r.getHotelDesc().uxConfiguration.crmSettings.enabledAbandonmentEmail;t.extendHoldFlag=!1;var m;d.__GMS_ABANDONMENT_VALUES__&&(m=d.__GMS_ABANDONMENT_VALUES__.pushListId||void 0);var u;if(u=!a.timerInContext||i.getTimer().length>0&&void 0!=i.getTimer()[0].time&&60*i.getMainReservation().extendedBookHoldDuration*60*1e3+Date.now()<i.getTimer()[0].time,(!a.MRB||a.MRB&&1==i.getMainReservationArray().length)&&u&&1!=a.showSpinner&&1==U()&&(!l||"HTML"==l.nodeName)&&s.clientY<=30&&void 0!=i.getMainReservation().extendedBookHoldDuration&&0!=i.getMainReservation().extendedBookHoldDuration&&null!=i.getMainReservation().extendedBookHoldDuration&&1==n.navToggle.totalSelected&&!c&&void 0!=i.getMainReservation().uniqueId&&"confirmation"!=o.current.name&&1!=i.getConfig("extendBooking")&&1!=i.getConfig("enhancementInTotal")&&1!=i.getConfig("enhancementInAccommodation")&&1!=i.getConfig("gmsAbandonmentShown")&&1!=i.getConfig("GMS_POPUP_OPEN")){p.eventTrack("ExtendedHoldShown",{category:"UserNavigation",label:"desktop"}),t.extendedBookHoldDuration=i.getMainReservation().extendedBookHoldDuration,i.setConfig("extendBooking"),a.$broadcast("EVENT.GMS_OPENED"),t.showExtendHoldModal="display-block",void 0!=e.getGmsProfile().profile&&void 0!=e.getGmsProfile().profile.customer&&void 0!=e.getGmsProfile().profile.customer.email&&(t.extendHoldObject.email=e.getGmsProfile().profile.customer.email),a.navBarDisabled=!0,t.extendHoldFlag=!0;var y=d.pageYOffset;t.topFinal=a.MRB?y+150+"px":y+100+"px",i.setConfig("gmsAbandonmentShown"),t.$apply(),
h.onModalOpen("","extended-hold-parent","extended-hold-title",!0,t.closeExtendBookingPopup)}else if(g&&!H()&&"confirmation"!=o.current.name&&1!=t.extendHoldFlag&&1!=i.getConfig("gmsAbandonmentShown")&&1!=i.getConfig("Land_On_Confirmation")&&!c&&1!=a.showSpinner&&1==U()&&(!l||"HTML"==l.nodeName)&&s.clientY<=30&&!m&&!a.isSocialLogin&&!q){t.showGmsAbandonmentModal="display-block",a.$broadcast("EVENT.GMS_OPENED");var y=d.pageYOffset;t.topFinal=a.MRB?y+150+"px":y+100+"px",t.$apply(),D(!1),a.navBarDisabled=!0,void 0!=e.getGmsProfile().profile&&void 0!=e.getGmsProfile().profile.customer&&void 0!=e.getGmsProfile().profile.customer.email&&(t.extendHoldObject.email=e.getGmsProfile().profile.customer.email),i.setConfig("gmsAbandonmentShown"),setTimeout(function(){h.onModalOpen("","abandonment-parent-id","abandonment-title-id",!0,t.closeGmsAbandonmentModal)})}1==U()&&(!l||"HTML"==l.nodeName)&&s.clientY<=30&&a.$broadcast("EVENT.SEND_GUESTINFO_TO_GMS")}}),t.closeExtendBookingPopup=function(){a.navBarDisabled=void 0,t.showExtendHoldModal="display-none",h.onModalClose()},t.closeExtendHoldExpiredModal=function(){t.showExtendHoldExpiredModal="display-none",h.onModalClose()},t.closeExtendHoldReservedModal=function(){t.showExtendHoldReservedModal="display-none",h.onModalClose()},t.closeGmsAbandonmentModal=function(){a.navBarDisabled=void 0,t.showGmsAbandonmentModal="display-none",D(!1),h.onModalClose()};var $=new RegExp("^[_A-Za-z0-9-+]+(\\.[_A-Za-z0-9-+]+)*@[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*(\\.[A-Za-z]{2,})$");t.submitHoldRoomForm=function(){var e=$.test(t.extendHoldObject.email);if(void 0==t.extendHoldObject.email||""==t.extendHoldObject.email)t.extendHoldSubmitted=!0,t.invalidEmailSubmitted=!1,t.alertVariable=!1,R(function(){t.alertVariable=!0},50);else if(0==e)t.extendHoldSubmitted=!1,t.invalidEmailSubmitted=!0,t.alertVariable=!1,R(function(){t.alertVariable=!0},50);else{t.extendHoldSubmitted=!1,t.invalidEmailSubmitted=!1;var o=angular.copy(i.getMainReservation());o.resGuests[0].profile.consents=[],1==t.specialOffer?o.resGuests[0].profile.shareAllMarketInd=0:o.resGuests[0].profile.shareAllMarketInd=1,t.extendedHoldConsents&&o.resGuests[0].profile.consents.push({id:t.extendedHoldConsents.id,consentInd:t.specialOffer?1:0,consentText:t.extendedHoldConsents.text}),o.resGuests[0].profile.customer.email=t.extendHoldObject.email;var n=r.getHotelInfo().hotelCode;a.gmsPromoCode&&J(o),s.callExtendHold(o,n).success(function(e){if(a.gmsPromoCode&&Q(e,o),t.reservation=angular.copy(e),i.setExtendHoldReservation(t.reservation),t.showExtendHoldModal="display-none",t.showExtendHoldConfirmationModal="display-block",h.onModalOpen("","extHoldConfirmationParent","extHoldConfirmationTitle",!0,t.closeExtendHoldConfirmationPopup),g.scrollTopAnimated(0,1e3),y.debug(JSON.stringify(t.reservation)+"extendReservation"),navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i))var r="mobile_tablet";else r="desktop";console.log("device :"+r),p.eventTrack("ConfirmExtendedHoldShown",{category:"UserNavigation",label:r}),t.alertVariable=!1,R(function(){t.alertVariable=!0},50)}).error(function(){t.alertVariable=!1,R(function(){t.alertVariable=!0},50)})}var l;l=1==t.specialOffer?"1":"0",p.eventTrack("ExtendedHoldConsentCheckbox",{category:"UserNavigation",label:l})},t.closeExtendHoldConfirmationPopup=function(){t.showExtendHoldConfirmationModal="display-none",a.navBarDisabled=void 0,h.onModalClose(),t.resetBookingEngine()},t.openExtendHold=function(){a.navBarDisabled=void 0;var e="https://"+document.location.host+"/"+r.getHotelInfo().hotelCode+"?confirmid="+t.reservation.uniqueId+"&email="+t.reservation.resGuests[0].profile.customer.email;c.clearCache(),d.open(e,"_self"),t.showExtendHoldConfirmationModal="display-none",h.onModalClose()},t.closeExtendHoldResumePopup=function(){t.showExtendHoldResumeModal="display-none",h.onModalClose()},t.startNewExtend=function(){t.resetBookingEngine()},t.resumeExtendHold=function(){a.startTime=Date.now();var e=i.getLanguage();e||(e=r.getCurrentLanguages().languageCode);var l=M("email"),d=M("confirmid");a.extendHoldHotelCode=angular.copy(j),a.extendHoldConfirmationCode=angular.copy(d),a.extendHoldEmail=angular.copy(l),a.extendHoldLanguage=angular.copy(e),s.retrieveExtendHold(j,d,l,e).success(function(e){var s;if(e&&e.merchandisedPromoData&&e.merchandisedPromoData.promotionId&&(s=e.merchandisedPromoData.promotionId),i.removePromotionDataOnModifyReservation(s),1==e.isMerchandisedBooking?(i.setConfig("SHOW_MERCHANDISED_CURRENCY"),i.setCurrency(e.merchandisedCurrencyCode),i.setCurrencyDetails(k(e.merchandisedCurrencyCode)),r.setExchangedRate(e.merchandisedCurrencyCode,e.merchandisedCurrencyExchgRate),a.$broadcast(u.UPDATE_CURRENCY)):i.deleteConfig("SHOW_MERCHANDISED_CURRENCY"),_(e),a.MRB=!1,r.getHotelDesc().enableMultiRoomTypeBookings&&(a.hideRoomSelector=!0),t.showExtendHoldResumeModal="display-none",h.onModalClose(),g.scrollTopAnimated(0,1e3),t.reservationData=e,e.resGuests.length>0){var l=e.resGuests[0],d=l.profile.customer;"N/A"!=d.namePrefix?t.fullName=d.namePrefix+" "+d.givenName+" "+d.surName:t.fullName=d.givenName+" "+d.surName,t.inputs=!1,t.confirmed=!0,1==e.isModifiable?t.canModify=!0:t.canModify=!1,t.showCancPolicy=!1,t.cancellationPolicy=e.policies.cancellationPolicies[0].policyDescription,t.startDate=e.resGlobalInfo.timeSpan.start,t.endDate=e.resGlobalInfo.timeSpan.end,N(),y.debug(JSON.stringify(e)+"retrieve JSON"),c.setUserTiming("Interaction","RetrieveRes")}i.setReservationFromRetrieveExtendHold(e),t.reservationData.resGuests&&t.reservationData.resGuests.length>0&&t.reservationData.resGuests[0].profile&&t.reservationData.resGuests[0].profile.consents&&t.reservationData.resGuests[0].profile.consents.length>0&&r.setConsentsDataFromRetrieval(t.reservationData.resGuests[0].profile.consents),"total"!=o.current.name?(a.arrivedConfirmation=!1,n.navToggle.datesSelected=!0,n.navToggle.accommodationSelected=!0,n.navToggle.totalSelected=!0,a.$broadcast(u.MODIFY_RESERVATION),o.go("total")):setTimeout(function(){t.$apply(function(){a.$broadcast(u.MODIFY_RESERVATION_FROM_TOTAL),a.$broadcast(u.MODIFY_RESERVATION)})},1e3),n.stepsById.total.placeholder=i.getTotalReservationAmount(),n.navToggle.totalSelected=!0,n.stepsById.total.placeholder=i.getTotalReservationAmount(),n.navToggle.totalSelected=!0,i.setConfig("modifyRetrieveEH")}).error(function(e){return e.errors&&e.errors.length>0&&"RESV_ALREADY_CANCELLED"==e.errors[0].errorCode?(t.canceledError=!0,t.confirmationError=!1,t.retrieveErrorMessage=e.errors[0].errorMessage,!1):void(t.confirmationError=!0)})},y.debug("FooterController"),t.showWelcomeBackModal="display-none",t.confirmed=!1,t.cancelled=!1,t.inputs=!0,t.closeBtn=!0,t.onlyNumbers=/^[0-9]{1,10}$/,t.confirmationError=!1,t.showCancPolicy=!1,t.cancelledSuccess=!1,t.canModify=!1,t.welcomeBackObj={confirmationNumber:"",lastName:"",cancellationComment:""};var q=i.isUpsellEnabled()&&"services"===i.getUpsellParams().type;a.$on("EVENT.GMS_OPENED",function(){t.showWelcomeBackModal="display-none",a.propertyDetailsGSplash="display-none",a.switchRoom="display-none"});var Y=r.getHotelDesc();Y.address.telephone.phoneTechType,angular.forEach(Y.address.telephone,function(e){"Voice"==e.phoneTechType&&(t.phoneNumber=e.phoneNumber)}),t.BackGroundColorCM="#fff",t.BackGroundColorLN="#fff",t.validCM=!1,t.validLN=!1,t.welcomeBack=function(e){var a=f.getLoyaltyConfig();t.showWelcomeBackTitle=f.getIsLoyaltyUserLogIn(),t.isLoyaltyReservation=!1,i.setRefreshPreviousAmount(!0),a&&(t.programName=a.programName),a?a&&a.enableLoginRewardBookModify?f.getIsLoyaltyUserLogIn()?t.isLoyaltyCancellationAllowed=!0:t.isLoyaltyCancellationAllowed=!1:t.isLoyaltyCancellationAllowed=!0:t.isLoyaltyCancellationAllowed=!1,t.canceledError=!1,t.confirmed=!1,t.cancelled=!1,t.inputs=!0,t.confirmationError=!1,t.showCancPolicy=!1,t.cancelledSuccess=!1,t.canModify=!1,t.BackGroundColorCM="#fff",t.BackGroundColorLN="#fff",t.welcomeBackObj={confirmationNumber:"",lastName:"",cancellationComment:""},I.executeAfterCookieBanner().then(function(){e||(t.showWelcomeBackModal="display-block"),g.scrollTopAnimated(0,1e3),p.eventTrack("ClickCancel/Modify",{category:"UserNavigation",label:"Cancel/Modify the reservation"}),setTimeout(function(){h.onModalOpen("welcomeback-id","welcomeback-splash-body-id","welcomeback-title-id",!1,t.closeWelcomeBackPopup)})})};var j=r.getHotelInfo().hotelCode;if(t.submitWelcomeBackForm=function(e){a.startTime=Date.now(),t.isInsuranceReservation=!1;var n=i.getLanguage();n||(n=r.getCurrentLanguages().languageCode),t.isLoyaltyReservation=!1,t.isVoucherReservation=!1,q&&(t.welcomeBackObj.bookingSource=i.getUpsellParams().bookingSource),s.getReservation(j,t.welcomeBackObj,n).success(function(n){if(i.handleXssVulnerabilities(n),i.setReservation(n),A.setMyCheckRefershTokenDetails(n,n.isModifiable),g.scrollTopAnimated(0,1e3),t.closeBtn=!0,t.reservationData=n,n.resGuests.length>0){var s=n.resGuests[0],l=s.profile.customer;"N/A"!=l.namePrefix?t.fullName=l.namePrefix+" "+l.givenName+" "+l.surName:t.fullName=l.givenName+" "+l.surName,t.inputs=!1,t.confirmed=!0,1==n.isModifiable?t.canModify=!0:t.canModify=!1,t.showCancPolicy=!1,t.cancellationPolicy=n.policies.cancellationPolicies[0].policyDescription,t.startDate=n.resGlobalInfo.timeSpan.start,t.endDate=n.resGlobalInfo.timeSpan.end,N(),y.debug(JSON.stringify(n)+"retrieve JSON"),c.setUserTiming("Interaction","RetrieveRes");var m=i.getMainReservation();if(m&&m.resGlobalInfo&&m.resGlobalInfo.guaranteesAccepted&&m.resGlobalInfo.guaranteesAccepted.length>0&&(m.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&m.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption.length>0&&m.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&C.forEach(m.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption,function(e){e.redemptionQuantity&&(t.isLoyaltyReservation=!0),!t.programName&&e.programName&&(t.programName=e.programName)}),m.resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&m.resGlobalInfo.guaranteesAccepted[0].voucherRedemption.redemptionQuantity&&(t.isVoucherReservation=!0)),t.isLoyaltyReservation){var p=f.getLoyaltyConfig();if(p&&p.enableLoginRewardBookModify&&t.isLoyaltyCancellationAllowed){var v=f.getLoyaltyPointsObject();if(v&&v.uniqueId&&v.uniqueId.id){var P=v.uniqueId.id,S=i.getMainReservation();S.resGuests&&S.resGuests.length>0&&S.resGuests[0].uniqueId&&S.resGuests[0].uniqueId.id&&S.resGuests[0].uniqueId.id==P?t.isLoyaltyCancellationAllowed=!0:t.isLoyaltyCancellationAllowed=!1}else t.isLoyaltyCancellationAllowed=!1}}if(m&&m.insurance&&m.insurance.policyNumber&&(t.isInsuranceReservation=!0),t.canModify&&(q||!t.isLoyaltyReservation)&&!t.isVoucherReservation&&!e&&d.manageUrlParams.enhancestay&&"true"===d.manageUrlParams.enhancestay&&t.hotelDescData.uxConfiguration.enhancementsEnabled&&(q||t.hotelDescData.uxConfiguration.confirmationConfig.enablePostCheckoutEnhancement||t.hotelDescData.uxConfiguration.roomUpgradeEnabled&&t.hotelDescData.uxConfiguration.confirmationConfig.enablePostCheckoutUpgrade)){var I;t.reservationData&&t.reservationData.merchandisedPromoData&&t.reservationData.merchandisedPromoData.promotionId&&(I=t.reservationData.merchandisedPromoData.promotionId),i.removePromotionDataOnModifyReservation(I),i.getConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK")?i.deleteConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"):i.setConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),1==t.reservationData.isMerchandisedBooking?(i.setConfig("SHOW_MERCHANDISED_CURRENCY"),i.setCurrency(t.reservationData.merchandisedCurrencyCode),i.setCurrencyDetails(k(t.reservationData.merchandisedCurrencyCode)),r.setExchangedRate(t.reservationData.merchandisedCurrencyCode,t.reservationData.merchandisedCurrencyExchgRate),a.$broadcast(u.UPDATE_CURRENCY)):i.deleteConfig("SHOW_MERCHANDISED_CURRENCY"),_(t.reservationData),a.MRB=r.getHotelDesc().enableMultiRoomTypeBookings&&!i.getMainReservation().isModifiable,r.getHotelDesc().enableMultiRoomTypeBookings&&(a.hideRoomSelector=!0),i.setModifyFlowFlag(),i.setReservationFromRetrieve(t.reservationData),t.reservationData.resGuests&&t.reservationData.resGuests.length>0&&t.reservationData.resGuests[0].profile&&t.reservationData.resGuests[0].profile.consents&&t.reservationData.resGuests[0].profile.consents.length>0&&r.setConsentsDataFromRetrieval(t.reservationData.resGuests[0].profile.consents),a.totalRatePlanIconHide=!0,t.closeWelcomeBackPopup(),a.arrivedConfirmation=!0,o.go("confirmation")}else e||setTimeout(function(){h.onModalOpen("welcomeback-id","welcomeback-splash-body-id","modifyResTitle2-id",!0,t.closeWelcomeBackPopup)})}t.alertVariable=!1,R(function(){t.alertVariable=!0},50),e&&t.modifyReservation()}).error(function(o){return o.errors&&o.errors.length>0&&"RESV_ALREADY_CANCELLED"==o.errors[0].errorCode?(t.canceledError=!0,t.confirmationError=!1,t.retrieveErrorMessage=b("replaceHashMRB")(a.translate["global_ReservationAlreadyCancelled-MsgReservationAlreadyCancelled"],t.welcomeBackObj.confirmationNumber,t.welcomeBackObj.lastName),e&&t.alertVariable&&(l.clear(),l.pop({type:"error",title:"",body:o.errors[0].errorMessage})),!1):(t.confirmationError=!0,t.alertVariable=!1,void R(function(){t.alertVariable=!0,e&&t.alertVariable&&(l.clear(),l.pop({type:"error",title:"",body:a.translate.page_wecouldnotfindyourreservation_WeCouldNotFindYourReservationReenterConfirmationMsg}))},50))})},t.modifyReservation=function(){var e;t.reservationData&&t.reservationData.merchandisedPromoData&&t.reservationData.merchandisedPromoData.promotionId&&(e=t.reservationData.merchandisedPromoData.promotionId),i.removePromotionDataOnModifyReservation(e),i.getConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK")?i.deleteConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"):i.setConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),1==t.reservationData.isMerchandisedBooking?(i.setConfig("SHOW_MERCHANDISED_CURRENCY"),i.setCurrency(t.reservationData.merchandisedCurrencyCode),i.setCurrencyDetails(k(t.reservationData.merchandisedCurrencyCode)),r.setExchangedRate(t.reservationData.merchandisedCurrencyCode,t.reservationData.merchandisedCurrencyExchgRate),a.$broadcast(u.UPDATE_CURRENCY)):i.deleteConfig("SHOW_MERCHANDISED_CURRENCY"),_(t.reservationData),a.MRB=r.getHotelDesc().enableMultiRoomTypeBookings&&!i.getMainReservation().isModifiable,r.getHotelDesc().enableMultiRoomTypeBookings&&(a.hideRoomSelector=!0),i.setModifyFlowFlag(),i.setReservationFromRetrieve(t.reservationData),t.reservationData.resGuests&&t.reservationData.resGuests.length>0&&t.reservationData.resGuests[0].profile&&t.reservationData.resGuests[0].profile.consents&&t.reservationData.resGuests[0].profile.consents.length>0&&r.setConsentsDataFromRetrieval(t.reservationData.resGuests[0].profile.consents),a.totalRatePlanIconHide=!0,t.closeWelcomeBackPopup(),"total"!=o.current.name?(a.arrivedConfirmation=!1,o.go("total")):setTimeout(function(){t.$apply(function(){a.$broadcast(u.MODIFY_RESERVATION_FROM_TOTAL)})},1e3),n.stepsById.total.placeholder=i.getTotalReservationAmount(),n.navToggle.totalSelected=!0},t.confirmationNumberChange=function(){t.confirmationError=!1;var e;e=void 0==t.welcomeBackObj.confirmationNumber?0:t.welcomeBackObj.confirmationNumber.length,e>0?(t.BackGroundColorCM="#f5f5f5",t.validCM=!0):(t.BackGroundColorCM="#fff",t.validCM=!1)},t.lastNameChange=function(){var e;e=void 0==t.welcomeBackObj.lastName?0:t.welcomeBackObj.lastName.length,e>0?(t.BackGroundColorLN="#f5f5f5",t.validLN=!0):(t.BackGroundColorLN="#fff",t.validLN=!1)},t.closeWelcomeBackPopup=function(){t.showWelcomeBackModal="display-none",h.onModalClose(),t.submitCancellation=!1},t.cancelWelcomeBackPopup=function(){g.scrollTopAnimated(0,1e3),t.confirmed=!1,t.inputs=!1,t.cancelled=!0,t.closeBtn=!1,setTimeout(function(){h.onModalOpen("welcomeback-id","welcomeback-splash-body-id","modifyResTitle3-id",!0,t.closeWelcomeBackPopup)})},t.showCancellationPolicy=function(){t.showCancPolicy=!t.showCancPolicy},t.cancelReservation=function(e){a.startTime=Date.now(),t.submitCancellation=!0,e&&s.cancelReservation(j,t.welcomeBackObj).success(function(e){g.scrollTopAnimated(0,1e3),y.debug("success"),y.debug(e),t.cancelled=!1,t.cancelledSuccess=!0,i.setCancellation(),y.debug(JSON.stringify(e)+"cancel response"),t.closeBtn=!0,c.setUserTiming("Interaction","CancelRes"),setTimeout(function(){h.onModalOpen("welcomeback-id","welcomeback-splash-body-id","modifyResTitle4-id",!0,t.closeWelcomeBackPopup)}),t.isLoyaltyReservation&&p.eventTrack("RewardsBookingVsNotRewardsBooking",{category:"UserNavigation",label:"RewardsBookingVsNotRewardsBooking"})}).error(function(e){g.scrollTopAnimated(0,1e3),y.debug("error"),y.debug(e),y.debug(JSON.stringify(e)+"cancel response"),t.closeBtn=!0})},t.$watch("translate",function(){N()}),t.resetBookingEngine=function(){a.startTime=Date.now(),c.startNewReservation()},void 0!=i.getConfig("RETRIEVE_RESERVATION_POPUP")&&1==i.getConfig("RETRIEVE_RESERVATION_POPUP")){var z=!(!d.manageUrlParams.ln||!d.manageUrlParams.ts);t.welcomeBack(z),t.welcomeBackObj.confirmationNumber=i.getMainReservation().uniqueId,z&&(t.welcomeBackObj.lastName=S.getDecryptedValue(d.manageUrlParams.ts,d.manageUrlParams.ln),t.submitWelcomeBackForm(z))}if(t.showPropertyDetails=function(){a.propertyDetailsGSplash="display-block",g.scrollTopAnimated(0,1e3),h.onModalOpen("property-details-id","propertyDetails-splash-body-id","property-title-id",!1,t.hidePropertyDetails)},t.hidePropertyDetails=function(){a.navBarDisabled=!1,a.propertyDetailsGSplash="display-none",h.onModalClose()},t.extendGMS={},t.submitGMSForm=function(){var e=$.test(t.extendGMS.email);if(void 0==t.extendGMS.email||""==t.extendGMS.email)t.extendHoldSubmitted=!0,t.invalidEmailSubmitted=!1,t.alertVariable=!1,R(function(){t.alertVariable=!0},50);else if(0==e)t.extendHoldSubmitted=!1,t.invalidEmailSubmitted=!0,t.alertVariable=!1,R(function(){t.alertVariable=!0},50);else{t.$broadcast(u.SUBMIT_GMS_FORM);var o={};o.label={},o.label.action="abandonment",t.extendGMS.email&&(o.label.email=t.extendGMS.email),void 0!=t.gmsSpecialOffer&&(o.label.optin=t.gmsSpecialOffer,o.label.optinWording=t.abandonmentEmailConsent.text),s.gmsAbandonmentPost(o).then(function(e){console.log("trackEventPost : "+e)}),t.showGmsAbandonmentModal="display-none",D(!0),h.onModalClose(),a.navBarDisabled=void 0,t.alertVariable=!1,R(function(){t.alertVariable=!0},50)}},a.$on("PROMOTION_DOES_NOT_QUALIFY_RESERVATION",function(){t.reasonDetails=i.getReasonObject()||[],t.showPromotionQualify=!0,setTimeout(function(){h.onModalOpen("","deal-expiry-modal-parent","deal-expiry-modal-title",!0,t.removePromotion)},0)}),t.removePromotion=function(){t.showPromotionQualify=!1,i.removePromotionFromContext(),setTimeout(function(){h.onModalClose()},0),"total"==o.current.name&&o.go("accommodation")},L)var W=Number(L)-(new Date).getTime(),K=setTimeout(function(){Number(L)<=(new Date).getTime()&&(t.showMessageBeforeRefreshBE=!0,setTimeout(function(){h.onModalOpen("","session-expiry-modal-parent","session-expiry-modal-title",!0,t.reloadBE)},0),clearTimeout(K))},W);t.reloadBE=function(){t.showMessageBeforeRefreshBE=!1,S.removeToken(),a.startTime=Date.now(),c.startNewReservation()};var J=function(e){var t;if(a.gmsPromoCode)t=a.gmsPromoCode;else{var o=getGmsProfile();o&&o.loyalty&&o.loyalty.length>0&&o.loyalty[0].memberOfferCode&&(t=o.loyalty[0].memberOfferCode)}if(t&&e)if(e&&e.posSource&&e.posSource.requestorIds&&e.posSource.requestorIds.length>0){var r=C.findIndex(e.posSource.requestorIds,function(e){return"corporate"==e.codeType.toLowerCase()||"group"==e.codeType.toLowerCase()});-1==r&&e.posSource.requestorIds.push({codeType:"corporate",id:t})}else e&&e.posSource&&e.posSource.requestorIds&&e.posSource.requestorIds.push({codeType:"corporate",id:t})},Q=function(e,t){var o;if(a.gmsPromoCode)o=a.gmsPromoCode;else{var r=getGmsProfile();r&&r.loyalty&&r.loyalty.length>0&&r.loyalty[0].memberOfferCode&&(o=r.loyalty[0].memberOfferCode)}if(o&&e&&e&&e.posSource&&e.posSource.requestorIds&&e.posSource.requestorIds.length>0){var n=C.findIndex(e.posSource.requestorIds,function(e){return"corporate"==e.codeType.toLowerCase()&&e.id==o});-1!=n&&e.posSource.requestorIds.splice(n,1)}if(o&&t&&t&&t.posSource&&t.posSource.requestorIds&&t.posSource.requestorIds.length>0){var n=C.findIndex(t.posSource.requestorIds,function(e){return"corporate"==e.codeType.toLowerCase()&&e.id==o});-1!=n&&t.posSource.requestorIds.splice(n,1)}}}function Gdpr(){return{restrict:"E",templateUrl:"./footerbar/GDPR.html"}}function browserDefault(){return{restrict:"E",templateUrl:"./footerbar/browserDefaultBackGround.html"}}function htmlGeolocation(){return{restrict:"E",templateUrl:"./footerbar/html5Geolocation.html"}}function chinaCdn(){return{restrict:"E",templateUrl:"./footerbar/chinaCDN.html"}}function footerBar(){return{restrict:"E",templateUrl:"./footerbar/footerbar.html",controller:FooterController}}function propertyDetails(){return{restrict:"E",templateUrl:"./footerbar/propertyDetails.html",replace:"true",controller:["$scope","hotelFactory","$document","$window","$rootScope",function(e,a,t,o,r){function n(){var e=document.getElementById("propertyDetails-splash-body-id"),a=document.getElementById("property-close-icon");if(e&&a){var t=document.documentElement,o=(window.pageYOffset||t.scrollTop)-(t.clientTop||0),r=e.getBoundingClientRect().top+window.pageYOffset;o+i+50>r?(a.classList.add("stick-property-detail"),a.style.top=i+73+"px"):(a.classList.remove("stick-property-detail"),a.style.removeProperty("top"))}}!0===a.getHotelDesc().uxConfiguration.accomodationsConfig.enableCarouselAutoScroll?e.myInterval=2500:e.myInterval=0;var i=0;setTimeout(function(){var e=0,a=0;document.getElementsByClassName("Header-selectionBar")[0]&&(a=document.getElementsByClassName("Header-selectionBar")[0].clientHeight),document.getElementsByClassName("MaxWidth-logo-wrap")[0]&&(e=document.getElementsByClassName("MaxWidth-logo-wrap")[0].clientHeight),i=a+e},0),t.on("scroll",function(){o.innerWidth<800&&"display-none"!=r.propertyDetailsGSplash&&n()})}]}}function showMoreText(e){return{restrict:"E",replace:!0,scope:{text:"=",limit:"=",manualClass:"@",translate:"="},template:'<div ng-class="manualClass"> <span ng-if="text.length>limit" ng-bind-html="text | unescapeFilter | ellipsisFilter : end"></span><span ng-if="text.length<=limit" ng-bind-html="text"></span><div class="show-more-link-container" ng-if="text.length>limit"><span class="total-text-link-color underlined-text" style="cursor: pointer" role="link" ng-click="showMore()" ng-show="isShowMore">{{translate.global_showmore_AccLbl}}</span><span class="total-text-link-color underlined-text" style="cursor: pointer" role="link" ng-click="showLess()" ng-hide="isShowMore">{{translate.global_showless_AccLbl}}</span></div></div>',link:function(a,t,o){a.description=e("unescapeFilter")(a.text),a.end=a.description&&" "!=a.description[a.limit]?a.description.indexOf(" ",a.limit):a.limit,a.isShowMore=a.description&&a.description.length>a.limit,a.showMore=function(){a.isShowMore=!1,a.end=a.description.length},a.showLess=function(){a.isShowMore=!0,a.end=a.description&&" "!=a.description[a.limit]?a.description.indexOf(" ",a.limit):a.limit}}}}function GmsController(e,a,t,o,r,n,i){a.isLogin=o.checkGmsLogin(),a.crmSettings=n.getUxConfiguration().crmSettings,a.gmsProfile={},a.isLogin&&(a.gmsProfile=o.getGmsProfile()),a.emailRegex="^[_A-Za-z0-9-+]+(\\.[_A-Za-z0-9-+]+)*@[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*(\\.[A-Za-z]{2,})$",a.showGMSLoginModal="display-none",a.showGMSSignUpModal="display-none",a.showGmsPopup=function(){a.crmSettings.privateOffersDefaultPage&&0!==a.crmSettings.privateOffersDefaultPage?t.$broadcast(i.GMS_SHOW_SIGNIN_FORM):t.$broadcast(i.GMS_SHOW_SIGNUP_FORM)},t.$on(i.GMS_LOGIN_SUCCESS,function(e,t){a.isLogin=o.checkGmsLogin(),a.isLogin&&(a.gmsProfile=o.getGmsProfile()),a.updateSignInTranslation()}),t.$on(i.GMS_SIGNUP_SUCCESS,function(e,t){a.isLogin=o.checkGmsLogin(),a.isLogin&&(a.gmsProfile=o.getGmsProfile()),a.updateSignInTranslation()}),t.$watch("translate.global_privateoffersunlocked_POUnlockedLbl2",function(e,t){a.updateSignInTranslation()}),a.updateSignInTranslation=function(){try{var e="";e=a.gmsProfile.profile.customer.givenName&&a.gmsProfile.profile.customer.surName?a.gmsProfile.profile.customer.givenName+" "+a.gmsProfile.profile.customer.surName:a.gmsProfile.profile.customer.givenName&&!a.gmsProfile.profile.customer.surName?a.gmsProfile.profile.customer.givenName:!a.gmsProfile.profile.customer.givenName&&a.gmsProfile.profile.customer.surName?a.gmsProfile.profile.customer.surName:a.gmsProfile.profile.customer.email,t.translate.global_privateoffersunlocked_POUnlockedLbl2.indexOf("ï¼…")<0&&t.translate.global_privateoffersunlocked_POUnlockedLbl2.indexOf("%")<0?a.signInTranslation=t.translate.global_privateoffersunlocked_POUnlockedLbl2+" "+e:(a.signInTranslation=t.translate.global_privateoffersunlocked_POUnlockedLbl2.replace(/\%.*\%/,e),a.signInTranslation=a.signInTranslation.replace(/\ï¼….*\ï¼…/,e))}catch(e){}},a.updateSignInTranslation(),a.gmsLogoutBtn=function(){t.$broadcast("EVENT.GMS_SHOW_LOGOUT_POPUP")},a.$on("EVENT.GMS_LOGOUT_EVENT",function(e,t){a.gmsProfile={},a.isLogin=!1})}function gmsUIBlock(){return{restrict:"E",templateUrl:"./gms/gms.html",controller:GmsController}}function GmsFormsController(e,a,t,o,r,n,i,s,l,c,d,g,m,u,p,y,v){function h(){var e=i.getHotelDescUpdated().consents;angular.forEach(e,function(e){"private_offers"===e.category.toLowerCase()&&(t.privateOffersConsent=e,t.confirmCheck=t.privateOffersConsent.isPreChecked?1:0)})}function R(){t.URLLogin=t.getLoginURLParameter("login"),o.disableGmsLoginForm||void 0!=I||!t.crmSettings||"None"==t.crmSettings.enabledCRM||null==t.crmSettings.enabledCRM||""==t.crmSettings.enabledCRM||null==t.crmSettings.isDisplaySignUp||1!=t.crmSettings.isDisplaySignUp&&"true"!=t.URLLogin||void 0==t.crmSettings.tcGMSPortalName||""==t.crmSettings.tcGMSPortalName||t.isDisabledPrivateOffersForGroups()||(t.crmSettings.privateOffersDefaultPage&&0!==t.crmSettings.privateOffersDefaultPage?t.showGMSLoginPopup():t.showGMSSingUpPopup())}t.scrollToTop=function(){m.scrollTopAnimated(0,1e3)},t.alertVariable=!0;var f=g.socialUrl,C=g.loyaltySocialUrl;t.showPasswoldGuildlines=!1,t.canceledError=!1,t.canceledSingupError=!1,t.isLogin=r.checkGmsLogin(),t.crmSettings=i.getUxConfiguration().crmSettings,void 0==t.crmSettings.validateForEmailFormat?t.emailValidate=!0:t.emailValidate=t.crmSettings.validateForEmailFormat,t.emailRegex="^[_A-Za-z0-9-+]+(\\.[_A-Za-z0-9-+]+)*@[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*(\\.[A-Za-z]{2,})$",t.phoneRegex="^[+]*[0-9 (]{0,4}[0-9 ]{1,5}[)]{0,1}[-\\s\\./0-9]+([0-9]{1,})$",t.showGMSLoginModal="display-none",t.showGMSSignUpModal="display-none",t.showForgetPasswordModal="display-none",t.gmsSignupUser={},t.gmsUser={},t.showGmsTCModal="display-none",t.showPrelogoutPopup="display-none",t.socialOptionCount=0,t.socialOptionGrid=12,t.showSocialOptInPopup="display-none";var P=i.getUxConfiguration().enableGeoAndCurrencyPricingConsent;if(t.crmSettings&&"None"!=t.crmSettings.enabledCRM&&null!=t.crmSettings.enabledCRM&&""!=t.crmSettings.enabledCRM&&t.crmSettings.socialLoginOptions?(t.isSocialLoginPresent=t.crmSettings.socialLoginOptions.enabledFacebookLogin||t.crmSettings.socialLoginOptions.enabledTwitterLogin||t.crmSettings.socialLoginOptions.enabledInstagramLogin,t.enabledFacebookLogin=t.crmSettings.socialLoginOptions.enabledFacebookLogin,t.enabledTwitterLogin=t.crmSettings.socialLoginOptions.enabledTwitterLogin,t.enabledInstagramLogin=t.crmSettings.socialLoginOptions.enabledInstagramLogin,t.enabledFacebookLogin&&t.socialOptionCount++,t.enabledTwitterLogin&&t.socialOptionCount++,t.enabledInstagramLogin&&t.socialOptionCount++,t.isSocialLoginPresent&&(t.socialOptionGrid="col-xs-"+t.socialOptionGrid/t.socialOptionCount)):(t.isSocialLoginPresent=!1,t.enabledFacebookLogin=!1,t.enabledTwitterLogin=!1,t.enabledInstagramLogin=!1),o.$on(c.GMS_SHOW_SIGNUP_FORM,function(e,a){t.showGMSSingUpPopup()}),o.$on(c.GMS_SHOW_SIGNIN_FORM,function(e,a){t.showGMSLoginPopup()}),o.$on(c.GMS_HIDE_LOGIN_FORM,function(e,a){t.closeGMSLoginPopup(),t.closeGMSSingUpPopup()}),t.$on("EVENT.GMS_OPENED",function(){t.closeGMSLoginPopup(),t.closeGMSSingUpPopup(),t.showPasswoldGuildlines=!1,t.showForgetPasswordModal="display-none",t.showSocialOptInPopup="display-none"}),t.showGMSLoginPopup=function(){if(o.MRB&&s.setEnableRoomSelectorIntoCache(),e.eventTrack("loginFormDisplay",{category:"UserNavigation"}),t.gmsUser&&t.gmsUser.userName)var a=t.gmsUser.userName;t.gmsUser={},a&&(t.gmsUser.userName=a),t.clickForgetPassword=!1,t.canceledError=!1,t.canceledSingupError=!1,v.executeAfterCookieBanner().then(function(){t.showGMSLoginModal="display-block",t.showGMSSignUpModal="display-none",s.setConfig("GMS_POPUP_OPEN"),setTimeout(function(){l.onModalOpen("gms-unlock-private-id","gms-login-modal-parent-id","gms-login-modal-title-id",!0,t.closeGMSLoginPopup)})})},t.isDisabledPrivateOffersForGroups=function(){var e=!1;if(p.getObjectData("disablePrivateOffersForGroup"))return!0;p.deleteObjectData("disablePrivateOffersForGroup");var a=t.crmSettings.disablePrivateOffersForGroups,n=s.getMainReservation().posSource.requestorIds,i=s.getCodeTypes()?s.getCodeTypes():[];return n.length?angular.forEach(n,function(a){"group"===a.codeType.toLowerCase()&&(e=!0)}):i.length&&angular.forEach(i,function(a){"group"===a.toLowerCase()&&(e=!0)}),!(!e||!a||(p.setObjectData("disablePrivateOffersForGroup",!0),t.isLogin&&(r.gmsLogout(),o.$broadcast(c.GMS_LOGOUT_SUCCESS)),0))},h(),t.$on("EVENT.HOTEL_DATA_UPDATED",function(e){h()}),t.showGMSSingUpPopup=function(){o.MRB&&s.setEnableRoomSelectorIntoCache(),1!=s.getConfig("SHOW_SESSION_ERROR")&&(t.gmsSignupUser={},t.clickForgetPassword=!1,t.canceledSingupError=!1,t.canceledError=!1,v.executeAfterCookieBanner().then(function(){t.showGMSLoginModal="display-none",t.showGMSSignUpModal="display-block",s.setConfig("GMS_POPUP_OPEN"),setTimeout(function(){l.onModalOpen("gms-unlock-private-id","gms-unlock-private-popup-id","gms-unlock-private-title-id",!0,t.closeGMSSingUpPopup)},500)}))},g.guestInfo){if(!g.guestInfo.errorId){var S=g.guestInfo;s.setGmsProfile(S),o.$broadcast(c.GMS_LOGIN_SUCCESS)}}else t.crmSettings&&"SESSION_M"==t.crmSettings.enabledCRM&&!g.guestInfo&&s.getGmsProfile()&&"ALTERNATE_PAYMENT_RESPONSE"!==g.route&&"GMS_SOCIAL_LOGIN_SUCCESS"!==g.route&&"NAVBAR_SOCIAL_LOGIN_SUCCESS"!==g.route&&s.clearGmsProfile();if(void 0!=g.signInRequiredFlagManageURL){var A=g.signInRequiredFlagManageURL;s.setSignInRequiredFlag(A)}var I=s.getGmsProfile();void 0!=I&&(r.saveGmsProfile(I),o.$broadcast(c.GMS_LOGIN_SUCCESS)),t.getLoginURLParameter=function(e){var a=window.location.href,t=new RegExp("[?&]"+e+"=([^&#]*)","i"),o=t.exec(a);return o?o[1]:null},t.$on(c.GDPR_SELECTED,function(){R()}),(void 0!==o.GDPREnabled&&P||void 0===o.GDPREnabled&&!P)&&R(),t.showErrorForSocialLogin=function(){o.isGmsSocialLoginError=!1,t.showGMSLoginPopup(),t.canceledError=!0,t.retrieveErrorMessage=o.translate.global_errorsigningin_SignInErrorMsg},t.showErrorForSocialAccount=function(){o.isGmsSocialLoginError=!1,t.showGMSLoginPopup(),t.canceledError=!0,t.retrieveErrorMessage=o.translate.global_accounthasnotbeenactivated_POAcctNotActiveMsg},(""!=g.errormessage&&""!=g.gmsSocialPlatform||o.isGmsSocialLoginError)&&(g.errormessage.indexOf("An email has been sent to")>-1?t.showErrorForSocialAccount():t.showErrorForSocialLogin()),t.$on(c.GMS_SOCIAL_LOGIN_ERROR,function(e,a){t.showErrorForSocialLogin()}),t.$on(c.GMS_SOCIAL_ACCOUNT_ERROR,function(e,a){t.showErrorForSocialAccount()}),t.closeGMSLoginPopup=function(){t.canceledError=!1,t.canceledSingupError=!1,t.clickForgetPassword=!1,"display-block"==t.showGMSLoginModal&&l.onModalClose(),t.showGMSLoginModal="display-none",t.gmsUser={},t.gmsSignupUser={},s.deleteConfig("GMS_POPUP_OPEN")};var b=function(){var e=s.getMainReservation();void 0!=e.roomStays&&e.roomStays.length>0&&void 0!=e.roomStays[0].roomRates&&e.roomStays[0].roomRates.length>0&&void 0!=e.roomStays[0].roomRates[0].roomTypeCode?s.setGmsLoginState(!1):s.setGmsLoginState(!0)}
;t.submitGMSLoginForm=function(){var l;"guestsandrooms"==a.current.name?l="GuestAndRooms":"datesofstay"==a.current.name?l="DatesOfStay":"accommodation.room"==a.current.name?l="Accommodation ":"accommodation.package"==a.current.name?l="Accommodation ":"total"==a.current.name&&(l="ConfirmRes"),e.eventTrack("ClickSignInUp",{category:"UserNavigation",label:l}),console.log(a.current.name),t.clickForgetPassword=!1;var d=i.getHotelInfo().hotelCode,g=s.getLanguage();g||(g=i.getCurrentLanguages().languageCode),n.gmsSignIn(d,t.gmsUser,g).success(function(a){s.handleXssVulnerabilities(a),r.saveGmsProfile(a),s.setGmsProfile(a),t.gmsUser={},o.$broadcast(c.GMS_LOGIN_SUCCESS),t.closeGMSLoginPopup(),b(),o.isSocialLogin=!0,e.eventTrack("SuccesfulSignIn",{category:"UserNavigation",label:""}),t.alertVariable=!1,y(function(){t.alertVariable=!0},50)}).error(function(a){return e.eventTrack("UnsuccesfulSignIn",{category:"UserNavigation",label:"username"}),a.errors&&a.errors.length>0?(t.canceledError=!0,"INCORRECT_USERNAME_OR_PASSWORD"==a.errors[0].errorCode?t.retrieveErrorMessage=o.translate.global_pleaseentervalidemailandpassword_POInvalidEmailPasswordMsg:"EMAIL_VERIFICATION_REQ_AFTER_SIGNUP"==a.errors[0].errorCode?t.retrieveErrorMessage=o.translate.global_accounthasnotbeenactivated_POAcctNotActiveMsg:t.retrieveErrorMessage=o.translate.global_errorsigningin_SignInErrorMsg,!1):(t.alertVariable=!1,void y(function(){t.alertVariable=!0},50))}),t.alertVariable=!1,y(function(){t.alertVariable=!0},50)},o.$on(c.GMS_LOGOUT_SUCCESS,function(){t.confirmCheck=!1,t.isLogin=!1,setTimeout(function(){var e=document.getElementById("gms-unlock-private-id");e&&e.focus()})}),t.submitGMSSignUpForm=function(){t.gmsSignupUser.userName=t.gmsUser.userName;var l;if("guestsandrooms"==a.current.name?l="GuestAndRooms":"datesofstay"==a.current.name?l="DatesOfStay":"accommodation.room"==a.current.name?l="Accommodation ":"accommodation.package"==a.current.name?l="Accommodation ":"total"==a.current.name&&(l="ConfirmRes"),e.eventTrack("ClickSignInUp",{category:"UserNavigation",label:l}),t.crmSettings.signUpFormFields.confirmPasswordField.mandatory&&t.gmsSignupUser.confirmPassword==t.gmsSignupUser.password||!t.crmSettings.signUpFormFields.confirmPasswordField.mandatory&&(""==t.gmsSignupUser.confirmPassword||void 0==t.gmsSignupUser.confirmPassword||""!=t.gmsSignupUser.confirmPassword&&t.gmsSignupUser.confirmPassword==t.gmsSignupUser.password)){t.clickForgetPassword=!1;var d=i.getHotelInfo().hotelCode,g=s.getLanguage();g||(g=i.getCurrentLanguages().languageCode),t.gmsSignupUser.countryCodeField&&(t.gmsSignupUser.phoneNumberField=t.gmsSignupUser.countryCodeField+"_"+t.gmsSignupUser.phNumField);var m={login:{password:t.gmsSignupUser.password,userName:t.gmsSignupUser.userName},profile:{customer:{address:[{addressLine1:"",addressLine2:"",cityName:"",countryCode:"",countryName:"",postalCode:"",stateCode:"",stateName:"",type:"Home"}],email:t.gmsSignupUser.userName,givenName:t.gmsSignupUser.fnameField?t.gmsSignupUser.fnameField:"",namePrefix:"",nameSufix:"",surName:t.gmsSignupUser.lnameField?t.gmsSignupUser.lnameField:"",telephone:[{phoneNumber:t.gmsSignupUser.phoneNumberField?t.gmsSignupUser.phoneNumberField:t.gmsSignupUser.phNumField?t.gmsSignupUser.phNumField:"",phoneUseType:"Home"}],title:""},shareAllMarketInd:t.confirmCheck?"1":"0"}};t.privateOffersConsent&&t.privateOffersConsent.text&&(m.profile.optinWording=t.privateOffersConsent.text),m.profile.signupAudit={},m.profile.signupAudit.sourceCategory="Booking Engine",m.profile.signupAudit.crsHotelId=d?d.toString():d,n.gmsSignUp(d,m,g).success(function(a){a.profile.customer=m.profile.customer,t.gmsProfile=a,t.isLogin=!0,o.isSocialLogin=!0,r.saveGmsProfile(a,t.confirmCheck),e.eventTrack("SuccesfulSignUp",{category:"UserNavigation",label:""}),o.userNameForPopUp=angular.copy(t.gmsSignupUser.userName),t.gmsSignupUser={},o.$broadcast(c.GMS_SIGNUP_SUCCESS),o.$broadcast(c.GMS_LOGIN_SUCCESS),t.closeGMSSingUpPopup(),b(),t.alertVariable=!1,y(function(){t.alertVariable=!0},50)}).error(function(e){if(t.isLogin=!1,e.errors&&e.errors.length>0)return t.canceledSingupError=!0,"ERROR_INVALID_PASSWORD_FORMAT"==e.errors[0].errorCode?t.retrieveSignUpErrorMessage=o.translate.global_password6to17charatleast1number_POPasswordValidationMsg:"EMAIL_VERIFICATION_REQ_AFTER_SIGNUP"==e.errors[0].errorCode?t.retrieveSignUpErrorMessage=o.translate.global_alreadyhaveyouremailonrecord_POExistingRecordMsg:"USERNAME_ALREADY_USED"==e.errors[0].errorCode?t.retrieveSignUpErrorMessage=o.translate.global_thisemailisalreadypairedwithanotheruser_AnotherUsersEmailMsg:t.retrieveSignUpErrorMessage=e.errors[0].errorMessage,!1}),t.alertVariable=!1,y(function(){t.alertVariable=!0},50)}else t.canceledSingupError=!0,t.retrieveSignUpErrorMessage=o.translate.global_passwordsmustmatch_POSignUpPasswordLbl;t.alertVariable=!1,y(function(){t.alertVariable=!0},50)},t.closeGMSSingUpPopup=function(){t.clickForgetPassword=!1,t.canceledSingupError=!1,t.canceledError=!1,"display-block"===t.showGMSSignUpModal&&l.onModalClose(),t.showGMSSignUpModal="display-none",t.gmsUser={},t.gmsSignupUser={},s.deleteConfig("GMS_POPUP_OPEN")},t.onForgetPassword=function(){if(t.clickForgetPassword=!0,t.canceledSingupError=!1,t.canceledError=!1,t.unlockLoginForm.email.$valid&&!t.unlockLoginForm.email.$error.required){t.clickForgetPassword=!1;var e=i.getHotelInfo().hotelCode,a=s.getLanguage();a||(a=i.getCurrentLanguages().languageCode),n.gmsForgetPassword(e,t.gmsUser.userName,a).success(function(e){t.showForgetPasswordModal="display-block",setTimeout(function(){l.onModalOpen("gms-login-modal-title-id","forgot-password-parent-id","forgot-password-title-id",!1,t.closeForgetPsModal)})}).error(function(e){t.showForgetPasswordModal="display-block",setTimeout(function(){l.onModalOpen("gms-login-modal-title-id","forgot-password-parent-id","forgot-password-title-id",!1,t.closeForgetPsModal)})})}},t.closeForgetPsModal=function(){t.showForgetPasswordModal="display-none",l.onModalClose()},t.gmsSocialLogin=function(e){var a=g.location.href.split("#/"),o=a[0].split("?")[0],r="en",l=s.getLanguage();l||(l=i.getCurrentLanguages().languageCode),void 0!=l&&l.length>=2&&(r=l.substring(0,2).toLowerCase());var c=i.getHotelInfo().hotelCode,d=i.getChainCode(),m=i.getTcGMSPortalName();if(i.getCRMLoyaltyV2Enable()){d=m&&d&&m.toLowerCase()!=d.toLowerCase()?m:d;var u=C.replace("{{platform}}",e);u=u.replace("{{chainName}}",d),u+="?sourcePropertyId="+c,u+="&internal=Booking Engine",u+="&firstRedirectUrl="+o+"?loginType="+e,u+="&finalRedirectUrl="+o+"?loginType="+e,u+="&isClientSide=true",a[1]&&s.setGmsRouteCache(a[1]),u+="&language="+r,n.getLoyaltyV2SSORedirect(u).success(function(e){g.location.href=e.redirectURL})}else{var u=f.replace("{{platform}}",e);u=u.replace("{{languageCode}}",r),u=u.replace("{{portalName}}",t.crmSettings.tcGMSPortalName),u+="?sourcePropertyId="+c,u+="&internal=Booking Engine",u+="&firstRedirectUrl="+o+"?loginType="+e,u+="&finalRedirectUrl="+o+"?loginType="+e,u+="&isClientSide=true",a[1]&&s.setGmsRouteCache(a[1]),g.location.href=u}},t.showPasswordGuild=function(e){t.showPasswoldGuildlines=!0,t.scrollTopPGpopup=g.pageYOffset+"px",setTimeout(function(){l.onModalOpen("password-guidelines-id","password-guidelines-parent-id","password-guidelines-title-id",!1,t.hidePasswordGuild)})},t.hidePasswordGuild=function(){t.showPasswoldGuildlines=!1,l.onModalClose()},o.$on("EVENT.GMS_SHOW_LOGOUT_POPUP",function(e,a){var r,n=s.getMainReservation();if(o.MRB){r=s.getMainReservationArray();for(var i=0;i<r.length;i++)if(void 0!=r[i]&&void 0!=r[i].roomStays&&r[i].roomStays.length>0&&void 0!=r[i].roomStays[0].roomRates&&r[i].roomStays[0].roomRates.length>0&&void 0!=r[i].roomStays[0].roomRates[0].roomTypeCode&&void 0!=r[i].roomStays[0].ratePlans&&r[i].roomStays[0].ratePlans.length>0&&"Group"!=r[i].roomStays[0].ratePlans[0].ratePlanType){n=r[i];break}}1==s.getGmsLoginState()&&void 0!=n.roomStays&&n.roomStays.length>0&&void 0!=n.roomStays[0].roomRates&&n.roomStays[0].roomRates.length>0&&void 0!=n.roomStays[0].roomRates[0].roomTypeCode?t.showPrelogoutPopup="display-block":t.gmsLogout()}),t.gmsLogout=function(){e.eventTrack("logout",{category:"UserNavigation"}),i.getHotelInfo().hotelCode,s.canModifyReservation()||1==s.getConfig("modifyRetrieveEH")||s.deleteUniqueIdFromCache(),o.$broadcast("EVENT.GMS_LOGOUT_EVENT"),r.gmsLogout(),o.$broadcast(c.GMS_LOGOUT_SUCCESS),t.showPrelogoutPopup="display-none",o.$broadcast("EVENT.GMS_REMOVE_PRIVATEOFFERS")},t.cancelGmsLogout=function(){t.showPrelogoutPopup="display-none"},o.$on("EVENT.SHOW_SOCIAL_OPTIN_POPUP",function(){t.showSocialOptInPopup="display-block",l.onModalOpen("","socialoptin-modal-parent","socialoptin-modal-title",!0,t.closeSocialOptinPopup)}),t.closeSocialOptinPopup=function(){t.showSocialOptInPopup="display-none",l.onModalClose()},t.updateConsentStatus=function(){var e=r.getGmsProfile().profile,a={consents:[{optIn:!0,type:"EMAIL",wording:"Email_Marketing"}],email:e.customer.email,ipAddress:"",source:"Booking Engine"};n.updateEmailMarketingConsentStatus(a).then(function(e){r.updateEmailMarketingConsentStatus(!0),t.closeSocialOptinPopup()},function(e){console.log(e)})}}function gmsFormsUi(){return{restrict:"E",templateUrl:"./gms/gms.forms.directive.html",controller:GmsFormsController}}function gmsService(e,a,t,o,r,n){function i(n,i){if(R=!0,e.gmsUserLoggedIn=!0,o.setIsGmsLogin(!0),void 0!=n.profile.customer.telephone&&n.profile.customer.telephone.length>0&&-1!=n.profile.customer.telephone[0].phoneNumber.indexOf("_")&&(n.profile.customer.telephone[0].phoneNumber=n.profile.customer.telephone[0].phoneNumber.replace("_","")),v=n,v.profile.customer.specialOfferConsent=i||"1"===n.profile.shareAllMarketInd?"1":"0",P&&C&&C.privateOffersEnabled)e.$broadcast(a.RES_SELECTION_CHANGE);else if(v.loyalty){var s=t.getHotelInfo().hotelCode;r.validateCodes(s,"corporate",v.loyalty[0].memberOfferCode,R).then(function(t){h=i,e.gmsPromoCode=v.loyalty[0].memberOfferCode,e.startTime=Date.now(),e.gmsPromoCodeValidated=!0,e.$broadcast(a.RES_SELECTION_CHANGE),e.hidePublicRates=t.data.hidePublicRates,R&&t.data.hidePublicRates&&""!=e.gmsPromoCode&&e.$broadcast("EVENT.COSMO_SPECIALCODES_LOGIN_LABEL")},function(a){var t=o.getSupplementalObj(),r=o.getloyaltyReqParams();t&&void 0!=t.guestInfo&&void 0!=t.guestInfo.loyalty&&t.guestInfo.loyalty.length>0&&!0===t.guestInfo.loyalty[0].requireRestrictionCheck&&r&&void 0!=r.offerId&&void 0!=r.guestId&&(o.setValidCodeApi(!0),e.$broadcast("EVENT.RECALL_BASIC_AVAIL_COSMO"))})}o.setDisplayPromotions(!1),e.$broadcast("PROMOTIONS_DISPLAY_ON_BE"),l(v),p(v)}function s(){R=!1,e.gmsUserLoggedIn=!1,o.setIsGmsLogin(!1),v={},f=!1,h=void 0,e.gmsPromoCode="",e.startTime=Date.now(),o.clearGmsProfile(),e.$broadcast(a.RES_SELECTION_CHANGE),o.getCodeTypes()&&!(o.getCodeTypes().length<=0)||o.getPromotionInContext()||(o.setDisplayPromotions(!0),e.$broadcast("PROMOTIONS_DISPLAY_ON_BE")),e.$broadcast("EVENT.COSMO_SPECIALCODES_REMOVE_LABEL"),e.$broadcast("EVENT.SPECIALCODES_REMOVE_MANUAL_LABEL_AFTER_LOGOUT")}function l(e){f=!1,e&&e.profile.customer&&e.profile.customer.specialOfferConsent&&"1"===e.profile.customer.specialOfferConsent&&"TCGMS"===t.getUxConfiguration().crmSettings.enabledCRM&&(f=!0)}function c(){return f}function d(){return R}function g(){return v}function m(){return R?v.loyalty[0].memberOfferCode:""}function u(){e.disableGmsLoginForm=!0,e.$broadcast(a.GMS_HIDE_LOGIN_FORM)}function p(a){var o,r=n.manageUrlParams.platform?n.manageUrlParams.platform.toLowerCase():"",i=a.profile.loginActivities&&a.profile.loginActivities.length>0?a.profile.loginActivities:[];if(r&&i&&i.length>0)for(var s=0;s<i.length;s++)if(r.toLowerCase()===i[s].loginSource.toLowerCase()){o=i[s];break}!(t.getUxConfiguration().crmSettings.socialLoginOptions.enabledSocialLoginConsentPopUp&&o&&o.numberOfLogins&&o.loginSource)||"facebook"!==o.loginSource.toLowerCase()&&"twitter"!==o.loginSource.toLowerCase()||1!==o.numberOfLogins&&2!==o.numberOfLogins||"1"===a.profile.shareAllMarketInd||e.$broadcast("EVENT.SHOW_SOCIAL_OPTIN_POPUP")}function y(e){f=e}var v={},h={},R=!1;e.gmsUserLoggedIn=!1;var f=!1,C=t.getHotelDesc(),P=t.getMemberRateEnabledGlobalSetting();return e.$on(a.COSMO_LOGOUT,function(){R=!1,e.gmsUserLoggedIn=!1,o.setIsGmsLogin(!1),v={},e.gmsPromoCode="",o.clearGmsProfile(),e.$broadcast("EVENT.GMS_REMOVE_PRIVATEOFFERS")}),{saveGmsProfile:i,gmsLogout:s,checkGmsLogin:d,getGmsProfile:g,getPrivateOfferCode:m,disableGmsLoginForm:u,checkAndHideEmailMarketingConsent:l,getEmailMarketingConsentStatusGMS:c,checkAndShowSocialOptInModal:p,updateEmailMarketingConsentStatus:y}}function GuestRetrieveController(e,a,t,o,r,n,i,s){e.showRetriveInfoModal="display-none",e.alertVariable=!0,e.retreiveInfo={},e.$on(n.SHOW_RETRIEVE_GUEST_INFO_POPUP,function(a,t){e.showRetriveInfoModal="display-block",console.log("data.scrollTopRPPopup :: "+t.scrollTopRPPopup),e.scrollTopRPPopup=t.scrollTopRPPopup,setTimeout(function(){i.onModalOpen("guests-retrieve-link","guests-retrieve-modal-parent-id","guests-retrieve-modal-title-id",!1,e.closeRetriveInfoModal)})}),e.closeRetriveInfoModal=function(){e.showRetriveInfoModal="display-none",e.retriveInfoError=!1,e.retriveInfosubmitted=!1,e.retreiveInfo={},e.retreiveInfo.email="",e.retreiveInfo.code="",i.onModalClose()},e.submitRetriveGuestInfo=function(i){if(e.retriveInfosubmitted=!0,e.retriveInfoError=!1,e.retriveInfoForm.$valid){var l=o.getHotelInfo().hotelCode,c=r.getLanguage();c||(c=o.getCurrentLanguages().languageCode),e.tempRetreiveInfo={userName:e.retreiveInfo.email,password:e.retreiveInfo.code},t.gmsSignIn(l,e.tempRetreiveInfo,c).success(function(t){r.handleXssVulnerabilities(t),e.retreiveInfo={},a.$broadcast(n.TOTAL_PAGE_GUEST_INFO_RETRIEVED,t),e.closeRetriveInfoModal(),a.isSocialLogin=!0,e.alertVariable=!1,s(function(){e.alertVariable=!0},50)}).error(function(t){return e.retriveInfoError=!0,e.retrieveInfoErrorMessage=a.translate.page_nopriorreservationfound_NoPriorReservationFoundMsg,!1}),e.retriveInfosubmitted=!1}i.preventDefault(),e.alertVariable=!1,s(function(){e.alertVariable=!0},50)}}function guestRetriveForm(){return{restrict:"E",templateUrl:"./guestretrieve/guest.retrieve.directive.html",controller:GuestRetrieveController}}function GuestsAndRoomsController(e,a,t,o,r,n,i,s,l,c,d,g,m,u,p,y,v,h,R,f){function C(){t(o.closeDrawer,2e3);var e=(c.stepsById.accommodations.rooms,c.stepsById.dates);"S"!==e.placeholder[0]?o.numberOfDays=Math.abs(moment(e.endDate).diff(moment(e.startDate),"days")):r.debug("You need to select the dates of stay for your trip!")}function P(){var e=[];return K=0,angular.forEach(W,function(a){K+=parseInt(a.count),o.MRB?K>x.maxChildOccupancy&&(K=x.defaultChild):K>x.maxChildOccupancy*s.maxRoomsPerBooking&&(K=x.defaultChild);for(var t={},r=0;r<parseInt(a.count);r++)void 0!=a.age&&("<1"==a.age?t.id=0:t.id=parseInt(a.age),t.name=a.age,e.push(t))}),e}function S(){if(void 0===Y.roomStays||void 0===Y.roomStays[0].roomRates[0].roomTypeCode)return!1;var e=Y.roomStays[0].roomRates;return e.length>0&&(w=0,U=0,H=0,$=0,q=0,e.forEach(function(e){var a=m("filter")(re,{id:e.roomTypeCode});r.debug(a),a.length>0&&(V=a[0].maxOccupancy,$=a[0].maxAdultOccupancy,q=a[0].maxChildOccupancy,w+=o.MRB?a[0].maxAdultOccupancy:a[0].maxAdultOccupancy*B.maxRoomsPerBooking,U+=o.MRB?a[0].maxChildOccupancy:a[0].maxChildOccupancy*B.maxRoomsPerBooking,a[0].maxInfantOccupancy?H+=o.MRB?a[0].maxInfantOccupancy:a[0].maxInfantOccupancy*B.maxRoomsPerBooking:H=o.MRB?a[0].maxChildOccupancy:a[0].maxChildOccupancy*B.maxRoomsPerBooking)}),!0)}function A(e){if(void 0===e.roomStays||void 0===e.roomStays[0].roomRates[0].roomTypeCode)return V=0,w=0,U=0,H=0,$=0,q=0,s.guests={maxAdults:g.numToArray(x.maxAdultOccupancy+1),maxChildren:g.numToArray(x.maxChildOccupancy+1),maxInfants:g.numToArray(x.maxChildOccupancy+1),maxRooms:g.numToArray(B.maxRoomsPerBooking+1),defaultAdults:parseInt(Q),defaultChildren:s.allowChildren?K:K+ee,defaultInfants:s.allowInfants?ee:0,defaultRooms:0===ae?x.defaultRooms:ae,ageOptions:b(x.minChildAge,x.maxChildAge+1)},!1;var a=e.roomStays[0].roomRates;return a.length>0&&(w=0,U=0,H=0,$=0,q=0,a.forEach(function(e){var a=m("filter")(re,{id:e.roomTypeCode});r.debug(a),a.length>0&&(V=a[0].maxOccupancy,$=a[0].maxAdultOccupancy,q=a[0].maxChildOccupancy,w+=o.MRB?a[0].maxAdultOccupancy:a[0].maxAdultOccupancy*B.maxRoomsPerBooking,U+=o.MRB?a[0].maxChildOccupancy:a[0].maxChildOccupancy*B.maxRoomsPerBooking,a[0].maxInfantOccupancy?H+=o.MRB?a[0].maxInfantOccupancy:a[0].maxInfantOccupancy*B.maxRoomsPerBooking:H=o.MRB?a[0].maxChildOccupancy:a[0].maxChildOccupancy*B.maxRoomsPerBooking)}),!0)}function I(e){return 0===e?{name:"<1",id:e}:{name:e,id:e}}function b(e,a){for(var t=a-e,o=new Array(t),r=0;r<t;r++)o[r]=I(e),e++;return o}function D(){o.MRB&&setTimeout(function(){for(var e=0;e<d.getMainReservationArray().length;e++){var a=angular.copy(d.getMainReservationArray()[e]);A(a);var t={maxAdults:A(a)?g.numToArray(w+1):o.MRB?g.numToArray(x.maxAdultOccupancy+1):g.numToArray(x.maxAdultOccupancy*B.maxRoomsPerBooking+1),maxChildren:A(a)?g.numToArray(U+1):o.MRB?g.numToArray(x.maxChildOccupancy+1):g.numToArray(x.maxChildOccupancy*B.maxRoomsPerBooking+1),maxInfants:A(a)?g.numToArray(H+1):o.MRB?g.numToArray(x.maxChildOccupancy+1):g.numToArray(x.maxChildOccupancy*B.maxRoomsPerBooking+1),maxRooms:g.numToArray(B.maxRoomsPerBooking+1),defaultAdults:A(a)?x.defaultAdult:parseInt(Q),defaultChildren:A(a)?x.defaultChild:s.allowChildren?K:K+ee,defaultInfants:A(a)?x.defaultInfants:s.allowInfants?ee:0,defaultRooms:A(a)?O():0===ae?x.defaultRooms:ae,ageOptions:b(x.minChildAge,x.maxChildAge+1)};r.debug(JSON.stringify(s.guests)+"Guests in GAR"),s.maxAdults=A(a)?w:x.maxAdultOccupancy*B.maxRoomsPerBooking;for(var n=0;n<s.initOptionsArrays.length;n++)if(s.initOptionsArrays[n].id==a.id){s.initOptionsArrays[n].guests=angular.copy(t),s.initOptionsArrays[n].maxAdults=angular.copy(s.maxAdults),s.initOptionsArrays[n].selectedRoomMaxOccupancy=angular.copy(V);break}}},100),s.guests={maxAdults:S()?g.numToArray(w+1):o.MRB?g.numToArray(x.maxAdultOccupancy+1):g.numToArray(x.maxAdultOccupancy*B.maxRoomsPerBooking+1),maxChildren:S()?g.numToArray(U+1):o.MRB?g.numToArray(x.maxChildOccupancy+1):g.numToArray(x.maxChildOccupancy*B.maxRoomsPerBooking+1),maxInfants:S()?g.numToArray(H+1):o.MRB?g.numToArray(x.maxChildOccupancy+1):g.numToArray(x.maxChildOccupancy*B.maxRoomsPerBooking+1),maxRooms:g.numToArray(B.maxRoomsPerBooking+1),defaultAdults:E()?x.defaultAdult:parseInt(Q),defaultChildren:E()?x.defaultChild:s.allowChildren?K:K+ee,defaultInfants:E()?x.defaultInfants:s.allowInfants?ee:0,defaultRooms:S()?O():0===ae?x.defaultRooms:ae,ageOptions:b(x.minChildAge,x.maxChildAge+1)},r.debug(JSON.stringify(s.guests)+"Guests in GAR"),s.maxAdults=S()?w:x.maxAdultOccupancy*B.maxRoomsPerBooking,ne&&(s.initOptions.Adults=s.guests.defaultAdults,s.initOptions.Children=s.guests.defaultChildren,s.initOptions.Infants=s.guests.defaultInfants,s.initOptions.Rooms=s.guests.defaultRooms,s.initOptions.ChildArr=P(),r.debug(X),r.debug(s.initOptions)),r.debug(s.guests)}function T(){ne=!0,D()}function O(){var e=0,a=Y.roomStays[0].roomRates;return angular.forEach(a,function(a){e+=a.numberOfUnits}),e}function E(){var e;return e=void 0==j[0]||0===j[0].count&&0===j[1].count&&0===j[2].count,r.debug("reservationDefault"),r.debug(e),!!e&&e}function M(){var e=i.getHotelDesc(),a=e&&e.chainInfo&&e.chainInfo.length>0?e.chainInfo[0]:"",t=f.getAudienceEvaluatorCriteria();y.callAudienceEvaluator(e.hotelCode,a,t).then(function(e){f.setAudienceLists(e.data),o.$broadcast("RECALL_MERCHANDISING_API"),Y=d.getMainReservation(),S(),D()},function(e){console.log(e),Y=d.getMainReservation(),S(),D()})}function _(){var a=i.getHotelDesc(),t=a&&a.chainInfo&&a.chainInfo.length>0?a.chainInfo[0]:"",o=angular.copy(e.loyaltyProfileData);o.xAuthToken&&o.profileMemberID?y.getLoyaltyBookedResDetails(a.hotelCode,t,o.xAuthToken,o.profileMemberID).then(function(e){f.setReservationHistoryObject(e.data),M()},function(e){console.log(e),M()}):M()}function k(){var e,a=d.getMainReservation();if(o.MRB){e=d.getMainReservationArray();for(var t=0;t<e.length;t++)if(void 0!=e[t]&&void 0!=e[t].roomStays&&e[t].roomStays.length>0&&void 0!=e[t].roomStays[0].roomRates&&e[t].roomStays[0].roomRates.length>0&&void 0!=e[t].roomStays[0].roomRates[0].roomTypeCode&&void 0!=e[t].roomStays[0].ratePlans&&e[t].roomStays[0].ratePlans.length>0&&"Group"!=e[t].roomStays[0].ratePlans[0].ratePlanType){a=e[t];break}}1==h.getIsLoyaltyReservationEnabled()&&void 0!=a.roomStays&&a.roomStays.length>0&&void 0!=a.roomStays[0].roomRates&&a.roomStays[0].roomRates.length>0&&void 0!=a.roomStays[0].roomRates[0].roomTypeCode&&void 0!=a.roomStays[0].ratePlans&&a.roomStays[0].ratePlans.length>0&&"Group"!=a.roomStays[0].ratePlans[0].ratePlanType&&(s.continueDeleteRatePlan(),s.continueDeleteRoom(),s.continueDeletePackage(),o.MRB&&(d.revertAllAccommodationsMrb(),c.stepsById.accommodations.placeholderMRB=d.getBookedRoomCount())),Y=d.getMainReservation(),S(),D()}o.recallAPIFromHTML5Geolocation=!1,setTimeout(function(){var e=document.getElementById("guestsAndRoomsHeader");e&&(e.focus(),a.scrollTopAnimated(0,500))}),d.hideMultiRoomButton()?s.hideAddRoomButton=!0:s.hideAddRoomButton=!1,o.MRB&&o.$broadcast(u.MODIFY_RESERVATION),void 0!=d.getMainReservation().id&&(o.id=angular.copy(d.getMainReservation().id)),o.reservationArray=d.getMainReservationArray(),o.switchRoom="display-none",s.$on("EVENT.GMS_OPENED",function(){s.deleteRoom="display-none",s.deleteRatePlan="display-none",s.deletePackage="display-none"}),o.displayPromo="block",o.$broadcast("EVENT.TRIGGER_GMS"),s.displayWidget=!1,0==i.getUxConfiguration().enableTravelAgencyCodes&&0==i.getUxConfiguration().enablePromotionalCodes&&0==i.getUxConfiguration().enableDiscountCode&&0==i.getUxConfiguration().enableGroupCode&&(s.displayWidget=!0),o.editPackageInclusions=!1,s.deleteRoom="display-none",s.deleteRatePlan="display-none",s.deletePackage="display-none",s.specialCodeEnabled=i.getUxConfiguration(),s.crmSettings=s.specialCodeEnabled.crmSettings;var N=!1;g.getObjectData("UPDATED_NAV_DATA_MANAGE_URL")||o.$broadcast("EVENT.UPDATE_NAVBAR_FROM_MANAGE_URL");var L=function(){delete c.stepsById.accommodations.ratePlan,c.stepsById.accommodations.rooms=[],c.stepsById.accommodations.id="accommodations",c.stepsById.accommodations.label="Accommodations",void 0==c.stepsById.accommodations.package&&void 0==c.stepsById.accommodations.group?(c.stepsById.accommodations.placeholder=o.translate.global_header_lblSelect,o.accommodations=!1):void 0==c.stepsById.accommodations.package&&(c.stepsById.accommodations.placeholder=o.translate.global_header_lblSelect,o.accommodations=!1),C(),d.revertAccommadationRooms(),d.revertServices()};s.$on(u.REMOVE_ACCOMMODATION,function(){a.scrollTopAnimated(0,1e3),s.deleteRoom="display-block",setTimeout(function(){v.onModalOpen("manage-rooms-link-id","delete-room-parent-id","delete-room-title-id",!1,s.cancelDeleteRoom)})}),s.$on(u.EXTENDHOLD_REMOVE_ROOM,function(){s.showModifyRetrieveEHModal="display-block",setTimeout(function(){v.onModalOpen("","modify-retreieve-eh-parent-guestsAndRoom-id","modify-retreieve-eh-title-guestsAndRoom-id",!1,s.cancelModifyRetrieveEH)}),d.setConfig("extendhold_remove_room")}),s.continueDeleteRoom=function(){if(n.clear(),d.getConfig("delete_room_in_roomselector")){var e=!0;d.getMainReservationArray().length>0||(e=!1);for(var a=0;a<d.getMainReservationArray().length;a++)if(void 0==d.getMainReservationArray()[a].roomStays[0].total){e=!1;break}o.$broadcast(u.REMOVE_CONFIRM_DELETE_ROOM_ROOMSELECTOR),d.deleteConfig("delete_room_in_roomselector"),e&&o.$broadcast(u.DELETE_ROOM_AFTER_LAND_TOTAL)}else o.MRB?(d.dropPromotion(),L(),o.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),o.reservationArray=d.getMainReservationArray()):(d.dropPromotion(),L(),o.$broadcast("EVENT.CONFIRM_DELETE_ROOM"));v.onModalClose(),s.deleteRoom="display-none"},s.cancelDeleteRoom=function(){v.onModalClose(),s.deleteRoom="display-none",o.MRB&&s.OpenSwitchRoom(),d.deleteConfig("delete_room_in_roomselector")};var G=function(){c.stepsById.accommodations.rooms=[],delete c.stepsById.accommodations.ratePlan,c.stepsById.accommodations.id="accommodations",c.stepsById.accommodations.label="Accommodations",void 0==c.stepsById.accommodations.package?(c.stepsById.accommodations.placeholder=o.translate.global_header_lblSelect,o.accommodations=!1):c.stepsById.accommodations.package.length>0||(c.stepsById.accommodations.placeholder=o.translate.global_header_lblSelect,o.accommodations=!1),c.stepsById.accommodations.className="Header-step--extended",c.stepsById.accommodations.rooms=[],c.stepsById.accommodations.ratePlan=[],C(),d.revertAccommadationRooms(),d.revertServices()};s.continueDeleteRatePlan=function(){d.getConfig("delete_room_in_roomselector")?(o.$broadcast(u.REMOVE_CONFIRM_DELETE_ROOM_ROOMSELECTOR),d.deleteConfig("delete_room_in_roomselector")):o.MRB?(d.getMainReservationArray().length>1&&void 0!=o.deleteRateFromRoom&&o.deleteRateFromRoom.id!=d.getMainReservation().id&&(d.changeSelectRoom(o.deleteRateFromRoom.id),o.$broadcast(u.MODIFY_RESERVATION),o.deleteRateFromRoom={}),d.dropPromotion(),G(),o.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),o.reservationArray=d.getMainReservationArray(),c.stepsById.accommodations.placeholderMRB=d.getBookedRoomCount()):(d.dropPromotion(),G(),o.$broadcast("EVENT.CONFIRM_DELETE_ROOM")),s.deleteRatePlan="display-none"},s.cancelDeleteRatePlan=function(){s.deleteRatePlan="display-none"},s.$on(u.REMOVE_RATEPLAN,function(){s.deleteRatePlan="display-block"}),s.$on(u.EXTENDHOLD_REMOVE_RATEPLAN,function(){s.showModifyRetrieveEHModal="display-block",setTimeout(function(){v.onModalOpen("","modify-retreieve-eh-parent-guestsAndRoom-id","modify-retreieve-eh-title-guestsAndRoom-id",!1,s.cancelModifyRetrieveEH)}),d.setConfig("extendhold_remove_rateplan")});var F=function(){o.accommodations=!1,c.stepsById.accommodations={id:"accommodations",label:"Accommodations",placeholder:"Select",placeholderMRB:c.stepsById.accommodations.placeholderMRB,className:"Header-step--extended",rooms:[]},n.clear(),C(),d.revertAccommadationRooms(),d.revertAccommadationRatePlan(),d.revertServices(),d.revertAccommadationRatePlan()};s.continueDeletePackage=function(){o.MRB&&d.getMainReservationArray().length>1&&void 0!=o.deletePackageFromRoom&&o.deletePackageFromRoom.id!=d.getMainReservation().id&&(d.changeSelectRoom(o.deletePackageFromRoom.id),o.$broadcast(u.MODIFY_RESERVATION),o.deletePackageFromRoom={}),d.dropPromotion(),F(),s.deletePackage="display-none",o.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),o.MRB&&(o.reservationArray=d.getMainReservationArray(),c.stepsById.accommodations.placeholderMRB=d.getBookedRoomCount())},s.cancelDeletePackage=function(){s.deletePackage="display-none"},s.$on(u.REMOVE_PACKAGE,function(){s.deletePackageWindow="18em",s.deletePackage="display-block"}),s.$on(u.EXTENDHOLD_REMOVE_PACKAGE,function(){s.showModifyRetrieveEHModal="display-block",setTimeout(function(){v.onModalOpen("","modify-retreieve-eh-parent-guestsAndRoom-id","modify-retreieve-eh-title-guestsAndRoom-id",!1,s.cancelModifyRetrieveEH)}),d.setConfig("extendhold_remove_package")}),o.startTime=Date.now(),o.guestsroomsClass="is-active",o.datesOfStayClass="is-disabled",o.accommodationClass="is-disabled",o.totalClass="is-disabled",s.retrieveConfirmationPopup="display-none",s.showModifyRetrieveEHModal="display-none",s.onlyNumbers=/^[0-9]{1,10}$/,n.clear(),s.$state=l;var B,x,w=0,U=0,H=0,V=0,$=0,q=0,Y=d.getMainReservation();r.debug(Y);var j=Y.resGlobalInfo.guestCounts,z=d.getAgeCollection(),W=m("filter")(j,{ageQualifyingCode:"8"}),K=0,J=m("filter")(j,{ageQualifyingCode:"10"}),Q=0;x=i.getOccupancyInfo(),r.debug("occupancyInfo"),r.debug(x),s.maxRoomsPerBooking=i.getHotelDesc().maxRoomsPerBooking,angular.forEach(J,function(e){Q+=parseInt(e.count),r.debug(e+"adult")}),r.debug(Q+"Adult count"),o.MRB?Q>x.maxAdultOccupancy&&(Q=x.defaultAdult):Q>x.maxAdultOccupancy*s.maxRoomsPerBooking&&(Q=x.defaultAdult);var X=[];d.getConfig("MAX_OCCUPANCY_EXCEEDED")&&(n.clear(),n.error({title:"",body:o.translate.page_guestRooms_addMoreRoomsToAccommodateYourSelectedNumberOfOccupantsMsg}),d.deleteConfig("MAX_OCCUPANCY_EXCEEDED")),X=P();var Z=m("filter")(j,{ageQualifyingCode:"7"}),ee=0;angular.forEach(Z,function(e){ee+=parseInt(e.count)}),r.debug("test"),r.debug(z);var ae=Y.resGlobalInfo.rooms;if(void 0!=Y.resGlobalInfo.rooms&&0!=Y.resGlobalInfo.rooms)ae=parseInt(Y.resGlobalInfo.rooms);else{var te=Y.roomStays[0].roomRates,oe=0;angular.forEach(te,function(e){oe+=e.numberOfUnits}),ae=oe}s.ageReservation=z.ageList,s.maxAdults=x.maxAdultsCountSupported,d.maxRoomRestrictCheck()?(B=i.getHotelInfo(),B.maxRoomsPerBooking=i.getHotelDesc().maxRoomsPerBooking):B=i.getHotelInfo(),r.debug(B);var re=i.getGuestRooms();s.familyPricingEnabled=x.familyPricingEnabled,s.isChildrenAgesAllowed=!(!x.familyPricingEnabled||!x.allowChildren),0==x.familyPricingEnabled?(r.debug(JSON.stringify(d.getMainReservation())+"reservationService.getMainReservation() in guestroom"),void 0!=d.getMainReservation().allCodes&&(void 0!=d.getMainReservation().allCodes.Group||void 0!=d.getMainReservation().allCodes.group)||void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].ratePlans&&void 0!=d.getMainReservation().roomStays[0].ratePlans[0]&&"Group"==d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType?s.allowChildren=!1:s.allowChildren=x.allowChildren):s.allowChildren=x.allowChildren,0==x.familyPricingEnabled?(r.debug(JSON.stringify(d.getMainReservation())+"reservationService.getMainReservation() in guestroom"),void 0!=d.getMainReservation().allCodes&&(void 0!=d.getMainReservation().allCodes.Group||void 0!=d.getMainReservation().allCodes.group)||void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].ratePlans&&void 0!=d.getMainReservation().roomStays[0].ratePlans[0]&&"Group"==d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType?s.allowInfants=!1:s.allowInfants=x.allowInfants):s.allowInfants=x.allowInfants,D(),function(){i.getUxConfiguration().interactiveMessagesEnabled&&0===Y.resGlobalInfo.guestCounts[0].count&&(n.clear(),n.pop({type:"info",title:"",body:s.translate.page_telluswhosstaying_WelcomeMsg,timeout:3e3}))}();var ne=!1;s.$on(u.RES_SELECTION_CHANGE,function(){Y=d.getMainReservation(),S(),D()}),s.checkReservation=E,r.debug(X),s.initOptions={ChildArr:E()?[]:z.ageList.length>0?z.ageList:X},r.debug("retrieveAgeList"+JSON.stringify(X)),r.debug("$scope.initOptions.ChildArr"+s.initOptions.ChildArr),s.numToArray=function(e){return g.numToArray(e)},s.updateChildArr=function(){var e=(d.canModifyReservation(),s.initOptions.ChildArr.length),a=s.initOptions.Children;if(e>a)for(var t=a;t<e;t++)s.initOptions.ChildArr.pop();p.eventTrack("ClickAddChildren",{category:"UserNavigation",label:s.initOptions.Children})},s.updateInfantArrMRB=function(e,a){if(n.clear(),o.MRB&&0!=e.selectedRoomMaxOccupancy&&void 0!=a&&e.selectedRoomMaxOccupancy<e.Adults+e.Children+e.Infants){e.Infants=parseInt(a);var t=m("replaceHash")(o.translate.page_roomtypemaxoccupancy_OccExceededMsg,e.selectedRoomMaxOccupancy);n.error({title:"",body:t})}},s.updateAdultArrMRB=function(e,a){if(n.clear(),o.MRB&&0!=e.selectedRoomMaxOccupancy&&void 0!=a&&e.selectedRoomMaxOccupancy<e.Adults+e.Children+e.Infants){e.Adults=parseInt(a);var t=m("replaceHash")(o.translate.page_roomtypemaxoccupancy_OccExceededMsg,e.selectedRoomMaxOccupancy);n.error({title:"",body:t})}},s.updateChildArrMRB=function(e,a){if(n.clear(),o.MRB&&0!=e.selectedRoomMaxOccupancy&&void 0!=a&&e.selectedRoomMaxOccupancy<e.Adults+e.Children+e.Infants){e.Children=parseInt(a);var t=m("replaceHash")(o.translate.page_roomtypemaxoccupancy_OccExceededMsg,e.selectedRoomMaxOccupancy);n.error({title:"",body:t})}else{for(var i=0;i<s.initOptionsArrays.length&&s.initOptionsArrays[i].id!=e.id;i++);0==s.initOptionsArrays.length&&(i=0)
;var l=angular.copy(s.initOptionsArrays[i].ChildArr.length);if(s.initOptionsArrays[i].ChildArr.length>s.initOptionsArrays[i].Children)for(var c=s.initOptionsArrays[i].Children;c<l;c++)s.initOptionsArrays[i].ChildArr.pop();0==s.initOptionsArrays[i].ChildArr.length&&(s.initOptionsArrays[i].ChildArr=[]),r.debug(JSON.stringify(s.initOptionsArrays[i]))}},s.checkButton=function(){E()?setTimeout(o.btnUpdate=!1,0):setTimeout(o.btnUpdate=!0,0)},s.checkButton(),s.$on(u.LANG_CHANGE,function(){var e=d.canModifyReservation();1==s.errInsufficientRooms&&(n.clear(),e?n.error({title:"",body:o.translate.page_occupancyisexceededforroomtypeadditionalroomsneeded_OccupancyIsExceededForRoomTypeAdditionalRoomsNeededMsg}):n.error({title:"",body:o.translate.page_guestRooms_errInsufficientRooms})),1==s.errorAge&&(n.clear(),n.error({title:"",body:o.translate.page_guestRooms_errMissingAge})),s.initOptions.Adults<s.initOptions.Rooms&&(n.clear(),n.error({title:"",body:o.translate.global_thespecifiednumberofroomsmustnotexceedspecifiednumberofadults_TheSpecifiedNumberOfRoomsMustNotExceedSpecifiedNumberOfAdults_Msg1+s.initOptions.Rooms+" "+o.translate.global_thespecifiednumberofroomsmustnotexceedspecifiednumberofadults_TheSpecifiedNumberOfRoomsMustNotExceedSpecifiedNumberOfAdults_Msg2+s.initOptions.Adults+o.translate.global_thespecifiednumberofroomsmustnotexceedspecifiednumberofadults_TheSpecifiedNumberOfRoomsMustNotExceedSpecifiedNumberOfAdults_Msg3}))}),s.$on("EVENT.CURRENCY_CHANGE",function(){"guestsandrooms"===l.current.name&&o.$broadcast("EVENT.RECALL_HOLD_API_ON_CHANGE_CURRENCY")});var ie,se,le,ce;if(s.$on("EVENT.EMPTY_CHILDREN_DROPDOWN",function(){if(s.initOptions.Children=0,s.initOptions.Infants=0,1==o.MRB)for(var e=0;e<s.initOptionsArrays.length;e++)s.initOptionsArrays[e].Children=0,s.initOptionsArrays[e].infants=0,s.initOptionsArrays[e].ChildArr=[]}),s.updateGuests=function(){d.getConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE")&&d.deleteConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE");var e=!1,a=d.canModifyReservation();if(void 0!=s.initOptionsArrays)for(var t=0;t<s.initOptionsArrays.length;t++){var r=0===s.initOptionsArrays[t].selectedRoomMaxOccupancy||void 0==s.initOptionsArrays[t].selectedRoomMaxOccupancy?x.maxOcc:s.initOptionsArrays[t].selectedRoomMaxOccupancy;total=s.initOptionsArrays[t].Adults+s.initOptionsArrays[t].Children+s.initOptionsArrays[t].Infants,le=s.initOptionsArrays[t].Rooms,total>r*le&&(e=!0)}e?(s.notGoDatesOfStay=!0,a?n.error({title:"",body:o.translate.page_occupancyisexceededforroomtypeadditionalroomsneeded_OccupancyIsExceededForRoomTypeAdditionalRoomsNeededMsg}):n.error({title:"",body:m("replaceHash")(o.translate.page_roomtypemaxoccupancy_OccExceededMsg,x.maxOcc)})):s.updateGuestsRoom()},s.updateGuestsRoom=function(){if(n.clear(),o.toggle.intlMenu=!1,1==o.MRB){var e=angular.copy(d.getMainReservationArray());r.debug(JSON.stringify(e)+"tempReservationArray");var t=!1;s.notGoDatesOfStay=!1,d.emptyMainReservationArray();for(var i=angular.copy(d.getMainReservation().id),g=angular.copy(d.getMainReservationArray()),p=0;p<s.initOptionsArrays.length;p++){void 0!=s.initOptionsArrays[p].id&&d.changeSelectRoomByGivenArray(s.initOptionsArrays[p].id,e),A(d.getMainReservation()),s.initOptions=angular.copy(s.initOptionsArrays[p]),s.initOptions.Rooms=1,void 0!=d.getMainReservationArray()[s.initOptionsArrays[p].id]&&d.changeMainReservation(s.initOptionsArrays[p].id),r.debug(JSON.stringify(d.getMainReservation())+"clearResGlobalInfo"),d.clearResGlobalInfo(),d.setInitOptionsArrays(s.initOptionsArrays),o.guestsroomsClass="is-disabled",o.datesOfStayClass="is-active",o.accommodationClass="is-disabled",o.totalClass="is-disabled",o.guestsRooms=!0;var y=0===V?x.maxOcc:V,h=d.canModifyReservation();if(!s.GuestsAndRoomsForm.$invalid){if(ie=s.initOptions,se=ie.Adults+ie.Children+ie.Infants,le=ie.Rooms,ie.Adults<ie.Rooms)return t=!0,n.clear(),n.error({title:"",body:o.translate.global_thespecifiednumberofroomsmustnotexceedspecifiednumberofadults_TheSpecifiedNumberOfRoomsMustNotExceedSpecifiedNumberOfAdults_Msg1+ie.Rooms+" "+o.translate.global_thespecifiednumberofroomsmustnotexceedspecifiednumberofadults_TheSpecifiedNumberOfRoomsMustNotExceedSpecifiedNumberOfAdults_Msg2+ie.Adults+o.translate.global_thespecifiednumberofroomsmustnotexceedspecifiednumberofadults_TheSpecifiedNumberOfRoomsMustNotExceedSpecifiedNumberOfAdults_Msg3}),h&&T(),!1;if(ie.Adults>x.maxAdultOccupancy*le)return t=!0,s.errInsufficientRooms=!0,n.clear(),h?n.error({title:"",body:o.translate.page_occupancyisexceededforroomtypeadditionalroomsneeded_OccupancyIsExceededForRoomTypeAdditionalRoomsNeededMsg}):n.error({title:"",body:o.translate.page_guestRooms_errInsufficientRooms}),!1;if(ie.Children>x.maxChildOccupancy*le)return s.errInsufficientRooms=!0,n.clear(),h?n.error({title:"",body:o.translate.page_occupancyisexceededforroomtypeadditionalroomsneeded_OccupancyIsExceededForRoomTypeAdditionalRoomsNeededMsg}):n.error({title:"",body:o.translate.page_guestRooms_errInsufficientRooms}),t=!0,!1;if(se>y*le)return s.errInsufficientRooms=!0,n.clear(),h?n.error({title:"",body:o.translate.page_occupancyisexceededforroomtypeadditionalroomsneeded_OccupancyIsExceededForRoomTypeAdditionalRoomsNeededMsg}):n.error({title:"",body:m("replaceHash")(o.translate.page_roomtypemaxoccupancy_OccExceededMsg,x.maxOcc)}),t=!0,s.notGoDatesOfStay=!0,!1;if(0!=$&&ie.Adults>$*le){if(s.errInsufficientRooms=!0,n.clear(),h){n.error({title:"",body:o.translate.page_occupancyisexceededforroomtypeadditionalroomsneeded_OccupancyIsExceededForRoomTypeAdditionalRoomsNeededMsg});break}return n.error({title:"",body:o.translate.page_guestRooms_errInsufficientRooms}),t=!0,!1}if(0!=q&&ie.Children>q*le)return s.errInsufficientRooms=!0,n.clear(),h?n.error({title:"",body:o.translate.page_occupancyisexceededforroomtypeadditionalroomsneeded_OccupancyIsExceededForRoomTypeAdditionalRoomsNeededMsg}):n.error({title:"",body:o.translate.page_guestRooms_errInsufficientRooms}),t=!0,!1;ie.ageBuckets=x.ageBuckets,ie.allowInfants=s.allowInfants,ce=void 0!=x.maxInfantsAge?x.maxInfantsAge:0;var h=d.canModifyReservation(),R=[];if(angular.forEach(s.initOptions.ChildArr,function(e){void 0!=e&&(e.name>=0||"<1"==e.name)&&("<1"==e.name?(e.name="0",R.push(e)):R.push(e)),r.debug(s.initOptions.ChildArr)}),R.length!=s.initOptions.Children&&s.isChildrenAgesAllowed)o.$broadcast("EVENT.CHANGE_TOTAL_PLACEHOLDER"),n.clear(),s.errorAge=!0,n.error({title:"",body:o.translate.page_guestRooms_errMissingAge}),t=!0;else{o.$broadcast("EVENT.CHANGE_TOTAL_PLACEHOLDER");var f,C,P;if(void 0!=d.getMainReservation().resGlobalInfo&&void 0!=d.getMainReservation().resGlobalInfo.guestCounts&&d.getMainReservation().resGlobalInfo.guestCounts.length>0){f=0,C=0,P=0;for(var S=0;S<d.getMainReservation().resGlobalInfo.guestCounts.length;S++)"10"==d.getMainReservation().resGlobalInfo.guestCounts[S].ageQualifyingCode&&(f+=d.getMainReservation().resGlobalInfo.guestCounts[S].count),"8"==d.getMainReservation().resGlobalInfo.guestCounts[S].ageQualifyingCode&&(C+=d.getMainReservation().resGlobalInfo.guestCounts[S].count),"7"==d.getMainReservation().resGlobalInfo.guestCounts[S].ageQualifyingCode&&(P+=d.getMainReservation().resGlobalInfo.guestCounts[S].count)}r.debug("initOptions"),r.debug(ie),d.setGuests(ie,ce),c.stepsById.guestsrooms.placeholder=se+" / "+le,c.navToggle.datesSelected=!0,void 0!=d.getMainReservation().resGlobalInfo&&void 0!=d.getMainReservation().resGlobalInfo.guestCounts&&void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].roomRates&&d.getMainReservation().roomStays[0].roomRates.length>0&&void 0!=d.getMainReservation().roomStays[0].roomRates[0].numberOfUnits&&d.getMainReservation().roomStays[0].roomRates[0].numberOfUnits!=d.getMainReservation().resGlobalInfo.rooms&&d.revertServices(),d.setRoomsToResInRetrieve(le);var I,b,D;if(void 0!=d.getMainReservation().resGlobalInfo&&void 0!=d.getMainReservation().resGlobalInfo.guestCounts&&d.getMainReservation().resGlobalInfo.guestCounts.length>0){I=0,b=0,D=0;for(var S=0;S<d.getMainReservation().resGlobalInfo.guestCounts.length;S++)"10"==d.getMainReservation().resGlobalInfo.guestCounts[S].ageQualifyingCode&&(I+=d.getMainReservation().resGlobalInfo.guestCounts[S].count),"8"==d.getMainReservation().resGlobalInfo.guestCounts[S].ageQualifyingCode&&(b+=d.getMainReservation().resGlobalInfo.guestCounts[S].count),"7"==d.getMainReservation().resGlobalInfo.guestCounts[S].ageQualifyingCode&&(D+=d.getMainReservation().resGlobalInfo.guestCounts[S].count)}o.currentRoomSelectorId==d.getMainReservation().id||f==I&&C==b&&P==D||d.revertServices(),d.setId(s.initOptionsArrays[p].id),r.debug(JSON.stringify(d.getMainReservation())+"reservationService.getMainReservation()"),d.setMainReservationArray(angular.copy(d.getMainReservation()))}}r.debug(JSON.stringify(d.getMainReservation())+"update")}if(s.notGoDatesOfStay=angular.copy(t),1!=t&&0==ge){if(d.deleteTotal(i),1!=o.enabelRoomSelector){for(var O=void 0,S=0;S<d.getMainReservationArray().length;S++)if(!(void 0!=d.getMainReservationArray()[S].roomStays[0].ratePlans&&d.getMainReservationArray()[S].roomStays[0].ratePlans.length>0&&void 0!=d.getMainReservationArray()[S].roomStays[0].ratePlans[0].ratePlanType&&d.getMainReservationArray()[S].roomStays[0].roomRates.length>1&&void 0!=d.getMainReservationArray()[S].roomStays[0].roomRates[0].roomTypeCode)){O=d.getMainReservationArray()[S].id;break}r.debug(JSON.stringify(d.getMainReservationArray())+"reservationService.getMainReservationArray()123123"),void 0!=O&&(d.changeSelectRoom(O),o.$broadcast(u.MODIFY_RESERVATION))}else void 0!=i&&(d.changeSelectRoom(i),o.$broadcast(u.MODIFY_RESERVATION));n.clear(),d.resChange(),l.go("datesofstay"),setTimeout(o.btnUpdate=!0,2e3)}else 1!=ge&&d.setMainReservationByEqual(g);1==ge&&(o.reservationArray=d.getMainReservationArray()),ge=!1}else{o.guestsroomsClass="is-disabled",o.datesOfStayClass="is-active",o.accommodationClass="is-disabled",o.totalClass="is-disabled",o.guestsRooms=!0;var y=0===V?x.maxOcc:V,h=d.canModifyReservation();if(!s.GuestsAndRoomsForm.$invalid){if(ie=s.initOptions,se=ie.Adults+ie.Children+ie.Infants,le=ie.Rooms,d.setRoomsToResInRetrieve(le),ie.Adults<ie.Rooms)return n.clear(),n.error({title:"",body:o.translate.global_thespecifiednumberofroomsmustnotexceedspecifiednumberofadults_TheSpecifiedNumberOfRoomsMustNotExceedSpecifiedNumberOfAdults_Msg1+ie.Rooms+" "+o.translate.global_thespecifiednumberofroomsmustnotexceedspecifiednumberofadults_TheSpecifiedNumberOfRoomsMustNotExceedSpecifiedNumberOfAdults_Msg2+ie.Adults+o.translate.global_thespecifiednumberofroomsmustnotexceedspecifiednumberofadults_TheSpecifiedNumberOfRoomsMustNotExceedSpecifiedNumberOfAdults_Msg3}),h&&T(),!1;if(ie.Adults>x.maxAdultOccupancy*le)return s.errInsufficientRooms=!0,n.clear(),h?n.error({title:"",body:o.translate.page_occupancyisexceededforroomtypeadditionalroomsneeded_OccupancyIsExceededForRoomTypeAdditionalRoomsNeededMsg}):n.error({title:"",body:o.translate.page_guestRooms_errInsufficientRooms}),!1;if(ie.Children>x.maxChildOccupancy*le)return s.errInsufficientRooms=!0,n.clear(),h?n.error({title:"",body:o.translate.page_occupancyisexceededforroomtypeadditionalroomsneeded_OccupancyIsExceededForRoomTypeAdditionalRoomsNeededMsg}):n.error({title:"",body:o.translate.page_guestRooms_errInsufficientRooms}),!1;if(se>y*le)return s.errInsufficientRooms=!0,n.clear(),h?n.error({title:"",body:o.translate.page_occupancyisexceededforroomtypeadditionalroomsneeded_OccupancyIsExceededForRoomTypeAdditionalRoomsNeededMsg}):n.error({title:"",body:o.translate.page_guestRooms_errInsufficientRooms}),!1;if(0!=$&&ie.Adults>$*le)return s.errInsufficientRooms=!0,n.clear(),h?n.error({title:"",body:o.translate.page_occupancyisexceededforroomtypeadditionalroomsneeded_OccupancyIsExceededForRoomTypeAdditionalRoomsNeededMsg}):n.error({title:"",body:o.translate.page_guestRooms_errInsufficientRooms}),!1;if(0!=q&&ie.Children>q*le)return s.errInsufficientRooms=!0,n.clear(),h?n.error({title:"",body:o.translate.page_occupancyisexceededforroomtypeadditionalroomsneeded_OccupancyIsExceededForRoomTypeAdditionalRoomsNeededMsg}):n.error({title:"",body:o.translate.page_guestRooms_errInsufficientRooms}),!1;ie.ageBuckets=x.ageBuckets,ie.allowInfants=s.allowInfants,ce=void 0!=x.maxInfantsAge?x.maxInfantsAge:0;var h=d.canModifyReservation(),R=[];if(angular.forEach(s.initOptions.ChildArr,function(e){void 0!=e&&(e.name>=0||"<1"==e.name)&&("<1"==e.name?(e.name="0",R.push(e)):R.push(e)),r.debug(s.initOptions.ChildArr)}),R.length!=s.initOptions.Children&&s.isChildrenAgesAllowed)o.$broadcast("EVENT.CHANGE_TOTAL_PLACEHOLDER"),n.clear(),s.errorAge=!0,n.error({title:"",body:o.translate.page_guestRooms_errMissingAge});else if(s.errorAge=!1,n.clear(),h)a.scrollTopAnimated(0,1e3),o.continueModifyReservation?s.continueModifyReservation():(s.retrieveConfirmationPopup="display-block",setTimeout(function(){v.onModalOpen("","gnr-retrieve-confirmation-parent-id","gnr-retrieve-confirmation-title-id",!1,s.cancelModifyReservation)}));else if(1==d.getConfig("modifyRetrieveEH"))s.showModifyRetrieveEHModal="display-block",setTimeout(function(){v.onModalOpen("","modify-retreieve-eh-parent-guestsAndRoom-id","modify-retreieve-eh-title-guestsAndRoom-id",!1,s.cancelModifyRetrieveEH)});else{o.$broadcast("EVENT.CHANGE_TOTAL_PLACEHOLDER");var f,C,P;if(void 0!=d.getMainReservation().resGlobalInfo&&void 0!=d.getMainReservation().resGlobalInfo.guestCounts&&d.getMainReservation().resGlobalInfo.guestCounts.length>0){f=0,C=0,P=0;for(var S=0;S<d.getMainReservation().resGlobalInfo.guestCounts.length;S++)"10"==d.getMainReservation().resGlobalInfo.guestCounts[S].ageQualifyingCode&&(f+=d.getMainReservation().resGlobalInfo.guestCounts[S].count),"8"==d.getMainReservation().resGlobalInfo.guestCounts[S].ageQualifyingCode&&(C+=d.getMainReservation().resGlobalInfo.guestCounts[S].count),"7"==d.getMainReservation().resGlobalInfo.guestCounts[S].ageQualifyingCode&&(P+=d.getMainReservation().resGlobalInfo.guestCounts[S].count)}r.debug("initOptions"),r.debug(ie),d.setGuests(ie,ce),c.stepsById.guestsrooms.placeholder=se+" / "+le,c.navToggle.datesSelected=!0,void 0!=d.getMainReservation().resGlobalInfo&&void 0!=d.getMainReservation().resGlobalInfo.guestCounts&&void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].roomRates&&d.getMainReservation().roomStays[0].roomRates.length>0&&void 0!=d.getMainReservation().roomStays[0].roomRates[0].numberOfUnits&&d.getMainReservation().roomStays[0].roomRates[0].numberOfUnits!=d.getMainReservation().resGlobalInfo.rooms&&d.revertServices();var I,b,D;if(void 0!=d.getMainReservation().resGlobalInfo&&void 0!=d.getMainReservation().resGlobalInfo.guestCounts&&d.getMainReservation().resGlobalInfo.guestCounts.length>0){I=0,b=0,D=0;for(var S=0;S<d.getMainReservation().resGlobalInfo.guestCounts.length;S++)"10"==d.getMainReservation().resGlobalInfo.guestCounts[S].ageQualifyingCode&&(I+=d.getMainReservation().resGlobalInfo.guestCounts[S].count),"8"==d.getMainReservation().resGlobalInfo.guestCounts[S].ageQualifyingCode&&(b+=d.getMainReservation().resGlobalInfo.guestCounts[S].count),"7"==d.getMainReservation().resGlobalInfo.guestCounts[S].ageQualifyingCode&&(D+=d.getMainReservation().resGlobalInfo.guestCounts[S].count)}f==I&&C==b&&P==D||d.revertServices(),l.go("datesofstay"),setTimeout(o.btnUpdate=!0,2e3)}}}d.buildUpdateOptions(),r.debug(JSON.stringify(d.getMainReservation())+"update")},s.cancelModifyReservation=function(){d.setRoomsToResInRetrieve(s.guests.defaultRooms),s.initOptions.Rooms=s.guests.defaultRooms,d.buildUpdateOptions(),d.setPromotionObjectInModifyReservation(void 0),s.retrieveConfirmationPopup="display-none",v.onModalClose()},s.cancelModifyRetrieveEH=function(){d.setRoomsToResInRetrieve(s.guests.defaultRooms),s.initOptions.Rooms=s.guests.defaultRooms,d.buildUpdateOptions(),d.setPromotionObjectInModifyReservation(void 0),s.showModifyRetrieveEHModal="display-none",v.onModalClose()},s.continueModifyReservationEH=function(){y.cancelExtendHold(o.extendHoldHotelCode,o.extendHoldConfirmationCode,o.extendHoldEmail).success(function(){var e=d.getPromotionObjectInModifyReservation();if(e&&(d.setPromotionInContext(e),o.$broadcast("DISABLE_RIGHT_RAIL"),o.$broadcast("EVENT.CONTINUE_MODIFY"),s.updateGuests()),d.setPromotionObjectInModifyReservation(void 0),1==d.getConfig("extendhold_remove_room"))d.deleteConfig("extendhold_remove_room"),L(),s.showModifyRetrieveEHModal="display-none",v.onModalClose(),o.$broadcast("EVENT.CONFIRM_DELETE_ROOM");else if(1==d.getConfig("extendhold_remove_rateplan"))d.deleteConfig("extendhold_remove_rateplan"),G(),o.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),s.showModifyRetrieveEHModal="display-none",v.onModalClose();else{if(1!=d.getConfig("extendhold_remove_package")){d.setContinueChangeReservation(),s.showModifyRetrieveEHModal="display-none",v.onModalClose(),d.setGuests(ie,ce),Y.resGlobalInfo.guestCounts,c.stepsById.guestsrooms.placeholder=se+" / "+le,d.revertServices();var a=d.buildUpdateOptions();return r.debug(JSON.stringify(d.getMainReservation())+"reservationService.getMainReservation()"),void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].ratePlans&&d.getMainReservation().roomStays[0].ratePlans.length>0&&"Group"!=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&(void 0!=d.getMainReservation().posSource.requestorIds[0]&&"group"!=d.getMainReservation().posSource.requestorIds[0].codeType||void 0==d.getMainReservation().posSource.requestorIds[0])&&(a.ratePlanType=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType,a.ratePlanCode=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode,a.uniqueId=d.getMainReservation().uniqueId),N=R.getIncludeMemberRate(),N&&(a.includeMemberRate=N),o.$broadcast("EVENT.CONTINUE_MODIFY"),a=d.passPromotionIdInApi(a),y.getAccommodationRooms(a).getAllRooms().success(function(e){d.validateAvailForPromotions(e),g.setUserTiming("Interaction","SelectDates");var a=!0,t=!0;if(void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].roomRates&&d.getMainReservation().roomStays[0].roomRates.length>0&&void 0!=d.getMainReservation().roomStays[0].roomRates[0].roomTypeCode&&void 0!=e.roomStays[0].roomTypes&&e.roomStays[0].roomTypes.length>0){a=!1;for(var o=0;o<e.roomStays[0].roomTypes.length;o++)e.roomStays[0].roomTypes[o].roomTypeCode==d.getMainReservation().roomStays[0].roomRates[0].roomTypeCode&&(a=!0)}if(void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].ratePlans&&d.getMainReservation().roomStays[0].ratePlans.length>0&&void 0!=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode&&"Group"!=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&void 0!=e.roomStays[0].ratePlans&&e.roomStays[0].ratePlans.length>0){t=!1;for(var o=0;o<e.roomStays[0].ratePlans.length;o++)e.roomStays[0].ratePlans[o].ratePlanCode==d.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode&&(t=!0)}void 0!=e.roomStays[0].ratePlans&&e.roomStays[0].ratePlans.length>0&&void 0==e.roomStays[0].ratePlans[0].ratePlanCode?(n.clear(),n.error({title:"",body:s.translate.page_noroomsareavailablepleaseselectnewdate_NoRoomsAreAvailablePleaseSelectNewDatesMsg})):0==a||0==t?(n.clear(),n.error({title:"",body:s.translate.page_noroomsareavailablepleaseselectnewdate_NoRoomsAreAvailablePleaseSelectNewDatesMsg})):1==a&&l.go("accommodation")}).error(function(){n.clear(),n.error({title:"",body:s.translate.page_noroomsareavailablepleaseselectnewdate_NoRoomsAreAvailablePleaseSelectNewDatesMsg})}),!1}d.deleteConfig("extendhold_remove_package"),F(),s.deletePackage="display-none",o.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),s.showModifyRetrieveEHModal="display-none",v.onModalClose()}}).error(function(){}),d.deleteUniqueId(),d.deleteConfig("modifyRetrieveEH")},s.continueModifyReservation=function(){var e=d.getPromotionObjectInModifyReservation();e&&(d.setPromotionInContext(e),o.$broadcast("DISABLE_RIGHT_RAIL"),o.$broadcast("EVENT.CONTINUE_MODIFY"),s.updateGuests()),d.setPromotionObjectInModifyReservation(void 0),d.setContinueChangeReservation(),s.retrieveConfirmationPopup="display-none",v.onModalClose(),d.setGuests(ie,ce),Y.resGlobalInfo.guestCounts,c.stepsById.guestsrooms.placeholder=se+" / "+le,d.revertServices();var a=d.buildUpdateOptions();return r.debug(JSON.stringify(d.getMainReservation())+"reservationService.getMainReservation()"),void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].ratePlans&&d.getMainReservation().roomStays[0].ratePlans.length>0&&"Group"!=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&(void 0!=d.getMainReservation().posSource.requestorIds[0]&&"group"!=d.getMainReservation().posSource.requestorIds[0].codeType||void 0==d.getMainReservation().posSource.requestorIds[0])&&(a.ratePlanType=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType,a.ratePlanCode=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode,a.uniqueId=d.getMainReservation().uniqueId),N=R.getIncludeMemberRate(),N&&(a.includeMemberRate=N),o.$broadcast("EVENT.CONTINUE_MODIFY"),a=d.passPromotionIdInApi(a),y.getAccommodationRooms(a).getAllRooms().success(function(e){d.validateAvailForPromotions(e),g.setUserTiming("Interaction","SelectDates");var a=!0,t=!0;if(void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].roomRates&&d.getMainReservation().roomStays[0].roomRates.length>0&&void 0!=d.getMainReservation().roomStays[0].roomRates[0].roomTypeCode&&void 0!=e.roomStays[0].roomTypes&&e.roomStays[0].roomTypes.length>0){a=!1;for(var o=0;o<e.roomStays[0].roomTypes.length;o++)e.roomStays[0].roomTypes[o].roomTypeCode==d.getMainReservation().roomStays[0].roomRates[0].roomTypeCode&&(a=!0)}if(void 0!=d.getMainReservation().roomStays&&d.getMainReservation().roomStays.length>0&&void 0!=d.getMainReservation().roomStays[0].ratePlans&&d.getMainReservation().roomStays[0].ratePlans.length>0&&void 0!=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode&&"Group"!=d.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&void 0!=e.roomStays[0].ratePlans&&e.roomStays[0].ratePlans.length>0){t=!1;for(var o=0;o<e.roomStays[0].ratePlans.length;o++)e.roomStays[0].ratePlans[o].ratePlanCode==d.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode&&(t=!0)}void 0!=e.roomStays[0].ratePlans&&e.roomStays[0].ratePlans.length>0&&void 0==e.roomStays[0].ratePlans[0].ratePlanCode?(n.clear(),n.error({title:"",body:s.translate.page_noroomsareavailablepleaseselectnewdate_NoRoomsAreAvailablePleaseSelectNewDatesMsg})):0==a||0==t?(n.clear(),n.error({title:"",body:s.translate.page_noroomsareavailablepleaseselectnewdate_NoRoomsAreAvailablePleaseSelectNewDatesMsg})):1==a&&l.go("accommodation")}).error(function(){n.clear(),n.error({title:"",body:s.translate.page_noroomsareavailablepleaseselectnewdate_NoRoomsAreAvailablePleaseSelectNewDatesMsg})}),!1},1==o.MRB){if(void 0==s.initOptionsArrays&&(s.initOptionsArrays=[]),void 0!=d.getGuestsAndRooms().Adults||d.getInitOptionsArrays().length>0){if(void 0==d.getGuestsAndRooms().Adults){var de=angular.copy(s.initOptions);de.Adults=s.guests.defaultAdults,de.Children=s.guests.defaultChildren,de.Infants=s.guests.defaultInfants,de.Rooms=1,r.debug(JSON.stringify(s.initOptions)+"tempInitOptions"),de.selected=!0,void 0!=d.getMainReservation().id?de.id=d.getMainReservation().id:de.id=0,d.setGuestsAndRooms(de)}}else{r.debug("$scope.initOptions"+JSON.stringify(s.initOptions));var de=angular.copy(s.initOptions);de.Adults=s.guests.defaultAdults,de.Children=s.guests.defaultChildren,de.Infants=s.guests.defaultInfants,de.Rooms=1,r.debug(JSON.stringify(s.initOptions)+"tempInitOptions"),d.setGuestsAndRooms(de),de.selected=!0,void 0!=d.getMainReservation().id?de.id=d.getMainReservation().id:de.id=0,s.initOptionsArrays.push(de),d.setInitOptionsArrays(angular.copy(s.initOptionsArrays))}o.$on(u.DELETE_ROOM_ROOMSELECTOR,function(){s.initOptionsArrays=angular.copy(d.getInitOptionsArrays())}),void 0!=d.getInitOptionsArrays()&&d.getInitOptionsArrays().length>0&&(r.debug(JSON.stringify(d.getInitOptionsArrays())+"reservationService.getInitOptionsArrays() after delete123123"),s.initOptionsArrays=angular.copy(d.getInitOptionsArrays()));var ge=!1;if(s.addRoom=function(){var a=!1,t=d.canModifyReservation();if(g.isMultiRateListView(e.innerWidth),void 0!=s.initOptionsArrays)for(var r=0;r<s.initOptionsArrays.length;r++){var i=0===s.initOptionsArrays[r].selectedRoomMaxOccupancy||void 0==s.initOptionsArrays[r].selectedRoomMaxOccupancy?x.maxOcc:s.initOptionsArrays[r].selectedRoomMaxOccupancy;totalCount=s.initOptionsArrays[r].Adults+s.initOptionsArrays[r].Children+s.initOptionsArrays[r].Infants,le=s.initOptionsArrays[r].Rooms,totalCount>i*le&&(a=!0)}a?(s.notGoDatesOfStay=!0,t?n.error({title:"",body:o.translate.page_occupancyisexceededforroomtypeadditionalroomsneeded_OccupancyIsExceededForRoomTypeAdditionalRoomsNeededMsg}):n.error({title:"",body:m("replaceHash")(o.translate.page_roomtypemaxoccupancy_OccExceededMsg,x.maxOcc)})):s.addRoomMRB()},s.addRoomMRB=function(){n.clear();var e=angular.copy(s.initOptionsArrays);p.eventTrack("AddRoom",{category:"UserNavigation",label:"multiRoom"});var a=angular.copy(d.getGuestsAndRooms());a.Adults=x.defaultAdult,void 0!=a.ChildArr&&(a.ChildArr=[]),d.getConfig("GROUP_FPDISABLED")?(a.Children=0,a.Infants=0):(a.Children=angular.copy(x.defaultChild),a.Infants=angular.copy(x.defaultInfants));for(var t=0;t<s.initOptionsArrays.length;t++)s.initOptionsArrays[t].selected=!1,void 0==s.initOptionsArrays[t].id&&(s.initOptionsArrays[t].id=t);1==o.enabelRoomSelector&&(void 0!=a.Children&&(0==x.familyPricingEnabled&&1!=d.getConfig("GROUP_FPDISABLED")?a.Children=angular.copy(x.defaultChild):a.Children=0),void 0!=a.Infants&&(0==x.familyPricingEnabled&&1!=d.getConfig("GROUP_FPDISABLED")?a.Infants=angular.copy(x.defaultInfants):a.Infants=0)),a.selected=!0,a.id=s.initOptionsArrays[s.initOptionsArrays.length-1].id+1,V=0,w=0,U=0,H=0,$=0,q=0,s.guests={maxAdults:g.numToArray(x.maxAdultOccupancy+1),maxChildren:g.numToArray(x.maxChildOccupancy+1),maxInfants:g.numToArray(x.maxChildOccupancy+1),maxRooms:g.numToArray(B.maxRoomsPerBooking+1),defaultAdults:parseInt(Q),defaultChildren:s.allowChildren?K:K+ee,defaultInfants:s.allowInfants?ee:0,defaultRooms:0===ae?x.defaultRooms:ae,ageOptions:b(x.minChildAge,x.maxChildAge+1)},s.maxAdults=x.maxAdultOccupancy*B.maxRoomsPerBooking,a.maxAdults=angular.copy(s.maxAdults),a.guests=angular.copy(s.guests),s.initOptionsArrays.push(a),o.initArrays=s.initOptionsArrays,1==o.enabelRoomSelector&&(ge=!0,s.updateGuests(),1!=s.notGoDatesOfStay?(d.changeSelectRoom(a.id),o.$broadcast(u.MODIFY_RESERVATION),Y=d.getMainReservation(),o.id=angular.copy(a.id)):(s.initOptionsArrays=e,o.initArrays=s.initOptionsArrays))},s.deleteRoomMRB=function(e,a){var t=0===V?x.maxOcc:V;guestTotalCount=s.initOptionsArrays[a].Adults+s.initOptionsArrays[a].Children+s.initOptionsArrays[a].Infants,le=s.initOptionsArrays[a].Rooms,maxGuestOccupancyPerRoom=s.initOptionsArrays[a].selectedRoomMaxOccupancy,(guestTotalCount>t*le||guestTotalCount>=maxGuestOccupancyPerRoom)&&(s.notGoDatesOfStay=!1,notGoDatesOfStay=!1,n.clear()),a==s.initOptionsArrays.length-1&&setTimeout(function(){var e=document.getElementById("guests-and-rooms-add-room-btn");e&&e.focus()});var r=!0;d.getMainReservationArray().length>0||(r=!1);for(var i=0;i<d.getMainReservationArray().length;i++)if(void 0==d.getMainReservationArray()[i].roomStays[0].total){r=!1;break}for(var l,g=0;g<s.initOptionsArrays.length;g++)if(s.initOptionsArrays[g].id==e){l=g,l++;break}o.gmsId=l,p.eventTrack("RemoveRoom",{category:"UserNavigation",label:e}),o.gmsId=void 0,d.setConfig("CLICK_STREAM_DELETE_ROOM");for(var g=0;g<s.initOptionsArrays.length;g++)if(s.initOptionsArrays[g].id==e){s.initOptionsArrays.splice(g,1);break}d.getMainReservationArray().length>0&&(d.deleteMainReservationArrayById(e),e==d.getMainReservation().id&&s.changeSelectRoom(d.getMainReservationArray()[0].id),o.reservationArray=d.getMainReservationArray(),d.deleteInitOptionsArrays()),o.initArrays=s.initOptionsArrays,c.stepsById.accommodations.placeholderMRB=d.getBookedRoomCount(),r&&o.$broadcast(u.DELETE_ROOM_AFTER_LAND_TOTAL)},s.changeSelectedRoom=function(e){for(var a=0;a<s.initOptionsArrays.length;a++)s.initOptionsArrays[a]==e?s.initOptionsArrays[a].selected=!0:s.initOptionsArrays[a].selected=!1},1==d.getConfig("MULTIROOM_MANAGER")){if(1==d.checkInitOptionsArrayCache())s.initOptionsArrays=angular.copy(d.getInitOptionsArrays());else for(var me=1;me<o.ManagerURLRes.length;me++){var ue=angular.copy(o.ManagerURLRes[me].resGlobalInfo.guestCounts),pe=angular.copy(d.getGuestsAndRooms());pe.selected=!1,void 0!=o.ManagerURLRes[me].id?pe.id=o.ManagerURLRes[me].id:pe.id=s.initOptionsArrays[s.initOptionsArrays.length-1].id+1;var ye=m("filter")(ue,{ageQualifyingCode:"10"}),ve=0;angular.forEach(ye,function(e){ve+=parseInt(e.count)});var he,Re=m("filter")(ue,{ageQualifyingCode:"8"}),fe=m("filter")(ue,{ageQualifyingCode:"7"}),Ce=0;angular.forEach(fe,function(e){Ce+=parseInt(e.count)}),pe.ChildArr=function(){var e=[];return he=0,angular.forEach(Re,function(a){he+=parseInt(a.count);for(var t={},o=0;o<parseInt(a.count);o++)void 0!=a.age&&("<1"==a.age?t.id=0:t.id=parseInt(a.age),t.name=a.age,e.push(t))}),e}(),pe.Adults=E()?x.defaultAdult:parseInt(ve),pe.Children=E()?x.defaultChild:s.allowChildren?he:he+Ce,pe.Infants=E()?occuproomResancyInfo.defaultInfants:s.allowInfants?Ce:0,s.initOptionsArrays.push(pe),d.setInitOptionsArrays(angular.copy(s.initOptionsArrays))}d.deleteConfig("MULTIROOM_MANAGER")}}if(o.enabelRoomSelector)for(var me=0;me<d.getMainReservationArray().length;me++)if(void 0!=d.getMainReservationArray()[me].resGlobalInfo.timeSpan.start){o.roominContext=!0;break}if(s.$on(u.ADD_ROOMSELECTOR,function(e){s.addRoom()}),d.getConfig("CHANGE_OCCUPANTS")){for(var me=0;me<s.initOptionsArrays.length;me++)s.initOptionsArrays[me].Adults=angular.copy(x.defaultAdult),void 0!=s.initOptionsArrays[me].ChildArr&&(s.initOptionsArrays[me].ChildArr=[]),0!=i.getOccupancyInfo().familyPricingEnabled&&(void 0!=s.initOptionsArrays[me].Children&&(s.initOptionsArrays[me].Children=angular.copy(x.defaultChild)),void 0!=s.initOptionsArrays[me].Infants&&(s.initOptionsArrays[me].Infants=angular.copy(x.defaultInfants)));d.deleteConfig("CHANGE_OCCUPANTS")}d.getConfig("ADD_ROOMSELECTOR")&&(setTimeout(function(){s.addRoom()},0),d.deleteConfig("ADD_ROOMSELECTOR")),o.initArrays=s.initOptionsArrays,s.gmsAdultEvent=function(e,a){if(void 0!=a){for(var t,r=0;r<s.initOptionsArrays.length;r++)if(s.initOptionsArrays[r].id==a.id){t=r,t++;break}o.gmsId=t}p.eventTrack("ClickAddAdults",{category:"UserNavigation",label:e}),o.gmsId=void 0},s.gmsChildrenEvent=function(e,a){if(void 0!=a){for(var t,r=0;r<s.initOptionsArrays.length;r++)if(s.initOptionsArrays[r].id==a.id){t=r,t++;break}o.gmsId=t}p.eventTrack("ClickAddChildren",{category:"UserNavigation",label:e}),o.gmsId=void 0},s.gmsInfantEvent=function(e,a){if(void 0!=a){for(var t,r=0;r<s.initOptionsArrays.length;r++)if(s.initOptionsArrays[r].id==a.id){t=r,t++;break}o.gmsId=t}p.eventTrack("ClickAddInfants",{category:"UserNavigation",label:e}),o.gmsId=void 0},s.gmsRoomEvent=function(e){p.eventTrack("ClickAddRooms",{category:"UserNavigation",label:e})},s.gmsChildAgeEvent=function(e,a){if(void 0!=a){for(var t,r=0;r<s.initOptionsArrays.length;r++)if(s.initOptionsArrays[r].id==a.id){t=r,t++;break}o.gmsId=t}for(var n,r=0;r<e.length;r++)void 0==n&&void 0!=e[r]?n=e[r].id:void 0!=e[r]&&(n=n+","+e[r].id);p.eventTrack("ClickAddChildrenAge",{category:"UserNavigation",label:n}),o.gmsId=void 0},o.MRB?setTimeout(function(){
for(var e=0;e<s.initOptionsArrays.length;e++)void 0!=s.initOptionsArrays[e].Adults&&s.gmsAdultEvent(s.initOptionsArrays[e].Adults,s.initOptionsArrays[e]),void 0!=s.initOptionsArrays[e].Children&&0!=s.initOptionsArrays[e].Children&&s.gmsChildrenEvent(s.initOptionsArrays[e].Children,s.initOptionsArrays[e]),void 0!=s.initOptionsArrays[e].Infants&&0!=s.initOptionsArrays[e].Infants&&s.gmsInfantEvent(s.initOptionsArrays[e].Infants,s.initOptionsArrays[e]),void 0!=s.initOptionsArrays[e].ChildArr&&s.initOptionsArrays[e].ChildArr.length>0&&s.gmsChildAgeEvent(s.initOptionsArrays[e].ChildArr,s.initOptionsArrays[e])},0):setTimeout(function(){void 0!=s.initOptions.Adults&&s.gmsAdultEvent(s.initOptions.Adults),void 0!=s.initOptions.Children&&0!=s.initOptions.Children&&s.gmsChildrenEvent(s.initOptions.Children),void 0!=s.initOptions.Infants&&0!=s.initOptions.Infants&&s.gmsInfantEvent(s.initOptions.Infants),void 0!=s.initOptions.ChildArr&&s.initOptions.ChildArr.length>0&&s.gmsChildAgeEvent(s.initOptions.ChildArr),s.gmsRoomEvent(s.initOptions.Rooms)},0),g.setUserTiming("PageLoad","GuestAndRooms"),s.$on("EVENT.GMS_REMOVE_PRIVATEOFFERS",function(){var e,a=d.getMainReservation();if(o.MRB){e=d.getMainReservationArray();for(var t=0;t<e.length;t++)if(void 0!=e[t]&&void 0!=e[t].roomStays&&e[t].roomStays.length>0&&void 0!=e[t].roomStays[0].roomRates&&e[t].roomStays[0].roomRates.length>0&&void 0!=e[t].roomStays[0].roomRates[0].roomTypeCode&&void 0!=e[t].roomStays[0].ratePlans&&e[t].roomStays[0].ratePlans.length>0&&"Group"!=e[t].roomStays[0].ratePlans[0].ratePlanType){a=e[t];break}}1==d.getGmsLoginState()&&void 0!=a.roomStays&&a.roomStays.length>0&&void 0!=a.roomStays[0].roomRates&&a.roomStays[0].roomRates.length>0&&void 0!=a.roomStays[0].roomRates[0].roomTypeCode&&void 0!=a.roomStays[0].ratePlans&&a.roomStays[0].ratePlans.length>0&&"Group"!=a.roomStays[0].ratePlans[0].ratePlanType&&(s.continueDeleteRatePlan(),s.continueDeleteRoom(),s.continueDeletePackage(),o.MRB&&(d.revertAllAccommodationsMrb(),c.stepsById.accommodations.placeholderMRB=d.getBookedRoomCount()))}),s.$on("LOYALTY_USER_LOGIN_SUCCESS",function(){f.isAudienceEvaluatorEnabled()?_():(Y=d.getMainReservation(),S(),D())}),s.$on("LOYALTY_USER_LOGOUT_SUCCESS",function(){if(f.isAudienceEvaluatorEnabled()){f.resetAudienceLists(),f.resetReservationHistoryObject();var e=f.getAudienceEvaluatorCriteria(),a=i.getHotelDesc(),t=a&&a.chainInfo&&a.chainInfo.length?a.chainInfo[0]:"";y.callAudienceEvaluator(a.hotelCode,t,e).then(function(e){f.setAudienceLists(e.data),o.$broadcast("RECALL_MERCHANDISING_API"),k()},function(e){console.log(e),o.$broadcast("RECALL_MERCHANDISING_API"),k()})}else k()})}function adultsFilter(e,a,t){return function(o){return o>1?e.translate.page_guestRooms_lblAdults.match(/#/g)?a("replaceHash")(e.translate.page_guestRooms_lblAdults,o):o+" "+e.translate.page_guestRooms_lblAdults:0==o&&"JA_JP"==t.getLanguage()?e.translate.page_guestRooms_lblAdults.match(/#/g)?a("replaceHash")(e.translate.page_guestRooms_lblAdults,o):o+" "+e.translate.page_guestRooms_lblAdults:e.translate.global_adult_AdultLbl.match(/1/g)?e.translate.global_adult_AdultLbl:o+" "+e.translate.global_adult_AdultLbl}}function childrenFilter(e,a,t){return function(o){return 0==o&&"FR_FR"==t.getLanguage()?o+" "+e.translate.page_guestRooms_lblChild:1!=o?e.translate.page_guestRooms_lblChildren.match(/#/g)?a("replaceHash")(e.translate.page_guestRooms_lblChildren,o):o+" "+e.translate.page_guestRooms_lblChildren:e.translate.page_guestRooms_lblChild.match(/1/g)?e.translate.page_guestRooms_lblChild:o+" "+e.translate.page_guestRooms_lblChild}}function infantsFilter(e,a,t){return function(t){return 1!=t?e.translate.page_guestRooms_lblInfants.match(/#/g)?a("replaceHash")(e.translate.page_guestRooms_lblInfants,t):t+" "+e.translate.page_guestRooms_lblInfants:e.translate.global_Infant_InfantLbl.match(/1/g)?e.translate.global_Infant_InfantLbl:t+" "+e.translate.global_Infant_InfantLbl}}function roomsFilter(e,a,t){return function(t){return t>1?e.translate.page_guestRooms_lblRooms.match(/#/g)?a("replaceHash")(e.translate.page_guestRooms_lblRooms,t):t+" "+e.translate.page_guestRooms_lblRooms:e.translate.global_room_RoomLowerCaseLbl.match(/1/g)?e.translate.global_room_RoomLowerCaseLbl:t+" "+e.translate.global_room_RoomLbl}}function ageFilter(e){return function(a){return a+" "+e.translate.page_guestRooms_lblYearsOld}}function insuranceComponent(e,a,t,o,r,n){return{restrict:"E",scope:{reservationPolicies:"=",translationLabels:"=",isModifyReservation:"=",selectedCountry:"=",selectedState:"=",creditCardFieldRequiredIndicator:"=",showCreditCardFields:"=",insuranceObj:"="},templateUrl:"./insurance/insurance-component.template.html",link:function(i){function s(){i.insuranceObj.selectedInsurance={},i.insuranceObj.hasInsuranceOffers=!1;var a=r.getReservation(),t=r.getInsuranceSuccessAndReservationFails();t&&null!=t.policyConfirmationNumber&&void 0!=t.policyConfirmationNumber&&t.isReservationFailed&&(i.insuranceObj.isInsuranceSuccessReservationFails=!0),i.insuranceObj.creditCardFieldRequiredIndicatorOriginalValue!==i.creditCardFieldRequiredIndicator&&(i.creditCardFieldRequiredIndicator=i.insuranceObj.creditCardFieldRequiredIndicatorOriginalValue),i.insuranceObj&&i.insuranceObj.showInsurance&&!i.insuranceObj.isInsuranceSuccessReservationFails&&(i.isModifyReservation?(a&&a.insurance&&a.insurance.policyNumber&&(i.insuranceObj.insuranceCaNotModify=!0),i.insuranceObj&&i.insuranceObj.insuranceCaNotModify?i.insuranceObj.widgetTopMessageComponent.message=e.translate["page_insurancecannotbecanceled-Msginsurancecannotbecanceled"]:l()):l())}function l(){n.insuranceSupportedCurrencyConversion(r.getCurrencyDetails().currencyCode).then(function(e,t){var o=document.getElementById("amadeus-hos-res-cn-insurance"),r=n.getAmadeusInsuranceSdkOptions(e),i=setInterval(function(){a.AmadeusHosResInsuranceServices&&o&&r&&(clearInterval(i),a.AmadeusHosResInsuranceServices&&a.AmadeusHosResInsuranceServices.InitializeInsuranceSdk&&a.AmadeusHosResInsuranceServices.InitializeInsuranceSdk._insuranceComponentEle&&o.hasChildNodes()?a.AmadeusHosResInsuranceServices.InitializeInsuranceSdk.searchInsuranceOffer(r):(o.innerHTML="",a.AmadeusHosResInsuranceServices.InitializeInsuranceSdk.initialize(!1,o,r)),n.setStyleToInsuranceWidgetWithVariables())},1e3)})}i.insuranceObj.isInsuranceEnable=o.getEnableInsurance(),i.insuranceObj.isInsuranceSupportedForPayment=o.isInsuranceSupportedForPaymentMethod(),i.insuranceObj.showInsurance=!1,i.insuranceObj.creditCardFieldRequiredIndicatorOriginalValue=i.creditCardFieldRequiredIndicator,i.insuranceObj.widgetTopMessageComponent={type:"info",message:e.translate["page_travelinsurancecoverage-Msgtravelinsurancecoverage"]},i.insuranceObj.hasInsuranceOffers=!1,i.insuranceObj.showInsurancePopUp=!1,i.insuranceObj.insuranceCaNotModify=!1,i.insuranceObj.isInsuranceSuccessReservationFails=!1,i.insuranceObj.isInsuranceEnable&&i.insuranceObj.isInsuranceSupportedForPayment&&(i.showCreditCardFields||i.insuranceObj._showCreditCardFieldsLoyalty)?i.insuranceObj.showInsurance=!0:i.insuranceObj.showInsurance=!1,i.insuranceObj&&i.insuranceObj.showInsurance&&i.selectedCountry&&("US"!==i.selectedCountry||"US"===i.selectedCountry&&i.selectedState)&&s(),i.hideInsurancePopUp=function(){i.insuranceObj.showInsurancePopUp=!1,t.onModalClose()},i.$on("EVT_WC_ON_INSURANCE_WIDGET_INITIALIZE",function(e,a){i.selectedCountry=a&&a.countryCode?a.countryCode:"",i.selectedState=a&&a.stateCode?a.stateCode:"",i.selectedCountry&&("US"!==i.selectedCountry||"US"===i.selectedCountry&&i.selectedState)?s():document.getElementById("amadeus-hos-res-cn-insurance")&&(i.insuranceObj.hasInsuranceOffers=!1,document.getElementById("amadeus-hos-res-cn-insurance").innerHTML="")})}}}function insurancePopUp(){return{restrict:"E",replace:!0,templateUrl:"./insurance/insurance-Popup.html"}}function insuranceMessageComponent(){return{restrict:"E",scope:{type:"=",message:"="},templateUrl:"./insurance/insurance-message-component.template.html"}}function InternationalController(e,a,t,o,r,n,i,s,l,c,d,g,m,u,p,y,v,h,R,f){function C(){t.prevLanguage=angular.copy(t.currentLanguage),t.prevCurrency=angular.copy(t.currency)}function P(e){for(var a=o.getCurrencies(),t=0;t<a.length;t++)if(a[t].currencyCode===e)return a[t]}function S(){var a=o.getHotelDesc(),r=a&&a.chainInfo&&a.chainInfo.length>0?a.chainInfo[0]:"",n=f.getAudienceEvaluatorCriteria(t.currency);g.callAudienceEvaluator(a.hotelCode,r,n).then(function(a){f.setAudienceLists(a.data),e.$broadcast("RECALL_MERCHANDISING_API"),v.getMenubarEnabled()?t.changeIntl(t.currentLanguage):e.$broadcast("EVENT.CURRENCY_CHANGE")},function(a){console.log(a),v.getMenubarEnabled()?t.changeIntl(t.currentLanguage):e.$broadcast("EVENT.CURRENCY_CHANGE")})}function A(e,a){return e.split(a)[0]}t.flagForCurrency=o.getUxConfiguration().enableMultipleCurrencyDisplay;var I=o.getLanguages();t.languages=I,t.isMenubarEnabled=v.getMenubarEnabled(),t.isBrandBarDisplay=u.getIsBrandBarDisplay();var b,D=(o.getCurrencies(),o.getCurrentCurrency(),o.getRatePlanMerchandisedCurrencies());e.currentCurrency=t.currency,t.currentLanguage=o.getCurrentLanguages().languageCode;var T=r.getCurrencyDetails();T&&T.currencyCode?(t.currency=T.currencyCode,e.currentCurrency=t.currency):(t.currency=o.getCurrentCurrency().currencyCode,r.setCurrencyDetails(o.getCurrentCurrency()),e.currentCurrency=t.currency);var O=o.getHotelInfo().hotelCode;if(e.$on(n.UPDATE_CURRENCY,function(){r.getConfig("SHOW_MERCHANDISED_CURRENCY")?t.isMerchandisedModification=!0:t.isMerchandisedModification=!1,r.getConfig("SHOW_RATE_PLAN_MERCHANDISED_CURRENCY")?t.isRatePlanMerchandisedModification=!0:t.isRatePlanMerchandisedModification=!1;var a=r.getCurrencyDetails();t.currency=a.currencyCode,e.currentCurrency=t.currency}),e.$on("EVENT.UPDATE_CURRENCY_THROUGH_RATEACCESSCODE",function(e,a){b=t.currency,t.currency=a,r.setConfig("CURRENCY_CHANGED_THROUGH_RATEACCESSCODE"),t.enabledMerchandisedCurrencyPopUp=!0,setTimeout(function(){p.onModalOpen("","merchandise-splash-parent-id","merchandise-splash-title-id",!0,t.cancelToChangeCurrency)})}),t.cancelToChangeCurrency=function(){t.enabledMerchandisedCurrencyPopUp=!1,b&&r.getConfig("CURRENCY_CHANGED_THROUGH_RATEACCESSCODE")?(t.currency=b,r.deleteConfig("CURRENCY_CHANGED_THROUGH_RATEACCESSCODE"),setTimeout(function(){var e=document.getElementById("add-code-button-id");e&&e.focus()})):(t.currency=e.currentCurrency,setTimeout(function(){var e=document.getElementById("currency-dropdown-update-button-id");e&&e.focus()})),p.onModalClose(),e.$broadcast(n.BROADCAST_CURRENCY_TO_CURRENCY_DROPDOWN,t.currency)},t.changeCurrencyToMerchandised=function(a){var o=r.getConfig("modifyRetrieveEH"),n=r.canModifyReservation();if(o)return void g.cancelExtendHold(e.extendHoldHotelCode,e.extendHoldConfirmationCode,e.extendHoldEmail).success(function(){r.deleteUniqueId(),r.deleteConfig("modifyRetrieveEH"),r.setContinueChangeReservation(),t.changeCurrencyToMerchandised(!0)},function(){t.cancelToChangeCurrency()});n&&(e.continueModifyReservation=!0),y.resetBookingEngineAndDropAllrooms(n||a),r.removeAllCode();var s=D.indexOf(t.currency)>-1;e.MRB&&s?r.disabledMultiRoomBehavior():e.MRB&&!s&&r.enabledMultiRoomBehavior(),r.getConfig("CURRENCY_CHANGED_THROUGH_RATEACCESSCODE")&&(e.$broadcast("EVENT.RECALL_SPECIAL_CODE",!0),r.deleteConfig("CURRENCY_CHANGED_THROUGH_RATEACCESSCODE"),t.toggleIntl()),t.enabledMerchandisedCurrencyPopUp=!1,p.onModalClose(),t.changeIntl(t.currentLanguage,!0),"guestsandrooms"==i.current.name?i.go(".",{},{reload:!0}):i.go("guestsandrooms")},e.$on(n.CALL_CURRENCY_CHANGE_MENUBAR,function(e,a){t.currency=a.currencyCode,f.isAudienceEvaluatorEnabled()?S():t.changeIntl(t.currentLanguage)}),t.changeIntl=function(a,i,s){var c=e.currentCurrency!==t.currency,d=D.indexOf(t.currency)>-1,g=D.indexOf(t.prevCurrency)>-1,m=r.getMainReservation();if(c&&D.length&&(d||g)&&!i&&(o.getHotelDesc().enableMultiRoomTypeBookings||void 0!=m.roomStays&&m.roomStays.length>0&&void 0!=m.roomStays[0]&&void 0!=m.roomStays[0].total))return t.enabledMerchandisedCurrencyPopUp=!0,void setTimeout(function(){p.onModalOpen("","merchandise-splash-parent-id","merchandise-splash-title-id",!0,t.cancelToChangeCurrency)});if(e.languages=angular.copy(a),r.setPreviousLanguage(t.prevLanguage),o.getDefaultCurrency().currencyCode,s||t.toggleIntl(),angular.forEach(I,function(a){a.languageCode==t.currentLanguage&&(e.description=a.description)}),e.initialLanguageCode=!0,e.currentCurrency=t.currency,r.setLanguage(a),o.setSelectedLanguage(a),r.setCurrency(t.currency),r.setCurrencyDetails(P(t.currency)),o.getTranslations(O,a,e),t.currentLanguage===t.prevLanguage&&t.currency===t.prevCurrency||e.$broadcast(n.LANG_CHANGE,c),t.currentLanguage!==t.prevLanguage&&u.fireLoyaltyEvent("lang_changed",{detail:{lang:t.currentLanguage}}),c&&(u.fireLoyaltyEvent("currency_changed",{detail:{currency:t.currency}}),f.isAudienceEvaluatorEnabled()&&!v.getMenubarEnabled()?S():e.$broadcast("EVENT.CURRENCY_CHANGE")),a){var y=a.toLowerCase().substring(0,2);document.getElementsByTagName("html")[0].lang=y}l.stepsById.total.placeholder=r.getTotalReservationAmount(),C(),setTimeout(function(){var e=document.getElementById("international-language-dropdown-id");e&&e.focus()}),h.switchCookieBannerLang(a)},1==r.getConfig("PAYPAL_CANCEL_LANGUAGE")||1==r.getConfig("IDEAL_CANCEL_LANGUAGE")||1==r.getConfig("SECURE_3D_CANCEL_LANGUAGE")){var E=r.curFromCache().currencyCode;t.currency=E,e.currentCurrency=t.currency,r.setCurrency(E),r.setCurrencyDetails(function(e){for(var a=o.getCurrencies(),t=0;t<a.length;t++)if(a[t].currencyCode===e)return a[t]}(E)),C(),e.$broadcast(n.LANG_CHANGE),1==r.getConfig("PAYPAL_CANCEL")&&r.deleteConfig("PAYPAL_CANCEL"),1==r.getConfig("IDEAL_CANCEL")&&r.deleteConfig("IDEAL_CANCEL"),1==r.getConfig("SECURE_3D_CANCEL")&&r.deleteConfig("SECURE_3D_CANCEL"),1==r.getConfig("PAYPAL_CANCEL_LANGUAGE")&&r.deleteConfig("PAYPAL_CANCEL_LANGUAGE"),1==r.getConfig("IDEAL_CANCEL_LANGUAGE")&&r.deleteConfig("IDEAL_CANCEL_LANGUAGE"),1==r.getConfig("SECURE_3D_CANCEL_LANGUAGE")&&r.deleteConfig("SECURE_3D_CANCEL_LANGUAGE")}1==r.getConfig("SET_CURRENCY")&&(t.currency=r.getMainReservation().currency,e.currentCurrency=t.currency,r.setCurrency(t.currency),r.setCurrencyDetails(P(t.currency)),C(),l.stepsById.total.placeholder=r.getTotalReservationAmount(),r.deleteConfig("SET_CURRENCY")),t.opLanguages=[],t.topCurrenciesArray=r.getTopCurrencies(),t.currenciesArray=r.getCurrencies(),I.forEach(function(e){var a=A(e.description," "),o=A(e.languageCode,"_");t.opLanguages.push({description:a,languageCode:o})}),void 0===e.intLang&&void 0===e.intCurrency&&(t.defaultLang=e.intLang={description:A(o.getCurrentLanguages().description," "),languageCode:A(o.getCurrentLanguages().languageCode,"_")},t.defaultCurrency=e.intCurrency=A(o.getCurrentCurrency().currencyCode,"_"),t.intlSelect={lang:t.defaultLang,curr:t.defaultCurrency}),t.cancelIntl=function(){t.currentLanguage=t.prevLanguage,t.currency=t.prevCurrency,t.toggleIntl(),setTimeout(function(){var e=document.getElementById("international-language-dropdown-id");e&&e.focus()})},e.toggle={intlMenu:!1,collapse:!0},t.toggleIntl=function(){e.toggle.intlMenu=!e.toggle.intlMenu,e.toggle.collapse=!0},t.intlFormatter=A,t.setSelectedCurrency=function(e){e&&(t.currency=e.currencyCode)},t.trackGAEventIntl=function(e,a){"language"===e?s.eventTrack("ChangeLanguage",{category:"UserNavigation",label:a}):"currency"===e&&s.eventTrack("ChangeCurrency",{category:"UserNavigation",label:a})},C(),e.$on(n.LANG_CHANGE,function(){var a=r.getPromotionInContext(),t=o.getHotelInfo().hotelCode,n=r.getLanguage(),i=o.getChainCodeUrl();n||(n=o.getCurrentLanguages().languageCode),g.getAllPromotions(t,n,i).success(function(t){if(r.setPromotionsList(t),a){var o=m.findIndex(t,function(e){return e.promotionId==a.promotionId});-1!=o&&r.setPromotionInContextVariable(t[o]),e.$broadcast("ENABLE_PROMOTION_BANNER")}e.$broadcast("PROMOTIONS_DISPLAY_ON_BE")})}),r.setZeroDollarExceptionFlag(!0),t.isMenubarEnabled&&R.TCCommonService&&R.TCCommonService.EventService.subscribe("menubar_language_change",function(e,a){t.currentLanguage=a.data.data,t.changeIntl(t.currentLanguage,!1,!0)})}function intlBar(){return{restrict:"E",templateUrl:"./international/international.html",controller:InternationalController}}function menubar(e,a,t,o,r){return{restrict:"E",templateUrl:"./menubar/menubar.template.html",link:function(n){n.metadata=a.getMenubarData(),n.langList=e.getLanguages(),n.currentLanguage=o.getLanguage(),n.chainCode=e.getChainCode(),n.phoneNumber=e.getHotelPhoneNumber(),n.applicationName="Booking Engine",n.hotelId=e.getHotelCode(),n.enableOnScrollTemplate=!0,n.enablePreviewMode=!(!t||!t.manageUrlParams||"true"!==t.manageUrlParams.menubarpreview),n.isLoyaltyEnabled=r.getIsLoyaltyReservationEnabled()||!1}}}function switchRoom(){return{restrict:"E",templateUrl:"./multiroom/switchRoom.directive.html",controller:MultiRoomController}}function confirmBookRoom(){return{restrict:"E",templateUrl:"./multiroom/confirmBookRoom.html"}}function manageMultiRoom(){return{restrict:"E",templateUrl:"./multiroom/manage-multi-room.directive.html"}}function MultiRoomController(e,a,t,o,r,n,i,s,l,c,d,g,m,u,p,y,v,h,R,f,C){function P(){for(var e=0,a=!1,t=!1,o=0;o<c.getMainReservationArray().length;o++)void 0!=c.getMainReservationArray()[o].roomStays&&c.getMainReservationArray()[o].roomStays.length>0&&void 0!=c.getMainReservationArray()[o].roomStays[0].roomRates&&c.getMainReservationArray()[o].roomStays[0].roomRates.length>0&&void 0!=c.getMainReservationArray()[o].roomStays[0].roomRates[0].roomTypeCode&&void 0!=c.getMainReservationArray()[o].roomStays[0].total||(c.getMainReservationArray()[o].id==c.getMainReservation().id&&(a=!0),e++,t=!0);return!(1!=e&&0!=e||1!=a&&0!=t)}n.confirmBookRoom=!1,n.combinedHoldFailureFlag=!1,c.hideMultiRoomButton()?n.hideAddRoomButton=!0:n.hideAddRoomButton=!1,n.fixedMerchandiseCurrency=c.getFixedMerchandisedCurrency(),i.getReservationTotal=function(){var e=c.getMainReservationArray(),t=0;return y.forEach(e,function(e){void 0!=e.roomStays[0].total&&void 0!=e.roomStays[0].total.amountBeforeTax&&(t+=e.roomStays[0].total.amountAfterTax),e.roomStays[0].roomRates.length>0&&e.roomStays[0].roomRates[0].roomTypeCode||i.MRB&&(a.navToggle.totalSelected=!1)}),v("currencyConversionAndSymbol")(t,c.getCurrencyDetails(),n.fixedMerchandiseCurrency)},n.changeSelectRoom=function(e,a){if(g.clear(),n.packageSelected=!1,c.getConfig("CLICK_STREAM_DELETE_ROOM"))c.deleteConfig("CLICK_STREAM_DELETE_ROOM");else{for(var s,l=0;l<c.getMainReservationArray().length;l++)if(c.getMainReservationArray()[l].id==e){s=l,s++;break}o.eventTrack("ClickModifyOnRoomSelector",{category:"UserNavigation",label:s}),c.setConfig("CLICK_STREAM_Modify_ROOMSELECTOR")}c.changeSelectRoom(e),i.$broadcast(d.MODIFY_RESERVATION),"display-block"==i.switchRoom&&h.onModalClose(),i.switchRoom="display-none",t.debug(c.getMainReservation().id),void 0!=c.getMainReservation().id&&(i.id=angular.copy(c.getMainReservation().id)),r.is("total")&&"modify"==a&&r.go("guestsandrooms"),r.is("datesofstay")&&i.$broadcast(d.CHANGE_ROOM_SELECTOR),c.setConfig("ROOM_SWITCH_FROM_ROOM_SELECTOR"),i.displayBook=P(),i.$broadcast(d.RES_SELECTION_CHANGE)},n.$watch("reservationArray",function(){i.MRB&&(n.initRoomData(),i.displayBook=P())}),n.deleteSelectRoom=function(e){n.packageSelected=!1,i.deleteReservation=angular.copy(e),i.switchRoom="display-none",h.onModalClose(),c.setConfig("delete_room_in_roomselector"),i.$broadcast(d.REMOVE_ACCOMMODATION);for(var a,t=0;t<c.getMainReservationArray().length;t++)if(c.getMainReservationArray()[t].id==e.id){a=t,a++;break}o.eventTrack("RemoveRoom",{category:"UserNavigation",label:a})},i.$on(d.REMOVE_CONFIRM_DELETE_ROOM_ROOMSELECTOR,function(){if(c.deleteMainReservationArrayById(i.deleteReservation.id),i.deleteReservation.id==c.getMainReservation().id){n.changeSelectRoom(c.getMainReservationArray()[0].id);for(var e=0;e<c.getMainReservationArray().length;e++)if(void 0==c.getMainReservationArray()[e].roomStays[0].roomRates[0].roomTypeCode){n.changeSelectRoom(c.getMainReservationArray()[e].id);break}}else for(var e=0;e<c.getMainReservationArray().length;e++)if(c.getMainReservationArray()[e].id==c.getMainReservation().id){i.currentRoomSelectorId=e;break}i.reservationArray=c.getMainReservationArray(),c.deleteInitOptionsArrays(),i.$broadcast(d.DELETE_ROOM_ROOMSELECTOR),n.initRoomData(),i.displayBook=P(),a.stepsById.accommodations.placeholderMRB=c.getBookedRoomCount()}),n.AddRoomInRoomSelector=function(){i.switchRoom="display-none",h.onModalClose(),c.getConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE")&&c.deleteConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE"),r.is("guestsandrooms")?i.$broadcast(d.ADD_ROOMSELECTOR):(c.setConfig("ADD_ROOMSELECTOR"),r.go("guestsandrooms"))},n.initRoomData=function(){for(var e=0;e<i.reservationArray.length;e++){var a={adults:0,children:0,infants:0},t=i.reservationArray[e].resGlobalInfo.guestCounts;a.noOfNights=Math.abs(moment.utc(i.reservationArray[e].resGlobalInfo.timeSpan.end).diff(moment.utc(i.reservationArray[e].resGlobalInfo.timeSpan.start),"days")),angular.forEach(t,function(e,t){"10"===e.ageQualifyingCode?a.adults+=Number(e.count):"8"===e.ageQualifyingCode?a.children+=Number(e.count):"7"===e.ageQualifyingCode&&(a.infants+=Number(e.count))}),i.reservationArray[e].roomData=angular.copy(a)}},i.$on("EVENT.REFRESH_MANAGE_ROOM_DATA",function(){n.initRoomData(),i.displayBook=P()}),i.$on(d.LANG_CHANGE,function(){n.langObj={language:c.getLanguage()},n.currentCurrencyObject=c.getCurrencyDetails()}),n.bookRoomSelector=function(){i.switchRoom="display-none",h.onModalClose(),u.scrollTopAnimated(0,1e3);for(var e=!1,a=0;a<c.getMainReservationArray().length;a++)if(void 0==c.getMainReservationArray()[a].roomStays[0].roomRates[0].roomTypeCode){e=!0;break}1==e?(n.confirmBookRoom=!0,setTimeout(function(){h.onModalOpen("manage-rooms-link-id","manage-room-confirm-book-parent","manage-room-confirm-book-title",!1,n.cancelBookRoomSelector)})):n.confirmBookRoomSelector()},n.cancelBookRoomSelector=function(){n.confirmBookRoom=!1,h.onModalClose()},n.confirmBookRoomSelector=function(){n.confirmBookRoom=!1,h.onModalClose();for(var m=0;m<c.getMainReservationArray().length;m++)if(c.getMainReservationArray()[m].roomStays.length>0&&void 0!=c.getMainReservationArray()[m].roomStays[0].ratePlans&&c.getMainReservationArray()[m].roomStays[0].ratePlans.length>0&&"Package"==c.getMainReservationArray()[m].roomStays[0].ratePlans[0].ratePlanType&&void 0==c.getMainReservationArray()[m].roomStays[0].total)return c.changeSelectRoom(c.getMainReservationArray()[m].id),void(r.includes("accommodation")?r.go(".",{},{reload:!0}):r.go("accommodation"));a.stepsById.accommodations.rooms=[],c.setContinueChangeReservation(),i.startTime=Date.now(),a.navToggle.totalSelected=!0;for(var m=0;m<c.getMainReservationArray().length;m++)if(void 0!=c.getMainReservationArray()[m].resGlobalInfo.timeSpan.start&&void 0!=c.getMainReservationArray()[m].resGlobalInfo.timeSpan.end&&c.getMainReservationArray()[m].roomStays[0].ratePlans.length>0&&void 0!=c.getMainReservationArray()[m].roomStays[0].ratePlans[0].ratePlanCode&&c.getMainReservationArray()[m].roomStays[0].roomRates.length>0&&void 0!=c.getMainReservationArray()[m].roomStays[0].roomRates[0].roomTypeCode){c.changeSelectRoom(c.getMainReservationArray()[m].id);break}c.deleteIncompleteRoom();var u=c.getMainReservation(),p=c.getLanguage();if(p||(p=l.getCurrentLanguages().languageCode),u.languageCode=p,void 0!=u.allCodes&&u.allCodes.Discount&&(u.roomStays[0].discountCode=u.allCodes.Discount),i.MRB){for(var P=angular.copy(c.getMainReservationArray()),m=0;m<P.length;m++)void 0!=P[m].allCodes&&P[m].allCodes.Discount&&(P[m].roomStays[0].discountCode=angular.copy(P[m].allCodes.Discount));c.setMainReservationByEqual(P)}var S=c.getMainReservation().id,A=0;t.debug(JSON.stringify(c.getMainReservationArray())+"_reservationService before before");for(var m=0;m<c.getMainReservationArray().length;m++)void 0!=c.getMainReservationArray()[m].roomStays&&c.getMainReservationArray()[m].roomStays.length>0&&void 0!=c.getMainReservationArray()[m].roomStays[0].roomRates&&c.getMainReservationArray()[m].roomStays[0].roomRates.length>0&&void 0!=c.getMainReservationArray()[m].roomStays[0].roomRates[0].roomTypeCode||A++;n.oneRoomLeft=1==A||0==A,c.setMainReservationArrayById(S,c.getMainReservation());var I=angular.copy(c.getMainReservationArray());t.debug(JSON.stringify(c.getMainReservation())+"reservationService.getMainReservation before"),t.debug(JSON.stringify(c.getMainReservationArray())+"reservationService.getMainReservationArray() before");var b=l.getHotelInfo().hotelCode;s.callHoldReservation(b,u,I,n.oneRoomLeft,i.MRB).success(function(s){if(C.setMyCheckRefershTokenDetails(s),R.getBurnPoints()&&o.eventTrack("RemoveAppliedPoints",{category:"UserNavigation",label:"RemoveAppliedPoints"}),R.setBurnPoints(void 0),f.resetVoucherDetails(),1==c.setMainReservationByEqual(s.reservationResponses)){if(void 0!=s.reservationResponses&&1==s.reservationResponses.length){var l;1==i.MRB&&1!=n.oneRoomLeft&&(l={},l=angular.copy(s.reservationResponses[0]),l.hotelCode=angular.copy(s.hotelCode),l.languageCode=angular.copy(s.languageCode),l.currencyCode=angular.copy(s.currencyCode),s=l)}if(g.clear(),e.setUserTiming("Interaction","Book"),a.stepsById.accommodations.ratePlan=[],1==i.MRB&&1==n.oneRoomLeft){var m=y.findIndex(s.reservationResponses,function(e){return e.id==S});l=angular.copy(s.reservationResponses[m]),a.stepsById.accommodations.ratePlan=l.roomStays[0].ratePlans}else a.stepsById.accommodations.ratePlan=s.roomStays[0].ratePlans,s.selected=!0;if(t.debug(JSON.stringify(a.stepsById.accommodations)+"navDataFactory.stepsById.accommodations"),1==i.MRB){if(1==n.oneRoomLeft&&1==i.MRB){for(var u=0;u<s.reservationResponses.length;u++)if(s.reservationResponses[u].id==S){s.reservationResponses[u].selected=!0;break}c.setMrbItineraryTotals(s.itineraryTotals),c.setMrbItineraryPaymentInfo(s.itineraryPaymentInfo),c.setMainReservationByEqual(s.reservationResponses);for(var p=!1,u=0;u<c.getMainReservationArray().length;u++)if(c.getMainReservationArray()[u].id==S){c.setReservation(c.getMainReservationArray()[u]);break}i.reservationArray=c.getMainReservationArray()}else{c.setReservation(s);var P,p=!1;s.id=S,c.setMainReservationArrayById(S,s);for(var A=0;A<c.getMainReservationArray().length;A++)if(!(void 0!=c.getMainReservationArray()[A].roomStays[0].ratePlans&&c.getMainReservationArray()[A].roomStays[0].ratePlans.length>0&&void 0!=c.getMainReservationArray()[A].roomStays[0].ratePlans[0].ratePlanType&&void 0!=c.getMainReservationArray()[A].roomStays[0].roomRates[0].roomTypeCode)){P=c.getMainReservationArray()[A].id,p=!0,roomToAdd=1,numRoomsCheck=1;break}void 0!=P&&(c.changeSelectRoom(P),i.$broadcast(d.MODIFY_RESERVATION))}t.debug(JSON.stringify(c.getMainReservationArray())+"reservationService.getMainReservationArray() after commit hold call"),a.stepsById.total.placeholder=c.getTotalReservationAmount(),a.navToggle.totalSelected=!0,1!=p?(i.$broadcast(d.MODIFY_RESERVATION),c.getConfig("DELETE_ROOM_AFTER_LAND_TOTAL")?(r.go(".",{},{reload:!0}),"total"!=r.current.name&&c.changeSelectRoom(c.getMainReservation().id)):"total"==r.current.name?r.go(".",{},{reload:!0}):r.go("total")):(g.clear(),g.pop({type:"info",title:"",body:"Please modify the next room to complete room selections.",timeout:3e3}))}else c.setReservation(s),a.stepsById.total.placeholder=c.getTotalReservationAmount(),a.navToggle.totalSelected=!0,c.getConfig("DELETE_ROOM_AFTER_LAND_TOTAL")?(r.go(".",{},{reload:!0}),"total"!=r.current.name&&c.changeSelectRoom(c.getMainReservation().id)):r.go("total")}else if(n.failedRoomsId=c.getFailedRoomsId(),n.failedRoomsId.length>1)n.combinedHoldFailureFlag=!0,h.onModalOpen("","combined-hold-failure-switchRoom","combined-hold-failure-title-0",!1);else if(r.includes("accommodation")){i.$broadcast(d.MODIFY_RESERVATION);var I=v("replaceHashMRB")(i.translate.page_roomisnolongeravl_MRTBRoomSelectorMsg,n.getRoomIndex(n.failedRoomsId[0]),i.reservationArray.length);g.pop({type:"error",title:"",body:I,timeout:3e3}),n.recallAPI(!0)}else e.setObjectData("combinedHoldError",!0),r.go("accommodation");c.deleteConfig("DELETE_ROOM_AFTER_LAND_TOTAL")}).error(function(){g.pop({type:"error",title:"",body:i.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg,timeout:3e3}),i.bookedError=!0,r.includes("accommodation")&&n.recallAPI(!0),c.deleteConfig("DELETE_ROOM_AFTER_LAND_TOTAL")})},n.$on(d.DELETE_ROOM_AFTER_LAND_TOTAL,function(){c.setConfig("DELETE_ROOM_AFTER_LAND_TOTAL"),n.confirmBookRoomSelector()}),n.selectRoomOnHoldFailureFlag=function(){n.combinedHoldFailureFlag=!1,h.onModalClose(),r.includes("accommodation")?n.recallAPI(!0):r.go("accommodation")},n.getRoomIndex=function(e){return y.findIndex(i.reservationArray,function(a){return a.id==e})+1};var S=l.getHotelInfo().hotelCode;n.$watch("NOOfObject",function(){0==n.NOOfObject&&(i.reservationArray=c.getMainReservationArray())}),n.$on(d.LANG_CHANGE,function(){void 0==n.NOOfObject&&(n.NOOfObject=0);for(var e=0;e<c.getMainReservationArray().length;e++)if(void 0!=c.getMainReservationArray()[e].roomStays[0].roomRates[0].roomTypeCode&&void 0!=c.getMainReservationArray()[e].roomStays[0].ratePlans[0].ratePlanCode){n.NOOfObject++;var o,r;o=angular.copy(c.getMainReservationArray()[e]),r=angular.copy(c.getMainReservationArray()[e]),t.debug(JSON.stringify(r)+"MainReservation in for loop");var d={},g=o.resGlobalInfo.guestCounts,m=o.resGlobalInfo.guestCounts.length,u=c.getLanguage();t.debug(u+"Lang in Acc buildOptions"),void 0!=u&&(d.languageCode=u);var p=c.getAllCode();void 0!=p&&Object.keys(p).length>0&&(d.allCodes=p),void 0!=S&&(d.hotelCode=l.getHotelInfo().hotelCode);for(var y=0;y<m;y++)if("10"==g[y].ageQualifyingCode&&void 0!=g[y].count){var v=parseInt(g[y].count);d.adults=v}for(var y,h=0,y=0;y<m;y++)"8"==g[y].ageQualifyingCode&&void 0!==g[y].count&&(h+=parseInt(g[y].count),d.children=h);for(var y=0;y<m;y++)if("7"==g[y].ageQualifyingCode&&void 0!=g[y].count){var R=parseInt(g[y].count);d.infant=R}for(var y=0;y<m;y++)if("7"==g[y].ageQualifyingCode&&void 0===g[y].count){var R=parseInt(occupancyInfo.defaultInfants);d.infant=R}if(void 0!=o.resGlobalInfo.timeSpan.start){var f=o.resGlobalInfo.timeSpan.start;d.dateIn=f}if(void 0!=o.resGlobalInfo.timeSpan.end){var C=o.resGlobalInfo.timeSpan.end;d.dateOut=C}var P,A,y,I,P=r.resGlobalInfo.guestCounts,A=[];d.childrenAges=void 0;for(var y=0;y<P.length;y++)if("8"==P[y].ageQualifyingCode&&P[y].count)for(var I=0;I<P[y].count;I++)void 0!=P[y].age&&(A.push(P[y].age.toString()),d.childrenAges=A.join(","));var b,D;if(void 0!=o.resGlobalInfo.rooms&&0!=o.resGlobalInfo.rooms){var T=parseInt(o.resGlobalInfo.rooms);d.rooms=T}else{var b=o.roomStays[0].roomRates,D=0;angular.forEach(b,function(e){D+=e.numberOfUnits}),d.rooms=D}var O=c.getConfirmationCode();if(void 0!=O&&(d.uniqueId=O),void 0!=p&&Object.keys(p).length>0){var E=c.getCodeTypes();t.debug(JSON.stringify(c.getMainReservation())+"codetype"),t.debug(JSON.stringify(E)+"  reservation Code type in Acco");for(var y=0;y<E.length;y++)if("group"==E[y].toLowerCase()){d.ratePlanType="Group",d.groupCode=c.getCodeValue(E[y]),t.debug(d.groupCode+"options[groupCode]"),void 0==a.stepsById.accommodations.group&&(a.stepsById.accommodations.group=[]);var M={};M.codeType=E[y].codeType,M.id=E[y].id,void 0!=c.getGroup()&&(M.name=c.getGroup().groupName),a.stepsById.accommodations.group.push(M),a.stepsById.accommodations.placeholder=M.name}else d.ratePlanType=void 0}else{t.debug(JSON.stringify(r)+"MainReservation new"),d.allCodes=r.posSource.requestorIds;var _=r.posSource.requestorIds;t.debug(r.posSource.requestorIds+"MainReservation.posSource.requestorIds");for(var I=0;I<_.length;I++){if("group"==_[I].codeType){d.ratePlanType="Group",d.groupCode=_[I].id,i.accommodations=!0,void 0==a.stepsById.accommodations.group&&(a.stepsById.accommodations.group=[]);var M={};M.codeType=_[I].codeType,M.id=_[I].id,
void 0!=c.getGroup()&&(M.name=c.getGroup().groupName),a.stepsById.accommodations.group.push(M),a.stepsById.accommodations.placeholder=M.name}"travelagent"==_[I].codeType&&(d.taCode=_[I].id),"discount"==_[I].codeType&&(d.Discount=_[I].id),"corporate"==_[I].codeType&&(d.Corporate=_[I].id)}void 0==r.roomStays[0].discountCode&&(d.Discount=void 0),void 0==d.Discount&&(d.Discount=r.roomStays[0].discountCode)}var k=c.getCurrency()||c.getCurrencyDetails()&&c.getCurrencyDetails().currencyCode;void 0!=k&&(d.currencyCode=k),t.debug(JSON.stringify(c.getReservation())+"reservationService.getReservation() in buildOption"),void 0!=c.getMainReservationArray()[e].roomStays&&void 0!=c.getMainReservationArray()[e].roomStays[0].ratePlans&&void 0!=c.getMainReservationArray()[e].roomStays[0].ratePlans[0]?("Group"!=c.getMainReservationArray()[e].roomStays[0].ratePlans[0].ratePlanType&&void 0!=c.getMainReservationArray()[e].roomStays[0].ratePlans[0].ratePlanCode?d.ratePlanCode=c.getMainReservationArray()[e].roomStays[0].ratePlans[0].ratePlanCode:(d.ratePlanCode=void 0,d.ratePlanType=void 0),void 0!=d.ratePlanCode&&void 0!=c.getMainReservationArray()[e].roomStays[0].ratePlans[0].ratePlanType?d.ratePlanType=c.getMainReservationArray()[e].roomStays[0].ratePlans[0].ratePlanType:d.ratePlanType=void 0):void 0==a.stepsById.accommodations.package&&"package"==d.ratePlanType?(d.ratePlanType=void 0,d.ratePlanCode=void 0):void 0!=a.stepsById.accommodations.package&&(d.ratePlanType="package",d.ratePlanCode=a.stepsById.accommodations.package[0].packageCode),t.debug(JSON.stringify(a.stepsById.accommodations.package)+"navDataFactory.stepsById.accommodations.package"),t.debug(JSON.stringify(d)+"Options"),t.debug(d+"BuildOptionsinaccomo"),s.getAccommodationRooms(d).getAllRooms().then(function(e){for(var a=0;a<c.getMainReservationArray().length;a++){for(var o=0;o<e.data.roomStays[0].roomTypes.length;o++)t.debug("_mrb"+a),t.debug(JSON.stringify(c.getMainReservationArray())+"reservationService.getMainReservationArray()"),e.data.roomStays[0].roomTypes[o].roomTypeCode==c.getMainReservationArray()[a].roomStays[0].roomRates[0].roomTypeCode&&(c.getMainReservationArray()[a].roomStays[0].roomRates[0].roomTypeName=e.data.roomStays[0].roomTypes[o].roomTypeName);for(var r=0;r<e.data.roomStays[0].ratePlans.length;r++)c.getMainReservationArray()[a].roomStays[0].ratePlans.length>0&&e.data.roomStays[0].ratePlans[r].ratePlanCode==c.getMainReservationArray()[a].roomStays[0].ratePlans[0].ratePlanCode&&(c.getMainReservationArray()[a].roomStays[0].ratePlans[0].ratePlanName=e.data.roomStays[0].ratePlans[r].ratePlanName)}n.NOOfObject--})}}),n.$on("CALL_COMBINED_HOLD_BEFORE_TOTAL",function(){n.confirmBookRoomSelector()})}function NavbarController(e,a,t,o,r,n,i,s,l,c,d,g,m,u,p,y,v,h,R){function f(e){e.matches?o.isProgressBarDesktopViewEnabled=!1:o.isProgressBarDesktopViewEnabled=!0}function C(){b=s.getMainReservation();var e=0;if(void 0!=b.roomStays){var a=b.roomStays[0].roomRates;angular.forEach(a,function(a){e+=a.numberOfUnits})}return e}function P(){b=s.getMainReservation(),o.navToggle.totalSelected=!1,a.debug("Reservation :: "+JSON.stringify(b));var l=C(),c=b.resGlobalInfo.guestCounts,m=0,u=0,p=0;if(1==t.MRB&&1!=t.enabelRoomSelector){l=0;for(var y=0;y<s.getMainReservationArray().length;y++){for(var v=angular.copy(s.getMainReservationArray()[y].resGlobalInfo.guestCounts),h=0;h<v.length;h++)void 0!=v[h].count&&(m=parseInt(v[h].count)+m),"10"==v[h].ageQualifyingCode&&(u+=parseInt(v[h].count)),"8"!=v[h].ageQualifyingCode&&"7"!=v[h].ageQualifyingCode||(p+=parseInt(v[h].count));l++}}else for(var h=0;h<c.length;h++)void 0!=c[h].count&&(m=parseInt(c[h].count)+m),"10"==c[h].ageQualifyingCode&&(u+=parseInt(c[h].count)),"8"!=c[h].ageQualifyingCode&&"7"!=c[h].ageQualifyingCode||(p+=parseInt(c[h].count));if(t.guestsRooms=!0,void 0!=s.getMainReservation().resGlobalInfo.timeSpan.start?t.datesOfStay=!0:t.datesOfStay=!1,o.navToggle.datesSelected=!0,t.multiRoomGNB=u+"/"+p,i.stepsById.guestsrooms.placeholder=m+" / "+l,i.stepsById.dates.placeholder=s.formatNavDates(),r.is("accommodation.room")||r.is("accommodation.package")||r.is("accommodation.inclusions")||(o.navToggle.accommodationSelected=!1),1==s.getConfig("LAND_ACCOMMODATION_SUCCESSFUL")||void 0!=b.roomStays[0].roomRates[0].roomTypeCode||void 0!=b.roomStays[0].ratePlans&&b.roomStays[0].ratePlans.length>0&&void 0!=b.roomStays[0].ratePlans[0].ratePlanType){if(s.deleteConfig("LAND_ACCOMMODATION_SUCCESSFUL"),void 0!=b.roomStays[0].roomRates[0].roomTypeCode&&void 0!=b.roomStays[0].ratePlans&&b.roomStays[0].ratePlans.length>0&&void 0!=b.roomStays[0].ratePlans[0].ratePlanType&&(r.is("accommodation.room")||r.is("accommodation.package")||(o.navToggle.accommodationSelected=!0)),t.accommodations=!0,1!=s.getConfig("PACKAGE_IN_CONTEXT_MULTIROOM")&&b.roomStays[0].roomRates.length>0&&void 0!=b.roomStays[0].roomRates[0].roomTypeCode){var R=b.roomStays[0].roomRates;i.stepsById.accommodations.rooms=[],angular.forEach(R,function(e){i.stepsById.accommodations.rooms.push(e),i.stepsById.accommodations.placeholder=e.roomTypeName})}if(s.deleteConfig("PACAKGE_IN_CONTEXT_MULTIROOM"),b.roomStays[0].ratePlans.length>0&&void 0!=b.roomStays[0].ratePlans[0].ratePlanCode){var f=b.roomStays[0].ratePlans;if(i.stepsById.accommodations.ratePlan=[],"Package"!=f[0].ratePlanType&&"group"!=f[0].ratePlanType.toLowerCase()?(void 0!=i.stepsById.accommodations.package&&delete i.stepsById.accommodations.package,void 0!=b.merchandisedPromoData&&(i.stepsById.accommodations.merchandisedPromotionData=b.merchandisedPromoData),i.stepsById.accommodations.ratePlan=f):(i.stepsById.accommodations.package=[],"Package"==f[0].ratePlanType&&(void 0!=b.roomStays[0].roomRates&&b.roomStays[0].roomRates.length>0&&void 0!=b.roomStays[0].roomRates[0].roomTypeCode&&(i.stepsById.accommodations.package=f),i.stepsById.accommodations.placeholder=f[0].ratePlanName)),"group"==f[0].ratePlanType.toLowerCase()){i.stepsById.accommodations.group=[];var P={};P.codeType=f[0].ratePlanType;var S,A=s.getMainReservation(),D=A.posSource.requestorIds;angular.forEach(D,function(e){"group"==e.codeType.toLowerCase()&&(S=e.id)}),P.id=S;var T=n.getHotelInfo().hotelCode;d.getGSplashDetails(T,f[0].ratePlanType,S,I).then(function(e){void 0!=e.data.groupRules&&(t.hidePriceFromAttendees=e.data.groupRules.hidePriceFromAttendees),s.setGroup(e.data),g.setUserTiming("Interaction","CodeWIdget"),void 0!=s.getGroup().groupName&&(P.name=s.getGroup().groupName),i.stepsById.accommodations.group.push(P),i.stepsById.accommodations.placeholder=P.name})}}void 0!=b.roomStays[0].total?(o.navToggle.totalSelected=!0,b.roomStays[0].total.amountAfterTax,i.stepsById.total.placeholder=s.getTotalReservationAmount()):(t.navData.total.placeholder=e("currencyConversionWithTwoDecimalPlaces")(0),o.navToggle.totalSelected=!1);for(var h=0;h<s.getMainReservationArray().length;h++)if(void 0!=s.getMainReservationArray()[h].roomStays&&void 0==s.getMainReservationArray()[h].roomStays[0].total){o.navToggle.totalSelected=!1;break}}else delete i.stepsById.accommodations.ratePlan,delete i.stepsById.accommodations.package,i.stepsById.accommodations.id="accommodations",i.stepsById.accommodations.label="Accommodations",void 0==i.stepsById.accommodations.package&&void 0==i.stepsById.accommodations.group?(i.stepsById.accommodations.placeholder=t.translate.global_header_lblSelect,t.accommodations=!1):void 0==i.stepsById.accommodations.package?(i.stepsById.accommodations.placeholder=t.translate.global_header_lblSelect,t.accommodations=!1):void 0==i.stepsById.accommodations.package||i.stepsById.accommodations.package.length>0||(t.accommodations=!1),i.stepsById.accommodations.className="Header-step--extended",i.stepsById.accommodations.rooms=[],i.stepsById.accommodations.ratePlan=[],t.navData.total.placeholder=e("currencyConversionWithTwoDecimalPlaces")(0),o.navToggle.totalSelected=!1}function S(a){var n=angular.copy(s.getMrbItineraryTotals());if(void 0!=n){e("currencyConversionAndSymbol")(n.itineraryRoomGrandTotal,s.getCurrencyDetails())==t.getReservationTotal()?(r.go(a),t.toggle.collapse=!0):o.$broadcast("CALL_COMBINED_HOLD_BEFORE_TOTAL")}else o.$broadcast("CALL_COMBINED_HOLD_BEFORE_TOTAL")}o.isMenubarEnabled=h.getMenubarEnabled(),o.isDisplayPropertyName=h.getDisplayPropertyName(),o.go=function(e){s.setOpenNewWindowFlag(!0),window.open(e,"_blank")},t.callManageUrlCalender=!0,t.translate=n.getTranslation(),t.navData=i.stepsById,o.deleteGroup="display-none",o.showGroupModal="display-none",s.canModifyReservation(),o.logoClickURL=n.getBrandInfo().webAddress,o.logoClickURL&&!/^(https?):\/\//i.test(o.logoClickURL)&&-1==="http://".indexOf(o.logoClickURL)&&(o.logoClickURL="http://"+o.logoClickURL),o.propertyHostName=n.getHotelDesc().hotelName,o.isBrandBarDisplay=v.getIsBrandBarDisplay(),o.hotelLogo=n.getBrandInfo().hotelLogo,o.logo=n.getBrandInfo().logo;var A=window.matchMedia("(max-width: 991px)");f(A),A.addListener(f),t.isProgressBarEnabled=o.isMenubarEnabled&&o.isProgressBarDesktopViewEnabled,void 0==o.hotelLogo||null!=o.logo.type&&""!=o.logo.type?void 0==o.logo||null!=o.hotelLogo.wideLogo&&""!=o.hotelLogo.wideLogo||null!=o.hotelLogo.smallLogo&&""!=o.hotelLogo.smallLogo?(t.fullWidthLogoEnabled=!1,o.smallLogoPath="null"):"wide-logo-banner"===o.logo.type?(t.fullWidthLogoEnabled=!0,null==o.logo.source||""==o.logo.source?o.wideLogoPath="null":o.wideLogoPath=o.logo.source):"small-logo-banner"===o.logo.type&&(t.fullWidthLogoEnabled=!1,null==o.logo.source||""==o.logo.source?o.smallLogoPath="null":o.smallLogoPath=o.logo.source):(null==o.hotelLogo.smallLogo||""==o.hotelLogo.smallLogo?o.smallLogoPath="null":o.smallLogoPath=o.hotelLogo.smallLogo,null==o.hotelLogo.wideLogo||""==o.hotelLogo.wideLogo?t.fullWidthLogoEnabled=!1:t.fullWidthLogoEnabled=!0,o.wideLogoPath=o.hotelLogo.wideLogo),o.resizeCall=function(){t.windowHeight=c.innerHeight-146,t.windowHeight=t.windowHeight+"px",document.getElementById("Site-pageWrapperId").style.minHeight=t.windowHeight;var e=c.innerWidth;void 0!=o.hotelLogo&&null!=o.hotelLogo.wideLogo&&""!=o.hotelLogo.wideLogo&&m(function(){e<1201&&1==t.fullWidthLogoEnabled?t.fullWidthLogoEnabled=!1:e>1200&&0==t.fullWidthLogoEnabled&&(t.fullWidthLogoEnabled=!0)},0),g.isMultiRateListView(e)},c.onresize=function(){o.isMenubarEnabled&&(f(A),t.isProgressBarEnabled=o.isMenubarEnabled&&o.isProgressBarDesktopViewEnabled,o.$digest()),o.resizeCall()},o.resizeCall();var I=(o.translate,s.getLanguage());o.$watch("translate",function(){t.navData.dates.placeholder=s.formatNavDates()});var b;g.deleteObjectData("UPDATED_NAV_DATA_MANAGE_URL"),t.$on(l.UPDATE_NAV_FOR_GMS,function(){if(s.resFromCache()){for(var e=C(),r=b.resGlobalInfo.guestCounts,l=0,c=0;c<r.length;c++)void 0!=r[c].count&&(l=parseInt(r[c].count)+l);i.navToggle.datesSelected=!0,i.stepsById.guestsrooms.placeholder=l+" / "+e,i.stepsById.dates.placeholder=s.formatNavDates();var m=b.roomStays[0].roomRates,u=b.roomStays[0].ratePlans;if(i.stepsById.accommodations.rooms=[],i.stepsById.accommodations.ratePlan=[],a.debug("Reservation :: "+b),t.datesOfStay&&(i.navToggle.accommodationSelected=!0),u.length>0&&(angular.forEach(m,function(e){e.roomTypeName&&""!=e.roomTypeName&&(t.accommodations=!0,i.stepsById.total.placeholder=s.getTotalReservationAmount(),i.navToggle.totalSelected=!0,i.stepsById.accommodations.rooms.push(e),i.stepsById.accommodations.placeholder=e.roomTypeName)}),u[0].ratePlanType&&("Package"!=u[0].ratePlanType&&"group"!=u[0].ratePlanType.toLowerCase()?(i.stepsById.accommodations.ratePlan=u,void 0!=b.merchandisedPromoData&&(i.stepsById.accommodations.merchandisedPromotionData=b.merchandisedPromoData)):(i.stepsById.accommodations.package=[],"Package"==u[0].ratePlanType&&(i.stepsById.accommodations.package=u,i.stepsById.accommodations.placeholder=u[0].ratePlanName))),u[0].ratePlanType&&"group"==u[0].ratePlanType.toLowerCase())){i.stepsById.accommodations.group=[];var p={};p.codeType=u[0].ratePlanType;var y,v=s.getMainReservation(),h=v.posSource.requestorIds;angular.forEach(h,function(e){"group"==e.codeType.toLowerCase()&&(y=e.id)}),p.id=y;var R=n.getHotelInfo().hotelCode,f=s.getLanguage();d.getGSplashDetails(R,u[0].ratePlanType,y,f).then(function(e){void 0!=e.data.groupRules&&(t.hidePriceFromAttendees=e.data.groupRules.hidePriceFromAttendees),s.setGroup(e.data),g.setUserTiming("Interaction","CodeWIdget"),void 0!=s.getGroup().groupName&&(p.name=s.getGroup().groupName),i.stepsById.accommodations.group.push(p),i.stepsById.accommodations.placeholder=p.name})}o.navToggle=i.navToggle}}),o.isModifyReservation=!1,o.$on(l.MODIFY_RESERVATION,function(e,r){if(t.MRB&&1!=s.getMainReservation().isModifiable)P();else{o.isModifyReservation=!0;for(var c=C(),m=b.resGlobalInfo.guestCounts,u=0,p=0;p<m.length;p++)void 0!=m[p].count&&(u=parseInt(m[p].count)+u);t.guestsRooms=!0,t.datesOfStay=!0,t.accommodations=!0,i.stepsById.guestsrooms.placeholder=u+" / "+c,i.stepsById.dates.placeholder=s.formatNavDates();var y=b.roomStays[0].roomRates,v=b.roomStays[0].ratePlans;if(i.stepsById.accommodations.rooms=[],i.stepsById.accommodations.ratePlan=[],a.debug("Reservation :: "+b),angular.forEach(y,function(e){i.stepsById.accommodations.rooms.push(e),i.stepsById.accommodations.placeholder=e.roomTypeName}),"Package"!=v[0].ratePlanType&&"group"!=v[0].ratePlanType.toLowerCase()?(i.stepsById.accommodations.ratePlan=v,void 0!=b.merchandisedPromoData&&(i.stepsById.accommodations.merchandisedPromotionData=b.merchandisedPromoData)):(i.stepsById.accommodations.package=[],"Package"==v[0].ratePlanType&&(i.stepsById.accommodations.package=v,i.stepsById.accommodations.placeholder=v[0].ratePlanName)),"group"==v[0].ratePlanType.toLowerCase()){i.stepsById.accommodations.group=[];var h={};h.codeType=v[0].ratePlanType;var R,f=s.getMainReservation(),S=f.posSource.requestorIds;angular.forEach(S,function(e){"group"==e.codeType.toLowerCase()&&(R=e.id)}),h.id=R;var A=n.getHotelInfo().hotelCode,I=s.getLanguage();d.getGSplashDetails(A,v[0].ratePlanType,R,I).then(function(e){void 0!=e.data.groupRules&&(t.hidePriceFromAttendees=e.data.groupRules.hidePriceFromAttendees),s.setGroup(e.data),t.$broadcast(l.GROUP_PAYMENT_INCONTEXT),g.setUserTiming("Interaction","CodeWIdget"),void 0!=s.getGroup().groupName&&(h.name=s.getGroup().groupName),i.stepsById.accommodations.group.push(h),i.stepsById.accommodations.placeholder=h.name,t.groupRatePlanName=h.name})}a.debug(JSON.stringify(i)+"navDataFactory"),b.roomStays[0].total.amountAfterTax,i.stepsById.total.placeholder=s.getTotalReservationAmount(),i.navToggle.totalSelected=!0}}),o.navToggle=i.navToggle,o.goToView=function(e,a){t.toggle.intlMenu=!1,g.deleteObjectData("stateObj"),g.setObjectData("stateObj",{stateToGo:e,isSelected:a}),t.propertyDetailsGSplash="display-none",!0===s.getConfig("modifyRetrieveEH")&&s.getCurrencyDetails().isMerchandisedCurrency?t.$broadcast("EVENT.GO_TO_PAGE_ON_CLICK_GNB"):"accommodation.room"!=e?a&&("total"==e&&t.MRB?S(e):(r.go(e),t.toggle.collapse=!0)):a&&(1==t.isPackage?r.go("accommodation.package"):r.go("accommodation.room"),t.toggle.collapse=!0)},o.$on("EVENT.CALL_GO_TO_VIEW_FROM_GNB",function(){var e=g.getObjectData("stateObj");o.goToView(e.stateToGo,e.isSelected)}),t.$on(l.LANG_CHANGE,function(){o.langObj={language:s.getLanguage()}}),t.$on("EVENT.HOTEL_DATA_UPDATED",function(){o.propertyHostName=n.getHotelDescUpdated().hotelName}),t.toggle={intlMenu:!1,collapse:!0,accommodationDraw:!1},t.openDrawer=function(){t.toggle.accommodationDraw=!0},t.closeDrawer=function(){t.toggle.accommodationDraw=!1},o.removeAccommodation=function(e,a){void 0!=e.packageCode?(i.stepsById.accommodations.rooms=[],void 0==i.stepsById.accommodations.group&&(i.stepsById.accommodations.placeholder=t.translate.global_header_lblSelect),s.revertAccommadations(),t.packageRemoved=!0,t.$broadcast(l.REMOVE_ACCOMMODATION),r.go("accommodation.package"),t.toggle.collapse=!0):(1==s.getConfig("modifyRetrieveEH")?t.$broadcast(l.EXTENDHOLD_REMOVE_ROOM):t.$broadcast(l.REMOVE_ACCOMMODATION),t.toggle.collapse=!0)},o.$on("EVENT.CHANGE_TOTAL_PLACEHOLDER",function(){t.navData.total.placeholder=e("currencyConversionWithTwoDecimalPlaces")(0),o.navToggle.totalSelected=!1}),o.$on("EVENT.CONFIRM_DELETE_ROOM",function(){t.navData.total.placeholder=e("currencyConversionWithTwoDecimalPlaces")(0),o.navToggle.totalSelected=!1,g.isMultiRateListView(c.innerWidth)}),o.$on("EVENT.CONTINUE_MODIFY",function(){o.navToggle.totalSelected=!1,t.navData.total.placeholder=e("currencyConversionWithTwoDecimalPlaces")(0)}),o.removeRatePlan=function(e){1==s.getConfig("modifyRetrieveEH")?t.$broadcast(l.EXTENDHOLD_REMOVE_RATEPLAN):t.$broadcast(l.REMOVE_RATEPLAN),t.toggle.collapse=!0},o.removeRatePlanMRBDrawer=function(e){t.deleteRateFromRoom=e,o.removeRatePlan()},o.$on("EVENT.CONFIRM_DELETE_RATEPLAN",function(){t.navData.total.placeholder=e("currencyConversionWithTwoDecimalPlaces")(0),o.navToggle.totalSelected=!1}),o.removePackage=function(e){1==s.getConfig("modifyRetrieveEH")?t.$broadcast(l.EXTENDHOLD_REMOVE_PACKAGE):t.$broadcast(l.REMOVE_PACKAGE),t.toggle.collapse=!0},o.removePackageMRBDrawer=function(e){t.deletePackageFromRoom=e,o.removePackage()},o.removeGroup=function(e){u.scrollTopAnimated(0,1e3),o.deleteGroup="display-block",t.toggle.collapse=!0,setTimeout(function(){p.onModalOpen("add-code-dropdown-id","delete-group-parent-id","delete-group-title-id",!0,o.cancelDeleteGroup)})},o.$on("EVENT.GMS_OPENED",function(){o.deleteGroup="display-none"});var D=function(){t.accommodations=!1;var e;void 0!=t.navData.accommodations&&void 0!=t.navData.accommodations.group&&(e=t.navData.accommodations.group[0]),s.deleteGroupCode(e),i.stepsById.accommodations={id:"accommodations",label:"Accommodations",placeholder:"Select",placeholderMRB:i.stepsById.accommodations.placeholderMRB,className:"Header-step--extended",rooms:[]},s.revertAccommadationRooms(),s.revertAccommadationRatePlan(),s.revertServices(),s.deleteAllCodeByKey(s.getCodeTypes()),s.deleteCodeTypeByIndex(),(!s.getCodeTypes()||s.getCodeTypes().length<=0)&&(o.placeHolder=!1),a.debug(s.getMainReservation()),o.showGroupModal="display-none"};o.$on("EVENT.DELETE_GROUP",function(e,a){o.removeGroup()}),o.continueDeleteGroup=function(){s.deleteConfig("GROUP_FPDISABLED"),g.isMultiRateListView(c.innerWidth),D(),"display-block"==o.deleteGroup&&p.onModalClose(),o.deleteGroup="display-none",t.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),t.MRB?(s.reverMainReservationArrayAfterAddGroupCode(),t.MRB&&(t.roominContext=!1),"guestsandrooms"==r.current.name?(s.setConfig("CHANGE_OCCUPANTS"),r.go(".",{},{reload:!0})):(s.setConfig("CHANGE_OCCUPANTS"),r.go("guestsandrooms"))):"datesofstay"==r.current.name?r.go(".",{},{reload:!0}):"guestsandrooms"!=r.current.name?r.go("datesofstay"):"guestsandrooms"==r.current.name&&t.$broadcast("EVENT.DELETED_GROUP"),s.getCodeTypes()&&!(s.getCodeTypes().length<=0)||s.getPromotionInContext()||y.checkGmsLogin()||(s.setDisplayPromotions(!0),t.$broadcast("PROMOTIONS_DISPLAY_ON_BE"))},o.cancelDeleteGroup=function(){o.deleteGroup="display-none",p.onModalClose()},o.selectAccommodation=function(e){void 0!=s.getMainReservation().resGlobalInfo.timeSpan&&void 0!=s.getMainReservation().resGlobalInfo.timeSpan.start&&"is-active"!=t.accommodationClass&&(t.packageRemoved=!1,t.isPackage=!1,"is-active"!=t.accommodationClass&&s.setConfig("OPEN_ROOM_DETAIL"),r.go("accommodation.room"),t.toggle.collapse=!0)},o.selectAccommodationMRBDrawer=function(e){void 0!=s.getMainReservation().resGlobalInfo.timeSpan&&void 0!=s.getMainReservation().resGlobalInfo.timeSpan.start&&"is-active"!=t.accommodationClass&&(i.stepsById.accommodations.rooms=[],i.stepsById.accommodations.rooms.push(e.roomStays[0].roomRates[0]),s.changeSelectRoom(e.id),o.selectAccommodation(e),t.$broadcast(l.MODIFY_RESERVATION))},o.goPackage=function(){void 0!=s.getMainReservation().resGlobalInfo.timeSpan&&void 0!=s.getMainReservation().resGlobalInfo.timeSpan.start&&("is-active"!=t.accommodationClass?(t.isPackage=!0,"is-active"!=t.accommodationClass&&(s.setConfig("OPEN_PACKAGE_DETAIL"),s.setConfig("SET_PACKAGE_PLACEHOLDER"),s.setConfig("OPEN_PACKAGE_MRBDRAWER")),r.go("accommodation.package")):(t.$broadcast("EVENT.REVIEW_PACKAGE"),s.setConfig("OPEN_PACKAGE_DETAIL"),s.setConfig("SET_PACKAGE_PLACEHOLDER"),s.setConfig("OPEN_PACKAGE_MRBDRAWER"),r.go("accommodation.package")),t.toggle.collapse=!0)},o.goPackageMRBDrawer=function(e){void 0!=s.getMainReservation().resGlobalInfo.timeSpan&&void 0!=s.getMainReservation().resGlobalInfo.timeSpan.start&&"is-active"!=t.accommodationClass&&(i.stepsById.accommodations.package=[],i.stepsById.accommodations.package.push(e.roomStays[0].ratePlans[0]),s.changeSelectRoom(e.id),t.isPackage=!0,s.setConfig("OPEN_PACKAGE_DETAIL"),s.setConfig("SET_PACKAGE_PLACEHOLDER"),s.setConfig("OPEN_PACKAGE_MRBDRAWER"),t.$broadcast(l.MODIFY_RESERVATION),r.go("accommodation.package"))},o.openGrpSplash=function(){R.executeAfterCookieBanner().then(function(){o.reviewGroupDetails=!0,t.$broadcast("EVENT.REVIEW_GRP_DETAILS"),t.toggle.collapse=!0})},o.$on("EVENT.RES_SELECTION_CHANGE_GROUP",function(e,o){var r=s.getAllCode();if(void 0!=r&&Object.keys(r).length>0){var n=s.getCodeTypes();a.debug(JSON.stringify(n)+"  reservation Code type in Acco");for(var l=0;l<n.length;l++)if("group"==n[l].toLowerCase()){t.accommodations=!0,void 0==i.stepsById.accommodations.group&&(i.stepsById.accommodations.group=[]);var c={};c.codeType=n[l],c.id=s.getCodeValue(n[l]),void 0!=s.getGroup().groupName&&(c.name=s.getGroup().groupName),i.stepsById.accommodations.group.push(c),i.stepsById.accommodations.placeholder=c.name}}}),o.$on("EVENT.UPDATE_NAVBAR_FROM_MANAGE_URL",function(){c.baseRes&&c.baseRes.roomStays[0].ratePlans.length>0&&"Package"!==c.baseRes.roomStays[0].ratePlans[0].ratePlanType&&"Group"!==c.baseRes.roomStays[0].ratePlans[0].ratePlanType&&(t.accommodations=!0,void 0!==c.baseRes.roomStays[0].roomRates[0].roomTypeName?(i.stepsById.accommodations.placeholder=c.baseRes.roomStays[0].roomRates[0].roomTypeName,angular.forEach(c.baseRes.roomStays[0].roomRates,function(e){i.stepsById.accommodations.rooms.push(e),i.stepsById.accommodations.placeholder=e.roomTypeName})):i.stepsById.accommodations.placeholder=c.baseRes.roomStays[0].ratePlans[0].ratePlanName,void 0!==c.baseRes.roomStays[0].ratePlans&&c.baseRes.roomStays[0].ratePlans.length>0&&void 0!==c.baseRes.roomStays[0].ratePlans[0].ratePlanName?(i.stepsById.accommodations.ratePlan=[],i.stepsById.accommodations.ratePlan.push(c.baseRes.roomStays[0].ratePlans[0])):t.accommodations=!1),g.setObjectData("UPDATED_NAV_DATA_MANAGE_URL",!0)}),o.$on("EVENT.UPDATE_NAVBAR_FROM_PROMOTION",function(){i.stepsById.accommodations.rooms=[],t.translate&&t.translate.global_header_lblSelect&&i&&i.stepsById&&i.stepsById.accommodations&&(i.stepsById.accommodations.placeholder=t.translate.global_header_lblSelect),delete i.stepsById.accommodations.ratePlan,delete i.stepsById.accommodations.package,t.navData.total.placeholder=e("currencyConversionWithTwoDecimalPlaces")(0),o.navToggle.totalSelected=!1,t.accommodations=!0,void 0!=s.getMainReservation().roomStays[0].ratePlans&&s.getMainReservation().roomStays[0].ratePlans.length>0&&("Package"==s.getMainReservation().roomStays[0].ratePlans[0].ratePlanType||"Regular"==s.getMainReservation().roomStays[0].ratePlans[0].ratePlanType)&&s.getMainReservation().roomStays[0].ratePlans?(void 0!=s.getMainReservation().roomStays[0].ratePlans[0].ratePlanName&&(i.stepsById.accommodations.placeholder=s.getMainReservation().roomStays[0].ratePlans[0].ratePlanName),"Regular"==s.getMainReservation().roomStays[0].ratePlans[0].ratePlanType?i.stepsById.accommodations.ratePlan=s.getMainReservation().roomStays[0].ratePlans:"Package"==s.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&(i.stepsById.accommodations.package=[],i.stepsById.accommodations.package=s.getMainReservation().roomStays[0].ratePlans,s.setConfig("OPEN_PACKAGE_DETAIL_PROMOTIONS"))):t.accommodations=!1}),o.$on(l.CHANGE_PLACEHOLDER,function(){void 0!=s.getMainReservation().roomStays[0].ratePlans&&s.getMainReservation().roomStays[0].ratePlans.length>0&&("Package"==s.getMainReservation().roomStays[0].ratePlans[0].ratePlanType||"Group"==s.getMainReservation().roomStays[0].ratePlans[0].ratePlanType)&&s.getMainReservation().roomStays[0].ratePlans?void 0!=s.getMainReservation().roomStays[0].ratePlans[0].ratePlanName&&(i.stepsById.accommodations.placeholder=s.getMainReservation().roomStays[0].ratePlans[0].ratePlanName):void 0!=s.getMainReservation().roomStays[0].roomRates[0].roomTypeName&&(i.stepsById.accommodations.placeholder=s.getMainReservation().roomStays[0].roomRates[0].roomTypeName),t.accommodations=!0}),1==s.getConfig("SET_ACCOMMODATION_PLACEHOLDER")&&(t.accommodations=!0,i.stepsById.accommodations.placeholder=s.getMainReservation().roomStays[0].roomRates[0].roomTypeName,s.deleteConfig("SET_ACCOMMODATION_PLACEHOLDER")),1==s.getConfig("SET_PACKAGE_PLACEHOLDER")&&(t.accommodations=!0,i.stepsById.accommodations.placeholder=s.getMainReservation().roomStays[0].ratePlans[0].ratePlanName,s.deleteConfig("SET_PACKAGE_PLACEHOLDER")),o.$on("EVENT.EMPTY_CHILDREN_DROPDOWN",function(){var e,a,t,o,r;if(void 0!=s.getMainReservation().resGlobalInfo&&void 0!=s.getMainReservation().resGlobalInfo.guestCounts&&s.getMainReservation().resGlobalInfo.guestCounts.length>0){e=0,a=0,t=0;for(var n=0;n<s.getMainReservation().resGlobalInfo.guestCounts.length;n++)"10"==s.getMainReservation().resGlobalInfo.guestCounts[n].ageQualifyingCode&&(e+=s.getMainReservation().resGlobalInfo.guestCounts[n].count),"8"==s.getMainReservation().resGlobalInfo.guestCounts[n].ageQualifyingCode&&(a+=s.getMainReservation().resGlobalInfo.guestCounts[n].count),"7"==s.getMainReservation().resGlobalInfo.guestCounts[n].ageQualifyingCode&&(t+=s.getMainReservation().resGlobalInfo.guestCounts[n].count)}r=angular.copy(i.stepsById.guestsrooms.placeholder.split("/")[1]),o=parseInt(e)+parseInt(a)+parseInt(t),i.stepsById.guestsrooms.placeholder=o+" / "+r}),o.clickInternationBar=function(){t.$broadcast("CancelAddCode"),t.$broadcast("CancelAccommodation"),1!=t.navBarDisabled&&(t.toggle.intlMenu=!t.toggle.intlMenu,t.toggle.collapse=!0,t.propertyDetailsGSplash="display-none",setTimeout(function(){if(void 0!=document.getElementById("language")){document.getElementById("language").focus()}},0))},o.setFocusOnInternationalBar=function(){t.$broadcast("CancelAddCode"),t.$broadcast("CancelAccommodation"),setTimeout(function(){if(void 0!=document.getElementById("language")){document.getElementById("language").focus()}},0)},o.OpenSwitchRoom=function(e){t.disableBookMRB=!0;for(var a=!1,r=0;r<s.getMainReservationArray().length;r++)if(void 0!=s.getMainReservationArray()[r].roomStays[0].roomRates[0].roomTypeCode&&void 0!=s.getMainReservationArray()[r].roomStays[0].ratePlans&&s.getMainReservationArray()[r].roomStays[0].ratePlans.length>0&&void 0!=s.getMainReservationArray()[r].roomStays[0].ratePlans[0].ratePlanType){a=!0;break}1==a&&(t.disableBookMRB=!1),t.switchRoom="display-block",u.scrollTopAnimated(0,1e3),setTimeout(function(){p.onModalOpen("manage-rooms-link-id","manage-room-parent-id","manage-room-focus-id",!1,o.closeSwitchRoom)}),e&&e.preventDefault()},o.closeSwitchRoom=function(){t.switchRoom="display-none",p.onModalClose()},s.getConfig("Manager_Url_MRB")&&(P(),s.deleteConfig("Manager_Url_MRB")),o.deleteCurrentRoom=function(e){o.packageSelected=!1,t.deleteReservation=angular.copy(e),s.setConfig("delete_room_in_roomselector"),t.$broadcast(l.REMOVE_ACCOMMODATION);for(var a,r=0;r<s.getMainReservationArray().length;r++)if(s.getMainReservationArray()[r].id==e.id){a=r,a++;break}$analytics.eventTrack("RemoveRoom",{category:"UserNavigation",label:a})}}function setHeightToNavbarDynamically(e,a,t,o){return{restrict:"A",link:function(r,n,i){var s,l,c=0;r.$watch(function(){var e=n[0].offsetHeight,a=document.getElementById("Site-pageWrapperId");!a||e==c&&a.style&&a.style.marginTop||(a.style.marginTop=e+"px",c=e)}),e.on("scroll",function(){o.isProgressBarEnabled&&(s||l||(s=t(function(){var e=n[0].offsetHeight,a=document.getElementById("Site-pageWrapperId");!a||e==c&&a.style&&a.style.marginTop||(a.style.marginTop=e+"px",c=e)}),l=a(function(){t.cancel(s),s=null,l=null},6e3)))})}}}function navBar(){return{restrict:"E",templateUrl:"./navbar/navbar.html",controller:NavbarController}}function navBarAccommodationsDrawer(){return{restrict:"E",templateUrl:"./navbar/navbarAccommodationsDrawer.html",replace:"true"}}function navBarMultiroomDrawer(){return{restrict:"E",templateUrl:"./navbar/navbarMultiroomDrawer.html",replace:"true"}}function navDataFactory(e,a,t){return t.translate=a.getTranslation(),{stepsById:{guestsrooms:{id:"guestsrooms",label:"Guests & Rooms",placeholder:e.formatGuestsAndRooms()},dates:{id:"dates",label:"Dates of Stay",placeholder:e.formatNavDates(),startDate:e.getMainReservation().resGlobalInfo.timeSpan.start,endDate:e.getMainReservation().resGlobalInfo.timeSpan.end},accommodations:{id:"accommodations",label:"Accommodations",placeholder:"Select",placeholderMRB:0,className:"Header-step--extended",rooms:[]},total:{id:"total",label:"Total",placeholder:e.getTotalReservationAmount(),className:"Header-step--total"}},steps:["guestsrooms","dates","accommodations","total"],navToggle:{datesSelected:void 0!=e.getMainReservation().resGlobalInfo.timeSpan.start,accommodationSelected:!1,totalSelected:!1}}}function paymentComponent(e,a,t,o,r){return{restrict:"E",scope:{depositAmount:"=",totalAmount:"=",languageCode:"=",translationLabels:"=",reservationPolicies:"=",billingAddress:"=",enableMandatoryCreditCardFields:"=",collapseOnMobileView:"=",isBrainTreePaymentEnabled:"=",isAmadeusPaymentEnabled:"=",reservationList:"=",bookerInfo:"="},templateUrl:"./payment-component/payment-component.template.html",link:function(n){function i(){n.paymentObj.currencyCode=o.getCurrency()||o.getCurrencyDetails()&&o.getCurrencyDetails().currencyCode}n.paymentObj={templateId:"stock-template",hotelCode:a.getHotelInfo().hotelCode,currencyCode:o.getCurrency()||o.getCurrencyDetails()&&o.getCurrencyDetails().currencyCode,getGuestFieldsConfigurations:r.getGuestFieldsConfigurations(),billingAddressTemplate:"horizontal",disableLoyaltyPointsRedemption:!0},n.isBrainTreePaymentEnabled=o.isBrainTreePaymentEnabled(),n.isAmadeusPaymentEnabled=o.isAmadeusPaymentEnabled();var s=[];e.MRB||s.push(o.getMainReservation()),n.reservationList=e.MRB?o.getMainReservationArray():s,n.configOptions={displayPlaceholders:!0,mopSelectionInSdk:!1,showSecurityHelper:!1,collectCardholderName:!0,showVendor:!1,matAppearance:"fill",matFloatLabels:"always",cardNumberSeparator:"-",billingAddress:!1,overridenLabels:{},iframeStyle:{fontSize:"18px",color:"#444",backgroundColor:"#fff"}},n.bookerInfo={salutation:{enable:!1},firstName:{enable:!1},lastName:{enable:!1},email:{enable:!1}},n.$on("EVENT.CURRENCY_CHANGE",i),n.paymentObj.styles={input:{"font-family":getComputedStyle(t.document.body).getPropertyValue("font-family"),"font-size":"18px","font-weight":"300",transition:"border-color ease-in-out .15s,box-shadow ease-in-out .15s",color:"#444"},"::-webkit-input-placeholder":{color:"lightgrey"},select:{"font-family":getComputedStyle(t.document.body).getPropertyValue("font-family"),"font-size":"18px","font-weight":"300",transition:"border-color ease-in-out .15s,box-shadow ease-in-out .15s",color:getComputedStyle(document.getElementsByClassName("GuestsAndRoomsForm-select")[0]).getPropertyValue("color")},".invalid":{"border-bottom":"1px solid red"}},n.paymentObj.amadeusStyles={".mat-form-field-appearance-fill .mat-form-field-flex":{"background-color":"#fff !important"},".ama-checkout .mat-input-element":{"font-family":getComputedStyle(t.document.body).getPropertyValue("font-family"),"font-size":"18px","font-weight":"300",color:"#444",transition:"border-color ease-in-out .15s,box-shadow ease-in-out .15s","background-color":"#fff"},".ama-checkout .mat-select":{"font-family":getComputedStyle(t.document.body).getPropertyValue("font-family"),"font-size":"18px","font-weight":"300",color:"#444"},"::-webkit-input-placeholder":{
color:"lightgrey"},".ama-checkout .mat-error":{color:getComputedStyle(document.getElementsByClassName("help-inline")[0]).getPropertyValue("color")},".ama-checkout-cvv-icon svg":{fill:getComputedStyle(document.getElementsByClassName("btn-primary-cta")[0]).getPropertyValue("background-color")},".ama-checkout .mat-form-field-label":{color:getComputedStyle(document.getElementsByClassName("GuestsAndRoomsForm-select")[0]).getPropertyValue("color"),"font-family":getComputedStyle(t.document.body).getPropertyValue("font-family"),"font-size":"18px","font-weight":"300"},".ama-checkout .mat-form-field.mat-focused .mat-form-field-label":{color:getComputedStyle(document.getElementsByClassName("GuestsAndRoomsForm-select")[0]).getPropertyValue("color")},".amadeus-hos-res-cn-amadeus-payment-widget-web4-template-wrapper .ama-checkout-address-title":{color:getComputedStyle(document.getElementsByClassName("GuestsAndRoomsForm-select")[0]).getPropertyValue("color")+"!important"},".ama-checkout .mat-form-field.mat-focused .mat-form-field-ripple":{"background-color":getComputedStyle(document.getElementsByClassName("GuestsAndRoomsForm-select")[0]).getPropertyValue("color")},".ama-checkout-inst-info":{"font-size":"14px !important","font-weight":"400 !important","font-family":getComputedStyle(t.document.body).getPropertyValue("font-family")},".ama-checkout-inst-item-total":{"font-family":getComputedStyle(t.document.body).getPropertyValue("font-family")},".ama-checkout-inst-item-interest":{"font-family":getComputedStyle(t.document.body).getPropertyValue("font-family")},".mat-hint":{"font-family":getComputedStyle(t.document.body).getPropertyValue("font-family")},".ama-checkout-address-title":{"font-family":getComputedStyle(t.document.body).getPropertyValue("font-family")},".mat-divider.mat-divider-inset":{"margin-left":"0 !important"},".ama-checkout-inst-item-label > .mat-hint":{display:"none"}};var l=document.querySelector("amadeus-hos-res-wc-payments");n.isAmadeusPaymentEnabled&&(l.setAttribute("amadeus-hos-res-attr-amadeus-payment-template-id","web4"),l.setAttribute("amadeus-hos-res-attr-amadeus-payment-config-options",JSON.stringify(n.configOptions)),l.setAttribute("amadeus-hos-res-attr-amadeus-hosted-fields-styles",JSON.stringify(n.paymentObj.amadeusStyles)))}}}function promotionBanner(e,a,t,o,r){return{restrict:"E",templateUrl:"./promotions/promotionBanner.directive.html",link:function(e){a.getDisplayPromotionBanner()&&(e.promotionBanner=a.getPromotionInContext(),o.enablePromotionBanner=!0,a.setDisplayPromotionBanner(!0),e.promotionBanner&&e.promotionBanner.translations&&e.promotionBanner.translations.length>0&&!e.promotionBanner.translations[0].guestRoomBannerHelpText?o.promotionBannerNoHelpTextGr=!0:o.promotionBannerNoHelpTextGr=!1,e.promotionBanner&&e.promotionBanner.translations&&e.promotionBanner.translations.length>0&&!e.promotionBanner.translations[0].calendarHelpText?o.promotionBannerNoHelpTextCalendar=!0:o.promotionBannerNoHelpTextCalendar=!1),o.$on("ENABLE_PROMOTION_BANNER",function(){e.promotionBanner=a.getPromotionInContext(),o.enablePromotionBanner=!0,a.setDisplayPromotionBanner(!0),e.promotionBanner&&e.promotionBanner.translations&&e.promotionBanner.translations.length>0&&!e.promotionBanner.translations[0].guestRoomBannerHelpText?o.promotionBannerNoHelpTextGr=!0:o.promotionBannerNoHelpTextGr=!1,e.promotionBanner&&e.promotionBanner.translations&&e.promotionBanner.translations.length>0&&!e.promotionBanner.translations[0].calendarHelpText?o.promotionBannerNoHelpTextCalendar=!0:o.promotionBannerNoHelpTextCalendar=!1}),o.$on("DISABLE_PROMOTION_BANNER",function(){o.enablePromotionBanner=!1,a.setDisplayPromotionBanner(!1),o.promotionBannerNoHelpTextGr=!1,o.promotionBannerNoHelpTextCalendar=!1}),e.viewBannerDetails=function(){t.eventTrack("ClickonPromo",{category:"UserNavigation",label:e.promotionBanner.promoName}),a.setPromotionDetailsInContext(e.promotionBanner),o.$broadcast("SHOW_PROMOTIONS_DETAILS_MODAL")},r(function(){var e=document.querySelector("body");if(e){var t=getComputedStyle(e).backgroundColor;if(t){var o=a.lightenDarkenColor(t,-20);if(o){var r=document.createElement("style");r.type="text/css",r.innerHTML=".promotionBanner { background-color: "+o+"}",document.getElementsByTagName("head")&&document.getElementsByTagName("head").length>0&&document.getElementsByTagName("head")[0]&&document.getElementsByTagName("head")[0].appendChild(r)}}}},500)}}}function promotionBannerTotal(e,a){return{restrict:"E",templateUrl:"./promotions/promotionBannerTotal.directive.html",link:function(t){e(function(){var e=document.querySelector("body");if(e){var t=getComputedStyle(e).backgroundColor;if(t){var o=a.lightenDarkenColor(t,-20);if(o){var r=document.createElement("style");r.type="text/css",r.innerHTML=".promotionBanner { background-color: "+o+"}",document.getElementsByTagName("head")&&document.getElementsByTagName("head").length>0&&document.getElementsByTagName("head")[0]&&document.getElementsByTagName("head")[0].appendChild(r)}}}},500)}}}function promotionDetailsModal(e,a,t,o,r,n){return{restrict:"E",templateUrl:"./promotions/promotionDetailsModal.directive.html",link:function(e){e.enablePromotionDetails=!1,e.isSelected=!1,o.$on("SHOW_PROMOTIONS_DETAILS_MODAL",function(){e.promotionDetailsInContext=a.getPromotionDetailsInContext(),e.promotionInContext=a.getPromotionInContext(),e.promotionInContext&&e.promotionDetailsInContext.promotionId==e.promotionInContext.promotionId?e.isSelected=!0:e.isSelected=!1,e.enablePromotionDetails=!0,setTimeout(function(){var a;n.is("guestsandrooms")?a="guestsAndRoomsHeader":n.is("datesofstay")?a="defaultFocus":n.includes("accommodation")&&(a="roomButton"),r.onModalOpen(a,"promotion-details-modals","promotionDetails-body-title-id",!0,e.closePromotionDetails)},0)}),o.$on("REMOVE_PROMOTIONS_AVAILABLE_FROM_API",function(){e.removePromotionDetails=!0,e.promotionInContext=a.getPromotionInContext(),setTimeout(function(){var e;n.is("guestsandrooms")?e="guestsAndRoomsHeader":n.is("datesofstay")?e="defaultFocus":n.includes("accommodation")&&(e="roomButton"),r.onModalOpen(e,"promotion-remove-modals","promotionDetails-remove-message-id",!0)},0)}),e.closePromotionDetails=function(){e.enablePromotionDetails=!1,e.removePromotionDetails=!1,setTimeout(function(){r.onModalClose()},0)},e.bookPromotion=function(){t.eventTrack("BookPromo",{category:"UserNavigation",label:e.promotionDetailsInContext.promoName});var i=a.canModifyReservation();1==a.getConfig("modifyRetrieveEH")?(a.setPromotionObjectInModifyReservation(e.promotionDetailsInContext),e.closePromotionDetails(),e.showModifyRetrieveEHModal="display-block",setTimeout(function(){var a,t;n.is("guestsandrooms")?(a="modify-retreieve-eh-parent-guestsAndRoom-id",t="modify-retreieve-eh-title-guestsAndRoom-id"):n.is("datesofstay")?(a="modify-retreieve-eh-parent-datesOfStay-id",t="modify-retreieve-eh-title-datesOfStay-id"):n.includes("accommodation")&&(a="modify-retreieve-eh-parent-accommodation-id",t="modify-retreieve-eh-title-accommodation-id"),r.onModalOpen("",a,t,!0,e.cancelModifyRetrieveEH)},500)):i&&(n.is("guestsandrooms")||n.is("datesofstay"))&&!o.continueModifyReservation?(a.setPromotionObjectInModifyReservation(e.promotionDetailsInContext),e.closePromotionDetails(),e.retrieveConfirmationPopup="display-block",setTimeout(function(){var a,t;n.is("guestsandrooms")?(a="gnr-retrieve-confirmation-parent-id",t="gnr-retrieve-confirmation-title-id"):n.is("datesofstay")&&(a="dos-retrieve-confirmation-parent-id",t="dos-retrieve-confirmation-title-id"),r.onModalOpen("",a,t,!0,e.cancelModifyReservation)},500)):(a.setPromotionInContext(e.promotionDetailsInContext),e.closePromotionDetails(),o.$broadcast("DISABLE_RIGHT_RAIL"))},e.removePromotion=function(){t.eventTrack("RemovePromo",{category:"UserNavigation",label:e.promotionInContext&&e.promotionInContext.promoName?e.promotionInContext.promoName:void 0}),a.removePromotionFromContext(),e.closePromotionDetails()}}}}function replaceNumberDealsCarousal(e){return function(a,t,o){if(void 0!=(a=e.translate.global_numberofnumber_CarouselLbl)){return a.replace("#",t+1).replace("#",o)}}}function promotionsRightRail(e,a,t,o,r,n,i,s,l){return{restrict:"E",templateUrl:"./promotions/promotionsRightRail.directive.html",link:function(c,d,g){var m=g.pageLocation;c.hideAdvt=s.manageUrlParams.hideadvt,c.promotionsSlides=a.getPromotionsList(),c.slides=e.filter(c.promotionsSlides,function(e){return e.displayLocations.indexOf(m)>-1}),o.enableRightRail=a.getDisplayPromotions()&&c.slides.length&&!c.hideAdvt,o.$on("PROMOTIONS_DISPLAY_ON_BE",function(){o.enableRightRail=!1,c.promotionsSlides=a.getPromotionsList(),c.slides=e.filter(c.promotionsSlides,function(e){return e.displayLocations.indexOf(m)>-1}),c.slides&&c.slides.length>0&&c.slides.sort(function(e,a){return e.rank<a.rank?-1:e.rank>a.rank?1:0}),r(function(){e.forEach(c.slides,function(e,a){0==a?(e.active=!0,e.activeIndex=!0):(e.active=!1,e.activeIndex=!1)}),o.enableRightRail=a.getDisplayPromotions()&&c.slides.length&&!c.hideAdvt},0)}),c.hidePromotionsRightRail=function(){o.enableRightRail=!1,a.setDisplayPromotions(!1)},c.$on("$locationChangeStart",function(){o.enableRightRail=!1,c.slides=e.filter(c.promotionsSlides,function(e){return e.displayLocations.indexOf(m)>-1}),c.slides&&c.slides.length>0&&c.slides.sort(function(e,a){return e.rank<a.rank?-1:e.rank>a.rank?1:0}),r(function(){e.forEach(c.slides,function(e,a){0==a?(e.active=!0,e.activeIndex=!0):(e.active=!1,e.activeIndex=!1)}),o.enableRightRail=a.getDisplayPromotions()&&c.slides.length&&!c.hideAdvt},0)}),c.viewPromotionDetails=function(e){if(!e.uxAdStyling.hideCallToActionButtonFlag){if(!e.promotionId&&e.uxAdStyling.urlBehindCallToActionButton){if(e.uxAdStyling.goToExternalSiteFlag){var r=e.uxAdStyling.urlBehindCallToActionButton;return void s.open(r)}var r=e.uxAdStyling.urlBehindCallToActionButton;return void l.startNewReservation(r)}t.eventTrack("ClickonPromo",{category:"UserNavigation",label:e.promoName}),a.setPromotionDetailsInContext(e),o.$broadcast("SHOW_PROMOTIONS_DETAILS_MODAL")}},o.$on("DISABLE_RIGHT_RAIL",function(){c.hidePromotionsRightRail()}),c.bookPromotionFromRightRail=function(e){if(!e.uxAdStyling.hideCallToActionButtonFlag){if(!e.promotionId&&e.uxAdStyling.urlBehindCallToActionButton){if(e.uxAdStyling.goToExternalSiteFlag){var r=e.uxAdStyling.urlBehindCallToActionButton;return void s.open(r)}var r=e.uxAdStyling.urlBehindCallToActionButton;return void l.startNewReservation(r)}t.eventTrack("BookPromo",{category:"UserNavigation",label:e.promoName});var d=a.canModifyReservation();1==a.getConfig("modifyRetrieveEH")?(a.setPromotionObjectInModifyReservation(e),c.showModifyRetrieveEHModal="display-block",setTimeout(function(){var e,a;n.is("guestsandrooms")?(e="modify-retreieve-eh-parent-guestsAndRoom-id",a="modify-retreieve-eh-title-guestsAndRoom-id"):n.is("datesofstay")?(e="modify-retreieve-eh-parent-datesOfStay-id",a="modify-retreieve-eh-title-datesOfStay-id"):n.includes("accommodation")&&(e="modify-retreieve-eh-parent-accommodation-id",a="modify-retreieve-eh-title-accommodation-id"),i.onModalOpen("",e,a,!0,c.cancelModifyRetrieveEH)},500)):d&&(n.is("guestsandrooms")||n.is("datesofstay"))&&!o.continueModifyReservation?(a.setPromotionObjectInModifyReservation(e),c.retrieveConfirmationPopup="display-block",setTimeout(function(){var e,a;n.is("guestsandrooms")?(e="gnr-retrieve-confirmation-parent-id",a="gnr-retrieve-confirmation-title-id"):n.is("datesofstay")&&(e="dos-retrieve-confirmation-parent-id",a="dos-retrieve-confirmation-title-id"),i.onModalOpen("",e,a,!0,c.cancelModifyReservation)},500)):(a.setPromotionInContext(e),c.hidePromotionsRightRail())}},c.viewThroughPromotions=function(){t.eventTrack("viewthruthecarouselads",{category:"UserNavigation",label:"View promotions"})},r(function(){var e=document.querySelector("body");if(e){var t=getComputedStyle(e).backgroundColor;if(t){var o=a.lightenDarkenColor(t,-20);if(o){var r=document.createElement("style");r.type="text/css",r.innerHTML=".rightRailCarousal-desktop-solidColorTemplate { background-color: "+o+"}",document.getElementsByTagName("head")&&document.getElementsByTagName("head").length>0&&document.getElementsByTagName("head")[0]&&document.getElementsByTagName("head")[0].appendChild(r);var r=document.createElement("style");r.type="text/css",r.innerHTML=".rightRailCarousal-mobile-border { background-color: "+o+"; border-color: "+o+";}",document.getElementsByTagName("head")&&document.getElementsByTagName("head").length>0&&document.getElementsByTagName("head")[0]&&document.getElementsByTagName("head")[0].appendChild(r)}}}},500)}}}function apiFunction(e,a,t,o,r,n,i,s,l,c,d){function g(e){var a="";return console.log("__GMS_ABANDONMENT_VALUES__ "+JSON.stringify(t.__GMS_ABANDONMENT_VALUES__)),void 0!=t.__GMS_ABANDONMENT_VALUES__&&(""!=__GMS_ABANDONMENT_VALUES__.pushListId&&(a="&push_list_id="+__GMS_ABANDONMENT_VALUES__.pushListId),""!=__GMS_ABANDONMENT_VALUES__.uniqueSig&&(a=a+"&signature="+__GMS_ABANDONMENT_VALUES__.uniqueSig)),a}var m,u,p=t.apiUrl,y=t.incertVoucherUrl,v=t.clickStreamUrl,h=t.HotelDescriptiveInfo2,R=h.hotelCode,f=function(e,a){var t=e;return void 0!=a&&(t=e.replace("[context_path]",a)),t},C=function(e){var a=r.defer();return o.get(e).success(function(e){n.debug(e+"the data in apifactory"),a.resolve(e)}).error(function(e){n.debug("getAPI-error"),a.reject(e.errorsAndWarnings)}),n.debug(a.promise+"this is deferred.promise"),a.promise},P=function(e){var a=r.defer();return o.get(e,{cache:!0}).success(function(e){a.resolve(e)}).error(function(e){void 0!=e?a.reject(e.errorsAndWarnings):a.reject(e)}),a.promise};return{callExtendHold:function(e,a){var t={method:"POST",url:f(p,"ibe-book/v1")+"/hotel/"+a+"/hold-reservation/exd-hold",headers:{"Content-Type":"application/json; charset=UTF-8"},data:e};return o(t)},retrieveExtendHold:function(e,a,t,r){var i=f(p,"ibe-book/v1")+"/hotel/"+e+"/reservation/"+a+"/exd-reservation?email="+t+"&lang="+r;return n.debug(i+"this is url"),o.get(i,{cache:!1})},getInfo:function(e,a){var t=f(p,"ibe-entity/v1")+"/hotel/"+e+"/info?lang="+a;return C(t)},getTranslations:function(e,a){var t=f(p,"ibe-entity/v1")+"/hotel/"+e+"/info/text-translations?lang="+a;return n.debug(t+"this is url"),C(t)},validateCodes:function(e,a,t,r){var i=f(p,"ibe-codes/v1")+"/hotel/"+e+"/specialcodes/"+a+"/";return"group"===a&&(i+="attendee/"),i+=t,1==r&&(i=i+"?userLoggedIn="+r),n.debug(i),n.debug(i),o.get(i)},getGSplashDetails:function(e,a,t,r){var i=f(p,"ibe-codes/v1")+"/hotel/"+e+"/specialcodes/group/attendee/"+t+"?lang="+r;return n.debug(i),o.get(i)},getBasicAvail:function(t,i,s,d,g,u,y,v){var h,R,C,P;if(d){var S=!1;if(void 0==t.allCodes&&void 0!=t.groupCode&&(R=t.groupCode,S=!0),void 0!=t.allCodes&&Object.keys(t.allCodes).length>0){for(M=0;M<Object.keys(t.allCodes).length;M++)if("travelagent"===Object.keys(t.allCodes)[M].toLowerCase()){var A=t.allCodes.TravelAgent?t.allCodes.TravelAgent:t.allCodes.travelagent;C=A}}else void 0!=t.taCode&&(C=t.taCode);if(void 0!=t.allCodes&&Object.keys(t.allCodes).length>0){for(M=0;M<Object.keys(t.allCodes).length;M++)if("discount"===Object.keys(t.allCodes)[M].toLowerCase()){var I=t.allCodes.Discount?t.allCodes.Discount:t.allCodes.discount;P=I}}else void 0!=t.Discount&&(P=t.Discount);if(void 0!=t.allCodes&&Object.keys(t.allCodes).length>0){for(M=0;M<Object.keys(t.allCodes).length;M++)if("corporate"===Object.keys(t.allCodes)[M].toLowerCase()){var h=t.allCodes.Corporate?t.allCodes.Corporate:t.allCodes.corporate;h=h,S=!0}}else void 0!=t.Corporate&&(h=t.Corporate,S=!0);var b=!1;if(void 0!=t.allCodes&&Object.keys(t.allCodes).length>0)for(M=0;M<Object.keys(t.allCodes).length;M++)if(1!=b&&"group"===Object.keys(t.allCodes)[M].toLowerCase()){b=!0;var D=t.allCodes.Group?t.allCodes.Group:t.allCodes.group;R=D,S=!0}if(!S){var T=a.gmsPromoCode;""!=T&&void 0!=T&&(h=T)}}if(1==d&&1!=g){n.debug(JSON.stringify(i)+"reservationServiceArray in date");var O=angular.copy(i),E={};E.hotelCode=O[0].hotelCode,E.lang=O[0].languageCode,void 0!=t.currencyCode&&(E.currency=t.currencyCode),void 0!=t.bookerIdentifier&&(E.bookerIdentifier=t.bookerIdentifier),void 0!=t.partnerIdentifier&&(E.partnerIdentifier=t.partnerIdentifier),void 0!=O[0].roomStays&&O[0].roomStays.length>0&&void 0!=O[0].roomStays[0].ratePlans&&O[0].roomStays[0].ratePlans.length>0&&"Group"!=O[0].roomStays[0].ratePlans[0].ratePlanType&&(E.ratePlanCode=O[0].roomStays[0].ratePlans[0].ratePlanCode,E.ratePlanType=O[0].roomStays[0].ratePlans[0].ratePlanType),E.dateIn=t.dateIn,E.dateOut=t.dateOut;var S=!1;if(void 0==t.allCodes&&void 0!=t.groupCode&&(j+="groupCode="+t.groupCode+"&",S=!0),void 0!=t.allCodes&&Object.keys(t.allCodes).length>0){for(M=0;M<Object.keys(t.allCodes).length;M++)if("travelagent"===Object.keys(t.allCodes)[M].toLowerCase()){var A=t.allCodes.TravelAgent?t.allCodes.TravelAgent:t.allCodes.travelagent;j+="taCode="+A+"&"}}else void 0!=t.taCode&&(j+="taCode="+t.taCode+"&");if(void 0!=t.allCodes&&Object.keys(t.allCodes).length>0){for(M=0;M<Object.keys(t.allCodes).length;M++)if("discount"===Object.keys(t.allCodes)[M].toLowerCase()){var I=t.allCodes.Discount?t.allCodes.Discount:t.allCodes.discount;j+="discountCode="+I+"&"}}else void 0!=t.Discount&&(j+="discountCode="+t.Discount+"&");if(void 0!=t.allCodes&&Object.keys(t.allCodes).length>0){for(M=0;M<Object.keys(t.allCodes).length;M++)if("corporate"===Object.keys(t.allCodes)[M].toLowerCase()){var h=t.allCodes.Corporate?t.allCodes.Corporate:t.allCodes.corporate;j+="corpCode="+h+"&",S=!0}}else void 0!=t.Corporate&&(j+="corpCode="+t.Corporate+"&",S=!0);var b=!1;if(void 0!=t.allCodes&&Object.keys(t.allCodes).length>0)for(M=0;M<Object.keys(t.allCodes).length;M++)if(1!=b&&"group"===Object.keys(t.allCodes)[M].toLowerCase()){b=!0;var D=t.allCodes.Group?t.allCodes.Group:t.allCodes.group;j+="groupCode="+D+"&",S=!0}if(!S){var T=a.gmsPromoCode;""!=T&&void 0!=T&&(j+="corpCode="+T+"&")}h&&(E.corpCode=h),R&&(E.groupCode=R),C&&(E.taCode=C),P&&(E.discountCode=P),O[0].roomStays[0].roomRates.length>0&&void 0!=O[0].roomStays[0].roomRates[0].roomTypeCode&&(E.roomTypeCode=O[0].roomStays[0].roomRates[0].roomTypeCode),l.getIsLoyaltyReservationEnabled()&&(l.getIsBrandBarDisplay()||c.getMenubarEnabled())&&l.getLoyaltyTierId()&&(E.tierId=l.getLoyaltyTierId()),E.multiRoomOccupancy=[];for(var M=0;M<O.length;M++){for(var _={},k=0,N=[],L=void 0,G=0;G<O[M].resGlobalInfo.guestCounts.length;G++)if("10"==O[M].resGlobalInfo.guestCounts[G].ageQualifyingCode&&(_.adults=O[M].resGlobalInfo.guestCounts[G].count),"7"==O[M].resGlobalInfo.guestCounts[G].ageQualifyingCode&&(_.infant=O[M].resGlobalInfo.guestCounts[G].count),"8"==O[M].resGlobalInfo.guestCounts[G].ageQualifyingCode&&(k=parseInt(O[M].resGlobalInfo.guestCounts[G].count)+k,O[M].resGlobalInfo.guestCounts[G].count))for(var F=0;F<O[M].resGlobalInfo.guestCounts[G].count;F++)void 0!=O[M].resGlobalInfo.guestCounts[G].age&&(N.push(O[M].resGlobalInfo.guestCounts[G].age.toString()),L=N.join(","));_.children=k,void 0!=L&&(_.childrenAges=L),E.multiRoomOccupancy.push(_)}if(n.debug(JSON.stringify(E)+"requestBody"),y&&void 0!=y.guestInfo&&void 0!=y.guestInfo.loyalty&&y.guestInfo.loyalty.length>0&&!0===y.guestInfo.loyalty[0].requireRestrictionCheck&&v&&void 0!=v.offerId&&void 0!=v.guestId){var B=E;B.offerId=v.offerId,B.guestId=v.guestId;var x,w={method:"POST",url:f(p,"ibe-shop/v1")+"/hotel/"+t.hotelCode+"/basicavail/mashup",data:B};e.get("mashupCache")||(mashupCache=e.createCache("mashupCache",{deleteOnExpire:"aggressive",maxAge:3e5,recycleFreq:6e4,storageMode:"sessionStorage"}));var U=JSON.stringify(angular.copy(E)),H=U.split("").reduce(function(e,a){return(e=(e<<5)-e+a.charCodeAt(0))&e},0);if(mashupCache.get(H)){var V=function(e){return r(function(a,t){a(e)})},$=V(mashupCache.get(H));x=$.then(function(e){return e})}else u&&(E.preFetch=!0),a.basicAvailCacheCall=!0,x=o(w).then(function(e){return mashupCache.put(H,e.data),a.basicAvailCacheCall=void 0,e.data})}else{var x,w={method:"POST",url:f(p,"ibe-shop/v1")+"/hotel/"+t.hotelCode+"/basicavail/multi-room",data:E};e.get("availCache")||(m=e.createCache("availCache",{deleteOnExpire:"aggressive",maxAge:3e5,recycleFreq:6e4,storageMode:"sessionStorage"}));var U=JSON.stringify(angular.copy(E)),H=U.split("").reduce(function(e,a){return(e=(e<<5)-e+a.charCodeAt(0))&e},0);if(m.get(H)){var V=function(e){return r(function(a,t){a(e)})},$=V(m.get(H));x=$.then(function(e){return e})}else u&&(E.preFetch=!0),a.basicAvailCacheCall=!0,x=o(w).then(function(e){return m.put(H,e.data),a.basicAvailCacheCall=void 0,e.data})}}else if(1==d&&1==g){n.debug(JSON.stringify(i)+"reservationServiceArray in date");var O=[];O.push(angular.copy(s));var E={};E.hotelCode=O[0].hotelCode,E.lang=O[0].languageCode,void 0!=t.currencyCode&&(E.currency=t.currencyCode),void 0!=O[0].roomStays&&O[0].roomStays.length>0&&void 0!=O[0].roomStays[0].ratePlans&&O[0].roomStays[0].ratePlans.length>0&&"Group"!=O[0].roomStays[0].ratePlans[0].ratePlanType&&(E.ratePlanCode=O[0].roomStays[0].ratePlans[0].ratePlanCode,E.ratePlanType=O[0].roomStays[0].ratePlans[0].ratePlanType),E.dateIn=t.dateIn,E.dateOut=t.dateOut,void 0!=t.bookerIdentifier&&(E.bookerIdentifier=t.bookerIdentifier),void 0!=t.partnerIdentifier&&(E.partnerIdentifier=t.partnerIdentifier),E.multiRoomOccupancy=[],h&&(E.corpCode=h),R&&(E.groupCode=R),C&&(E.taCode=C),P&&(E.discountCode=P),O[0].roomStays[0].roomRates.length>0&&void 0!=O[0].roomStays[0].roomRates[0].roomTypeCode&&(E.roomTypeCode=O[0].roomStays[0].roomRates[0].roomTypeCode),l.getIsLoyaltyReservationEnabled()&&(l.getIsBrandBarDisplay()||c.getMenubarEnabled())&&l.getLoyaltyTierId()&&(E.tierId=l.getLoyaltyTierId());for(var M=0;M<O.length;M++){for(var _={},k=0,N=[],L=void 0,G=0;G<O[M].resGlobalInfo.guestCounts.length;G++)if("10"==O[M].resGlobalInfo.guestCounts[G].ageQualifyingCode&&(_.adults=O[M].resGlobalInfo.guestCounts[G].count),"7"==O[M].resGlobalInfo.guestCounts[G].ageQualifyingCode&&(_.infant=O[M].resGlobalInfo.guestCounts[G].count),"8"==O[M].resGlobalInfo.guestCounts[G].ageQualifyingCode&&(k=parseInt(O[M].resGlobalInfo.guestCounts[G].count)+k,O[M].resGlobalInfo.guestCounts[G].count))for(var F=0;F<O[M].resGlobalInfo.guestCounts[G].count;F++)void 0!=O[M].resGlobalInfo.guestCounts[G].age&&(N.push(O[M].resGlobalInfo.guestCounts[G].age.toString()),L=N.join(","));_.children=k,void 0!=L&&(_.childrenAges=L),E.multiRoomOccupancy.push(_)}if(n.debug(JSON.stringify(E)+"requestBody"),y&&void 0!=y.guestInfo&&void 0!=y.guestInfo.loyalty&&y.guestInfo.loyalty.length>0&&!0===y.guestInfo.loyalty[0].requireRestrictionCheck&&v&&void 0!=v.offerId&&void 0!=v.guestId){var B=E;B.offerId=v.offerId,B.guestId=v.guestId;var x,w={cache:!0,method:"POST",url:f(p,"ibe-shop/v1")+"/hotel/"+t.hotelCode+"/basicavail/mashup",data:B};e.get("mashupCache")||(mashupCache=e.createCache("mashupCache",{deleteOnExpire:"aggressive",maxAge:3e5,recycleFreq:6e4,storageMode:"sessionStorage"}));var U=JSON.stringify(E),H=U.split("").reduce(function(e,a){return(e=(e<<5)-e+a.charCodeAt(0))&e},0);if(mashupCache.get(H)){var V=function(e){return r(function(a,t){a(e)})},$=V(mashupCache.get(H));x=$.then(function(e){return e})}else a.basicAvailCacheCall=!0,u&&(E.preFetch=!0),x=o(w).then(function(e){return mashupCache.put(H,e.data),a.basicAvailCacheCall=void 0,e.data})}else{var x,w={cache:!0,method:"POST",url:f(p,"ibe-shop/v1")+"/hotel/"+t.hotelCode+"/basicavail/multi-room",data:E};e.get("availCache")||(m=e.createCache("availCache",{deleteOnExpire:"aggressive",maxAge:3e5,recycleFreq:6e4,storageMode:"sessionStorage"}));var U=JSON.stringify(E),H=U.split("").reduce(function(e,a){return(e=(e<<5)-e+a.charCodeAt(0))&e},0);if(m.get(H)){var V=function(e){return r(function(a,t){a(e)})},$=V(m.get(H));x=$.then(function(e){return e})}else a.basicAvailCacheCall=!0,u&&(E.preFetch=!0),x=o(w).then(function(e){return m.put(H,e.data),a.basicAvailCacheCall=void 0,e.data})}}else if(y&&void 0!=y.guestInfo&&void 0!=y.guestInfo.loyalty&&y.guestInfo.loyalty.length>0&&!0===y.guestInfo.loyalty[0].requireRestrictionCheck&&v&&void 0!=v.offerId&&void 0!=v.guestId){var E=angular.copy(t);E.offerId=v.offerId,E.guestId=v.guestId;var S=!1;if(void 0==t.allCodes&&void 0!=t.groupCode&&(R=t.groupCode,S=!0),void 0!=t.allCodes&&Object.keys(t.allCodes).length>0){for(M=0;M<Object.keys(t.allCodes).length;M++)if("travelagent"===Object.keys(t.allCodes)[M].toLowerCase()){var A=t.allCodes.TravelAgent?t.allCodes.TravelAgent:t.allCodes.travelagent;C=A}}else void 0!=t.taCode&&(C=t.taCode);if(void 0!=t.allCodes&&Object.keys(t.allCodes).length>0){for(M=0;M<Object.keys(t.allCodes).length;M++)if("discount"===Object.keys(t.allCodes)[M].toLowerCase()){var I=t.allCodes.Discount?t.allCodes.Discount:t.allCodes.discount;P=I}}else void 0!=t.Discount&&(P=t.Discount);if(void 0!=t.allCodes&&Object.keys(t.allCodes).length>0){for(M=0;M<Object.keys(t.allCodes).length;M++)if("corporate"===Object.keys(t.allCodes)[M].toLowerCase()){var h=t.allCodes.Corporate?t.allCodes.Corporate:t.allCodes.corporate;h=h,S=!0}}else void 0!=t.Corporate&&(h=t.Corporate,S=!0);var b=!1;if(void 0!=t.allCodes&&Object.keys(t.allCodes).length>0)for(M=0;M<Object.keys(t.allCodes).length;M++)if(1!=b&&"group"===Object.keys(t.allCodes)[M].toLowerCase()){b=!0;var D=t.allCodes.Group?t.allCodes.Group:t.allCodes.group;R=D,S=!0}if(!S){var T=a.gmsPromoCode;""!=T&&void 0!=T&&(h=T)}if(h&&(E.corpCode=h),R&&(E.groupCode=R),C&&(E.taCode=C),P&&(E.discountCode=P),void 0==E.childrenAges||E.childrenAges&&0===E.childrenAges.length)E.childrenAges=[];else if(Number.isInteger(E.childrenAges)){var q=[];q[0]=E.childrenAges,E.childrenAges=q}else if(!Array.isArray(E.childrenAges)&&E.childrenAges.toString().indexOf(",")>0){var q=[];q=E.childrenAges.split(",");for(var M=0;M<q.length;M++)q[M]=parseInt(q[M],10);E.childrenAges=q}l.getIsLoyaltyReservationEnabled()&&(l.getIsBrandBarDisplay()||c.getMenubarEnabled())&&l.getLoyaltyTierId()&&(E.tierId=l.getLoyaltyTierId());var x,w={cache:!0,method:"POST",url:f(p,"ibe-shop/v1")+"/hotel/"+t.hotelCode+"/basicavail/mashup",data:E};e.get("mashupCache")||(mashupCache=e.createCache("mashupCache",{deleteOnExpire:"aggressive",maxAge:3e5,recycleFreq:6e4,storageMode:"sessionStorage"}));var U=JSON.stringify(angular.copy(E)),H=U.split("").reduce(function(e,a){return(e=(e<<5)-e+a.charCodeAt(0))&e},0);if(mashupCache.get(H)&&1!=a.showPosition){var V=function(e){return r(function(a,t){a(e)})},$=V(mashupCache.get(H));x=$.then(function(e){return e})}else u&&(E.preFetch=!0),x=o(w).then(function(e){return mashupCache.put(H,e.data),a.showPosition=void 0,e.data})}else{n.debug(JSON.stringify(t)+" optionsin API"),n.debug(JSON.stringify(t.hotelCode)+" hotel code in api factory");var Y=f(p,"ibe-shop/v1")+"/hotel/"+t.hotelCode+"/basicavail?";n.debug(Y+" basic URL");var j="";void 0!=t.roomTypeCode&&(j+="roomTypeCode="+t.roomTypeCode+"&"),void 0!=t.languageCode&&(j+="lang="+t.languageCode+"&"),void 0!=t.adults&&(j+="adults="+t.adults+"&"),void 0!=t.children&&(j+="children="+t.children+"&"),n.debug(t.infant+"Infant in Options"),void 0!=t.infant&&(j+="infants="+t.infant+"&"),void 0!=t.childrenAges&&(j+="childrenAges="+t.childrenAges+"&"),void 0!=t.currencyCode&&(j+="currency="+t.currencyCode+"&"),void 0!=t.rooms&&(j+="rooms="+t.rooms+"&"),void 0!=t.dateIn&&(j+="dateIn="+t.dateIn+"&"),void 0!=t.dateOut&&(j+="dateOut="+t.dateOut+"&"),void 0!=t.duration&&(j+="duration="+t.duration+"&"),void 0!=t.ratePlanCode&&(j+="ratePlanCode="+t.ratePlanCode+"&"),void 0!=t.ratePlanType&&(j+="ratePlanType="+t.ratePlanType+"&");var S=!1;if(void 0==t.allCodes&&void 0!=t.groupCode&&(j+="groupCode="+t.groupCode+"&",S=!0),void 0!=t.allCodes&&Object.keys(t.allCodes).length>0){for(M=0;M<Object.keys(t.allCodes).length;M++)if("travelagent"===Object.keys(t.allCodes)[M].toLowerCase()){var A=t.allCodes.TravelAgent?t.allCodes.TravelAgent:t.allCodes.travelagent;j+="taCode="+A+"&"}}else void 0!=t.taCode&&(j+="taCode="+t.taCode+"&");if(void 0!=t.allCodes&&Object.keys(t.allCodes).length>0){for(M=0;M<Object.keys(t.allCodes).length;M++)if("discount"===Object.keys(t.allCodes)[M].toLowerCase()){var I=t.allCodes.Discount?t.allCodes.Discount:t.allCodes.discount;j+="discountCode="+I+"&"}}else void 0!=t.Discount&&(j+="discountCode="+t.Discount+"&");if(void 0!=t.allCodes&&Object.keys(t.allCodes).length>0){for(M=0;M<Object.keys(t.allCodes).length;M++)if("corporate"===Object.keys(t.allCodes)[M].toLowerCase()){var h=t.allCodes.Corporate?t.allCodes.Corporate:t.allCodes.corporate;j+="corpCode="+h+"&",S=!0}}else void 0!=t.Corporate&&(j+="corpCode="+t.Corporate+"&",S=!0);var b=!1;if(void 0!=t.allCodes&&Object.keys(t.allCodes).length>0)for(M=0;M<Object.keys(t.allCodes).length;M++)if(1!=b&&"group"===Object.keys(t.allCodes)[M].toLowerCase()){b=!0;var D=t.allCodes.Group?t.allCodes.Group:t.allCodes.group;j+="groupCode="+D+"&",S=!0}if(!S){var T=a.gmsPromoCode;""!=T&&void 0!=T&&(j+="corpCode="+T+"&")}void 0!=t.uniqueId&&(j+="reservationCode="+t.uniqueId+"&"),void 0!=t.bookerIdentifier&&(j+="bookerIdentifier="+t.bookerIdentifier+"&"),void 0!=t.partnerIdentifier&&(j+="partnerIdentifier="+t.partnerIdentifier+"&"),l.getIsLoyaltyReservationEnabled()&&(l.getIsBrandBarDisplay()||c.getMenubarEnabled())&&l.getLoyaltyTierId()&&(j+="tierId="+l.getLoyaltyTierId()+"&");var z=Y+j;n.debug(z+" in API query string builder");var x;x=1==a.showPosition?o.get(z,{cache:!1}).then(function(e){return a.showPosition=void 0,e.data}):o.get(z,{cache:!0}).then(function(e){return e.data})}return{getAllDates:function(){return x}}},getAccommodationRooms:function(e,t){n.debug(JSON.stringify(e)+" optionsin API"),n.debug(JSON.stringify(e.hotelCode)+" hotel code in api factory");var r=f(p,"ibe-shop/v1")+"/hotel/"+e.hotelCode+"/avail?";n.debug(r+" basic URL"),(1==a.timerInContext||a.showPosition)&&(t=!0);var i="";void 0!=e.roomTypeCode&&(i+="roomTypeCode="+e.roomTypeCode+"&"),void 0!=e.languageCode&&(i+="lang="+e.languageCode+"&"),void 0!=e.adults&&(i+="adults="+e.adults+"&"),void 0!=e.children&&0!=e.children&&(i+="children="+e.children+"&"),void 0!=e.infant&&(i+="infants="+e.infant+"&"),void 0!=e.childrenAges&&(i+="childrenAges="+e.childrenAges+"&"),void 0!=e.currencyCode&&(i+="currency="+e.currencyCode+"&"),void 0!=e.rooms&&(i+="rooms="+e.rooms+"&"),void 0!=e.dateIn&&(i+="dateIn="+e.dateIn+"&"),void 0!=e.dateOut&&(i+="dateOut="+e.dateOut+"&"),void 0!=e.duration&&(i+="duration="+e.duration+"&"),void 0!=e.promotionId&&(i+="promotionId="+e.promotionId+"&");var s=!1;if(void 0!=e.groupCode&&(i+="groupCode="+e.groupCode+"&",s=!0),void 0!=e.ratePlanType&&"Regular"!=e.ratePlanType&&(i+="ratePlanType="+e.ratePlanType+"&"),void 0!=e.ratePlanCode&&(i+="ratePlanCode="+e.ratePlanCode+"&"),void 0!=e.allCodes&&Object.keys(e.allCodes).length>0){for(u=0;u<Object.keys(e.allCodes).length;u++)if("travelagent"===Object.keys(e.allCodes)[u].toLowerCase()){var d=e.allCodes.TravelAgent?e.allCodes.TravelAgent:e.allCodes.travelagent;i+="taCode="+d+"&"}}else void 0!=e.taCode&&(i+="taCode="+e.taCode+"&");if(void 0!=e.allCodes&&Object.keys(e.allCodes).length>0){for(u=0;u<Object.keys(e.allCodes).length;u++)if("discount"===Object.keys(e.allCodes)[u].toLowerCase()){var g=e.allCodes.Discount?e.allCodes.Discount:e.allCodes.discount;i+="discountCode="+g+"&"}}else void 0!=e.Discount&&(i+="discountCode="+e.Discount+"&");if(void 0!=e.allCodes&&Object.keys(e.allCodes).length>0){for(u=0;u<Object.keys(e.allCodes).length;u++)if("corporate"===Object.keys(e.allCodes)[u].toLowerCase()){var m=e.allCodes.Corporate?e.allCodes.Corporate:e.allCodes.corporate;i+="corpCode="+m+"&",s=!0}for(var u=0;u<e.allCodes.length;u++)if("corporate"==e.allCodes[u].codeType){i+="corpCode="+e.allCodes[u].id+"&",s=!0;break}}else void 0!=e.Corporate&&(i+="corpCode="+e.Corporate+"&",s=!0);var y=!1;if(void 0!=e.allCodes&&Object.keys(e.allCodes).length>0)for(u=0;u<Object.keys(e.allCodes).length;u++)"Group"===Object.keys(e.allCodes)[u]&&(y=!0,void 0==e.groupCode&&(i+="groupCode="+e.allCodes.Group+"&",s=!0));if(y&&void 0!=e.ratePlanCode&&(i+="ratePlanCode="+e.ratePlanCode+"&"),!s){var v=a.gmsPromoCode;""!=v&&void 0!=v&&(i+="corpCode="+v+"&")}
void 0!=e.uniqueId&&(i+="reservationCode="+e.uniqueId+"&"),1==e.isAltHotelsReq&&(i+="isAltHotelsReq=true&"),l.getIsLoyaltyReservationEnabled()&&(l.getIsBrandBarDisplay()||c.getMenubarEnabled())&&l.getLoyaltyTierId()&&(i+="tierId="+l.getLoyaltyTierId()+"&"),void 0!=e.bookerIdentifier&&(i+="bookerIdentifier="+e.bookerIdentifier+"&"),void 0!=e.partnerIdentifier&&(i+="partnerIdentifier="+e.partnerIdentifier+"&"),1==e.includeMemberRate&&(i+="includeMemberRate=true&");var h=r+i;n.debug(h+" in API query string builder");var R;return R=1==t?o.get(h,{cache:!1}):o.get(h,{cache:!0}),{getAllRooms:function(){return R}}},callHoldReservation:function(e,a,t,r,i){n.debug(a);var s,l,c={};if(void 0!=t&&t.length>0)for(var d,g=0;g<t.length;g++){if(void 0!=t[g].itineraryId){d=angular.copy(t[g].itineraryId);break}if(void 0!=d){a.itineraryId=angular.copy(d);for(var g=0;g<t.length;g++)t[g].itineraryId=angular.copy(d),delete t[g].resGuests}}return 1==r&&1==i?(c.hotelCode=e,c.languageCode=a.languageCode,c.currencyCode=a.currencyCode,c.itineraryId=d,c.reservationRequestParams=t,s=angular.copy(c),l={method:"POST",url:f(p,"ibe-book/v1")+"/hotel/"+e+"/hold-reservation/multi-room",data:s}):1==i?(c.reservationRequestParams=[],d&&(c.itineraryId=d),c.languageCode=a.languageCode,c.currencyCode=a.currencyCode,c.reservationRequestParams.push(a),s=angular.copy(c),l={method:"POST",url:f(p,"ibe-book/v1")+"/hotel/"+e+"/hold-reservation/multi-room",data:s}):(s=angular.copy(a),l={method:"POST",url:f(p,"ibe-book/v1")+"/hotel/"+e+"/hold-reservation",data:s}),n.debug(JSON.stringify(s)+"res in callHoldReservation"),s.codeType&&delete s.codeType,o(l)},getTotal:function(e){n.debug(JSON.stringify(e)+" optionsin API"),n.debug(JSON.stringify(e.hotelCode)+" hotel code in api factory");var t=f(p,"ibe-shop/v1")+"/hotel/"+e.hotelCode+"/avail?";n.debug(t+" basic URL");var r="";void 0!=e.languageCode&&(r+="lang="+e.languageCode+"&"),void 0!=e.adults&&(r+="adults="+e.adults+"&"),void 0!=e.children&&(r+="children="+e.children+"&"),void 0!=e.infant&&(r+="infants="+e.infant+"&"),void 0!=e.currencyCode&&(r+="currency="+e.currencyCode+"&"),void 0!=e.rooms&&(r+="rooms="+e.rooms+"&"),void 0!=e.dateIn&&(r+="dateIn="+e.dateIn+"&"),void 0!=e.dateOut&&(r+="dateOut="+e.dateOut+"&"),void 0!=e.duration&&(r+="duration="+e.duration+"&"),void 0!=e.ratePlanCode&&(r+="ratePlanCode="+e.ratePlanCode+"&"),void 0!=e.ratePlanType&&(r+="ratePlanType="+e.ratePlanType+"&"),void 0!=e.filterRatePlanCode&&(r+="ratePlanCode="+e.filterRatePlanCode+"&"),void 0!=e.roomTypeCode&&(r+="roomTypeCode="+e.roomTypeCode+"&");var i=!1;if(void 0!=e.allCodes&&Object.keys(e.allCodes).length>0)for(u=0;u<Object.keys(e.allCodes).length;u++)"TravelAgent"===Object.keys(e.allCodes)[u]&&(r+="taCode="+e.allCodes.TravelAgent+"&",i=!0);if(void 0!=e.allCodes&&Object.keys(e.allCodes).length>0)for(u=0;u<Object.keys(e.allCodes).length;u++)"Discount"===Object.keys(e.allCodes)[u]&&(r+="discountCode="+e.allCodes.Discount+"&",i=!0);if(void 0!=e.allCodes&&Object.keys(e.allCodes).length>0)for(u=0;u<Object.keys(e.allCodes).length;u++)"Corporate"===Object.keys(e.allCodes)[u]&&(r+="corpCode="+e.allCodes.Corporate+"&",i=!0);if(void 0!=e.allCodes&&Object.keys(e.allCodes).length>0)for(u=0;u<Object.keys(e.allCodes).length;u++)"Group"===Object.keys(e.allCodes)[u]&&(r+="groupCode="+e.allCodes.Group+"&",i=!0);if(!i){var s=a.gmsPromoCode;""!=s&&void 0!=s&&(r+="corpCode="+s)}n.debug(r+" query string ");var l=t+r;n.debug(l+" in API query string builder");var c=o.get(l).then(function(e){return n.debug(l+"this is the url in getTotalPirce"),e.data});return{getTotalPrice:function(){return c}}},getAccommodation:function(e){var a=f(p,"ibe-shop/v1")+"/hotel/"+e+"/avail?dateIn=2016-02-10&dateOut=2016-02-14&rooms=1&adults=1";return o.get(a)},getRatePlan:function(e,a){var t=f(p,"ibe-shop/v1")+"/hotel/"+e+"/avail?dateIn=2016-02-10&dateOut=2016-02-14&rooms=1&adults=1&ratePlanCode="+a;return o.get(t)},callReservation:function(e,a,t){if(l.getIsLoyaltyReservationEnabled()&&l.getIsLoyaltyUserLogIn()){var r=l.getLoyaltyPointsObject().loyaltyInfo.tierName;t?angular.forEach(a,function(e){e.resGuests[0].profile.customer.tierName=r}):a.resGuests[0].profile.customer.tierName=r}if(t){var n,i={};i.hotelCode=e,i.languageCode=a[0].languageCode,i.currencyCode=a[0].currencyCode,i.itineraryId=a[0].itineraryId,i.reservationRequestParams=a,n=angular.copy(i);var s={method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},url:f(p,"ibe-book/v1")+"/hotel/"+e+"/reservation/multi-room",data:n}}else var s={method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},url:f(p,"ibe-book/v1")+"/hotel/"+e+"/reservation",data:a};return o(s)},callModifyReservation:function(e,a){if(l.getIsLoyaltyReservationEnabled()&&l.getIsLoyaltyUserLogIn()){var t=l.getLoyaltyPointsObject().loyaltyInfo.tierName;a.resGuests[0].profile.customer.tierName=t}var r={method:"PUT",url:f(p,"ibe-book/v1")+"/hotel/"+e+"/reservation/"+a.uniqueId,data:a};return o(r)},getReservation:function(e,a,t){var r=f(p,"ibe-book/v1")+"/hotel/"+e+"/reservation/"+a.confirmationNumber+"?surName="+a.lastName+"&lang="+t;return void 0!=a.bookingSource&&(r+="&bookingSource="+a.bookingSource),o.get(r,{cache:!1})},getSpecialServices:function(e){var a=f(p,"ibe-shop/v1")+"/hotel/"+e.hotelCode+"/services?"+e.queryString;return C(a)},cancelReservation:function(e,a){var t=f(p,"ibe-book/v1")+"/hotel/"+e+"/reservation/"+a.confirmationNumber+"?surName="+a.lastName;if(a.cancellationComment){var r={};r.cancellationComment=a.cancellationComment;var n={method:"DELETE",url:t,data:r,headers:{"Content-Type":"application/json; charset=UTF-8"}}}else var n={method:"DELETE",url:t};return o(n)},cancelExtendHold:function(e,a,t){var r=f(p,"ibe-book/v1")+"/hotel/"+e+"/reservation/"+a+"?email="+t;return o({method:"DELETE",url:r})},getEnhancementServices:function(e){var t=f(p,"ibe-shop/v1")+"/hotel/"+e.hotelCode+"/services?";n.debug(t+" basic URL");var o="";void 0!=e.languageCode&&(o+="lang="+e.languageCode+"&"),void 0!=e.adults&&(o+="adults="+e.adults+"&"),void 0!=e.children&&0!=e.children&&(o+="children="+e.children+"&"),void 0!=e.infant&&0!=e.infant&&(o+="infants="+e.infant+"&"),void 0!=e.rooms&&(o+="rooms="+e.rooms+"&"),void 0!=e.dateIn&&(o+="dateIn="+e.dateIn+"&"),void 0!=e.dateOut&&(o+="dateOut="+e.dateOut+"&"),void 0!=e.ratePlanCode&&(o+="ratePlanCode="+e.ratePlanCode+"&"),void 0!=e.ratePlanType&&(o+="ratePlanType="+e.ratePlanType+"&"),void 0!=e.roomTypeCode&&(o+="roomTypeCode="+e.roomTypeCode+"&"),e.bookerIdentifier&&(o+="bookerIdentifier="+e.bookerIdentifier+"&"),e.partnerIdentifier&&(o+="partnerIdentifier="+e.partnerIdentifier+"&"),void 0!=e.loyaltySignIn&&(o+="loyaltySignIn="+e.loyaltySignIn+"&"),void 0!=e.currencyCode&&(o+="currency="+e.currencyCode+"&");var r=!1,i=!1;if(void 0!=e.allCodes&&Object.keys(e.allCodes).length>0)for(u=0;u<Object.keys(e.allCodes).length;u++){if("travelagent"===Object.keys(e.allCodes)[u].toLowerCase()){r=!0;var s=e.allCodes.TravelAgent?e.allCodes.TravelAgent:e.allCodes.travelagent;o+="taCode="+s+"&"}if("discount"===Object.keys(e.allCodes)[u].toLowerCase()){r=!0;var l=e.allCodes.Discount?e.allCodes.Discount:e.allCodes.discount;o+="discountCode="+l+"&"}if("corporate"===Object.keys(e.allCodes)[u].toLowerCase()){r=!0;var c=e.allCodes.Corporate?e.allCodes.Corporate:e.allCodes.corporate;o+="corpCode="+c+"&"}if(!i&&"group"===Object.keys(e.allCodes)[u].toLowerCase()){r=!0,i=!0;var d=e.allCodes.Group?e.allCodes.Group:e.allCodes.group;o+="groupCode="+d+"&"}}var g;void 0!=e.allCodes&&(g=Object.keys(e.allCodes).find(function(e){return"travelagent"===e.toLowerCase()})),void 0==e.taCode||e.allCodes&&void 0!=g||(r=!0,o+="taCode="+e.taCode+"&");var m;void 0!=e.allCodes&&(m=Object.keys(e.allCodes).find(function(e){return"discount"===e.toLowerCase()})),void 0==e.Discount||e.allCodes&&void 0!=m||(r=!0,o+="discountCode="+e.Discount+"&");var y;void 0!=e.allCodes&&(y=Object.keys(e.allCodes).find(function(e){return"corporate"===e.toLowerCase()})),void 0==e.Corporate||e.allCodes&&void 0!=y||(r=!0,o+="corpCode="+e.Corporate+"&");var v;if(void 0!=e.allCodes&&(v=Object.keys(e.allCodes).find(function(e){return"group"===e.toLowerCase()})),void 0==e.groupCode||e.allCodes&&void 0!=v||(r=!0,o+="groupCode="+e.groupCode+"&"),!r){var h=a.gmsPromoCode;""!=h&&void 0!=h&&(o+="corpCode="+h+"&")}var R=t+o;return n.debug(R+"url for services"),P(R)},modifyHoldReservation:function(e,a,t){1==t&&(a.resGlobalInfo.guaranteesAccepted=[]);var r={method:"PUT",url:f(p,"ibe-book/v1")+"/hotel/"+e+"/hold-reservation/"+a.uniqueId,data:a};return o(r)},postPricingConsent:function(e,a){var t={method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},url:f(p,"ibe-guest/v1")+"/hotel/"+e+"/guest/audit/gdpr",data:a};return o(t)},gmsSignIn:function(e,a,t){var r={method:"POST",url:f(p,"ibe-guest/v1")+"/hotel/"+e+"/guest/signin?lang="+t,data:a};return o(r)},gmsSignUp:function(e,a,t){var r={method:"POST",url:f(p,"ibe-guest/v1")+"/hotel/"+e+"/guest/signup?lang="+t,data:a};return o(r)},gmsForgetPassword:function(e,a,t){var r=f(p,"ibe-guest/v1")+"/hotel/"+e+"/guest/forgetpassword?userName="+a+"&lang="+t;return o.get(r)},getGuestInfo:function(e,a,t){var r=f(p,"ibe-guest/v1")+"/hotel/"+e+"/guest/guestinfo?token="+a+"&lang="+t;return o.get(r)},getLoyaltyV2SSORedirect:function(e){return o.get(e)},validateGmsOuthToken:function(e,a,t){var r=f(p,"ibe-guest/v1")+"/hotel/"+e+"/guest/outh-token-validation?userName="+a+"&token="+t;return o.get(r)},getAllPromotions:function(e,t,r,n){var i=f(p,"ibe-codes/v1")+"/hotel/"+e+"/merchandise?channelType=ibe_4&lang="+t+r;return l.getIsLoyaltyReservationEnabled()&&(l.getIsBrandBarDisplay()||c.getMenubarEnabled())&&l.getLoyaltyTierId()&&(i+="&tierId="+l.getLoyaltyTierId()),a.currentCurrency&&(i+="&currency="+a.currentCurrency),o.get(i,{headers:{"MONITOR-REQUEST":n}})},upsellEnhancements:function(e,a,t){var r={method:"PUT",url:f(p,"ibe-book/v1")+"/hotel/"+e+"/reservation/"+a+"/upsell",data:t};return o(r)},trackEvent:function(e){var t=(i.get("GMS_"+R),g(e)),n=r.defer(),l=!0;if(""==t&&(l=!1),"confirmation"!=s.current.name)var c="processing_page";else c="COMPLETED_PAGE";var d=e.label,m=v+"?action="+e.eventType+"&category="+e.category+"&property_code="+R+"&page_type="+c,u=!1;if(void 0!=a.gmsId&&(m+="&roomSeqNo="+a.gmsId,u=!0),d){if(angular.isObject(d))for(var p in d)d.hasOwnProperty(p)&&("roomSeqNo"!=p?t+="&"+p+"="+d[p]:"roomSeqNo"==p&&1!=u&&(t+="&"+p+"="+d[p]));else t+=e&&e.eventType&&"defaultlanguage"==e.eventType.toLowerCase()?"&language="+d:e&&e.eventType&&"defaultcurrency"==e.eventType.toLowerCase()?"&currency="+d:"&label="+d}m+=t;var y={method:"GET",url:m,headers:{"Content-Type":"application/json; charset=UTF-8"},cache:!1};return l?o(y).success(function(e){n.resolve(e)}).error(function(e){n.reject(e)}):n.resolve({}),n.promise},trackEventPost:function(e){var a=g(e),n=r.defer(),i=!0;if(""==a&&(i=!1),"confirmation"!=s.current.name)var l="processing_page";else l="confirmation";var c=e.label;if(c.property_code=R,c.page_type=l,e.eventType&&(c.action=e.eventType),e.category&&(c.category=e.category),void 0!=t.__GMS_ABANDONMENT_VALUES__&&(""!=__GMS_ABANDONMENT_VALUES__.pushListId&&(c.push_list_id=__GMS_ABANDONMENT_VALUES__.pushListId),""!=__GMS_ABANDONMENT_VALUES__.uniqueSig&&(c.signature=__GMS_ABANDONMENT_VALUES__.uniqueSig)),c)var d={method:"POST",url:v,headers:{"Content-Type":"application/json; charset=UTF-8"},data:c,cache:!1};return i?o(d).success(function(e){n.resolve(e)}).error(function(e){n.reject(e)}):n.resolve({}),n.promise},trackPage:function(e){var a=(i.get("GMS_"+R),g(e)),t=r.defer(),n=!0;""==a&&(n=!1);var s=e.label;if(angular.isObject(s))for(var l in s)s.hasOwnProperty(l)&&(a+="&"+l+"="+s[l]);else a+="&label="+s;var c={method:"GET",url:v+"?action="+e.eventType+"&property_code="+R+"&page_type="+e.eventType+a,headers:{"Content-Type":"application/json; charset=UTF-8"},cache:!1};return n?o(c).success(function(e){t.resolve(e)}).error(function(e){t.reject(e)}):t.resolve({}),t.promise},gmsAbandonmentPost:function(e){var a=e.label,n=r.defer();if(void 0!=t.__GMS_ABANDONMENT_VALUES__&&(""!=__GMS_ABANDONMENT_VALUES__.pushListId&&(a.push_list_id=__GMS_ABANDONMENT_VALUES__.pushListId),""!=__GMS_ABANDONMENT_VALUES__.uniqueSig&&(a.signature=__GMS_ABANDONMENT_VALUES__.uniqueSig)),a.property_code=R,a)var i={method:"POST",url:v,headers:{"Content-Type":"application/json; charset=UTF-8"},data:a,cache:!1};return o(i).success(function(e){n.resolve(e)}).error(function(e){n.reject(e)}),n.promise},validateVoucherCode:function(e){return o({method:"POST",url:y,headers:{"Content-Type":"application/json; charset=UTF-8"},data:{voucherStatusRequest:{code:e},hotelId:R}})},updateEmailMarketingConsentStatus:function(e){var a={method:"POST",url:f(p,"ibe-guest/v1")+"/hotel/"+R+"/guest/consent",headers:{"Content-Type":"application/json; charset=UTF-8"},data:e};return o(a)},callAudienceEvaluator:function(e,a,t){var r={chainCode:a,propertyId:e,criteria:t},n={method:"POST",url:f(p,"")+"audience/v1/evaluator",headers:{"Content-Type":"application/json; charset=UTF-8"},data:r};return o(n)},getLoyaltyBookedResDetails:function(e,a,t,r){var n={method:"GET",url:f(p,"")+"loyalty/v2/"+a+"/account/"+r+"/bookings/CRS/"+e,headers:{"x-tc-user-auth":t}};return o(n)},callIcsPaSetupCybersource:function(e,a){var t={method:"POST",url:f(p,"")+"cybersource/v2/payments/ics_pa_setup",headers:{"Content-Type":"application/json; charset=UTF-8",hotelId:a},data:e};return o(t)},setMediaMetaCollectionContent:function(e){var a={method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},url:mediaMetaCollectionApiUrl,data:e};return o(a)}}}function audienceEvaluatorService(e,a,t,o,r){function n(){return angular.copy(f)}function i(e){f=angular.copy(e),h&&h.put("/page/reservationHistoryCacheObject/"+R.hotelCode,f)}function s(){return angular.copy(y)}function l(e){y=angular.copy(e),v&&v.put("/page/audienceCacheObject/"+R.hotelCode,y)}function c(){y=void 0,v&&v.remove("/page/audienceCacheObject/"+R.hotelCode)}function d(){f={},h&&h.remove("/page/reservationHistoryCacheObject/"+R.hotelCode)}function g(){return R.enableAudienceEvaluator}function m(t){var n=[],i=e.manageUrlParams,s={},l=moment(new Date).format("YYYY-MM-DD");s.type="BOOK_DATE",s.value=[],s.value.push(l),n.push(s);var c=a.get("pageCache"),d=t;d||(d=r.currentCurrency?r.currentCurrency:c&&c.get("/page/currency/"+R.hotelCode)?c.get("/page/currency/"+R.hotelCode).currencyCode:e.baseRes.currency);var g={};if(g.type="GEO_CURRENCY",g.value=[],g.value.push(d),n.push(g),i)for(var m in i)if(i.hasOwnProperty(m)&&m.indexOf("utm")>-1){var y={},v=m.replace(/\s+/g," ").trim();y.type=v.toUpperCase(),y.value=[],y.value.push(i[m]),n.push(y)}if(o.getLoyaltyPointsObject()&&o.getIsLoyaltyUserLogIn()){var h=o.getLoyaltyPointsObject();if(h&&h.loyaltyInfo&&h.loyaltyInfo.availablePoints){var C={};C.type="POINT_BALANCE",C.value=[],C.value.push(h.loyaltyInfo.availablePoints),n.push(C)}if(h&&h.loyaltyInfo&&h.loyaltyInfo.tierId){var P={};P.type="LOYALTY_TIERS",P.value=[],P.value.push(h.loyaltyInfo.tierId),n.push(P)}if(h&&h.profile&&h.profile.customer&&h.profile.customer.birthDate){var S={};S.type="BIRTH_DATE",S.value=[],S.value.push(h.profile.customer.birthDate),n.push(S);var A={};A.type="BIRTH_DATE_NUM",A.value=[],A.value.push(u(h.profile.customer.birthDate)),n.push(A)}if(h&&h.loyaltyInfo&&h.loyaltyInfo.signupDate){var I={};I.type="SIGN_UP_DATE",I.value=[],I.value.push(h.loyaltyInfo.signupDate),n.push(I);var b={};b.type="SIGN_UP_DATE_NUM",b.value=[],b.value.push(p(h.loyaltyInfo.signupDate)),n.push(b)}if(h&&h.profile&&h.profile.customer&&h.profile.customer.rmfScore){var D={};D.type="RFM_SCORE",D.value=[],D.value.push(h.profile.customer.rmfScore),n.push(D)}if(h&&h.profile&&h.profile.customer&&h.profile.customer.totalStays){var T={};T.type="TOTAL_STAYS",T.value=[],T.value.push(h.profile.customer.totalStays),n.push(T)}if(h&&h.profile&&h.profile.customer&&h.profile.customer.totalNights){var O={};O.type="TOTAL_NIGHTS",O.value=[],O.value.push(h.profile.customer.totalNights),n.push(O)}}if(f&&f.bookings&&f.bookings.length>0&&f.bookings[0].rooms&&f.bookings[0].rooms.length>0){if(f.bookings[0].rooms[0].roomInfo&&f.bookings[0].rooms[0].roomInfo.code){var E={};E.type="LAST_RM_TYP_BOOKED",E.value=[],E.value.push(f.bookings[0].rooms[0].roomInfo.code),n.push(E)}if(f.bookings[0].rooms[0].reservationInfo&&f.bookings[0].rooms[0].reservationInfo.checkOutDate){var M={};M.type="LAST_RES_DATE",M.value=[],M.value.push(f.bookings[0].rooms[0].reservationInfo.checkOutDate),n.push(M);var _={};_.type="LAST_RES_DATE_NUM",_.value=[],_.value.push(p(f.bookings[0].rooms[0].reservationInfo.checkOutDate)),n.push(_)}}return n}function u(e){var e=moment.utc(e).format("MM-DD"),a=moment.utc(new Date).format("MM-DD");return moment.utc(a).isAfter(moment.utc(e))?-Math.abs(moment.utc(a).diff(moment.utc(e),"days")):Math.abs(moment.utc(a).diff(moment.utc(e),"days"))}function p(e){var e=moment.utc(e).format("YYYY-MM-DD"),a=moment.utc(new Date).format("YYYY-MM-DD");return Math.abs(moment.utc(a).diff(moment.utc(e),"days"))>0?-Math.abs(moment.utc(a).diff(moment.utc(e),"days")):Math.abs(moment.utc(a).diff(moment.utc(e),"days"))}var y,v,h,R=angular.copy(e.HotelDescriptiveInfo2),f={};return a.get("audienceCache")||(v=a.createCache("audienceCache",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"})),a.get("reservationHistoryCache")||(v=a.createCache("reservationHistoryCache",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"})),function(){v&&v.get("/page/audienceCacheObject/"+R.hotelCode)&&!t.isEmpty(v.get("/page/audienceCacheObject/"+R.hotelCode))?y=v.get("/page/audienceCacheObject/"+R.hotelCode):e.evaluatorResponse&&e.evaluatorResponse.length>0&&l(e.evaluatorResponse),h&&h.get("/page/reservationHistoryCacheObject/"+R.hotelCode)&&!t.isEmpty(h.get("/page/reservationHistoryCacheObject/"+R.hotelCode))&&(f=h.get("/page/reservationHistoryCacheObject/"+R.hotelCode))}(),{getReservationHistoryObject:n,setReservationHistoryObject:i,getAudienceLists:s,setAudienceLists:l,resetAudienceLists:c,resetReservationHistoryObject:d,isAudienceEvaluatorEnabled:g,getAudienceEvaluatorCriteria:m}}function commonFactory(e,a,t,o,r,n,i){function s(a){switch(a){case"1":return e.translate.global_month_longJan;case"2":return e.translate.global_month_longFeb;case"3":return e.translate.global_month_longMar;case"4":return e.translate.global_month_longApr;case"5":return e.translate.global_month_longMay;case"6":return e.translate.global_month_longJun;case"7":return e.translate.global_month_longJul;case"8":return e.translate.global_month_longAug;case"9":return e.translate.global_month_longSep;case"10":return e.translate.global_month_longOct;case"11":return e.translate.global_month_longNov;case"12":return e.translate.global_month_longDec}}function l(a){switch(a){case"1":return e.translate.global_month_shortJan;case"2":return e.translate.global_month_shortFeb;case"3":return e.translate.global_month_shortMar;case"4":return e.translate.global_month_shortApr;case"5":return e.translate.global_month_shortMay;case"6":return e.translate.global_month_shortJun;case"7":return e.translate.global_month_shortJul;case"8":return e.translate.global_month_shortAug;case"9":return e.translate.global_month_shortSep;case"10":return e.translate.global_month_shortOct;case"11":return e.translate.global_month_shortNov;case"12":return e.translate.global_month_shortDec}}function c(t){switch(a.getTranslation(),t){case 0:return e.translate.global_day_shortSun.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()});case 1:return e.translate.global_day_shortMon.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()});case 2:return e.translate.global_day_shortTue.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()});case 3:return e.translate.global_day_shortWed.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()});case 4:return e.translate.global_day_shortThu.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()});case 5:return e.translate.global_day_shortFri.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()});case 6:return e.translate.global_day_shortSat.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})}}function d(r){var n=this;e.showSpinner=!0,t.destroyAll(),o.sessionStorage.clear(),n.setUserTiming("Interaction","StartOver");var i=a.getSelectedLanguage(),s="",l="",c="",d="";void 0!=i&&(d="?languageid="+i),a.getHotelInfo().currency&&(l="&currency="+a.getHotelInfo().currency),a.getHotelInfo().themeCode&&(c="&theme_code="+a.getHotelInfo().themeCode),a.getHotelInfo().subchan&&(s="&subchan="+a.getHotelInfo().subchan);var g=o.location.origin+o.location.pathname+d+l+c+s;o.location.href=void 0!=r?r:g}function g(){t.destroyAll()}function m(a,t){var o=Date.now();o-=e.startTime;var r={timingCategory:a,timingVar:t,timingValue:o};i.userTimings(r)}function u(e,a){void 0==P&&(P={}),P[e]=a}function p(e){return P[e]}function y(e){void 0!=P[e]&&delete P[e]}function v(e,a){for(var t=[],o=e.length,r=0;r<o;r++)e[r].name.toLowerCase()==a.toLowerCase()&&t.push(e[r]);return t}function h(e){var a,t,o;return a=Math.floor(e/3600),e-=3600*a,t=Math.floor(e/60)%60,e-=60*t,o=e%60,[a+"h",t+"m",o+"s"].join(" ")}function R(t){e.displayMultiRateListView=a.getUxConfiguration().accomodationsConfig.displayMultiRateListView,1==e.displayMultiRateListView&&(e.displayMultiRateListView=t>1200)}function f(e,a,t){var o=new Date;o.setTime(o.getTime()+60*t*1e3);var r="expires="+o.toUTCString();document.cookie=e+"="+a+";"+r+";path=/"}function C(e,a){for(var t,o=e+"=",r=decodeURIComponent(document.cookie),n=r.split(";"),i=0;i<n.length;i++){for(var s=n[i];" "==s.charAt(0);)s=s.substring(1);if(0==s.indexOf(o)){if(!a)return s.substring(o.length,s.length);t=s.substring(o.length,s.length)}}if(a&&t&&t.length>0){var l=t.split(a);return{cookieFirstString:l[0],cookieSecondString:l[1]}}return""}var P={};return{dhms:h,translateMonthShortName:l,translateMonthName:s,translateWeekShortName:c,startNewReservation:d,setUserTiming:m,setObjectData:u,getObjectData:p,deleteObjectData:y,clearCache:g,checkForSaturation:v,isMultiRateListView:R,setCookie:f,getCookie:C,numToArray:function(e){for(var a=new Array(e),t=0;t<e;t++)a[t]=t;return a}}}function cookieConsentService(e,a,t,o){function r(){var a=o.defer();if(u)if(p){var t=function(){console.log("sp_overlay_change"),p||(e.removeEventListener("sp_overlay_change",t),a.resolve())};e.addEventListener("sp_overlay_change",t)}else a.resolve();else a.resolve();return a.promise}function n(){if(u)try{sp.isTrustBadgeEnabled()&&sp.showTrustWidget()}catch(e){console.error(e)}}function i(){if(u)try{sp.isTrustBadgeEnabled()&&sp.hideTrustWidget()}catch(e){console.error(e)}}function s(e){if(u){var a=e.split("_")[0].toLowerCase();switch(a){case"ind":a="id";break;case"heb":a="he";break;case"kr":a="ko"}try{sp.switchLanguage(a)}catch(e){console.error(e)}}}function l(){try{y=!!sp.checkConsent("Google Analytics")}catch(e){y=!1}e.dispatchEvent(new CustomEvent("sp_consent_change"))}function c(a){p=a,e.dispatchEvent(new CustomEvent("sp_overlay_change"))}function d(o){p=!0,s(a.getCurrentLanguages().languageCode);try{c(sp.cookieBannerVisible()),sp.cookieBannerVisible()&&t(function(){document.getElementById("main-cookie-banner").focus()},500),l()}catch(e){console.error(e)}e.addEventListener("sp_cookie_banner_shown",function(e){c(e.detail)}),e.addEventListener("sp_cookie_banner_save",function(e){c(!1),l()}),e.addEventListener("sp_privacy_banner_shown",function(e){c(e.detail)}),e.addEventListener("sp_privacy_banner_save",function(e){c(!1),l()})}function g(){return p}function m(){return y}var u=!!angular.copy(e.isCookieConsentsEnable),p=u,y=!u;return u&&e.sp&&e.sp.isInitialized?d():u&&(e.addEventListener("sp_init",d,{once:!0}),t(function(){e.sp&&e.sp.isInitialized||(p=!1,y=!0,e.dispatchEvent(new CustomEvent("sp_overlay_change")),e.dispatchEvent(new CustomEvent("sp_consent_change")))},1e4)),{isSPOverlayVisible:g,executeAfterCookieBanner:r,showTrustBadge:n,hideTrustBadge:i,switchCookieBannerLang:s,isGoogleAnalyticsAllowed:m}}function enhancementsService(e,a){function t(a,t){return angular.forEach(t,function(t){angular.forEach(t.eachDayRate,function(o){"PER_PERSON_PER_NIGHT"!=t.servicePricingType&&"PER_PERSON"!=t.servicePricingType||o.options.length>0&&angular.forEach(a,function(a){if(a.serviceTypeId==t.serviceTypeId)for(var r=0;r<a.serviceOptions.length;r++){for(var n=0,i=0,s=0,l=0,c=0;c<a.serviceOptions[r].dailyRates.length;c++)if(a.serviceOptions[r].dailyRates[c].serviceDate==o.serviceDate){var d={};void 0!=a.serviceOptions[r].dailyRates[c].adultQuantity&&(d.adultOwnCount=a.serviceOptions[r].dailyRates[c].adultQuantity,n+=d.adultOwnCount,e.forEach(a.serviceOptions[r].dailyRates[c].price,function(e){"adult"===e.priceType.toLowerCase()&&(d.adultOwnAmount=e.amountBeforeDiscount/d.adultOwnCount,d.adultOwnDiscountAmount=a.serviceOptions[r].dailyRates[c].adultUnitDiscount,e.discountAmount>0&&(s+=a.serviceOptions[r].dailyRates[c].adultQuantity),0!=a.serviceOptions[r].dailyRates[c].adultQuantity?d.perAdultOwnAmount=(e.amountBeforeDiscount-e.discountAmount)/a.serviceOptions[r].dailyRates[c].adultQuantity:d.perAdultOwnAmount=0)})),void 0!=a.serviceOptions[r].dailyRates[c].childQuantity&&(d.childOwnCount=a.serviceOptions[r].dailyRates[c].childQuantity,i+=d.childOwnCount,e.forEach(a.serviceOptions[r].dailyRates[c].price,function(e){"adult"!==e.priceType.toLowerCase()&&(d.childOwnAmount=e.amountBeforeDiscount/d.childOwnCount,d.childOwnDiscountAmount=a.serviceOptions[r].dailyRates[c].childUnitDiscount,e.discountAmount>0&&(l+=a.serviceOptions[r].dailyRates[c].childQuantity),0!=a.serviceOptions[r].dailyRates[c].childQuantity?d.perChildOwnAmount=(e.amountBeforeDiscount-e.discountAmount)/a.serviceOptions[r].dailyRates[c].childQuantity:d.perChildOwnAmount=0)})),o.oldPriceArray||(o.oldPriceArray=[]),o.oldPriceArray.push(d),o.oldDiscountAdult=s,o.oldDiscountChild=l}0!=n&&(o.oldTotalAdult=n),0!=i&&(o.oldTotalChild=i)}}),"PER_ROOM_PER_NIGHT"==t.servicePricingType&&o.options.length>0&&(delete o.oldDiscountRoom,delete o.oldPriceArray,delete o.oldTotalRoom,angular.forEach(a,function(a){if(a.serviceTypeId==t.serviceTypeId)for(var r=0;r<a.serviceOptions.length;r++){for(var n=0,i=0,s=0;s<a.serviceOptions[r].dailyRates.length;s++)if(a.serviceOptions[r].dailyRates[s].serviceDate==o.serviceDate){var l={};void 0!=a.serviceOptions[r].dailyRates[s].quantity&&(l.roomOwnCount=a.serviceOptions[r].dailyRates[s].quantity,n+=l.roomOwnCount,e.forEach(a.serviceOptions[r].dailyRates[s].price,function(e){l.roomOwnAmount=e.amountBeforeDiscount,l.roomOwnDiscountAmount=e.discountAmount/l.roomOwnCount,e.discountAmount>0&&(i+=a.serviceOptions[r].dailyRates[s].quantity),0!=a.serviceOptions[r].dailyRates[s].quantity?l.perRoomOwnAmount=(e.amountBeforeDiscount-e.discountAmount)/a.serviceOptions[r].dailyRates[s].quantity:l.perRoomOwnAmount=0})),o.oldPriceArray||(o.oldPriceArray=[]),o.oldPriceArray.push(l),o.oldDiscountRoom=i}0!=n&&(o.oldTotalRoom=n)}})),"PER_ROOM"==t.servicePricingType&&o.options.length>0&&angular.forEach(a,function(a){if(a.serviceTypeId==t.serviceTypeId)for(var r=0;r<a.serviceOptions.length;r++)for(var n=0,i=0,s=0;s<a.serviceOptions[r].dailyRates.length;s++)if(a.serviceOptions[r].dailyRates[s].serviceDate==o.serviceDate){var l={};if(void 0!=a.serviceOptions[r].dailyRates[s].quantity)for(var c=0;c<o.options.length;c++)a.serviceOptions[r].serviceOptionId==o.options[c].serviceOptionId&&(l.roomOwnCount=a.serviceOptions[r].dailyRates[s].quantity,n+=l.roomOwnCount,e.forEach(a.serviceOptions[r].dailyRates[s].price,function(e){l.roomOwnAmount=e.amountBeforeDiscount,l.roomOwnDiscountAmount=e.discountAmount/l.roomOwnCount,e.discountAmount>0&&(i+=a.serviceOptions[r].dailyRates[s].quantity),0!=a.serviceOptions[r].dailyRates[s].quantity?l.perRoomOwnAmount=(e.amountBeforeDiscount-e.discountAmount)/a.serviceOptions[r].dailyRates[s].quantity:l.perRoomOwnAmount=0}),o.options[c].oldPriceArray||(o.options[c].oldPriceArray=[]),o.options[c].oldPriceArray.push(l),0!=n&&(o.options[c].oldTotalRoom=n),0!=i&&(o.options[c].oldDiscountedPerRoomCount=i))}}),"PER_RESERVATION"==t.servicePricingType&&o.options.length>0&&angular.forEach(a,function(e){if(e.serviceTypeId==t.serviceTypeId)for(var a=0;a<e.serviceOptions.length;a++)for(var r=0;r<e.serviceOptions[a].dailyRates.length;r++)e.serviceOptions[a].dailyRates[r].serviceDate==o.serviceDate?void 0!=e.serviceOptions[a].dailyRates[r].quantity&&(o.resOwnServiceDate=e.serviceOptions[a].dailyRates[r].serviceDate,o.resOwnAmount=e.serviceOptions[a].dailyRates[r].price[0].amountBeforeDiscount,o.resOwnDiscountAmount=e.serviceOptions[a].dailyRates[r].price[0].discountAmount):(o.dateDropdownOption&&(delete o.dateDropdownOption[o.serviceDate].resOwnServiceDate,delete o.dateDropdownOption[o.serviceDate].resOwnAmount,delete o.dateDropdownOption[o.serviceDate].resOwnDiscountAmount),o.resOwnServiceDate&&(delete o.resOwnServiceDate,delete o.resOwnAmount,delete o.resOwnDiscountAmount))})})}),t}function o(e){for(var t={},o=0,r=0,n=0,i=0,s=0,l=a.canModifyReservation(),c=!1,d=0;d<e.eachDayRate.length;d++){var g=0,m=0,u=0,p=0,y=e.maxLimit,v=0,h=0,R=0,f=0,C=0,P=0,S=0,A=0,I=0,b=0;if(void 0!=e.eachDayRate[d].adult&&void 0!=e.eachDayRate[d].selectOption){if(l){for(adultIndex=0;adultIndex<e.eachDayRate[d].adult;adultIndex++){var D=0;if(e.eachDayRate[d].oldPriceArray&&e.eachDayRate[d].oldPriceArray.length>0)for(var T=0;T<e.eachDayRate[d].oldPriceArray.length;T++)if((D+=e.eachDayRate[d].oldPriceArray[T].adultOwnCount)>adultIndex&&e.eachDayRate[d].oldPriceArray[T].adultOwnCount>0){h+=e.eachDayRate[d].oldPriceArray[T].adultOwnAmount,A+=e.eachDayRate[d].oldPriceArray[T].perAdultOwnAmount,e.eachDayRate[d].oldPriceArray[T].adultOwnDiscountAmount>0&&(v++,c=!0);break}D<adultIndex+1&&(h+=e.eachDayRate[d].selectOption.adultUnitPrice,e.discountRuleId||(A+=e.eachDayRate[d].selectOption.adultUnitPrice))}var O=h,E=h}else var O=e.eachDayRate[d].adult*e.eachDayRate[d].selectOption.adultUnitPrice,E=e.eachDayRate[d].adult*e.eachDayRate[d].selectOption.adultUnitPrice;if(l&&D>0&&e.eachDayRate[d].adult>0?(C=e.eachDayRate[d].adult-D,g=A):(C=e.eachDayRate[d].adult,g=A),l&&e.eachDayRate[d].oldDiscountChild>0&&e.eachDayRate[d].adult>0&&(v+=e.eachDayRate[d].oldDiscountChild),e.discountRuleId&&y>0&&0!==e.eachDayRate[d].selectOption.adultUnitDiscount)for(maxCount=0;maxCount<C;maxCount++)y>v?(v++,g+=e.eachDayRate[d].selectOption.adultUnitPrice-e.eachDayRate[d].selectOption.adultUnitDiscount):g+=e.eachDayRate[d].selectOption.adultUnitPrice;else if(e.discountRuleId&&0==y&&0!=e.eachDayRate[d].selectOption.adultUnitDiscount)for(maxCount=0;maxCount<C;maxCount++)g+=e.eachDayRate[d].selectOption.adultUnitPrice-e.eachDayRate[d].selectOption.adultUnitDiscount;else if(e.discountRuleId&&0==e.eachDayRate[d].selectOption.adultUnitDiscount)for(maxCount=0;maxCount<C;maxCount++)g+=e.eachDayRate[d].selectOption.adultUnitPrice}else{var O=0,E=0;g=0}if("PER_RESERVATION"==e.servicePricingType&&void 0!=e.eachDayRate[d].selectOption&&"PER_PERSON_PER_NIGHT"!=e.servicePricingType)if(e.eachDayRate[d].resOwnAmount>0&&e.eachDayRate[d].resOwnServiceDate===e.eachDayRate[d].selectOption.serviceDate){var O=e.eachDayRate[d].resOwnAmount,E=e.eachDayRate[d].resOwnAmount;p=e.eachDayRate[d].resOwnAmount-e.eachDayRate[d].resOwnDiscountAmount,e.eachDayRate[d].resOwnDiscountAmount>0&&(c=!0)}else{var O=e.eachDayRate[d].selectOption.adultUnitPrice,E=e.eachDayRate[d].selectOption.adultUnitPrice;e.discountRuleId&&0!==e.eachDayRate[d].selectOption.adultUnitDiscount?p=e.eachDayRate[d].selectOption.adultUnitPrice-e.eachDayRate[d].selectOption.adultUnitDiscount:e.discountRuleId&&0==e.eachDayRate[d].selectOption.adultUnitDiscount&&(p=e.eachDayRate[d].selectOption.adultUnitPrice)
}else if("PER_PERSON_PER_NIGHT"!=e.servicePricingType&&"PER_PERSON"!=e.servicePricingType){var O=0,E=0;p=0}if(void 0!=e.eachDayRate[d].children&&void 0!=e.eachDayRate[d].selectOption){if(l){for(childIndex=0;childIndex<e.eachDayRate[d].children;childIndex++){var M=0;if(e.eachDayRate[d].oldPriceArray&&e.eachDayRate[d].oldPriceArray.length>0)for(var T=0;T<e.eachDayRate[d].oldPriceArray.length;T++)if((M+=e.eachDayRate[d].oldPriceArray[T].childOwnCount)>childIndex&&e.eachDayRate[d].oldPriceArray[T].childOwnCount>0){R+=e.eachDayRate[d].oldPriceArray[T].childOwnAmount,I+=e.eachDayRate[d].oldPriceArray[T].perChildOwnAmount,e.eachDayRate[d].oldPriceArray[T].childOwnDiscountAmount>0&&(v++,c=!0);break}M<childIndex+1&&(R+=e.eachDayRate[d].selectOption.childUnitPrice,e.discountRuleId||(I+=e.eachDayRate[d].selectOption.childUnitPrice))}var _=R,k=R}else var _=e.eachDayRate[d].children*e.eachDayRate[d].selectOption.childUnitPrice,k=e.eachDayRate[d].children*e.eachDayRate[d].selectOption.childUnitPrice;if(l&&M>0&&e.eachDayRate[d].children>0?(S=e.eachDayRate[d].children-M,m=I):(S=e.eachDayRate[d].children,m=I),l&&e.eachDayRate[d].children>0&&0==e.eachDayRate[d].adult&&e.eachDayRate[d].oldDiscountAdult>0?v+=e.eachDayRate[d].oldDiscountAdult:l&&e.eachDayRate[d].oldDiscountChild>0&&e.eachDayRate[d].oldDiscountAdult>0&&(v-=e.eachDayRate[d].oldDiscountChild),e.discountRuleId&&y>0&&0!==e.eachDayRate[d].selectOption.childUnitDiscount)for(maxCount=0;maxCount<S;maxCount++)y>v?(v++,m+=e.eachDayRate[d].selectOption.childUnitPrice-e.eachDayRate[d].selectOption.childUnitDiscount):m+=e.eachDayRate[d].selectOption.childUnitPrice;else if(e.discountRuleId&&0==y&&0!=e.eachDayRate[d].selectOption.childUnitDiscount)for(maxCount=0;maxCount<S;maxCount++)m+=e.eachDayRate[d].selectOption.childUnitPrice-e.eachDayRate[d].selectOption.childUnitDiscount;else if(e.discountRuleId&&0==e.eachDayRate[d].selectOption.childUnitDiscount)for(maxCount=0;maxCount<S;maxCount++)m+=e.eachDayRate[d].selectOption.childUnitPrice}else{var _=0,k=0;m=0}if(void 0!=e.eachDayRate[d].room&&void 0!=e.eachDayRate[d].selectOption){if("PER_ROOM"==e.servicePricingType)if(0!==s&&(v=s),l){for(roomIndex=0;roomIndex<e.eachDayRate[d].room;roomIndex++)for(opt=0;opt<e.eachDayRate[d].options.length;opt++)if(e.eachDayRate[d].selectOption.serviceOptionId==e.eachDayRate[d].options[opt].serviceOptionId){var N=0;if(e.eachDayRate[d].options[opt].oldPriceArray&&e.eachDayRate[d].options[opt].oldPriceArray.length>0)for(var T=0;T<e.eachDayRate[d].options[opt].oldPriceArray.length;T++)if((N+=e.eachDayRate[d].options[opt].oldPriceArray[T].roomOwnCount)>roomIndex&&e.eachDayRate[d].options[opt].oldPriceArray[T].roomOwnCount>0){f+=e.eachDayRate[d].options[opt].oldPriceArray[T].roomOwnAmount/e.eachDayRate[d].options[opt].oldPriceArray[T].roomOwnCount,b+=e.eachDayRate[d].options[opt].oldPriceArray[T].perRoomOwnAmount,P=0,e.eachDayRate[d].options[opt].oldPriceArray[T].roomOwnDiscountAmount>0&&(s++,c=!0);break}N<roomIndex+1&&(f+=e.eachDayRate[d].selectOption.adultUnitPrice,0==!e.discountRuleId&&(0==y||y>s)?(b+=e.eachDayRate[d].selectOption.adultUnitPrice-e.eachDayRate[d].selectOption.adultUnitDiscount,s++):b+=e.eachDayRate[d].selectOption.adultUnitPrice)}var L=f,G=f;u=b}else{var L=e.eachDayRate[d].room*e.eachDayRate[d].selectOption.adultUnitPrice,G=e.eachDayRate[d].room*e.eachDayRate[d].selectOption.adultUnitPrice;P=e.eachDayRate[d].room}else{if(l){for(roomIndex=0;roomIndex<e.eachDayRate[d].room;roomIndex++){var N=0;if(e.eachDayRate[d].oldPriceArray&&e.eachDayRate[d].oldPriceArray.length>0)for(var T=0;T<e.eachDayRate[d].oldPriceArray.length;T++)if((N+=e.eachDayRate[d].oldPriceArray[T].roomOwnCount)>roomIndex&&e.eachDayRate[d].oldPriceArray[T].roomOwnAmount>0){f+=e.eachDayRate[d].oldPriceArray[T].roomOwnAmount/e.eachDayRate[d].oldPriceArray[T].roomOwnCount,b+=e.eachDayRate[d].oldPriceArray[T].perRoomOwnAmount,e.eachDayRate[d].oldPriceArray[T].roomOwnDiscountAmount>0&&(v++,c=!0);break}N<roomIndex+1&&(f+=e.eachDayRate[d].selectOption.adultUnitPrice,e.discountRuleId||(b+=e.eachDayRate[d].selectOption.adultUnitPrice))}var L=f,G=f}else var L=e.eachDayRate[d].room*e.eachDayRate[d].selectOption.adultUnitPrice,G=e.eachDayRate[d].room*e.eachDayRate[d].selectOption.adultUnitPrice;l&&N>0&&e.eachDayRate[d].room>0?(P=e.eachDayRate[d].room-N,u=b):(P=e.eachDayRate[d].room,u=b)}if(e.discountRuleId&&y>0&&0!==e.eachDayRate[d].selectOption.adultUnitDiscount)for(maxCount=0;maxCount<P;maxCount++)y>v?(v++,s=v,u+=e.eachDayRate[d].selectOption.adultUnitPrice-e.eachDayRate[d].selectOption.adultUnitDiscount):u+=e.eachDayRate[d].selectOption.adultUnitPrice;else if(e.discountRuleId&&0==y&&0!=e.eachDayRate[d].selectOption.adultUnitDiscount)for(maxCount=0;maxCount<P;maxCount++)u+=e.eachDayRate[d].selectOption.adultUnitPrice-e.eachDayRate[d].selectOption.adultUnitDiscount;else if(e.discountRuleId&&0==e.eachDayRate[d].selectOption.adultUnitDiscount)for(maxCount=0;maxCount<P;maxCount++)u+=e.eachDayRate[d].selectOption.adultUnitPrice}else{var L=0,G=0;u=0}void 0!=e.eachDayRate[d].selectOption&&void 0!=e.eachDayRate[d].adult&&(o=o+O+_,r=r+O+_-e.eachDayRate[d].selectOption.discountRate*(e.eachDayRate[d].selectOption.adultUnitPrice+e.eachDayRate[d].selectOption.childUnitPrice)*e.eachDayRate[d].adult*(1+e.eachDayRate[d].selectOption.taxRate),n=n+E+k-e.eachDayRate[d].selectOption.discountRate*e.eachDayRate[d].selectOption.adultUnitPrice*e.eachDayRate[d].adult,void 0!=e.eachDayRate[d].children&&(n-=e.eachDayRate[d].selectOption.discountRate*e.eachDayRate[d].selectOption.childUnitPrice*e.eachDayRate[d].children),(e.discountRuleId||m>0||g>0)&&(i=i+m+g)),void 0!=e.eachDayRate[d].selectOption&&void 0==e.eachDayRate[d].adult&&void 0!=e.eachDayRate[d].children&&(o+=_,r=r+_-e.eachDayRate[d].selectOption.discountRate*e.eachDayRate[d].selectOption.childUnitPrice*e.eachDayRate[d].children*(1+e.eachDayRate[d].selectOption.taxRate),n=n+k-e.eachDayRate[d].selectOption.discountRate*e.eachDayRate[d].children,(e.discountRuleId||m>0)&&(i+=m)),void 0!=e.eachDayRate[d].selectOption&&void 0!=e.eachDayRate[d].room&&(o+=L,r=r+L-e.eachDayRate[d].selectOption.discountRate*e.eachDayRate[d].selectOption.adultUnitPrice*e.eachDayRate[d].room*(1+e.eachDayRate[d].selectOption.taxRate),n=n+G-e.eachDayRate[d].selectOption.discountRate*e.eachDayRate[d].selectOption.adultUnitPrice*e.eachDayRate[d].room,(e.discountRuleId||u>0)&&(i+=u)),"PER_RESERVATION"==e.servicePricingType&&void 0!=e.eachDayRate[d].selectOption&&(o+=O,r=r+O-e.eachDayRate[d].selectOption.discountRate*e.eachDayRate[d].selectOption.adultUnitPrice*(1+e.eachDayRate[d].selectOption.taxRate),n=n+E-e.eachDayRate[d].selectOption.discountRate*e.eachDayRate[d].selectOption.adultUnitPrice,(e.discountRuleId||p>0)&&(i+=p))}return t.totalPrice=o,t.totalfinalPrice=r,t.packageTotalFinalPrice=n,t.packageTotalFinalPriceDisc=i,t.zeroDiscountApplied=c,t}function r(e,a){var t=e+1,o=a,r=[],n=0;if(o)for(i=0;o.length>i;i++)if((n+=o[i].adultOwnCount)>=t){r=o[i];break}return r}function n(e,a){var t=e+1,o=a,r=[],n=0;if(o)for(i=0;o.length>i;i++)if((n+=o[i].childOwnCount)>=t){r=o[i];break}return r}function s(e,a){var t=e+1,o=a,r=[],n=0;if(o)for(i=0;o.length>i;i++)if((n+=o[i].roomOwnCount)>=t){r=o[i];break}return r}function l(e){for(var a=0;a<e.length;a++)if("PER_ROOM"==e[a].servicePricingType)angular.forEach(e[a].eachDayRate,function(e){angular.forEach(e.options,function(e){e.oldPriceArray&&e.oldPriceArray.length>0&&delete e.oldPriceArray})});else for(var t=0;t<e[a].eachDayRate.length;t++)e[a].eachDayRate[t].oldPriceArray&&e[a].eachDayRate[t].oldPriceArray.length>0&&(delete e[a].eachDayRate[t].oldPriceArray,e[a].eachDayRate[t].oldTotalAdult&&(delete e[a].eachDayRate[t].oldTotalAdult,e[a].eachDayRate[t].oldDiscountAdult&&delete e[a].eachDayRate[t].oldDiscountAdult),e[a].eachDayRate[t].oldTotalChild&&(delete e[a].eachDayRate[t].oldTotalChild,e[a].eachDayRate[t].oldDiscountChild&&delete e[a].eachDayRate[t].oldDiscountChild));return e}function c(e,a,t){var o=e.maxLimit,t=t+1,r=!1;return 0==o?r=!0:0!=o&&(0==a.oldDiscountAdult&&0==a.oldDiscountChild?r=t-a.oldTotalChild<=o-(a.adult-a.oldTotalAdult):0==a.oldDiscountAdult&&a.oldDiscountChild>0?r=!!(a.oldTotalAdult&&a.oldTotalChild!=a.oldDiscountChild&&t-(a.oldTotalChild-a.oldDiscountChild)<=o-(a.adult-a.oldTotalAdult))||!!(a.oldTotalAdult&&a.oldTotalChild==a.oldDiscountChild&&t-a.oldDiscountChild<o-(a.adult-a.oldTotalAdult))||!a.oldTotalAdult&&a.oldTotalChild==a.oldDiscountChild&&t-a.oldDiscountChild<=o-(a.adult+a.oldDiscountChild):a.oldDiscountAdult>0&&0==a.oldDiscountChild?r=t-a.oldTotalChild<=o-(a.adult-(a.oldTotalAdult-a.oldDiscountAdult)):(a.oldDiscountAdult>0||a.oldDiscountChild>0)&&(r=t-(a.oldTotalChild-a.oldDiscountChild)<=o-(a.adult-(a.oldTotalAdult-a.oldDiscountAdult)))),r}function d(e,a,t){var o=e.maxLimit,t=t+1,r=!1,n=0;return 0==o?r=!0:0!=o&&(0==a.oldDiscountAdult&&0==a.oldDiscountChild?r=t-a.oldTotalAdult<=o:0==a.oldDiscountAdult&&a.oldDiscountChild>0?r=t-a.oldTotalAdult<=o-a.oldDiscountChild:a.oldDiscountAdult>0&&0==a.oldDiscountChild?r=a.oldTotalAdult!=a.oldDiscountAdult&&t-(a.oldTotalAdult-a.oldDiscountAdult)<=o-a.oldDiscountAdult||a.oldTotalAdult==a.oldDiscountAdult&&t-a.oldDiscountAdult<=o-a.oldDiscountAdult:a.oldDiscountAdult>0&&a.oldDiscountChild>0&&(n=a.oldDiscountAdult+a.oldDiscountChild,r=t-a.oldTotalAdult<=o-n)),r}function g(e,a){var t=[];if(e&&a&&e.length>0&&a.length>0){for(var o=0;o<a.length;o++)for(var r=0;r<e.length;r++)a[o].serviceTypeId===e[r].serviceTypeId&&e.splice(r,1);t=e}return t}function m(e){var t,o=0,r=[],n={},i=[],s=[],l=a.canModifyReservation();if(void 0!=a.getReservation().services)for(var c=0;c<a.getReservation().services.length;c++)"ENHANCEMENT"!=a.getReservation().services[c].serviceCategory&&"PACKAGE_OPTION"!=a.getReservation().services[c].serviceCategory||r.push(a.getReservation().services[c]);if(e.serviceOptions&&e.serviceOptions.length>0)for(var d=0;d<e.serviceOptions.length;d++){if(l&&("PER_RESERVATION"==e.servicePricingType||"PER_PERSON"==e.servicePricingType||"PER_ROOM"==e.servicePricingType)&&r&&r.length>0)for(var g=0;r.length>g;g++)if(r[g].serviceTypeId===e.serviceTypeId){o=e.serviceOptions[d].dailyRates[0].adultUnitPrice-e.serviceOptions[d].dailyRates[0].adultUnitDiscount,t=e.serviceOptions[d].dailyRates[0].serviceDate,void 0==i[d]&&(i[d]=e.serviceOptions[d].dailyRates[0].adultUnitPrice,e.discountRuleId&&(s[d]=e.serviceOptions[d].dailyRates[0].adultUnitDiscount));for(var m=0;m<e.serviceOptions[d].dailyRates.length;m++)r[g].serviceOptions[0].dailyRates[0].serviceDate===e.serviceOptions[d].dailyRates[m].serviceDate&&("PER_RESERVATION"==e.servicePricingType?t=e.serviceOptions[d].dailyRates[m].serviceDate:(o=e.serviceOptions[d].dailyRates[m].adultUnitPrice-e.serviceOptions[d].dailyRates[m].adultUnitDiscount,t=e.serviceOptions[d].dailyRates[m].serviceDate,i[d]=e.serviceOptions[d].dailyRates[m].adultUnitPrice,e.discountRuleId&&(s[d]=e.serviceOptions[d].dailyRates[m].adultUnitDiscount))),"PER_RESERVATION"==e.servicePricingType&&o>e.serviceOptions[d].dailyRates[m].adultUnitPrice-e.serviceOptions[d].dailyRates[m].adultUnitDiscount&&(o=e.serviceOptions[d].dailyRates[m].adultUnitPrice-e.serviceOptions[d].dailyRates[m].adultUnitDiscount,i[d]=e.serviceOptions[d].dailyRates[m].adultUnitPrice,e.discountRuleId&&(s[d]=e.serviceOptions[d].dailyRates[m].adultUnitDiscount))}if(!t){o=e.serviceOptions[d].dailyRates[0].adultUnitPrice-e.serviceOptions[d].dailyRates[0].adultUnitDiscount,t=e.serviceOptions[d].dailyRates[0].serviceDate,void 0==i[d]&&(i[d]=e.serviceOptions[d].dailyRates[0].adultUnitPrice,e.discountRuleId&&(s[d]=e.serviceOptions[d].dailyRates[0].adultUnitDiscount));for(var m=0;m<e.serviceOptions[d].dailyRates.length;m++)o>e.serviceOptions[d].dailyRates[m].adultUnitPrice-e.serviceOptions[d].dailyRates[m].adultUnitDiscount&&(o=e.serviceOptions[d].dailyRates[m].adultUnitPrice-e.serviceOptions[d].dailyRates[m].adultUnitDiscount,t=e.serviceOptions[d].dailyRates[m].serviceDate,i[d]=e.serviceOptions[d].dailyRates[m].adultUnitPrice,e.discountRuleId&&(s[d]=e.serviceOptions[d].dailyRates[m].adultUnitDiscount))}}return n.selectFirstDateOFDiscount=t,n.tempAdultRate=i,n.tempAdultDiscount=s,n}function u(e,a,t){var o=0;if(0==a.maxLimit)return!0;if(0!=a.maxLimit){if(t.oldDiscountAdult>0)if(t.oldTotalAdult-t.oldDiscountAdult==0)o=t.adult===t.oldTotalAdult?t.adult:t.adult>t.oldDiscountAdult?t.adult:t.oldTotalAdult-t.adult;else{var r=t.oldTotalAdult-t.oldDiscountAdult;o=t.adult===r?t.adult:t.adult-r}else o=t.adult-t.oldTotalAdult;return a.maxLimit-o>e}}return{mergeModifyEnhancements:t,getTotalEnhancement:o,adultEnhancementPriceObj:r,childEnhancementPriceObj:n,roomEnhancementPriceObj:s,deleteOldPriceArray:l,childPriceBreakUp:c,adultPriceBreakUp:d,removeDuplicateGeneralEnhancement:g,getMinimumDayRate:m,showDiscountedChildOnly:u}}function hotelFunction(e,a,t,o,r,n,i,s){var l=e.HotelDescriptiveInfo2,c=e.HotelDescriptiveInfo2,d=angular.copy(e.HotelDescriptiveInfo2),g={};g.hotelCode=l.hotelCode,g.hotelName=l.hotelName,g.maxRoomsPerBooking=l.maxRoomsPerBooking,g.webAddress=l.webAddress,g.roomCategoriesEnabled=l.roomCategoriesEnabled,g.interactiveMessagesEnabled=l.interactiveMessagesEnabled,g.currentLanguageCode=l.currentLanguage.languageCode,g.enableSchedPkgInclusions=l.enableSchedPkgInclusions,g.subchan=e.manageUrlParams.subchan,g.themeCode=e.manageUrlParams.theme_code,g.currency=e.manageUrlParams.currency;var m=l.currentLanguage.languageCode,u={},p={};u[m]=l.translations;var y;return(i.getIsBrandBarDisplay()||s.getMenubarEnabled()&&i.getIsLoyaltyReservationEnabled())&&(l.uxConfiguration.crmSettings.enabledPrivateOffers=!1,l.uxConfiguration.crmSettings.disablePrivateOffersForGroups=!1,l.uxConfiguration.crmSettings.tcGMSPortalName=""),{getHotelCode:function(){return g.hotelCode},getHotelInfo:function(){return g},getTimeZone:function(){return l.timeZone},getPromoInfo:function(){return l.brandInfo},getCodeDisplay:function(){return l.uxConfiguration.specialCodesConfigList},getHotelDesc:function(){return l},getLanguages:function(){return l.languages},getCurrentCurrency:function(){return l.currentCurrency},getDefaultCurrency:function(){var e=!0,a={};return angular.forEach(l.currencies,function(t,o){e&&!0===t.isDefaultCurrency&&(e=!1,a=t)}),a},getCurrentLanguages:function(){return l.currentLanguage},getCurrencies:function(){return l.currencies},getOccupancyInfo:function(){return l.occupancyInfo},updateMaxRoomsPerBooking:function(e){l.maxRoomsPerBooking=e},updateMaxMultiRoomLimit:function(e){l.maxMultiRoomLimit=e},updateDefaultRooms:function(e,a){l.occupancyInfo.defaultRooms=e,l.uxConfiguration.guestAndRoomConfig.defaultRooms=a},getTranslation:function(){return l.translations},getTranslations:function(e,a,o){u[a]?(o.translate=u[a],o.$broadcast(r.LANG_CHANGE_AFTER_API),o.$broadcast(r.LANG_CHANGE_AFTER_API_CURRENCY_CHANGE),o.MRB||o.$broadcast(r.LANG_CHANGE)):t.getTranslations(e,a).then(function(e){u[a]=e.translations,o.translate=e.translations,o.$broadcast(r.LANG_CHANGE_AFTER_API),o.$broadcast(r.LANG_CHANGE_AFTER_API_CURRENCY_CHANGE)})},getGuestRooms:function(){return l.facilityInfo.guestRooms},getFacilityInfo:function(){return l.facilityInfo},getCalConfigInfo:function(){return l.uxConfiguration.calendarConfig},getUxConfiguration:function(){return l.uxConfiguration},getCountries:function(){return l.countries},getTitles:function(){return l.titles},getBrandInfo:function(){return l.brandInfo},getPaymentProviders:function(){return l.paymentProviders},setExchangedRate:function(e,a){for(var t=0;t<l.currencies.length;t++)l.currencies[t].currencyCode===e&&(p=angular.copy(l.currencies[t]),l.currencies[t].exchangeRate=a)},replaceMerchandisedCurrencyObj:function(){for(var e=0;e<l.currencies.length;e++)l.currencies[e].currencyCode===p.currencyCode&&(l.currencies[e]=angular.copy(p));return p},getHotelDescUpdated:function(){return c},setHotelDescUpdated:function(e){c=e},setConsentsDataFromRetrieval:function(e){for(var a=0;a<c.consents.length;a++)for(var t=0;t<e.length;t++)c.consents[a].id===e[t].id&&(c.consents[a].isPreChecked="1"===e[t].consentInd.toString())},getRewardTypeId:function(){var e,a=n.findIndex(l.paymentModes,function(e){return"loyalty points"==e.name.toLowerCase()});return-1!=a&&(e=l.paymentModes[a].paymentModeId),e},setSelectedLanguage:function(e){y=e},getSelectedLanguage:function(){return y||m},getRatePlanMerchandisedCurrencies:function(){return l.ratePlanMerchandisedCurrencies||[]},getHotelDescOld:function(){return d},getChainCodeUrl:function(){return l&&l.chainInfo&&l.chainInfo.length?"&chainCode="+l.chainInfo[0]:""},getHotelPhoneNumber:function(){var e=a("filter")(l.address.telephone,{phoneTechType:"Voice"});return e&&e.length>0?e[0].phoneNumber:null},getChainCode:function(){return l&&l.chainInfo&&l.chainInfo.length?l.chainInfo[0]:""},getMemberRateEnabledGlobalSetting:function(){return l.enableMemberRateMerchandising},getEnableBookerOption:function(){var e=!1;return l&&l.uxConfiguration&&l.uxConfiguration.reservationAndPaymentConfig&&(e=l.uxConfiguration.reservationAndPaymentConfig.displayBookerSalutationFieldIndicator||l.uxConfiguration.reservationAndPaymentConfig.displayBookerFirstNameFieldIndicator||l.uxConfiguration.reservationAndPaymentConfig.displayBookerLastNameFieldIndicator||l.uxConfiguration.reservationAndPaymentConfig.displayBookerEmailAddressFieldIndicator),e},getCRMLoyaltyV2Enable:function(){var e=!1;return l&&l.uxConfiguration&&l.uxConfiguration.crmSettings&&l.uxConfiguration.crmSettings.enabledCRM&&"TCLOYALTY"==l.uxConfiguration.crmSettings.enabledCRM&&(e=!0),e},getEnableInsurance:function(){return!!l.enableBookingEngineInsurance},showHideInsurance:function(){return!(!this.getEnableInsurance()||!this.isInsuranceSupportedForPaymentMethod())},isInsuranceSupportedForPaymentMethod:function(){var e=!1;return l&&l.paymentProviders?angular.forEach(l.paymentProviders,function(a){("credcard-ogone"===a.vendorKey&&1===a.paymentMethod||"hosting-ogone"===a.vendorKey&&4===a.paymentMethod||"credcard-cybersource"===a.vendorKey&&1===a.paymentMethod||"creditcard-payu_latam"===a.vendorKey&&1===a.paymentMethod||"credcard-ihotelier"===a.vendorKey&&1===a.paymentMethod||"creditcard-adyen"===a.vendorKey&&1===a.paymentMethod||"hosting-adyen"===a.vendorKey&&(14===a.paymentMethod||15===a.paymentMethod||16===a.paymentMethod||17===a.paymentMethod||18===a.paymentMethod||19===a.paymentMethod||19===a.paymentMethod||20===a.paymentMethod||21===a.paymentMethod||22===a.paymentMethod||23===a.paymentMethod))&&(e=!0)}):e=!0,e=!(l&&l.enableGuarantee3DS||!e)},getCountryNameByCode:function(e){var t;return e&&(t=a("filter")(this.getCountries(),{code:e})),t},getStateNameByCode:function(e,t){var o;if(e&&t){var r=a("filter")(this.getCountries(),{code:e});o=a("filter")(r[0].states,{code:t})}return o},getStateCodeByName:function(e,t){var o;if(e&&t){var r=a("filter")(this.getCountries(),{code:e});o=a("filter")(r[0].states,{name:t})}return o},getTcGMSPortalName:function(){var e="";return l&&l.uxConfiguration&&l.uxConfiguration.crmSettings&&l.uxConfiguration.crmSettings.enabledCRM&&"TCLOYALTY"==l.uxConfiguration.crmSettings.enabledCRM&&l.uxConfiguration.crmSettings.tcGMSPortalName&&(e=l.uxConfiguration.crmSettings.tcGMSPortalName),e},getCybersource3DSV2Enabled:function(){var e=!1;if(l&&l.paymentProviders)for(var a=0;a<l.paymentProviders.length;a++){const t=l.paymentProviders[a];2!=t.paymentMethod||"3dsecurev2-cybersource"!=t.vendorKey.toLowerCase()||l.enable3DSv1PaymentProcessing||(e=!0)}return e}}}function insuranceService(e,a,t,o,r){function n(e){A=r.getReservation(),I=a.getHotelDesc();var t={id:"insurance-element",coveredProducts:this.getInsuranceShoppingCoveredProduct(e),marketCode:I.address.countryCode,providerCodes:["SET"],stakeholdersInformation:this.getInsuranceShoppingStakeholdersInformation(),authentication:{token:"",phase:D}};return Object.entries(this.getInsuranceShoppingPreferences(e)).length&&(t.preferences=this.getInsuranceShoppingPreferences(e)),t}function i(){var e="",a=document.getElementsByClassName("Checkout-section");if(a&&a.length){e="--amadeus-insurance-teaser-padding-right: 0px;--amadeus-insurance-teaser-padding-left: 0px;--amadeus-insurance-teaser-item-padding-right: 20px;--amadeus-insurance-teaser-width: 100%;--amadeus-insurance-teaser-max-width: 100%;--amadeus-insurance-teaser-item-header-price-display: none;--amadeus-insurance-teaser-item-background-color: "+getComputedStyle(a[0]).backgroundColor+";"}var t="",o=document.getElementsByClassName("Section-displayTitle");if(o&&o.length){var r=getComputedStyle(o[0]);t="--amadeus-insurance-teaser-item-header-text-color: "+r.color+";--amadeus-insurance-teaser-item-header-font-family: "+r.fontFamily+";--amadeus-insurance-teaser-item-header-font-weight: "+r.fontWeight+";--amadeus-insurance-teaser-item-header-font-size: "+r.fontSize+";--amadeus-insurance-teaser-item-header-line-height: "+r.lineHeight+";"}var n="",i=document.getElementsByClassName("Checkout-section Receipt-footer loyaltyPoints");if(i&&i.length){var s=getComputedStyle(i[0]);n="--amadeus-insurance-teaser-item-description-color: "+s.color+";--amadeus-insurance-teaser-item-read-more-color: "+s.color+";--amadeus-insurance-teaser-item-description-font-size: "+s.fontSize+";--amadeus-insurance-teaser-item-description-font-weight: "+s.fontWeight+";--amadeus-insurance-teaser-item-description-font-family: "+s.fontFamily+";--amadeus-insurance-teaser-item-description-line-height: "+s.lineHeight+";"}var l="";if(document.getElementsByClassName("breakdown-lbl")&&document.getElementsByClassName("breakdown-lbl").length&&document.getElementsByClassName("breakdown-lbl")[0].getElementsByTagName("a")&&document.getElementsByClassName("breakdown-lbl")[0].getElementsByTagName("a").length){var c=document.getElementsByClassName("breakdown-lbl")[0].getElementsByTagName("a")[0];const d=getComputedStyle(c).color;l="--amadeus-insurance-teaser-item-terms-hover-color:"+d+";--amadeus-insurance-teaser-item-terms-active-color:"+d+";--amadeus-insurance-teaser-item-terms-link-color:"+d+";--amadeus-insurance-teaser-item-terms-visited-color:"+d+";--amadeus-insurance-teaser-item-terms-hover-text-decoration: underline;"}var g="",m=document.getElementsByClassName("InputGroup--stacked");if(m&&m.length){var u=getComputedStyle(m[0]);g="--amadeus-insurance-teaser-item-acceptance-color: "+u.color+";--amadeus-insurance-teaser-item-acceptance-font-size: "+u.fontSize+";--amadeus-insurance-teaser-item-acceptance-font-weight: 400;--amadeus-insurance-teaser-item-acceptance-font-family: "+u.fontFamily+";"}var p="",y=document.getElementById("formatted-reservation-total-id");if(y){var v=getComputedStyle(y);p="--amadeus-insurance-teaser-item-acceptance-price-color: "+v.color+";--amadeus-insurance-teaser-item-acceptance-price-font-size: "+v.fontSize+";--amadeus-insurance-teaser-item-acceptance-price-font-weight: 700;--amadeus-insurance-teaser-item-acceptance-price-font-family: "+v.fontFamily+";"}var h=document.createElement("style");h.type="text/css";var R="* {"+e+t+n+l+g+p+"}";h.innerHTML=R,document.getElementsByTagName("head")&&document.getElementsByTagName("head")[0]&&document.getElementsByTagName("head")[0].appendChild(h)}function s(e){if(e)for(var a in e)S[a]=e[a]}function l(e){P=e}function c(){var e=[],a=this.getSupportedInsuranceProviderWithCardVendor();return a&&a.SET&&P&&P.length&&angular.forEach(P,function(t,o){var r=t.cardCode;t&&a.SET.cardVendor.indexOf(r)>=0&&e.push(t)}),e}function d(){return{SET:{cardVendor:["VI","MC","AX","DS","DN","JC","VE"]}}}function g(e){var a=e,t={JCBCard:"JC",Amex:"AX",Visa:"VI",DinersClub:"DN",Discover:"DS",MasterCard:"MC"};return t[a]?t[a]:e}function m(e){b=e}function u(){return b}function p(e){var t=[],o={hotel:{}},n={};I.hotelCode&&(n.id=JSON.stringify(I.hotelCode)),I&&I.chainInfo&&I.chainInfo.length&&I.chainInfo.length>0&&(n.code=I.chainInfo[0]),I&&I.hotelName&&(n.name=I.hotelName.substring(0,30));var i={};if(I.position&&(I.position.latitude||I.position.longitude)&&(i.startLocationDateTime=i.startLocationDateTime?i.startLocationDateTime:{},i.startLocationDateTime.geoCode={},i.startLocationDateTime.geoCode.latitude=I.position.latitude,i.startLocationDateTime.geoCode.longitude=I.position.longitude),A&&A.resGlobalInfo&&A.resGlobalInfo.timeSpan&&(i.startLocationDateTime=i.startLocationDateTime?i.startLocationDateTime:{},i.endLocationDateTime=i.endLocationDateTime?i.endLocationDateTime:{},i.startLocationDateTime.localDateTime=A.resGlobalInfo.timeSpan.start,i.endLocationDateTime.localDateTime=A.resGlobalInfo.timeSpan.end),I&&I.address&&I.address.countryCode&&i&&i.startLocationDateTime){var s={},l=[];if(I.address.countryCode&&(s.countryCode=I.address.countryCode),I.address.stateName){var c=a.getStateCodeByName(I.address.countryCode,I.address.stateName);c.length&&c[0].name&&(s.stateCode=c[0].code)}I.address.cityName&&(s.cityName=I.address.cityName),I.address.postalCode&&(s.postalCode=I.address.postalCode),I.address.addressLine1&&l.push(I.address.addressLine1),I.address.addressLine2&&l.push(I.address.addressLine2),l.length&&(s.lines=l),i.startLocationDateTime.address=s}if(r.getCurrencyDetails()){var d={};e&&e.total&&e.currency&&(d.total=parseFloat(e.total).toFixed(2),d.currency=e.currency)}return 0!==Object.entries(n).length&&(o.hotel.companyInformation=n),0!==Object.entries(i).length&&(o.hotel.coverageLocationPeriod=i),o.hotel.roomQuantity=1,Object.entries(d).length&&(o.hotel.price=d),Object.entries(o).length&&t.push(o),t}function y(e){var a={};return A&&A.languageCode&&(a.languageCode=A.languageCode),r.getCurrencyDetails()&&(a.preferredCurrency={decimalPosition:"2",decimalSeparator:"."},r.getCurrencyDetails().currencyDisplayFormat&&r.getCurrencyDetails().currencyDisplayFormat.hasOwnProperty("decimalSeparator")&&(a.preferredCurrency.decimalSeparator="."),r.getCurrencyDetails().currencyDisplayFormat&&r.getCurrencyDetails().currencyDisplayFormat.hasOwnProperty("precision")&&(a.preferredCurrency.decimalPosition=r.getCurrencyDetails().currencyDisplayFormat.precision),r.getCurrencyDetails()&&(a.preferredCurrency.displayOnLeft=!r.getCurrencyDetails().displayRightEnabled),r.getCurrencyDetails().currencyCode&&(a.preferredCurrency.code=r.getCurrencyDetails().currencyCode),e&&e.exchangeRate&&(a.preferredCurrency.exchangeRate=e.exchangeRate),r.getCurrencyDetails().currencySymbol&&(a.preferredCurrency.symbol=r.getCurrencyDetails().currencySymbol)),a}function v(){var e={numberOfAdults:0,numberOfChildren:0,numberOfInfants:0},a=[],t={};if(A&&A.resGlobalInfo&&A.resGlobalInfo.guestCounts)for(var o=0;o<A.resGlobalInfo.guestCounts.length;o++)"10"===A.resGlobalInfo.guestCounts[o].ageQualifyingCode?e.numberOfAdults=parseInt(A.resGlobalInfo.guestCounts[o].count):"8"===A.resGlobalInfo.guestCounts[o].ageQualifyingCode?e.numberOfChildren=parseInt(A.resGlobalInfo.guestCounts[o].count):"7"===A.resGlobalInfo.guestCounts[o].ageQualifyingCode&&(e.numberOfInfants=parseInt(A.resGlobalInfo.guestCounts[o].count));return S&&(S.countryCode&&(t.contact=t.contact?t.contact:{},t.contact.address=t.contact.address?t.contact.address:{},t.contact.address.countryCode=S.countryCode),S.stateCode&&(t.contact=t.contact?t.contact:{},t.contact.address=t.contact.address?t.contact.address:{},t.contact.address.stateCode=S.stateCode)),Object.entries(t).length&&t.contact.address.countryCode&&a.push(t),a&&a.length&&(e.stakeholders=a),e}function h(e){return o(function(o,n){var i=["EUR","USD","GBP"],s=r.getReservation(),l=s.roomStays[0].total.amountAfterTax,c=a.getHotelDesc(),d={total:"",currency:"",exchangeRate:1},g=!1,m=c.currentCurrency.currencyCode;void 0!=s.roomStays[0].ratePlans&&s.roomStays[0].ratePlans.length>0&&s.roomStays[0].ratePlans[0].merchandisedCurrency&&s.roomStays[0].ratePlans[0].merchandisedCurrency===e&&(g=!0),e&&i.indexOf(e)>-1&&(g||m&&m===e)?(d.total=l,d.currency=e,d.exchangeRate=1,o(d)):e&&m&&!g&&i.indexOf(e)>-1?t.TCCommonService&&t.TCCommonService.CurrencyFormatterService&&t.TCCommonService.CurrencyFormatterService._getCurrencyExchangeRates(m).then(function(a){a&&a.exchangeRates&&(angular.forEach(a.exchangeRates,function(a){a.currencyCode===e&&(d.total=l*a.rate,d.currency=e,d.exchangeRate=1)}),o(d))}):g?t.TCCommonService&&t.TCCommonService.CurrencyFormatterService&&t.TCCommonService.CurrencyFormatterService._getCurrencyExchangeRates(e).then(function(e){e&&e.exchangeRates&&(angular.forEach(e.exchangeRates,function(e){"USD"===e.currencyCode&&(d.total=l*e.rate,d.currency="USD",d.exchangeRate=parseFloat(1/e.rate).toFixed(2))}),o(d))}):"USD"===m?(d.total=l,d.currency="USD",d.exchangeRate=R(e,"USD",m),o(d)):t.TCCommonService&&t.TCCommonService.CurrencyFormatterService&&t.TCCommonService.CurrencyFormatterService._getCurrencyExchangeRates(m).then(function(a){a&&a.exchangeRates&&(angular.forEach(a.exchangeRates,function(a){"USD"===a.currencyCode&&(d.total=l*a.rate,d.currency="USD",d.exchangeRate=R(e,"USD",m))}),o(d))})})}function R(e,t,o){var r,n,i,s=a.getCurrencies();if(s&&s.length){o===t&&(n=1),o===e&&(r=1);for(var l=0;l<s.length&&(r||s[l].currencyCode!==e||(r=s[l].exchangeRate),n||s[l].currencyCode!==t||(n=s[l].exchangeRate),!r||!n);l++);r&&n&&(i=parseFloat(r/n).toFixed(2))}return i}function f(e,t){if(e&&e.length>0){var o="",n="";e[0].resGlobalInfo&&e[0].resGlobalInfo.timeSpan&&e[0].resGlobalInfo.timeSpan.start&&(o=e[0].resGlobalInfo.timeSpan.start),e[e.length-1].resGlobalInfo&&e[e.length-1].resGlobalInfo.timeSpan&&e[e.length-1].resGlobalInfo.timeSpan.end&&(n=e[e.length-1].resGlobalInfo.timeSpan.end);for(var i=0;i<e.length;i++){var s={insurance:{}},l={insuranceCompany:{companyShortName:""},reservationLineage:{primaryReservation:"",primaryReservationId:""},policyDetail:{policyDescription:"",policyHolderDetail:{countryName:"",stateProv:"",cityName:""},policyCode:"",policyProductId:"",policyCurrency:"",paymentMethod:"",adultsCovered:0,childrenCovered:0,policyQuote:""},policyNumber:"",effectiveDate:"",expireDate:"",insuranceType:"",purchaseDate:"",reservationPrice:"",termsAndConditionsAccepted:""};l.insuranceCompany.companyShortName="Setoo",l.insuranceType="hotel";var c=this.getSelectedInsurance();if(c&&"ACCEPTED"===c.selectionStatus){if(c.descriptions&&c.descriptions.length>0){l.policyDetail.policyDescription="";for(var d=0;d<c.descriptions.length;d++)""!=l.policyDetail.policyDescription?l.policyDetail.policyDescription=l.policyDetail.policyDescription.concat(" ",c.descriptions[d].description):l.policyDetail.policyDescription=c.descriptions[d].description}l.policyDetail.policyCurrency=r.getCurrencyDetails().currencyCode,l.policyDetail.policyQuote=c.priceDetails.total}if(t&&(l.policyNumber=t.policyConfirmationNumber,l.policyDetail.policyProductId=t.id),c&&c.provider&&c.provider.id&&(l.policyDetail.policyCode=c.provider.id),l.reservationLineage.primaryReservation=0==i?"true":"false",e[i].uniqueId&&void 0!=e[i].uniqueId&&(l.reservationLineage.primaryReservationId=e[0].uniqueId),e[i].resGuests&&e[i].resGuests[0].profile&&e[i].resGuests[0].profile.customer&&e[i].resGuests[0].profile.customer.address){if(e[i].resGuests[0].profile.customer.address[0].countryCode){var g=a.getCountryNameByCode(e[i].resGuests[0].profile.customer.address[0].countryCode);l.policyDetail.policyHolderDetail.countryName=g[0].name}if(e[i].resGuests[0].profile.customer.address[0].countryCode&&e[i].resGuests[0].profile.customer.address[0].stateCode){var m=a.getStateNameByCode(e[i].resGuests[0].profile.customer.address[0].countryCode,e[i].resGuests[0].profile.customer.address[0].stateCode);l.policyDetail.policyHolderDetail.stateProv=m[0].name}e[i].resGuests[0].profile.customer.address[0].cityName&&(l.policyDetail.policyHolderDetail.cityName=e[i].resGuests[0].profile.customer.address[0].cityName)}if(e[i].resGlobalInfo&&e[i].resGlobalInfo.guaranteesAccepted&&e[i].resGlobalInfo.guaranteesAccepted[0].paymentCard&&e[i].resGlobalInfo.guaranteesAccepted[0].paymentCard.cardCode&&(l.policyDetail.paymentMethod=e[i].resGlobalInfo.guaranteesAccepted[0].paymentCard.cardCode),
e[i].resGlobalInfo&&e[i].resGlobalInfo.guestCounts)for(var u=0;u<e[i].resGlobalInfo.guestCounts.length;u++)"10"===e[i].resGlobalInfo.guestCounts[u].ageQualifyingCode?l.policyDetail.adultsCovered=e[i].resGlobalInfo.guestCounts[u].count:"8"===e[i].resGlobalInfo.guestCounts[u].ageQualifyingCode?l.policyDetail.childrenCovered=e[i].resGlobalInfo.guestCounts[u].count:"7"===e[i].resGlobalInfo.guestCounts[u].ageQualifyingCode&&(l.policyDetail.childrenCovered=parseInt(l.policyDetail.childrenCovered)+parseInt(e[i].resGlobalInfo.guestCounts[u].count));if(e[i].resGlobalInfo&&e[i].resGlobalInfo.timeSpan&&e[i].resGlobalInfo.timeSpan.start&&(l.effectiveDate=o),e[i].resGlobalInfo&&e[i].resGlobalInfo.timeSpan&&e[i].resGlobalInfo.timeSpan.end&&(l.expireDate=n),l.purchaseDate=(new Date).toISOString().split("T")[0],e[i].roomStays&&e[i].roomStays[0].total&&e[i].roomStays[0].total.amountAfterTax&&(l.reservationPrice=e[i].roomStays[0].total.amountAfterTax),e[i].policies&&e[i].policies.textualPolicies)for(var p=0;p<e[i].policies.textualPolicies.length;p++)"Terms & Conditions"==e[i].policies.textualPolicies[p].policyType&&(l.termsAndConditionsAccepted="true");s.insurance=l,e[i].services.push(s)}}return e}function C(e,o){A=r.getReservation(),I=a.getHotelDesc();var n={stakeholdersInformation:this.getInsuranceShoppingStakeholdersInformation(),authentication:{token:"",phase:D}};e&&e.resGuests.length&&e.resGuests[0].profile&&e.resGuests[0].profile.customer&&(e.resGuests[0].profile.customer.givenName&&(n.stakeholdersInformation.stakeholders[0].name=n.stakeholdersInformation.stakeholders[0].name?n.stakeholdersInformation.stakeholders[0].name:{},n.stakeholdersInformation.stakeholders[0].name.firstName=e.resGuests[0].profile.customer.givenName),e.resGuests[0].profile.customer.surName&&(n.stakeholdersInformation.stakeholders[0].name=n.stakeholdersInformation.stakeholders[0].name?n.stakeholdersInformation.stakeholders[0].name:{},n.stakeholdersInformation.stakeholders[0].name.lastName=e.resGuests[0].profile.customer.surName),e.resGuests[0].profile.customer.telephone&&e.resGuests[0].profile.customer.telephone.length&&e.resGuests[0].profile.customer.telephone[0].phoneNumber&&(n.stakeholdersInformation.stakeholders[0].contact.phone=n.stakeholdersInformation.stakeholders[0].contact.phone?n.stakeholdersInformation.stakeholders[0].contact.phone:{},n.stakeholdersInformation.stakeholders[0].contact.phone.phoneNumber=e.resGuests[0].profile.customer.telephone[0].phoneNumber),e.resGuests[0].profile.customer.email&&(n.stakeholdersInformation.stakeholders[0].contact.email=n.stakeholdersInformation.stakeholders[0].contact.email?n.stakeholdersInformation.stakeholders[0].contact.email:{},n.stakeholdersInformation.stakeholders[0].contact.email.address=e.resGuests[0].profile.customer.email),n.stakeholdersInformation.stakeholders[0].contact.hasOwnProperty("address")||(n.stakeholdersInformation.stakeholders[0].contact.address={}),e.resGuests[0].profile.customer.address[0]&&e.resGuests[0].profile.customer.address[0].countryCode&&(n.stakeholdersInformation.stakeholders[0].contact.address.countryCode=e.resGuests[0].profile.customer.address[0].countryCode),e.resGuests[0].profile.customer.address[0]&&e.resGuests[0].profile.customer.address[0].stateCode&&(n.stakeholdersInformation.stakeholders[0].contact.address.stateCode=e.resGuests[0].profile.customer.address[0].stateCode),e.resGuests[0].profile.customer.address[0]&&e.resGuests[0].profile.customer.address[0].postalCode&&(n.stakeholdersInformation.stakeholders[0].contact.address.postalCode=e.resGuests[0].profile.customer.address[0].postalCode),e.resGuests[0].profile.customer.address[0]&&e.resGuests[0].profile.customer.address[0].cityName&&(n.stakeholdersInformation.stakeholders[0].contact.address.cityName=e.resGuests[0].profile.customer.address[0].cityName),e.resGuests[0].profile.customer.address[0]&&e.resGuests[0].profile.customer.address[0].addressLine1&&(n.stakeholdersInformation.stakeholders[0].contact.address.lines=[],n.stakeholdersInformation.stakeholders[0].contact.address.lines.push(e.resGuests[0].profile.customer.address[0].addressLine1)),e.resGuests[0].profile.customer.address[0]&&e.resGuests[0].profile.customer.address[0].addressLine2&&(n.stakeholdersInformation.stakeholders[0].contact.address.hasOwnProperty("lines")||(n.stakeholdersInformation.stakeholders[0].contact.address.lines=[]),n.stakeholdersInformation.stakeholders[0].contact.address.lines.push(e.resGuests[0].profile.customer.address[0].addressLine2))),n.stakeholdersInformation.stakeholders[0].isSubscriber=!0,n.stakeholdersInformation.stakeholders[0].isTraveler=!0,e&&e.resGlobalInfo&&e.resGlobalInfo.guaranteesAccepted&&e.resGlobalInfo.guaranteesAccepted.length>0&&e.resGlobalInfo.guaranteesAccepted[0].paymentCard&&e.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardNumber&&(n.payment=n.payment?n.payment:{},n.payment.creditCard=n.payment.creditCard?n.payment.creditCard:{},n.payment.creditCard.cardDetails=n.payment.creditCard.cardDetails?n.payment.creditCard.cardDetails:{},n.payment.creditCard.cardDetails.holderName=e.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderName,n.payment.creditCard.cardDetails.cardNumber=o.cardNumber,n.payment.creditCard.cardDetails.vendorCode=this.getFormattedCardVendor(e.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardCode),n.payment.creditCard.cardDetails.securityCode=o.seriesCode,n.payment.creditCard.cardDetails.expiryDate=o.expireDate.replace("/","")),t.AmadeusHosResInsuranceServices.InitializeInsuranceSdk.submitBooking(n)}var P=[],S={},A=r.getReservation(),I=a.getHotelDesc(),b={},D="prod1"===t.env||"prod"===t.env?"PROD":"TEST";return function(){a.showHideInsurance()&&(t.TCCommonService.EventService.subscribe("EVT_WC_ON_INSURANCE_SELECTION",function(a,t){t&&t.data&&t.data&&e.$broadcast("INSURANCE_COMPONENT_INSURANCE_SELECTION",t)}),t.TCCommonService.EventService.subscribe("EVT_WC_ON_INSURANCE_ERROR",function(a,t){t&&t.data&&t.data.length&&t.data[0].errorCode&&"booking"===t.data[0].errorCode.toLowerCase()?e.$broadcast("INSURANCE_COMPONENT_INSURANCE_BOOKING_ERROR",t):t&&t.data&&t.data.length&&t.data[0].errorCode&&"shopping"===t.data[0].errorCode.toLowerCase()&&e.$broadcast("INSURANCE_COMPONENT_INSURANCE_ERROR",t)}),t.TCCommonService.EventService.subscribe("EVT_WC_ON_INSURANCE_READY",function(a,t){t&&t.data&&t.data&&e.$broadcast("INSURANCE_COMPONENT_INSURANCE_WIDGET_READY",t)}))}(),{getAmadeusInsuranceSdkOptions:n,setStyleToInsuranceWidgetWithVariables:i,getSupportedCardVendors:c,bookingInsuranceMethod:C,insuranceSupportedCurrencyConversion:h,getSupportedInsuranceProviderWithCardVendor:d,setPaymentSupportedCardVendor:l,setInsuranceGuestInfo:s,getInsuranceShoppingCoveredProduct:p,getInsuranceShoppingPreferences:y,getInsuranceShoppingStakeholdersInformation:v,getFormattedCardVendor:g,prepareInsuranceObject:f,setSelectedInsurance:m,getSelectedInsurance:u}}function lodashFactoryMethod(e){if(!e._){var a=document.createElement("script");a.src="scripts/lodash.min.js",document.body.appendChild(a)}return e._}function loyaltyPointsService(e,a,t,o){function r(){return G}function n(e){G=e}function i(){return B.loyaltyEnabled}function s(){return i()&&B.brandBarEnabled}function l(){return B.enableEarnPoints}function c(){return B.enableRedeemPoints}function d(){N&&N.put("/page/loyaltyCacheObject/"+B.hotelCode,F)}function g(){if(t.loyaltyProfileData){var e=t.loyaltyProfileData.profile.consents||[];x=!1;for(var a=0;a<e.length;a++)"EMAIL"===e[a].type&&e[a].accepted&&(x=!0)}}function m(){return x}function u(){var e;return F&&F.loyaltyInfo&&(e=F.loyaltyInfo.availablePoints),e}function p(){var e;return F&&F.loyaltyInfo&&(e=F.loyaltyInfo.minRedemptionPoints),e}function y(){var e=!0;return void 0!=l()&&void 0!=c()&&(l()||c()||(e=!1)),e}function v(e){F.burnPoints=e,d()}function h(){return F.burnPoints}function R(e){k=!0,t.dataLayer.push({loggedIn:"yes"}),F=e,d(),g()}function f(){N&&N.remove("/page/loyaltyCacheObject/"+B.hotelCode),k=!1,t.dataLayer.push({loggedIn:"no"}),F={},x=!1}function C(e){return F.burnPoints?S(F.burnPoints,e):void 0}function P(e){F.reservationTotal=e,d()}function S(e,a){var t;if(e){t=e*F.loyaltyInfo.conversionRatio;var r=o.findIndex(B.currencies,function(e){return e.currencyCode.toLowerCase()==F.loyaltyInfo.currencyCode.toLowerCase()}),n=B.currencies[r].exchangeRate;(t=parseFloat(parseFloat(t/n).toFixed(2)))>a&&(t=parseFloat(a))}return t}function A(){return k}function I(){return F}function b(e){var a=D(e);return a&&a>F.loyaltyInfo.availablePoints?F.loyaltyInfo.availablePoints:a}function D(e){var a;if(F&&F.loyaltyInfo&&F.loyaltyInfo.currencyCode){var t=parseFloat(e),r=o.findIndex(B.currencies,function(e){return e.currencyCode.toLowerCase()==F.loyaltyInfo.currencyCode.toLowerCase()});t*=B.currencies[r].exchangeRate,a=parseFloat(t/F.loyaltyInfo.conversionRatio)}return Math.ceil(a)}function T(){return!(!F||!F.isMaximumPointsApplied)}function O(e){F.isMaximumPointsApplied=e,d()}function E(){return L}function M(e,a){if(i()){!function(){function e(e,a){a=a||{bubbles:!1,cancelable:!1,detail:void 0};var t=document.createEvent("CustomEvent");return t.initCustomEvent(e,a.bubbles,a.cancelable,a.detail),t}"function"!=typeof window.CustomEvent&&(e.prototype=window.Event.prototype,window.CustomEvent=e)}();var t=new CustomEvent(e,a);document.body.dispatchEvent(t)}}function _(){var e;return i()&&k&&F&&F.loyaltyInfo&&F.loyaltyInfo.tierId&&(e=F.loyaltyInfo.tierId),e}var k,N,L,G,F={},B=angular.copy(t.HotelDescriptiveInfo2),x=!1;return e.get("loyaltyCache")||(N=e.createCache("loyaltyCache",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"})),i()&&(function(){t.loyaltyProfileData&&void 0!=t.route&&"ALTERNATE_PAYMENT_RESPONSE"!=t.route?R(angular.copy(t.loyaltyProfileData)):N&&N.get("/page/loyaltyCacheObject/"+B.hotelCode)&&!o.isEmpty(N.get("/page/loyaltyCacheObject/"+B.hotelCode))&&(F=angular.copy(N.get("/page/loyaltyCacheObject/"+B.hotelCode)))&&F.loyaltyInfo&&!o.isEmpty(F.loyaltyInfo)&&(k=!0)}(),function(){t.loyaltyConfigData?(L=t.loyaltyConfigData,N&&N.put("/page/loyaltyConfigCacheObject/"+B.hotelCode,L)):N&&N.get("/page/loyaltyConfigCacheObject/"+B.hotelCode)&&!o.isEmpty(N.get("/page/loyaltyConfigCacheObject/"+B.hotelCode))&&(L=angular.copy(N.get("/page/loyaltyConfigCacheObject/"+B.hotelCode)))}()),document.body.addEventListener("LOYALTY_USER_LOGIN",function(){if(i()&&(void 0!=t.route&&"ALTERNATE_PAYMENT_RESPONSE"!=t.route||!k)){R(angular.copy(t.loyaltyProfileData)),a.$broadcast("LOYALTY_USER_LOGIN_SUCCESS")}}),document.body.addEventListener("LOYALTY_USER_LOGOUT",function(){i()&&(delete t.loyaltyProfileData,f(),a.$broadcast("EVENT.SPECIALCODES_REMOVE_MANUAL_LABEL_AFTER_LOGOUT"),a.$broadcast("LOYALTY_USER_LOGOUT_SUCCESS"))}),document.body.addEventListener("LOYALTY_CONFIG_DATA",function(){i()&&(L=t.loyaltyConfigData,N&&N.put("/page/loyaltyConfigCacheObject/"+B.hotelCode,L),a.$broadcast("LOYALTY_CONFIG_DATA_SUCCESS"))}),document.body.addEventListener("HIDE_EMAIL_MARKETING_BE4_TOTAL_PAGE",function(){x=!0}),{getAvailablePoints:u,setBurnPoints:v,getBurnPoints:h,loyaltyUserLogin:R,loyaltyUserLogout:f,getBurnPointsCurrencyValueFromBurnPoints:C,getBurnPointsCurrencyValueFromPassedPoints:S,getIsLoyaltyUserLogIn:A,getLoyaltyPointsObject:I,getMaxPointsToEnter:b,getIsMaximumPointsApplied:T,setIsMaximumPointsApplied:O,convertCashToPoints:D,setReservationTotal:P,getLoyaltyConfig:E,fireLoyaltyEvent:M,getMinPointsForRedemption:p,getPropertyLoyaltyParticipationConfig:y,getLoyaltyTierId:_,getIsLoyaltyReservationEnabled:i,getIsBrandBarDisplay:s,getEnableEarnPoints:l,getEnableRedeemPoints:c,getRecallAvailAsync:r,setRecallAvailAsync:n,setEmailMarketingConsentStatus:g,getEmailMarketingConsentStatus:m}}function memberRateService(e,a,t,o,r){function n(){return u=!(!p||!(g&&g.privateOffersEnabled&&m.enabledPrivateOffers&&""!=m.tcGMSPortalName&&!1===t.checkGmsLogin()||!o.getIsLoyaltyUserLogIn()&&(o.getIsBrandBarDisplay()||r.getMenubarEnabled()&&o.getIsLoyaltyReservationEnabled())))}function i(e){var a=angular.copy(e.roomStays[0].allRoomTypes),t=angular.copy(e.roomStays[0].roomTypes),o=angular.copy(e.roomStays[0].ratePlans),r=angular.copy(e.roomStays[0].packageTypes);return e.roomStays[0].allRoomTypes=s(a),e.roomStays[0].roomTypes=l(o,t),e.roomStays[0].ratePlans=c(o),e.roomStays[0].packageTypes=d(r,a),e}function s(e){for(var a=0;a<e.length;a++){for(var t=[],o=0;o<e[a].averageRates.length;o++)if("Regular"===e[a].averageRates[o].ratePlanType&&e[a].averageRates[o].memberRate&&void 0!=e[a].averageMemberRates&&e[a].averageMemberRates.length>0)for(var r=0;r<e[a].averageMemberRates.length;r++)if(e[a].averageMemberRates[r].ratePlanCode===e[a].averageRates[o].ratePlanCode)if(e[a].averageRates[o].isAbstract)e[a].averageRates[o].isMemberRatePlan=!0;else{var n=angular.copy(e[a].averageMemberRates[r]);n.ratePlanCode="M_"+n.ratePlanCode,n.isMemberRatePlan=!0,t.push(n)}e[a].averageRates=t.concat(e[a].averageRates)}for(var a=0;a<e.length;a++)for(var o=0;o<e[a].averageRates.length;o++)if("Regular"===e[a].averageRates[o].ratePlanType&&void 0!=e[a].nightlyMemberRates&&e[a].nightlyMemberRates.length>0)for(var r=0;r<e[a].nightlyMemberRates.length;r++)if(e[a].nightlyMemberRates[r].ratePlanCode===e[a].averageRates[o].ratePlanCode&&!e[a].averageRates[o].isAbstract){var i=angular.copy(e[a].nightlyMemberRates[r]);i.ratePlanCode="M_"+i.ratePlanCode,e[a].nightlyRates.push(angular.copy(i))}return e}function l(e,a){for(var t,o=angular.copy(a),r=[],n=0;n<e.length;n++)if(!0===e[n].default){t=e[n].ratePlanCode;break}for(var i=0;i<o.length;i++){var s=angular.copy(o[i]);if(s.averageMemberRates&&s.averageMemberRates.length>0){for(var l=0;l<s.averageRates.length;l++)if(("regular"===s.averageRates[l].ratePlanType.toLowerCase()||"package"===s.averageRates[l].ratePlanType.toLowerCase())&&s.averageRates[l].memberRate)for(var c=0;c<s.averageMemberRates.length;c++){if(s.averageMemberRates[c].ratePlanCode===s.averageRates[l].ratePlanCode&&!s.averageRates[l].isAbstract){var d=angular.copy(s.averageMemberRates[c]);s.averageRates[l]=d}if(s.averageRates[l].ratePlanCode===t&&s.averageRates[l].isAbstract){o[i].isMemberRatePlan=!0;break}}for(var g=0;g<s.nightlyRates.length;g++)for(var m=0;m<s.nightlyMemberRates.length;m++)if(s.nightlyMemberRates[m].ratePlanCode===s.nightlyRates[g].ratePlanCode){var u=angular.copy(s.nightlyMemberRates[m]);s.nightlyRates[g]=u}for(var c=0;c<s.averageMemberRates.length;c++)if(s.averageMemberRates[c].ratePlanCode===t&&!s.averageMemberRates[c].isAbstract){s.roomTypeCode="M_"+s.roomTypeCode,s.isMemberRatePlan=!0,r.push(s);break}}}return r.length>0&&(o=r.concat(o)),o}function c(a){for(var t=angular.copy(a),o=[],r=0;r<t.length;r++)if(t[r].isAbstract){void 0!=t[r].leadMemberRate&&void 0==t[r].leadRate&&(t[r].leadRate=t[r].leadMemberRate),void 0!=t[r].discountMemberRate&&void 0==t[r].discountRate&&(t[r].discountRate=t[r].discountMemberRate);var n=t[r].ratePlanCode;o[n]={isAbstract:t[r].isAbstract,ratePlanCode:t[r].ratePlanCode}}return e.ratePlanList=o,t}function d(a,t){for(var o=angular.copy(a),r=[],n=0;n<t.length;n++)if(t[n].averageMemberRates&&t[n].averageMemberRates.length>0)for(var i=0;i<t[n].averageMemberRates.length;i++)if("package"===t[n].averageMemberRates[i].ratePlanType.toLowerCase()&&t[n].averageMemberRates[i].ratePlanCode){var s=t[n].averageMemberRates[i].ratePlanCode;-1==r.indexOf(s)&&(r[s]={isAbstract:t[n].averageMemberRates[i].isAbstract,ratePlanCode:t[n].averageMemberRates[i].ratePlanCode})}e.packageList=r;for(var l=0;l<o.length;l++)r.length>0&&void 0!=r[o[l].packageCode]&&r[o[l].packageCode].isAbstract&&(o[l].leadMemberRate&&!o[l].leadRate&&(o[l].leadRate=o[l].leadMemberRate),o[l].discountMemberRate&&!o[l].discountRate&&(o[l].discountRate=o[l].discountMemberRate));return o}var g=angular.copy(a.HotelDescriptiveInfo2),m=g.uxConfiguration.crmSettings,u=!1,p=g.enableMemberRateMerchandising;return{getIncludeMemberRate:n,createDuplicateRateList:i,setLeadRateAndDiscountRateForRateplanFromMemberRateData:c,setLeadRateAndDiscountRateForPackagesFromMemberRateData:d}}function menubarService(e,a,t,o,r){function n(){return l}function i(){return c}function s(){return!(!l||!c)&&c.uxInfo.uxSettings.displayPropertyName}var l=angular.copy(e.isMenubarEnabled),c=angular.copy(e.menuBarMetaData);if(l&&e.TCCommonService&&c&&t.getIsLoyaltyReservationEnabled()){e.TCCommonService.EventService.subscribe("on_loyalty_signup_modal_continue",function(){o.$broadcast("VIEW_ROOM_DETAILS")}),e.TCCommonService.EventService.subscribe("loyalty_guest_sign_in",function(a,r){var n=r.data.data;e.loyaltyProfileData=angular.copy(n),o.loyaltyGuestAction=r.data.action,t.fireLoyaltyEvent("LOYALTY_USER_LOGIN")}),e.TCCommonService.EventService.subscribe("loyalty_guest_sign_out",function(e,a){t.fireLoyaltyEvent("LOYALTY_USER_LOGOUT")});var d={enableLoginRewardBookModify:c.uxInfo.uxSettings.loyaltyLoginOptions.enableLoginRewardBookModify,programName:c.loyaltyInfo.programName,isBrandBarEnabledOnBE:c.uxInfo.uxSettings.menuBarDisplayApps.displayAtBookEng,programCurrency:c.loyaltyInfo.currencyLabel,showHideLoyaltyPoints:c.uxInfo.uxSettings.loyaltyLoginOptions.showHideLoyaltyPoints};e.loyaltyConfigData=angular.copy(d),t.fireLoyaltyEvent("LOYALTY_CONFIG_DATA"),e.TCCommonService.EventService.subscribe("social_login_init",function(e,a){var t=window.location.href.split("#")[1];sessionStorage.setItem("applicationRoute/"+window.HotelDescriptiveInfo2.hotelCode,t)}),e.TCCommonService.EventService.subscribe("hide_email_marketing_be4_total_page",function(){t.fireLoyaltyEvent("HIDE_EMAIL_MARKETING_BE4_TOTAL_PAGE")})}return{getMenubarEnabled:n,getMenubarData:i,getDisplayPropertyName:s}}function myCheckWalletService(e,a,t,o){function r(){var e=o.getHotelDesc();return!(!(e.paymentProviders&&e.paymentProviders.length>0&&e.paymentProviders[0].paymentMethod&&e.paymentProviders[0].vendorKey)||1!=e.paymentProviders[0].paymentMethod&&4!=e.paymentProviders[0].paymentMethod&&24!=e.paymentProviders[0].paymentMethod&&25!=e.paymentProviders[0].paymentMethod||"creditcard-mycheck"!=e.paymentProviders[0].vendorKey&&"altpayment-mycheck"!=e.paymentProviders[0].vendorKey)}function n(){return angular.copy(y)}function i(a,t){e.MRB&&!t?void 0!=a.reservationResponses&&a.reservationResponses.length>0&&void 0!=a.reservationResponses[0].resGlobalInfo&&a.reservationResponses[0].resGlobalInfo.guaranteesAccepted.length>0&&void 0!=a.reservationResponses[0].resGlobalInfo.guaranteesAccepted[0].walletRedemption&&(y=a.reservationResponses[0].resGlobalInfo.guaranteesAccepted[0].walletRedemption):void 0!=a&&void 0!=a.resGlobalInfo&&a.resGlobalInfo.guaranteesAccepted.length>0&&void 0!=a.resGlobalInfo.guaranteesAccepted[0].walletRedemption&&(y=a.resGlobalInfo.guaranteesAccepted[0].walletRedemption),y&&m&&m.put("/page/myCheckCacheObject/"+o.getHotelDescUpdated().hotelCode,y)}function s(){y={},m&&m.remove("/page/myCheckCacheObject/"+o.getHotelDescUpdated().hotelCode)}function l(e){u=e}function c(){return u}function d(e){p=e.data}function g(){return p}var m,u,p,y={};return a.get("myCheckCache")||(m=a.createCache("myCheckCache",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"})),r()&&function(){m&&m.get("/page/myCheckCacheObject/"+o.getHotelDescUpdated().hotelCode)&&!t.isEmpty(m.get("/page/myCheckCacheObject/"+o.getHotelDescUpdated().hotelCode))&&(y=m.get("/page/myCheckCacheObject/"+o.getHotelDescUpdated().hotelCode))}(),{isMyCheckPaymentEnabled:r,getMyCheckRefershTokenDetails:n,setMyCheckRefershTokenDetails:i,resetMyCheckRefershTokenDetails:s,saveCardInfoData:l,getCardInfoData:c,setMyCheckV2CardDetails:d,getMyCheckV2CardDetails:g}}function paymentComponentService(e,a,t,o,r){function n(){return m=JSON.stringify({"IBE AriaLabel Expiration date month":a.translate["page_expirationmonth-Lblexpirationmonth"],"IBE AriaLabel Expiration date year":a.translate["page_expirationdateyear-Lblexpirationdateyear"],"IBE AriaLabel will be charged to your credit card":"will be charged to your credit card","IBE Button PAY NOW":"PAY NOW","IBE Label A valid form of payment must be presented at check-in":a.translate["page_validformcheckin-Lblvalidformcheckin"],"IBE Label and the":"and the","IBE Label Card Number":a.translate.page_nameoncard_CardNumberLbl,"IBE Label CVV":a.translate.page_mm_CVVLbl,"IBE Label Credit card checkbox1":"I understand that","IBE Label Credit card checkbox2":"will be charged to my card once my reservation is confirmed","IBE Label Enter card number":a.translate.page_nameoncard_CardNumberLbl,"IBE Label Expiration Date":a.translate["page_expirationdate-Lblexpirationdate"],"IBE Label Full name on the credit card":a.translate.page_nameoncard_NameOnCardLbl,"IBE Label I have read and agree to the":a.translate.global_readandagreetoTC_ReadAndAgreeToTC1Lbl,"IBE Label Logo":a.translate["page_logo-Lbllogo"],"IBE Label Name on Card":a.translate.page_nameoncard_NameOnCardLbl,"IBE Label MM":a.translate["page_mm-Lblmm"],"IBE Label Pay with Credit/Debit Card":a.translate["page_paywithcreditdebit-Lblpaywithcreditdebit"],"IBE Label Payment Details":"Payment Details","IBE Label Privacy Policy":a.translate.global_privacypolicy_NoColonPrivacyLbl,"IBE Label Secure":a.translate["page_secure-Lblsecure"],"IBE Label Show Pricing Breakdown":"Show Pricing Breakdown","IBE Label Taxes Included":"Taxes Included","IBE Label Terms & Conditions":a.translate.global_termsAndconditions_TermsAndConditionsLbl,"IBE Label Total":a.translate.global_total_TotalLbl,"IBE Label Use the same address as contact info":a.translate.page_usethesameaddressascontactinfo_UseTheSameAddressAsContactInfoLbl,"IBE Label YY":a.translate["page_yy-Lblyy"],"IBE Message Credit card checkbox unchecked":"Please acknowledge that a deposit is required to book your stay","IBE Message Credit Card validation1":a.translate.page_CardTypeNotAcceptedForProperty1_CardTypeNotAcceptedForProperty1Err,"IBE Message Credit Card validation2":a.translate.page_CardTypeNotAcceptedForProperty2_CardTypeNotAcceptedForProperty2Err,"IBE Message Please enter a card with a valid expiration date":a.translate["page_entercardvalidexpiration-Lblentercardvalidexpiration"],"IBE Message Please enter a credit card holder":a.translate.page_pleaseEnteACreditCardHolder_pleaseEnteACreditCardHolderErr,"IBE Message Please enter a credit card number":a.translate.page_pleaseEnterACreditCardNumber_pleaseEnterACreditCardNumberErr,"IBE Message Please enter a valid name":a.translate.page_pleaseEnterValidName_pleaseEnterValidNameErr,"IBE Message Please enter an expiration date. (MM/YY)":a.translate.page_pleaseEnterAnExpirationDate_pleaseEnterAnExpirationDateErr,"IBE Message Please enter a valid credit card number":a.translate.page_pleaseEnterAvalidCreditCardNumber_pleaseEnterAvalidCreditCardNumberErr,"IBE Message Please enter security code":a.translate.global_thiscreditcardrequiresasecuritycode_ThisCreditCardReuiresASecurityCodeMsg,"IBE Message Please enter the correct number of digits":"Please enter the correct number of digits","IBE Label Deposit Policy":a.translate.global_depositPolicy_DepositPolicy,"IBE Label Guarantee Policy":a.translate.global_guaranteePolicy_GuaranteePolicy,"IBE Label Cancellation Policy":a.translate.global_cancellationPolicy_CancellationPolicy,"IBE Button ACCEPT":"ACCEPT","IBE Button DECLINE":a.translate.global_decline_DeclineLbl,"IBE Label Policies":a.translate.global_policies_PoliciesLbl,"IBE Label Terms and Conditions":a.translate.global_termsAndconditions_TermsAndConditionsLbl,"IBE Button AGREE":a.translate.global_agree_AgreeLbl,"IBE Message Please review the Terms & Conditions for this reservation and check the box to continue.":a.translate.global_pleasereviewthetermsAndmsg_PleaseReviewTheTermsAndMsg,"IBE Label Billing Address":a.translate.page_billingaddress_BillingAddressLbl,"IBE Label City/Locality":a.translate.page_guestDetails_cityLbl,"IBE Label Country":a.translate.page_guestDetails_CountryLbl,"IBE Label Please select your country":a.translate["page_selectcountry-Lblselectcountry"],"IBE Label Apt/Unit/District":a.translate["page_aptunitdistrict-Lblaptunitdistrict"],"IBE Label State/Province":a.translate.global_stateprovince_StateProvinceLbl,"IBE Label Zip/Postal Code":a.translate.global_postalcode_PostalCodeLbl,"IBE Message Field cannot be blank":a.translate.page_error_FieldCannotBeBlankLbl,"IBE Label Please select your Province/State":a.translate["page_selectprovincestate-Lblselectprovincestate"],"IBE Label Select an option":a.translate["page_selectanoption-Lblselectanoption"],"IBE Label Select":a.translate.global_header_lblSelect,"IBE Label No results found":a.translate.global_NoResultsFound_LblNoResultsFound,"IBE Label CVV Placeholder":a.translate.page_mm_CVVLbl,"IBE Label Pay with Other Methods":a.translate["page_othermethodsofpayment-Lblothermethodsofpayment"],"IBE Label Change Payment type":a.translate["page_changepaymenttype-Lblchangepaymenttype"],"IBE Message A payment method must be selected to complete your booking reservation":a.translate["page_paymentmethodmustbeselected-Lblpaymentmethodmustbeselected"],"IBE Button Refresh Payment Method":a.translate["page_refreshpaymentmethod-Lblrefreshpaymentmethod"],"IBE Unexpected Internal Error Occurred":a.translate["page_unexpectedinternalerror-Msgunexpectedinternalerror"],"IBE Unexpected Error Occurred":a.translate["page_unexpectederroroccured-Msgunexpectederroroccured"],"IBE Session Timeout Occurred":a.translate["page_sessiontimeoutoccurred-Msgsessiontimeoutoccurred"]})}function i(){var t=[],o=r.getMainReservation(),n=r.getMainReservationArray(),i={policyType:"",acceptTender:""};return a.MRB&&1==n.length||!a.MRB?(i.policyType=o.policies.guaranteePolicies[0].policyType.toLowerCase(),i.acceptTender=o.policies.guaranteePolicies[0].acceptTender.toLowerCase(),t.push(i)):e.forEach(n,function(e){var a={policyType:e.policies.guaranteePolicies[0].policyType.toLowerCase(),acceptTender:e.policies.guaranteePolicies[0].acceptTender.toLowerCase()};t.push(a)}),t=JSON.stringify(t)}function s(e){u=e||{addressLine1:"",addressLine2:"",cityName:"",countryCode:"",countryName:"",postalCode:"",stateCode:"",stateName:"",useType:""}}function l(){return u}function c(e){p=e}function d(){return p}function g(){var e=t.getUxConfiguration().reservationAndPaymentConfig;return guestFieldsConfigurations=JSON.stringify({salutation:{mandatory:!1,enable:!1,hidden:!1},firstName:{mandatory:!0,enable:!1,hidden:!1},lastName:{mandatory:!0,enable:!1,hidden:!1},email:{mandatory:!0,enable:!1,hidden:!1},phoneNumber:{mandatory:!0,enable:!1,hidden:!1},addressLine1:{mandatory:e.addressLine1RequiredIndicator,enable:e.displayAddressLine1FieldIndicator,hidden:e.addressLine1SecondaryDisplayIndicator},addressLine2:{mandatory:e.addressLine2RequiredIndicator,enable:e.displayAddressLine2FieldIndicator,hidden:e.addressLine2SecondaryDisplayIndicator},postalCode:{mandatory:e.postalCodeRequiredIndicator,enable:e.displayPostalCodeFieldIndicator,hidden:e.postalCodeSecondaryDisplayIndicator},city:{mandatory:e.cityRequiredIndicator,enable:e.displayCityFieldIndicator,hidden:e.citySecondaryDisplayIndicator},country:{mandatory:e.countryRequiredIndicator,enable:e.displayCountryFieldIndicator,hidden:e.countrySecondaryDisplayIndicator},state:{mandatory:e.stateRequiredIndicator,enable:e.displayStateFieldIndicator,hidden:e.stateSecondaryDisplayIndicator},frequentGuestId:{mandatory:e.enableFrequentGuestId,enable:e.displayFrequentGuestIdIndicator,hidden:!1}}),guestFieldsConfigurations}var m,u,p;return function(){(r.isBrainTreePaymentEnabled()||r.isAmadeusPaymentEnabled())&&o.TCCommonService&&o.TCCommonService.EventService.subscribe("EVT_WC_PAYMENTS_ON_CAPTURE_PAYMENT_DETAILS",function(e,t){a.$broadcast("PAYMENT_COMPONENT_DETAILS_CAPTURED",t)})}(),{getTranslationLabels:n,getReservationPolicies:i,setBillingAddress:s,getBillingAddress:l,setGuaranteeAcceptedDetailsData:c,getGuaranteeAcceptedDetailsData:d,getGuestFieldsConfigurations:g}}function reservationService(e,a,t,o,r,n,i,s,l,c,d,g,m,u,p){function y(){if(void 0===_r.get("/page/landingUrl")){var e=s.location.origin+s.location.pathname+s.location.search;_r.put("/page/landingUrl",e)}}function v(){var e=["JRR","GOOGLE","HTLCOMB","BING","KAYAK","TRIVAGO","TRIPADVISOR","SKYSCANNER","ROOMKEY","WEGO","HOTELLOOK"],a="",t="";if(jr&&jr.posSource&&jr.posSource.companyName&&(t=jr.posSource.companyName.code?jr.posSource.companyName.code:jr.posSource.companyName.companyShortName),t){var o=t.split("_");a=o.length>0?o[0]:t}if(a&&e.includes(a.toUpperCase())&&t)return t}function h(){return on}function R(){return tn}function f(e){void 0==Wr&&(Wr={}),Wr[e]=!0}function C(e){return Wr[e]}function P(e){void 0!=Wr[e]&&delete Wr[e]}function S(e){Cr=e,_r.put("/page/modify/"+r.getHotelInfo().hotelCode,Cr)}function A(e){Pr=e,_r.put("/page/group/"+r.getHotelInfo().hotelCode,Pr)}function I(e){Ar=e,_r.put("/page/currency/"+r.getHotelInfo().hotelCode,Ar)}function b(){_r.put("/page/reservation/"+r.getHotelInfo().hotelCode,jr),a.MRB&&(_r.put("/page/reservationArray/"+r.getHotelInfo().hotelCode,Yr),Kr.length>0&&_r.put("/page/initOptionsArrays/"+r.getHotelInfo().hotelCode,Kr),_r.put("/page/enabelRoomSelector/"+r.getHotelInfo().hotelCode,a.enabelRoomSelector)),D()}function D(){s.dataLayer.push({ihHotelID:r.getHotelInfo().hotelCode}),s.dataLayer.push({ihHotelName:r.getHotelInfo().hotelName}),s.dataLayer.push({contentGroup:"conversion"}),s.dataLayer.push({pageSubsectionB:"be"}),s.dataLayer.push({globalProduct:"be"}),a.$on("$stateChangeStart",function(e,a){if(a.name.includes("confirmation")){if(O(),m.getIsLoyaltyReservationEnabled()){E(m.getBurnPoints()?parseFloat(m.getBurnPoints()):0)}r.getHotelDesc().enableEmailHashing&&T()}}),r.getHotelDesc().address.stateName&&s.dataLayer.push({ihState:r.getHotelDesc().address.stateName}),r.getHotelDesc().address.cityName&&s.dataLayer.push({ihCity:r.getHotelDesc().address.cityName}),r.getHotelDesc().address.countryName&&s.dataLayer.push({ihCountry:r.getHotelDesc().address.countryName});var t=ve();if(void 0!=t&&t.indexOf("_")>0&&s.dataLayer.push({pageLanguage:t.split("_")[0].toLowerCase()}),xr||m.getIsLoyaltyUserLogIn()?s.dataLayer.push({loggedIn:"yes"}):s.dataLayer.push({loggedIn:"no"}),a.MRB){for(var o=he(),n=[],i=!1,l=0,c=0,d=0,g=0;g<Yr.length;g++){n[g]={},n[g].ihHotelID=r.getHotelInfo().hotelCode,n[g].ihHotelName=r.getHotelInfo().hotelName;var u=0;if(Yr[g].services&&Yr[g].services.length)for(var p=0;p<Yr[g].services.length;p++)"ENHANCEMENT"===Yr[g].services[p].serviceCategory&&u++;n[g].ihEnhancementCount=u;for(var y=Yr[g].resGlobalInfo.guestCounts,p=0;p<y.length;p++)null!=y[p].ageQualifyingCode&&void 0!=y[p].ageQualifyingCode&&"10"===y[p].ageQualifyingCode?void 0!=y[p].count&y[p].count>0&&(c+=parseInt(y[p].count),n[g].ihAdults=y[p].count,i=!0):null!=y[p].ageQualifyingCode&&void 0!=y[p].ageQualifyingCode&&"8"===y[p].ageQualifyingCode&&void 0!=y[p].count&&(l+=parseInt(y[p].count),void 0==n[g].ihChildren?n[g].ihChildren=parseInt(y[p].count):n[g].ihChildren+=parseInt(y[p].count))}if(s.dataLayer.push({ihAdults:c}),Yr&&Yr.length)for(var g=0;g<Yr.length;g++)if(Yr[g].services&&Yr[g].services.length)for(var p=0;p<Yr[g].services.length;p++)"ENHANCEMENT"===Yr[g].services[p].serviceCategory&&d++;if(s.dataLayer.push({ihEnhancementCount:d}),s.dataLayer.push({ihChildren:l}),jr.itineraryId&&s.dataLayer.push({ihItineraryID:jr.itineraryId}),Yr.length>0&&void 0!=Yr[0].resGlobalInfo&&void 0!=Yr[0].resGlobalInfo.timeSpan&&void 0!=Yr[0].resGlobalInfo.timeSpan.start&&void 0!=Yr[0].resGlobalInfo.timeSpan.end){s.dataLayer.push({ihDate:Yr[0].resGlobalInfo.timeSpan.start}),s.dataLayer.push({ihDateOut:Yr[0].resGlobalInfo.timeSpan.end});var v=moment(Yr[0].resGlobalInfo.timeSpan.end).diff(Yr[0].resGlobalInfo.timeSpan.start,"days");s.dataLayer.push({ihNights:v})}if(Yr.length>0&&void 0!=Yr[0].uniqueId&&""!=Yr[0].uniqueId&&(s.dataLayer.push({ihConfirmID:Yr[0].uniqueId}),Xr.dataLayerFlag.dataLayerFlagForConfirmID=!0),Yr.length>0&&Yr[0].hasOwnProperty("allCodes")&&(void 0!=Yr[0].allCodes.Discount&&(s.dataLayer.push({ihDiscountCode:Yr[0].allCodes.Discount
}),Xr.dataLayerFlag.dataLayerFlagForDiscountCode=!0),void 0!=Yr[0].allCodes.TravelAgent&&(s.dataLayer.push({ihTACode:Yr[0].allCodes.TravelAgent}),Xr.dataLayerFlag.dataLayerFlagForTravelAgentCode=!0),void 0!=Yr[0].allCodes.Group&&(s.dataLayer.push({ihGroupCode:Yr[0].allCodes.Group}),Xr.dataLayerFlag.dataLayerFlagForGroupCode=!0),void 0!=Yr[0].allCodes.Corporate&&(s.dataLayer.push({ihAccessCode:Yr[0].allCodes.Corporate}),Xr.dataLayerFlag.dataLayerFlagForAccessCode=!0)),Yr.length>0&&void 0!=Yr[0].roomStays&&Yr[0].roomStays.length>0&&void 0!=Yr[0].roomStays[0].discountCode&&(s.dataLayer.push({ihDiscountCode:Yr[0].roomStays[0].discountCode}),Xr.dataLayerFlag.dataLayerFlagForDiscountCode=!0),Yr.length>0&&void 0!=Yr[0].posSource&&void 0!=Yr[0].posSource.requestorIds&&Yr[0].posSource.requestorIds.length>0){var h=Yr[0].posSource.requestorIds;if(h.length>0)for(var p=0;p<h.length;p++)"travelagent"==h[p].codeType?(s.dataLayer.push({ihTACode:h[p].id}),Xr.dataLayerFlag.dataLayerFlagForTravelAgentCode=!0):"group"==h[p].codeType?(s.dataLayer.push({ihGroupCode:h[p].id}),Xr.dataLayerFlag.dataLayerFlagForGroupCode=!0):"corporate"==h[p].codeType&&(s.dataLayer.push({ihAccessCode:h[p].id}),Xr.dataLayerFlag.dataLayerFlagForAccessCode=!0)}if(Yr.length>0&&Yr[0].hasOwnProperty("allCodes")&&void 0!=Xr&&(1==Xr.dataLayerFlag.dataLayerFlagForDiscountCode&&void 0==Yr[0].allCodes.Discount&&void 0==Yr[0].allCodes.discount&&void 0==Yr[0].roomStays[0].discountCode&&(s.dataLayer.push({ihDiscountCode:void 0}),Xr.dataLayerFlag.dataLayerFlagForDiscountCode=!1),1==Xr.dataLayerFlag.dataLayerFlagForTravelAgentCode&&void 0==Yr[0].allCodes.TravelAgent&&void 0==Yr[0].allCodes.travelagent&&(s.dataLayer.push({ihTACode:void 0}),Xr.dataLayerFlag.dataLayerFlagForTravelAgentCode=!1),1==Xr.dataLayerFlag.dataLayerFlagForGroupCode&&void 0==Yr[0].allCodes.Group&&void 0==Yr[0].allCodes.group&&(s.dataLayer.push({ihGroupCode:void 0}),Xr.dataLayerFlag.dataLayerFlagForGroupCode=!1),1==Xr.dataLayerFlag.dataLayerFlagForAccessCode&&void 0==Yr[0].allCodes.Corporate&&void 0==Yr[0].allCodes.corporate&&(s.dataLayer.push({ihAccessCode:void 0}),Xr.dataLayerFlag.dataLayerFlagForAccessCode=!1)),Yr.length>0&&!Yr[0].uniqueId&&1==Xr.dataLayerFlag.dataLayerFlagForConfirmID&&!yr&&1!=C("modifyRetrieveEH")&&(s.dataLayer.push({ihConfirmID:void 0}),Xr.dataLayerFlag.dataLayerFlagForConfirmID=!1),Yr.length>0&&void 0!=Yr[0].roomStays&&void 0!=Yr[0].roomStays[0]&&void 0!=Yr[0].roomStays[0].ratePlans&&void 0!=Yr[0].roomStays[0].ratePlans[0]&&(void 0!=Yr[0].roomStays[0].ratePlans[0].ratePlanCode&&"Package"==Yr[0].roomStays[0].ratePlans[0].ratePlanType&&(s.dataLayer.push({ihPackageID:Yr[0].roomStays[0].ratePlans[0].ratePlanCode}),Xr.dataLayerFlag.dataLayerFlagForPackageID=!0),void 0!=Yr[0].roomStays[0].ratePlans[0].ratePlanCode&&s.dataLayer.push({ihRatePlanID:Yr[0].roomStays[0].ratePlans[0].ratePlanCode}),1==Xr.dataLayerFlag.dataLayerFlagForPackageID&&"Package"!=Yr[0].roomStays[0].ratePlans[0].ratePlanType&&(s.dataLayer.push({ihPackageID:void 0}),Xr.dataLayerFlag.dataLayerFlagForPackageID=!1),void 0!=Yr[0].roomStays[0].ratePlans[0].ratePlanType&&s.dataLayer.push({ihRatePlanType:Yr[0].roomStays[0].ratePlans[0].ratePlanType}),void 0!=Yr[0].roomStays[0].ratePlans[0].ratePlanName&&s.dataLayer.push({ihRatePlanName:Yr[0].roomStays[0].ratePlans[0].ratePlanName})),void 0!=jr.roomStays&&void 0!=jr.roomStays[0]&&void 0!=jr.roomStays[0].total){for(var R=0,f=0,P=0,S=!1,A=!1,I=!1,g=0;g<Yr.length;g++)void 0!=Yr[g].roomStays[0].total&&void 0!=Yr[g].roomStays[0].total.taxAmountTotal&&(S=!0,R+=Yr[g].roomStays[0].total.taxAmountTotal),void 0!=Yr[g].roomStays[0].total&&void 0!=Yr[g].roomStays[0].total.amountBeforeTax&&(A=!0,f+=Yr[g].roomStays[0].total.amountBeforeTax),void 0!=Yr[g].roomStays[0].total&&void 0!=Yr[g].roomStays[0].total.amountBeforeTax&&(I=!0,P+=Yr[g].roomStays[0].total.amountBeforeTax);S&&s.dataLayer.push({ihTaxes:R}),A&&s.dataLayer.push({ihAmount:f}),I&&s.dataLayer.push({ihAmountBeforeTax:P})}Yr.length>0&&void 0!=Yr[0].roomStays&&void 0!=Yr[0].roomStays[0]&&void 0!=Yr[0].roomStays[0].roomRates&&void 0!=Yr[0].roomStays[0].roomRates[0]&&(void 0!=Yr[0].roomStays[0].roomRates[0].roomTypeName&&s.dataLayer.push({ihRoomType:Yr[0].roomStays[0].roomRates[0].roomTypeName}),void 0!=Yr[0].roomStays[0].roomRates[0].roomTypeCode&&s.dataLayer.push({ihRoomTypeId:Yr[0].roomStays[0].roomRates[0].roomTypeCode})),Yr.length>0&&void 0!=jr.roomStays[0].roomRates[0].numberOfUnits&&s.dataLayer.push({ihRooms:Yr.length});var b=xo()?xo():void 0===Ce()?r.getCurrentCurrency().currencyCode:Ce();s.dataLayer.push({ihCurrency:b}),e.debug(JSON.stringify(jr)+"MainReservation"),void 0===jr.posSource.companyName.code||""===jr.posSource.companyName.code?s.dataLayer.push({ihSubChan:jr.posSource.companyName.companyShortName}):s.dataLayer.push({ihSubChan:jr.posSource.companyName.code}),1!=yr?s.dataLayer.push({ihHotelIsModify:!1}):s.dataLayer.push({ihHotelIsModify:!0}),vr?(s.dataLayer.push({ihHotelIsCancel:!0}),s.dataLayer.push({ihHotelIsModify:!1})):s.dataLayer.push({ihHotelIsCancel:!1}),void 0!=jr.resGlobalInfo&&void 0!=jr.resGlobalInfo.guaranteesAccepted&&jr.resGlobalInfo.guaranteesAccepted.length>0&&void 0!=jr.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardCode&&s.dataLayer.push({ihHotelPaymentMethod:jr.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardCode}),void 0!=jr.metaSubchannelSpecialId&&""!=jr.metaSubchannelSpecialId&&s.dataLayer.push({ihPixelId:jr.metaSubchannelSpecialId}),void 0!=jr.utmParameters&&""!=jr.utmParameters&&s.dataLayer.push({ihMetaUTMParameters:jr.utmParameters}),void 0!=t&&(s.dataLayer.push({ihLanguageCode:t}),t.indexOf("_")>0&&s.dataLayer.push({ihIsoLanguageCode:t.split("_")[0]}));for(var g=0;g<Yr.length;g++){if(Yr.length>0&&void 0!=Yr[g].resGlobalInfo&&void 0!=Yr[g].resGlobalInfo.timeSpan&&void 0!=Yr[g].resGlobalInfo.timeSpan.start&&void 0!=Yr[g].resGlobalInfo.timeSpan.end){n[g].ihDate=Yr[g].resGlobalInfo.timeSpan.start,n[g].ihDateOut=Yr[g].resGlobalInfo.timeSpan.end;var v=moment(Yr[g].resGlobalInfo.timeSpan.end).diff(Yr[g].resGlobalInfo.timeSpan.start,"days");n[g].ihNights=v}if(Yr.length>0&&void 0!=Yr[g].uniqueId&&""!=Yr[g].uniqueId&&(n[g].ihConfirmID=Yr[g].uniqueId,Xr.myReservationArrayFlag.dataLayerFlagForConfirmID[g]=!0),Yr.length>0&&Yr[0].hasOwnProperty("allCodes")&&(void 0!=Yr[0].allCodes.Discount&&(n[g].ihDiscountCode=Yr[0].allCodes.Discount,Xr.myReservationArrayFlag.dataLayerFlagForDiscountCode=!0),void 0!=Yr[0].allCodes.TravelAgent&&(n[g].ihTACode=Yr[0].allCodes.TravelAgent,Xr.myReservationArrayFlag.dataLayerFlagForTravelAgentCode=!0),void 0!=Yr[0].allCodes.Group&&(n[g].ihGroupCode=Yr[0].allCodes.Group,Xr.myReservationArrayFlag.dataLayerFlagForGroupCode=!0),void 0!=Yr[0].allCodes.Corporate&&(n[g].ihAccessCode=Yr[0].allCodes.Corporate,Xr.myReservationArrayFlag.dataLayerFlagForAccessCode=!0)),Yr.length>0&&void 0!=Yr[g].roomStays&&Yr[g].roomStays.length>0&&void 0!=Yr[g].roomStays[0].discountCode&&(n[g].ihDiscountCode=Yr[g].roomStays[0].discountCode,Xr.myReservationArrayFlag.dataLayerFlagForDiscountCode=!0),Yr.length>0&&void 0!=Yr[g].posSource&&void 0!=Yr[g].posSource.requestorIds&&Yr[g].posSource.requestorIds.length>0){var h=Yr[0].posSource.requestorIds;if(h.length>0)for(var p=0;p<h.length;p++)"travelagent"==h[p].codeType?(n[g].ihTACode=h[p].id,Xr.myReservationArrayFlag.dataLayerFlagForTravelAgentCode=!0):"group"==h[p].codeType?(n[g].ihGroupCode=h[p].id,Xr.myReservationArrayFlag.dataLayerFlagForGroupCode=!0):"corporate"==h[p].codeType&&(n[g].ihAccessCode=h[p].id,Xr.myReservationArrayFlag.dataLayerFlagForAccessCode=!0)}Yr.length>0&&Yr[0].hasOwnProperty("allCodes")&&void 0!=Xr&&(1==Xr.myReservationArrayFlag.dataLayerFlagForDiscountCode&&void 0==Yr[0].allCodes.Discount&&void 0==Yr[0].allCodes.discount&&void 0==Yr[g].roomStays[0].discountCode&&(n[g].ihDiscountCode=void 0),1==Xr.myReservationArrayFlag.dataLayerFlagForTravelAgentCode&&void 0==Yr[0].allCodes.TravelAgent&&void 0==Yr[0].allCodes.travelagent&&(n[g].ihTACode=void 0),1==Xr.myReservationArrayFlag.dataLayerFlagForGroupCode&&void 0==Yr[0].allCodes.Group&&void 0==Yr[0].allCodes.group&&(n[g].ihGroupCode=void 0),1==Xr.myReservationArrayFlag.dataLayerFlagForAccessCode&&void 0==Yr[0].allCodes.Corporate&&void 0==Yr[0].allCodes.corporate&&(n[g].ihAccessCode=void 0)),Yr.length>0&&!Yr[g].uniqueId&&1==Xr.myReservationArrayFlag.dataLayerFlagForConfirmID[g]&&!yr&&1!=C("modifyRetrieveEH")&&(n[g].ihConfirmID=void 0,Xr.myReservationArrayFlag.dataLayerFlagForConfirmID[g]=!1),Yr.length>0&&void 0!=Yr[g].roomStays&&void 0!=Yr[g].roomStays[0]&&void 0!=Yr[g].roomStays[0].ratePlans&&void 0!=Yr[g].roomStays[0].ratePlans[0]&&(void 0!=Yr[g].roomStays[0].ratePlans[0].ratePlanCode&&"Package"==Yr[g].roomStays[0].ratePlans[0].ratePlanType&&(n[g].ihPackageID=Yr[g].roomStays[0].ratePlans[0].ratePlanCode,Xr.myReservationArrayFlag.dataLayerFlagForPackageID[g]=!0),void 0!=Yr[g].roomStays[0].ratePlans[0].ratePlanCode&&(n[g].ihRatePlanID=Yr[g].roomStays[0].ratePlans[0].ratePlanCode),1==Xr.myReservationArrayFlag.dataLayerFlagForPackageID[g]&&"Package"!=Yr[g].roomStays[0].ratePlans[0].ratePlanType&&(n[g].ihPackageID=void 0,Xr.myReservationArrayFlag.dataLayerFlagForPackageID[g]=!1),void 0!=Yr[g].roomStays[0].ratePlans[0].ratePlanType&&(n[g].ihRatePlanType=Yr[g].roomStays[0].ratePlans[0].ratePlanType),void 0!=Yr[g].roomStays[0].ratePlans[0].ratePlanName&&(n[g].ihRatePlanName=Yr[g].roomStays[0].ratePlans[0].ratePlanName)),void 0!=Yr[g].roomStays&&void 0!=Yr[g].roomStays[0]&&void 0!=Yr[g].roomStays[0].total&&(void 0!=Yr[g].roomStays[0].total&&void 0!=Yr[g].roomStays[0].total.taxAmountTotal&&(n[g].ihTaxes=Yr[g].roomStays[0].total.taxAmountTotal),void 0!=Yr[g].roomStays[0].total&&void 0!=Yr[g].roomStays[0].total.amountBeforeTax&&(n[g].ihAmount=Yr[g].roomStays[0].total.amountBeforeTax),void 0!=Yr[g].roomStays[0].total&&void 0!=Yr[g].roomStays[0].total.amountBeforeTax&&(n[g].ihAmountBeforeTax=Yr[g].roomStays[0].total.amountBeforeTax)),Yr.length>0&&void 0!=Yr[g].roomStays&&void 0!=Yr[g].roomStays[0]&&void 0!=Yr[g].roomStays[0].roomRates&&void 0!=Yr[g].roomStays[0].roomRates[0]&&(void 0!=Yr[g].roomStays[0].roomRates[0].roomTypeName&&(n[g].ihRoomType=Yr[g].roomStays[0].roomRates[0].roomTypeName),void 0!=Yr[g].roomStays[0].roomRates[0].roomTypeCode&&(n[g].ihRoomTypeId=Yr[g].roomStays[0].roomRates[0].roomTypeCode)),Yr.length>0&&void 0!=Yr[g].roomStays[0].roomRates[0].numberOfUnits&&(n[g].ihRooms=Yr[g].roomStays[0].roomRates[0].numberOfUnits);var b=xo()?xo():void 0===Ce()?r.getCurrentCurrency().currencyCode:Ce();n[g].ihCurrency=b,void 0===Yr[g].posSource.companyName.code||""===Yr[g].posSource.companyName.code?n[g].ihSubChan=Yr[g].posSource.companyName.companyShortName:n[g].ihSubChan=Yr[g].posSource.companyName.code,void 0!=Yr[g].metaSubchannelSpecialId&&""!=Yr[g].metaSubchannelSpecialId&&(n[g].ihPixelId=Yr[g].metaSubchannelSpecialId),void 0!=Yr[g].utmParameters&&""!=Yr[g].utmParameters&&(n[g].ihMetaUTMParameters=Yr[g].utmParameters),n[g].ihHotelIsModify=1==yr,vr&&(o==Yr[g].uniqueId?(n[g].ihHotelIsCancel=!0,n[g].ihHotelIsModify=!1):n[g].ihHotelIsCancel=!1),void 0!=Yr[g].resGlobalInfo&&void 0!=Yr[g].resGlobalInfo.guaranteesAccepted&&Yr[g].resGlobalInfo.guaranteesAccepted.length>0&&void 0!=Yr[g].resGlobalInfo.guaranteesAccepted[0].paymentCard.cardCode&&(n[g].ihHotelPaymentMethod=Yr[g].resGlobalInfo.guaranteesAccepted[0].paymentCard.cardCode),void 0!=t&&(n[g].ihLanguageCode=t,t.indexOf("_")>0&&(n[g].ihIsoLanguageCode=t.split("_")[0]))}n.length>0&&void 0==n[0].ihDiscountCode&&(Xr.myReservationArrayFlag.dataLayerFlagForDiscountCode=!1),n.length>0&&void 0==n[0].ihTACode&&(Xr.myReservationArrayFlag.dataLayerFlagForTravelAgentCode=!1),n.length>0&&void 0==n[0].ihGroupCode&&(Xr.myReservationArrayFlag.dataLayerFlagForGroupCode=!1),n.length>0&&void 0==n[0].ihAccessCode&&(Xr.myReservationArrayFlag.dataLayerFlagForAccessCode=!1),n=M(n),n.length>0&&s.dataLayer.push({ihReservations:n})}else{var y=jr.resGlobalInfo.guestCounts;e.debug(jr.resGlobalInfo.guestCounts+"  Guestcounts in GTM");var l=0,i=!1,d=0;if(jr.services&&jr.services.length)for(var p=0;p<jr.services.length;p++)"ENHANCEMENT"===jr.services[p].serviceCategory&&d++;if(s.dataLayer.push({ihEnhancementCount:d}),angular.forEach(y,function(e){null!=e.ageQualifyingCode&&void 0!=e.ageQualifyingCode&&"10"===e.ageQualifyingCode?void 0!=e.count&e.count>0&&(s.dataLayer.push({ihAdults:e.count}),i=!0):null!=e.ageQualifyingCode&&void 0!=e.ageQualifyingCode&&"8"===e.ageQualifyingCode&&void 0!=e.count&e.count>0&&(l+=e.count)}),i&&s.dataLayer.push({ihChildren:l}),void 0!=jr.resGlobalInfo.timeSpan&&void 0!=jr.resGlobalInfo.timeSpan.start&&void 0!=jr.resGlobalInfo.timeSpan.end){s.dataLayer.push({ihDate:jr.resGlobalInfo.timeSpan.start}),s.dataLayer.push({ihDateOut:jr.resGlobalInfo.timeSpan.end});var v=moment(jr.resGlobalInfo.timeSpan.end).diff(jr.resGlobalInfo.timeSpan.start,"days");s.dataLayer.push({ihNights:v})}void 0!=jr.uniqueId&&""!=jr.uniqueId&&(s.dataLayer.push({ihConfirmID:jr.uniqueId}),Xr.dataLayerFlag.dataLayerFlagForConfirmID=!0),jr.hasOwnProperty("allCodes")&&(void 0!=jr.allCodes.Discount&&(s.dataLayer.push({ihDiscountCode:jr.allCodes.Discount}),Xr.dataLayerFlag.dataLayerFlagForDiscountCode=!0),void 0!=jr.allCodes.TravelAgent&&(s.dataLayer.push({ihTACode:jr.allCodes.TravelAgent}),Xr.dataLayerFlag.dataLayerFlagForTravelAgentCode=!0),void 0!=jr.allCodes.Group&&(s.dataLayer.push({ihGroupCode:jr.allCodes.Group}),Xr.dataLayerFlag.dataLayerFlagForGroupCode=!0),void 0!=jr.allCodes.Corporate&&(s.dataLayer.push({ihAccessCode:jr.allCodes.Corporate}),Xr.dataLayerFlag.dataLayerFlagForAccessCode=!0)),void 0!=jr.roomStays&&jr.roomStays.length>0&&void 0!=jr.roomStays[0].discountCode&&(s.dataLayer.push({ihDiscountCode:jr.roomStays[0].discountCode}),Xr.dataLayerFlag.dataLayerFlagForDiscountCode=!0);var D=!1,_=!1,k=!1;if(void 0!=jr.posSource&&void 0!=jr.posSource.requestorIds&&jr.posSource.requestorIds.length>0){var h=jr.posSource.requestorIds;if(h.length>0)for(var p=0;p<h.length;p++)"travelagent"==h[p].codeType?(s.dataLayer.push({ihTACode:h[p].id}),Xr.dataLayerFlag.dataLayerFlagForTravelAgentCode=!0,k=!0):"group"==h[p].codeType?(s.dataLayer.push({ihGroupCode:h[p].id}),Xr.dataLayerFlag.dataLayerFlagForGroupCode=!0,_=!0):"corporate"==h[p].codeType&&(s.dataLayer.push({ihAccessCode:h[p].id}),Xr.dataLayerFlag.dataLayerFlagForAccessCode=!0,D=!0)}jr.hasOwnProperty("allCodes")&&void 0!=Xr&&(1==Xr.dataLayerFlag.dataLayerFlagForDiscountCode&&void 0==jr.allCodes.Discount&&void 0==jr.allCodes.discount&&void 0==jr.roomStays[0].discountCode&&(s.dataLayer.push({ihDiscountCode:void 0}),Xr.dataLayerFlag.dataLayerFlagForDiscountCode=!1),1==Xr.dataLayerFlag.dataLayerFlagForTravelAgentCode&&void 0==jr.allCodes.TravelAgent&&void 0==jr.allCodes.travelagent&&1!=k&&(s.dataLayer.push({ihTACode:void 0}),Xr.dataLayerFlag.dataLayerFlagForTravelAgentCode=!1),1==Xr.dataLayerFlag.dataLayerFlagForGroupCode&&void 0==jr.allCodes.Group&&void 0==jr.allCodes.group&&1!=_&&(s.dataLayer.push({ihGroupCode:void 0}),Xr.dataLayerFlag.dataLayerFlagForGroupCode=!1),1==Xr.dataLayerFlag.dataLayerFlagForAccessCode&&void 0==jr.allCodes.Corporate&&void 0==jr.allCodes.corporate&&1!=D&&(s.dataLayer.push({ihAccessCode:void 0}),Xr.dataLayerFlag.dataLayerFlagForAccessCode=!1)),jr.uniqueId||1!=Xr.dataLayerFlag.dataLayerFlagForConfirmID||yr||1==C("modifyRetrieveEH")||(s.dataLayer.push({ihConfirmID:void 0}),Xr.dataLayerFlag.dataLayerFlagForConfirmID=!1),void 0!=jr.roomStays&&void 0!=jr.roomStays[0]&&void 0!=jr.roomStays[0].ratePlans&&void 0!=jr.roomStays[0].ratePlans[0]&&(void 0!=jr.roomStays[0].ratePlans[0].ratePlanCode&&"Package"==jr.roomStays[0].ratePlans[0].ratePlanType&&(s.dataLayer.push({ihPackageID:jr.roomStays[0].ratePlans[0].ratePlanCode}),Xr.dataLayerFlag.dataLayerFlagForPackageID=!0),void 0!=jr.roomStays[0].ratePlans[0].ratePlanCode&&s.dataLayer.push({ihRatePlanID:jr.roomStays[0].ratePlans[0].ratePlanCode}),1==Xr.dataLayerFlag.dataLayerFlagForPackageID&&"Package"!=jr.roomStays[0].ratePlans[0].ratePlanType&&(s.dataLayer.push({ihPackageID:void 0}),Xr.dataLayerFlag.dataLayerFlagForPackageID=!1),void 0!=jr.roomStays[0].ratePlans[0].ratePlanType&&s.dataLayer.push({ihRatePlanType:jr.roomStays[0].ratePlans[0].ratePlanType}),void 0!=jr.roomStays[0].ratePlans[0].ratePlanName&&s.dataLayer.push({ihRatePlanName:jr.roomStays[0].ratePlans[0].ratePlanName})),void 0!=jr.roomStays&&void 0!=jr.roomStays[0]&&void 0!=jr.roomStays[0].total&&(void 0!=jr.roomStays[0].total.taxAmountTotal&&s.dataLayer.push({ihTaxes:jr.roomStays[0].total.taxAmountTotal}),void 0!=jr.roomStays[0].total.amountBeforeTax&&(void 0!=jr.uniqueId&&""!=jr.uniqueId&&Ko()&&(Hr=jr.roomStays[0].total.amountBeforeTax),Wo(!1),s.dataLayer.push({ihAmount:jr.roomStays[0].total.amountBeforeTax})),void 0!=jr.roomStays[0].total.amountBeforeTax&&s.dataLayer.push({ihAmountBeforeTax:jr.roomStays[0].total.amountBeforeTax})),void 0!=jr.roomStays&&void 0!=jr.roomStays[0]&&void 0!=jr.roomStays[0].roomRates&&void 0!=jr.roomStays[0].roomRates[0]&&(void 0!=jr.roomStays[0].roomRates[0].roomTypeName&&s.dataLayer.push({ihRoomType:jr.roomStays[0].roomRates[0].roomTypeName}),void 0!=jr.roomStays[0].roomRates[0].roomTypeCode&&s.dataLayer.push({ihRoomTypeId:jr.roomStays[0].roomRates[0].roomTypeCode}),Cr?void 0!=jr.roomStays[0].roomRates[0].numberOfUnits&&s.dataLayer.push({ihRooms:jr.roomStays[0].roomRates[0].numberOfUnits}):void 0!=jr.resGlobalInfo.rooms?s.dataLayer.push({ihRooms:jr.resGlobalInfo.rooms}):void 0!=jr.roomStays[0].roomRates[0].numberOfUnits&&s.dataLayer.push({ihRooms:jr.roomStays[0].roomRates[0].numberOfUnits}));var b=xo()?xo():void 0===Ce()?r.getCurrentCurrency().currencyCode:Ce();if(s.dataLayer.push({ihCurrency:b}),e.debug(JSON.stringify(jr)+"MainReservation"),void 0===jr.posSource.companyName.code||""===jr.posSource.companyName.code?s.dataLayer.push({ihSubChan:jr.posSource.companyName.companyShortName}):s.dataLayer.push({ihSubChan:jr.posSource.companyName.code}),void 0!=jr.metaSubchannelSpecialId&&""!=jr.metaSubchannelSpecialId&&s.dataLayer.push({ihPixelId:jr.metaSubchannelSpecialId}),void 0!=jr.utmParameters&&""!=jr.utmParameters&&s.dataLayer.push({ihMetaUTMParameters:jr.utmParameters}),1!=yr?s.dataLayer.push({ihHotelIsModify:!1}):(s.dataLayer.push({ihHotelIsModify:!0}),void 0!=Hr&&null!=Hr&&s.dataLayer.push({ihPreviousAmount:Hr})),vr?(s.dataLayer.push({ihHotelIsCancel:!0}),s.dataLayer.push({ihHotelIsModify:!1})):s.dataLayer.push({ihHotelIsCancel:!1}),void 0!=jr.resGlobalInfo&&void 0!=jr.resGlobalInfo.guaranteesAccepted&&jr.resGlobalInfo.guaranteesAccepted.length>0&&void 0!=jr.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardCode&&s.dataLayer.push({ihHotelPaymentMethod:jr.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardCode}),void 0!=t&&(s.dataLayer.push({ihLanguageCode:t}),t.indexOf("_")>0&&s.dataLayer.push({ihIsoLanguageCode:t.split("_")[0]})),r.getEnableInsurance()&&r.showHideInsurance()){var N="No";if(jr.services&&jr.services.length)for(var L=0;L<jr.services.length;L++)if(jr.services[L].insurance){N="Yes";break}jr.insurance&&(N="Yes"),s.dataLayer.push({ihInsurancePurchased:N})}else s.dataLayer.push({ihInsurancePurchased:"Not applicable"})}}function T(){if(a.MRB){void 0!=Yr&&Yr.length>0&&void 0!=Yr[0].resGuests&&Yr[0].resGuests.length>0&&void 0!=Yr[0].resGuests[0].profile&&void 0!=Yr[0].resGuests[0].profile.customer&&(Yr[0].resGuests[0].profile.customer.email?s.dataLayer.push({email_sha256:sha256(Yr[0].resGuests[0].profile.customer.email)}):s.dataLayer.push({email_sha256:null}),Yr[0].resGuests[0].profile.customer.telephone&&Yr[0].resGuests[0].profile.customer.telephone.length>0&&Yr[0].resGuests[0].profile.customer.telephone[0].phoneNumber?s.dataLayer.push({phone_sha256:sha256(Yr[0].resGuests[0].profile.customer.telephone[0].phoneNumber)}):s.dataLayer.push({phone_sha256:null}));var e=c.findLast(s.dataLayer,"ihReservations");if(void 0!=e&&(e=e.ihReservations),void 0!=Yr&&Yr.length>0&&e&&e.length>0)for(var t=0;t<Yr.length;t++)void 0!=Yr[t].resGuests&&Yr[t].resGuests.length>0&&void 0!=Yr[t].resGuests[0].profile&&void 0!=Yr[t].resGuests[0].profile.customer&&(Yr[t].resGuests[0].profile.customer.email?e[t].email_sha256=sha256(Yr[t].resGuests[0].profile.customer.email):e[t].email_sha256=null,Yr[t].resGuests[0].profile.customer.telephone&&Yr[t].resGuests[0].profile.customer.telephone.length>0&&Yr[t].resGuests[0].profile.customer.telephone[0].phoneNumber?e[t].phone_sha256=sha256(Yr[t].resGuests[0].profile.customer.telephone[0].phoneNumber):e[t].phone_sha256=null);e&&e.length>0&&s.dataLayer.push({ihReservations:e})}else void 0!=jr&&void 0!=jr.resGuests&&jr.resGuests.length>0&&void 0!=jr.resGuests[0].profile&&void 0!=jr.resGuests[0].profile.customer&&(jr.resGuests[0].profile.customer.email?s.dataLayer.push({email_sha256:sha256(jr.resGuests[0].profile.customer.email)}):s.dataLayer.push({email_sha256:null}),jr.resGuests[0].profile.customer.telephone&&jr.resGuests[0].profile.customer.telephone.length>0&&jr.resGuests[0].profile.customer.telephone[0].phoneNumber?s.dataLayer.push({phone_sha256:sha256(jr.resGuests[0].profile.customer.telephone[0].phoneNumber)}):s.dataLayer.push({phone_sha256:null}))}function O(){if(a.MRB){void 0!=Yr&&Yr.length>0&&void 0!=Yr[0].uniqueId&&""!=Yr[0].uniqueId&&s.dataLayer.push({ihBookedConfirmID:Yr[0].uniqueId});var e=c.findLast(s.dataLayer,"ihReservations");if(void 0!=e&&(e=e.ihReservations),void 0!=Yr&&e)for(var t=0;t<Yr.length;t++)Yr.length>0&&void 0!=Yr[t].uniqueId&&""!=Yr[t].uniqueId&&(e[t].ihBookedConfirmID=Yr[t].uniqueId);e&&e.length>0&&s.dataLayer.push({ihReservations:e})}else void 0!=jr&&void 0!=jr.uniqueId&&""!=jr.uniqueId&&s.dataLayer.push({ihBookedConfirmID:jr.uniqueId})}function E(e){var t=0;if(a.MRB){void 0!=Yr&&Yr.length>0&&void 0!=Yr[0].resGlobalInfo&&void 0!=Yr[0].resGlobalInfo.guaranteesAccepted&&Yr[0].resGlobalInfo.guaranteesAccepted.length>0&&(void 0!=Yr[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&Yr[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption.length>0&&c.forEach(Yr[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption,function(e){e.redemptionQuantity&&(t=parseFloat(e.redemptionQuantity))}),s.dataLayer.push({ihLoyaltyPointsValue:t}),s.dataLayer.push({ihLoyaltyPointsUsed:e}));var o=c.findLast(s.dataLayer,"ihReservations");if(void 0!=o&&(o=o.ihReservations),void 0!=Yr&&o)for(var r=0;r<Yr.length;r++)void 0!=Yr[r].resGlobalInfo&&void 0!=Yr[r].resGlobalInfo.guaranteesAccepted&&Yr[r].resGlobalInfo.guaranteesAccepted.length>0&&(void 0!=Yr[r].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&Yr[r].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption.length>0&&c.forEach(Yr[r].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption,function(e){e.redemptionQuantity&&(t=parseFloat(e.redemptionQuantity))}),o[r].ihLoyaltyPointsValue=t,o[r].ihLoyaltyPointsUsed=e);o&&o.length>0&&s.dataLayer.push({ihReservations:o})}else void 0!=jr&&void 0!=jr.resGlobalInfo&&void 0!=jr.resGlobalInfo.guaranteesAccepted&&jr.resGlobalInfo.guaranteesAccepted.length>0&&(void 0!=jr.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&jr.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption.length>0&&c.forEach(jr.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption,function(e){e.redemptionQuantity&&(t=parseFloat(e.redemptionQuantity))}),s.dataLayer.push({ihLoyaltyPointsValue:t}),s.dataLayer.push({ihLoyaltyPointsUsed:e}))}function M(e){if(r.getEnableInsurance()&&r.showHideInsurance()){for(var a=[],t=0;t<Yr.length;t++)if(Yr[t]&&Yr[t].services&&Yr[t].services.length)for(var o=Yr[t].services,n=0;n<o.length;n++)if(o&&o[n].insurance){a.push(Yr[t].uniqueId);break}for(var i=0;i<e.length;i++)a.indexOf(e[i].ihConfirmID)>-1?e[i].ihInsurancePurchased="Yes":e[i].ihInsurancePurchased="No"}else for(var i=0;i<e.length;i++)e[i].ihInsurancePurchased="Not applicable";return e}function k(e){i.get("openNewWindow")||(cn=i.createCache("openNewWindow",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"})),cn.put("/page/open/"+r.getHotelInfo().hotelCode,e)}function N(){i.get("openNewWindow")||(cn=i.createCache("openNewWindow",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"}));var e=cn.get("/page/open/"+r.getHotelInfo().hotelCode);return e||null}function L(){var e=r.getHotelDesc();return!(!(e.paymentProviders&&e.paymentProviders.length>0&&e.paymentProviders[0].paymentMethod&&e.paymentProviders[0].vendorKey)||1!=e.paymentProviders[0].paymentMethod&&2!=e.paymentProviders[0].paymentMethod&&26!=e.paymentProviders[0].paymentMethod&&27!=e.paymentProviders[0].paymentMethod&&28!=e.paymentProviders[0].paymentMethod&&29!=e.paymentProviders[0].paymentMethod||"creditcard-braintree"!=e.paymentProviders[0].vendorKey&&"altpayment-braintree"!=e.paymentProviders[0].vendorKey)}function G(){var e=r.getHotelDesc();return!(!(e.paymentProviders&&e.paymentProviders.length>0&&e.paymentProviders[0].paymentMethod&&e.paymentProviders[0].vendorKey)||1!=e.paymentProviders[0].paymentMethod&&2!=e.paymentProviders[0].paymentMethod&&26!=e.paymentProviders[0].paymentMethod&&27!=e.paymentProviders[0].paymentMethod&&28!=e.paymentProviders[0].paymentMethod&&29!=e.paymentProviders[0].paymentMethod||"creditcard-amadeus"!=e.paymentProviders[0].vendorKey)}function F(){return pr}function B(){return ir}function x(){return sr}function w(e){if(void 0!=sr&&void 0!=sr.guestInfo&&void 0!=sr.guestInfo.loyalty&&sr.guestInfo.loyalty.length>0&&!0===sr.guestInfo.loyalty[0].requireRestrictionCheck&&void 0!=ir.offerId&&void 0!=ir.guestId&&void 0==e.loyaltyParams){if(s.supplemental=void 0,sr=void 0,ir=void 0,s.baseRes.offerid=void 0,s.baseRes.guestId=void 0,s.baseRes.allCodes&&s.baseRes.allCodes.discount&&s.baseRes.codeType){s.baseRes.allCodes.discount=void 0;for(var t=0;t<s.baseRes.codeType.length;t++)if("discount"==s.baseRes.codeType[t]){s.baseRes.codeType.splice(t,1);break}}if(jr.allCodes&&jr.allCodes.hasOwnProperty("discount")&&jr.codeType&&(delete jr.allCodes.discount,angular.forEach(jr.codeType,function(e,a){"discount"==jr.codeType[a]&&jr.codeType.splice(a,1)})),1==a.MRB){for(var t=0;t<Yr.length;t++)Yr[t].allCodes&&Yr[t].allCodes.hasOwnProperty("discount")&&Yr[t].codeType&&(delete Yr[t].allCodes.discount,angular.forEach(Yr[t].codeType,function(e,a){"discount"==Yr[t].codeType[a]&&Yr[t].codeType.splice(a,1)}));a.reservationArray=Fa()}if(la(),i.get("pageCache")){var n=i.get("pageCache");n.remove("/page/supplementalObj/"+r.getHotelInfo().hotelCode),n.remove("/page/loyaltyReqParams/"+r.getHotelInfo().hotelCode)}b(),a.$broadcast(o.COSMO_LOGOUT)}}function U(){return lr}function H(){return cr}function V(){var e=jr.resGlobalInfo.guestCounts,t=0;angular.forEach(e,function(e,a){t+=Number(e.count)});var o;if(void 0!=jr.resGlobalInfo.rooms&&0!=jr.resGlobalInfo.rooms)o=parseInt(jr.resGlobalInfo.rooms);else{var r=jr.roomStays[0].roomRates,n=0;angular.forEach(r,function(e){n+=e.numberOfUnits}),o=n}if(a.MRB){for(var i=0,s=0,l=0;l<e.length;l++)"10"==e[l].ageQualifyingCode&&(i+=parseInt(e[l].count)),"8"!=e[l].ageQualifyingCode&&"7"!=e[l].ageQualifyingCode||(s+=parseInt(e[l].count));a.multiRoomGNB=i+"/"+s}return t+"/"+o}function $(){return e.debug(JSON.stringify($r)+"this is ageCollection"),$r}function q(e){A(e)}function Y(){return Pr}function j(e){jr.hotelCode=e}function z(t,o){e.debug("countData"),e.debug(t),e.debug(o);var r=0,n=0,i=0;e.debug(JSON.stringify(jr.resGlobalInfo.guestCounts)+"MainReservation.resGlobalInfo.guestCounts");var s=l("filter")(jr.resGlobalInfo.guestCounts,{ageQualifyingCode:"10"}),c=l("filter")(jr.resGlobalInfo.guestCounts,{ageQualifyingCode:"8"}),d=l("filter")(jr.resGlobalInfo.guestCounts,{ageQualifyingCode:"7"});0==s.length&&jr.resGlobalInfo.guestCounts.push({ageQualifyingCode:"10",count:"0"}),0==c.length&&jr.resGlobalInfo.guestCounts.push({ageQualifyingCode:"8",count:"0"}),0==d.length&&jr.resGlobalInfo.guestCounts.push({ageQualifyingCode:"7",count:"0"}),angular.forEach(jr.resGlobalInfo.guestCounts,function(a,o){"10"==a.ageQualifyingCode&&(e.debug(t.Adults),r=t.Adults,jr.resGlobalInfo.guestCounts[o].count=r),"8"==a.ageQualifyingCode&&(n=t.Children,jr.resGlobalInfo.guestCounts[o].count=n),"7"==a.ageQualifyingCode&&(i=t.Infants,jr.resGlobalInfo.guestCounts[o].count=i)});if(e.debug(JSON.stringify(t)+"countData"),t.allowInfants){if(Cr){if(t.ChildArr&&t.ChildArr.length>0){jr.resGlobalInfo.guestCounts=l("filter")(jr.resGlobalInfo.guestCounts,{ageQualifyingCode:"!7"});var g=[];angular.forEach(t.ChildArr,function(e){if(g.length>0){var a=l("filter")(g,{age:e.name});if(a.length>0)a[0].count+=1;else{var t={ageQualifyingCode:"8",count:1,age:e.name};g.push(t)}}else{var t={ageQualifyingCode:"8",count:1,age:e.name};g.push(t)}}),angular.forEach(g,function(e){jr.resGlobalInfo.guestCounts.push(e)})}var m=l("filter")(jr.resGlobalInfo.guestCounts,{ageQualifyingCode:"7"});if(m.length>0){var u=parseInt(m[0].count);if(0!=u){jr.resGlobalInfo.guestCounts=l("filter")(jr.resGlobalInfo.guestCounts,{ageQualifyingCode:"!7"});var p={ageQualifyingCode:"7",count:t.Infants};jr.resGlobalInfo.guestCounts.push(p)}}}}else if($r.ageBuckets=[],t.ChildArr.forEach(function(e){$r.ageBuckets.forEach(function(a){a.start<=e.id&&a.end>=e.id&&$r.ageBuckets.push(a)})}),Cr){t.ChildArr.length>0&&(jr.resGlobalInfo.guestCounts=l("filter")(jr.resGlobalInfo.guestCounts,{ageQualifyingCode:"!8"}));var g=[];angular.forEach(t.ChildArr,function(a){if(g.length>0){e.debug("childrenUpdated"),e.debug(g);var o=l("filter")(t.ChildArr,{age:a.name});if(e.debug("existingChild"),e.debug(o),o.length>0)o[0].count+=1;else{var r={ageQualifyingCode:"8",count:1,age:a.name};g.push(r)}}else{var r={ageQualifyingCode:"8",count:1,age:a.name};g.push(r)}}),angular.forEach(g,function(e){jr.resGlobalInfo.guestCounts.push(e)});var m=l("filter")(jr.resGlobalInfo.guestCounts,{ageQualifyingCode:"7"});if(m.length>0){var u=parseInt(m[0].count);if(0!=u){jr.resGlobalInfo.guestCounts=l("filter")(jr.resGlobalInfo.guestCounts,{ageQualifyingCode:"!7"});var p={ageQualifyingCode:"7",count:0};jr.resGlobalInfo.guestCounts.push(p)}}}else{e.debug(t.ChildArr),t.ChildArr&&t.ChildArr.length>0&&(jr.resGlobalInfo.guestCounts=l("filter")(jr.resGlobalInfo.guestCounts,{ageQualifyingCode:"!8"})),e.debug(JSON.stringify(jr.resGlobalInfo.guestCounts));var g=[];angular.forEach(t.ChildArr,function(a){if(e.debug(a),g.length>0){e.debug("children updated"),e.debug(JSON.stringify(g)),e.debug("second time in if"),e.debug(a);var t,o=!1;if(angular.forEach(g,function(r,n){e.debug(r),e.debug(n),e.debug(r.age),e.debug(a.name),r.age==a.name&&(e.debug("true"),t=n,o=!0)}),o)e.debug("childExisted true"),g[t].count+=1;else{var r={ageQualifyingCode:"8",count:1,age:a.name};g.push(r)}}else{e.debug("first time in else");var r={ageQualifyingCode:"8",count:1,age:a.name};g.push(r)}}),angular.forEach(g,function(e){jr.resGlobalInfo.guestCounts.push(e)}),e.debug(JSON.stringify(jr.resGlobalInfo.guestCounts));var m=l("filter")(jr.resGlobalInfo.guestCounts,{ageQualifyingCode:"7"});if(m.length>0){var u=parseInt(m[0].count);if(0!=u){jr.resGlobalInfo.guestCounts=l("filter")(jr.resGlobalInfo.guestCounts,{ageQualifyingCode:"!7"});var p={ageQualifyingCode:"7",count:0};jr.resGlobalInfo.guestCounts.push(p)}}}jr.resGlobalInfo.rooms!==t.Rooms&&(jr.resGlobalInfo.rooms=t.Rooms),$r.ageList!==t.ChildArr&&($r.ageList=t.ChildArr),a.MRB?Yr.length==Kr.length&&b():b()}function W(e,t){if(1!=C("FIRST_TIME_LAND_CALENDAR")&&1==a.MRB)for(var o=0;o<Yr.length;o++)Yr[o].resGlobalInfo.timeSpan={start:e,end:t};else if(1==C("FIRST_TIME_LAND_CALENDAR")&&1==a.MRB)for(var o=0;o<Yr.length;o++)if(Yr[o].id==jr.id){Yr[o].resGlobalInfo.timeSpan={start:e,end:t};break}jr.resGlobalInfo.timeSpan={start:e,end:t},b()}function K(e,a){jr[a]=e,b()}function J(){delete jr.roomStays[0].ratePlans,delete jr.roomStays[0].roomRates[0].roomTypeCode}function Q(){if(void 0!=jr.roomStays&&(void 0==jr.roomStays[0].ratePlans&&(jr.roomStays[0].ratePlans=[]),
void 0!=jr.roomStays[0].ratePlans&&jr.roomStays[0].ratePlans.length>0&&("Regular"==jr.roomStays[0].ratePlans[0].ratePlanType||"Package"==jr.roomStays[0].ratePlans[0].ratePlanType)&&(jr.roomStays[0].ratePlans=[]),void 0!=jr.roomStays[0].roomRates&&(delete jr.roomStays[0].roomRates[0].roomTypeCode,delete jr.roomStays[0].roomRates[0].roomTypeName,delete jr.roomStays[0].roomRates[0].rates)),a.MRB)for(var e=0;e<Yr.length;e++)if(Yr[e].id==jr.id&&void 0!=Yr[e].roomStays){void 0==Yr[e].roomStays[0].ratePlans&&(Yr[e].roomStays[0].ratePlans=[]),void 0!=Yr[e].roomStays[0].ratePlans&&Yr[e].roomStays[0].ratePlans.length>0&&("Regular"==Yr[e].roomStays[0].ratePlans[0].ratePlanType||"Package"==Yr[e].roomStays[0].ratePlans[0].ratePlanType)&&(Yr[e].roomStays[0].ratePlans=[]),void 0!=Yr[e].roomStays[0].roomRates&&(delete Yr[e].roomStays[0].roomRates[0].roomTypeCode,delete Yr[e].roomStays[0].roomRates[0].roomTypeName,delete Yr[e].roomStays[0].roomRates[0].rates,delete Yr[e].roomStays[0].total);break}}function X(){void 0!=jr.roomStays&&jr.roomStays.length>0&&delete jr.roomStays[0].total}function Z(){if(void 0!=jr.roomStays&&jr.roomStays.length>0&&delete jr.roomStays[0].total,a.MRB)for(var e=0;e<Yr.length;e++)Yr[e].id==jr.id&&void 0!=Yr[e].roomStays&&(void 0==Yr[e].roomStays[0].ratePlans&&(Yr[e].roomStays[0].ratePlans=[]),void 0!=Yr[e].roomStays[0].ratePlans&&Yr[e].roomStays[0].ratePlans.length>0&&("Regular"==Yr[e].roomStays[0].ratePlans[0].ratePlanType||"Package"==Yr[e].roomStays[0].ratePlans[0].ratePlanType)&&(Yr[e].roomStays[0].ratePlans=[]),void 0!=Yr[e].roomStays[0].roomRates&&(delete Yr[e].roomStays[0].roomRates[0].roomTypeCode,delete Yr[e].roomStays[0].roomRates[0].roomTypeName,delete Yr[e].roomStays[0].roomRates[0].rates,delete Yr[e].roomStays[0].total))}function ee(){var e=Fa();c.forEach(e,function(e){Xa(e.id),J(),void 0!=e.roomStays[0].ratePlans&&e.roomStays[0].ratePlans.length>0&&"Package"==e.roomStays[0].ratePlans[0].ratePlanType&&te(),Q(),X(),ne(),no(),Ya(e.id,jr)}),Wa(e[0].id)}function ae(){if(a.MRB){var e=Fa();c.forEach(e,function(e){Xa(e.id),ya(),Ya(e.id,jr)})}else ya();b()}function te(){void 0!=jr.roomStays&&void 0==jr.roomStays[0].ratePlans&&(jr.roomStays[0].ratePlans=[]),jr.roomStays[0].ratePlans[0]={},void 0!=jr.roomStays[0].roomRates&&(delete jr.roomStays[0].roomRates[0].roomTypeCode,delete jr.roomStays[0].roomRates[0].roomTypeName,delete jr.roomStays[0].roomRates[0].rates)}function oe(){void 0!=jr.roomStays&&"Regular"==jr.roomStays[0].ratePlans[0].ratePlanType&&(jr.roomStays[0].ratePlans=[])}function re(){var e;jr.resGlobalInfo.timeSpan={},jr.roomStays[0].ratePlans=[],void 0!=jr.roomStays[0].roomRates[0].roomTypeCode&&(delete jr.roomStays[0].roomRates[0].roomTypeCode,delete jr.roomStays[0].roomRates[0].roomTypeName),jr.services=[];for(var t=0;t<Yr.length;t++)Yr[t].resGlobalInfo.timeSpan={},Yr[t].roomStays[0].ratePlans=[],void 0!=Yr[t].roomStays[0].roomRates[0].roomTypeCode&&(delete Yr[t].roomStays[0].roomRates[0].roomTypeCode,delete Yr[t].roomStays[0].roomRates[0].roomTypeName),Yr[t].services=[];for(var r=s.multiRoomReservation.length,t=Yr.length-1;t>=0&&Yr.length>r;t--)Yr.splice(t,1);for(var t=Kr.length-1;t>=0&&Kr.length>r;t--)Kr.splice(t,1);if(void 0!=Kr&&Kr.length>0){for(;Kr.length<r;){var n=angular.copy(Kr[0]);n.selected=!1,n.id=Kr[Kr.length-1].id+1,Kr.push(n)}for(var t=0;t<Kr.length;t++)Kr[t].ChildArr=[]}for(var i=0;i<Fa().length;i++)if(!(void 0!=Fa()[i].roomStays[0].ratePlans&&Fa()[i].roomStays[0].ratePlans.length>0&&void 0!=Fa()[i].roomStays[0].ratePlans[0].ratePlanType&&void 0!=Fa()[i].roomStays[0].roomRates[0].roomTypeCode)){e=Fa()[i].id;break}void 0!=e&&(Wa(e),a.$broadcast(o.MODIFY_RESERVATION)),a.enabelRoomSelector=!1,a.roominContext=!1,P("FIRST_TIME_LAND_CALENDAR"),Fa().length>0&&(a.reservationArray=angular.copy(Fa()))}function ne(){if(jr.services=[],a.MRB)for(var t=0;t<Yr.length;t++)if(Yr[t].id==jr.id){Yr[t].services=[];break}e.debug(JSON.stringify(jr)+"this is new Mainreservation")}function ie(){return hr}function se(e){hr=e}function le(){return Rr}function ce(e){Rr=e}function de(){return fr}function ge(e){fr=e}function me(a,t){if(jr.roomStays=[],jr.roomStays[0]={ratePlans:[],roomRates:[]},e.debug(JSON.stringify(jr)+"this is reservation 1"),e.debug(JSON.stringify(t)+" ROOM"),jr.roomStays[0].ratePlans.length)jr.roomStays[0].ratePlans.forEach(function(a,o){if(a.ratePlanCode===t.currentCode)e.debug("duplicate");else{var r="Group"==t.priceTagRate[0].ratePlanType?t.currentRate.roomRateCode:t.currentCode;jr.roomStays[0].ratePlans.push({ratePlanCode:r,ratePlanType:t.priceTagRate[0].ratePlanType})}});else{var o="Group"==t.priceTagRate[0].ratePlanType?t.currentRate.roomRateCode:t.currentCode;jr.roomStays[0].ratePlans.push({ratePlanCode:o,ratePlanType:t.priceTagRate[0].ratePlanType})}e.debug(JSON.stringify(jr)+"this is reservation 2"),jr.roomStays[0].roomRates=[],jr.roomStays[0].roomRates.length?jr.roomStays[0].roomRates.forEach(function(e,o){e.roomTypeCode===t.roomTypeCode?jr.roomStays[0].roomRates[o].numberOfUnits++:jr.roomStays[0].roomRates.push({numberOfUnits:a,roomTypeCode:t.roomTypeCode})}):jr.roomStays[0].roomRates.push({numberOfUnits:a,roomTypeCode:t.roomTypeCode}),Ne(t),e.debug(JSON.stringify(jr)+"this is reservation 3"),b()}function ue(a){var t=c.findIndex(jr.roomStays[0].ratePlans,function(e){return e.ratePlanCode==a.ratePlanCode}),o=c.findIndex(jr.roomStays[0].roomRates,function(e){return e.roomTypeCode==a.roomTypeCode});t>-1&&jr.roomStays[0].ratePlans.splice(t,1),o>-1&&jr.roomStays[0].roomRates.splice(o,1),e.debug(jr)}function pe(){return e.debug("in get ALL CODES"),e.debug(JSON.stringify(jr.allCodes)+"in there here"),jr.allCodes}function ye(e){if(jr.languageCode=e,void 0!=Yr&&Yr.length>0)for(var a=0;a<Yr.length;a++)Yr[a].languageCode=e;b()}function ve(){return void 0!=jr.languageCode?jr.languageCode:r.getCurrentLanguages().languageCode}function he(){return void 0!=jr.uniqueId?jr.uniqueId:void 0}function Re(){return jr.hotelCode}function fe(e){jr.currencyCode=e,b()}function Ce(){return void 0!=jr.currencyCode?jr.currencyCode:void 0}function Pe(){return jr}function Se(){return jr}function Ae(a){c.remove(jr.services,{serviceCategory:"SERVICE_REQUEST"}),jr.resGlobalInfo.comments=[],a.arrivalTimeInfo?jr.resGlobalInfo.arrivalTime=a.arrivalTimeInfo:jr.resGlobalInfo.arrivalTime="",a.additionalComment?jr.resGlobalInfo.comments.push({comment:a.additionalComment}):jr.resGlobalInfo.comments=[],angular.forEach(a.specialRequest,function(t,o){if(t.selectedRequest){var r={serviceName:t.serviceName,serviceCategory:t.serviceCategory,serviceTypeId:t.serviceTypeId,serviceOptions:[{serviceOptionId:t.selectedRequest.serviceOptionId,dailyRates:[],serviceOptionName:t.selectedRequest.serviceOptionName}]};"PER_RESERVATION"===t.servicePricingType?r.serviceOptions[0].dailyRates.push({serviceDate:t.selectedRequest.dailyRates[0].serviceDate,quantity:1}):"PER_PERSON"===t.servicePricingType||"PER_PERSON_PER_NIGHT"===t.servicePricingType?r.serviceOptions[0].dailyRates.push({serviceDate:t.selectedRequest.dailyRates[0].serviceDate,adultQuantity:a.guestCounts.adults,childQuantity:a.guestCounts.children}):"PER_ROOM"!==t.servicePricingType&&"PER_ROOM_PER_NIGHT"!==t.servicePricingType||r.serviceOptions[0].dailyRates.push({serviceDate:t.selectedRequest.dailyRates[0].serviceDate,quantity:jr.roomStays[0].roomRates[0].numberOfUnits}),jr.services.push(r)}else for(var n=0;n<jr.services.length;n++)if(jr.services[n].serviceTypeId==t.serviceTypeId){e.debug("test"),jr.services.splice(n,1);break}}),b()}function Ie(){return jr.roomStays[0].total?l("currencyConversionWithTwoDecimalPlaces")(jr.roomStays[0].total.amountAfterTax,xo()):l("currencyConversionWithTwoDecimalPlaces")(0)}function be(e){var a={},t=jr.roomStays[0],o=t.total,n=jr.resGlobalInfo.guestCounts,i=jr.posSource.requestorIds;console.log(JSON.stringify(i)),void 0!=jr.roomStays[0].discountCode&&i.length>0&&"discountCode"!=i[i.length-1].codeType&&i.push({codeType:"discountCode",id:jr.roomStays[0].discountCode});var s=r.getUxConfiguration(),d=jr.services,g=0,m=[],u=[],p=!1;if(a.hotelCode=jr.hotelCode,a.dateIn=jr.resGlobalInfo.timeSpan.start,a.dateOut=jr.resGlobalInfo.timeSpan.end,a.roomCount=jr.roomStays.length,a.ratePlanCode=t.ratePlans[0].ratePlanCode,a.ratePlanType=t.ratePlans[0].ratePlanType,a.packageTitle=t.ratePlans[0].ratePlanName,a.roomTypeCode=t.roomRates[0].roomTypeCode,a.taxBreakoutEnabled=!!_.has(t,"prodTaxes.taxBreakoutEnabled")&&t.prodTaxes.taxBreakoutEnabled,a.enableFlexibleTaxes=!!_.has(jr,"hotelInfo.hotelSettings.enableFlexibleTaxes")&&jr.hotelInfo.hotelSettings.enableFlexibleTaxes,a.prodTaxes=[],_.has(t,"prodTaxes.inTotalExclusiveTaxes")){for(var y=t.prodTaxes.inTotalExclusiveTaxes.resortFee?l(e)(t.prodTaxes.inTotalExclusiveTaxes.resortFee,xo()):null,v=t.prodTaxes.inTotalExclusiveTaxes.serviceCharges?l(e)(t.prodTaxes.inTotalExclusiveTaxes.serviceCharges,xo()):null,h=t.prodTaxes.inTotalExclusiveTaxes.totalTax?l(e)(t.prodTaxes.inTotalExclusiveTaxes.totalTax,xo()):null,R=_.has(t,"prodTaxes.inTotalExclusiveTaxes.resortFee")||_.has(t,"prodTaxes.inTotalExclusiveTaxes.serviceCharges")||_.has(t,"prodTaxes.inTotalExclusiveTaxes.totalTax"),f=[],C=[],P=0;P<t.prodTaxes.inTotalExclusiveTaxes.taxes.length;P++)C.push(t.prodTaxes.inTotalExclusiveTaxes.taxes[P].taxName),f.push({taxName:t.prodTaxes.inTotalExclusiveTaxes.taxes[P].beDescription||null,taxAmt:l(e)(t.prodTaxes.inTotalExclusiveTaxes.taxes[P].taxAmt,xo())});var S,A,I=0;_.has(t,"total.taxAmountTotalServ")&&t.total.taxAmountTotalServ>0&&(S={taxName:"Enhancement Taxes",taxAmt:l(e)(t.total.taxAmountTotalServ,xo())}),_.has(t,"total.pkgIncTaxAmountTotal")&&t.total.pkgIncTaxAmountTotal>0&&(A={taxName:"Package Taxes",taxAmt:l(e)(t.total.pkgIncTaxAmountTotal,xo())}),C.indexOf("Service Charge")>-1?(I=C.indexOf("Service Charge"),S&&f.splice(I,0,S),A&&f.splice(I,0,A)):C.indexOf("Resort Fee")>-1?(I=C.indexOf("Resort Fee"),S&&f.splice(I,0,S),A&&f.splice(I,0,A)):(S&&f.push(S),A&&f.push(A)),a.prodTaxes.push({title:"inTotalExclusiveTaxes",resortFee:t.prodTaxes.inTotalExclusiveTaxes.resortFee,serviceFee:t.prodTaxes.inTotalExclusiveTaxes.serviceCharges,total:t.prodTaxes.inTotalExclusiveTaxes.totalTax,formattedResortFee:y,formattedServiceFee:v,formattedTotal:h,taxes:f,hasInTotalExclusiveTaxes:R})}else f=[],_.has(t,"total.taxAmountTotalServ")&&t.total.taxAmountTotalServ>0&&(S={taxName:"Enhancement Taxes",taxAmt:l(e)(t.total.taxAmountTotalServ,xo())},f.push(S)),_.has(t,"total.pkgIncTaxAmountTotal")&&t.total.pkgIncTaxAmountTotal>0&&(A={taxName:"Package Taxes",taxAmt:l(e)(t.total.pkgIncTaxAmountTotal,xo())},f.push(A)),f.length>0&&a.prodTaxes.push({title:"inTotalExclusiveTaxes",taxes:f,hasInTotalExclusiveTaxes:!1});if(_.has(t,"prodTaxes.outTotalInclusiveTaxes")){var b=t.prodTaxes.outTotalInclusiveTaxes.resortFee?l(e)(t.prodTaxes.outTotalInclusiveTaxes.resortFee,xo()):null,D=t.prodTaxes.outTotalInclusiveTaxes.serviceCharges?l(e)(t.prodTaxes.outTotalInclusiveTaxes.serviceCharges,xo()):null,T=t.prodTaxes.outTotalInclusiveTaxes.totalTax?l(e)(t.prodTaxes.outTotalInclusiveTaxes.totalTax,xo()):null,O=[];if(t.prodTaxes.outTotalInclusiveTaxes.taxes&&t.prodTaxes.outTotalInclusiveTaxes.taxes.length>0)for(var E=0;E<t.prodTaxes.outTotalInclusiveTaxes.taxes.length;E++)O.push({taxName:t.prodTaxes.outTotalInclusiveTaxes.taxes[E].beDescription||null,taxAmt:l(e)(t.prodTaxes.outTotalInclusiveTaxes.taxes[E].taxAmt,xo())});a.prodTaxes.push({title:"Included in the Rate",resortFee:t.prodTaxes.outTotalInclusiveTaxes.resortFee,serviceFee:t.prodTaxes.outTotalInclusiveTaxes.serviceCharges,total:t.prodTaxes.outTotalInclusiveTaxes.totalTax,formattedResortFee:b,formattedServiceFee:D,formattedTotal:T,taxes:O})}if(_.has(t,"prodTaxes.outTotalExclusiveTaxes")){var M=t.prodTaxes.outTotalExclusiveTaxes.resortFee?l(e)(t.prodTaxes.outTotalExclusiveTaxes.resortFee,xo()):null,k=t.prodTaxes.outTotalExclusiveTaxes.serviceCharges?l(e)(t.prodTaxes.outTotalExclusiveTaxes.serviceCharges,xo()):null,N=t.prodTaxes.outTotalExclusiveTaxes.totalTax?l(e)(t.prodTaxes.outTotalExclusiveTaxes.totalTax,xo()):null,L=[];if(t.prodTaxes.outTotalExclusiveTaxes.taxes&&t.prodTaxes.outTotalExclusiveTaxes.taxes.length>0&&t.prodTaxes.outTotalExclusiveTaxes.taxes&&t.prodTaxes.outTotalExclusiveTaxes.taxes.length>0)for(var G=0;G<t.prodTaxes.outTotalExclusiveTaxes.taxes.length;G++)L.push({taxName:t.prodTaxes.outTotalExclusiveTaxes.taxes[G].beDescription||null,taxAmt:l(e)(t.prodTaxes.outTotalExclusiveTaxes.taxes[G].taxAmt,xo())});a.prodTaxes.push({title:"Excluded from the Total",resortFee:t.prodTaxes.outTotalExclusiveTaxes.resortFee,serviceFee:t.prodTaxes.outTotalExclusiveTaxes.serviceCharges,total:t.prodTaxes.outTotalExclusiveTaxes.totalTax,formattedResortFee:M,formattedServiceFee:k,formattedTotal:N,taxes:L})}a.roomsData=[],a.packageInclusions=[],a.enhancements=[],a.isRoomDiscounteEnabled=!1,(o.discountIndicator||o.discountIndicatorRoom||o.discountIndicatorServ)&&(a.isRoomDiscounteEnabled=!0),a.guestCounts={adults:0,children:0,infants:0},a.allCodes=[],angular.forEach(n,function(e,t){"10"===e.ageQualifyingCode?a.guestCounts.adults+=Number(e.count):"8"===e.ageQualifyingCode?a.guestCounts.children+=Number(e.count):"7"===e.ageQualifyingCode&&(a.guestCounts.infants+=Number(e.count)),g+=Number(e.count)}),a.noOfNights=jr.resGlobalInfo.timeSpan.duration;var F=a.noOfNights>t.ratePlans[0].maxStay?t.ratePlans[0].maxStay:a.noOfNights,B=0,x=0;angular.forEach(d,function(e,t){if("PACKAGE_INCLUSION"===e.serviceCategory||"PACKAGE_OPTION"===e.serviceCategory||"ENHANCEMENT"===e.serviceCategory){var o=[],r=[],n=0,i=0,s=0,l=0,d={serviceTypeId:e.serviceTypeId,serviceName:e.serviceName,servicePricingType:e.servicePricingType,serviceCategory:e.serviceCategory,sortOrder:e.sortOrder,serviceTotalPrice:e.totalPrice.amountBeforeTax,discountRuleId:e.discountRuleId,quantities:{},daysArray:[]};angular.forEach(e.serviceOptions,function(a){var t=c.uniq(a.dailyRates,"serviceDate");n+=t.length;var i=angular.copy(a.dailyRates);angular.forEach(a.dailyRates,function(a){if("PER_PERSON"===e.servicePricingType||"PER_PERSON_PER_NIGHT"===e.servicePricingType){if(i.length>0){for(var t=0,n=0,s=0;i.length>s;s++)i[s].serviceDate===a.serviceDate&&(t+=i[s].adultQuantity,n+=i[s].childQuantity);o.push({quantity:t+n,adultsCount:t,childrenCount:n})}}else if(("PER_ROOM"===e.servicePricingType||"PER_ROOM_PER_NIGHT"===e.servicePricingType)&&i.length>0){for(var l=0,s=0;i.length>s;s++)i[s].serviceDate===a.serviceDate&&(l+=i[s].quantity);r.push({quantity:l})}})}),"PER_RESERVATION"===e.servicePricingType?d.quantities={}:"PER_PERSON"===e.servicePricingType||"PER_PERSON_PER_NIGHT"===e.servicePricingType?(i=c.last(c.sortBy(o,"quantity")).adultsCount,s=c.last(c.sortBy(o,"quantity")).childrenCount,"PER_PERSON"===e.servicePricingType?d.quantities={adultsCount:i,childCount:s}:"PER_PERSON_PER_NIGHT"===e.servicePricingType&&(d.quantities={adultsCount:i,childCount:s,nightsCount:n})):"PER_ROOM"!==e.servicePricingType&&"PER_ROOM_PER_NIGHT"!==e.servicePricingType||(l=c.last(c.sortBy(r,"quantity")).quantity,"PER_ROOM"===e.servicePricingType?d.quantities={roomsCount:l}:"PER_ROOM_PER_NIGHT"===e.servicePricingType&&(d.quantities={roomsCount:l,nightsCount:n})),"PACKAGE_INCLUSION"===e.serviceCategory&&(B+=e.totalPrice.amountBeforeTax),angular.forEach(e.serviceOptions,function(e){var a=Jo(e.dailyRates);angular.forEach(a,function(e){var a=0;angular.forEach(e.price,function(e){a+=e.totalamountBeforeTax?Number(e.totalamountBeforeTax):Number(e.amountBeforeTax)}),d.daysArray.push({date:e.serviceDate,price:a})})}),"PACKAGE_INCLUSION"===e.serviceCategory?a.packageInclusions.push(d):"PACKAGE_OPTION"===e.serviceCategory?m.push(d):"ENHANCEMENT"===e.serviceCategory&&u.push(d)}}),m=c.sortBy(m,"serviceName"),u=c.sortBy(u,"serviceName"),m=c.sortBy(m,"sortOrder"),u=c.sortBy(u,"sortOrder"),a.enhancements=m.concat(u),angular.forEach(a.enhancements,function(e,t){a.enhancements[t].modifiedSortOrder=t+1}),x=B/F;for(var w=moment(a.dateIn).add(F,"days"),U=0;U<t.roomRates.length;U++){var H={roomsCount:0,roomTypeName:"",totalRoomPrice:0,datesOfStay:[]};H.roomTypeName=t.roomRates[U].roomTypeName,H.roomsCount=t.roomRates[U].numberOfUnits,t.roomRates[U].rates.forEach(function(e){var a=0;moment(e.effectiveDate)<w&&(a=x),H.totalRoomPrice+=e.grossAmountBeforeTax+a,e.grossAmountBeforeTax?(p=!1,H.datesOfStay.push({date:e.effectiveDate,price:e.grossAmountBeforeTax+a,freeNightsDiscount:e.discount})):(p=!0,H.datesOfStay.push({date:e.effectiveDate,price:e.grossAmountBeforeTax,freeNightsDiscount:e.discount}))}),p&&(o.amountBeforeTaxRoom?H.totalRoomPrice=o.amountBeforeTaxRoom+B:H.totalRoomPrice=o.amountBeforeTaxRoom),a.roomsData.push(H)}return a.isRoomDiscounteEnabled&&(a.subtotalExcludeDiscount=o.grossAmountBeforeTax),a.subtotal=o.amountBeforeTaxRoom,i.length?angular.forEach(i,function(e){a.allCodes.push({codeType:e.codeType,codeId:e.id})}):t.discountCode&&a.isRoomDiscounteEnabled&&a.allCodes.push({codeType:"discountCode",codeId:t.discountCode}),a.subtotal=Number(o.amountBeforeTax),0==Number(o.taxAmountTotal)?a.taxes=0:a.taxes=Number(o.taxAmountTotal)-(Number(t.taxes.resortFee)+Number(t.taxes.serviceCharge)),a.resortFees=t.taxes.resortFee,a.serviceCharge=t.taxes.serviceCharge,a.total=o.amountAfterTax,a.specialRequestForm=s.reservationAndPaymentConfig.specialRequestForm,a.displayArrivalTime=s.reservationAndPaymentConfig.displayArrivalTime,a.arrivalTimeInfo="",a.specialRequest=[],a.selectedSpecialRequests=l("filter")(d,{serviceCategory:"SERVICE_REQUEST"}),a.arrivalTimeInfo=jr.resGlobalInfo.arrivalTime,jr.resGlobalInfo.comments&&jr.resGlobalInfo.comments.length>0?a.additionalComment=jr.resGlobalInfo.comments[0].comment:a.additionalComment="",Ur=angular.copy(a),a}function De(){return Ur}function Te(a){if(e.debug(JSON.stringify(a)+"services"),void 0!=a){void 0==jr.services&&(jr.services=[]);for(var t=0;t<a.length;t++){if("PER_ROOM"==a[t].servicePricingType){var o={};o.serviceCategory=a[t].serviceCategory,o.serviceTypeId=a[t].serviceTypeId,o.serviceOptions=[];for(var r=0;r<a[t].eachDayRate.length;r++)if(void 0!=a[t].eachDayRate[r].selectOption){var n={};n.serviceOptionId=a[t].eachDayRate[r].selectOption.serviceOptionId,n.dailyRates=[],e.debug(n.serviceOptionId+"tempServiceOption");for(var i={},s=0;s<a[t].serviceOptions.length;s++)if(n.serviceOptionId==a[t].serviceOptions[s].serviceOptionId)for(var l=0;l<a[t].eachDayRate.length;l++)if(a[t].eachDayRate[l].options.length>0){i.serviceDate=a[t].eachDayRate[l].serviceDate;break}i.quantity=a[t].eachDayRate[r].room,n.dailyRates.push(i),o.serviceOptions.push(n)}for(var r=0;r<jr.services.length;r++)if(jr.services[r].serviceTypeId==o.serviceTypeId){jr.services.splice(r,1);break}jr.services.push(o)}if("PER_RESERVATION"==a[t].servicePricingType){var o={};o.serviceCategory=a[t].serviceCategory,o.serviceTypeId=a[t].serviceTypeId,o.serviceOptions=[];for(var r=0;r<a[t].eachDayRate.length;r++)if(void 0!=a[t].eachDayRate[r].selectOption&&a[t].eachDayRate[r].options.length>0){var n={};n.serviceOptionId=a[t].eachDayRate[r].selectOption.serviceOptionId,n.dailyRates=[];for(var i={},s=0;s<a[t].serviceOptions.length;s++)e.debug(a[t].serviceOptions[s].serviceOptionId+"services[i].serviceOptions[k].serviceOptionId"),n.serviceOptionId==a[t].serviceOptions[s].serviceOptionId&&(i.serviceDate=a[t].eachDayRate[r].date);i.quantity=1,n.dailyRates.push(i),o.serviceOptions.push(n)}for(var r=0;r<jr.services.length;r++)if(jr.services[r].serviceTypeId==o.serviceTypeId){jr.services.splice(r,1);break}jr.services.push(o)}if("PER_PERSON"==a[t].servicePricingType){var o={};o.serviceCategory=a[t].serviceCategory,o.serviceTypeId=a[t].serviceTypeId,o.serviceOptions=[];for(var r=0;r<a[t].eachDayRate.length;r++)if(void 0!=a[t].eachDayRate[r].selectOption&&a[t].eachDayRate[r].options.length>0){var n={};n.serviceOptionId=a[t].eachDayRate[r].selectOption.serviceOptionId,a[t].adult=a[t].eachDayRate[r].adult,void 0!=a[t].eachDayRate[r].children&&0!=a[t].eachDayRate[r].children&&(a[t].children=a[t].eachDayRate[r].children),n.dailyRates=[];for(var i={},s=0;s<a[t].serviceOptions.length;s++)if(e.debug(a[t].serviceOptions[s].serviceOptionId+"services[i].serviceOptions[k].serviceOptionId"),n.serviceOptionId==a[t].serviceOptions[s].serviceOptionId)for(var l=0;l<a[t].eachDayRate.length;l++)if(a[t].eachDayRate[l].options.length>0){i.serviceDate=a[t].eachDayRate[l].serviceDate;break}i.adultQuantity=a[t].adult,void 0!=a[t].children&&"null"!=a[t].children&&(e.debug("enter"),i.childQuantity=a[t].children),n.dailyRates.push(i),o.serviceOptions.push(n)}for(var r=0;r<jr.services.length;r++)if(jr.services[r].serviceTypeId==o.serviceTypeId){jr.services.splice(r,1);break}jr.services.push(o)}if("PER_ROOM_PER_NIGHT"==a[t].servicePricingType){var o={};o.serviceCategory=a[t].serviceCategory,o.serviceTypeId=a[t].serviceTypeId,o.serviceOptions=[];for(var r=0;r<a[t].eachDayRate.length;r++)if(void 0!=a[t].eachDayRate[r].selectOption&&a[t].eachDayRate[r].options.length>0){var n={};n.serviceOptionId=a[t].eachDayRate[r].selectOption.serviceOptionId,n.dailyRates=[];for(var i={},s=0;s<a[t].serviceOptions.length;s++)e.debug(a[t].serviceOptions[s].serviceOptionId+"services[i].serviceOptions[k].serviceOptionId"),n.serviceOptionId==a[t].serviceOptions[s].serviceOptionId&&(i.serviceDate=a[t].eachDayRate[r].selectOption.serviceDate);i.quantity=a[t].eachDayRate[r].room,n.dailyRates.push(i),o.serviceOptions.push(n)}for(var r=0;r<jr.services.length;r++)if(jr.services[r].serviceTypeId==o.serviceTypeId){jr.services.splice(r,1);break}jr.services.push(o)}if("PER_PERSON_PER_NIGHT"==a[t].servicePricingType){var o={};o.serviceCategory=a[t].serviceCategory,o.serviceTypeId=a[t].serviceTypeId,o.serviceOptions=[];for(var r=0;r<a[t].eachDayRate.length;r++)if(void 0!=a[t].eachDayRate[r].selectOption&&a[t].eachDayRate[r].options.length>0){var n={};n.serviceOptionId=a[t].eachDayRate[r].selectOption.serviceOptionId,a[t].adult=a[t].eachDayRate[r].adult,void 0!=a[t].eachDayRate[r].children&&0!=a[t].eachDayRate[r].children&&(a[t].children=a[t].eachDayRate[r].children),n.dailyRates=[];for(var i={},s=0;s<a[t].serviceOptions.length;s++)e.debug(a[t].serviceOptions[s].serviceOptionId+"services[i].serviceOptions[k].serviceOptionId"),n.serviceOptionId==a[t].serviceOptions[s].serviceOptionId&&(i.serviceDate=a[t].eachDayRate[r].selectOption.serviceDate);i.adultQuantity=a[t].eachDayRate[r].adult,1==a[t].eachDayRate[r].childrenIsSelected&&(i.childQuantity=a[t].eachDayRate[r].children),n.dailyRates.push(i),o.serviceOptions.push(n)}for(var r=0;r<jr.services.length;r++)if(jr.services[r].serviceTypeId==o.serviceTypeId){jr.services.splice(r,1);break}jr.services.push(o)}}}e.debug(JSON.stringify(jr)+"Mainreservation")}function Oe(a){if(void 0!=a){void 0==jr.services&&(jr.services=[]);for(var t=0;t<a.length;t++){if(1==a[t].checked){var o={};if("PER_ROOM"==a[t].servicePricingType){o.serviceCategory=a[t].serviceCategory,o.serviceTypeId=a[t].serviceTypeId,o.serviceOptions=[];for(var r=0;r<a[t].eachDayRate.length;r++)if(void 0!=a[t].eachDayRate[r].selectOption){var n={};n.serviceOptionId=a[t].eachDayRate[r].selectOption.serviceOptionId,n.dailyRates=[],e.debug(n.serviceOptionId+"tempServiceOption");for(var i={},s=0;s<a[t].serviceOptions.length;s++)e.debug(a[t].serviceOptions[s].serviceOptionId+"services[i].serviceOptions[k].serviceOptionId"),n.serviceOptionId==a[t].serviceOptions[s].serviceOptionId&&(i.serviceDate=a[t].eachDayRate[r].selectOption.serviceDate);i.quantity=a[t].eachDayRate[r].room,n.dailyRates.push(i),o.serviceOptions.push(n)}jr.services.push(o)}}if(1==a[t].checked){var o={};if("PER_RESERVATION"==a[t].servicePricingType){o.serviceCategory=a[t].serviceCategory,o.serviceTypeId=a[t].serviceTypeId,o.serviceOptions=[];for(var r=0;r<a[t].eachDayRate.length;r++)if(void 0!=a[t].eachDayRate[r].selectOption&&a[t].eachDayRate[r].options.length>0){var n={};n.serviceOptionId=a[t].eachDayRate[r].selectOption.serviceOptionId,n.dailyRates=[],e.debug(n.serviceOptionId+"tempServiceOption");for(var i={},s=0;s<a[t].serviceOptions.length;s++)if(e.debug(a[t].serviceOptions[s].serviceOptionId+"services[i].serviceOptions[k].serviceOptionId"),n.serviceOptionId==a[t].serviceOptions[s].serviceOptionId)for(var l=0;l<a[t].eachDayRate.length;l++)if(a[t].eachDayRate[l].options.length>0){i.serviceDate=a[t].eachDayRate[l].date;break}i.quantity=1,n.dailyRates.push(i),o.serviceOptions.push(n)}jr.services.push(o)}}if(1==a[t].checked){var o={};if("PER_PERSON"==a[t].servicePricingType){o.serviceCategory=a[t].serviceCategory,o.serviceTypeId=a[t].serviceTypeId,o.serviceOptions=[];for(var r=0;r<a[t].eachDayRate.length;r++)if(void 0!=a[t].eachDayRate[r].selectOption&&a[t].eachDayRate[r].options.length>0){var n={};n.serviceOptionId=a[t].eachDayRate[r].selectOption.serviceOptionId,n.dailyRates=[],e.debug(n.serviceOptionId+"tempServiceOption");for(var i={},s=0;s<a[t].serviceOptions.length;s++)if(e.debug(a[t].serviceOptions[s].serviceOptionId+"services[i].serviceOptions[k].serviceOptionId"),n.serviceOptionId==a[t].serviceOptions[s].serviceOptionId)for(var l=0;l<a[t].eachDayRate.length;l++)if(a[t].eachDayRate[l].options.length>0){i.serviceDate=a[t].eachDayRate[r].selectOption.serviceDate;break}i.adultQuantity=a[t].adult,void 0!=a[t].children&&"null"!=a[t].children&&(e.debug("enter"),i.childQuantity=a[t].children),n.dailyRates.push(i),o.serviceOptions.push(n)}jr.services.push(o)}}if(1==a[t].checked){var o={};if("PER_ROOM_PER_NIGHT"==a[t].servicePricingType){o.serviceCategory=a[t].serviceCategory,o.serviceTypeId=a[t].serviceTypeId,o.serviceOptions=[];for(var r=0;r<a[t].eachDayRate.length;r++)if(void 0!=a[t].eachDayRate[r].selectOption&&a[t].eachDayRate[r].options.length>0){var n={};n.serviceOptionId=a[t].eachDayRate[r].selectOption.serviceOptionId,n.dailyRates=[],e.debug(n.serviceOptionId+"tempServiceOption");for(var i={},s=0;s<a[t].serviceOptions.length;s++)e.debug(a[t].serviceOptions[s].serviceOptionId+"services[i].serviceOptions[k].serviceOptionId"),n.serviceOptionId==a[t].serviceOptions[s].serviceOptionId&&(i.serviceDate=a[t].eachDayRate[r].selectOption.serviceDate);i.quantity=a[t].eachDayRate[r].room,n.dailyRates.push(i),o.serviceOptions.push(n)}jr.services.push(o)}}if(1==a[t].checked){var o={};if("PER_PERSON_PER_NIGHT"==a[t].servicePricingType){o.serviceCategory=a[t].serviceCategory,o.serviceTypeId=a[t].serviceTypeId,o.serviceOptions=[];for(var r=0;r<a[t].eachDayRate.length;r++)if(void 0!=a[t].eachDayRate[r].selectOption&&a[t].eachDayRate[r].options.length>0){var n={};n.serviceOptionId=a[t].eachDayRate[r].selectOption.serviceOptionId,n.dailyRates=[],e.debug(n.serviceOptionId+"tempServiceOption");for(var i={},s=0;s<a[t].serviceOptions.length;s++)e.debug(a[t].serviceOptions[s].serviceOptionId+"services[i].serviceOptions[k].serviceOptionId"),n.serviceOptionId==a[t].serviceOptions[s].serviceOptionId&&(i.serviceDate=a[t].eachDayRate[r].selectOption.serviceDate);i.adultQuantity=a[t].eachDayRate[r].adult,1==a[t].eachDayRate[r].childrenIsSelected&&(e.debug("enter the children "),i.childQuantity=a[t].eachDayRate[r].children),n.dailyRates.push(i),o.serviceOptions.push(n)}jr.services.push(o)}}}e.debug(jr)}}function Ee(a){if(void 0!=we())for(var t=we(),o=0;o<t.length;o++)if("Discount"!=t[o]&&"group"!=t[o]){var r={};r.codeType=t[o],r.id=xe(t[o]),jr.posSource.requestorIds.push(r);for(var n=0;n<Yr.length;n++)Yr[n].posSource.requestorIds.push(r)}else if("Discount"==t[o]){jr.roomStays[0].discountCode=xe(t[o]);for(var n=0;n<Yr.length;n++)Yr[n].roomStays[0].discountCode=xe(t[o])}if(void 0!=a){e.debug(JSON.stringify(jr.services)),void 0==jr.services&&(jr.services=[]);for(var o=0;o<a.length;o++){if(1==a[o].checked){var i={};if("PER_ROOM"==a[o].servicePricingType){i.serviceCategory=a[o].serviceCategory,i.serviceTypeId=a[o].serviceTypeId,a[o].discountRuleId&&(i.discountRuleId=a[o].discountRuleId),i.serviceOptions=[];for(var n=0;n<a[o].eachDayRate.length;n++)if(void 0!=a[o].eachDayRate[n].selectOption){var s={};s.serviceOptionId=a[o].eachDayRate[n].selectOption.serviceOptionId,s.dailyRates=[],e.debug(s.serviceOptionId+"tempServiceOption");for(var l={},c=0;c<a[o].serviceOptions.length;c++)e.debug(a[o].serviceOptions[c].serviceOptionId+"services[i].serviceOptions[k].serviceOptionId"),s.serviceOptionId==a[o].serviceOptions[c].serviceOptionId&&(l.serviceDate=a[o].eachDayRate[n].selectOption.serviceDate);l.quantity=a[o].eachDayRate[n].room,s.dailyRates.push(l),i.serviceOptions.push(s)}jr.services.push(i)}}if(1==a[o].checked){var i={};if("PER_RESERVATION"==a[o].servicePricingType){i.serviceCategory=a[o].serviceCategory,i.serviceTypeId=a[o].serviceTypeId,a[o].discountRuleId&&(i.discountRuleId=a[o].discountRuleId),i.serviceOptions=[];for(var n=0;n<a[o].eachDayRate.length;n++)if(void 0!=a[o].eachDayRate[n].selectOption&&a[o].eachDayRate[n].options.length>0){var s={};s.serviceOptionId=a[o].eachDayRate[n].selectOption.serviceOptionId,s.dailyRates=[],e.debug(s.serviceOptionId+"tempServiceOption");for(var l={},c=0;c<a[o].serviceOptions.length;c++)if(e.debug(a[o].serviceOptions[c].serviceOptionId+"services[i].serviceOptions[k].serviceOptionId"),s.serviceOptionId==a[o].serviceOptions[c].serviceOptionId)for(var d=0;d<a[o].eachDayRate.length;d++)if(a[o].eachDayRate[d].options.length>0){l.serviceDate=a[o].eachDayRate[d].date;break}l.quantity=1,s.dailyRates.push(l),i.serviceOptions.push(s)}jr.services.push(i)}}if(1==a[o].checked){var i={};if("PER_PERSON"==a[o].servicePricingType){i.serviceCategory=a[o].serviceCategory,i.serviceTypeId=a[o].serviceTypeId,a[o].discountRuleId&&(i.discountRuleId=a[o].discountRuleId),i.serviceOptions=[];for(var n=0;n<a[o].eachDayRate.length;n++)if(void 0!=a[o].eachDayRate[n].selectOption&&a[o].eachDayRate[n].options.length>0){var s={};s.serviceOptionId=a[o].eachDayRate[n].selectOption.serviceOptionId,s.dailyRates=[],e.debug(s.serviceOptionId+"tempServiceOption");for(var l={},c=0;c<a[o].serviceOptions.length;c++)if(e.debug(a[o].serviceOptions[c].serviceOptionId+"services[i].serviceOptions[k].serviceOptionId"),s.serviceOptionId==a[o].serviceOptions[c].serviceOptionId)for(var d=0;d<a[o].eachDayRate.length;d++)if(a[o].eachDayRate[d].options.length>0){l.serviceDate=a[o].eachDayRate[n].selectOption.serviceDate;break}l.adultQuantity=a[o].adult,void 0!=a[o].children&&"null"!=a[o].children&&(e.debug("enter"),l.childQuantity=a[o].children),s.dailyRates.push(l),i.serviceOptions.push(s)}jr.services.push(i)}}if(1==a[o].checked){var i={};if("PER_ROOM_PER_NIGHT"==a[o].servicePricingType){i.serviceCategory=a[o].serviceCategory,i.serviceTypeId=a[o].serviceTypeId,a[o].discountRuleId&&(i.discountRuleId=a[o].discountRuleId),i.serviceOptions=[];for(var n=0;n<a[o].eachDayRate.length;n++)if(void 0!=a[o].eachDayRate[n].selectOption&&a[o].eachDayRate[n].options.length>0){var s={};s.serviceOptionId=a[o].eachDayRate[n].selectOption.serviceOptionId,s.dailyRates=[],e.debug(s.serviceOptionId+"tempServiceOption");for(var l={},c=0;c<a[o].serviceOptions.length;c++)e.debug(a[o].serviceOptions[c].serviceOptionId+"services[i].serviceOptions[k].serviceOptionId"),s.serviceOptionId==a[o].serviceOptions[c].serviceOptionId&&(l.serviceDate=a[o].eachDayRate[n].selectOption.serviceDate);l.quantity=a[o].eachDayRate[n].room,s.dailyRates.push(l),i.serviceOptions.push(s)}jr.services.push(i)}}if(1==a[o].checked){var i={};if("PER_PERSON_PER_NIGHT"==a[o].servicePricingType){i.serviceCategory=a[o].serviceCategory,i.serviceTypeId=a[o].serviceTypeId,a[o].discountRuleId&&(i.discountRuleId=a[o].discountRuleId),i.serviceOptions=[];for(var n=0;n<a[o].eachDayRate.length;n++)if(void 0!=a[o].eachDayRate[n].selectOption&&a[o].eachDayRate[n].options.length>0){var s={};s.serviceOptionId=a[o].eachDayRate[n].selectOption.serviceOptionId,s.dailyRates=[],e.debug(s.serviceOptionId+"tempServiceOption");for(var l={},c=0;c<a[o].serviceOptions.length;c++)e.debug(a[o].serviceOptions[c].serviceOptionId+"services[i].serviceOptions[k].serviceOptionId"),s.serviceOptionId==a[o].serviceOptions[c].serviceOptionId&&(l.serviceDate=a[o].eachDayRate[n].selectOption.serviceDate);l.adultQuantity=a[o].eachDayRate[n].adult,
1==a[o].eachDayRate[n].childrenIsSelected&&(e.debug("enter the children "),l.childQuantity=a[o].eachDayRate[n].children),s.dailyRates.push(l),i.serviceOptions.push(s)}jr.services.push(i)}}}}e.debug(JSON.stringify(jr)+"Mainreservation"),e.debug(JSON.stringify(jr.services))}function Me(){var t=r.getHotelInfo().hotelCode,o=Pe(),n=$(),i=pe(),s=Pe().resGlobalInfo.guestCounts,l=r.getOccupancyInfo(),c=o.resGlobalInfo.guestCounts.length,d={};e.debug("guestsFromResObj"),e.debug(s),void 0!=t&&(d.hotelCode=r.getHotelInfo().hotelCode),jr.posSource&&jr.posSource.companyName&&void 0!=jr.posSource.companyName.code&&(d.bookerIdentifier=jr.posSource.companyName.code),jr.posSource&&jr.posSource.companyName&&void 0!=jr.posSource.companyName.companyShortName&&(d.partnerIdentifier=jr.posSource.companyName.companyShortName);for(var g=0;g<c;g++)if("10"==s[g].ageQualifyingCode&&void 0!=s[g].count){e.debug(" in if ");var m=parseInt(s[g].count);d.adults=m}if(Cr)for(var u=0,g=0;g<c;g++)"8"==s[g].ageQualifyingCode&&(u+=parseInt(s[g].count)),d.children=u;else for(var p=0,g=0;g<c;g++)"8"==s[g].ageQualifyingCode&&void 0!==s[g].count&&(p+=parseInt(s[g].count),e.debug("children"),e.debug(p)),d.children=p;for(var g=0;g<s.length;g++)if("7"==s[g].ageQualifyingCode&&void 0!=s[g].count){var y=parseInt(s[g].count);d.infant=y}for(var g=0;g<c;g++)if("7"==s[g].ageQualifyingCode&&void 0===s[g].count){var y=parseInt(l.defaultInfants);d.infant=y}if(void 0!=o.resGlobalInfo.timeSpan.start){var v=o.resGlobalInfo.timeSpan.start;d.dateIn=v}if(void 0!=o.resGlobalInfo.timeSpan.end){var h=o.resGlobalInfo.timeSpan.end;d.dateOut=h}if(Cr||1==a.MRB){d.childrenAges=void 0;for(var R=jr.resGlobalInfo.guestCounts,f=[],g=0;g<R.length;g++)if("8"==R[g].ageQualifyingCode&&R[g].count)for(var C=0;C<R[g].count;C++)void 0!=R[g].age&&(f.push(R[g].age.toString()),d.childrenAges=f.join(","))}else{var R=jr.resGlobalInfo.guestCounts,f=[];if(void 0!=n.ageList&&0!=n.ageList.length){d.childrenAges=void 0;for(var g=0;g<n.ageList.length;g++){if(g<n.ageList.length-1)var P=parseInt(n.ageList[g].id)+",";else P=parseInt(n.ageList[g].id);void 0!=d.childrenAges?d.childrenAges=d.childrenAges+P:d.childrenAges=P}}else if(void 0!=R){d.childrenAges=void 0;for(var g=0;g<R.length;g++)if("8"==R[g].ageQualifyingCode&&R[g].count)for(var C=0;C<R[g].count;C++)void 0!=R[g].age&&(f.push(R[g].age.toString()),d.childrenAges=f.join(","))}}if(Cr){var S=o.roomStays[0].roomRates,A=0;angular.forEach(S,function(e){A+=e.numberOfUnits}),d.rooms=A}else if(void 0!=o.resGlobalInfo.rooms&&0!=o.resGlobalInfo.rooms){var I=parseInt(o.resGlobalInfo.rooms);d.rooms=I}else{var S=o.roomStays[0].roomRates,A=0;angular.forEach(S,function(e){A+=e.numberOfUnits}),d.rooms=A}var b=ve();e.debug(b+"this is languageCode if you changed the language"),void 0!=b&&(d.languageCode=b),void 0!=i&&Object.keys(i).length>0&&(d.allCodes=i);var D=Ce()||ze()&&ze().currencyCode;void 0!=D&&(d.currencyCode=D);var i=pe();if(void 0!=i&&Object.keys(i).length>0){d.allCodes=i;for(var T=we(),g=0;g<T.length;g++)"group"==T[g].toLowerCase()?(d.ratePlanType="Group",d.groupCode=xe(T[g]),d.roomTypeCode=void 0):d.ratePlanType=void 0}else for(var O=jr.posSource.requestorIds,C=0;C<O.length;C++)"group"==O[C].codeType&&(d.ratePlanType="Group",d.groupCode=O[C].id,d.roomTypeCode=void 0),"travelagent"==O[C].codeType&&(d.taCode=O[C].id),"discount"==O[C].codeType&&(d.Discount=O[C].id),"corporate"==O[C].codeType&&(d.Corporate=O[C].id);void 0!=jr.roomStays&&jr.roomStays.length>0&&(void 0!=jr.roomStays[0].discountCode&&(d.Discount=jr.roomStays[0].discountCode),void 0!=jr.roomStays[0].taCode&&(d.taCode=jr.roomStays[0].taCode),void 0!=jr.roomStays[0].groupCode&&(d.groupCode=jr.roomStays[0].groupCode),void 0!=jr.roomStays[0].corpCode&&(d.Corporate=jr.roomStays[0].corpCode));var E=he();return void 0!=E&&(d.uniqueId=E),""!=jr.gmsPromoCode&&(d.gmsPromoCode=jr.gmsPromoCode),d}function _e(){var t=r.getHotelInfo().hotelCode,o=r.getOccupancyInfo(),n=pe(),i=Pe(),s=Pe().resGlobalInfo.guestCounts,l=s.length,c={};e.debug(JSON.stringify(i)+"guests"),void 0!=Pe().roomStays&&Pe().roomStays.length>0&&void 0!=Pe().roomStays[0].roomRates&&Pe().roomStays[0].roomRates.length>0&&(c.roomTypeCode=Pe().roomStays[0].roomRates[0].roomTypeCode),void 0!=t&&(c.hotelCode=r.getHotelInfo().hotelCode);for(var d=0;d<l;d++)if("10"==s[d].ageQualifyingCode&&void 0!=s[d].count){var g=parseInt(s[d].count);c.adults=g}for(var d=0;d<l;d++)if("10"==s[d].ageQualifyingCode&&void 0===s[d].count){var g=parseInt(o.defaultAdult);c.adults=g}if(Cr)for(var m=0,d=0;d<l;d++)"8"==s[d].ageQualifyingCode&&(m+=parseInt(s[d].count)),c.children=m;else for(var u=0,d=0;d<l;d++)"8"==s[d].ageQualifyingCode&&void 0!==s[d].count&&(u+=parseInt(s[d].count),c.children=u);for(var d=0;d<l;d++)if("7"==s[d].ageQualifyingCode&&void 0!=s[d].count){var p=parseInt(s[d].count);c.infant=p}for(var d=0;d<l;d++)if("7"==s[d].ageQualifyingCode&&void 0===s[d].count){var p=parseInt(o.defaultInfants);c.infant=p}var y=$();if(Cr||1==a.MRB){c.childrenAges=void 0;for(var v=jr.resGlobalInfo.guestCounts,h=[],d=0;d<v.length;d++)if("8"==v[d].ageQualifyingCode&&v[d].count)for(var R=0;R<v[d].count;R++)void 0!=v[d].age&&(h.push(v[d].age.toString()),c.childrenAges=h.join(","))}else{var v=jr.resGlobalInfo.guestCounts,h=[];if(void 0!=y.ageList&&0!=y.ageList.length){c.childrenAges=void 0;for(var d=0;d<y.ageList.length;d++){if(d<y.ageList.length-1)var f=parseInt(y.ageList[d].id)+",";else f=parseInt(y.ageList[d].id);void 0!=c.childrenAges?c.childrenAges=c.childrenAges+f:c.childrenAges=f}}else if(void 0!=v){c.childrenAges=void 0;for(var d=0;d<v.length;d++)if("8"==v[d].ageQualifyingCode&&v[d].count)for(var R=0;R<v[d].count;R++)void 0!=v[d].age&&(h.push(v[d].age.toString()),c.childrenAges=h.join(","))}}if(Cr){var C=i.roomStays[0].roomRates,P=0;angular.forEach(C,function(e){P+=e.numberOfUnits}),c.rooms=P}else if(void 0!=i.resGlobalInfo.rooms&&0!=i.resGlobalInfo.rooms){var S=parseInt(i.resGlobalInfo.rooms);c.rooms=S}else{var C=i.roomStays[0].roomRates,P=0;angular.forEach(C,function(e){P+=e.numberOfUnits}),c.rooms=P}void 0!=n&&Object.keys(n).length>0&&(c.allCodes=n),void 0!=jr.roomStays&&jr.roomStays.length>0&&(void 0!=jr.roomStays[0].discountCode&&(c.Discount=jr.roomStays[0].discountCode),void 0!=jr.roomStays[0].taCode&&(c.taCode=jr.roomStays[0].taCode),void 0!=jr.roomStays[0].groupCode&&(c.groupCode=jr.roomStays[0].groupCode),void 0!=jr.roomStays[0].corpCode&&(c.Corporate=jr.roomStays[0].corpCode));var A=ve();void 0!=A&&(c.languageCode=A);var I=Ce()||ze()&&ze().currencyCode;void 0!=I&&(c.currencyCode=I);var b=he();if(void 0!=b&&(c.uniqueId=b),void 0!=i.resGlobalInfo.timeSpan.start){var D=i.resGlobalInfo.timeSpan.start;c.dateIn=D}if(void 0!=i.resGlobalInfo.timeSpan.end){var T=i.resGlobalInfo.timeSpan.end;c.dateOut=T}if(void 0!=i.resGlobalInfo.timeSpan.start&&void 0!=i.resGlobalInfo.timeSpan.end){var O=moment(i.resGlobalInfo.timeSpan.end).diff(moment(i.resGlobalInfo.timeSpan.start),"days");c.duration=O}void 0!=i.roomStays&&i.roomStays.length>0&&void 0!=i.roomStays[0].ratePlans&&i.roomStays[0].ratePlans.length>0&&(void 0!=i.roomStays[0].ratePlans[0].ratePlanCode&&"Group"!=i.roomStays[0].ratePlans[0].ratePlanType?(c.ratePlanCode=i.roomStays[0].ratePlans[0].ratePlanCode,c.ratePlanType=i.roomStays[0].ratePlans[0].ratePlanType):(c.ratePlanCode=void 0,c.ratePlanType=void 0)),void 0!=i.roomStays&&i.roomStays.length>0&&i.roomStays[0].roomRates.length>0&&(c.roomTypeCode=i.roomStays[0].roomRates[0].roomTypeCode);var n=pe();if(void 0!=n&&Object.keys(n).length>0){c.allCodes=n;for(var E=we(),d=0;d<E.length;d++)"group"==E[d].toLowerCase()&&(c.groupCode=xe(E[d]),c.roomTypeCode=void 0)}else for(var M=jr.posSource.requestorIds,R=0;R<M.length;R++)"group"==M[R].codeType&&(c.ratePlanType="Group",c.groupCode=M[R].id,c.roomTypeCode=void 0),"travelagent"==M[R].codeType&&(c.taCode=M[R].id),"discount"==M[R].codeType&&(c.Discount=M[R].id),"corporate"==M[R].codeType&&(c.Corporate=M[R].id);return void 0!=jr.roomStays&&jr.roomStays.length>0&&(void 0!=jr.roomStays[0].discountCode&&(c.Discount=jr.roomStays[0].discountCode),void 0!=jr.roomStays[0].taCode&&(c.taCode=jr.roomStays[0].taCode),void 0!=jr.roomStays[0].groupCode&&(c.groupCode=jr.roomStays[0].groupCode),void 0!=jr.roomStays[0].corpCode&&(c.Corporate=jr.roomStays[0].corpCode)),""!=jr.gmsPromoCode&&(c.gmsPromoCode=jr.gmsPromoCode),jr.posSource&&jr.posSource.companyName&&void 0!=jr.posSource.companyName.code&&(c.bookerIdentifier=jr.posSource.companyName.code),jr.posSource&&jr.posSource.companyName&&void 0!=jr.posSource.companyName.companyShortName&&(c.partnerIdentifier=jr.posSource.companyName.companyShortName),e.debug(JSON.stringify(c)+" in Reservation service options "),c}function ke(){return un.reservations=[],un.reservations.push(jr),un}function Ne(e){var a=moment(jr.resGlobalInfo.timeSpan.start,"YYYY-MM-DD").format("DD"),t=moment(jr.resGlobalInfo.timeSpan.end,"YYYY-MM-DD").format("DD"),o=Number(t)-Number(a);if(jr.total={amountBeforeTax:0,amountAfterTax:0},void 0!==jr.roomRates){var r=2;jr.roomRates[0].numberOfUnits=2}else{var r=2;jr.roomRates=[],jr.roomRates[0]={roomTypeCode:e.roomTypeCode,roomTypeName:e.roomTypeName,numberOfUnits:1,rates:[]};for(var n=0;n<o;n++){var i=moment(jr.resGlobalInfo.timeSpan.start,"YYYY-MM-DD").add(n,"days").format("YYYY-MM-DD");jr.roomRates[0].rates.push({effectiveDate:i,unitMultiplier:1,base:{amountBeforeTax:e.averageRate}}),pn+=jr.roomRates[0].rates[0].base.amountBeforeTax,yn=pn}}jr.total.amountBeforeTax=pn*r,jr.total.amountAfterTax+=yn*r}function Le(){return{hotelCode:1234,languageCode:"EN_US",currencyCode:"USD",reservations:[{uniqueId:9999,resGlobalInfo:{timeSpan:{start:"2015-11-25",end:"2015-11-30"}},roomStays:{ratePlans:[{ratePlanCode:0,ratePlanType:"PACKAGE"}],roomRates:[{numberOfUnits:0,roomTypeCode:0}]},roomRates:[{roomTypeCode:"0",numberOfUnits:2,rates:[{effectiveDate:" 2015-12-15",unitMultiplier:1,base:{amountBeforeTax:"100.00"}},{effectiveDate:" 2015-12-16",unitMultiplier:2,base:{amountBeforeTax:"100.00"}},{effectiveDate:" 2015-12-17",unitMultiplier:3,base:{amountBeforeTax:"100.00"}}]}],total:{amountBeforeTax:"300.00",amountAfterTax:"450.00"}}]}}function Ge(e){jr.resGuests[0].profiles[0].customer=e.customer,jr.resGuests[0].profiles[0].shareAllMarketInd=e.shareAllMarketInd,jr.resGlobalInfo.guarantee=e.guarantee,jr.resGlobalInfo.specialRequests=e.specialRequests,b()}function Fe(t,r){if(Cr){void 0==jr.allCodes&&(jr.allCodes={}),jr.allCodes[t]=r,f("add_special_codes"),a.$broadcast(o.RES_SELECTION_CHANGE);var n=l("filter")(jr.posSource.requestorIds,{codeType:t.toLowerCase(),id:r});if(n.length<=0&&jr.posSource.requestorIds.push({codeType:t.toLowerCase(),id:r}),"discount"==t.toLowerCase()&&(jr.roomStays[0].discountCode=r),1==a.MRB){for(var i=0;i<Yr.length;i++){void 0==Yr[i].allCodes&&(Yr[i].allCodes={}),Yr[i].allCodes[t]=r,a.$broadcast(o.RES_SELECTION_CHANGE);var n=l("filter")(Yr[i].posSource.requestorIds,{codeType:t.toLowerCase(),id:r});n.length<=0&&Yr[i].posSource.requestorIds.push({codeType:t.toLowerCase(),id:r}),"discount"==t.toLowerCase()&&(Yr[i].roomStays[0].discountCode=r)}a.reservationArray=Fa()}}else{if(void 0==jr.allCodes&&(jr.allCodes={}),jr.allCodes[t]=r,e.info(JSON.stringify(jr.allCodes)+"this is all the discount code"),e.info(JSON.stringify(jr.codeType)+"this is all the CodeType"),e.debug("trigger the event"),1==a.MRB){for(var i=0;i<Yr.length;i++)void 0==Yr[i].allCodes&&(Yr[i].allCodes={}),Yr[i].allCodes[t]=r;a.reservationArray=Fa()}f("add_special_codes"),a.$broadcast(o.RES_SELECTION_CHANGE)}b()}function Be(t){if(jr.codeType?jr.codeType.push(t):(jr.codeType=[],jr.codeType.push(t)),e.info(JSON.stringify(jr.allCodes)+"this is all the discount code"),e.info(JSON.stringify(jr.codeType)+"this is all the CodeType"),1==a.MRB){for(var o=0;o<Yr.length;o++)if(Yr[o].codeType){for(var r=!1,n=0;n<Yr[o].codeType.length;n++)if(Yr[o].codeType[n]==t){r=!0;break}Yr[o].codeType&&1!=r&&Yr[o].codeType.push(t)}else Yr[o].codeType=[],Yr[o].codeType.push(t);a.reservationArray=Fa()}b()}function xe(e){return jr.allCodes[e]}function we(){return void 0!=jr.codeType?jr.codeType:void 0}function Ue(e){if(void 0!=jr.codeType&&jr.codeType.splice(e,1),1==a.MRB){for(var t=0;t<Yr.length;t++)void 0!=Yr[t].codeType&&Yr[t].codeType.splice(e,1);a.reservationArray=Fa()}setTimeout(function(){a.$broadcast(o.RES_SELECTION_CHANGE)},0)}function He(t){if("Group"!=t&&"group"!=t||(a.hidePriceFromAttendees=!1),e.debug("begin:"+JSON.stringify(t)),Cr){jr.allCodes&&(delete jr.allCodes[t],"Group"===t&&q(void 0));var o=jr.posSource.requestorIds;if(o.length>0)for(var r=0;r<o.length;r++)o[r].codeType==t&&(o.splice(r,1),jr.posSource.requestorIds=o);if(1==a.MRB){for(var r=0;r<Yr.length;r++)if(Yr[r].allCodes[t]){Yr[r].allCodes&&(delete Yr[r].allCodes[t],"Group"===t&&q(void 0));var o=Yr[r].posSource.requestorIds;if(o.length>0)for(var r=0;r<o.length;r++)o[r].codeType==t&&(o.splice(r,1),Yr[r].posSource.requestorIds=o)}a.reservationArray=Fa()}}else{if(jr.allCodes&&delete jr.allCodes[t],"Group"===t&&q(void 0),1==a.MRB){for(var r=0;r<Yr.length;r++)void 0!=Yr[r].allCodes&&(e.debug("end:"+JSON.stringify(t)),delete Yr[r].allCodes[t]),"Group"===t&&q(void 0);a.reservationArray=Fa()}e.info(JSON.stringify(jr.allCodes)+"this is Allcode in service")}}function Ve(){var e="Group";if(jr.allCodes&&jr.allCodes[e]&&(delete jr.allCodes[e],angular.forEach(jr.codeType,function(a,t){a==e&&jr.codeType.splice(t,1)})),jr.posSource&&jr.posSource.requestorIds){var t=jr.posSource.requestorIds;if(t.length>0)for(var o=0;o<t.length;o++)t[o].codeType==e.toLowerCase()&&(t.splice(o,1),jr.posSource.requestorIds=t)}if(1==a.MRB){for(var o=0;o<Yr.length;o++){var e="Group";if(Yr[o].allCodes&&Yr[o].allCodes[e]&&(delete Yr[o].allCodes[e],angular.forEach(Yr[o].codeType,function(a,t){a==e&&Yr[o].codeType.splice(t,1)})),Yr[o].posSource&&Yr[o].posSource.requestorIds){var t=Yr[o].posSource.requestorIds;if(t.length>0)for(var r=0;r<t.length;r++)t[r].codeType==e.toLowerCase()&&(t.splice(r,1),Yr[o].posSource.requestorIds=t)}}a.reservationArray=Fa()}}function $e(){return Pe().resGlobalInfo.timeSpan.start}function qe(){return Pe().resGlobalInfo.timeSpan.end}function Ye(){var e=n.translateMonthShortName(moment.utc($e()).format("M")),a=n.translateMonthShortName(moment.utc(qe()).format("M")),t=moment.utc($e()).format("D"),o=moment.utc(qe()).format("D");return e===a?e+" "+t+"-"+o:e+" "+t+"-"+a+" "+o}function je(e){I(e),a.currencyLeadRate=e.leadRateDisplayEnabled}function ze(){return Ar}function We(a){jr=a,e.debug(JSON.stringify(jr)+"  this is the new mainReservation"),b()}function Ke(a){jr=a,S(!0),e.debug(JSON.stringify(jr)+"  this is the Retrieved mainReservation"),b()}function Je(a){jr=a,e.debug(JSON.stringify(jr)+"  this is the Retrieved mainReservation"),b()}function Qe(){var e=_r.get("/page/modify/"+r.getHotelInfo().hotelCode);return void 0!=e&&(Cr=e),Cr}function Xe(a,t,o,r){var n={useType:"1",countryCode:"",stateCode:"",stateName:"",cityName:"",postalCode:"",addressLine1:"",addressLine2:""},i={useType:"3",countryCode:"",stateCode:"",stateName:"",cityName:"",postalCode:"",addressLine1:"",addressLine2:""};jr.resGuests[0].profile.customer.namePrefix=a.salutation?a.salutation:"",jr.resGuests[0].profile.customer.givenName=a.firstName,jr.resGuests[0].profile.customer.surName=a.lastName;var s={phoneUseType:"1",phoneNumber:""};s.phoneNumber=a.phoneNumber;for(var l,c=jr.resGuests[0].profile.customer.telephone.length,d=!1,g=0;g<c;g++)"1"==jr.resGuests[0].profile.customer.telephone[g].phoneUseType&&(l=g,d=!0);if(d?jr.resGuests[0].profile.customer.telephone[l].phoneNumber=a.phoneNumber:jr.resGuests[0].profile.customer.telephone.push(s),jr.resGuests[0].profile.customer.email=a.email,jr.resGuests[0].profile.shareAllMarketInd=o.specialOffersByEmail,jr.resGuests[0].uniqueId.id=a.guestId,jr.resGuests[0].uniqueId.idContext="ProfileID",n.countryCode=a.contactCountry,n.stateCode=a.contactState,n.stateName=a.contactStateName,n.cityName=a.contactCity,n.postalCode=a.contactPostalCode,n.addressLine1=a.contactAddress1,n.addressLine2=a.contactAddress2,void 0!=jr.resGuests[0].profile.customer.address)for(var g=0;g<jr.resGuests[0].profile.customer.address.length;g++)if(void 0!=n&&n.useType==jr.resGuests[0].profile.customer.address[g].useType){jr.resGuests[0].profile.customer.address.splice(g,1);break}if(t&&(jr.resGuests[0].profile.booker||(jr.resGuests[0].profile.booker={}),jr.resGuests[0].profile.booker.salutation=t.salutation&&"N/A"!==t.salutation?t.salutation:null,jr.resGuests[0].profile.booker.firstName=t.firstName?t.firstName:"",jr.resGuests[0].profile.booker.lastName=t.lastName?t.lastName:"",jr.resGuests[0].profile.booker.email=t.email?t.email:""),G()){var m=jr.resGuests[0].profile.customer.address[0];jr.resGuests[0].profile.customer.address=[],jr.resGuests[0].profile.customer.address[0]=n,m&&"3"==m.useType&&(jr.resGuests[0].profile.customer.address[1]=m)}else jr.resGuests[0].profile.customer.address.push(n);if(!o.useSameContactAddress&&r){if(i.countryCode=o.billingCountry,i.stateCode=o.billingState,i.stateName=o.billingStateName,i.cityName=o.billingCity,i.postalCode=o.billingPostalCode,i.addressLine1=o.billingAddressLine1,i.addressLine2=o.billingAddressLine2,void 0!=jr.resGuests[0].profile.customer.address)for(var g=0;g<jr.resGuests[0].profile.customer.address.length;g++)if(void 0!=i&&i.useType==jr.resGuests[0].profile.customer.address[g].useType){jr.resGuests[0].profile.customer.address.splice(g,1);break}jr.resGuests[0].profile.customer.address.push(i)}if(o.billingAddress){if(i=o.billingAddress,void 0!=jr.resGuests[0].profile.customer.address)for(var g=0;g<jr.resGuests[0].profile.customer.address.length;g++)if(void 0!=i&&i.useType==jr.resGuests[0].profile.customer.address[g].useType){jr.resGuests[0].profile.customer.address.splice(g,1);break}jr.resGuests[0].profile.customer.address.push(i)}jr.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderName=o.nameOnCard,""!=o.cardNumber&&void 0!=o.cardNumber&&(jr.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardNumber=o.cardNumber,jr.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardCode=o.cardType,jr.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardType=o.cardId),null!=o.ccv&&(jr.resGlobalInfo.guaranteesAccepted[0].paymentCard.seriesCode=o.ccv),jr.resGlobalInfo.guaranteesAccepted[0].paymentCard.expireDate=o.cardExpiryHalf,null==jr.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderName&&(jr.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderName=void 0),e.debug("State"),e.debug(jr),e.debug(JSON.stringify(jr)+"   salutation "),b()}function Ze(e){var t,o=e&&e.currentReservation?e.currentReservation:null,r=e&&e.additionalData?e.additionalData:null,n=e&&e.type?e.type:null;if(r&&n&&(1==a.MRB&&o?(o.additionalInfo||(o.additionalInfo=[]),t=o):(jr.additionalInfo||(jr.additionalInfo=[]),t=jr),t.additionalInfo)){var i=c.findIndex(t.additionalInfo,function(e){return e.type==n});-1!=i?t.additionalInfo[i]=r:t.additionalInfo.push(r)}}function ea(e){var t,o=e&&e.currentReservation?e.currentReservation:null,r=e&&e.type?e.type:null;if(r&&(t=1==a.MRB&&o?o.additionalInfo?o.additionalInfo:[]:jr.additionalInfo?jr.additionalInfo:[],t.length)){var n=c.findIndex(t,function(e){return e.type==r});-1!=n&&t.splice(n,1)}}function aa(){return qr}function ta(e,a){qr.guestInfo=e,qr.paymentInfo=a,b()}function oa(e){Cr&&void 0!=jr.roomStays[0].roomRates[0].numberOfUnits&&(jr.roomStays[0].roomRates[0].numberOfUnits=e)}function ra(){return jr.services}function na(a){jr.services=l("filter")(jr.services,{serviceTypeId:"!"+a.serviceTypeId}),e.debug(JSON.stringify(jr.services))}function ia(e,a){jr.services[a]=e}function sa(){a.continueModifyReservation=!0}function la(){delete jr.roomStays[0].discountCode;for(var e=0;e<jr.posSource.requestorIds.length;e++)if("discount"==jr.posSource.requestorIds[e].codeType){jr.posSource.requestorIds.splice(e,1);break}if(1==a.MRB){for(var e=0;e<Yr.length;e++){delete Yr[e].roomStays[0].discountCode;for(var t=0;t<Yr[e].posSource.requestorIds.length;t++)if("discount"==Yr[e].posSource.requestorIds[t].codeType){Yr[e].posSource.requestorIds.splice(t,1);break}}a.reservationArray=Fa()}}function ca(e){for(var t=0;t<jr.posSource.requestorIds.length;t++)if(jr.posSource.requestorIds[t].codeType.toLowerCase()==e){jr.posSource.requestorIds.splice(t,1);break}if(1==a.MRB){for(var t=0;t<Yr.length;t++)for(var o=0;o<Yr[t].posSource.requestorIds.length;o++)if(Yr[t].posSource.requestorIds.length>0&&Yr[t].posSource.requestorIds[o].codeType.toLowerCase()==e){Yr[t].posSource.requestorIds.splice(o,1);break}a.reservationArray=Fa()}}function da(){if(void 0!=jr.services&&jr.services.length>0)for(var e=jr.services.length-1;e>=0;e--)"PACKAGE_INCLUSION"!=jr.services[e].serviceCategory&&jr.services.splice(e,1)}function ga(){if(void 0!=jr.resGlobalInfo.guestCounts&&jr.resGlobalInfo.guestCounts.length>0)for(var e=jr.resGlobalInfo.guestCounts.length;e--;e<=0)"7"!=jr.resGlobalInfo.guestCounts[e].ageQualifyingCode&&"8"!=jr.resGlobalInfo.guestCounts[e].ageQualifyingCode||jr.resGlobalInfo.guestCounts.splice(e,1);if(1==a.MRB){for(var e=0;e<Yr.length;e++)if(void 0!=Yr[e].resGlobalInfo.guestCounts&&Yr[e].resGlobalInfo.guestCounts.length>0)for(var t=Yr[e].resGlobalInfo.guestCounts.length;t--;t<=0)"7"!=Yr[e].resGlobalInfo.guestCounts[t].ageQualifyingCode&&"8"!=Yr[e].resGlobalInfo.guestCounts[t].ageQualifyingCode||Yr[e].resGlobalInfo.guestCounts.splice(t,1);for(var e=0;e<Kr.length;e++)void 0!=Kr[e].ChildArr&&(Kr[e].ChildArr=[]),void 0!=Kr[e].Children&&(Kr[e].Children=0),void 0!=Kr[e].Infants&&(Kr[e].Infants=0);a.reservationArray=Fa()}}function ma(e){Mr=e}function ua(){return Mr}function pa(){jr.policyOverrideIndicator=!0}function ya(){delete jr.uniqueId}function va(e){nr=e}function ha(){return nr}function Ra(){return i.get("pageCache")||(_r=i.createCache("pageCache",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"})),_r.get("/page/reservation/"+r.getHotelInfo().hotelCode)}function fa(){return _r.get("/page/currency/"+r.getHotelInfo().hotelCode)}function Ca(e){i.get("gmsProfile")||(dn=i.createCache("gmsProfile",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"})),dn.put("/page/gmsProfile/"+r.getHotelInfo().hotelCode,e)}function Pa(){return i.get("gmsProfile")||(dn=i.createCache("gmsProfile",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"})),dn.get("/page/gmsProfile/"+r.getHotelInfo().hotelCode)}function Sa(){i.get("gmsProfile")&&dn.destroy()}function Aa(){i.get("promoCache")||(gn=i.createCache("promoCache",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"})),gn.put("checkPromo",!0)}function Ia(){if(i.get("promoCache")||(gn=i.createCache("promoCache",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"})),gn=gn.get("checkPromo")){var a=gn;return e.debug("get ifPromo:"+JSON.stringify(a)),a}return console.log("No promoCache!"),null}function ba(e){i.get("gmsRouteCache")||(mn=i.createCache("gmsRouteCache",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"})),mn.put("/page/gmsRoute/"+r.getHotelInfo().hotelCode,e)}function Da(){i.get("gmsRouteCache")||(mn=i.createCache("gmsRouteCache",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"}));var e=mn.get("/page/gmsRoute/"+r.getHotelInfo().hotelCode);return e||null}function Ta(){i.get("gmsRouteCache")&&i.get("gmsRouteCache").destroy()}function Oa(){jr.resGuests[0].profile.shareAllMarketInd=0}function Ea(){yr=!0}function Ma(){vr=!0,D()}function _a(e){vn=e}function ka(){return vn}function Na(e){Kr=angular.copy(e)}function La(){return Kr}function Ga(){for(var e=Kr.length-1;e>=0;e--){for(var a=!1,t=0;t<Yr.length;t++)Kr[e].id==Yr[t].id&&(a=!0);0==a&&Kr.splice(e,1)}}function Fa(){return Yr}function Ba(e){var a=angular.copy(e);Yr.push(a)}function xa(e,a){var t=Ua(e);return t?(Yr=e,_r.put("/page/reservationArray/"+r.getHotelInfo().hotelCode,Yr)):void 0!=a&&1==a&&gt(),t}function wa(e){return Ua(e)}function Ua(e){ur=[];var a=angular.copy(e),t=!0;return c.forEach(a,function(e){if(void 0!=e.errorInfo){t=!1,ur.push(e.id),Xa(e.id),Q(),ne(),st(e.id);var a=Pe();Ya(a.id,a)}else Ya(e.id,e)}),0==t&&Wa(ur[0]),t}function Ha(e){for(var a={isError:!1,errorInfo:void 0},t=0;t<e.length;t++)if(e[t].errorInfo){a.isError=!0,a.errorInfo=e[t].errorInfo;break}return 1==a.isError&&gt(),a}function Va(){return ur}function $a(){Yr=[]}function qa(e){jr.id=e}function Ya(e,a){for(var t=angular.copy(a),o=0;o<Yr.length;o++)Yr[o].id==e&&(Yr[o]=t)}function ja(){for(var e=!1,a=0;a<Yr.length;a++)if(void 0==Yr[a].roomStays[0].total)return jr=angular.copy(Yr[a]),e=!0,!1;if(0==e)return!0}function za(e,a){for(var t=0;t<Yr.length;t++)Yr[t].resGlobalInfo.timeSpan={start:e,end:a}}function Wa(e){for(var t=0;t<Yr.length;t++)Yr[t].id==e?(Yr[t].selected=!0,jr=angular.copy(Yr[t]),a.currentRoomSelectorId=t):Yr[t].selected=!1;Lr&&Xt(!1),a.reservationArray=Yr,b()}function Ka(t,o){for(var r=!1,n=0;n<o.length;n++)o[n].id==t?(r=!0,o[n].selected=!0,jr=angular.copy(o[n]),a.currentRoomSelectorId=n):o[n].selected=!1;1!=r&&(jr.roomStays[0].ratePlans.length>0&&(delete jr.roomStays[0].ratePlans[0].ratePlanCode,delete jr.roomStays[0].ratePlans[0].ratePlanType,delete jr.roomStays[0].ratePlans[0].ratePlanName),void 0!=jr.roomStays[0].total&&delete jr.roomStays[0].total,delete jr.uniqueId,delete jr.roomStays[0].roomRates[0].roomTypeCode,delete jr.roomStays[0].roomRates[0].roomTypeName),e.debug(JSON.stringify(Yr))}function Ja(e){if(Yr.length>0)for(var a=Yr.length-1;a>=0;a--)Yr[a].id==e&&Yr.length>1?Yr.splice(a,1):Yr[a].id==e&&1==Yr.length&&(delete Yr[a].roomStays[0].roomRates[0].roomTypeCode,delete Yr[a].roomStays[0].roomRates[0].roomTypeName,delete Yr[a].roomStays[0].total,Yr[a].roomStays[0].ratePlans=[])}function Qa(e){jr=angular.copy(Yr[e]);for(var a=0;a<Yr.length;a++)Yr[a].id==e&&Yr.splice(a,1)}function Xa(e){var a=c.findIndex(Yr,function(a){return a.id==e});jr=angular.copy(Yr[a])}function Za(){void 0!=jr.resGlobalInfo&&jr.resGlobalInfo.guestCounts.length>0&&(jr.resGlobalInfo.guestCounts=[])}function et(){for(var e=0;e<Yr.length;e++)Yr[e].id=e,1==Yr.length&&(Yr[e].selected=!0)}function at(){jr.id=angular.copy(Yr[0].id),1==Yr.length&&(jr.selected=!0)}function tt(e){void 0!=e&&(kr=angular.copy(e),_r.put("/page/mrbItineraryTotals/"+r.getHotelInfo().hotelCode,angular.copy(e)))}function ot(e){void 0!=e&&(Nr=angular.copy(e),_r.put("/page/mrbItineraryPaymentInfo/"+r.getHotelInfo().hotelCode,angular.copy(e)))}function rt(){return kr}function nt(){return Nr}function it(){for(var e=Yr.length-1;e>=0;e--){var t;(void 0==Yr[e].resGlobalInfo.timeSpan.start||void 0==Yr[e].resGlobalInfo.timeSpan.end||Yr[e].roomStays[0].ratePlans.length<=0||void 0==Yr[e].roomStays[0].ratePlans[0].ratePlanCode||0==Yr[e].roomStays[0].roomRates.length||void 0==Yr[e].roomStays[0].roomRates[0].roomTypeCode)&&(t=Yr[e].id,Yr.splice(e,1));for(var o=Kr.length-1;o>=0;o--)if(void 0!=t&&Kr[o].id==t){Kr.splice(o,1);break}}a.reservationArray=angular.copy(Fa())}function st(e){delete jr.roomStays[0].total;for(var t=0;t<Yr.length;t++)if(Yr[t].id==e){delete Yr[t].roomStays[0].total;break}a.reservationArray=Fa()}function lt(e){Ir=e}function ct(){return Ir}function dt(){return void 0!=_r.get("/page/initOptionsArrays/"+r.getHotelInfo().hotelCode)}function gt(){c.forEach(Yr,function(e){void 0!=e.resGlobalInfo&&void 0!=e.resGlobalInfo.guaranteesAccepted&&e.resGlobalInfo.guaranteesAccepted.length>0&&(void 0!=e.resGlobalInfo.guaranteesAccepted[0].paymentCard&&(e.resGlobalInfo.guaranteesAccepted[0].paymentCard={}),void 0!=e.resGlobalInfo.guaranteesAccepted[0].alternatePayment&&(e.resGlobalInfo.guaranteesAccepted[0].alternatePayment={}),void 0!=e.resGlobalInfo.guaranteesAccepted[0].paymentMethodId&&delete e.resGlobalInfo.guaranteesAccepted[0].paymentMethodId,void 0!=e.resGlobalInfo.guaranteesAccepted[0].vendorKey&&delete e.resGlobalInfo.guaranteesAccepted[0].vendorKey)})}function mt(t){if(a.MRB&&Yr.length>1){var o={};o.id=angular.copy(jr.id),void 0!=t.left?(o.time=angular.copy(1*t.left+Date.now()),a.timerInContext=!0):o.time=-1;for(var r=!1,n=0;n<Rn.length;n++)if(Rn[n].id==jr.id){r=!0;break}r?Rn[n]=angular.copy(o):Rn.push(angular.copy(o))}else{var o={};o.id=angular.copy(jr.id),void 0!=t.left?(o.time=angular.copy(1*t.left+Date.now()),a.timerInContext=!0):(a.timerInContext=!1,o.time=-1),Rn[0]=angular.copy(o)}e.debug(JSON.stringify(Rn)+"timer timer timer timer timer")}function ut(){return Rn}function pt(e){for(var a=0;a<Rn.length;a++)Rn[a].id==e.id&&-1!=Rn[a].time&&Rn[a].time<Date.now()&&(st(e.id),f("TIMER_FAILED"))}function yt(e){var a=c.findIndex(Sr,function(a){return a.roomId==e.roomId});-1!=a?Sr[a]=angular.copy(e):Sr.push(e)}function vt(){_r.put("/page/enabelRoomSelector/"+r.getHotelInfo().hotelCode,a.enabelRoomSelector)}function ht(){_r.put("/page/ingenicoAlternatePayment/"+r.getHotelInfo().hotelCode,!0)}function Rt(){_r.put("/page/ingenicoAlternatePayment/"+r.getHotelInfo().hotelCode,!1)}function ft(){return _r.get("/page/ingenicoAlternatePayment/"+r.getHotelInfo().hotelCode)}function Ct(){_r.put("/page/paymentExpressAlternatePayment/"+r.getHotelInfo().hotelCode,!0)}function Pt(){_r.put("/page/paymentExpressAlternatePayment/"+r.getHotelInfo().hotelCode,!1)}function St(){return _r.get("/page/paymentExpressAlternatePayment/"+r.getHotelInfo().hotelCode)}function At(){_r.put("/page/netsAlternatePayment/"+r.getHotelInfo().hotelCode,!0)}function It(){_r.put("/page/netsAlternatePayment/"+r.getHotelInfo().hotelCode,!1)}function bt(){return _r.get("/page/netsAlternatePayment/"+r.getHotelInfo().hotelCode)}function Dt(e){br.alternatePayment=e,_r.put("/page/xpayAlternatePayment/"+r.getHotelInfo().hotelCode,br)}function Tt(){_r.remove("/page/xpayAlternatePayment/"+r.getHotelInfo().hotelCode)}function Ot(){return _r.get("/page/xpayAlternatePayment/"+r.getHotelInfo().hotelCode)}function Et(e){Tr.alternatePayment=e,_r.put("/page/adyenDotpayPayment/"+r.getHotelInfo().hotelCode,Tr)}function Mt(){_r.remove("/page/adyenDotpayPayment/"+r.getHotelInfo().hotelCode)}function _t(){return _r.get("/page/adyenDotpayPayment/"+r.getHotelInfo().hotelCode)}function kt(e){var a=c.findIndex(Sr,function(a){return a.roomId==e});if(-1!=a)return Sr[a]}function Nt(){if(void 0!=window.localStorage)for(var e=window.localStorage.length,a=0;a<e;a++){var t=window.localStorage.key(a);if(void 0!=t&&t.indexOf(".data")>0&&t.indexOf("angular-cache.caches.")>-1&&t.indexOf("LocalStorage"+r.getHotelInfo().hotelCode)>0){t=t.replace("angular-cache.caches.","");var o=t.indexOf(".data");o>-1&&(t=t.substr(0,o),i.get(t)||(hn=i.createCache(t,{deleteOnExpire:"aggressive",maxAge:18e5,cacheFlushInterval:18e5,storageMode:"localStorage"})))}}for(var n=i.keys(),a=0;a<n.length;a++){var s;n[a].indexOf("LocalStorage")>0&&(s=i.get(n[a]),s.destroy())}}function Lt(){for(var e=i.keys(),a=0;a<e.length;a++)if(i.get(i.keys()[a])&&"defaultCache"!=i.keys()[a]&&i.keys()[a].indexOf("LocalStorage")<0){var t=i.get(i.keys()[a]).keys();if(void 0!=t&&t.length>0){var o;o=i.get(i.keys()[a]+"LocalStorage"+r.getHotelInfo().hotelCode)?i.get(i.keys()[a]+"LocalStorage"+r.getHotelInfo().hotelCode):i.createCache(i.keys()[a]+"LocalStorage"+r.getHotelInfo().hotelCode,{deleteOnExpire:"aggressive",maxAge:18e5,cacheFlushInterval:18e5,storageMode:"localStorage"});for(var n=i.get(i.keys()[a]),s=0;s<t.length;s++){var l=n.get(t[s]);o.put(t[s],l)}}}}function Gt(){if(void 0!=window.localStorage)for(var e=window.localStorage.length,a=0;a<e;a++){var t=window.localStorage.key(a);if(void 0!=t&&t.indexOf(".data")>0&&t.indexOf("angular-cache.caches.")>-1&&t.indexOf("LocalStorage"+r.getHotelInfo().hotelCode)>0){t=t.replace("angular-cache.caches.","");var o=t.indexOf(".data");o>-1&&(t=t.substr(0,o),i.get(t)||(hn=i.createCache(t,{deleteOnExpire:"aggressive",maxAge:18e5,cacheFlushInterval:18e5,storageMode:"localStorage"})))}}
for(var n=i.keys(),a=0;a<n.length;a++)if(i.get(i.keys()[a])&&"defaultCache"!=i.keys()[a]&&i.keys()[a].indexOf("LocalStorage")>0){var s=i.get(i.keys()[a]).keys();if(void 0!=s&&s.length>0){var l,o=i.keys()[a].indexOf("LocalStorage"),c=i.keys()[a].substr(0,o);l=i.get(c)?i.get(c):i.createCache(c,{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"});for(var d=i.get(i.keys()[a]),g=0;g<s.length;g++){var m=d.get(s[g]);l.put(s[g],m)}}}Nt()}function Ft(e){_r.put("/page/HTML5Selected/"+r.getHotelInfo().hotelCode,e)}function Bt(){return _r.get("/page/HTML5Selected/"+r.getHotelInfo().hotelCode)}function xt(e){_r.put("/page/latitude/"+r.getHotelInfo().hotelCode,e)}function wt(){return _r.get("/page/latitude/"+r.getHotelInfo().hotelCode)}function Ut(e){_r.put("/page/longitude/"+r.getHotelInfo().hotelCode,e)}function Ht(){return _r.get("/page/longitude/"+r.getHotelInfo().hotelCode)}function Vt(e){Jr=!!(Fr&&Fr.length>0)&&e,_r.put("/page/displayPromotions/"+r.getHotelInfo().hotelCode,Jr)}function $t(){return Jr}function qt(){if(Fr&&Fr.length>0)return Fr}function Yt(e){Br=e,_r.put("/page/displayPromotionBanner/"+r.getHotelInfo().hotelCode,Br)}function jt(){return Br}function zt(e){Fr=e,sessionStorage&&sessionStorage.setItem("allPromotionsCache/"+r.getHotelInfo().hotelCode,JSON.stringify(Fr))}function Wt(e){Lr=e,Lr?_r.put("/page/promotionInContext/"+r.getHotelInfo().hotelCode,Lr):_r.remove("/page/promotionInContext/"+r.getHotelInfo().hotelCode)}function Kt(){var e=_r.get("/page/isGmsLogin/"+r.getHotelInfo().hotelCode);if(e&&so(e),(Fr=s.allPromotions)&&Fr.length>0)if(a.$broadcast(o.DISPLAY_ALL_PROMOTIONS_EVENT),s.baseRes&&s.baseRes.promotionId){var t=c.findIndex(Fr,function(e){return e.promotionId==s.baseRes.promotionId});-1!=t&&(Wt(Fr[t]),Vt(!1),Yt(!0),a.$broadcast("ENABLE_PROMOTION_BANNER"))}else{var n=_r.get("/page/displayPromotions/"+r.getHotelInfo().hotelCode);Vt(void 0!=n?n:!(jr.posSource&&jr.posSource.requestorIds&&jr.posSource.requestorIds.length>0));var i=_r.get("/page/promotionInContext/"+r.getHotelInfo().hotelCode);void 0!=i&&Wt(i);var l=_r.get("/page/displayPromotionBanner/"+r.getHotelInfo().hotelCode);void 0!=l&&(Yt(l),1==l&&a.$broadcast("ENABLE_PROMOTION_BANNER"))}else Vt(!1)}function Jt(){return Lr}function Qt(e){Wt(e),J(),Q(),ne(),delete jr.roomStays[0].total,Xt(!0),a.$broadcast("ENABLE_PROMOTION_BANNER")}function Xt(e){jr.roomStays&&jr.roomStays.length>0&&jr.roomStays[0].ratePlans&&jr.roomStays[0].ratePlans.length>0&&jr.roomStays[0].ratePlans[0].ratePlanCode||(jr.roomStays[0].ratePlans[0]={ratePlanCode:Lr.defaultRatePlan.id,ratePlanType:Lr.defaultRatePlan.type,ratePlanName:Lr.defaultRatePlan.name},"Package"==Lr.defaultRatePlan.type&&(jr.roomStays[0].ratePlans[0].packageStartDate=Lr.defaultRatePlan.startDate,jr.roomStays[0].ratePlans[0].packageEndDate=Lr.defaultRatePlan.endDate),jr.promotionId||a.$broadcast(o.APPLY_PROMOTION_TO_RESERVATION),jr.promotionId=Lr.promotionId,a.MRB&&(Ya(jr.id,jr),a.$broadcast("EVENT.REFRESH_MANAGE_ROOM_DATA")),a.$broadcast("EVENT.UPDATE_NAVBAR_FROM_PROMOTION"),g.includes("accommodation")&&a.$broadcast("RECALL_AVAIL_API",{recallApi:e}),g.is("datesofstay")&&a.$broadcast("EVENT.RECALL_BASIC_AVAIL"),b())}function Zt(e){return jr.promotionId?e.promotionId=jr.promotionId:jr.roomStays&&jr.roomStays.length>0&&jr.roomStays[0].ratePlans&&jr.roomStays[0].ratePlans.length>0&&jr.roomStays[0].ratePlans[0].ratePlanCode||Lr&&(e.promotionId=Lr.promotionId),e}function eo(){Wt(void 0),delete jr.promotionId,J(),Q(),ne(),delete jr.roomStays[0].total,a.MRB&&(Ya(jr.id,jr),a.$broadcast("EVENT.REFRESH_MANAGE_ROOM_DATA")),a.$broadcast("DISABLE_PROMOTION_BANNER"),a.$broadcast("EVENT.UPDATE_NAVBAR_FROM_PROMOTION"),g.includes("accommodation")&&a.$broadcast("RECALL_AVAIL_API",{recallApi:!0}),g.is("datesofstay")&&a.$broadcast("EVENT.RECALL_BASIC_AVAIL"),we()&&!(we().length<=0)||xr||(Vt(!0),a.$broadcast("PROMOTIONS_DISPLAY_ON_BE")),b()}function ao(e){if(jr.promotionId&&0==e.promotionApplied&&Fr&&Fr.length>0){var t=c.findIndex(Fr,function(e){return e.promotionId==jr.promotionId});-1!=t&&a.$broadcast(o.PROMOTION_DOES_NOT_QUALIFY,{promotionName:Fr[t].promoName}),a.$broadcast("PROMOTION_DOES_NOT_QUALIFY_RESERVATION")}}function to(){return Gr}function oo(e){Gr=e}function ro(e){Fr&&Fr.length>0&&(Wt(void 0),Yt(!1),a.$broadcast("DISABLE_PROMOTION_BANNER"),Vt(!e&&!(jr.posSource&&jr.posSource.requestorIds&&jr.posSource.requestorIds.length>0||xr)),a.$broadcast("PROMOTIONS_DISPLAY_ON_BE"))}function no(){Fr&&Fr.length>0&&(Lr||jr.promotionId||Cr&&jr.merchandisedPromoData&&jr.merchandisedPromoData.promotionId)&&(Wt(void 0),delete jr.promotionId,a.$broadcast("DISABLE_PROMOTION_BANNER"),we()&&!(we().length<=0)||xr||(Vt(!0),a.$broadcast("PROMOTIONS_DISPLAY_ON_BE")))}function io(){Fr&&Fr.length>0&&(J(),Q(),ne(),delete jr.roomStays[0].total,Wt(void 0),Yt(!1),delete jr.promotionId,a.$broadcast("DISABLE_PROMOTION_BANNER"),a.MRB&&c.forEach(Yr,function(e){delete e.promotionId}))}function so(e){xr=e,_r.put("/page/isGmsLogin/"+r.getHotelInfo().hotelCode,xr),xr?s.dataLayer.push({loggedIn:"yes"}):s.dataLayer.push({loggedIn:"no"})}function lo(e){Qr=e}function co(){return Qr}function go(e){return e=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),e&&4===e.length?"#"+("0"+parseInt(e[1],10).toString(16)).slice(-2)+("0"+parseInt(e[2],10).toString(16)).slice(-2)+("0"+parseInt(e[3],10).toString(16)).slice(-2):""}function mo(e,a){var t=!1;/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e)||(e=go(e)),"#"==e[0]&&(e=e.slice(1),t=!0);var o=parseInt(e,16),r=(o>>16)+a;r>255?r=255:r<0&&(r=0),r=r.toString(16),1==r.length&&(r="0"+r);var n=(o>>8&255)+a;n>255?n=255:n<0&&(n=0),n=n.toString(16),1==n.length&&(n="0"+n);var i=(255&o)+a;return i>255?i=255:i<0&&(i=0),i=i.toString(16),1==i.length&&(i="0"+i),(t?"#":"")+r+n+i}function uo(e){wr=e}function po(){return wr}function yo(e){var t;if(a.gmsPromoCode)t=a.gmsPromoCode;else{var o=Pa();o&&o.loyalty&&o.loyalty.length>0&&o.loyalty[0].memberOfferCode&&(t=o.loyalty[0].memberOfferCode)}if(a.MRB)t&&e&&c.forEach(e,function(e){if(e&&e.posSource&&e.posSource.requestorIds&&e.posSource.requestorIds.length>0){-1==c.findIndex(e.posSource.requestorIds,function(e){return"corporate"==e.codeType.toLowerCase()||"group"==e.codeType.toLowerCase()})&&e.posSource.requestorIds.push({codeType:"corporate",id:t})}else e&&e.posSource&&e.posSource.requestorIds&&e.posSource.requestorIds.push({codeType:"corporate",id:t})});else if(t&&e)if(e&&e.posSource&&e.posSource.requestorIds&&e.posSource.requestorIds.length>0){var r=c.findIndex(e.posSource.requestorIds,function(e){return"corporate"==e.codeType.toLowerCase()||"group"==e.codeType.toLowerCase()});-1==r&&e.posSource.requestorIds.push({codeType:"corporate",id:t})}else e&&e.posSource&&e.posSource.requestorIds&&e.posSource.requestorIds.push({codeType:"corporate",id:t})}function vo(e,t){var o;if(a.gmsPromoCode)o=a.gmsPromoCode;else{var r=Pa();r&&r.loyalty&&r.loyalty.length>0&&r.loyalty[0].memberOfferCode&&(o=r.loyalty[0].memberOfferCode)}if(a.MRB)o&&e&&c.forEach(e,function(e){if(e&&e.posSource&&e.posSource.requestorIds&&e.posSource.requestorIds.length>0){var a=c.findIndex(e.posSource.requestorIds,function(e){return"corporate"==e.codeType.toLowerCase()&&e.id==o});-1!=a&&e.posSource.requestorIds.splice(a,1)}}),o&&t&&c.forEach(t,function(e){if(e&&e.posSource&&e.posSource.requestorIds&&e.posSource.requestorIds.length>0){var a=c.findIndex(e.posSource.requestorIds,function(e){return"corporate"==e.codeType.toLowerCase()&&e.id==o});-1!=a&&e.posSource.requestorIds.splice(a,1)}});else{if(o&&e&&e&&e.posSource&&e.posSource.requestorIds&&e.posSource.requestorIds.length>0){var n=c.findIndex(e.posSource.requestorIds,function(e){return"corporate"==e.codeType.toLowerCase()&&e.id==o});-1!=n&&e.posSource.requestorIds.splice(n,1)}if(o&&t&&t&&t.posSource&&t.posSource.requestorIds&&t.posSource.requestorIds.length>0){var n=c.findIndex(t.posSource.requestorIds,function(e){return"corporate"==e.codeType.toLowerCase()&&e.id==o});-1!=n&&t.posSource.requestorIds.splice(n,1)}}}function ho(e){zr=e}function Ro(){return zr}function fo(e){dr=e,_r.put("/page/specialCodesApiFail/"+r.getHotelInfo().hotelCode,e)}function Co(){return dr}function Po(){return gr}function So(e){return unescape(encodeURIComponent(e))}function Ao(){return rr}function Io(e){_r.put("/page/hideCodeWidget/"+r.getHotelInfo().hotelCode,e)}function bo(e){return _r.get("/page/hideCodeWidget/"+r.getHotelInfo().hotelCode)}function Do(e,a){var t={orderId:e,amount:a};_r.put("/page/idealLogTracking/"+r.getHotelInfo().hotelCode,t)}function To(){return _r.get("/page/idealLogTracking/"+r.getHotelInfo().hotelCode)}function Oo(e){mr=e}function Eo(){return mr}function Mo(){for(var e=0,a=Fa(),t=0;t<a.length;t++)void 0!=a[t].roomStays[0].total&&e++;return e}function _o(e){Zr=e,_r.put("/page/signInRequiredFlag/"+r.getHotelInfo().hotelCode,Zr)}function ko(){var e=_r.get("/page/signInRequiredFlag/"+r.getHotelInfo().hotelCode);return void 0!=e&&(Zr=e),Zr}function No(){if(r.getHotelDesc().enableMultiRoomTypeBookings&&!Qe()){lr=!0,r.updateMaxMultiRoomLimit(1),r.updateMaxRoomsPerBooking(1),r.updateDefaultRooms(1,1),cr=!0;for(var e=Kr.length-1;e>0;e--)Kr.splice(e,1);wo(),a.enabelRoomSelector=!1}}function Lo(){r.getHotelDesc().enableMultiRoomTypeBookings&&!Qe()&&(lr=!1,r.updateMaxMultiRoomLimit(r.getHotelDescOld().maxMultiRoomLimit),r.updateMaxRoomsPerBooking(r.getHotelDescOld().maxRoomsPerBooking),r.updateDefaultRooms(r.getHotelDescOld().occupancyInfo.defaultRooms,r.getHotelDescOld().uxConfiguration.guestAndRoomConfig.defaultRooms),cr=!1)}function Go(){if(void 0!=jr.resGlobalInfo.timeSpan.start&&(delete jr.resGlobalInfo.timeSpan.start,delete jr.resGlobalInfo.timeSpan.end),a.MRB&&void 0!=Yr[0].resGlobalInfo.timeSpan.start)for(var e=0;e<Yr.length;e++)delete Yr[e].resGlobalInfo.timeSpan.start,delete Yr[e].resGlobalInfo.timeSpan.end}function Fo(){if(jr.merchandisedPromoData={},a.MRB&&Yr[0].merchandisedPromoData)for(var e=0;e<Yr.length;e++)Yr[e].merchandisedPromoData={}}function Bo(){var e="Corporate";if(jr.allCodes&&(jr.allCodes[e]&&(delete jr.allCodes[e],angular.forEach(jr.codeType,function(a,t){a==e&&jr.codeType.splice(t,1)})),jr.allCodes[e.toLowerCase()]&&(delete jr.allCodes[e.toLowerCase()],angular.forEach(jr.codeType,function(a,t){a==e.toLowerCase()&&jr.codeType.splice(t,1)}))),jr.posSource&&jr.posSource.requestorIds){var t=jr.posSource.requestorIds;if(t.length>0)for(var o=0;o<t.length;o++)t[o].codeType==e.toLowerCase()&&(t.splice(o,1),jr.posSource.requestorIds=t)}if(1==a.MRB){for(var o=0;o<Yr.length;o++)if(Yr[o].allCodes&&(Yr[o].allCodes[e]&&(delete Yr[o].allCodes[e],angular.forEach(Yr[o].codeType,function(a,t){a==e&&Yr[o].codeType.splice(t,1)})),Yr[o].allCodes[e.toLowerCase()]&&(delete Yr[o].allCodes[e.toLowerCase()],angular.forEach(Yr[o].codeType,function(a,t){a==e.toLowerCase()&&Yr[o].codeType.splice(t,1)}))),Yr[o].posSource&&Yr[o].posSource.requestorIds){var t=Yr[o].posSource.requestorIds;if(t.length>0)for(var r=0;r<t.length;r++)t[r].codeType==e.toLowerCase()&&(t.splice(r,1),Yr[o].posSource.requestorIds=t)}a.reservationArray=Fa()}}function xo(){var e;return jr&&void 0!=jr.roomStays[0].ratePlans&&jr.roomStays[0].ratePlans.length>0&&jr.roomStays[0].ratePlans[0].merchandisedCurrency&&(e=jr.roomStays[0].ratePlans[0].merchandisedCurrency),e}function wo(){if(Yr.length>0)for(var e=Yr.length-1;e>0;e--)Yr.splice(e,1)}function Uo(){if(jr.allCodes&&(delete jr.allCodes,angular.forEach(jr.codeType,function(e,a){jr.codeType.splice(a,1)})),jr.posSource&&jr.posSource.requestorIds){var e=jr.posSource.requestorIds;if(e.length>0)for(var t=0;t<e.length;t++)e.splice(t,1),jr.posSource.requestorIds=e}if(1==a.MRB){for(var t=0;t<Yr.length;t++)if(Yr[t].allCodes&&(delete Yr[t].allCodes,angular.forEach(Yr[t].codeType,function(e,a){Yr[t].codeType.splice(a,1)})),Yr[t].posSource&&Yr[t].posSource.requestorIds){var e=Yr[t].posSource.requestorIds;if(e.length>0)for(var o=0;o<e.length;o++)e.splice(o,1),Yr[t].posSource.requestorIds=e}a.reservationArray=Fa()}}function Ho(){var e=1;return r.getHotelDesc().paymentProviders&&r.getHotelDesc().paymentProviders.length>0&&"allpayment-reddot"==r.getHotelDesc().paymentProviders[0].vendorKey&&7==r.getHotelDesc().paymentProviders[0].paymentMethod&&(e=r.getHotelDesc().paymentProviders[0].customValidationAmount?r.getHotelDesc().paymentProviders[0].customValidationAmount:e),e}function Vo(e){Dr=e}function $o(){return Dr}function qo(){var e=[];if(Lr&&Lr.defaultRatePlan&&Lr.defaultRatePlan.id){var t={title:"Rate Plan",default:Lr.defaultRatePlan.name+" "+(a.translate["global-ratePlan_ratePlanLbl"]||"")};e.push(t)}return Lr&&Lr.promotionCriteriaDetails&&Lr.promotionCriteriaDetails.length&&angular.forEach(Lr.promotionCriteriaDetails,function(t){if("Travel dates"==t.promoCriteriaMemberDisplay&&t.promoCriteriaValue){Er=[];var o=t.promoCriteriaValue.split(","),r=moment(o[0].split("/")[0]).format("MM-DD-YYYY"),n=moment(o[o.length-1].split("/")[1]).format("MM-DD-YYYY"),i={title:"Travel Dates",default:(a.translate.global_datesofstaybetween_DatesOfStayBetweenLbl||"")+" "+r+" "+(a.translate.global_and_TermAndPrivacyLbl||"")+" "+n||""};o.length>1&&(o.map(function(e,a){if(a<o.length-1){var t=moment(e.split("/")[1]),r=moment(o[a+1].split("/")[0]);for(t=t.add(1,"days");t<r;)Er.push(t.format("MM-DD-YYYY")),t=t.add(1,"days")}}),i.default=(a.translate.global_datesofstaybetween_DatesOfStayBetweenLbl||"")+" "+r+" "+(a.translate.global_and_TermAndPrivacyLbl||"")+" "+n+" "+(a.translate["page_except-Lblexcept"]||" ")+" ( "+Er.join(", ")+" ) "||""),e.push(i)}if("Length of stay"==t.promoCriteriaMemberDisplay&&t.promoCriteriaValue){var s={title:"Length of Stay",default:(a.translate.global_alengthofstayof_LengthOfStayOfLbl||"")+" "+(a.translate[t.operatorLangKey]||"")+" "+t.promoCriteriaValue+" "+(a.translate.page_nights_StandardStayNightsMsg||"")||""};e.push(s)}}),e}function Yo(){return Or}function jo(){return Or.enableUpsell}function zo(e){var a=Pe(),t=r.getUxConfiguration();return(a.roomStays&&a.roomStays.length&&a.roomStays[0]&&a.roomStays[0].ratePlans&&a.roomStays[0].ratePlans.length&&a.roomStays[0].ratePlans[0]&&a.roomStays[0].ratePlans[0].ratePlanType&&"package"===a.roomStays[0].ratePlans[0].ratePlanType.toLowerCase()||e.stepsById.accommodations.package&&e.stepsById.accommodations.package.length>0)&&t.calendarConfig.hideCalendarRatesForPackage}function Wo(e){Vr=e}function Ko(){return Vr}function Jo(e){var a=e,t=c.uniq(e,"serviceDate");return angular.forEach(t,function(e){var t=0,o=0,r=0;angular.forEach(a,function(a){e.serviceDate===a.serviceDate&&angular.forEach(e.price,function(e){angular.forEach(a.price,function(a){e.priceType==a.priceType&&("child5"==e.priceType.toLowerCase()?t+=a.amountBeforeTax:"adult"==e.priceType.toLowerCase()?o+=a.amountBeforeTax:"per_room_per_night"==e.priceType.toLowerCase()&&(r+=a.amountBeforeTax))})})}),angular.forEach(e.price,function(e){"child5"==e.priceType.toLowerCase()?e.totalamountBeforeTax=Number(t):"adult"==e.priceType.toLowerCase()?e.totalamountBeforeTax=Number(o):"per_room_per_night"==e.priceType.toLowerCase()&&(e.totalamountBeforeTax=Number(r))})}),t}function Qo(e){if(e.resGlobalInfo&&(e.resGlobalInfo.arrivalTime&&(e.resGlobalInfo.arrivalTime=l("unescapeFilter")(e.resGlobalInfo.arrivalTime)),e.resGlobalInfo.comments&&e.resGlobalInfo.comments.length>0))for(var a=0;a<e.resGlobalInfo.comments.length;a++)e.resGlobalInfo.comments[a].comment=e.resGlobalInfo.comments[a].comment?l("unescapeFilter")(e.resGlobalInfo.comments[a].comment):e.resGlobalInfo.comments[a].comment;if(e.resGuests&&e.resGuests.length>0)for(var a=0;a<e.resGuests.length;a++)if(e.resGuests[a].profile&&e.resGuests[a].profile.customer&&(e.resGuests[a].profile.customer.givenName=l("unescapeFilter")(e.resGuests[a].profile.customer.givenName),e.resGuests[a].profile.customer.surName=l("unescapeFilter")(e.resGuests[a].profile.customer.surName),e.resGuests[a].profile.customer.address&&e.resGuests[a].profile.customer.address.length>0))for(var t=0;t<e.resGuests[a].profile.customer.address.length;t++)e.resGuests[a].profile.customer.address[t].addressLine1=e.resGuests[a].profile.customer.address[t].addressLine1?l("unescapeFilter")(e.resGuests[a].profile.customer.address[t].addressLine1):e.resGuests[a].profile.customer.address[t].addressLine1,e.resGuests[a].profile.customer.address[t].addressLine2=e.resGuests[a].profile.customer.address[t].addressLine2?l("unescapeFilter")(e.resGuests[a].profile.customer.address[t].addressLine2):e.resGuests[a].profile.customer.address[t].addressLine2,e.resGuests[a].profile.customer.address[t].cityName=e.resGuests[a].profile.customer.address[t].cityName?l("unescapeFilter")(e.resGuests[a].profile.customer.address[t].cityName):e.resGuests[a].profile.customer.address[t].cityName;e.profile&&e.profile.customer&&(e.profile.customer.givenName&&(e.profile.customer.givenName=l("unescapeFilter")(e.profile.customer.givenName)),e.profile.customer.surName&&(e.profile.customer.surName=l("unescapeFilter")(e.profile.customer.surName)))}function Xo(e){var a;if(e&&e.reservationResponses)for(var t=0;t<e.reservationResponses.length;t++)a=e.reservationResponses[t],Qo(a);else Qo(e)}function Zo(e,a){var t="",r=moment.utc().format("HH:mm");a===o.BEFORE_REDIRECT&&(t=(new Date).valueOf(),sessionStorage&&sessionStorage.setItem("browserSessionId",t)),a===o.AFTER_REDIRECT&&(angular.element(document.documentElement).injector().get("MyUsageTrackingService"),sessionStorage.getItem("browserSessionId")?t=sessionStorage.getItem("browserSessionId"):(t=(new Date).valueOf(),sessionStorage.setItem("browserSessionId",t))),a===o.AFTER_REDIRECT_COMMIT&&(t=sessionStorage.getItem("browserSessionId"));var n=e+"-"+r+"-"+t+"-"+a;p.eventTrack("AltPayRedirection",{category:"UserNavigation",label:n})}function er(e){return!!(e&&e.resGuests&&e.resGuests.length&&e.resGuests[0].profile&&e.resGuests[0].profile.booker&&(e.resGuests[0].profile.booker.firstName||e.resGuests[0].profile.booker.lastName||e.resGuests[0].profile.booker.email))}function ar(e){nn=e}function tr(){return nn}function or(e){var t=a.MRB?Fa():Pe(),o=[{paramKey:"payerAuthSetupReply_referenceID",paramValue:e}];if(a.MRB)for(var r=0;r<t.length;r++)t[r].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst=o,t[r].resGlobalInfo.guaranteesAccepted[0].vendorKey="3DSecureV2-cybersource";else t.resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst=o,t.resGlobalInfo.guaranteesAccepted[0].vendorKey="3DSecureV2-cybersource"}var rr=!1;try{rr=!(!localStorage.getItem("angular-cache.caches.pageCacheLocalStorage"+r.getHotelInfo().hotelCode+".data./page/reservation/"+r.getHotelInfo().hotelCode)&&!localStorage.getItem("angular-cache.caches.pageCacheLocalStorage"+r.getHotelInfo().hotelCode+".data./page/reservationArray/"+r.getHotelInfo().hotelCode))}catch(e){rr=!1}var nr,ir,sr,lr,cr,dr,gr,mr,ur=[],pr={},yr=!1,vr=!1,hr=!1,Rr=!1,fr=!1,Cr=!1,Pr=void 0,Sr=[],Ar={},Ir={},br={},Dr=!1,Tr={},Or={},Er=[];Or={type:s.manageUrlParams.upsell,upsellId:s.manageUrlParams.serviceid,enableUpsell:!!(s.manageUrlParams.enhancestay&&s.manageUrlParams.upsell&&s.manageUrlParams.serviceid&&s.manageUrlParams.bookingsource),bookingSource:s.manageUrlParams.bookingsource};var Mr,_r,kr,Nr,Lr,Gr,Fr,Br,xr,wr,Ur,Hr,Vr,$r={ageList:[],ageBuckets:[]},qr={guestInfo:{},paymentInfo:{}},Yr=[],jr={resGlobalInfo:{timeSpan:{start:null,end:null},guestCounts:[{ageQualifyingCode:"10",count:0},{ageQualifyingCode:"8",count:0},{ageQualifyingCode:"7",count:0}],rooms:0},posSource:{bookingChannel:{code:"12",companyShortName:"Web4"},requestorIds:[],companyName:{}},resGuests:[],uniqueId:"",allCodes:{},gmsPromoCode:""},zr=!1,Wr={},Kr=[],Jr=!1,Qr=!0,Xr={dataLayerFlag:{dataLayerFlagForDiscountCode:"false",dataLayerFlagForTravelAgentCode:"false",dataLayerFlagForGroupCode:"false",dataLayerFlagForAccessCode:"false",dataLayerFlagForPackageID:"false",dataLayerFlagForConfirmID:"false"},myReservationArrayFlag:{dataLayerFlagForDiscountCode:"false",dataLayerFlagForTravelAgentCode:"false",dataLayerFlagForGroupCode:"false",dataLayerFlagForAccessCode:"false",dataLayerFlagForPackageID:[],dataLayerFlagForConfirmID:[]}},Zr=!1,en=r.getUxConfiguration().propertyCurrencies,an=r.getCurrencies(),tn=[],on=[],rn=angular.copy(an),nn={};if(rn&&en)for(var sn=0;sn<en.length;sn++)for(var ln=0;ln<rn.length;ln++)en[sn]==rn[ln].currencyCode&&(on.push(rn[ln]),rn.splice(ln,1));if(rn.forEach(function(e){tn.push(e)}),s.route&&"ALTERNATE_PAYMENT_RESPONSE"===s.route&&!s.isGaLoggedforAfterEvent){Zo(window.manageUrlParams.ccid,o.AFTER_REDIRECT),s.isGaLoggedforAfterEvent=!0}(function(){null!=N()&&void 0!=N()&&(void 0!=i.get("gmsRouteCache")?i.get("gmsRouteCache").destroy():i.get("gmsRouteCache")||(_r=i.createCache("gmsRouteCache",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"}),i.get("gmsRouteCache").destroy()),i.get("pageCache")?i.get("pageCache").destroy():i.get("pageCache")||(_r=i.createCache("pageCache",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"}),i.get("pageCache").destroy()),void 0!=i.get("gmsProfile")?i.get("gmsProfile").destroy():i.get("gmsProfile")||(_r=i.createCache("gmsProfile",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"}),i.get("gmsProfile").destroy()),void 0!=i.get("openNewWindow")?i.get("openNewWindow").destroy():i.get("openNewWindow")||(_r=i.createCache("openNewWindow",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"}),i.get("openNewWindow").destroy()));var e=Ra();"ALTERNATE_PAYMENT_RESPONSE"===s.route&&void 0!=s.alternatPayment&&"ideal"===s.alternatPayment.type&&void 0==e?Gt():function(){var e="test";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}()&&void 0!=window.localStorage&&window.localStorage.length>0&&Nt(),i.get("pageCache")||(_r=i.createCache("pageCache",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"}));var t,o=_r.get("/page/reservation/"+r.getHotelInfo().hotelCode);if(void 0!=s.multiRoomReservation){if(t=_r.get("/page/reservationArray/"+r.getHotelInfo().hotelCode),void 0!=_r.get("/page/initOptionsArrays/"+r.getHotelInfo().hotelCode)&&(Kr=_r.get("/page/initOptionsArrays/"+r.getHotelInfo().hotelCode)),void 0!=_r.get("/page/enabelRoomSelector/"+r.getHotelInfo().hotelCode)&&(a.enabelRoomSelector=_r.get("/page/enabelRoomSelector/"+r.getHotelInfo().hotelCode)),1==a.enabelRoomSelector)for(var n=0;n<t.length;n++)if(1==t[n].selected){a.currentRoomSelectorId=angular.copy(t[n].id),a.id=angular.copy(t[n].id);break}void 0!=_r.get("/page/mrbItineraryTotals/"+r.getHotelInfo().hotelCode)&&tt(_r.get("/page/mrbItineraryTotals/"+r.getHotelInfo().hotelCode)),void 0!=_r.get("/page/mrbItineraryPaymentInfo/"+r.getHotelInfo().hotelCode)&&ot(_r.get("/page/mrbItineraryPaymentInfo/"+r.getHotelInfo().hotelCode))}var l=s.location.origin+s.location.pathname+s.location.search,c=_r.get("/page/url"),o=_r.get("/page/reservation/"+r.getHotelInfo().hotelCode),d=!1;void 0!==o&&(void 0===c||c===l)||void 0!==s.route&&("ALTERNATE_PAYMENT_RESPONSE"===s.route||"GMS_SOCIAL_LOGIN_SUCCESS"===s.route||"NAVBAR_SOCIAL_LOGIN_SUCCESS"===s.route)?(void 0!=s.multiRoomReservation&&(Yr=t,a.reservationArray=t),jr=o,d=!0):void 0!==s.baseRes&&(jr=s.baseRes,d=!0,b(),_r.put("/page/url",l));var g=s.errorList;if(void 0!=g&&void 0!=g.errors&&g.errors.length>0)for(var n=0;n<g.errors.length;n++)if("INVALID_CORP_ID"==g.errors[n].errorCode){if(f("INVALID_CORP_CODE"),void 0!=s.multiRoomReservation){pr=angular.copy(s.multiRoomReservation[0].posSource.requestorIds);for(var n=0;n<s.multiRoomReservation.length;n++)if(void 0!=s.multiRoomReservation[n].posSource.requestorIds&&s.multiRoomReservation[n].posSource.requestorIds.length>0)for(var m=0;m<s.multiRoomReservation[n].posSource.requestorIds.length;m++)if("corporate"==s.multiRoomReservation[n].posSource.requestorIds[m].codeType){s.multiRoomReservation[n].posSource.requestorIds.splice(m,1);break}}else if(void 0!=(pr=angular.copy(s.baseRes.posSource.requestorIds))&&pr.length>0)for(var u=0;u<pr.length;u++)if("corporate"==pr[u].codeType){s.baseRes.posSource.requestorIds.splice(u,1);break}}else if("GROUP_CUTOFF_DATE_PASSED"==g.errors[n].errorCode)if(f("GROUP_CUTOFF_DATE_PASSED"),void 0!=s.multiRoomReservation){pr=angular.copy(s.multiRoomReservation[0].posSource.requestorIds);for(var n=0;n<s.multiRoomReservation.length;n++)if(void 0!=s.multiRoomReservation[n].posSource.requestorIds&&s.multiRoomReservation[n].posSource.requestorIds.length>0)for(var m=0;m<s.multiRoomReservation[n].posSource.requestorIds.length;m++)if("group"==s.multiRoomReservation[n].posSource.requestorIds[m].codeType){s.multiRoomReservation[n].posSource.requestorIds.splice(m,1);break}}else if(void 0!=(pr=angular.copy(s.baseRes.posSource.requestorIds))&&pr.length>0)for(var u=0;u<pr.length;u++)if("group"==pr[u].codeType){s.baseRes.posSource.requestorIds.splice(u,1);break}if(d){var p=jr.resGlobalInfo.guestCounts,h=0;angular.forEach(p,function(e,a){h+=Number(e.count)}),h>0&&(a.guestsRooms=!0),void 0!=jr.resGlobalInfo.timeSpan&&void 0!=jr.resGlobalInfo.timeSpan.start&&void 0!=jr.resGlobalInfo.timeSpan.end&&(a.datesOfStay=!0)}var R=_r.get("/page/modify/"+r.getHotelInfo().hotelCode);void 0!=R&&(isModify=R);var C=_r.get("/page/group/"+r.getHotelInfo().hotelCode),P=s.groupInfo;Pr=void 0!=C?C:P;var S=_r.get("/page/currency/"+r.getHotelInfo().hotelCode);void 0!=S&&(Ar=S),D();var A=_r.get("/page/loyaltyReqParams/"+r.getHotelInfo().hotelCode);void 0!=A?(ir=A,void 0==s.baseRes||void 0==s.baseRes.offerid||void 0==s.baseRes.guestId||ir.offerId==s.baseRes.offerid&&ir.guestId==s.baseRes.guestId?"ALTERNATE_PAYMENT_RESPONSE"==s.route&&"GMS_SOCIAL_LOGIN_SUCCESS"==s.route&&"NAVBAR_SOCIAL_LOGIN_SUCCESS"==s.route||void 0==s.baseRes||void 0!=s.baseRes.offerid&&void 0!=s.baseRes.guestId||(_r.remove("/page/loyaltyReqParams/"+r.getHotelInfo().hotelCode),ir=void 0):(ir.offerId=s.baseRes.offerid,ir.guestId=s.baseRes.guestId,_r.put("/page/loyaltyReqParams/"+r.getHotelInfo().hotelCode,ir))):void 0!=s.baseRes&&void 0!=s.baseRes.offerid&&void 0!=s.baseRes.guestId&&(ir={},ir.offerId=s.baseRes.offerid,ir.guestId=s.baseRes.guestId,_r.put("/page/loyaltyReqParams/"+r.getHotelInfo().hotelCode,ir));var I=_r.get("/page/supplementalObj/"+r.getHotelInfo().hotelCode);if(void 0!=I?(sr=I,"ALTERNATE_PAYMENT_RESPONSE"==s.route&&"GMS_SOCIAL_LOGIN_SUCCESS"==s.route&&"NAVBAR_SOCIAL_LOGIN_SUCCESS"==s.route||void 0!=s.supplemental||(_r.remove("/page/supplementalObj/"+r.getHotelInfo().hotelCode),sr=void 0)):void 0!=s.supplemental&&void 0!=s.supplemental.guestInfo&&void 0!=s.supplemental.guestInfo.loyalty&&(sr={},sr.guestInfo=s.supplemental.guestInfo,sr.guestInfo.loyalty=s.supplemental.guestInfo.loyalty,_r.put("/page/supplementalObj/"+r.getHotelInfo().hotelCode,sr)),void 0!=sr&&void 0!=sr.guestInfo&&void 0!=sr.guestInfo.loyalty&&sr.guestInfo.loyalty.length>0&&!1===sr.guestInfo.loyalty[0].multiRoomEligible){var T=a.MRB?a.MRB:r.getHotelDesc().enableMultiRoomTypeBookings&&!jr.isModifiable;T&&(lr=!0,r.updateMaxMultiRoomLimit(1)),r.updateMaxRoomsPerBooking(1),r.updateDefaultRooms(1,1),cr=!0}else T&&(lr=!1,r.updateMaxMultiRoomLimit(s.HotelDescriptiveInfo2.maxMultiRoomLimit)),r.updateMaxRoomsPerBooking(s.HotelDescriptiveInfo2.maxRoomsPerBooking),r.updateDefaultRooms(s.HotelDescriptiveInfo2.occupancyInfo.defaultRooms,s.HotelDescriptiveInfo2.uxConfiguration.guestAndRoomConfig.defaultRooms),cr=!1;a.continueModifyReservation=!1;var O=_r.get("/page/specialCodesApiFail/"+r.getHotelInfo().hotelCode);void 0!=O&&(dr=O);var E=_r.get("/page/countryCode/"+r.getHotelInfo().hotelCode);s.baseRes.countryCode?(_r.put("/page/countryCode/"+r.getHotelInfo().hotelCode,s.baseRes.countryCode),gr=s.baseRes.countryCode):E&&(gr=E),v()&&y()})(),function(){if(s.TCCommonService&&(s.isMenubarEnabled&&s.menuBarMetaData||L()||G()||r.getEnableInsurance())){var e={env:"local"===s.env?"t4":s.env,tokens:{oAuthToken:u.getToken()}};if(s.isMenubarEnabled){e.tokens.gmsToken=m.getIsLoyaltyReservationEnabled()?u.getGmsToken():"";var o=s.TCCommonService.AppConstants;s.TCCommonService.EventService.subscribe(o.events.EVT_REQUEST_LOADING,function(e,o){t(function(){a.menubarLoyaltyLoader=o.data.isLoading},0)})}s.TCCommonService.InitializerService.initialize(e)}}();var cn,dn,gn,mn,un={hotelCode:1234,languageCode:"EN_US",currencyCode:"USD",reservations:[{uniqueId:9999,resGlobalInfo:{timeSpan:{start:"2015-11-25",end:"2015-11-30"}},roomStays:{ratePlans:[{ratePlanCode:0,ratePlanType:"PACKAGE"}],roomRates:[{numberOfUnits:0,roomTypeCode:0}]},roomRates:[{roomTypeCode:"0",numberOfUnits:1,rates:[{effectiveDate:" 2015-12-15",unitMultiplier:1,base:{amountBeforeTax:"100.00"}},{effectiveDate:" 2015-12-16",unitMultiplier:2,base:{amountBeforeTax:"100.00"}},{effectiveDate:" 2015-12-17",unitMultiplier:3,base:{amountBeforeTax:"100.00"}}]}],total:{amountBeforeTax:"300.00",amountAfterTax:"450.00"}}]},pn=0,yn=0,vn={};!function(){var e,t=new MobileDetect(window.navigator.userAgent);if(t.tablet()?(s.deviceType="tablet",e="Web4_Tablet"):t.mobile()||t.phone()?(s.deviceType="phone",e="Web4_Mobile"):(s.deviceType="desktop",e="Web4_Desktop"),jr&&(jr.posSource&&jr.posSource.companyName&&!jr.posSource.companyName.companyShortName&&(jr.posSource.companyName.companyShortName=e),void 0!=jr.secondarySubChannel&&(jr.secondarySubChannel=e)),void 0!=Yr&&Yr.length>0)for(var o=0;o<Yr.length;o++)Yr[o].posSource&&Yr[o].posSource.companyName&&!Yr[o].posSource.companyName.companyShortName&&(Yr[o].posSource.companyName.companyShortName=e),void 0!=Yr[o].secondarySubChannel&&(Yr[o].secondarySubChannel=e);if(void 0!=s.baseRes&&(s.baseRes.posSource&&s.baseRes.posSource.companyName&&!s.baseRes.posSource.companyName.companyShortName&&(s.baseRes.posSource.companyName.companyShortName=e),void 0!=s.baseRes.secondarySubChannel&&(s.baseRes.secondarySubChannel=e)),void 0!=s.multiRoomReservation&&s.multiRoomReservation.length>0)for(var o=0;o<s.multiRoomReservation.length;o++)s.multiRoomReservation[o].posSource&&s.multiRoomReservation[o].posSource.companyName&&!s.multiRoomReservation[o].posSource.companyName.companyShortName&&(s.multiRoomReservation[o].posSource.companyName.companyShortName=e),void 0!=s.multiRoomReservation[o].secondarySubChannel&&(s.multiRoomReservation[o].secondarySubChannel=e);if(void 0!=a.ManagerURLRes&&a.ManagerURLRes.length>0)for(var o=0;o<a.ManagerURLRes.length;o++)a.ManagerURLRes[o].posSource&&a.ManagerURLRes[o].posSource.companyName&&!a.ManagerURLRes[o].posSource.companyName.companyShortName&&(a.ManagerURLRes[o].posSource.companyName.companyShortName=e),void 0!=a.ManagerURLRes[o].secondarySubChannel&&(a.ManagerURLRes[o].secondarySubChannel=e);if(void 0!=a.reservationArray&&a.reservationArray.length>0)for(var o=0;o<a.reservationArray.length;o++)a.reservationArray[o].posSource&&a.reservationArray[o].posSource.companyName&&!a.reservationArray[o].posSource.companyName.companyShortName&&(a.reservationArray[o].posSource.companyName.companyShortName=e),void 0!=a.reservationArray[o].secondarySubChannel&&(a.reservationArray[o].secondarySubChannel=e)}();var hn,Rn=[];return a.$on("PROMOTIONS_AVAILABLE_FROM_API",function(){Kt(),a.$broadcast("PROMOTIONS_DISPLAY_ON_BE")}),s.allPromotions&&Kt(),{setOrderIdInCacheIdealTracking:Do,getOrderIdInCacheIdealTracking:To,setCosmoHideCodeWidget:Io,getCosmoHideCodeWidget:bo,setHTML5Selected:Ft,getHTML5Selected:Bt,setLatitude:xt,getLatitude:wt,setLongitude:Ut,getLongitude:Ht,deleteIngenicoAlternatePayment:Rt,setIngenicoAlternatePayment:ht,getIngenicoAlternatePayment:ft,deletePaymentExpressAlternatePayment:Pt,setPaymentExpressAlternatePayment:Ct,getPaymentExpressAlternatePayment:St,setEnableRoomSelectorIntoCache:vt,getTimer:ut,revertTotalByTimer:pt,pushToTimer:mt,checkInitOptionsArrayCache:dt,resChange:b,getFailedRoomsId:Va,deleteTotal:st,deleteIncompleteRoom:it,setMrbItineraryTotals:tt,getMrbItineraryTotals:rt,setMrbItineraryPaymentInfo:ot,getMrbItineraryPaymentInfo:nt,
reverMainReservationArrayAfterAddGroupCode:re,deleteInitOptionsArrays:Ga,assignIdForReservation:at,assignIdForReservationArray:et,changeSelectRoomByGivenArray:Ka,clearResGlobalInfo:Za,changeMainReservation:Qa,setMainReservationByEqual:xa,emptyMainReservationArray:$a,deleteMainReservationArrayById:Ja,changeSelectRoom:Wa,setTimeSpanForMainReservationArray:za,switchRoom:ja,setMainReservationArrayById:Ya,setId:qa,setMainReservationArray:Ba,getMainReservationArray:Fa,setInitOptionsArrays:Na,getInitOptionsArrays:La,getGuestsAndRooms:ka,setGuestsAndRooms:_a,setOpenNewWindowFlag:k,getOpenNewWindowFlag:N,setModifyFlowFlag:Ea,addSpecialOffer:Oa,getGmsProfile:Pa,setGmsProfile:Ca,clearGmsProfile:Sa,setGmsRouteCache:ba,getGmsRouteCache:Da,clearGmsRouteCache:Ta,getPromoCache:Ia,setPromoCache:Aa,getUpgradeRoom:ha,setUpgradeRoom:va,setCurrencyDetails:je,getCurrencyDetails:ze,formatNavDates:Ye,setGuests:z,setTimeSpan:W,setCodes:K,removeAccommodation:ue,setAccommodations:me,getHoldData:ke,getOldHoldData:Le,setGuestTotals:Ge,addToAllCodes:Fe,setCodeType:Be,getCodeTypes:we,getCodeValue:xe,deleteCodeTypeByIndex:Ue,deleteAllCodeByKey:He,getAllCode:pe,setCurrency:fe,getCurrency:Ce,setLanguage:ye,getLanguage:ve,buildOptions:_e,getHotelCode:Re,getGroup:Y,setGroup:q,getMainReservation:Pe,setHotelCode:j,modifyMainReservation:Ee,getAgeCollection:$,revertAccommadations:J,buildUpdateOptions:Me,setReservation:We,getResStartDate:$e,getResEndDate:qe,setGuestAndPaymentInfo:Xe,setGuestAndPaymentInfoForRetrieval:ta,setAdditionalInfo:Ze,RemoveAdditionalInfoIfPresent:ea,getGuestAndPaymentInfo:aa,getFormattedReservationData:be,setServicesDataMainReservation:Ae,setReservationFromRetrieve:Ke,setVisitedConfirmReservationPage:se,getVisitedConfirmReservationPage:ie,setVisitedAccomodationPage:ce,getVisitedAccomodationPage:le,setDatesChanged:ge,getDatesChanged:de,canModifyReservation:Qe,modifyPackageInclusions:Te,formatGuestsAndRooms:V,modifyFinalConfirmation:Oe,setRoomsToResInRetrieve:oa,revertServices:ne,revertAccommadationRooms:Q,revertAllAccommodationsMrb:ee,deleteUniqueIdFromCache:ae,getReservation:Se,revertAccommadationRatePlan:te,getAddedEnhancement:ra,deleteEnhancement:na,replaceEnhancement:ia,getConfirmationCode:he,deleteGroupCode:Ve,setConfig:f,getConfig:C,deleteConfig:P,getTotalReservationAmount:Ie,setContinueChangeReservation:sa,removeDiscountCode:la,removeOtherCode:ca,removeExistingEnhancements:da,removeChildrenAndInfants:ga,setIsGroup:ma,getIsGroup:ua,setPolicyOverrideIndicator:pa,revertAccommadationRegularRatePlan:oe,setReservationFromRetrieveExtendHold:Je,deleteUniqueId:ya,resFromCache:Ra,curFromCache:fa,updateResCache:b,setMainReservation:Xa,setExtendHoldReservation:lt,getExtendHoldReservation:ct,validateMultiRoomCommitResponse:Ha,revertGuaranteesAcceptedObject:gt,setRatePlanInfoObject:yt,getRatePlanInfoObject:kt,setDataToLocalStorage:Lt,getDataFromLocalStorage:Gt,destroyLocalStorage:Nt,setMainReservationByEqualOnCurrencyChange:wa,getPromotionInContext:Jt,setPromotionInContext:Qt,setPromotionInContextVariable:Wt,applyPromotionToReservation:Xt,passPromotionIdInApi:Zt,getPromotionDetailsInContext:to,setPromotionDetailsInContext:oo,validateAvailForPromotions:ao,removePromotionFromContext:eo,removePromotionDataOnModifyReservation:ro,setDisplayPromotions:Vt,getDisplayPromotions:$t,getPromotionsList:qt,setPromotionsList:zt,getDisplayPromotionBanner:jt,setDisplayPromotionBanner:Yt,dropPromotion:no,dropPromotionForGroupCode:io,setIsGmsLogin:so,getloyaltyReqParams:B,getSupplementalObj:x,resetLoyaltyParams:w,hideMultiRoomButton:U,maxRoomRestrictCheck:H,lightenDarkenColor:mo,setGmsLoginState:lo,getGmsLoginState:co,setPromotionObjectInModifyReservation:uo,getPromotionObjectInModifyReservation:po,addGmsRateAccessCodeInReservation:yo,removeRateAccessCodeInReservation:vo,setZeroDollarExceptionFlag:ho,getZeroDollarExceptionFlag:Ro,setValidCodeApi:fo,getValidCodeApi:Co,getCountryCode:Po,convertStringIntoUTF8:So,setIhConfirmIdGTMDataLayer:O,setIhLoyaltyPtsAppliedGTMDataLayer:E,getIdealLocalStorageStatus:Ao,setPreviousLanguage:Oo,getPreviousLanguage:Eo,getIncorrectCode:F,getBookedRoomCount:Mo,setSignInRequiredFlag:_o,getSignInRequiredFlag:ko,disabledMultiRoomBehavior:No,enabledMultiRoomBehavior:Lo,clearCalenderDates:Go,removeMerchandisedPromoData:Fo,revertAllAccommadationTotalMrb:Z,deleteCorporateCode:Bo,getFixedMerchandisedCurrency:xo,deleteMainReservationArray:wo,setCancellation:Ma,deleteNetsAlternatePayment:It,setNetsAlternatePayment:At,getNetsAlternatePayment:bt,deleteXpayAlternatePayment:Tt,setXpayAlternatePayment:Dt,getXpayAlternatePayment:Ot,removeAllCode:Uo,getFormattedDataForTaxBreakdown:De,getCustomValidationAmount:Ho,setTaxBreakDownFinalConfirmation:Vo,getTaxBreakDownFinalConfirmation:$o,setAdyenDotpayPayment:Et,deleteAdyenDotpayPayment:Mt,getAdyenDotpayPayment:_t,getReasonObject:qo,getUpsellParams:Yo,isUpsellEnabled:jo,setCurrency:fe,getTopCurrencies:h,getCurrencies:R,canHideLeadRatesForPackage:zo,setRefreshPreviousAmount:Wo,getRefreshPreviousAmount:Ko,mergeDuplicateDates:Jo,setHashedEmailGTMDataLayer:T,handleXssVulnerabilities:Xo,decodingForGuestDetails:Qo,isBrainTreePaymentEnabled:L,isBookerInformation:er,isAmadeusPaymentEnabled:G,logGAEvents:Zo,isBookerInformation:er,setInsuranceSuccessAndReservationFails:ar,getInsuranceSuccessAndReservationFails:tr,setAltPaymentLstToReservationList:or,getSubChan:v}}function resetBookingEngineService(e,a,t,o,r){function n(a){t.revertAccommadationRooms(),e.MRB&&t.revertAllAccommodationsMrb(),t.revertAllAccommadationTotalMrb(),t.revertAccommadationRatePlan(),t.revertServices(),a||t.clearCalenderDates(),t.removeMerchandisedPromoData(),r.resetMyCheckRefershTokenDetails(),i(a)}function i(t){o.stepsById.accommodations.rooms=[],delete o.stepsById.accommodations.ratePlan,o.stepsById.accommodations.id="accommodations",o.stepsById.accommodations.label="Accommodations",o.stepsById.accommodations.placeholder=e.translate.global_header_lblSelect,o.stepsById.accommodations.className="Header-step--extended",o.stepsById.accommodations.rooms=[],o.stepsById.accommodations.ratePlan=[],a(e.closeDrawer,2e3);var r=o.stepsById.dates;"S"!==r.placeholder[0]&&(e.numberOfDays=Math.abs(moment(r.endDate).diff(moment(r.startDate),"days"))),e.accommodations=!1,o.stepsById.accommodations={id:"accommodations",label:"Accommodations",placeholder:"Select",placeholderMRB:o.stepsById.accommodations.placeholderMRB,className:"Header-step--extended",rooms:[]},t||(e.datesOfStay=!1),o.navToggle.datesSelected=!0,o.navToggle.accommodationSelected=!1,o.navToggle.totalSelected=!1}return{resetBookingEngineAndDropAllrooms:n}}function svgCacheService(){function e(e,t){void 0!=r[e]&&null!=o[e]||(r[e]=[]),void 0==o[e]||null==o[e]?(r[e].push(t),o[e]="",new a(e,function(e,a){if(o[e]=a,r[e].length>0){for(var t=0;t<r[e].length;t++)r[e][t](a);r[e]=[]}})):""!=o[e]?t(o[e]):r[e].push(t)}function a(e,a){var o=new t;o.onreadystatechange=function(){4==o.readyState&&"200"==o.status&&a(e,o.responseText)},o.open("GET",e),o.send()}var t,o=[],r=[];return window.XMLHttpRequest&&(t=new XMLHttpRequest,t=void 0!==t.withCredentials?XMLHttpRequest:XDomainRequest||void 0),{getSvgFile:e}}function voucherPaymentService(e,a,t){function o(){return u}function r(){return angular.copy(p)}function n(e){p=angular.copy(e),m&&m.put("/page/voucherCacheObject/"+t.getHotelDescUpdated().hotelCode,p)}function i(){p={},m&&m.remove("/page/voucherCacheObject/"+t.getHotelDescUpdated().hotelCode)}function s(){return t.getHotelDescUpdated().voucherConfigs}function l(e,o){var r=a.findIndex(t.getCurrencies(),function(e){return e.currencyCode.toLowerCase()==o.toLowerCase()}),n=t.getCurrencies()[r].exchangeRate;return parseFloat(e/n)}function c(e,a,t){var o=l(a,t);return o>e?e:o}function d(){var e;if(t.getHotelDescUpdated().voucherConfigs&&1===t.getHotelDescUpdated().voucherConfigs.length)e=t.getHotelDescUpdated().voucherConfigs[0].redemptionMode;else if(p&&p.rewardPartnerId){var o=a.findIndex(t.getHotelDescUpdated().voucherConfigs,function(e){return e.rewardPartnerId==p.rewardPartnerId});-1!=o&&(e=t.getHotelDescUpdated().voucherConfigs[o].redemptionMode)}return e}function g(){var e;return t.getHotelDescUpdated().voucherConfigs&&1===t.getHotelDescUpdated().voucherConfigs.length?e=t.getHotelDescUpdated().voucherConfigs[0].rewardPartnerId:p&&p.rewardPartnerId&&(e=p.rewardPartnerId),e}var m,u=t.getHotelDescUpdated()&&t.getHotelDescUpdated().voucherConfigs&&t.getHotelDescUpdated().voucherConfigs.length,p={};return e.get("voucherCache")||(m=e.createCache("voucherCache",{deleteOnExpire:"aggressive",maxAge:18e5,recycleFreq:6e4,storageMode:"sessionStorage"})),o()&&function(){m&&m.get("/page/voucherCacheObject/"+t.getHotelDescUpdated().hotelCode)&&!a.isEmpty(m.get("/page/voucherCacheObject/"+t.getHotelDescUpdated().hotelCode))&&(p=m.get("/page/voucherCacheObject/"+t.getHotelDescUpdated().hotelCode))}(),{getEnableVoucherPayment:o,getVoucherDetails:r,setVoucherDetails:n,resetVoucherDetails:i,getVoucherPaymentProvidersList:s,convertVoucherCashValueInBaseCurrency:l,calculateRedeemableVoucherAmount:c,getRedemptionMode:d,getRewardPartnerId:g}}function toggleArrow(e,a){return{scope:{flag:"="},link:function(e,a,t){void 0===e.flag?(a.bind("click",function(){a.hasClass("dropdown-uparrow")?a.removeClass("dropdown-uparrow"):a.addClass("dropdown-uparrow")}),a.bind("blur",function(){a.removeClass("dropdown-uparrow")})):e.$watch("flag",function(){e.flag?(a[0].innerHTML='<svg style="transform: rotate(180deg)"; focusable="false" role="none" aria-hidden="true" version="1.1" id="Layer1" stroke="#000" class="Icon" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="10px" height="10px" viewBox="0 0 10 6"> <g sketch:type="MSPage"> <g transform="translate(-95.000000, -236.000000)" sketch:type="MSArtboardGroup"> <g transform="translate(95.000000, 144.000000)" sketch:type="MSLayerGroup"> <g transform="translate(0.000000, 64.000000)" sketch:type="MSShapeGroup"> <g transform="translate(0.000000, 22.000000)"> <g transform="translate(1.000000, 7.000000)"> <path class="Icon-property--stroke" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d=" M4,3.828l4-3.535"/> <path class="Icon-property--stroke" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d=" M4,3.828L0,0.293"/> </g> </g> </g> </g> </g> </g> </svg>',event&&event.stopPropagation()):(a[0].innerHTML='<svg focusable="false" role="none" aria-hidden="true" version="1.1" id="Layer1" stroke="#000" class="Icon" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="10px" height="10px" viewBox="0 0 10 6"> <g sketch:type="MSPage"> <g transform="translate(-95.000000, -236.000000)" sketch:type="MSArtboardGroup"> <g transform="translate(95.000000, 144.000000)" sketch:type="MSLayerGroup"> <g transform="translate(0.000000, 64.000000)" sketch:type="MSShapeGroup"> <g transform="translate(0.000000, 22.000000)"> <g transform="translate(1.000000, 7.000000)"> <path class="Icon-property--stroke" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d=" M4,3.828l4-3.535"/> <path class="Icon-property--stroke" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d=" M4,3.828L0,0.293"/> </g> </g> </g> </g> </g> </g> </svg>',event&&event.stopPropagation())})}}}function TotalController(e,a,t,o,r,n,i,s,l,c,d,g,m,u,p,y,v,h,R,f,C,P,S,A,I,b,D,T,O,E,M,k,N){function L(){var e=l.getDefaultCurrency().currencyCode;o.currencyDetail=i.getCurrencyDetails();var a=i.canModifyReservation(),r=i.getFixedMerchandisedCurrency();o.currencyMsg="",a?o.currencyMsg="":o.currencyDetail.isMerchandisedCurrency&&!r?o.currencyMsg=c("replaceHashMRB")(t.translate.global_alertmerchandise_PricesAreShownMsg,o.currencyDetail.currencyCode,e):o.currencyDetail.isDefaultCurrency||r?o.currencyMsg="":o.currencyMsg=c("replaceHashMRB")(t.translate.page_alertnonmerchandise_PricesInShownMsg,o.currencyDetail.currencyCode,e)}function G(){if(t.MRB&&1==i.getMainReservationArray().length||!t.MRB){var e=i.getMainReservation();e.merchandisedPromoData&&e.merchandisedPromoData.promotionId?(t.promotionBannerObject=e.merchandisedPromoData,(e.merchandisedPromoData.labelText||e.merchandisedPromoData.valueAddedText)&&(t.enablePromotionBannerTotal=!0)):(t.enablePromotionBannerTotal=!1,t.promotionBannerObject=void 0)}else t.enablePromotionBannerTotal=!1,t.promotionBannerObject=void 0}function F(e){var a=i.getCurrencyDetails(),t=c("defaultCurrencySymbol")(e),r=c("currencyConversionWithTwoDecimalPlaces")(e,o.fixedMerchandiseCurrency);return a.isDefaultCurrency?t:t+" ("+r+")"}function B(){e(t.closeDrawer,2e3);var o=p.stepsById.guestsrooms,r=0,n=p.stepsById.accommodations.rooms;angular.forEach(n,function(e){void 0==e.packageCode&&r++}),"S"!==o.placeholder[0]?(t.numberOfGuests=Number(o.placeholder[0]),t.numberOfRooms=Number(o.placeholder.split("/")[1].trim()),r?t.numberOfRooms:t.numberOfRooms):a.debug("You need to set the number of guests for your stay!");var i=p.stepsById.dates;"S"!==i.placeholder[0]?t.numberOfDays=Math.abs(moment.utc(i.endDate).diff(moment.utc(i.startDate),"days")):a.debug("You need to select the dates of stay for your trip!")}function x(e,a){var t=[],r="PricingConsent-"+l.getHotelInfo().hotelCode,n=""!==s.getCookie(r),i=s.getCookie(r,"|"),c=s.getCookie("PricingConsentWording-"+l.getHotelInfo().hotelCode),d=n?r+":"+i.cookieFirstString+",time:"+i.cookieSecondString:"";angular.forEach(o.consentsSelectedArray,function(e){t.push({id:e.id,consentInd:e.isSelected?1:0,consentText:e.text})}),o.emailMarketingConsent&&t.push({id:o.emailMarketingConsent.id,consentInd:o.shareAllMarketInd||o.hideEmailMarketingConsent?1:0,consentText:o.emailMarketingConsent.text}),n&&t.push({id:o.pricingConsent.id,consentInd:"true"===i.cookieFirstString?1:0,consentText:c});var g=angular.copy(e);return a?angular.forEach(g,function(e,a){e.resGuests[0].profile.consents=angular.copy(t),e.resGuests[0].profile.shareAllMarketInd=o.shareAllMarketInd||o.hideEmailMarketingConsent?0:1,e.posSource.cookieId=n?d:"",0!==a&&(angular.forEach(e.resGuests[0].profile.consents,function(e,a){e.id!==o.pricingConsent.id&&(e.consentInd=0,e.consentText="Multi room secondary booking")}),e.resGuests[0].profile.shareAllMarketInd=1)}):(g.resGuests[0].profile.consents=t,g.resGuests[0].profile.shareAllMarketInd=o.shareAllMarketInd||o.hideEmailMarketingConsent?0:1,g.posSource.cookieId=n?d:""),g}function w(e){if(void 0!=e){var a=new RSAKey;a.setPublic(window.modulus,"10001");var t=a.encrypt(e);return window.btoa(t)}}function U(e,a){var t=S.getIsLoyaltyReservationEnabled()&&S.getBurnPoints()&&S.getLoyaltyPointsObject()&&S.getLoyaltyConfig(),r=A.getEnableVoucherPayment()&&A.getVoucherDetails()&&A.getVoucherDetails().voucherCode&&A.getVoucherDetails().redeemedCashValue;if(t||r){var n=[],s={};if(t&&(n=[{redemptionQuantity:o.fixedMerchandiseCurrency?parseFloat(parseFloat(i.getCurrencyDetails().exchangeRate*S.getBurnPointsCurrencyValueFromBurnPoints(ne("loyalty-payment"))).toFixed(2)):S.getBurnPointsCurrencyValueFromBurnPoints(ne("loyalty-payment")),pointsValue:S.getBurnPoints(),memberNumber:S.getLoyaltyPointsObject().loyaltyInfo.memberNumber,programName:S.getLoyaltyConfig().programName,rewardTypeId:l.getRewardTypeId(),tierName:S.getLoyaltyPointsObject().loyaltyInfo.tierName}]),r&&(s={redemptionMode:A.getRedemptionMode(),redemptionQuantity:A.getVoucherDetails().redeemedCashValue,identifier:A.getVoucherDetails().voucherCode,rewardPartnerId:A.getRewardPartnerId()}),a){e[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0,e[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption=n,e[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption=s,o.changeInPaymentVariables&&(e[0].resGlobalInfo.guaranteesAccepted[0].paymentCard={},delete e[0].resGlobalInfo.guaranteesAccepted[0].paymentMethodId,delete e[0].resGlobalInfo.guaranteesAccepted[0].vendorKey);for(var c=0;c<e.length;c++)0!=c&&e[c].resGlobalInfo&&e[c].resGlobalInfo.guaranteesAccepted&&e[c].resGlobalInfo.guaranteesAccepted.length>0&&(e[c].resGlobalInfo.guaranteesAccepted.voucherRedemption={},e[c].resGlobalInfo.guaranteesAccepted.loyaltyRedemption=[],e[c].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!1)}else e.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption=n,e.resGlobalInfo.guaranteesAccepted[0].voucherRedemption=s,o.changeInPaymentVariables&&(e.resGlobalInfo.guaranteesAccepted[0].paymentCard={},delete e.resGlobalInfo.guaranteesAccepted[0].paymentMethodId,delete e.resGlobalInfo.guaranteesAccepted[0].vendorKey);return e}return S.getIsLoyaltyReservationEnabled()&&!S.getBurnPoints()||A.getEnableVoucherPayment()&&!r?(a?v.forEach(e,function(e){e&&e.resGlobalInfo&&e.resGlobalInfo.guaranteesAccepted&&e.resGlobalInfo.guaranteesAccepted.length>0&&(e.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption=[],e.resGlobalInfo.guaranteesAccepted[0].voucherRedemption={},e.resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!1)}):e&&e.resGlobalInfo&&e.resGlobalInfo.guaranteesAccepted&&e.resGlobalInfo.guaranteesAccepted.length>0&&(e.resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption=[],e.resGlobalInfo.guaranteesAccepted[0].voucherRedemption={},e.resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!1),e):e}function H(e){var a=window.navigator.userAgent,r=(new Date).toUTCString(),n=l.getHotelInfo().hotelCode,s=e,c=o.depositAmount,d="";if(t.MRB){var g=i.getMainReservationArray();v.forEach(g,function(e){d=d+e.itineraryId+"-"+e.uniqueId+" || "})}else d=i.getMainReservation().uniqueId;var m="LOG :: Browser Info - "+a+" | Time Info - "+r+" | Hotel Id - "+n+" | Order Status - "+s+" | Order Id - "+d+" | Amount - "+c;f.eventTrack("3DSecureApplicationLogs",{category:"Be4ApplicationsLogs",label:m})}function V(){var e=window.navigator.userAgent,a=(new Date).toUTCString(),r=l.getHotelInfo().hotelCode,n=o.depositAmount,s="";if(t.MRB){var c=i.getMainReservationArray();v.forEach(c,function(e){s=s+e.itineraryId+"-"+e.uniqueId+" || "})}else s=i.getMainReservation().uniqueId;var d;try{d=!(!localStorage.getItem("angular-cache.caches.pageCacheLocalStorage"+r+".data./page/reservation/"+r)&&!localStorage.getItem("angular-cache.caches.pageCacheLocalStorage"+r+".data./page/reservationArray/"+r))}catch(e){d=!1}var g="LOG :: Browser Info - "+e+" | Time Info - "+a+" | Hotel Id - "+r+" | Order Status - paymentInit | Order Id - "+s+" | Amount - "+n+" | Local Storage Status - "+d;f.eventTrack("idealApplicationLogs",{category:"Be4ApplicationsLogs",label:g})}function $(){if(o.isModifyReservation){var e=i.getMainReservation();return a.debug(e.resGuests[0].profile.customer.givenName),""!=e.resGuests[0].profile.customer.givenName&&void 0!=e.resGuests[0].profile.customer.givenName}var e=t.MRB?i.getMainReservationArray()[0]:i.getMainReservation();return!!e.resGuests[0].profile.customer.givenName}function q(){$()&&(p.navToggle.datesSelected=!0,p.navToggle.accommodationSelected=!0,p.navToggle.totalSelected=!0,setTimeout(function(){o.$apply(function(){t.$broadcast(y.MODIFY_RESERVATION)})},1e3))}function Y(){for(var e=0;e<o.totalData.roomsData.length;e++)o.totalData.roomsData[e].nightsCollapse=!o.enableExpandedDailyRates;for(var e=0;e<o.totalData.enhancements.length;e++)o.totalData.enhancements[e].nightsCollapse=!0;for(var e=0;e<o.totalData.packageInclusions.length;e++)o.totalData.packageInclusions[e].nightsCollapse=!0}function j(){s.deleteObjectData("TOTAL_RES_DATA"),t.MRB&&o.mainReservationArray.length>1?s.setObjectData("TOTAL_RES_DATA",o.mainReservationArray):s.setObjectData("TOTAL_RES_DATA",o.totalData)}function z(){if(o.isUpdatedResDataRequired=!0,t.MRB&&o.mainReservationArray.length>1){var e=s.getObjectData("TOTAL_RES_DATA");v.forEach(o.mainReservationArray,function(a){var t=v.findIndex(e,function(e){return e.id==a.id});-1!=t&&(a.totalRoomData&&e[t].totalRoomData&&(a.totalRoomData.arrivalTimeInfo=e[t].totalRoomData.arrivalTimeInfo,a.totalRoomData.specialRequest=e[t].totalRoomData.specialRequest,a.totalRoomData.additionalComment=e[t].totalRoomData.additionalComment,Y()),a.resGuests=angular.copy(e[t].resGuests))})}else{o.getFormattedDatePrices();var e=s.getObjectData("TOTAL_RES_DATA");o.totalData.arrivalTimeInfo=e.arrivalTimeInfo,o.totalData.specialRequest=e.specialRequest,o.totalData.additionalComment=e.additionalComment,Y()}p.stepsById.total.placeholder=i.getTotalReservationAmount(),s.deleteObjectData("TOTAL_RES_DATA"),t.MRB&&(o.itineraryPaymentInfo=angular.copy(i.getMrbItineraryPaymentInfo()),o.itineraryDepositAmt=void 0!=o.itineraryPaymentInfo&&o.itineraryPaymentInfo.itineraryDepositAmt?o.itineraryPaymentInfo.itineraryDepositAmt:void 0,o.depositAmount=angular.copy(o.itineraryDepositAmt),o.depositAmountCopy=angular.copy(o.depositAmount),o.depositAmt=F(o.depositAmountCopy))}function W(){o.formattedPackageTotalFinalPrice=c("currencyConversionWithTwoDecimalPlaces")(o.packageTotalFinalPrice,o.fixedMerchandiseCurrency),angular.forEach(o.enhancementServices,function(e){angular.forEach(e.eachDayRate,function(e){e.formattedServiceDate=c("formatServicesDate")(e.serviceDate)}),angular.forEach(e.serviceOptions,function(e){angular.forEach(e.dailyRates,function(e){e.formattedAdultUnitPrice=c("currencyConversionWithTwoDecimalPlaces")(e.adultUnitPrice,o.fixedMerchandiseCurrency),e.formattedChildUnitPrice=c("currencyConversionWithTwoDecimalPlaces")(e.childUnitPrice,o.fixedMerchandiseCurrency)})})})}function K(e,o){if(1==e.allSelected){a.debug(JSON.stringify(o)+"currentServices"),a.debug(JSON.stringify(e)+"currentService");var r,n,s,l,c,d={};if(e.adult>0&&(r=angular.copy(e.adult),d.adults=r),e.children>0&&(n=angular.copy(e.children),d.children=n),e.room>0&&(l=angular.copy(e.room),d.room=l),void 0==e.serviceDate||"PER_ROOM"==o.servicePricingType&&"PER_PERSON"==o.servicePricingType||(c="PER_RESERVATION"==o.servicePricingType?angular.copy(e.date):angular.copy(e.serviceDate),"PER_PERSON"!=o.servicePricingType&&"PER_ROOM"!=o.servicePricingType&&(d.date=c)),void 0!=e.selectOption&&(s=angular.copy(e.selectOption.serviceOptionId),d.selectOption=s),void 0!=i.getMainReservationArray()){for(var g,m=0;m<i.getMainReservationArray().length;m++)if(i.getMainReservationArray()[m].id==i.getMainReservation().id){g=m,g++;break}t.gmsId=g}f.eventTrack("serviceOptions",{category:"UserNavigation",label:d}),t.gmsId=void 0}}function J(){if(o.langObj={language:i.getLanguage()},t.MRB){if(!o.isModifyReservation){j();var e=i.getMainReservation(),n=e.id,c=i.getMainReservationArray();void 0!=we&&void 0!=we.guestInfo&&void 0!=we.guestInfo.loyalty&&we.guestInfo.loyalty.length>0&&!0===we.guestInfo.loyalty[0].requireRestrictionCheck&&o.addLoyaltyReqParams(e),d.callHoldReservation(ea,e,c,t.MRB,t.MRB).success(function(e){if(b.setMyCheckRefershTokenDetails(e),i.setMrbItineraryTotals(e.itineraryTotals),i.setMrbItineraryPaymentInfo(e.itineraryPaymentInfo),1==i.setMainReservationByEqual(e.reservationResponses)){c.length>1?(o.initMultiroomData(),i.setMainReservation(n),z()):(o.mainReservationArray=angular.copy(i.getMainReservationArray()),i.setMainReservation(o.mainReservationArray[0].id),z());var a=v.findIndex(e.reservationResponses,function(e){return e.id==n}),g=angular.copy(e.reservationResponses[a]);o.textualPolicies=g.policies.textualPolicies,p.stepsById.accommodations.placeholder=g.roomStays[0].roomRates[0].roomTypeName;var m=g.roomStays[0].roomRates,u=g.roomStays[0].ratePlans;if(p.stepsById.accommodations.rooms=[],p.stepsById.accommodations.ratePlan=[],angular.forEach(m,function(e){p.stepsById.accommodations.rooms.push(e),p.stepsById.accommodations.placeholder=e.roomTypeName}),"Package"!=u[0].ratePlanType&&"group"!=u[0].ratePlanType.toLowerCase()?(p.stepsById.accommodations.ratePlan=u,void 0!=g.merchandisedPromoData&&(p.stepsById.accommodations.merchandisedPromotionData=g.merchandisedPromoData)):(p.stepsById.accommodations.package=[],"Package"==u[0].ratePlanType&&(p.stepsById.accommodations.package=u,p.stepsById.accommodations.placeholder=u[0].ratePlanName)),"group"==u[0].ratePlanType.toLowerCase()){p.stepsById.accommodations.group=[];var y={};y.codeType=u[0].ratePlanType;var h,R=g.posSource.requestorIds;angular.forEach(R,function(e){"group"==e.codeType.toLowerCase()&&(h=e.id)}),y.id=h;var f=l.getHotelInfo().hotelCode,C=i.getLanguage();d.getGSplashDetails(f,u[0].ratePlanType,h,C).then(function(e){void 0!=e.data.groupRules&&(t.hidePriceFromAttendees=e.data.groupRules.hidePriceFromAttendees),i.setGroup(e.data),s.setUserTiming("Interaction","CodeWIdget"),void 0!=i.getGroup().groupName&&(y.name=i.getGroup().groupName),p.stepsById.accommodations.group.push(y),p.stepsById.accommodations.placeholder=y.name})}te(),G()}else o.failedRoomsId=i.getFailedRoomsId(),o.failedRoomsId.length>1?(o.combinedHoldFailure=!0,P.onModalOpen("book-button-id","combined-hold-failure-totals","combined-hold-failure-title-0",!1)):(s.setObjectData("combinedHoldError",!0),r.go("accommodation"))}).error(function(e){g.clear(),g.pop({type:"error",title:"",body:"Hold reservation error in total"})})}}else{var e=i.getMainReservation(),m=Qe.roomStays[0].depositPayments.depositAmt;if(o.depositAmt=F(m),i.getConfig("modifyEnhancementInContext")||o.getEnhancementServices(),o.isModifyReservation){if(o.isModifyReservation&&i.getConfig("modifyEnhancementInContext")){i.removeExistingEnhancements(),i.modifyMainReservation(o.enhancementServices),o.totalData&&o.totalData.specialRequest.length>0&&i.setServicesDataMainReservation(o.totalData);var e=i.getMainReservation()}d.modifyHoldReservation(ea,e,!0).success(function(e){i.handleXssVulnerabilities(e),i.getConfig("modifyEnhancementInContext")&&i.deleteConfig("modifyEnhancementInContext"),b.setMyCheckRefershTokenDetails(e),g.clear(),i.setReservation(e),o.totalData=i.getFormattedReservationData(He),o.totalData.roomsData.roomTypeName=e.roomStays[0].roomRates[0].roomTypeName,p.stepsById.accommodations.placeholder=e.roomStays[0].roomRates[0].roomTypeName;var r=e,n=r.roomStays[0].roomRates,c=r.roomStays[0].ratePlans;if(p.stepsById.accommodations.rooms=[],p.stepsById.accommodations.ratePlan=[],a.debug(r),o.mainReservation=i.getMainReservation(),o.textualPolicies=o.mainReservation.policies.textualPolicies,angular.forEach(n,function(e){p.stepsById.accommodations.rooms.push(e),p.stepsById.accommodations.placeholder=e.roomTypeName}),"Package"!=c[0].ratePlanType&&"group"!=c[0].ratePlanType.toLowerCase()?(p.stepsById.accommodations.ratePlan=c,void 0!=r.merchandisedPromoData&&(p.stepsById.accommodations.merchandisedPromotionData=r.merchandisedPromoData)):(p.stepsById.accommodations.package=[],"Package"==c[0].ratePlanType&&(p.stepsById.accommodations.package=c,p.stepsById.accommodations.placeholder=c[0].ratePlanName,o.selectedRatePlanName=c[0].ratePlanName)),"group"==c[0].ratePlanType.toLowerCase()){p.stepsById.accommodations.group=[];var m={};m.codeType=c[0].ratePlanType;var u,y=i.getMainReservation(),v=y.posSource.requestorIds;angular.forEach(v,function(e){"group"==e.codeType.toLowerCase()&&(u=e.id)}),m.id=u;var h=l.getHotelInfo().hotelCode;d.getGSplashDetails(h,c[0].ratePlanType,u,ra).then(function(e){void 0!=e.data.groupRules&&(t.hidePriceFromAttendees=e.data.groupRules.hidePriceFromAttendees),i.setGroup(e.data),s.setUserTiming("Interaction","CodeWIdget"),void 0!=i.getGroup().groupName&&(m.name=i.getGroup().groupName),p.stepsById.accommodations.group.push(m),p.stepsById.accommodations.placeholder=m.name,o.selectedRatePlanName=m.name})}o.getFormattedDatePrices(),o.addSpecialRequestToReservation(),G()}).error(function(){g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}),a.debug(JSON.stringify(e)),h.clearAll()})}else void 0!=we&&void 0!=we.guestInfo&&void 0!=we.guestInfo.loyalty&&we.guestInfo.loyalty.length>0&&!0===we.guestInfo.loyalty[0].requireRestrictionCheck&&o.addLoyaltyReqParams(e),d.callHoldReservation(ea,e).success(function(e){b.setMyCheckRefershTokenDetails(e),g.clear(),i.setReservation(e),o.totalData=i.getFormattedReservationData(He),o.taxBreakoutEnabled=o.totalData.taxBreakoutEnabled,o.totalData.roomsData.roomTypeName=e.roomStays[0].roomRates[0].roomTypeName,p.stepsById.accommodations.placeholder=e.roomStays[0].roomRates[0].roomTypeName;var r=e,n=r.roomStays[0].roomRates,c=r.roomStays[0].ratePlans;if(p.stepsById.accommodations.rooms=[],p.stepsById.accommodations.ratePlan=[],a.debug(r),o.mainReservation=i.getMainReservation(),o.textualPolicies=o.mainReservation.policies.textualPolicies,angular.forEach(n,function(e){p.stepsById.accommodations.rooms.push(e),p.stepsById.accommodations.placeholder=e.roomTypeName}),"Package"!=c[0].ratePlanType&&"group"!=c[0].ratePlanType.toLowerCase()?(p.stepsById.accommodations.ratePlan=c,void 0!=r.merchandisedPromoData&&(p.stepsById.accommodations.merchandisedPromotionData=r.merchandisedPromoData)):(p.stepsById.accommodations.package=[],"Package"==c[0].ratePlanType&&(p.stepsById.accommodations.package=c,p.stepsById.accommodations.placeholder=c[0].ratePlanName)),"group"==c[0].ratePlanType.toLowerCase()){p.stepsById.accommodations.group=[];var m={};m.codeType=c[0].ratePlanType;var u,y=i.getMainReservation(),v=y.posSource.requestorIds;angular.forEach(v,function(e){"group"==e.codeType.toLowerCase()&&(u=e.id)}),m.id=u;var h=l.getHotelInfo().hotelCode;d.getGSplashDetails(h,c[0].ratePlanType,u,ra).then(function(e){void 0!=e.data.groupRules&&(t.hidePriceFromAttendees=e.data.groupRules.hidePriceFromAttendees),i.setGroup(e.data),s.setUserTiming("Interaction","CodeWIdget"),void 0!=i.getGroup().groupName&&(m.name=i.getGroup().groupName),p.stepsById.accommodations.group.push(m),p.stepsById.accommodations.placeholder=m.name})}o.getFormattedDatePrices(),o.addSpecialRequestToReservation(),wa(),te(),G()}).error(function(){g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}),a.debug(JSON.stringify(e)),h.clearAll()})}L()}function Q(){var e=i.getMainReservation();angular.forEach(e.posSource.requestorIds,function(e){if(("Group"==e.codeType||"group"==e.codeType)&&i.getGroup()&&void 0!=i.getGroup().groupRules.paymentMethod){"Company"==i.getGroup().groupRules.paymentMethod&&(o.groupPaymentMethod=!0)}}),(o.ingenico||o.reddot||o.paymentexpress||o.nets||o.xpaycredit||o.enabledMyCheckCreditCard||o.isBrainTreePaymentEnabled||o.isAmadeusPaymentEnabled)&&1==o.groupPaymentMethod&&(o.bookNowDisplay=!0)}function X(){var e=(ne(),0),a=0,t=-1;return o.isVoucherPaymentEnabled&&A.getVoucherDetails()&&A.getVoucherDetails().redeemedCashValue&&(e=A.getVoucherDetails().redeemedCashValue),o.isLoyaltyReservationEnabled&&S.getBurnPoints()&&(a=S.getBurnPointsCurrencyValueFromBurnPoints(ne("loyalty-payment"))),(e||a)&&(t=e+a),t}function Z(){var e=ne();o.isVoucherPaymentEnabled&&A.getVoucherDetails()&&A.getVoucherDetails().redeemedCashValue?o.formattedVoucherCashValue=c("currencyConversionWithTwoDecimalPlaces")(A.getVoucherDetails().redeemedCashValue):o.formattedVoucherCashValue=null,o.isLoyaltyReservationEnabled&&S.getBurnPoints()?o.burnPointsCurrencyValue=c("currencyConversionWithTwoDecimalPlaces")(S.getBurnPointsCurrencyValueFromBurnPoints(ne("loyalty-payment"))):o.burnPointsCurrencyValue=null;var a=X();o.remainingTotalAfterSecondaryPayments=-1!==a?c("currencyConversionWithTwoDecimalPlaces")(parseFloat(e)-parseFloat(X())):null}function ee(e){Z(),le(),"voucher-payment"===e&&(o.isLoyaltyReservationEnabled&&!S.getBurnPoints()?oe():o.isLoyaltyReservationEnabled&&S.getIsLoyaltyUserLogIn()&&de()),"loyalty-payment"===e&&o.isVoucherPaymentEnabled&&(!A.getVoucherDetails()||A.getVoucherDetails()&&!A.getVoucherDetails().voucherCode)&&ve()}function ae(){var e=!1;o.isVoucherPaymentEnabled&&(e=!0,A.resetVoucherDetails(),ve()),o.isLoyaltyReservationEnabled&&(e=!0,o.removeLoyaltyPoints(),oe()),e&&(Z(),le())}function te(){var e=!1;S.getIsLoyaltyReservationEnabled()&&S.getIsLoyaltyUserLogIn()&&(e=!0,re()),A.getEnableVoucherPayment()&&A.getVoucherDetails()&&A.getVoucherDetails().voucherCode&&(e=!0,fe()),e&&Z()}function oe(){
o.showLoyaltyErrorMessage=!1,o.isLoyaltyUserLogIn=S.getIsLoyaltyUserLogIn(),o.loyaltyParticipationConfig=S.getPropertyLoyaltyParticipationConfig(),o.propertyEnableForEarning=S.getEnableEarnPoints(),o.propertyEnableForBurning=S.getEnableRedeemPoints(),o.isLoyaltyRedemptionAllowed=ie(o.isLoyaltyUserLogIn),o.isLoyaltyUserLogIn&&(o.availableLoyaltyPoints=S.getAvailablePoints(),o.minRedemptionPoints=S.getMinPointsForRedemption(),ce(),o.loyaltyBurnPoints=S.getBurnPoints(),o.displayMaximumPointsPaymentView=!o.loyaltyBurnPoints&&!S.getIsMaximumPointsApplied()||S.getIsMaximumPointsApplied(),de(),e(function(){o.loyaltyBurnPoints&&o.inputPointsValidationAndCashEquivalent(o.loyaltyBurnPoints)})),setTimeout(function(){var e=document.getElementsByClassName("js-input-phone");if(e[0]){var a=getComputedStyle(e[0]).backgroundColor;if(a){var t=document.createElement("style");t.type="text/css",t.innerHTML=".loyaltyPointsInputBox { background-color: "+a+" !important}",document.getElementsByTagName("head")[0]&&document.getElementsByTagName("head")[0].appendChild(t)}}})}function re(){e(function(){de()},0)}function ne(e){var a;if(!t.MRB||t.MRB&&1==i.getMainReservationArray().length){a=i.getMainReservation().roomStays[0].total.amountAfterTax}else a=i.getMrbItineraryTotals().itineraryRoomGrandTotal;return o.fixedMerchandiseCurrency&&(a/=i.getCurrencyDetails().exchangeRate),"loyalty-payment"===e?o.isVoucherPaymentEnabled&&A.getVoucherDetails()&&A.getVoucherDetails().redeemedCashValue&&(a-=A.getVoucherDetails().redeemedCashValue):"voucher-payment"===e&&o.isLoyaltyReservationEnabled&&S.getBurnPoints()&&(a-=S.getBurnPointsCurrencyValueFromBurnPoints(a)),a}function ie(e){var a=!0;if(l.getHotelDesc().paymentProviders||(a=!1),parseFloat(ne("loyalty-payment"))||(a=!1),parseFloat(ne())||(a=!1),e){var t=ne("loyalty-payment");o.reservationRequirementsNotMetMsg=!1,o.youHaveNotEnoughPointsMsg=!1;var r=S.getMinPointsForRedemption(),n=S.getAvailablePoints();S.convertCashToPoints(t)<r?(o.reservationRequirementsNotMetMsg=!0,a=!1):n<r&&(o.youHaveNotEnoughPointsMsg=!0,a=!1)}return a}function se(){o.changeInPaymentVariables&&(o.enablePayPal=angular.copy(Ha),o.enableIDeal=angular.copy(Va),o.enableCreditCard=angular.copy($a),o.enable3DSecure=angular.copy(qa),o.paypal=angular.copy(Ya),o.credit=angular.copy(ja),o.ideal=angular.copy(za),o.secure3D=angular.copy(Wa),o.ingenico=angular.copy(Ka),o.nets=angular.copy(Ja),o.paymentexpress=angular.copy(Qa),o.reddot=angular.copy(Xa),o.creditCardFieldRequiredIndicator=angular.copy(Za),o.showCreditCardFields=angular.copy(et),o.bookNowDisplay=angular.copy(at),o.alternatePaymentIngenico=angular.copy(tt),o.payment.method=angular.copy(ot),o.changeInPaymentVariables=!1,o.enableXpayCreditCard=angular.copy(rt),o.enableXpayPayPal=angular.copy(nt),o.enableXpayWeChat=angular.copy(it),o.enableXpayAliPay=angular.copy(st),o.xpaywechat=angular.copy(lt),o.xpayalipay=angular.copy(ct),o.xpaypaypal=angular.copy(dt),o.xpaycredit=angular.copy(gt),o.enableAdyenDotPay=angular.copy(mt),o.adyenDotPay=angular.copy(ut),o.enableAdyenMbank=angular.copy(pt),o.enableAdyenIpko=angular.copy(yt),o.enableAdyenPrzelew24=angular.copy(vt),o.enableAdyenING=angular.copy(ht),o.enableAdyenMillennium=angular.copy(Rt),o.enableAdyenAliorBank=angular.copy(ft),o.enableAdyenCitiHandlowy=angular.copy(Ct),o.enableAdyenEurobank=angular.copy(Pt),o.enableAdyenRPrzelew=angular.copy(St),o.enableAdyenBlik=angular.copy(At),o.enabledMyCheckCreditCard=angular.copy(It),o.enabledMyCheckPaypal=angular.copy(bt),o.enabledMyCheckApplePay=angular.copy(Dt),o.enabledMyCheckGpay=angular.copy(Tt))}function le(){var e=i.getMainReservation();if("deposit"==e.policies.guaranteePolicies[0].policyType.toLowerCase()||Me)if(t.MRB&&void 0!=o.itineraryDepositAmt||!t.MRB&&e.roomStays[0].depositPayments.depositAmt){var a=X();-1!==a&&a>=parseFloat(o.depositAmount)?(o.changeInPaymentVariables=!0,o.showCreditCardFields=!1,o.creditCardFieldRequiredIndicator=!1,o.enablePayPal=!1,o.enableXpayCreditCard=!1,o.enableXpayPayPal=!1,o.enableXpayWeChat=!1,o.enableXpayAliPay=!1,o.enableIDeal=!1,o.enableCreditCard=!1,o.enable3DSecure=!1,o.paypal=!1,o.ideal=!1,o.xpaywechat=!1,o.xpayalipay=!1,o.xpaypaypal=!1,o.xpaycredit=!1,o.secure3D=!1,o.ingenico=!1,o.nets=!1,o.paymentexpress=!1,o.reddot=!1,o.alternatePaymentIngenico=!1,o.bookNowDisplay=!1,o.credit=!0,o.enableAdyenDotPay=!1,o.adyenDotPay=!1,o.enableAdyenMbank=!1,o.enableAdyenIpko=!1,o.enableAdyenPrzelew24=!1,o.enableAdyenING=!1,o.enableAdyenMillennium=!1,o.enableAdyenAliorBank=!1,o.enableAdyenCitiHandlowy=!1,o.enableAdyenEurobank=!1,o.enableAdyenRPrzelew=!1,o.enableAdyenBlik=!1,o.enabledMyCheckCreditCard=!1,o.enabledMyCheckPaypal=!1,o.enabledMyCheckApplePay=!1,o.enabledMyCheckGpay=!1,o.insuranceObj&&o.insuranceObj.showInsurance&&o.isInsuranceSelected&&(o.showCreditCardFields=angular.copy(et),o.creditCardFieldRequiredIndicator=!0)):se()}else se();else se()}function ce(){var e=S.getLoyaltyPointsObject();e&&(e.hasOwnProperty("uniqueId")&&e.hasOwnProperty("profile")&&o.updateGuestInfo(e),t.MRB&&o.mainReservationArray&&v.forEach(o.mainReservationArray,function(e){e&&e.resGuests&&e.resGuests.length>0&&e.resGuests[0].uniqueId&&(e.resGuests[0].uniqueId.id=o.selectedGuestId)}))}function de(){if(o.isLoyaltyReservationEnabled&&o.isLoyaltyUserLogIn)if(S.getBurnPoints()&&o.displayMaximumPointsPaymentView)o.reservationTotalInPoints=S.getBurnPoints(),o.maxPointsCashValue=c("currencyConversionWithTwoDecimalPlaces")(S.getBurnPointsCurrencyValueFromBurnPoints(ne("loyalty-payment")));else{var e=ne("loyalty-payment");o.reservationTotalInPoints=S.getMaxPointsToEnter(e);var a=S.getMaxPointsToEnter(e);o.maxPointsCashValue=c("currencyConversionWithTwoDecimalPlaces")(S.getBurnPointsCurrencyValueFromPassedPoints(a,e)),S.getBurnPoints()&&o.inputPointsValidationAndCashEquivalent(S.getBurnPoints())}}function ge(){var e=i.getMainReservation(),a=!1;return void 0!=e.services&&e.services.length>0&&angular.forEach(e.services,function(e){e.discountRuleId&&(a=!0)}),a}function me(){var a=l.getHotelDesc(),r=a&&a.chainInfo&&a.chainInfo.length>0?a.chainInfo[0]:"",n=M.getAudienceEvaluatorCriteria();d.callAudienceEvaluator(HotelDescriptiveInfo2.hotelCode,r,n).then(function(a){M.setAudienceLists(a.data),t.$broadcast("RECALL_MERCHANDISING_API"),Ua(),e(function(){o.isLoyaltyReservationEnabled&&oe()})},function(a){console.log(a),e(function(){o.isLoyaltyReservationEnabled&&oe()}),J()})}function ue(){var e=l.getHotelDesc(),a=e&&e.chainInfo&&e.chainInfo.length?e.chainInfo[0]:"",t=angular.copy(u.loyaltyProfileData);t.xAuthToken&&t.profileMemberID?d.getLoyaltyBookedResDetails(e.hotelCode,a,t.xAuthToken,t.profileMemberID).then(function(e){M.setReservationHistoryObject(e.data),me()},function(e){console.log(e),me()}):me()}function pe(){e(function(){o.isLoyaltyReservationEnabled&&(o.isLoyaltyUserLogIn=!1,o.removeLoyaltyPoints(!0),ye());var e=i.getMainReservation(),a=S.getIsLoyaltyReservationEnabled();o.hideEmailMarketingConsent=S.getEmailMarketingConsentStatus(),1==a&&void 0!=e.roomStays&&e.roomStays.length>0&&void 0!=e.roomStays[0].ratePlans&&e.roomStays[0].ratePlans.length>0&&("Group"!=e.roomStays[0].ratePlans[0].ratePlanType||"Group"==e.roomStays[0].ratePlans[0].ratePlanType&&ge())&&(o.continueDeleteRatePlan(),o.continueDeleteRoom(),o.continueDeletePackage(),Ot(),t.MRB&&(i.revertAllAccommodationsMrb(),p.stepsById.accommodations.placeholderMRB=i.getBookedRoomCount()))})}function ye(){o.salutation=null,o.firstName="",o.lastName="",o.email="",o.bookerInfo={salutation:null,firstName:"",lastName:"",email:""},o.phoneNumber="",o.address1="",o.address2="",o.city="",o.selectedCountry="1"==o.ResAndPayConfig.defaultCountry?o.hotelDesc.address.countryCode:null,o.selectedState=null,o.postalcode="",o.selectedGuestId="",t.MRB&&o.mainReservationArray&&v.forEach(o.mainReservationArray,function(e){e&&e.resGuests&&e.resGuests.length>0&&(e.resGuests[0].profile&&e.resGuests[0].profile.customer&&(e.resGuests[0].profile.customer.namePrefix=null,e.resGuests[0].profile.customer.givenName="",e.resGuests[0].profile.customer.surName="",e.resGuests[0].profile.customer.email="",e.resGuests[0].profile.customer.telephone&&e.resGuests[0].profile.customer.telephone.length>0&&(e.resGuests[0].profile.customer.telephone[0].phoneNumber=""),e.resGuests[0].profile.customer.address&&e.resGuests[0].profile.customer.address.length>0&&(e.resGuests[0].profile.customer.address[0].addressLine1="",e.resGuests[0].profile.customer.address[0].addressLine2="",e.resGuests[0].profile.customer.address[0].cityName="",e.resGuests[0].profile.customer.address[0].countryCode="1"==o.ResAndPayConfig.defaultCountry?o.hotelDesc.address.countryCode:null,e.resGuests[0].profile.customer.address[0].stateCode=null,e.resGuests[0].profile.customer.address[0].postalCode="")),e.resGuests[0].uniqueId&&(e.resGuests[0].uniqueId.id=""))}),o.readOnlyConfig.firstNameReadOnlyIndicator=!1,o.readOnlyConfig.lastNameReadOnlyIndicator=!1,o.readOnlyConfig.emailAddressReadOnlyIndicator=!1}function ve(){o.voucherErrorObject={show:!1,message:""},o.voucherDetails=angular.copy(A.getVoucherDetails()),o.voucherApplied=o.voucherDetails&&o.voucherDetails.voucherCode,o.voucherPaymentProvidersList=A.getVoucherPaymentProvidersList(),o.isVoucherPaymentRedemptionAllowed=Re()}function he(){var e,a=i.getMainReservation(),t=a.posSource.requestorIds;return angular.forEach(t,function(a){"group"==a.codeType.toLowerCase()&&(e=!0)}),e}function Re(){var e=!0;return l.getHotelDesc().paymentProviders||(e=!1),parseFloat(ne("voucher-payment"))||(e=!1),parseFloat(ne())||(e=!1),he()&&(e=!1),e}function fe(){o.formattedVoucherCashValue=c("currencyConversionWithTwoDecimalPlaces")(A.getVoucherDetails().redeemedCashValue)}function Ce(){var e=i.getMainReservation();$()&&e.resGuests&&e.resGuests.length>0&&e.resGuests[0].profile&&e.resGuests[0].profile.consents&&e.resGuests[0].profile.consents.length>0&&l.setConsentsDataFromRetrieval(e.resGuests[0].profile.consents);var a=angular.copy(l.getHotelDescUpdated().consents);o.consentsSelectedArray=[];var t=0;angular.forEach(a,function(e){"pricing_consent"===e.category.toLowerCase()&&(o.pricingConsent=e),t<6&&("email_marketing"===e.category.toLowerCase()?(o.emailMarketingConsent=e,o.shareAllMarketInd=o.emailMarketingConsent.isPreChecked,t++):"private_offers"!==e.category.toLowerCase()&&"abandonment_email"!==e.category.toLowerCase()&&"extended_hold"!==e.category.toLowerCase()&&"pricing_consent"!==e.category.toLowerCase()&&(e.isSelected||(e.isSelected=angular.copy(e.isPreChecked)),o.consentsSelectedArray.push(e),t++))}),o.emailMarketingConsent||(o.shareAllMarketInd=!1)}function Pe(){return o.credit||(o.ingenico||o.nets||o.paymentexpress||o.xpaycredit)&&!o.alternatePaymentIngenico}function Se(){o.insuranceObj&&o.insuranceObj.creditCardFieldRequiredIndicatorOriginalValue===o.creditCardFieldRequiredIndicator&&!o.creditCardFieldRequiredIndicator&&(o.creditCardFieldRequiredIndicator=!0),o.payment.method&&"CREDIT"!==o.payment.method&&(o.payment.method="CREDIT",o.paymentProvider("credit")),o.changeInPaymentVariables&&(o.showCreditCardFields=angular.copy(et),o.creditCardFieldRequiredIndicator=!0)}function Ae(){if(l.getEnableInsurance()&&o.insuranceObj&&o.insuranceObj.showInsurance){var e={countryCode:o.selectedCountry};o.states&&o.states.map(function(e){return e.code}).indexOf(o.selectedState)>-1&&(e.stateCode=o.selectedState),o.initializeInsuranceOnDataUpdate(e)}}function Ie(){o.insuranceObj.reservationData={isReservationFailed:!1,isInsuranceSuccess:!1};var e=i.getInsuranceSuccessAndReservationFails();e&&null!=e.policyConfirmationNumber&&void 0!=e.policyConfirmationNumber&&e.isReservationFailed?(o.insuranceObj.reservationData.isReservationFailed=!0,o.insuranceObj.reservationData.isInsuranceSuccess=!0,o.isInsuranceSelected=!0,o.insuranceObj.selectedInsurance=e.selectedInsurance):o.isInsuranceSelected=!1}function be(e){var a=e;return o.insuranceObj.changeInPaymentVariables&&o.insuranceObj.paymentCard&&o.insuranceObj.paymentCard.cardNumber&&(a.resGlobalInfo.guaranteesAccepted[0].paymentCard=angular.copy(o.insuranceObj.paymentCard)),a}if(t.recallAPIFromHTML5Geolocation=!1,o.showMessageOnCosmoFailure=!1,o.alertVariable=!0,o.hideEmailMarketingConsent=S.getEmailMarketingConsentStatus()||R.getEmailMarketingConsentStatusGMS(),o.hasDiscountServices=!1,o.showPaymentGuideLineMessage=!1,u.innerWidth<=768?o.smallWindow=!0:o.smallWindow=!1,l.getUxConfiguration().accomodationsConfig.hideEnhancementScheduling&&(o.removeEnhancementBtnFlag=l.getUxConfiguration().accomodationsConfig.hideEnhancementScheduling),t.enablePromotionBanner=!1,o.taxBreakoutEnabled=!1,o.trustAsHtml=C.trustAsHtml,o.insuranceTotalPrice="",o.isMyCheckPaymentEnabled=b.isMyCheckPaymentEnabled(),o.configurationDataOfWidget=b.getMyCheckRefershTokenDetails(),o.alternatePaymentOptionsFromHotelDec=angular.copy(l.getHotelDesc().paymentProviders),o.isMycheckV2Enabled=l.getHotelDesc().enable3DSv1PaymentProcessing,o.isMycheckV2Enabled||(t.MRB?o.amountForWallet=0!=i.getMrbItineraryPaymentInfo().itineraryDepositAmt?i.getMrbItineraryPaymentInfo().itineraryDepositAmt:i.getCustomValidationAmount():o.amountForWallet=i.getMainReservation().roomStays[0].depositPayments.depositAmt?i.getMainReservation().roomStays[0].depositPayments.depositAmt:i.getCustomValidationAmount()),t.enabledMyCheckButton=!0,o.enabledCybersourceButton=!0,o.isInstallmentEnabled=!1,o.isNoOfInstallmentsAvailable=!1,o.isBrainTreePaymentEnabled=i.isBrainTreePaymentEnabled(),o.isAmadeusPaymentEnabled=i.isAmadeusPaymentEnabled(),o.isBrainTreePaymentEnabled&&(o.totalAmountAfterTax=!t.MRB||t.MRB&&1==i.getMainReservationArray().length?i.getMainReservation().roomStays[0].total.amountAfterTax:i.getMrbItineraryTotals().itineraryRoomGrandTotal,o.reservationPolicies=k.getReservationPolicies(),o.languageCode=i.getLanguage(),o.translationLabels=k.getTranslationLabels(),o.collapseOnMobileView=o.smallWindow,o.enableBrainTreeButton=!0),o.isAmadeusPaymentEnabled){o.totalAmountAfterTax=!t.MRB||t.MRB&&1==i.getMainReservationArray().length?i.getMainReservation().roomStays[0].total.amountAfterTax:i.getMrbItineraryTotals().itineraryRoomGrandTotal,o.reservationPolicies=k.getReservationPolicies(),o.languageCode=i.getLanguage(),o.translationLabels=k.getTranslationLabels(),o.collapseOnMobileView=o.smallWindow,o.enableAmadeusButton=!0;var De=!1}o.isAmadeusPaymentEnabled&&i.getReservation()&&i.canModifyReservation()&&(o.isInstallmentEnabled=i.getReservation().policies.guaranteePolicies[0].isInstallmentEnabled,i.getReservation().resGlobalInfo.guaranteesAccepted[0].paymentCard.noOfInstallments?o.isNoOfInstallmentsAvailable=!0:o.isNoOfInstallmentsAvailable=!1);var Te,Oe,Ee=!1;o.isLoyaltyReservationEnabled=S.getIsLoyaltyReservationEnabled()&&!i.canModifyReservation(),o.isLoyaltyRedemptionAllowed=l.getHotelDesc().paymentProviders&&l.getHotelDesc().paymentProviders.length>0,o.isBrandbarDisplay=S.getIsBrandBarDisplay(),o.isMenubarDisplay=D.getMenubarEnabled(),S.getLoyaltyConfig()&&(o.showLoyaltyPoints=!S.getLoyaltyConfig().showHideLoyaltyPoints||"hide"!==S.getLoyaltyConfig().showHideLoyaltyPoints.toLowerCase(),o.programName=S.getLoyaltyConfig().programName,o.programCurrency=S.getLoyaltyConfig().programCurrency),o.isVoucherPaymentEnabled=A.getEnableVoucherPayment()&&!i.canModifyReservation(),o.voucherDetails={},o.voucherApplied=!1,o.voucherPaymentProvidersList=[],i.setTaxBreakDownFinalConfirmation(!1),o.showTaxBreakdown=!1,o.fixedMerchandiseCurrency=i.getFixedMerchandisedCurrency();var Me=!1,_e=!1,ke=!1,Ne=!1,Le=!1,Ge=!1,Fe=!1,Be=!1,xe={},we=i.getSupplementalObj(),Ue=!1;t.promotionBannerObject=void 0;var He="currencyConversionWithTwoDecimalPlaces",Ve=!1;o.enableExpandedDailyRates=l.getUxConfiguration().reservationAndPaymentConfig.enableExpandedDailyRates,o.enableExpandedSpecialRequestForm=l.getUxConfiguration().reservationAndPaymentConfig.enableExpandedSpecialRequestForm,l.getEnableInsurance()&&(o.insuranceObj={},o.insuranceObj.isInsuranceEnable=l.getEnableInsurance(),o.insuranceObj.showInsurance=l.showHideInsurance()&&!(t.MRB&&i.getMainReservationArray()&&i.getMainReservationArray().length>1),o.insuranceObj.creditCardFieldRequiredIndicatorOriginalValue=angular.copy(o.creditCardFieldRequiredIndicator),o.insuranceObj.insurancePaymentOptionMessage={type:"info",message:t.translate["page_paymentsupportedinsurance-Msgpaymentsupportedinsurance"]},o.isInsuranceSelected=!1,Ie(),o.initializeInsuranceOnDataUpdate=function(e){N.setInsuranceGuestInfo(e),o.insuranceObj.selectedInsurance={},Ie(),t.$broadcast("EVT_WC_ON_INSURANCE_WIDGET_INITIALIZE",e)}),L(),G(),o.$on(y.MODIFY_RESERVATION,function(){G()}),o.initMultiroomData=function(){i.changeSelectRoom(i.getMainReservation().id),t.reservationArray=angular.copy(i.getMainReservationArray()),o.mainReservationArray=angular.copy(i.getMainReservationArray()),o.itineraryTotals=angular.copy(i.getMrbItineraryTotals()),o.itineraryTotals.formattedItineraryRoomSubTotal=c(He)(o.itineraryTotals.itineraryRoomSubTotal,o.fixedMerchandiseCurrency);var e=0;o.itineraryTotals.itineraryRoomTotalTaxes&&(o.itineraryTotals.itineraryResortFeeTotal&&(e+=Number(o.itineraryTotals.itineraryResortFeeTotal)),o.itineraryTotals.itineraryServiceChargeTotal&&(e+=Number(o.itineraryTotals.itineraryServiceChargeTotal)),o.itineraryTotals.itineraryRoomTotalTaxes=Number(o.itineraryTotals.itineraryRoomTotalTaxes)-Number(e)),o.itineraryTotals.formattedItineraryRoomTotalTaxes=c(He)(o.itineraryTotals.itineraryRoomTotalTaxes,o.fixedMerchandiseCurrency),o.itineraryTotals.formattedItineraryResortFeeTotal=c(He)(o.itineraryTotals.itineraryResortFeeTotal,o.fixedMerchandiseCurrency),o.itineraryTotals.formattedItineraryServiceChargeTotal=c(He)(o.itineraryTotals.itineraryServiceChargeTotal,o.fixedMerchandiseCurrency),o.itineraryTotals.formattedItineraryRoomGrandTotal=c(He)(o.itineraryTotals.itineraryRoomGrandTotal,o.fixedMerchandiseCurrency),o.itineraryTotals.formattedItineraryOutTotalInclusiveResortFeeTotal=c(He)(o.itineraryTotals.itineraryOutTotalInclusiveResortFeeTotal,o.fixedMerchandiseCurrency),o.itineraryTotals.formattedItineraryOutTotalInclusiveServiceChargeTotal=c(He)(o.itineraryTotals.itineraryOutTotalInclusiveServiceChargeTotal,o.fixedMerchandiseCurrency),o.itineraryTotals.formattedItineraryOutTotalInclusiveTaxTotal=c(He)(o.itineraryTotals.itineraryOutTotalInclusiveTaxTotal,o.fixedMerchandiseCurrency),o.itineraryTotals.formattedItineraryOutTotalExclusiveResortFeeTotal=c(He)(o.itineraryTotals.itineraryOutTotalExclusiveResortFeeTotal,o.fixedMerchandiseCurrency),o.itineraryTotals.formattedItineraryOutTotalExclusiveServiceChargeTotal=c(He)(o.itineraryTotals.itineraryOutTotalExclusiveServiceChargeTotal,o.fixedMerchandiseCurrency),o.itineraryTotals.formattedItineraryOutTotalExclusiveTaxTotal=c(He)(o.itineraryTotals.itineraryOutTotalExclusiveTaxTotal,o.fixedMerchandiseCurrency),o.itineraryTotals.hasOutTotalInclusive=o.itineraryTotals.itineraryOutTotalInclusiveResortFeeTotal>0||o.itineraryTotals.itineraryOutTotalInclusiveServiceChargeTotal>0||o.itineraryTotals.itineraryOutTotalInclusiveTaxTotal>0,o.itineraryTotals.hasOutTotalExclusive=o.itineraryTotals.itineraryOutTotalExclusiveResortFeeTotal>0||o.itineraryTotals.itineraryOutTotalExclusiveServiceChargeTotal>0||o.itineraryTotals.itineraryOutTotalExclusiveTaxTotal>0,v.forEach(o.mainReservationArray,function(e){if(i.setMainReservation(e.id),e.totalRoomData=i.getFormattedReservationData(He),e.totalRoomData.roomsData[0].nightsCollapse=!o.enableExpandedDailyRates,e.totalRoomData.roomsData[0].breakDownNightsCollapse=!o.enableExpandedDailyRates,e.totalRoomData.formattedSubtotalExcludeDiscount=c(He)(e.totalRoomData.subtotalExcludeDiscount,o.fixedMerchandiseCurrency),e.totalRoomData.formattedSubtotal=c(He)(e.totalRoomData.subtotal,o.fixedMerchandiseCurrency),e.totalRoomData.formattedTaxes=c(He)(e.totalRoomData.taxes,o.fixedMerchandiseCurrency),e.totalRoomData.formattedResortFees=c(He)(e.totalRoomData.resortFees,o.fixedMerchandiseCurrency),e.totalRoomData.formattedServiceCharge=c(He)(e.totalRoomData.serviceCharge,o.fixedMerchandiseCurrency),e.totalRoomData.formattedTotal=c(He)(e.totalRoomData.total,o.fixedMerchandiseCurrency),o.taxBreakoutEnabled=o.taxBreakoutEnabled||e.totalRoomData.taxBreakoutEnabled,angular.forEach(e.totalRoomData.roomsData,function(e,a){e.formattedTotalRoomPrice=c(He)(e.totalRoomPrice,o.fixedMerchandiseCurrency),angular.forEach(e.datesOfStay,function(e){e.formattedDate=c("formatServicesDate")(e.date),e.formattedPrice=c(He)(e.price,o.fixedMerchandiseCurrency)})}),angular.forEach(e.totalRoomData.packageInclusions,function(e,a){angular.forEach(e.daysArray,function(e){e.formattedDate=c("formatServicesDate")(e.date),e.formattedPrice=c(He)(e.price,o.fixedMerchandiseCurrency)})}),angular.forEach(e.totalRoomData.enhancements,function(e,a){e.formattedServiceTotalPrice=c(He)(e.serviceTotalPrice,o.fixedMerchandiseCurrency),angular.forEach(e.daysArray,function(e){e.formattedDate=c("formatServicesDate")(e.date),e.formattedPrice=c(He)(e.price,o.fixedMerchandiseCurrency)})}),0==e.totalRoomData.specialRequest.length&&e.totalRoomData.selectedSpecialRequests.length>0){var a=[];v.forEach(e.totalRoomData.selectedSpecialRequests,function(e){var t=angular.copy(e);t.selectedRequest=t.serviceOptions[0],a.push(t)}),e.totalRoomData.specialRequest=angular.copy(a)}else e.totalRoomData.specialRequest=[];e.selected&&(o.currentRoomInContext=angular.copy(e));var t=e.policies.guaranteePolicies;if(t&&t.length>0){var r=t[0].policyType;if("deposit"==r.toLowerCase()){Me=!0;var n=t[0].acceptTender;"IATA"==n?_e=!0:"credit card, alternate payments"==n.toLowerCase()&&(ke=!0)}if("guarantee"==r.toLowerCase()){Ne=!0;var n=t[0].acceptTender;"IATA"==n?Le=!0:"Corp ID"==n||"Rate Access Code"==n?Ge=!0:"credit card"==n.toLowerCase()?Fe=!0:Be=!0}}}),void 0!=o.currentRoomInContext&&(delete o.currentRoomInContext.totalRoomData,i.setMainReservation(o.currentRoomInContext.id)),setTimeout(function(){var e,a=document.getElementById("multiroom-totalreservation-price"),o=angular.copy(i.getMrbItineraryTotals());o&&(e=parseFloat(o.itineraryRoomGrandTotal)/1);if(a&&e){var n=a.innerHTML;!r.is("total")||S.getBurnPoints()||0==e||null==n.match("^[^1-9]+$")&&n.match("^(?!.*undefined).*$")||t.$broadcast("UNKNOWN_APPLICATION_ERROR",{applicationReset:!1,eventLabel:"AngularDigestException"})}},3e3)},t.MRB&&(o.itineraryPaymentInfo=angular.copy(i.getMrbItineraryPaymentInfo()),o.itineraryDepositAmt=void 0!=o.itineraryPaymentInfo&&o.itineraryPaymentInfo.itineraryDepositAmt?o.itineraryPaymentInfo.itineraryDepositAmt:void 0,o.depositAmount=angular.copy(o.itineraryDepositAmt),o.depositAmountCopy=angular.copy(o.depositAmount),o.depositAmt=F(o.depositAmountCopy),o.mainReservationArray=angular.copy(i.getMainReservationArray()),o.mainReservationArray.length>1?o.initMultiroomData():(i.setMainReservation(o.mainReservationArray[0].id),o.totalData=i.getFormattedReservationData(He),o.taxBreakoutEnabled=o.totalData.taxBreakoutEnabled));var $e=Me||_e||ke||Ne||Le||Ge||Fe;o.singleGuestsInfo=!0,O.executeAfterCookieBanner().then(function(){t.$broadcast("EVENT.TRIGGER_EXTEND_HOLD")}),o.$on("EVENT.GMS_OPENED",function(){o.deleteRoom="display-none",o.deleteRatePlan="display-none",o.deletePackage="display-none",o.showPaymentConfirmationModal="display-none",o.showTCModal="display-none",o.showServices="display-none",o.deleteConfirmationPopup="display-none",o.showRatePlanDetail=!1,o.showTaxBreakdown=!1,o.closeRetriveInfoModal()}),t.$broadcast("EVENT.TRIGGER_GMS"),t.displayPromo="none",o.$watch("showServices",function(){"display-block"==o.showServices?i.setConfig("enhancementInTotal"):"display-none"==o.showServices&&i.deleteConfig("enhancementInTotal")}),o.rateShow=l.getHotelDesc().uxConfiguration.strikeThroughPricingEnabled;var qe,Ye=["INVALID_ROOM_ID","BOOKCHK_NO_ROOMS_STAYDATES","BOOKCHK_NO_ROOMS_STAYDATES_RATEPLAN","BOOKCHK_NO_GENERAL_INVENTORY","BOOKCHK_NO_ROOMTYPE_LEVEL_INVENTORY","BOOKCHK_NO_PRODUCT_LEVEL_INVENTORY","BOOKCHK_NO_PROPERTY_LEVEL_INVENTORY","BOOK_NEW_NO_LONGER_AVAILABLE"],je=["PAYMENT_STATUS_UNKNOWN","ALT_PAYMENT_PROCESSING_FAILED"],ze=["CREDIT_CARD_NUMBER_NOT_VALID","CREDIT_CARD_EXPIRED","CREDIT_CARD_EXPIRY_MISSING_OR_FORMAT_NOT_VALID","CREDIT_CARD_HOLDER_NAME_REQUIRED","CREDIT_CARD_INFO_INCOMPLETE","PAYMENT_PROCESS_FAILED","ALTERNATE_PAYINIT_PROCESSING_FAILURE"],We=["CREDIT_CARD_PROCESSING_FAILURE","CREDIT_CARD_NOT_ACTIVE_FOR_HOTEL","CREDIT_CARD_TYPE_NOT_VALID","CREDIT_CARD_TYPE_REQUIRED"],Ke=["PAYMENT_PROCESS_FAILED","PAYER_CARD_NOT_AUTHORIZED","REQUEST_NOT_FOUND","PAYER_SESSION_INIT_FAIL","CREDIT_CARD_NUMBER_NOT_VALID"];o.clearOnFocus=!1;var Je=i.getCurrencyDetails();o.currencySymbol=Je.currencySymbol,o.currencyCode=i.getCurrency(),o.currencyCode||(o.currencyCode=l.getHotelDesc().currentCurrency.currencyCode),o.crmSettings=l.getUxConfiguration().crmSettings,o.enablePayPal=!1,o.enableIDeal=!1,o.enableXpayCreditCard=!1,o.enableXpayPayPal=!1,o.enableXpayWeChat=!1,o.enableXpayAliPay=!1,o.enableCreditCard=!1,o.enable3DSecure=!1,o.paypal=!1,o.xpaywechat=!1,o.xpayalipay=!1,o.xpaypaypal=!1,o.xpaycredit=!1,o.credit=!1,o.ideal=!1,o.secure3D=!1,o.enableAdyenDotPay=!1,o.adyenDotPay=!1,o.enableAdyenMbank=!1,o.enableAdyenIpko=!1,o.enableAdyenPrzelew24=!1,o.enableAdyenING=!1,o.enableAdyenMillennium=!1,o.enableAdyenAliorBank=!1,o.enableAdyenCitiHandlowy=!1,o.enableAdyenEurobank=!1,o.enableAdyenRPrzelew=!1,o.enableAdyenBlik=!1,o.enabledMyCheckCreditCard=!1,o.enabledMyCheckPaypal=!1,o.enabledMyCheckApplePay=!1,o.enabledMyCheckGpay=!1,o.secure3DLogo={visa:!1,amex:!1,master:!1,jcb:!1},o.cvvRequiredIndicator=!1,o.cvvRequiredIndicatorOgone=!1,t.startTime=Date.now(),o.showPaymentRedirectModal="display-none",o.showPaymentConfirmationModal="display-none",o.deleteRoom="display-none",o.deleteRatePlan="display-none",o.deletePackage="display-none",t.guestsroomsClass="is-disabled",t.datesOfStayClass="is-disabled",t.accommodationClass="is-disabled",t.totalClass="is-active",o.emailRegex="^[_A-Za-z0-9-+]+(\\.[_A-Za-z0-9-+]+)*@[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*(\\.[A-Za-z]{2,})$",o.postalRegex="^[A-Za-z0-9 ]+(?:-[A-Za-z0-9 ]+)?$",o.phoneRegex="^[+]*[0-9 (]{0,4}[0-9 ]{1,5}[)]{0,1}[-\\s\\./0-9]+([0-9]{1,})$",o.onlyNumbers="^[0-9]*$",o.expiryPtrn=/^(\d{2})[\/](\d{2})$/,o.$state=r,o.deleteConfirmationPopup="display-none",o.showServices="display-none",o.showGroupModal="display-none",o.cardNumberChange=!1,o.expiryDatePassed=!1,o.passPaymentMethod=!0;var Qe=i.getMainReservation();o.orderId=Qe.uniqueId,o.depositAmount=t.MRB?o.itineraryDepositAmt:Qe.roomStays[0].depositPayments.depositAmt,o.depositAmountCopy=angular.copy(o.depositAmount),o.depositAmt=F(o.depositAmountCopy),o.totalData={},o.groupPaymentMethod=!1,o.combinedHoldFailure=!1,s.getObjectData("paypalCancelModalFlag")?setTimeout(function(){o.showPaymentCancelModal=!0,s.setObjectData("paypalCancelModalFlag",!1),setTimeout(function(){P.onModalOpen("book-button-id","payment-cancel-modal-parent","payment-cancel-modal-title",!1,o.continueShowPaymentCancelModal)},500)},0):o.showPaymentCancelModal=!1,s.getObjectData("idealCancelModalFlag")?setTimeout(function(){o.showIdealPaymentCancelModal=!0,setTimeout(function(){P.onModalOpen("book-button-id","ideal-payment-cancel-modal-parent","ideal-payment-cancel-modal-title",!1,o.continueShowPaymentCancelModal)},500),s.setObjectData("idealCancelModalFlag",!1)},0):o.showIdealPaymentCancelModal=!1,o.showTCModal="display-none",o.showOFACModal=!1,o.ofacSubmitData=null,o.ofacCitizenStatus={},o.ofacInputData={};var Xe=i.getCountryCode(),Ze=l.getHotelDesc();o.ofacEnabled=!(!Ze||!Ze.ofacEnabled),o.isUSIp=!(!Xe||"us"!==Xe.toLowerCase()),o.showConfirmModal="display-none";var ea=l.getHotelInfo().hotelCode;o.titles=l.getTitles();var aa=!0;o.ResAndPayConfig=l.getUxConfiguration().reservationAndPaymentConfig,o.readOnlyConfig={},o.hotelDesc=l.getHotelDesc(),o.ccvMinLength=3;var ta=o.hotelDesc.brandInfo,oa=ta.themeId;a.debug(oa+"  Theme Id Number"),o.creditCardFieldRequiredIndicator,o.showCreditCardFields,o.totalAmount=p.stepsById.total.placeholder;var ra=i.getLanguage();if(o.language=ra,oa){var na=o.ResAndPayConfig.enableMandatoryCreditCardFieldsForThemes,ia=o.ResAndPayConfig.showCreditCardFieldsForThemes;a.debug(JSON.stringify(na)+"  theme Object");var sa=c("filter")(na,{themeId:oa});void 0!=sa&&sa.length>0?o.creditCardFieldRequiredIndicator=sa[0].enableMandatoryCreditCardFields:o.creditCardFieldRequiredIndicator=o.ResAndPayConfig.enableMandatoryCreditCardFields;var la=c("filter")(ia,{themeId:oa});void 0!=la&&la.length>0?o.showCreditCardFields=la[0].showCreditCardFields:o.showCreditCardFields=o.ResAndPayConfig.showCreditCardFields}else o.creditCardFieldRequiredIndicator=o.ResAndPayConfig.enableMandatoryCreditCardFields,o.showCreditCardFields=o.ResAndPayConfig.showCreditCardFields;o.enableMandatoryCreditCardFields=!o.creditCardFieldRequiredIndicator;var ca=Qe.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardNumber;if(ca)var da=ca.substr(ca.length-4);o.isTAAvailable=!0,o.isCorpCodeAvailable=!0,t.callManageUrlCalender=!1,o.selectedRatePlanName=Qe.roomStays[0].ratePlans[0].ratePlanName;var ga=Qe.roomStays[0].ratePlans[0].ratePlanType;if(o.selectedRatePlanCode=Qe.roomStays[0].ratePlans[0].ratePlanCode,void 0!=t.RatesAvail){var ma=t.RatesAvail.roomStays[0].ratePlans,ua=Qe.roomStays[0].ratePlans[0].ratePlanCode;o.selectedRatePlanObj=_.filter(ma,{ratePlanCode:ua}),"Group"!=ga&&"group"!=ga||void 0!=o.selectedRatePlanName||(o.selectedRatePlanName=ma[0].ratePlanName,0==o.selectedRatePlanObj.length&&(o.selectedRatePlanObj=ma))}else t.totalRatePlanIconHide=!0;o.showRatePlanDetail=!1,o.groupNameModifyFlow=!1,o.isModifyReservation=i.canModifyReservation(),"Group"!=ga&&"group"!=ga||!o.isModifyReservation||1!=t.totalRatePlanIconHide||(o.groupNameModifyFlow=!0),o.bookNowDisplay=!1,1==ke&&void 0!=l.getHotelDesc().paymentProviders&&l.getHotelDesc().paymentProviders.length>=2&&void 0!=o.depositAmt&&0!=o.depositAmt&&(o.depositCC=!0);var pa=l.getHotelDesc().paymentProviders;if(o.disabledIngenicoOgoneAltPayment=!1,pa&&pa.length>1)for(var ya=0;ya<pa.length;ya++)Ne&&Fe&&"creditcard-ingenico"==pa[0].vendorKey&&"hosting-ogone"==pa[ya].vendorKey&&("4"==pa[ya].paymentMethod||"3"==pa[ya].paymentMethod)&&(o.disabledIngenicoOgoneAltPayment=!0);var va,ha=Qe.policies.guaranteePolicies;if((ha||$e)&&(ha.length>0||$e)){var Ra=ha[0].policyType;if("deposit"==Ra.toLowerCase()||Me){if(void 0!=l.getUxConfiguration().reservationAndPaymentConfig.overrideVariantIdsLst)for(var ya=0;ya<l.getUxConfiguration().reservationAndPaymentConfig.overrideVariantIdsLst.length;ya++)if(l.getUxConfiguration().reservationAndPaymentConfig.overrideVariantIdsLst[ya].themeId==l.getBrandInfo().themeId){va=l.getUxConfiguration().reservationAndPaymentConfig.overrideVariantIdsLst[ya].depositVariantId;break}void 0==va&&void 0!=l.getUxConfiguration().reservationAndPaymentConfig&&(va=l.getUxConfiguration().reservationAndPaymentConfig.depositVariantId);var fa=ha[0].acceptTender;if("IATA"==fa||_e){1!=ke&&(o.bookNowDisplay=!0),o.enablePayPal=!1,o.enableIDeal=!1,o.enableXpayCreditCard=!1,o.enableXpayPayPal=!1,o.enableXpayWeChat=!1,o.enableXpayAliPay=!1,o.enable3DSecure=!1,o.enableAdyenDotPay=!1;var Ca=Qe.posSource.requestorIds;if(Ca.length>0){var Pa=!1;angular.forEach(Ca,function(e,a){"travelagent"==e.codeType.toLowerCase()&&(Pa=!0)}),Pa||(o.isTAAvailable=!1)}else o.isTAAvailable=!1}"credit card, alternate payments"==fa.toLowerCase()&&void 0!=l.getHotelDesc().paymentProviders&&l.getHotelDesc().paymentProviders.length>=2&&void 0!=o.depositAmount&&0!=o.depositAmount&&(o.depositCC=!0),void 0!=o.depositAmount&&0!=o.depositAmount||(o.bookNowDisplay=!0)}if("guarantee"==Ra.toLowerCase()||Ne){var fa=ha[0].acceptTender
;if(!ke&&void 0!=l.getUxConfiguration().reservationAndPaymentConfig.overrideVariantIdsLst)for(var ya=0;ya<l.getUxConfiguration().reservationAndPaymentConfig.overrideVariantIdsLst.length;ya++)l.getUxConfiguration().reservationAndPaymentConfig.overrideVariantIdsLst[ya].themeId==l.getBrandInfo().themeId&&(va=l.getUxConfiguration().reservationAndPaymentConfig.overrideVariantIdsLst[ya].validationVariantId);if(ke||void 0!=va||void 0==l.getUxConfiguration().reservationAndPaymentConfig||(va=l.getUxConfiguration().reservationAndPaymentConfig.validationVariantId),"IATA"==fa||Le){ke||1==Fe||(o.bookNowDisplay=!0);var Ca=Qe.posSource.requestorIds;if(Ca.length>0){var Pa=!1;angular.forEach(Ca,function(e,a){"travelagent"==e.codeType.toLowerCase()&&(Pa=!0)}),Pa||(o.isTAAvailable=!1)}else o.isTAAvailable=!1}if("Corp ID"==fa||"Rate Access Code"==fa||Ge){ke||1==Fe||(o.bookNowDisplay=!0);var Ca=Qe.posSource.requestorIds;if(Ca.length>0){var Sa=!1;angular.forEach(Ca,function(e,a){"corporate"==e.codeType.toLowerCase()&&(Sa=!0)}),Sa||(o.isCorpCodeAvailable=!1)}else o.isCorpCodeAvailable=!1}o.creditCardFieldRequiredIndicator||Fe||"credit card"==fa.toLowerCase()?(o.bookNowDisplay=!1,o.guaranteeIngenico=!0):!("IATA"!=fa&&"Corp ID"!=fa&&"Rate Access Code"!=fa||Be)||o.creditCardFieldRequiredIndicator||ke||(o.bookNowDisplay=!0),o.bookNowDisplay||!_e||ke||(o.bookNowDisplay=!0)}}if(!o.creditCardFieldRequiredIndicator){a.debug("Credit card true");var ha=Qe.policies.guaranteePolicies;if((ha||$e)&&(ha.length>0||$e)){var Ra=ha[0].policyType;if("deposit"==Ra.toLowerCase()||Me){var fa=ha[0].acceptTender;("credit card, alternate payments"==fa.toLowerCase()||ke)&&(o.creditCardFieldRequiredIndicator=!0)}if("guarantee"==Ra.toLowerCase()||Ne){var fa=ha[0].acceptTender;("credit card"==fa.toLowerCase()||Fe)&&(o.creditCardFieldRequiredIndicator=!0,o.cvvRequiredIndicator=!1,o.cvvRequiredIndicatorOgone=!1,o.showCVV=!1)}}}if(!o.showCreditCardFields){a.debug("Credit card true");var ha=Qe.policies.guaranteePolicies;if((ha||$e)&&(ha.length>0||$e)){var Ra=ha[0].policyType;if("deposit"==Ra.toLowerCase()||Me){var fa=ha[0].acceptTender;("credit card, alternate payments"==fa.toLowerCase()||ke)&&(o.showCreditCardFields=!0)}if("guarantee"==Ra.toLowerCase()||Ne){var fa=ha[0].acceptTender;("credit card"==fa.toLowerCase()||Fe)&&(o.showCreditCardFields=!0)}}}var Aa=["creditcard-mycheck","creditcard-amadeus","allpayment-reddot","creditcard-nets","creditcard-payu_latam","creditcard-paymentexpress","creditcard-ingenico","creditcard-xpay"];!function(){var e=o.hotelDesc.paymentProviders;if(e){var a=!1;a=e.some(function(e){return Aa.some(function(a){return a===e.vendorKey})}),o.showPaymentGuideLineMessage=(a||e.length>1)&&("credit card"===ha[0].acceptTender.toLowerCase()||"credit card, alternate payments"===ha[0].acceptTender.toLowerCase()||o.creditCardFieldRequiredIndicator)}}();var Ia=function(){var e="test",a=u.sessionStorage;try{return a.setItem(e,"1"),a.removeItem(e),!0}catch(e){return!1}}(),ba=function(){var e="test",a=u.localStorage;try{return a.setItem(e,"1"),a.removeItem(e),!0}catch(e){return!1}}();if(o.creditCardFieldRequiredIndicator&&void 0!=o.hotelDesc.paymentProviders&&("deposit"==Qe.policies.guaranteePolicies[0].policyType.toLowerCase()||Me))for(var pa=o.hotelDesc.paymentProviders,ya=0;ya<pa.length;ya++)void 0!=pa[ya].vendorKey&&("hosting-ogone"==pa[ya].vendorKey&&void 0!=pa[ya].paymentMethod&&("4"==pa[ya].paymentMethod&&("IATA"!=ha[0].acceptTender||ke)&&(Fe||void 0==o.depositAmount||1!=Ia||(o.enablePayPal=!0)),"IATA"==ha[0].acceptTender&&!ke||void 0==o.depositAmount||"3"!=pa[ya].paymentMethod||1!=Ia||1!=ba||Fe||(o.enableIDeal=!0)),"altpayment-xpay"==pa[ya].vendorKey&&void 0!=pa[ya].paymentMethod&&("4"==pa[ya].paymentMethod?("IATA"!=ha[0].acceptTender||ke)&&void 0!=o.depositAmount&&1==Ia&&(o.enableXpayPayPal=!0):"12"==pa[ya].paymentMethod?("IATA"!=ha[0].acceptTender||ke)&&void 0!=o.depositAmount&&1==Ia&&(o.enableXpayAliPay=!0):"13"==pa[ya].paymentMethod&&("IATA"!=ha[0].acceptTender||ke)&&void 0!=o.depositAmount&&1==Ia&&(o.enableXpayWeChat=!0)),"credcard-cybersource"!=pa[ya].vendorKey&&"credcard-ogone"!=pa[ya].vendorKey&&"credcard-ihotelier"!=pa[ya].vendorKey&&"creditcard-adyen"!=pa[ya].vendorKey||void 0!=pa[ya].paymentMethod&&"1"==pa[ya].paymentMethod&&(o.enableCreditCard=!0),"IATA"==ha[0].acceptTender&&!ke||void 0==o.depositAmount||"creditcard-xpay"!=pa[ya].vendorKey||void 0!=pa[ya].paymentMethod&&("creditcard-xpay"==pa[ya].vendorKey&&pa.length>1?o.enableXpayCreditCard=!0:"creditcard-xpay"==pa[ya].vendorKey&&(o.xpaycredit=!0)),"IATA"==ha[0].acceptTender&&!ke||void 0==o.depositAmount||"3DSecure-cybersource"!=pa[ya].vendorKey&&"3DSecureV2-cybersource"!=pa[ya].vendorKey&&"3DSecure-ogone"!=pa[ya].vendorKey&&"3DSecure-adyen"!=pa[ya].vendorKey||void 0!=pa[ya].paymentMethod&&"2"==pa[ya].paymentMethod&&(o.enable3DSecure=!0,o.enableCreditCard=!0),"hosting-adyen"==pa[ya].vendorKey&&void 0!=pa[ya].paymentMethod&&("14"==pa[ya].paymentMethod?("IATA"!=ha[0].acceptTender||ke)&&(Fe||void 0==o.depositAmount||1!=Ia||(o.enableAdyenDotPay=!0,o.enableAdyenMbank=!0)):"15"==pa[ya].paymentMethod?("IATA"!=ha[0].acceptTender||ke)&&(Fe||void 0==o.depositAmount||1!=Ia||(o.enableAdyenDotPay=!0,o.enableAdyenIpko=!0)):"16"==pa[ya].paymentMethod?("IATA"!=ha[0].acceptTender||ke)&&(Fe||void 0==o.depositAmount||1!=Ia||(o.enableAdyenDotPay=!0,o.enableAdyenPrzelew24=!0)):"17"==pa[ya].paymentMethod?("IATA"!=ha[0].acceptTender||ke)&&(Fe||void 0==o.depositAmount||1!=Ia||(o.enableAdyenDotPay=!0,o.enableAdyenING=!0)):"18"==pa[ya].paymentMethod?("IATA"!=ha[0].acceptTender||ke)&&(Fe||void 0==o.depositAmount||1!=Ia||(o.enableAdyenDotPay=!0,o.enableAdyenMillennium=!0)):"19"==pa[ya].paymentMethod?("IATA"!=ha[0].acceptTender||ke)&&(Fe||void 0==o.depositAmount||1!=Ia||(o.enableAdyenDotPay=!0,o.enableAdyenAliorBank=!0)):"20"==pa[ya].paymentMethod?("IATA"!=ha[0].acceptTender||ke)&&(Fe||void 0==o.depositAmount||1!=Ia||(o.enableAdyenDotPay=!0,o.enableAdyenCitiHandlowy=!0)):"21"==pa[ya].paymentMethod?("IATA"!=ha[0].acceptTender||ke)&&(Fe||void 0==o.depositAmount||1!=Ia||(o.enableAdyenDotPay=!0,o.enableAdyenRPrzelew=!0)):"22"==pa[ya].paymentMethod?("IATA"!=ha[0].acceptTender||ke)&&(Fe||void 0==o.depositAmount||1!=Ia||(o.enableAdyenDotPay=!0,o.enableAdyenEurobank=!0)):"23"==pa[ya].paymentMethod&&("IATA"!=ha[0].acceptTender||ke)&&(Fe||void 0==o.depositAmount||1!=Ia||(o.enableAdyenDotPay=!0,o.enableAdyenBlik=!0))),"IATA"==ha[0].acceptTender&&!ke||void 0==o.depositAmount||"creditcard-mycheck"!=pa[ya].vendorKey||void 0!=pa[ya].paymentMethod&&"1"==pa[ya].paymentMethod&&(o.enabledMyCheckCreditCard=!0),"altpayment-mycheck"==pa[ya].vendorKey&&void 0!=pa[ya].paymentMethod&&("4"==pa[ya].paymentMethod?("IATA"!=ha[0].acceptTender||ke)&&(Fe||void 0==o.depositAmount||1!=Ia||(o.enabledMyCheckCreditCard=!0,o.enabledMyCheckPaypal=!0)):"24"==pa[ya].paymentMethod?("IATA"!=ha[0].acceptTender||ke)&&(Fe||void 0==o.depositAmount||1!=Ia||(o.enabledMyCheckCreditCard=!0,o.enabledMyCheckApplePay=!0)):"25"==pa[ya].paymentMethod&&("IATA"!=ha[0].acceptTender||ke)&&(Fe||void 0==o.depositAmount||1!=Ia||(o.enabledMyCheckCreditCard=!0,o.enabledMyCheckGpay=!0))));void 0==o.hotelDesc.paymentProviders&&(o.enableCreditCard=!0),o.payment={method:"CREDIT"},o.payment={bank:""},o.paymentProvider=function(e){o.credit=!1,o.paypal=!1,o.ideal=!1,o.xpaywechat=!1,o.xpayalipay=!1,o.xpaypaypal=!1,o.xpaycredit=!1,o.secure3D=!1,o.adyenDotPay=!1,o.payment.bank="","credit"==e?o.credit=!0:"paypal"==e?(o.paypal=!0,o.enableIngenico=!1,o.nameOnCard=void 0,o.cardNumber=void 0,o.expiry=void 0,o.cvv=void 0):"ideal"==e?(o.ideal=!0,o.enableIngenico=!1,o.nameOnCard=void 0,o.cardNumber=void 0,o.expiry=void 0,o.cvv=void 0):"ingenico"==e?(o.ingenico=!0,o.enableIngenico=!0,o.ideal=!1,o.paypal=!1,o.nameOnCard=void 0,o.cardNumber=void 0,o.expiry=void 0,o.cvv=void 0):"reddot"==e?(o.reddot=!0,o.nameOnCard=void 0,o.cardNumber=void 0,o.expiry=void 0,o.cvv=void 0):"paymentexpress"==e?(o.paymentexpress=!0,o.nameOnCard=void 0,o.cardNumber=void 0,o.expiry=void 0,o.cvv=void 0):"nets"==e?(o.nets=!0,o.nameOnCard=void 0,o.cardNumber=void 0,o.expiry=void 0,o.cvv=void 0):"xpaycreditcard"==e?(o.xpaycredit=!0,o.nameOnCard=void 0,o.cardNumber=void 0,o.expiry=void 0,o.cvv=void 0):"xpaypaypal"==e?(o.xpaypaypal=!0,o.nameOnCard=void 0,o.cardNumber=void 0,o.expiry=void 0,o.cvv=void 0):"xpaywechat"==e?(o.xpaywechat=!0,o.nameOnCard=void 0,o.cardNumber=void 0,o.expiry=void 0,o.cvv=void 0):"xpayalipay"==e?(o.xpayalipay=!0,o.nameOnCard=void 0,o.cardNumber=void 0,o.expiry=void 0,o.cvv=void 0):"dotpay"==e?(o.adyenDotPay=!0,o.nameOnCard=void 0,o.cardNumber=void 0,o.expiry=void 0,o.cvv=void 0):"mbank"!=e&&"ipko"!=e&&"przelew24"!=e&&"ing"!=e&&"millennium"!=e&&"aliorbank"!=e&&"citihandlowy"!=e&&"eurobank"!=e&&"rprzelew"!=e&&"blik"!=e||(o.adyenDotPay=!0,o.nameOnCard=void 0,o.cardNumber=void 0,o.expiry=void 0,o.cvv=void 0,o.payment.bank=e)},o.paymentType={},o.changeIngenicoPaymentType=function(e){o.paymentType.type=e,"alternatePayment"==e?o.alternatePaymentIngenico=!0:(o.alternatePaymentIngenico=!1,o.enableIngenico=!0,o.paypal=!1,o.ideal=!1)},o.changeIngenicoPaymentType("creditCard");var pa=o.hotelDesc.paymentProviders,Da=0;if(void 0!=pa)if("deposit"==Qe.policies.guaranteePolicies[0].policyType.toLowerCase()||Me)for(var Ta=0;Ta<pa.length;Ta++)void 0!=pa[Ta].paymentMethod&&("4"==pa[Ta].paymentMethod&&"altpayment-xpay"!=pa[Ta].vendorKey&&"altpayment-mycheck"!=pa[Ta].vendorKey&&"altpayment-braintree"!=pa[Ta].vendorKey?("IATA"!=ha[0].acceptTender||ke)&&(Fe||void 0==o.depositAmount||1!=Ia?(o.credit=!0,Da++):(o.enablePayPal=!0,o.paymentMethodTitle="Paypal",Da++)):"4"==pa[Ta].paymentMethod&&"altpayment-xpay"==pa[Ta].vendorKey&&"altpayment-mycheck"!=pa[Ta].vendorKey&&"altpayment-braintree"!=pa[Ta].vendorKey?("IATA"!=ha[0].acceptTender||ke)&&(void 0!=o.depositAmount&&1==Ia?(o.enableXpayPayPal=!0,o.paymentMethodTitle="Paypal",Da++):(o.xpaycredit=!0,Da++)):"4"==pa[Ta].paymentMethod&&"altpayment-mycheck"==pa[Ta].vendorKey?("IATA"!=ha[0].acceptTender||ke)&&(void 0!=o.depositAmount&&1==Ia?(o.enabledMyCheckPaypal=!0,o.paymentMethodTitle="Paypal",Da++):(o.enabledMyCheckCreditCard=!0,Da++)):"24"==pa[Ta].paymentMethod&&"altpayment-mycheck"==pa[Ta].vendorKey?("IATA"!=ha[0].acceptTender||ke)&&(void 0!=o.depositAmount&&1==Ia?(o.enabledMyCheckApplePay=!0,o.paymentMethodTitle="ApplyPay",Da++):(o.enabledMyCheckCreditCard=!0,Da++)):"25"==pa[Ta].paymentMethod&&"altpayment-mycheck"==pa[Ta].vendorKey?("IATA"!=ha[0].acceptTender||ke)&&(void 0!=o.depositAmount&&1==Ia?(o.enabledMyCheckGpay=!0,o.paymentMethodTitle="GooglePay",Da++):(o.enabledMyCheckCreditCard=!0,Da++)):"1"==pa[Ta].paymentMethod&&"creditcard-xpay"==pa[Ta].vendorKey?("IATA"!=ha[0].acceptTender||ke)&&void 0!=o.depositAmount&&1==Ia&&("creditcard-xpay"==pa[Ta].vendorKey&&pa.length>1?o.enableXpayCreditCard=!0:"creditcard-xpay"==pa[Ta].vendorKey&&(o.xpaycredit=!0),o.paymentMethodTitle="Credit Card",Da++):"1"==pa[Ta].paymentMethod&&"creditcard-mycheck"==pa[Ta].vendorKey?("IATA"!=ha[0].acceptTender||ke)&&(void 0!=o.depositAmount&&1==Ia?(o.enabledMyCheckCreditCard=!0,o.paymentMethodTitle="MyCheck CreditCard",Da++):(o.enabledMyCheckCreditCard=!0,Da++)):"1"==pa[Ta].paymentMethod&&"creditcard-xpay"!=pa[Ta].vendorKey&&"creditcard-mycheck"!=pa[Ta].vendorKey&&"creditcard-braintree"!=pa[Ta].vendorKey&&"creditcard-amadeus"!=pa[Ta].vendorKey?(o.enableCreditCard=!0,o.paymentMethodTitle="Credit Card",Da++):"3"==pa[Ta].paymentMethod?("IATA"!=ha[0].acceptTender||ke)&&(Fe||void 0==o.depositAmount||1!=Ia||1!=ba?(o.credit=!0,Da++):(o.enableIDeal=!0,o.paymentMethodTitle="iDeal",Da++)):"2"==pa[Ta].paymentMethod&&"creditcard-braintree"!=pa[Ta].vendorKey&&"creditcard-amadeus"!=pa[Ta].vendorKey?("IATA"!=ha[0].acceptTender||ke)&&(void 0!=o.depositAmount&&1==Ia?(o.enable3DSecure=!0,o.enableCreditCard=!0,o.paymentMethodTitle="3D-Secure",Da++):(o.credit=!0,Da++)):"12"==pa[Ta].paymentMethod?("IATA"!=ha[0].acceptTender||ke)&&(void 0!=o.depositAmount&&1==Ia?(o.enableXpayAliPay=!0,o.paymentMethodTitle="AliPay",Da++):(o.xpaycredit=!0,Da++)):"13"==pa[Ta].paymentMethod?("IATA"!=ha[0].acceptTender||ke)&&(void 0!=o.depositAmount&&1==Ia?(o.enableXpayWeChat=!0,o.paymentMethodTitle="WeChat",Da++):(o.xpaycredit=!0,Da++)):14!=pa[Ta].paymentMethod&&15!=pa[Ta].paymentMethod&&16!=pa[Ta].paymentMethod&&17!=pa[Ta].paymentMethod&&18!=pa[Ta].paymentMethod&&19!=pa[Ta].paymentMethod&&20!=pa[Ta].paymentMethod&&21!=pa[Ta].paymentMethod&&22!=pa[Ta].paymentMethod||("IATA"!=ha[0].acceptTender||ke)&&(Fe||void 0==o.depositAmount||1!=Ia?(o.credit=!0,Da++):(o.enableAdyenDotPay=!0,Da++)));else{o.credit=!0;for(var Ta=0;Ta<pa.length;Ta++)void 0!=pa[Ta].paymentMethod&&("1"==pa[Ta].paymentMethod&&"creditcard-xpay"==pa[Ta].vendorKey?(o.xpaycredit=!0,o.credit=!1):"1"==pa[Ta].paymentMethod&&"creditcard-mycheck"==pa[Ta].vendorKey?(o.enabledMyCheckCreditCard=!0,o.credit=!1):"1"==pa[Ta].paymentMethod&&"creditcard-braintree"==pa[Ta].vendorKey?o.credit=!1:"1"==pa[Ta].paymentMethod&&"creditcard-amadeus"==pa[Ta].vendorKey&&(o.credit=!1))}else o.credit=!0;if("deposit"==Qe.policies.guaranteePolicies[0].policyType.toLowerCase()||Me){if(1==Da)"Credit Card"==o.paymentMethodTitle?o.paymentProvider("credit"):Fe||"iDeal"!=o.paymentMethodTitle?Fe||"Paypal"!=o.paymentMethodTitle?"3D-Secure"==o.paymentMethodTitle&&o.paymentProvider("credit"):o.paymentProvider("paypal"):o.paymentProvider("ideal");else if(o.enableCreditCard)o.payment.method="CREDIT",o.paymentProvider("credit");else if(void 0!=pa&&pa.length>0){var Oa=pa[0];!Fe&&"4"==Oa.paymentMethod&&o.enablePayPal&&(o.payment.method="PAYPAL",o.paymentProvider("paypal")),!Fe&&"3"==Oa.paymentMethod&&o.enableIDeal&&(o.payment.method="IDEAL",o.paymentProvider("ideal")),("2"==Oa.paymentMethod&&o.enable3DSecure||"1"==Oa.paymentMethod&&o.enableCreditCard)&&(o.payment.method="CREDIT",o.paymentProvider("credit")),("1"==Oa.paymentMethod&&o.enableXpayCreditCard||"4"==Oa.paymentMethod&&o.enableXpayPayPal||"12"==Oa.paymentMethod&&o.enableXpayAliPay||"13"==Oa.paymentMethod&&o.enableXpayWeChat)&&(o.payment.method="XPAYCREDITCARD",o.paymentProvider("xpaycreditcard"))}}else if("guarantee"==Qe.policies.guaranteePolicies[0].policyType.toLowerCase()&&void 0!=o.alternatePaymentOptionsFromHotelDec&&o.alternatePaymentOptionsFromHotelDec.length>0)for(var ya=o.alternatePaymentOptionsFromHotelDec.length-1;ya>=0;ya--)void 0==o.alternatePaymentOptionsFromHotelDec[ya].vendorKey||"altpayment-mycheck"!=o.alternatePaymentOptionsFromHotelDec[ya].vendorKey||void 0==o.alternatePaymentOptionsFromHotelDec[ya].paymentMethod||4!=o.alternatePaymentOptionsFromHotelDec[ya].paymentMethod&&24!=o.alternatePaymentOptionsFromHotelDec[ya].paymentMethod&&25!=o.alternatePaymentOptionsFromHotelDec[ya].paymentMethod||o.enabledMyCheckPaypal||o.enabledMyCheckApplePay||o.enabledMyCheckGpay||o.alternatePaymentOptionsFromHotelDec.splice(ya,1);var pa=o.hotelDesc.paymentProviders;if(void 0!=pa&&pa.length>0)for(var ya=0;ya<pa.length;ya++){if(void 0!=pa[ya].vendorKey&&"creditcard-ingenico"==pa[ya].vendorKey&&void 0!=pa[ya].paymentMethod&&1==pa[ya].paymentMethod){o.paymentProvider("ingenico"),o.enableCreditCard=!1,o.enable3DSecure=!1,o.credit=!1;break}if(void 0!=pa[ya].vendorKey&&"creditcard-paymentexpress"==pa[ya].vendorKey&&void 0!=pa[ya].paymentMethod&&1==pa[ya].paymentMethod){o.paymentProvider("paymentexpress"),o.enablePayPal=!1,o.enableIDeal=!1,o.enableCreditCard=!1,o.enable3DSecure=!1,o.credit=!1;break}if(void 0!=pa[ya].vendorKey&&"allpayment-reddot"==pa[ya].vendorKey&&void 0!=pa[ya].paymentMethod&&7==pa[ya].paymentMethod){o.paymentProvider("reddot"),o.enablePayPal=!1,o.enableIDeal=!1,o.enableCreditCard=!1,o.enable3DSecure=!1,o.credit=!1;break}if(void 0!=pa[ya].vendorKey&&"creditcard-nets"==pa[ya].vendorKey&&void 0!=pa[ya].paymentMethod&&1==pa[ya].paymentMethod){o.paymentProvider("nets"),o.enablePayPal=!1,o.enableIDeal=!1,o.enableCreditCard=!1,o.enable3DSecure=!1,o.credit=!1;break}if(void 0!=pa[ya].vendorKey&&"creditcard-xpay"==pa[ya].vendorKey&&void 0!=pa[ya].paymentMethod&&1==pa[ya].paymentMethod){o.paymentProvider("xpaycreditcard"),o.enablePayPal=!1,o.enableIDeal=!1,o.enableCreditCard=!1,o.enable3DSecure=!1,o.credit=!1;break}}1==o.enableCreditCard&&0==o.enablePayPal&&0==o.enableIDeal&&0==o.enableAdyenDotPay&&(o.enableCreditCard=!1),o.customValidity=!1,o.toggleCustomValidity=function(e){o.customValidity=e},o.mainReservation=i.getMainReservation();var Ea=o.hotelDesc.policies.guaranteePaymentPolicy.acceptPayments;o.acceptedCreditCards=Ea,o.acceptedCreditCards=v.without(o.acceptedCreditCards,v.findWhere(o.acceptedCreditCards,{cardCode:"Switch"})),o.acceptedCreditCards=v.without(o.acceptedCreditCards,v.findWhere(o.acceptedCreditCards,{cardCode:"CB"})),o.acceptedCreditCardsLogos=angular.copy(o.acceptedCreditCards),o.enable3DSecure&&(v.findWhere(o.acceptedCreditCardsLogos,{cardCode:"VI"})&&(o.secure3DLogo.visa=!0,o.acceptedCreditCardsLogos=v.without(o.acceptedCreditCardsLogos,v.findWhere(o.acceptedCreditCardsLogos,{cardCode:"VI"}))),v.findWhere(o.acceptedCreditCardsLogos,{cardCode:"AX"})&&(o.secure3DLogo.amex=!0,o.acceptedCreditCardsLogos=v.without(o.acceptedCreditCardsLogos,v.findWhere(o.acceptedCreditCardsLogos,{cardCode:"AX"}))),v.findWhere(o.acceptedCreditCardsLogos,{cardCode:"JC"})&&(o.secure3DLogo.jcb=!0,o.acceptedCreditCardsLogos=v.without(o.acceptedCreditCardsLogos,v.findWhere(o.acceptedCreditCardsLogos,{cardCode:"JC"}))),v.findWhere(o.acceptedCreditCardsLogos,{cardCode:"MC"})&&(o.secure3DLogo.master=!0,o.acceptedCreditCardsLogos=v.without(o.acceptedCreditCardsLogos,v.findWhere(o.acceptedCreditCardsLogos,{cardCode:"MC"})))),o.selectedCountry="1"==o.ResAndPayConfig.defaultCountry?o.hotelDesc.address.countryCode:null,o.textualPolicies=o.mainReservation.policies.textualPolicies,o.isModifyReservation=i.canModifyReservation(),1==i.getConfig("POST_BOOKING_ENHANCEMENT")&&(o.isModifyReservation=!0,l.getUxConfiguration().interactiveMessagesEnabled&&(g.clear(),g.pop({type:"info",title:"",body:o.translate.Page_pleaseconfirmyourchanges_PleaseConfirmYourChangesMsgl,timeout:3e3})));var Ma=function(){delete p.stepsById.accommodations.ratePlan,p.stepsById.accommodations.id="accommodations",p.stepsById.accommodations.label="Accommodations",void 0==p.stepsById.accommodations.package&&void 0==p.stepsById.accommodations.group?(p.stepsById.accommodations.placeholder=t.translate.global_header_lblSelect,t.accommodations=!1):void 0==p.stepsById.accommodations.package&&(p.stepsById.accommodations.placeholder=t.translate.global_header_lblSelect,t.accommodations=!1),p.stepsById.accommodations.className="Header-step--extended",p.stepsById.accommodations.rooms=[],B(),i.revertAccommadationRooms(),i.revertServices()};o.continueDeleteRoom=function(){var e=!1;i.getConfig("delete_room_in_roomselector")?(t.$broadcast(y.REMOVE_CONFIRM_DELETE_ROOM_ROOMSELECTOR),i.deleteConfig("delete_room_in_roomselector")):t.MRB?(i.dropPromotion(),e=!0,Ma(),t.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),t.reservationArray=i.getMainReservationArray(),r.go("accommodation")):(i.dropPromotion(),Ma(),t.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),r.go("accommodation")),P.onModalClose(),o.deleteRoom="display-none",t.MRB&&1!=e&&r.is("total")&&(1==i.getMainReservationArray().length&&void 0==i.getMainReservationArray()[0].roomStays[0].roomRates[0].roomTypeCode?r.go("accommodation"):o.confirmBookRoomSelector())},o.$on(y.REMOVE_ACCOMMODATION,function(){o.deleteRoom="display-block",setTimeout(function(){P.onModalOpen("manage-rooms-link-id","delete-room-parent-id","delete-room-title-id",!1,o.cancelDeleteRoom)}),m.scrollTopAnimated(0,1e3),o.cancelDeleteRoom=function(){P.onModalClose(),o.deleteRoom="display-none",t.MRB&&o.OpenSwitchRoom(),i.deleteConfig("delete_room_in_roomselector")}}),o.$on(y.EXTENDHOLD_REMOVE_ROOM,function(){o.showModifyRetrieveEHModal="display-block",setTimeout(function(){P.onModalOpen("","modify-retreieve-eh-parent-total-id","modify-retreieve-eh-title-total-id",!1,o.cancelModifyRetrieveEH)}),i.setConfig("extendhold_remove_room")});var _a=function(){t.accommodations=!1,p.stepsById.accommodations={id:"accommodations",label:"Accommodations",placeholder:"Select",placeholderMRB:p.stepsById.accommodations.placeholderMRB,className:"Header-step--extended",rooms:[]},i.revertAccommadationRooms(),i.revertAccommadationRatePlan(),i.revertServices()};o.continueDeletePackage=function(){t.MRB&&i.getMainReservationArray().length>1&&void 0!=t.deletePackageFromRoom&&t.deletePackageFromRoom.id!=i.getMainReservation().id&&(i.changeSelectRoom(t.deletePackageFromRoom.id),t.$broadcast(y.MODIFY_RESERVATION),t.deletePackageFromRoom={}),i.dropPromotion(),_a(),t.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),o.deletePackage="display-none",r.go("accommodation"),t.MRB&&(t.reservationArray=i.getMainReservationArray(),p.stepsById.accommodations.placeholderMRB=i.getBookedRoomCount())},o.$on(y.REMOVE_PACKAGE,function(){o.deletePackage="display-block",o.deletePackageWindow=u.pageYOffset+180+"px",o.cancelDeletePackage=function(){o.deletePackage="display-none"}}),o.$on(y.EXTENDHOLD_REMOVE_PACKAGE,function(){o.showModifyRetrieveEHModal="display-block",setTimeout(function(){P.onModalOpen("","modify-retreieve-eh-parent-total-id","modify-retreieve-eh-title-total-id",!1,o.cancelModifyRetrieveEH)}),i.setConfig("extendhold_remove_room")});var ka=function(){delete p.stepsById.accommodations.ratePlan,p.stepsById.accommodations.id="accommodations",p.stepsById.accommodations.label="Accommodations",p.stepsById.accommodations.className="Header-step--extended",void 0==p.stepsById.accommodations.package?(p.stepsById.accommodations.placeholder=t.translate.global_header_lblSelect,t.accommodations=!1):p.stepsById.accommodations.package.length>0||(p.stepsById.accommodations.placeholder=t.translate.global_header_lblSelect,t.accommodations=!1),p.stepsById.accommodations.rooms=[],B(),i.revertAccommadationRooms(),i.revertServices()};o.continueDeleteRatePlan=function(){var e=!1;i.getConfig("delete_room_in_roomselector")?(t.$broadcast(y.REMOVE_CONFIRM_DELETE_ROOM_ROOMSELECTOR),i.deleteConfig("delete_room_in_roomselector")):t.MRB?(i.getMainReservationArray().length>1&&void 0!=t.deleteRateFromRoom&&t.deleteRateFromRoom.id!=i.getMainReservation().id&&(i.changeSelectRoom(t.deleteRateFromRoom.id),t.$broadcast(y.MODIFY_RESERVATION),t.deleteRateFromRoom={}),i.dropPromotion(),e=!0,ka(),t.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),t.reservationArray=i.getMainReservationArray(),p.stepsById.accommodations.placeholderMRB=i.getBookedRoomCount(),r.go("accommodation")):(i.dropPromotion(),ka(),t.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),r.go("accommodation")),o.deleteRatePlan="display-none",t.MRB&&1!=e&&r.is("total")&&(1==i.getMainReservationArray().length&&void 0==i.getMainReservationArray()[0].roomStays[0].roomRates[0].roomTypeCode?r.go("accommodation"):o.confirmBookRoomSelector())},o.$on(y.REMOVE_RATEPLAN,function(){o.deleteRatePlan="display-block",o.cancelDeleteRatePlan=function(){o.deleteRatePlan="display-none"}}),o.$on(y.EXTENDHOLD_REMOVE_RATEPLAN,function(){o.showModifyRetrieveEHModal="display-block",setTimeout(function(){P.onModalOpen("","modify-retreieve-eh-parent-total-id","modify-retreieve-eh-title-total-id",!1,o.cancelModifyRetrieveEH)}),i.setConfig("extendhold_remove_rateplan")}),o.$on("EVENT.GO_TO_PAGE_ON_CLICK_GNB",function(){o.showModifyRetrieveEHModal="display-block",setTimeout(function(){P.onModalOpen("","modify-retreieve-eh-parent-total-id","modify-retreieve-eh-title-total-id",!1,o.cancelModifyRetrieveEH)}),s.setObjectData("isGNBClickedInCaseEH",!0)}),o.cancelModifyRetrieveEH=function(){o.showModifyRetrieveEHModal="display-none",P.onModalClose()},o.continueModifyReservationEH=function(){d.cancelExtendHold(t.extendHoldHotelCode,t.extendHoldConfirmationCode,t.extendHoldEmail).success(function(){i.getCurrencyDetails().isMerchandisedCurrency&&l.replaceMerchandisedCurrencyObj()&&l.replaceMerchandisedCurrencyObj().currencyCode&&(i.setCurrencyDetails(l.replaceMerchandisedCurrencyObj()),i.setCurrency(l.replaceMerchandisedCurrencyObj().currencyCode),i.deleteConfig("SHOW_MERCHANDISED_CURRENCY"),t.$broadcast(y.UPDATE_CURRENCY)),s.getObjectData("isGNBClickedInCaseEH")?(s.deleteObjectData("isGNBClickedInCaseEH"),i.deleteUniqueId(),i.deleteConfig("modifyRetrieveEH"),o.showModifyRetrieveEHModal="display-none",P.onModalClose(),t.$broadcast("EVENT.CALL_GO_TO_VIEW_FROM_GNB")):1==i.getConfig("extendhold_remove_room")?(i.deleteConfig("extendhold_remove_room"),Ma(),t.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),o.showModifyRetrieveEHModal="display-none",P.onModalClose(),r.go("accommodation")):1==i.getConfig("extendhold_remove_package")?(i.deleteConfig("extendhold_remove_package"),_a(),t.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),o.showModifyRetrieveEHModal="display-none",P.onModalClose(),r.go("accommodation")):1==i.getConfig("extendhold_remove_rateplan")&&(i.deleteConfig("extendhold_remove_rateplan"),ka(),t.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),o.deleteRatePlan="display-none",r.go("accommodation")),i.deleteUniqueId(),i.deleteConfig("modifyRetrieveEH")}).error(function(){})};var Na=l.getCountries();o.countries=c("orderBy")(Na,"name"),o.salutation,o.states=[],o.selectedGuestId,o.postalcode,o.selectedBillingCountry,o.months=["01","02","03","04","05","06","07","08","09","10","11","12"],o.month,o.currentYear=(new Date).getFullYear(),o.selectedExpirationPast=!1,o.useSameContactAddress=!0,o.termsAndConditionsDisplayFormat=o.ResAndPayConfig.termsAndConditionsDisplayFormat,o.privacyPolicyEnabled=o.ResAndPayConfig.privacyPolicyEnabled,o.tc={confirmCheck:!1},o.enableBookerOption=l.getEnableBookerOption(),o.showBooker=!1,o.bookerInfo={salutation:null,firstName:"",lastName:"",email:""},o.showHideBookerSection=S.getIsLoyaltyUserLogIn(),o.bookerEmailRegex=null,o.changeShowBooker=function(){o.bookerEmailRegex=o.showBooker?o.emailRegex:null},l.getUxConfiguration().interactiveMessagesEnabled&&!1===i.getVisitedConfirmReservationPage()&&1!=o.isModifyReservation&&(g.clear(),g.pop({type:"info",title:"",body:o.translate.page_greatchoicepleasefilloutinformationbelow_GreatChoiceFillOutInfoMsg,timeout:3e3}),i.setVisitedConfirmReservationPage(!0)),o.showTCModalPopup=function(e){o.showTCModal="display-block",o.TCPopupWindow=u.pageYOffset+40+"px";var a=0;setTimeout(function(){"TC"==e?a=angular.element(document.getElementById("roomPolicies")).prop("offsetTop"):"PP"==e&&(a=angular.element(document.getElementById("tc1")).prop("offsetTop")),angular.element(document.getElementById("divWrap")).scrollTop(a-25)},100),"TC"==e?P.onModalOpen("TnC-id","TermsAndConditions-parent","terms-and-conditions-header-id",!1,o.declineTC):P.onModalOpen("privacy-policy-id","TermsAndConditions-parent","terms-and-conditions-header-id",!1,o.declineTC)},o.declineTC=function(){o.showTCModal="display-none",P.onModalClose(),o.isBrainTreePaymentEnabled&&(o.enableBrainTreeButton=!0),o.isAmadeusPaymentEnabled&&(o.enableAmadeusButton=!0),!l.getCybersource3DSV2Enabled()||o.paypal||o.ideal||(o.enabledCybersourceButton=!0)},o.agreeTC=function(){return o.showTCModal="display-none",P.onModalClose(),1==o.termsAndConditionsDisplayFormat?void(o.tc.confirmCheck=!0):void("deposit"==Qe.policies.guaranteePolicies[0].policyType.toLowerCase()||Me?(t.MRB&&void 0!=o.itineraryDepositAmt||!t.MRB&&Qe.roomStays[0].depositPayments.depositAmt)&&("IATA"!=Qe.policies.guaranteePolicies[0].acceptTender||ke)?o.showConfirmationPaymentPopup():!o.isBrainTreePaymentEnabled&&!o.isAmadeusPaymentEnabled||o.bookNowDisplay?l.getCybersource3DSV2Enabled()&&!o.paypal&&!o.ideal&&o.creditCardFieldRequiredIndicator?o.payerAuthCallForCybersource():o.booknow():u.TCCommonService.EventService.broadcast(document,"EVT_WC_PAYMENTS_ON_GET_PAYMENT_DETAILS"):("guarantee"==Qe.policies.guaranteePolicies[0].policyType.toLowerCase()||Ne)&&(!o.isBrainTreePaymentEnabled&&!o.isAmadeusPaymentEnabled||o.bookNowDisplay?l.getCybersource3DSV2Enabled()&&!o.paypal&&!o.ideal&&o.creditCardFieldRequiredIndicator?o.payerAuthCallForCybersource():o.booknow():u.TCCommonService.EventService.broadcast(document,"EVT_WC_PAYMENTS_ON_GET_PAYMENT_DETAILS")))},o.showConfirmationPaymentPopup=function(){var e=X();if(-1!==e&&e>=parseFloat(o.depositAmount)){if((o.isBrainTreePaymentEnabled||o.isAmadeusPaymentEnabled)&&!o.bookNowDisplay)return void u.TCCommonService.EventService.broadcast(document,"EVT_WC_PAYMENTS_ON_GET_PAYMENT_DETAILS");if(!l.getCybersource3DSV2Enabled()||o.paypal||o.ideal||!o.creditCardFieldRequiredIndicator)return void o.booknow();o.payerAuthCallForCybersource()}else if(-1!==e){var a=o.depositAmount-e;o.depositAmt=F(a)}else o.depositAmt=F(o.depositAmount);if(m.scrollTopAnimated(0,1e3),o.showPaymentConfirmationModal="display-block",o.finalPriceMessage=o.depositAmt+t.translate.global_yourcreditcardwillbecharged_YourCreditCardWillBeChargedMsg,o.insuranceObj&&o.insuranceObj.selectedInsurance&&o.isInsuranceSelected&&t.translate["page_chargedforyourstay-Msgchargedforyourstay"]&&!o.insuranceObj.isInsuranceSuccessReservationFails){o.finalPriceMessage=t.translate["page_chargedforyourstay-Msgchargedforyourstay"];var r=o.finalPriceMessage.indexOf("#",1);o.finalPriceMessage=o.finalPriceMessage.substring(0,r+1)+"<br>"+o.finalPriceMessage.substring(r+1),o.finalPriceMessage=c("replaceHashMRB")(o.finalPriceMessage,o.depositAmt,o.insuranceTotalPrice)}setTimeout(function(){P.onModalOpen("book-button-id","final-payment-conf-modal-parent","payment-conf-title-id",!1,o.cancelPaymentConfirmation)})},o.cancelPaymentConfirmation=function(){o.isBrainTreePaymentEnabled&&(o.enableBrainTreeButton=!0),o.isAmadeusPaymentEnabled&&(o.enableAmadeusButton=!0),!l.getCybersource3DSV2Enabled()||o.paypal||o.ideal||(o.enabledCybersourceButton=!0),o.showPaymentConfirmationModal="display-none",P.onModalClose()},o.submitPaymentConfirmation=function(){o.showPaymentConfirmationModal="display-none",P.onModalClose(),!o.isBrainTreePaymentEnabled&&!o.isAmadeusPaymentEnabled||o.bookNowDisplay?l.getCybersource3DSV2Enabled()&&!o.paypal&&!o.ideal&&o.creditCardFieldRequiredIndicator?o.payerAuthCallForCybersource():o.booknow():u.TCCommonService.EventService.broadcast(document,"EVT_WC_PAYMENTS_ON_GET_PAYMENT_DETAILS")},o.closeTCPopup=function(){o.showTCModal="display-none"},o.ccTypeMap;var La=[{ccType:"MasterCard",newMapping:"MC",linkMapping:"MasterCard"},{ccType:"Visa",newMapping:"VI",linkMapping:"Visa"},{ccType:"AmericanExpress",newMapping:"AX",linkMapping:"Amex"},{ccType:"Discover",newMapping:"DS",linkMapping:"Discover"},{ccType:"JCB",newMapping:"JC",linkMapping:"JCBCard"},{ccType:"Switch",newMapping:"Switch",linkMapping:"Switch"},{ccType:"UnionPay",newMapping:"CUP",linkMapping:"Cup"},{ccType:"DinersClub/CarteBlanche",newMapping:"DN",linkMapping:"DinersClub"},{ccType:"CarteBlanche",newMapping:"CB",linkMapping:"DinersClub"},{ccType:"MIR",newMapping:"MIR",linkMapping:"MIR"},{ccType:"NARANJA",newMapping:"NARANJA",linkMapping:"NARANJA"},{ccType:"SHOPPING",newMapping:"SHOPPING",linkMapping:"SHOPPING"},{ccType:"CABAL",newMapping:"CABAL",linkMapping:"CABAL"},{ccType:"ARGENCARD",newMapping:"ARGENCARD",linkMapping:"ARGENCARD"},{ccType:"CENCOSUD",newMapping:"CENCOSUD",linkMapping:"CENCOSUD"}];o.getBillingDetails=function(){o.isAmadeusPaymentEnabled&&(billAddress={addressLine1:o.address1,addressLine2:o.address2,cityName:o.city,countryCode:o.selectedCountry,countryName:o.selectedCountry,postalCode:o.postalcode,stateCode:o.selectedState,stateName:o.selectedState,useType:""},k.setBillingAddress(billAddress),o.billingAddress=JSON.stringify(k.getBillingAddress()))},o.countryChange=function(){if(o.selectedCountry){var e=c("filter")(o.countries,{code:o.selectedCountry});if(e&&e.length>0){var a=e[0].states;o.states=c("orderBy")(a,"name")}else o.states=[]}else o.states=[];if(o.insuranceObj&&o.insuranceObj.showInsurance){var t={countryCode:o.selectedCountry,stateCode:""};o.states&&o.states.map(function(e){return e.code}).indexOf(o.selectedState)>-1&&(t.stateCode=o.selectedState),o.initializeInsuranceOnDataUpdate(t)}},o.selectedCountry&&o.countryChange(),o.billingCountryChange=function(){
if(o.selectedBillingCountry){var e=c("filter")(o.countries,{code:o.selectedBillingCountry}),a=e[0].states;o.billingStates=c("orderBy")(a,"name")}else o.billingStates=[]},o.stateChange=function(e){if(o.selectedState=e,a.debug(o.selectedState+"   this is States"),o.selectedState){var t=c("filter")(o.states,{code:o.selectedState}),e=t[0];o.stateName=e.name}else o.selectedState=null,o.stateName=null;if(o.insuranceObj&&o.insuranceObj.showInsurance&&"US"===o.selectedCountry){var r={stateCode:o.selectedState,countryCode:o.selectedCountry};o.initializeInsuranceOnDataUpdate(r)}},o.billingStateChange=function(e){if(o.selectedBillingState=e,o.selectedBillingState){var a=c("filter")(o.billingStates,{code:o.selectedBillingState}),t=a[0];o.selectedBillingStateName=t.name}else o.selectedBillingState=null,o.selectedBillingStateName=null},o.closeConfirmPopup=function(){o.showConfirmModal="display-none"},o.passDeviceSessionIdToScript=function(e,a){var t;a?v.forEach(e,function(e){e.deviceSessionId&&(t=e.deviceSessionId)}):t=e.deviceSessionId;var o=document.createElement("script");o.type="text/javascript",o.src="https://maf.pagosonline.net/ws/fp/check.js?id="+t+"80200";var r=document.createElement("noscript"),n=document.createElement("iframe");n.className="sessionIdIframe",n.src="https://maf.pagosonline.net/ws/fp/check.js?id="+t+"80200",r.appendChild(n),document.getElementsByTagName("head")[0]&&(document.getElementsByTagName("head")[0].appendChild(o),document.getElementsByTagName("head")[0].appendChild(r))},o.callReservationAPI=function(e,n){var s=l.getHotelDesc().paymentProviders;void 0!=s&&s.length>0&&void 0!=s[0].vendorKey&&void 0!=s[0].paymentMethod&&"creditcard-payu_latam"==s[0].vendorKey&&1==s[0].paymentMethod&&o.passDeviceSessionIdToScript(e,n),a.debug(JSON.stringify(e)+"requestData"),t.gmsPromoCode&&i.addGmsRateAccessCodeInReservation(e),d.callReservation(ea,e,n).success(function(n){if(i.handleXssVulnerabilities(n),t.gmsPromoCode&&(t.MRB?i.removeRateAccessCodeInReservation(n.reservationResponses,e):i.removeRateAccessCodeInReservation(n,e)),g.clear(),t.MRB){var s=i.validateMultiRoomCommitResponse(n.reservationResponses);if(0==s.isError)i.setMrbItineraryTotals(n.itineraryTotals),i.setMrbItineraryPaymentInfo(n.itineraryPaymentInfo),i.setMainReservationByEqual(n.reservationResponses),p.stepsById.total.placeholder=i.getTotalReservationAmount(),t.arrivedConfirmation=!0,r.go("confirmation");else{o.isBrainTreePaymentEnabled&&(o.enableBrainTreeButton=!0),o.isAmadeusPaymentEnabled&&(o.enableAmadeusButton=!0),!l.getCybersource3DSV2Enabled()||o.paypal||o.ideal||(o.enabledCybersourceButton=!0),o.clearOnFocus=!1;var c,d,m=s.errorInfo?s.errorInfo:void 0;m&&(c=m.errorCode,d=m.errorMessage,o.isAmadeusPaymentEnabled&&u.TCCommonService.EventService.broadcast(document,"EVT_WC_PAYMENTS_ON_RELOAD_AMADEUS_WIDGET")),ze.indexOf(c)>-1&&void 0!=c?(t.roomUnavailableMsg=d,o.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:t.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):We.indexOf(c)>-1&&void 0!=c?(t.roomUnavailableMsg=d,o.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:t.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:t.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})),o.revertOFACInfo()}}else i.setReservation(n),p.stepsById.total.placeholder=i.getTotalReservationAmount(),t.arrivedConfirmation=!0,r.go("confirmation");a.debug(JSON.stringify(n)+"this is data in second API");var y;if(1==t.MRB)for(var v=0;v<n.reservationResponses.length;v++)y=void 0==y?n.reservationResponses[v].uniqueId:y+","+n.reservationResponses[v].uniqueId;else y=n.uniqueId;f.eventTrack("confirmBooking",{category:"UserNavigation",label:y}),o.clearInsuranceDataFromReservationService()}).error(function(e){t.MRB&&i.revertGuaranteesAcceptedObject(),o.isBrainTreePaymentEnabled&&(o.enableBrainTreeButton=!0),o.isAmadeusPaymentEnabled&&(o.enableAmadeusButton=!0),!l.getCybersource3DSV2Enabled()||o.paypal||o.ideal||(o.enabledCybersourceButton=!0),o.clearOnFocus=!1;var a,n,s,c=e.errors?e.errors:void 0;if(c){a=c[0].errorCode,n=c[0].errorMessage;for(var d=0;d<c.length;d++)"BAD_REQUEST"==c[d].errorCode&&(s=c[d].errorCode);o.isAmadeusPaymentEnabled&&u.TCCommonService.EventService.broadcast(document,"EVT_WC_PAYMENTS_ON_RELOAD_AMADEUS_WIDGET")}Ye.indexOf(a)>-1&&void 0!=a?(t.roomUnavailableMsg=n,r.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:t.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):je.indexOf(a)>-1&&void 0!=a?(t.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:t.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):ze.indexOf(a)>-1&&void 0!=a?(t.roomUnavailableMsg=n,o.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:t.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):We.indexOf(a)>-1&&void 0!=a?(t.roomUnavailableMsg=n,o.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:t.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):c.length>0&&c[0].errorCode&&c[0].errorCode.toLowerCase()==="UNABLE_TO_LOCK_OFFER".toLowerCase()?(o.showMessageOnCosmoFailure=!0,u.scrollTo(0,0)):s?(o.clearGuestDeatilsForInvalidData(),g.clear(),g.pop({type:"error",title:"",body:t.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):(g.clear(),g.pop({type:"error",title:"",body:t.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})),o.revertOFACInfo(),o.setReservationFailsFlagForInsurance()})},o.clearToaster=function(){if(o.clearOnFocus)return g.clear(),!1},o.callModifyReservationAPI=function(e){var n=l.getHotelDesc().paymentProviders;void 0!=n&&n.length>0&&void 0!=n[0].vendorKey&&void 0!=n[0].paymentMethod&&"creditcard-payu_latam"==n[0].vendorKey&&1==n[0].paymentMethod&&o.passDeviceSessionIdToScript(e),a.debug(JSON.stringify(e)+"requestData 2"),(o.ingenico||o.paymentexpress||o.reddot||o.nets||o.xpaywechat||o.xpayalipay||o.xpaypaypal||o.xpaycredit||o.adyenDotPay||o.enabledMyCheckCreditCard&&o.bookNowDisplay)&&void 0!=e.resGlobalInfo.guaranteesAccepted[0].paymentCard&&delete e.resGlobalInfo.guaranteesAccepted[0].paymentCard,t.gmsPromoCode&&i.addGmsRateAccessCodeInReservation(e),d.callModifyReservation(ea,e).success(function(n){t.gmsPromoCode&&i.removeRateAccessCodeInReservation(n,e),g.clear(),i.setReservation(n),a.debug(JSON.stringify(i.getMainReservation())+"this is flag"),p.stepsById.total.placeholder=i.getTotalReservationAmount(),t.arrivedConfirmation=!0,r.go("confirmation"),f.eventTrack("confirmBooking",{category:"UserNavigation",label:n.uniqueId}),o.clearInsuranceDataFromReservationService()}).error(function(e){o.clearOnFocus=!1;var a,n,i,s=e.errors?e.errors:void 0;if(s){a=s[0].errorCode,n=s[0].errorMessage;for(var l=0;l<s.length;l++)"BAD_REQUEST"==s[l].errorCode&&(i=s[l].errorCode)}Ye.indexOf(a)>-1&&void 0!=a?(t.roomUnavailableMsg=n,r.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:t.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):je.indexOf(a)>-1&&void 0!=a?(t.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:t.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):ze.indexOf(a)>-1&&void 0!=a?(t.roomUnavailableMsg=n,o.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:t.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):We.indexOf(a)>-1&&void 0!=a?(t.roomUnavailableMsg=n,o.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:t.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):s.length>0&&s[0].errorCode&&s[0].errorCode.toLowerCase()==="UNABLE_TO_LOCK_OFFER".toLowerCase()?(o.showMessageOnCosmoFailure=!0,u.scrollTo(0,0)):i?(o.clearGuestDeatilsForInvalidData(),g.clear(),g.pop({type:"error",title:"",body:t.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):(g.clear(),g.pop({type:"error",title:"",body:t.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})),o.revertOFACInfo(),o.setReservationFailsFlagForInsurance()})},o.parseBookingAddressList=function(){var e=[];t.MRB?e=angular.copy(o.mainReservationArray):e.push(angular.copy(Qe));var a={anyUSAddress:!1,addressList:[]},r={addressLine1:o.address1,addressLine2:o.address2,cityName:o.city,countryCode:o.selectedCountry,stateCode:o.selectedState,postalCode:o.postalcode};e[0].resGuests[0].profile.customer.address[0]=r;for(var n=Object.keys(r),i=o.singleGuestsInfo?1:e.length,s=0;s<i;s++){for(var l=[],c=e[s].resGuests[0].profile.customer.address[0],d=!1,g=0;g<n.length;g++)"addressLine1"!=n[g]||c[n[g]]||(d=!0),c&&c[n[g]]&&("US"===c.countryCode&&(a.anyUSAddress=!0),l.push(c[n[g]]));l.length&&d&&(l=[]),a.addressList.push(l.join(", "))}return a},o.booknow=function(){var n=o.parseBookingAddressList(),m=n.anyUSAddress;if(o.ofacEnabled){var h=!1;if(!o.ofacSubmitData&&o.isModifyReservation&&i.getMainReservation().additionalInfo&&i.getMainReservation().additionalInfo.length){h=-1!=v.findIndex(i.getMainReservation().additionalInfo,function(e){return"ofac"===e.type.toLowerCase()})}if(o.isModifyReservation&&h||!o.ofacSubmitData&&(o.isUSIp||m||o.ofacCitizenStatus&&o.ofacCitizenStatus.isuscitizen))return u.scrollTo(0,0),o.ofacInputData.addressList=n.addressList,o.showOFACModal=!0,void setTimeout(function(){P.onModalOpen("book-button-id","checkForUSCitizen","ofac-modal-title-id",!0,o.ofacInputData.ofacClose)},0)}if(1!=ke&&o.creditCardFieldRequiredIndicator&&o.guaranteeIngenico&&!o.bookNowDisplay&&o.ingenico&&o.enableIngenico){if(void 0!=l.getUxConfiguration().reservationAndPaymentConfig.overrideVariantIdsLst)for(var R=0;R<l.getUxConfiguration().reservationAndPaymentConfig.overrideVariantIdsLst.length;R++)l.getUxConfiguration().reservationAndPaymentConfig.overrideVariantIdsLst[R].themeId==l.getBrandInfo().themeId&&(va=l.getUxConfiguration().reservationAndPaymentConfig.overrideVariantIdsLst[R].validationVariantId);void 0==va&&void 0!=l.getUxConfiguration().reservationAndPaymentConfig&&(va=l.getUxConfiguration().reservationAndPaymentConfig.validationVariantId)}var f=o.GuestsTotalForm.cardnumber.$ccType,C=l.getHotelDesc().enableGuarantee3DS;if(C){var I=l.getPaymentProviders();if(void 0!=I&&I.length>0)var D=c("filter")(I,function(e){if(1==e.paymentMethod&&("creditcard-adyen"==e.vendorKey||"credcard-cybersource"==e.vendorKey))return!0}),T=c("filter")(I,function(e){if(1==e.paymentMethod&&"credcard-cybersource"==e.vendorKey)return!0});var O=l.getHotelDesc().creditCardMode;(D&&0==D.length||T&&O&&"validateonly"===O.toLowerCase()&&o.isModifyReservation)&&(C=!1)}if(void 0!==f&&o.credit&&o.enable3DSecure?o.secure3DLogo.visa&&"visa"===f.toLowerCase()||o.secure3DLogo.master&&"mastercard"===f.toLowerCase()||o.secure3DLogo.jcb&&"jcb"===f.toLowerCase()||o.secure3DLogo.amex&&"americanexpress"===f.toLowerCase()||"switch"===f.toLowerCase()||C?o.secure3D=!0:o.secure3D=!1:(o.creditCardFieldRequiredIndicator&&o.showCreditCardFields||o.creditCardFieldRequiredIndicator&&!o.showCreditCardFields||!o.creditCardFieldRequiredIndicator&&o.showCreditCardFields)&&"deposit"!=Qe.policies.guaranteePolicies[0].policyType.toLowerCase()&&C&&!o.payment.bank&&!o.groupPaymentMethod?o.showCreditCardFields?void 0!=o.nameOnCard&&void 0!=o.cardNumber?o.secure3D=!0:o.secure3D=!1:o.secure3D=!0:o.secure3D=!1,o.secure3D&&u._3DSecureLogs&&H("3DSecureBookButtonClick - Modify Flow - "+i.canModifyReservation()),l.getEnableInsurance()&&o.insuranceObj&&o.insuranceObj.showInsurance&&o.insuranceObj.selectedInsurance&&o.insuranceObj.selectedInsurance.selectionStatus?u.dataLayer.push({ihInsurancePurchased:"ACCEPTED"===o.insuranceObj.selectedInsurance.selectionStatus?"Yes":"No"}):u.dataLayer.push({ihInsurancePurchased:"Not applicable"}),t.MRB){var E=[];if(!o.singleGuestsInfo){o.mainReservationArray[0].resGuests[0].profile.customer.namePrefix=o.salutation,o.mainReservationArray[0].resGuests[0].profile.customer.givenName=o.firstName,o.mainReservationArray[0].resGuests[0].profile.customer.surName=o.lastName,o.mainReservationArray[0].resGuests[0].profile.customer.email=o.email,o.mainReservationArray[0].resGuests[0].profile.booker={},o.mainReservationArray[0].resGuests[0].profile.booker=o.bookerInfo;var M={phoneUseType:"1",phoneNumber:o.phoneNumber};o.mainReservationArray[0].resGuests[0].profile.customer.telephone=[],o.mainReservationArray[0].resGuests[0].profile.customer.telephone.push(M);var _={useType:"1",addressLine1:o.address1,addressLine2:o.address2,cityName:o.city,countryCode:o.selectedCountry,stateCode:o.selectedState,stateCode:o.selectedState,stateName:o.stateName,postalCode:o.postalcode};o.mainReservationArray[0].resGuests[0].profile.customer.address=[],o.mainReservationArray[0].resGuests[0].profile.customer.address.push(_);var N={id:o.selectedGuestId,idContext:"ProfileID"};o.mainReservationArray[0].resGuests[0].uniqueId=N}v.forEach(o.mainReservationArray,function(e){var a=1==o.mainReservationArray.length?o.totalData:e.totalRoomData;i.setMainReservation(e.id),i.setServicesDataMainReservation(a);var t=e.resGuests;if(e=angular.copy(i.getMainReservation()),e.resGuests=t,e.totalRoomData=a,o.singleGuestsInfo||o.mainReservationArray.length<2){e.resGuests[0].profile.customer.namePrefix=o.salutation,e.resGuests[0].profile.customer.givenName=o.firstName,e.resGuests[0].profile.customer.surName=o.lastName,e.resGuests[0].profile.customer.email=o.email,e.resGuests[0].profile.booker={},e.resGuests[0].profile.booker=o.bookerInfo;var r={phoneUseType:"1",phoneNumber:o.phoneNumber};e.resGuests[0].profile.customer.telephone=[],e.resGuests[0].profile.customer.telephone.push(r);var n={useType:"1",addressLine1:o.address1,addressLine2:o.address2,cityName:o.city,countryCode:o.selectedCountry,stateCode:o.selectedState,stateCode:o.selectedState,stateName:o.stateName,postalCode:o.postalcode};e.resGuests[0].profile.customer.address=[],e.resGuests[0].profile.customer.address.push(n);var s={id:o.selectedGuestId,idContext:"ProfileID"};e.resGuests[0].uniqueId=s}else e.resGuests[0].profile.booker={},e.resGuests[0].profile.booker=o.bookerInfo;if(!o.useSameContactAddress&&Pe()){var l={useType:"3",countryCode:o.selectedBillingCountry,stateCode:o.selectedBillingState,stateName:o.selectedBillingStateName,cityName:o.billingCity,postalCode:o.billingPostalCode,addressLine1:o.billingAddressLine1,addressLine2:o.billingAddressLine2},c=v.findIndex(e.resGuests[0].profile.customer.address,function(e){return"3"==e.useType});-1!=c&&(e.resGuests[0].profile.customer.address=v.without(e.resGuests[0].profile.customer.address,e.resGuests[0].profile.customer.address[c])),e.resGuests[0].profile.customer.address.push(l)}else if((o.isBrainTreePaymentEnabled||o.isAmadeusPaymentEnabled)&&k.getBillingAddress()&&k.getBillingAddress().useType){var d=k.getBillingAddress(),c=v.findIndex(e.resGuests[0].profile.customer.address,function(e){return"3"==e.useType});-1!=c&&(e.resGuests[0].profile.customer.address=v.without(e.resGuests[0].profile.customer.address,e.resGuests[0].profile.customer.address[c])),e.resGuests[0].profile.customer.address.push(d)}else{var c=v.findIndex(e.resGuests[0].profile.customer.address,function(e){return"3"==e.useType});-1!=c&&(e.resGuests[0].profile.customer.address=v.without(e.resGuests[0].profile.customer.address,e.resGuests[0].profile.customer.address[c]))}if(o.ofacEnabled&&o.ofacSubmitData)for(var g in o.ofacSubmitData.guestDetails)e.uniqueId==g&&i.setAdditionalInfo({type:"ofac",additionalData:{type:"ofac",data:{travelReason:o.ofacSubmitData.visitPurpose,guests:o.ofacSubmitData.guestDetails[g]}},currentReservation:e});var m=angular.copy(e);delete m.totalRoomData,E.push(m),(m.selected||1==o.mainReservationArray.length)&&(m.selected=!0,o.currentRoomInContext=angular.copy(m))}),i.setMainReservationByEqual(E),void 0!=o.currentRoomInContext&&i.setMainReservation(o.currentRoomInContext.id);var L=angular.copy(i.getMainReservationArray()),G=L[0],B={};if(B.nameOnCard=o.nameOnCard,B.cardNumber=o.cardNumber,o.cardNumber){var $=o.cardNumber.substr(o.cardNumber.length-4);da==$&&void 0!=da||(o.cardNumberChange=!0)}if(B.cardType=o.ccTypeMap,B.cardExpiry=o.expiry,o.expiry){var q=o.expiry.split("/"),Y=q[0],j=q[1],z=j.slice(-2);B.cardExpiryHalf=Y+"/"+z}B.ccv=o.ccv,B.cardId=o.cardId,B.specialOffersByEmail=o.shareAllMarketInd,B.termsAndConditions=o.tc.confirmCheck,G.resGuests[0].profile.shareAllMarketInd=B.specialOffersByEmail,G.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderName=B.nameOnCard,""!=B.cardNumber&&void 0!=B.cardNumber&&(G.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardNumber=B.cardNumber,G.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardCode=B.cardType,G.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardType=B.cardId),null!=B.ccv&&(G.resGlobalInfo.guaranteesAccepted[0].paymentCard.seriesCode=B.ccv),G.resGlobalInfo.guaranteesAccepted[0].paymentCard.expireDate=B.cardExpiryHalf,null==G.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderName&&(G.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderName=void 0)}else{a.debug(o.GuestsTotalForm.$valid+"$scope.GuestsTotalForm.$valid");var W={};W.salutation=o.salutation,W.firstName=o.firstName,W.lastName=o.lastName,W.email=o.email,W.phoneNumber=o.phoneNumber,W.contactAddress1=o.address1,W.contactAddress2=o.address2,W.contactCity=o.city,W.contactCountry=o.selectedCountry,W.contactState=o.selectedState,W.contactStateName=o.stateName,W.contactPostalCode=o.postalcode,W.guestId=o.selectedGuestId;var B={};if(B.nameOnCard=o.nameOnCard,B.cardNumber=o.cardNumber,o.cardNumber){var $=o.cardNumber.substr(o.cardNumber.length-4);da==$&&void 0!=da||(o.cardNumberChange=!0)}if(B.cardType=o.ccTypeMap,B.cardExpiry=o.expiry,o.expiry){var q=o.expiry.split("/"),Y=q[0],j=q[1],z=j.slice(-2);B.cardExpiryHalf=Y+"/"+z}if(B.ccv=o.ccv,B.cardId=o.cardId,o.isBrainTreePaymentEnabled&&k.getBillingAddress()&&k.getBillingAddress().useType?(B.billingAddress=k.getBillingAddress(),i.setGuestAndPaymentInfo(W,o.bookerInfo,B,Pe()),i.setGuestAndPaymentInfoForRetrieval(W,B)):(B.useSameContactAddress=o.useSameContactAddress,B.billingAddressLine1=o.useSameContactAddress?o.address1:o.billingAddressLine1,B.billingAddressLine2=o.useSameContactAddress?o.address2:o.billingAddressLine2,B.billingCity=o.useSameContactAddress?o.city:o.billingCity,B.billingCountry=o.useSameContactAddress?o.selectedCountry:o.selectedBillingCountry,B.billingState=o.useSameContactAddress?o.selectedState:o.selectedBillingState,B.billingStateName=o.useSameContactAddress?o.stateName:o.selectedBillingStateName,B.billingPostalCode=o.useSameContactAddress?o.postalcode:o.billingPostalCode,i.setGuestAndPaymentInfo(W,o.bookerInfo,B,Pe()),i.setGuestAndPaymentInfoForRetrieval(W,B)),B.specialOffersByEmail=o.shareAllMarketInd,B.termsAndConditions=o.tc.confirmCheck,o.ofacEnabled&&o.ofacSubmitData){var K=Object.keys(o.ofacSubmitData.guestDetails);K&&K[0]&&i.setAdditionalInfo({type:"ofac",additionalData:{type:"ofac",data:{travelReason:o.ofacSubmitData.visitPurpose,guests:o.ofacSubmitData.guestDetails[K[0]]}}})}a.debug(JSON.stringify(o.totalData)+"$scope.totalData in total"),i.setServicesDataMainReservation(o.totalData)}1==i.getConfig("policyOverrideIndicator")&&(i.deleteConfig("policyOverrideIndicator"),i.setPolicyOverrideIndicator()),o.cardNumber||(o.passPaymentMethod=!1);var J=t.MRB?L[0]:i.getMainReservation();o.isMyCheckPaymentEnabled&&1!=o.bookNowDisplay&&(J.resGlobalInfo.guaranteesAccepted[0].walletRedemption.currency=l.getCurrentCurrency().currencyCode,"guarantee"==J.policies.guaranteePolicies[0].policyType.toLowerCase()?J.resGlobalInfo.guaranteesAccepted[0].walletRedemption.amount=l.getPaymentProviders()[0].customValidationAmount:t.MRB&&i.getMrbItineraryPaymentInfo()&&i.getMrbItineraryPaymentInfo().itineraryDepositAmt?J.resGlobalInfo.guaranteesAccepted[0].walletRedemption.amount=i.getMrbItineraryPaymentInfo().itineraryDepositAmt:J.resGlobalInfo.guaranteesAccepted[0].walletRedemption.amount=J.roomStays[0].depositPayments.depositAmt,o.isMycheckV2Enabled?J.resGlobalInfo.guaranteesAccepted[0].walletRedemption.ccToken=b.getCardInfoData().token:(J.resGlobalInfo.guaranteesAccepted[0].walletRedemption.ccToken=b.getCardInfoData().cc_token,J.resGlobalInfo.guaranteesAccepted[0].walletRedemption.encrypted_cvv=b.getMyCheckV2CardDetails().encrypted_cvv,J.resGlobalInfo.guaranteesAccepted[0].walletRedemption.fingerprint=b.getMyCheckV2CardDetails().fingerprint),J.resGlobalInfo.guaranteesAccepted[0].walletRedemption.source=b.getCardInfoData().source);var Q=l.getPaymentProviders();if(void 0!=Q&&Q.length>0&&o.credit&&o.passPaymentMethod){var X=c("filter")(pa,function(e){if(1==e.paymentMethod)return!0});X.length>0&&(!l.getCybersource3DSV2Enabled()&&!o.paypal&&!o.ideal||l.getCybersource3DSV2Enabled()&&"validateonly"==Ze.creditCardMode.toLowerCase()&&"deposit"==J.policies.guaranteePolicies[0].policyType.toLowerCase())&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId=1,J.resGlobalInfo.guaranteesAccepted[0].vendorKey=X[0].vendorKey,void 0!=J.resGlobalInfo.guaranteesAccepted[0].alternatePayment&&(J.resGlobalInfo.guaranteesAccepted[0].alternatePayment={}))}if(void 0!=Q&&Q.length>0&&o.paypal){J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId=4;var Z=c("filter")(pa,{paymentMethod:4});J.resGlobalInfo.guaranteesAccepted[0].vendorKey=Z[0].vendorKey}if(void 0!=Q&&Q.length>0&&o.ideal){J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId=3;var ee=c("filter")(pa,{paymentMethod:3});J.resGlobalInfo.guaranteesAccepted[0].vendorKey=ee[0].vendorKey}if(void 0!=Q&&Q.length>0&&o.secure3D){J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId=2;var ee=c("filter")(pa,{paymentMethod:2},!0),ae=c("filter")(ee,function(e){if(2==e.paymentMethod&&"3DSecure-cybersource"==e.vendorKey)return!0});l.getCybersource3DSV2Enabled()||o.paypal||o.ideal||(ae.length>0?J.resGlobalInfo.guaranteesAccepted[0].vendorKey="3DSecure-cybersource":J.resGlobalInfo.guaranteesAccepted[0].vendorKey=ee[0].vendorKey)}a.debug(JSON.stringify(J)+"paymentProviders123"),a.debug(JSON.stringify(J)+"_reservationService in total");var te=c("filter")(J.services,{serviceCategory:"SERVICE_REQUEST"});l.getEnableInsurance()&&(o.cardDetails={},o.cardDetails.cardNumber=B.cardNumber,o.cardDetails.expireDate=B.cardExpiryHalf,o.cardDetails.seriesCode=B.ccv);var oe={cardCode:B.cardType,cardHolderInfoRequired:!1,cardHolderName:B.nameOnCard,cardNumber:w(B.cardNumber),cardType:B.cardId,expireDate:w(B.cardExpiryHalf),seriesCode:w(B.ccv)};if(o.paypal||o.ideal||o.ingenico||o.paymentexpress||o.reddot||o.nets||o.xpaywechat||o.xpayalipay||o.xpaypaypal||o.xpaycredit||o.adyenDotPay||o.enabledMyCheckCreditCard||o.isBrainTreePaymentEnabled||o.isAmadeusPaymentEnabled||(J.resGlobalInfo.guaranteesAccepted[0].paymentCard=oe),o.secure3D)var re=oe;if(J=x(J,!1),L=t.MRB?x(L,!0):L,o.isModifyReservation){(o.enhancementServices.length>0||o.totalData&&o.totalData.specialRequest.length>0)&&(i.removeExistingEnhancements(),i.modifyMainReservation(o.enhancementServices),o.totalData&&o.totalData.specialRequest.length>0&&i.setServicesDataMainReservation(o.totalData),J=i.getMainReservation());var ne;if((o.adyenDotPay||o.paypal||o.ideal||o.ingenico||o.paymentexpress||o.reddot||o.nets||o.xpaywechat||o.xpayalipay||o.xpaypaypal||o.xpaycredit&&!o.credit||o.enabledMyCheckCreditCard||o.enabledMyCheckPaypal||o.enabledMyCheckApplePay||o.enabledMyCheckGpay)&&((o.ingenico&&o.enableIngenico||o.nets)&&void 0!=J.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderName&&(ne=J.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderName),void 0!=J.resGlobalInfo.guaranteesAccepted[0].paymentCard&&(J.resGlobalInfo.guaranteesAccepted[0].paymentCard={},J.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderInfoRequired=!1,(o.ingenico&&o.enableIngenico||o.nets)&&void 0!=ne&&"alternatePayment"!=o.paymentType.type&&(J.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderName=ne)),l.getCybersource3DSV2Enabled()||o.paypal||o.ideal||void 0!=J.resGlobalInfo.guaranteesAccepted[0].alternatePayment&&(J.resGlobalInfo.guaranteesAccepted[0].alternatePayment={})),void 0==J.languageCode&&(J.languageCode=i.getLanguage()),(o.isBrainTreePaymentEnabled||o.isAmadeusPaymentEnabled)&&1!=o.bookNowDisplay)J.resGlobalInfo.guaranteesAccepted=k.getGuaranteeAcceptedDetailsData(),o.callModifyReservationAPI(J);else if(t.timerInContext||te.length>0||J.resGlobalInfo.comments.length>0||""!=J.resGlobalInfo.arrivalTime||o.cardNumberChange||o.paypal||o.ideal||o.secure3D||(o.ingenico&&o.enableIngenico||o.reddot||o.paymentexpress||o.nets||o.xpaywechat||o.xpayalipay||o.xpaypaypal||o.xpaycredit||o.adyenDotPay||o.enabledMyCheckCreditCard||o.enabledMyCheckPaypal||o.enabledMyCheckApplePay||o.enabledMyCheckGpay)&&1!=o.bookNowDisplay){var ie=[];ie[0]=angular.copy(i.getMainReservation().roomStays[0].total.amountAfterTaxRoom),o.ingenico&&o.enableIngenico&&1!=o.bookNowDisplay&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",J.resGlobalInfo.guaranteesAccepted[0].variantId=va,J.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-ingenico","creditCard"==o.paymentType.type?(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-ingenico"):"alternatePayment"==o.paymentType.type&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="5",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-ingenico")),o.paymentexpress&&1!=o.bookNowDisplay&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-paymentexpress","alternatePayment"==o.paymentType.type&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="8",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-paymentexpress")),o.reddot&&1!=o.bookNowDisplay&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="7",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="allpayment-reddot","guarantee"==J.policies.guaranteePolicies[0].policyType.toLowerCase()&&(J.resGlobalInfo.guaranteesAccepted[0].merchantRefMsg=i.convertStringIntoUTF8(c("replaceDollerOneToAmount")(t.translate.page_nonccdollarcharge_RDPChargeMsg,F(i.getCustomValidationAmount()))))),o.nets&&1!=o.bookNowDisplay&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-nets","creditCard"==o.paymentType.type?(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-nets"):"alternatePayment"==o.paymentType.type&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="9",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-nets")),(o.xpaywechat||o.xpayalipay||o.xpaypaypal||o.xpaycredit)&&1!=o.bookNowDisplay&&(o.xpaycredit&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-xpay"),o.xpayalipay&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="12",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-xpay"),o.xpaywechat&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="13",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-xpay"),o.xpaypaypal&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="4",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-xpay")),o.adyenDotPay&&1!=o.bookNowDisplay&&o.payment.bank&&("mbank"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="14",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"ipko"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="15",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"przelew24"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="16",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"ing"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="17",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"millennium"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="18",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"aliorbank"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="19",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"citihandlowy"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="20",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"rprzelew"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="21",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"eurobank"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="22",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"blik"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="23",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen")),o.isMyCheckPaymentEnabled&&1!=o.bookNowDisplay&&(o.enabledMyCheckCreditCard||o.enabledMyCheckPaypal||o.enabledMyCheckApplePay||o.enabledMyCheckGpay)&&(o.enabledMyCheckCreditCard?(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-mycheck"):o.enabledMyCheckPaypal?(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="4",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck"):o.enabledMyCheckApplePay?(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="24",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck"):o.enabledMyCheckGpay&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="25",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck")),t.gmsPromoCode&&i.addGmsRateAccessCodeInReservation(J),o.secure3D&&u._3DSecureLogs&&H("3DSecureCallingModifyHoldApi"),d.modifyHoldReservation(ea,J,!1).success(function(n){i.handleXssVulnerabilities(n),o.isMyCheckPaymentEnabled&&1!=o.bookNowDisplay&&(n.resGlobalInfo.guaranteesAccepted[0].walletRedemption.source=b.getCardInfoData().source,o.enabledMyCheckCreditCard?(n.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",n.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-mycheck"):o.enabledMyCheckPaypal?(n.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="4",n.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck"):o.enabledMyCheckApplePay?(n.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="24",n.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck"):o.enabledMyCheckGpay&&(n.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="25",n.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck")),t.gmsPromoCode&&i.removeRateAccessCodeInReservation(n,J),o.secure3D&&!n.isdirectCommit&&(n.resGlobalInfo.guaranteesAccepted[0].paymentCard=re),(o.ingenico&&o.enableIngenico||o.nets)&&void 0!=ne&&"alternatePayment"!=o.paymentType.type&&(n.resGlobalInfo.guaranteesAccepted[0].paymentCard={},n.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderName=ne),i.setReservation(n),(o.enhancementServices.length>0||o.totalData&&o.totalData.specialRequest.length>0)&&(i.removeExistingEnhancements(),i.modifyMainReservation(o.enhancementServices),o.totalData&&o.totalData.specialRequest.length>0&&i.setServicesDataMainReservation(o.totalData));if(n.resGlobalInfo.guaranteesAccepted[0].alternatePayment){var s=n.resGlobalInfo.guaranteesAccepted[0].alternatePayment,l=s.htmlForm,c=s.altPayRedirectUrl;if(angular.element(document.body).append(l),n.isdirectCommit&&o.secure3D)return o.secure3D&&u._3DSecureLogs&&H("3DSecureModifyDirectCommit"),g.clear(),i.setReservation(n),a.debug(JSON.stringify(i.getMainReservation())+"this is flag"),p.stepsById.total.placeholder=i.getTotalReservationAmount(),t.arrivedConfirmation=!0,void r.go("confirmation");var d=n.reservationResponses&&n.reservationResponses.length&&n.reservationResponses[0].uniqueId?n.reservationResponses[0].uniqueId:!!n.uniqueId&&n.uniqueId
;if((o.secure3D||void 0!=c||o.paypal||o.ideal)&&d&&(i.logGAEvents(d,y.BEFORE_REDIRECT),i.resChange()),o.ingenico&&o.enableIngenico&&1!=o.bookNowDisplay)return"alternatePayment"==o.paymentType.type?i.setIngenicoAlternatePayment():i.deleteIngenicoAlternatePayment(),o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(c,"_self")},500);if(o.nets&&1!=o.bookNowDisplay)return"alternatePayment"==o.paymentType.type?i.setNetsAlternatePayment():i.deleteNetsAlternatePayment(),o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(c,"_self")},500);if(o.paymentexpress&&1!=o.bookNowDisplay)return"alternatePayment"==o.paymentType.type?i.setPaymentExpressAlternatePayment():i.deletePaymentExpressAlternatePayment(),o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(c,"_self")},500);if(o.reddot&&1!=o.bookNowDisplay)return o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(c,"_self")},500);if(o.paypal||o.ideal){if(o.ideal){if(window.iDealLogs){var m=i.getMainReservation().uniqueId;i.setOrderIdInCacheIdealTracking(m,o.depositAmount)}i.setDataToLocalStorage(),window.iDealLogs&&V()}return o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){document.getElementById("form1").submit()},500)}if(o.secure3D)return o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),o.secure3D&&u._3DSecureLogs&&H("3DSecureModifyRedirect"),void e(function(){document.getElementById("PAEnrollForm").submit()},500);if((o.xpaywechat||o.xpayalipay||o.xpaypaypal||o.xpaycredit)&&1!=o.bookNowDisplay)return o.xpaywechat?i.setXpayAlternatePayment("xpaywechat"):o.xpayalipay?i.setXpayAlternatePayment("xpayalipay"):o.xpaypaypal?i.setXpayAlternatePayment("xpaypaypal"):o.xpaycredit?i.setXpayAlternatePayment("xpaycredit"):i.deleteXpayAlternatePayment(),o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(c,"_self")},500);if(o.adyenDotPay&&1!=o.bookNowDisplay)return o.payment.bank?i.setAdyenDotpayPayment(o.payment.bank):i.deleteAdyenDotpayPayment(),o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(c,"_self")},500)}if(i.deleteConfig("TIMER_FAILED"),n.roomStays[0].total.amountAfterTaxRoom!=ie[0]&&i.revertTotalByTimer(n),i.getConfig("TIMER_FAILED"))r.go("accommodation"),i.setConfig("SHOW_ERROR_MESSAGE");else{if(o.enabledMyCheckCreditCard&&n.resGlobalInfo.guaranteesAccepted[0].walletRedemption&&1==n.resGlobalInfo.guaranteesAccepted[0].walletRedemption.awaitingConfirmation&&1!=o.bookNowDisplay&&!(o.enabledMyCheckPaypal&&o.enabledMyCheckApplePay&&o.enabledMyCheckGpay))return;o.enabledMyCheckCreditCard?o.callReservationAPI(n):o.isInsuranceSelected&&!o.insuranceObj.insuranceCaNotModify?o.bookInsuranceAndCallReservation(J):o.callReservationAPI(J)}}).error(function(e){o.secure3D&&u._3DSecureLogs&&H("3DSecureModifyHoldError - "+JSON.stringify(e.errors));var a=i.getMainReservation();void 0!=a.resGlobalInfo.guaranteesAccepted[0].paymentCard&&(a.resGlobalInfo.guaranteesAccepted[0].paymentCard={}),l.getCybersource3DSV2Enabled()||o.paypal||o.ideal||void 0!=a.resGlobalInfo.guaranteesAccepted[0].alternatePayment&&(a.resGlobalInfo.guaranteesAccepted[0].alternatePayment={}),!l.getCybersource3DSV2Enabled()||o.paypal||o.ideal||(o.enabledCybersourceButton=!0),i.setReservation(a);var r,n,s=e.errors?e.errors:void 0;if(s){r=s[0].errorCode,s[0].errorMessage;for(var c=0;c<s.length;c++)"BAD_REQUEST"==s[c].errorCode&&(n=s[c].errorCode)}Ke.indexOf(r)>-1&&void 0!=r?(g.clear(),g.pop({type:"error",title:"",body:t.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):We.indexOf(r)>-1&&void 0!=r?(g.clear(),g.pop({type:"error",title:"",body:t.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):n?(o.clearGuestDeatilsForInvalidData(),g.clear(),g.pop({type:"error",title:"",body:t.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):(i.revertAccommadationRooms(),g.clear(),g.pop({type:"error",title:"",body:t.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}),i.setReservation(a),g.clear(),g.pop({type:"error",title:"",body:t.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})),o.revertOFACInfo()})}else o.isInsuranceSelected&&!o.insuranceObj.insuranceCaNotModify?o.bookInsuranceAndCallReservation(J):o.callModifyReservationAPI(J)}else if((o.isBrainTreePaymentEnabled||o.isAmadeusPaymentEnabled)&&1!=o.bookNowDisplay)t.MRB?(v.forEach(L,function(e){e.resGlobalInfo.guaranteesAccepted=k.getGuaranteeAcceptedDetailsData()}),o.callReservationAPI(L,t.MRB)):(J.resGlobalInfo.guaranteesAccepted=k.getGuaranteeAcceptedDetailsData(),o.callReservationAPI(J));else if(t.timerInContext||te.length>0||J.resGlobalInfo.comments.length>0||""!=J.resGlobalInfo.arrivalTime||o.paypal||o.ideal||o.secure3D||t.MRB||(o.ingenico||o.reddot||o.paymentexpress||o.nets||o.xpaypaypal||o.xpaycredit||o.xpaywechat||o.xpayalipay||o.adyenDotPay||o.enabledMyCheckCreditCard||o.enabledMyCheckPaypal||o.enabledMyCheckApplePay||o.enabledMyCheckGpay)&&1!=o.bookNowDisplay){var ne;(o.adyenDotPay||o.paypal||o.xpaypaypal||o.xpaycredit||o.xpaywechat||o.xpayalipay||o.ideal||o.ingenico||o.paymentexpress||o.reddot||o.nets&&!o.credit)&&((o.ingenico&&o.enableIngenico||o.nets)&&void 0!=J.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderName&&(ne=J.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderName),void 0!=J.resGlobalInfo.guaranteesAccepted[0].paymentCard&&(J.resGlobalInfo.guaranteesAccepted[0].paymentCard={},(o.ingenico&&o.enableIngenico||o.nets)&&"alternatePayment"!=o.paymentType.type&&(J.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderName=ne)));var se=angular.copy(J.resGlobalInfo.guaranteesAccepted);t.MRB&&v.forEach(L,function(e){e.resGlobalInfo.guaranteesAccepted=angular.copy(se)});var ie=[];if(t.MRB)for(var R=0;R<L.length;R++)ie.push(angular.copy(L[R].roomStays[0].total.amountAfterTaxRoom));else ie[0]=angular.copy(i.getMainReservation().roomStays[0].total.amountAfterTaxRoom);if(t.MRB){if(o.ingenico&&o.enableIngenico&&1!=o.bookNowDisplay)for(var R=0;R<L.length;R++)L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",L[R].resGlobalInfo.guaranteesAccepted[0].variantId=va,L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-ingenico","creditCard"==o.paymentType.type?L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-ingenico":"alternatePayment"==o.paymentType.type&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="5",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-ingenico");if(o.nets&&1!=o.bookNowDisplay)for(var R=0;R<L.length;R++)L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-nets","creditCard"==o.paymentType.type?L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-nets":"alternatePayment"==o.paymentType.type&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="9",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-nets");if(o.paymentexpress&&1!=o.bookNowDisplay)for(var R=0;R<L.length;R++)L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-paymentexpress","creditCard"==o.paymentType.type?L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-paymentexpress":"alternatePayment"==o.paymentType.type&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="8",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-paymentexpress"),(!Me&&Ne&&i.getMainReservationArray().length>1||1==i.getMainReservationArray().length&&"guarantee"==i.getMainReservation().policies.guaranteePolicies[0].policyType.toLowerCase())&&(L[R].resGlobalInfo.guaranteesAccepted[0].merchantRefMsg=i.convertStringIntoUTF8(c("replaceDollerOneToAmount")(t.translate.page_nonccdollarcharge_RDPChargeMsg,F(1))));if(o.reddot&&1!=o.bookNowDisplay)for(var R=0;R<L.length;R++)L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="7",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="allpayment-reddot",(!Me&&Ne&&i.getMainReservationArray().length>1||1==i.getMainReservationArray().length&&"guarantee"==i.getMainReservation().policies.guaranteePolicies[0].policyType.toLowerCase())&&(L[R].resGlobalInfo.guaranteesAccepted[0].merchantRefMsg=i.convertStringIntoUTF8(c("replaceDollerOneToAmount")(t.translate.page_nonccdollarcharge_RDPChargeMsg,F(i.getCustomValidationAmount()))));if((o.xpaywechat||o.xpayalipay||o.xpaypaypal||o.xpaycredit)&&1!=o.bookNowDisplay)for(var R=0;R<L.length;R++)o.xpaycredit&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-xpay"),o.xpayalipay&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="12",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-xpay"),o.xpaywechat&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="13",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-xpay"),o.xpaypaypal&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="4",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-xpay");if(o.adyenDotPay&&1!=o.bookNowDisplay&&o.payment.bank)for(var R=0;R<L.length;R++)"mbank"==o.payment.bank&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="14",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"ipko"==o.payment.bank&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="15",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"przelew24"==o.payment.bank&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="16",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"ing"==o.payment.bank&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="17",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"millennium"==o.payment.bank&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="18",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"aliorbank"==o.payment.bank&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="19",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"citihandlowy"==o.payment.bank&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="20",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"rprzelew"==o.payment.bank&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="21",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"eurobank"==o.payment.bank&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="22",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"blik"==o.payment.bank&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="23",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen");if(o.isMyCheckPaymentEnabled&&1!=o.bookNowDisplay&&(o.enabledMyCheckCreditCard||o.enabledMyCheckPaypal||o.enabledMyCheckApplePay||o.enabledMyCheckGpay))for(var R=0;R<L.length;R++)o.enabledMyCheckCreditCard?(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-mycheck"):o.enabledMyCheckPaypal?(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="4",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck"):o.enabledMyCheckApplePay?(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="24",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck"):o.enabledMyCheckGpay&&(L[R].resGlobalInfo.guaranteesAccepted[0].paymentMethodId="25",L[R].resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck")}else o.ingenico&&o.enableIngenico&&1!=o.bookNowDisplay&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",J.resGlobalInfo.guaranteesAccepted[0].variantId=va,J.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-ingenico","creditCard"==o.paymentType.type?J.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-ingenico":"alternatePayment"==o.paymentType.type&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="5",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-ingenico")),o.nets&&1!=o.bookNowDisplay&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-nets","creditCard"==o.paymentType.type?J.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-nets":"alternatePayment"==o.paymentType.type&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="9",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-nets")),o.paymentexpress&&1!=o.bookNowDisplay&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-paymentexpress","creditCard"==o.paymentType.type?J.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-paymentexpress":"alternatePayment"==o.paymentType.type&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="8",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-paymentexpress")),o.reddot&&1!=o.bookNowDisplay&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="7",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="allpayment-reddot","guarantee"==J.policies.guaranteePolicies[0].policyType.toLowerCase()&&(J.resGlobalInfo.guaranteesAccepted[0].merchantRefMsg=i.convertStringIntoUTF8(c("replaceDollerOneToAmount")(t.translate.page_nonccdollarcharge_RDPChargeMsg,F(i.getCustomValidationAmount()))))),(o.xpaywechat||o.xpayalipay||o.xpaypaypal||o.xpaycredit)&&1!=o.bookNowDisplay&&(o.xpaycredit&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-xpay"),o.xpayalipay&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="12",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-xpay"),o.xpaywechat&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="13",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-xpay"),o.xpaypaypal&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="4",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-xpay")),o.adyenDotPay&&1!=o.bookNowDisplay&&o.payment.bank&&("mbank"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="14",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"ipko"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="15",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"przelew24"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="16",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"ing"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="17",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"millennium"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="18",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"aliorbank"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="19",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"citihandlowy"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="20",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"rprzelew"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="21",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"eurobank"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="22",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"),"blik"==o.payment.bank&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="23",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen")),o.isMyCheckPaymentEnabled&&1!=o.bookNowDisplay&&(o.enabledMyCheckCreditCard||o.enabledMyCheckPaypal||o.enabledMyCheckApplePay||o.enabledMyCheckGpay)&&(o.enabledMyCheckCreditCard?(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-mycheck"):o.enabledMyCheckPaypal?(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="4",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck"):o.enabledMyCheckApplePay?(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="24",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck"):o.enabledMyCheckGpay&&(J.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="25",J.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck"));void 0!=we&&void 0!=we.guestInfo&&void 0!=we.guestInfo.loyalty&&we.guestInfo.loyalty.length>0&&!0===we.guestInfo.loyalty[0].requireRestrictionCheck&&o.addLoyaltyReqParams(J),t.gmsPromoCode&&(t.MRB?i.addGmsRateAccessCodeInReservation(L):i.addGmsRateAccessCodeInReservation(J)),o.insuranceObj&&o.insuranceObj.showInsurance&&o.isInsuranceSelected&&o.insuranceObj.selectedInsurance&&o.changeInPaymentVariables&&(o.insuranceObj.changeInPaymentVariables=o.changeInPaymentVariables,o.insuranceObj.paymentCard=t.MRB?L[0].resGlobalInfo.guaranteesAccepted[0].paymentCard:J.resGlobalInfo.guaranteesAccepted[0].paymentCard),t.MRB?L=U(L,!0):J=U(J),o.secure3D&&u._3DSecureLogs&&H("3DSecureCallingHoldApi"),d.callHoldReservation(ea,J,L,t.MRB,t.MRB).success(function(n){if(i.handleXssVulnerabilities(n),o.isMyCheckPaymentEnabled&&1!=o.bookNowDisplay&&(t.MRB?v.forEach(n.reservationResponses,function(e){e.resGlobalInfo.guaranteesAccepted[0].walletRedemption.source=b.getCardInfoData().source,o.enabledMyCheckCreditCard?(e.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",e.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-mycheck"):o.enabledMyCheckPaypal?(e.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="4",e.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck"):o.enabledMyCheckApplePay?(e.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="24",e.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck"):o.enabledMyCheckGpay&&(e.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="25",e.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck")}):(n.resGlobalInfo.guaranteesAccepted[0].walletRedemption.source=b.getCardInfoData().source,o.enabledMyCheckCreditCard?(n.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",n.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-mycheck"):o.enabledMyCheckPaypal?(n.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="4",n.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck"):o.enabledMyCheckApplePay?(n.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="24",n.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck"):o.enabledMyCheckGpay&&(n.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="25",n.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-mycheck"))),t.gmsPromoCode&&(t.MRB?i.removeRateAccessCodeInReservation(n.reservationResponses,L):i.removeRateAccessCodeInReservation(n,J)),n=o.addLoyaltyReqParams(n),t.MRB){i.setMrbItineraryTotals(n.itineraryTotals),i.setMrbItineraryPaymentInfo(n.itineraryPaymentInfo);if(1==i.setMainReservationByEqual(n.reservationResponses,!0)){if((S.getIsLoyaltyReservationEnabled()&&S.getBurnPoints()||A.getVoucherDetails()&&A.getVoucherDetails().redeemedCashValue)&&o.changeInPaymentVariables)return void(o.isInsuranceSelected?o.bookInsuranceAndCallReservation(n.reservationResponses):o.callReservationAPI(n.reservationResponses,t.MRB));if(o.secure3D&&!n.isdirectCommit&&(v.forEach(n.reservationResponses,function(e){e.resGlobalInfo.guaranteesAccepted[0].paymentCard=re}),i.setMainReservationByEqual(n.reservationResponses)),(o.ingenico&&o.enableIngenico||o.nets)&&void 0!=ne&&(v.forEach(n.reservationResponses,function(e){e.resGlobalInfo.guaranteesAccepted[0].paymentCard={},"alternatePayment"!=o.paymentType.type&&(e.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderName=ne)}),i.setMainReservationByEqual(n.reservationResponses)),n.reservationResponses[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment){var l=n.reservationResponses[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment,c=l.htmlForm,d=l.altPayRedirectUrl;if(angular.element(document.body).append(c),n.isdirectCommit&&o.secure3D)return o.secure3D&&u._3DSecureLogs&&H("3DSecureDirectCommit"),i.setMrbItineraryTotals(n.itineraryTotals),i.setMrbItineraryPaymentInfo(n.itineraryPaymentInfo),i.setMainReservationByEqual(n.reservationResponses),p.stepsById.total.placeholder=i.getTotalReservationAmount(),t.arrivedConfirmation=!0,void r.go("confirmation");var m=n.reservationResponses&&n.reservationResponses.length&&n.reservationResponses[0].uniqueId?n.reservationResponses[0].uniqueId:!!n.uniqueId&&n.uniqueId;if((o.secure3D||void 0!=d||o.paypal||o.ideal)&&m&&(i.logGAEvents(m,y.BEFORE_REDIRECT),i.resChange()),o.ingenico&&o.enableIngenico&&1!=o.bookNowDisplay)return"alternatePayment"==o.paymentType.type?i.setIngenicoAlternatePayment():i.deleteIngenicoAlternatePayment(),o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(d,"_self")},500);if(o.nets&&1!=o.bookNowDisplay)return"alternatePayment"==o.paymentType.type?i.setNetsAlternatePayment():i.deleteNetsAlternatePayment(),o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(d,"_self")},500);if(o.paymentexpress&&1!=o.bookNowDisplay)return"alternatePayment"==o.paymentType.type?i.setPaymentExpressAlternatePayment():i.deletePaymentExpressAlternatePayment(),o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(d,"_self")},500);if(o.reddot&&1!=o.bookNowDisplay)return o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(d,"_self")},500);if(o.paypal||o.ideal){if(o.ideal){if(window.iDealLogs){var h="",R=i.getMainReservationArray();v.forEach(R,function(e){h=h+e.itineraryId+"-"+e.uniqueId+" || "}),i.setOrderIdInCacheIdealTracking(h,o.depositAmount)}i.setDataToLocalStorage(),window.iDealLogs&&V()}return o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){document.getElementById("form1").submit()},500)}if(o.secure3D)return o.secure3D&&u._3DSecureLogs&&H("3DSecureRedirect"),o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){document.getElementById("PAEnrollForm").submit()},500);if((o.xpaywechat||o.xpayalipay||o.xpaypaypal||o.xpaycredit)&&1!=o.bookNowDisplay)return o.xpaywechat?i.setXpayAlternatePayment("xpaywechat"):o.xpayalipay?i.setXpayAlternatePayment("xpayalipay"):o.xpaypaypal?i.setXpayAlternatePayment("xpaypaypal"):o.xpaycredit?i.setXpayAlternatePayment("xpaycredit"):i.deleteXpayAlternatePayment(),o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(d,"_self")},500);if(o.adyenDotPay&&1!=o.bookNowDisplay)return o.payment.bank?i.setAdyenDotpayPayment(o.payment.bank):i.deleteAdyenDotpayPayment(),o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(d,"_self")},500)}if(!o.paypal&&!o.ideal&&!o.secure3D){o.isMyCheckPaymentEnabled||o.isBrainTreePaymentEnabled||o.isAmadeusPaymentEnabled||v.forEach(n.reservationResponses,function(e){e.resGlobalInfo.guaranteesAccepted=angular.copy(se)}),(S.getIsLoyaltyReservationEnabled()&&S.getBurnPoints()||A.getVoucherDetails()&&A.getVoucherDetails().redeemedCashValue)&&(n.reservationResponses=U(n.reservationResponses,!0)),i.deleteConfig("TIMER_FAILED");for(var f=0;f<n.reservationResponses.length;f++)n.reservationResponses[f].roomStays[0].total.amountAfterTaxRoom!=ie[f]&&i.revertTotalByTimer(n.reservationResponses[f]);if(i.getConfig("TIMER_FAILED"))r.go("accommodation"),i.setConfig("SHOW_ERROR_MESSAGE");else{if(o.enabledMyCheckCreditCard&&n.reservationResponses[0].resGlobalInfo.guaranteesAccepted[0].walletRedemption&&1==n.reservationResponses[0].resGlobalInfo.guaranteesAccepted[0].walletRedemption.awaitingConfirmation&&1!=o.bookNowDisplay&&!(o.enabledMyCheckPaypal&&o.enabledMyCheckApplePay&&o.enabledMyCheckGpay))return;o.isInsuranceSelected?o.bookInsuranceAndCallReservation(n.reservationResponses):o.callReservationAPI(n.reservationResponses,t.MRB)}}}else u._3DSecureLogs&&H("3DSecureHoldErrorMultiRoom"),o.failedRoomsId=i.getFailedRoomsId(),o.failedRoomsId.length>1?(o.combinedHoldFailure=!0,P.onModalOpen("book-button-id","combined-hold-failure-totals","combined-hold-failure-title-0",!1)):(s.setObjectData("combinedHoldError",!0),r.go("accommodation"))}else{if((S.getIsLoyaltyReservationEnabled()&&S.getBurnPoints()||A.getVoucherDetails()&&A.getVoucherDetails().redeemedCashValue)&&o.changeInPaymentVariables)return i.setReservation(n),void(o.isInsuranceSelected?o.bookInsuranceAndCallReservation(n):o.callReservationAPI(n,t.MRB));o.secure3D&&!n.isdirectCommit&&(n.resGlobalInfo.guaranteesAccepted[0].paymentCard=re),(o.ingenico&&o.enableIngenico||o.nets)&&void 0!=ne&&"alternatePayment"!=o.paymentType.type&&(n.resGlobalInfo.guaranteesAccepted[0].paymentCard={},n.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderName=ne),i.setReservation(n),a.debug(JSON.stringify(J)+"data1"),a.debug(JSON.stringify(n)+"data");if(n.resGlobalInfo.guaranteesAccepted[0].alternatePayment){var l=n.resGlobalInfo.guaranteesAccepted[0].alternatePayment,c=l.htmlForm,d=l.altPayRedirectUrl;if(angular.element(document.body).append(c),n.isdirectCommit&&o.secure3D)return o.secure3D&&u._3DSecureLogs&&H("3DSecureDirectCommit"),g.clear(),i.setReservation(n),p.stepsById.total.placeholder=i.getTotalReservationAmount(),t.arrivedConfirmation=!0,void r.go("confirmation");var m=n.reservationResponses&&n.reservationResponses.length&&n.reservationResponses[0].uniqueId?n.reservationResponses[0].uniqueId:!!n.uniqueId&&n.uniqueId;if((o.secure3D||void 0!=d||o.paypal||o.ideal)&&m&&(i.logGAEvents(m,y.BEFORE_REDIRECT),i.resChange()),o.ingenico&&o.enableIngenico&&1!=o.bookNowDisplay)return"alternatePayment"==o.paymentType.type&&i.setIngenicoAlternatePayment(),o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(d,"_self")},500);if(o.nets&&1!=o.bookNowDisplay)return"alternatePayment"==o.paymentType.type&&i.setNetsAlternatePayment(),o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(d,"_self")},500);if(o.paymentexpress&&1!=o.bookNowDisplay)return"alternatePayment"==o.paymentType.type&&i.setPaymentExpressAlternatePayment(),o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(d,"_self")},500);if(o.reddot&&1!=o.bookNowDisplay)return o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(d,"_self")},500);if(o.paypal||o.ideal){if(o.ideal){if(window.iDealLogs){var h=i.getMainReservation().uniqueId;i.setOrderIdInCacheIdealTracking(h,o.depositAmount)}i.setDataToLocalStorage(),window.iDealLogs&&V()}return o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){document.getElementById("form1").submit()},500)}if(o.secure3D)return o.secure3D&&u._3DSecureLogs&&H("3DSecureRedirect"),o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){document.getElementById("PAEnrollForm").submit()},500);if((o.xpaywechat||o.xpayalipay||o.xpaypaypal||o.xpaycredit)&&1!=o.bookNowDisplay)return o.xpaywechat?i.setXpayAlternatePayment("xpaywechat"):o.xpayalipay?i.setXpayAlternatePayment("xpayalipay"):o.xpaypaypal?i.setXpayAlternatePayment("xpaypaypal"):o.xpaycredit?i.setXpayAlternatePayment("xpaycredit"):i.deleteXpayAlternatePayment(),o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(d,"_self")},500);if(o.adyenDotPay&&1!=o.bookNowDisplay)return o.payment.bank?i.setAdyenDotpayPayment(o.payment.bank):i.deleteAdyenDotpayPayment(),o.showPaymentRedirectModal="display-block",P.onModalOpen("","payment-redirect-modal-parent","payment-redirect-modal-title",!1),void e(function(){window.open(d,"_self")},500)}if(!(o.paypal||o.ideal||(o.ingenico&&o.enableIngenico||o.reddot||o.paymentexpress||o.nets)&&1!=o.bookNowDisplay))if(i.deleteConfig("TIMER_FAILED"),n.roomStays[0].total.amountAfterTaxRoom!=ie[0]&&i.revertTotalByTimer(n),i.getConfig("TIMER_FAILED"))r.go("accommodation"),i.setConfig("SHOW_ERROR_MESSAGE");else{if((S.getIsLoyaltyReservationEnabled()&&S.getBurnPoints()||A.getVoucherDetails()&&A.getVoucherDetails().redeemedCashValue)&&(J=U(J)),o.enabledMyCheckCreditCard&&n.resGlobalInfo.guaranteesAccepted[0].walletRedemption&&1==n.resGlobalInfo.guaranteesAccepted[0].walletRedemption.awaitingConfirmation&&1!=o.bookNowDisplay&&!(o.enabledMyCheckPaypal&&o.enabledMyCheckApplePay&&o.enabledMyCheckGpay))return;void 0!=we&&void 0!=we.guestInfo&&void 0!=we.guestInfo.loyalty&&we.guestInfo.loyalty.length>0&&!0===we.guestInfo.loyalty[0].requireRestrictionCheck?o.enabledMyCheckCreditCard?o.callReservationAPI(o.addLoyaltyReqParams(n)):o.callReservationAPI(o.addLoyaltyReqParams(J)):o.enabledMyCheckCreditCard?o.callReservationAPI(n):o.callReservationAPI(J)}i.setReservation(n)}}).error(function(e){o.secure3D&&u._3DSecureLogs&&H("3DSecureHoldError - "+JSON.stringify(e.errors)),t.MRB&&i.revertGuaranteesAcceptedObject();var a=i.getMainReservation();void 0!=a.resGlobalInfo.guaranteesAccepted[0].paymentCard&&(a.resGlobalInfo.guaranteesAccepted[0].paymentCard={}),l.getCybersource3DSV2Enabled()||o.paypal||o.ideal||void 0!=a.resGlobalInfo.guaranteesAccepted[0].alternatePayment&&(a.resGlobalInfo.guaranteesAccepted[0].alternatePayment={}),!l.getCybersource3DSV2Enabled()||o.paypal||o.ideal||(o.enabledCybersourceButton=!0),i.setReservation(a);var r,n,s,c=e.errors?e.errors:void 0;if(c){r=c[0].errorCode,n=c[0].errorMessage;for(var d=0;d<c.length;d++)"BAD_REQUEST"==c[d].errorCode&&(s=c[d].errorCode)}Ke.indexOf(r)>-1&&void 0!=r?(g.clear(),g.pop({type:"error",title:"",body:t.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):We.indexOf(r)>-1&&void 0!=r?(g.clear(),g.pop({type:"error",title:"",body:t.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):ze.indexOf(r)>-1&&void 0!=r?(t.roomUnavailableMsg=n,o.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:t.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):s?(o.clearGuestDeatilsForInvalidData(),g.clear(),g.pop({type:"error",title:"",body:t.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):(i.revertAccommadationRooms(),i.setReservation(a),g.clear(),g.pop({type:"error",title:"",
body:t.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})),o.revertOFACInfo()})}else if(J=U(J),void 0!=we&&void 0!=we.guestInfo&&void 0!=we.guestInfo.loyalty&&we.guestInfo.loyalty.length>0&&!0===we.guestInfo.loyalty[0].requireRestrictionCheck){var J=o.addLoyaltyReqParams(J);o.callReservationAPI(J)}else o.isInsuranceSelected?o.bookInsuranceAndCallReservation(J):o.callReservationAPI(J)},o.revertOFACInfo=function(){o.ofacEnabled&&(o.isModifyReservation||(t.MRB?v.forEach(i.getMainReservationArray(),function(e){i.RemoveAdditionalInfoIfPresent({type:"ofac",currentReservation:e})}):i.RemoveAdditionalInfoIfPresent({type:"ofac"})),o.ofacSubmitData=null)},o.addLoyaltyReqParams=function(e){var a=e,t=i.getSupplementalObj();if(void 0!=t&&void 0!=t.guestInfo&&void 0!=t.guestInfo.loyalty&&t.guestInfo.loyalty.length>0&&!0===t.guestInfo.loyalty[0].requireRestrictionCheck){var o=i.getloyaltyReqParams();if(void 0!=o.offerId&&void 0!=o.guestId)if(void 0!=a.reservationResponses&&v.isArray(a.reservationResponses))for(var r=0;r<a.reservationResponses.length;r++)a.reservationResponses[r].loyaltyReqParams={},a.reservationResponses[r].loyaltyReqParams.offerId=o.offerId,a.reservationResponses[r].loyaltyReqParams.guestId=o.guestId,a.reservationResponses[r].loyaltyReqParams.requireRedemption=t.guestInfo.loyalty[0].requireRedemption;else a.loyaltyReqParams={},a.loyaltyReqParams.offerId=o.offerId,a.loyaltyReqParams.guestId=o.guestId,a.loyaltyReqParams.requireRedemption=t.guestInfo.loyalty[0].requireRedemption}return a},o.goToInclusions=function(){o.showInclusion=!0},o.goBackToReservation=function(){o.showInclusion=!1},o.booknowClickForWallet=function(e){(o.isMycheckV2Enabled?mycheckWallet.getCard():mycheck.wallet.getPaymentMethod()).then(function(a){b.saveCardInfoData(a),"BRAINTREE"==a.source&&"PL"==a.credit_type?(o.enabledMyCheckCreditCard=!1,o.enabledMyCheckPaypal=!0,o.enabledMyCheckApplePay=!1,o.enabledMyCheckGpay=!1):"GOOGLEPAY"==a.source?(o.enabledMyCheckCreditCard=!1,o.enabledMyCheckPaypal=!1,o.enabledMyCheckApplePay=!1,o.enabledMyCheckGpay=!0):"APPLE_PAY"==a.source?(o.enabledMyCheckCreditCard=!1,o.enabledMyCheckPaypal=!1,o.enabledMyCheckApplePay=!0,o.enabledMyCheckGpay=!1):(o.enabledMyCheckCreditCard=!0,o.enabledMyCheckPaypal=!1,o.enabledMyCheckApplePay=!1,o.enabledMyCheckGpay=!1),o.booknowClick(e,b.getCardInfoData())},function(a){console.log("error:"+a),o.booknowClick(e,b.getCardInfoData())})},o.booknowClickForBrainTree=function(e){o.isBrainTreePaymentEnabled&&(o.enableBrainTreeButton=!1),o.isAmadeusPaymentEnabled&&(o.enableAmadeusButton=!1),1!=o.bookNowDisplay?(document.getElementsByTagName("amadeus-hos-res-wc-payments")[0]&&document.getElementsByTagName("amadeus-hos-res-wc-payments")[0].shadowRoot.querySelector("#amadeus-hos-res-id-change-payment-type-link")&&(Ee=!0),Ee?o.booknowClick(e):(u.TCCommonService.EventService.broadcast(document,"EVT_WC_PAYMENTS_ON_VALIDATE_PAYMENTS_FORM"),setTimeout(function(){o.booknowClick(e)},1e3))):o.booknowClick(e)},(i.isBrainTreePaymentEnabled()||i.isAmadeusPaymentEnabled())&&u.TCCommonService&&u.TCCommonService.EventService.subscribe("EVT_WC_PAYMENTS_ON_ERRORS",function(e,r){r&&r.data&&r.data.length>0&&r.data[0].errorCode&&("BRAINTREE_APPLE_PAY_PAYMENT_NOT_SUPPORTED_IN_THIS_DEVICE"===r.data[0].errorCode||"APPLE_PAY_NOT_ENABLED"===r.data[0].errorCode||"BRAINTREE_APPLE_PAY_NOT_CAPABLE_OF_MAKING_PAYMENTS"===r.data[0].errorCode||"VENMO_NOT_ENABLED"===r.data[0].errorCode||"BRAINTREE_VENMO_PAYMENT_NOT_SUPPORTED_IN_THIS_BROWSER"===r.data[0].errorCode?a.info("Braintree Error Message : "+r.data[0].errorMessage):"HOSTED_FIELDS_FIELDS_INVALID"!==r.data[0].errorCode&&"HOSTED_FIELDS_FIELDS_EMPTY"!==r.data[0].errorCode&&(g.clear(),g.pop({type:"error",title:"",body:t.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg,timeout:3e3})),o.isBrainTreePaymentEnabled&&(o.enableBrainTreeButton=!0),o.isAmadeusPaymentEnabled&&De&&(o.enableAmadeusButton=!0))}),i.isAmadeusPaymentEnabled()&&u.TCCommonService&&u.TCCommonService.EventService.subscribe("EVT_WC_PAYMENTS_AMADEUS_WIDGET_READY",function(e,a){De=!a.data.disabledBookButton,o.enableAmadeusButton=!a.data.disabledBookButton}),o.$on("PAYMENT_COMPONENT_DETAILS_CAPTURED",function(e,a){k.setBillingAddress(a.data.billingAddress),k.setGuaranteeAcceptedDetailsData(a.data.guaranteesAccepted),o.booknow()}),o.booknowClick=function(a,r){if(o.bookerInfo=o.showBooker?o.bookerInfo:{salutation:null,firstName:"",lastName:"",email:""},t.toggle.intlMenu=!1,o.getInfo(),o.submitted=!0,o.showNotBankSelectedMsg=!1,o.submitted&&o.adyenDotPay&&!o.credit&&!o.GuestsTotalForm.paymentbank.$valid)return void(o.showNotBankSelectedMsg=!0);if(t.MRB&&o.mainReservationArray.length>1&&!o.singleGuestsInfo){o.GuestsTotalForm.guestDetailsCollapse.$valid||(o.collapseGuestDetails=!1);for(var n=1;n<o.mainReservationArray.length;n++){var i="guestDetailsCollapse"+o.mainReservationArray[n].id;o.GuestsTotalForm[i].$valid||(o.mainReservationArray[n].collapseGuestDetails=!1)}}if(!o.groupPaymentMethod&&o.credit)o.useSameContactAddress&&(o.GuestsTotalForm.billingaddrline1.$setValidity("$valid",!0),o.GuestsTotalForm.billingaddrline2.$setValidity("$valid",!0),o.GuestsTotalForm.billingcity.$setValidity("$valid",!0),o.GuestsTotalForm.bilingCountryddl.$setValidity("$valid",!0),o.GuestsTotalForm.billingState&&o.GuestsTotalForm.billingState.$setValidity("$valid",!0),o.GuestsTotalForm.billingpostalcode.$setValidity("$valid",!0)),o.submitted&&!o.cardNumber&&(""!=o.nameOnCard&&void 0!=o.nameOnCard||""!=o.expiry&&void 0!=o.expiry)?o.toggleCustomValidity(!0):o.toggleCustomValidity(!1),void 0!=o.cardNumber&&(o.cardNumber||o.GuestsTotalForm.cardnumber.$valid||o.toggleCustomValidity(!1)),void 0!=o.expiry&&(o.submitted&&o.GuestsTotalForm.ccExpiry.$error.required||o.submitted&&(""==o.expiry||void 0==o.expiry)&&(""!=o.nameOnCard&&void 0!=o.nameOnCard||""!=o.cardNumber&&void 0!=o.cardNumber)||!o.GuestsTotalForm.ccExpiry.$valid&&void 0!=o.expiry&&""!=o.expiry?o.GuestsTotalForm.ccExpiry.$setValidity("$valid",!1):o.GuestsTotalForm.ccExpiry.$setValidity("$valid",!0)),void 0!=o.ccv&&(o.cvvRequiredIndicator||o.ccv||o.GuestsTotalForm.ccv.$valid||(o.GuestsTotalForm.ccv.$setValidity("$valid",!0),delete o.GuestsTotalForm.$error.ccCvc,o.GuestsTotalForm.$setValidity("$valid",!0)));else{o.GuestsTotalForm.nameoncard.$setValidity("$valid",!0),o.GuestsTotalForm.nameoncard.$setValidity("required",!0),0==o.GuestsTotalForm.cardnumber.$valid&&(o.GuestsTotalForm.cardnumber.$setValidity("$valid",!0),o.GuestsTotalForm.cardnumber.$setValidity("required",!0)),o.GuestsTotalForm.ccExpiry.$setValidity("required",!0),o.GuestsTotalForm.ccExpiry.$setValidity("$valid",!0),void 0!=o.GuestsTotalForm.ccv&&(o.GuestsTotalForm.ccv.$setValidity("required",!0),o.GuestsTotalForm.ccv.$setValidity("$valid",!0),delete o.GuestsTotalForm.$error.ccCvc),o.GuestsTotalForm.$setValidity("$valid",!0);var s;angular.forEach(o.GuestsTotalForm.$error.required,function(e,a){"cardnumber"==e.$name&&(s=a)}),void 0!=s&&(o.GuestsTotalForm.$error.required.splice(s,1),0==o.GuestsTotalForm.$error.required.length&&(delete o.GuestsTotalForm.$error.required,o.GuestsTotalForm.$setValidity("$valid",!0)))}if((o.ingenico&&o.enableIngenico||o.nets)&&1!=o.bookNowDisplay&&"alternatePayment"!=o.paymentType.type)o.submitted&&""!=o.nameOnCard&&void 0!=o.nameOnCard?(o.toggleCustomValidity(!0),o.GuestsTotalForm.nameoncardingenico.$setValidity("required",!0)):o.GuestsTotalForm.nameoncardingenico.$setValidity("required",!1);else if(void 0!=o.GuestsTotalForm.nameoncardingenico&&(o.GuestsTotalForm.nameoncardingenico.$setValidity("$valid",!0),o.GuestsTotalForm.nameoncardingenico.$setValidity("required",!0)),0==o.showCreditCardFields){o.GuestsTotalForm.nameoncard.$setValidity("$valid",!0),o.GuestsTotalForm.nameoncard.$setValidity("required",!0),o.GuestsTotalForm.cardnumber.$setValidity("$valid",!0),o.GuestsTotalForm.cardnumber.$setValidity("required",!0),o.GuestsTotalForm.ccExpiry.$setValidity("required",!0),o.GuestsTotalForm.ccExpiry.$setValidity("$valid",!0),void 0!=o.GuestsTotalForm.ccv&&(o.GuestsTotalForm.ccv.$setValidity("required",!0),o.GuestsTotalForm.ccv.$setValidity("$valid",!0),delete o.GuestsTotalForm.$error.ccCvc);var c;angular.forEach(o.GuestsTotalForm.$error.required,function(e,a){"cardnumber"==e.$name&&(c=a)}),void 0!=c&&(o.GuestsTotalForm.$error.required.splice(c,1),0==o.GuestsTotalForm.$error.required.length&&(delete o.GuestsTotalForm.$error.required,o.GuestsTotalForm.$setValidity("$valid",!0)))}!o.groupPaymentMethod&&o.credit||(o.GuestsTotalForm.billingaddrline1.$setValidity("$valid",!0),o.GuestsTotalForm.billingaddrline1.$setValidity("required",!0),o.GuestsTotalForm.billingaddrline2.$setValidity("$valid",!0),o.GuestsTotalForm.billingaddrline2.$setValidity("required",!0),o.GuestsTotalForm.billingcity.$setValidity("$valid",!0),o.GuestsTotalForm.billingcity.$setValidity("required",!0),o.GuestsTotalForm.bilingCountryddl.$setValidity("$valid",!0),o.GuestsTotalForm.bilingCountryddl.$setValidity("required",!0),o.GuestsTotalForm.billingState&&(o.GuestsTotalForm.billingState.$setValidity("$valid",!0),o.GuestsTotalForm.billingState.$setValidity("required",!0)),o.GuestsTotalForm.billingpostalcode.$setValidity("$valid",!0),o.GuestsTotalForm.billingpostalcode.$setValidity("required",!0)),(!(o.ingenico||o.reddot||o.paymentexpress||o.nets||o.xpaycredit||o.adyenDotPay)||o.bookNowDisplay||o.alternatePaymentIngenico)&&(o.GuestsTotalForm.billingaddrline1_ingenico.$setValidity("$valid",!0),o.GuestsTotalForm.billingaddrline1_ingenico.$setValidity("required",!0),o.GuestsTotalForm.billingaddrline2_ingenico.$setValidity("$valid",!0),o.GuestsTotalForm.billingaddrline2_ingenico.$setValidity("required",!0),o.GuestsTotalForm.billingcity_ingenico.$setValidity("$valid",!0),o.GuestsTotalForm.billingcity_ingenico.$setValidity("required",!0),o.GuestsTotalForm.bilingCountryddl_ingenico.$setValidity("$valid",!0),o.GuestsTotalForm.bilingCountryddl_ingenico.$setValidity("required",!0),o.GuestsTotalForm.billingState_ingenico&&(o.GuestsTotalForm.billingState_ingenico.$setValidity("$valid",!0),o.GuestsTotalForm.billingState_ingenico.$setValidity("required",!0)),o.GuestsTotalForm.billingpostalcode_ingenico.$setValidity("$valid",!0),o.GuestsTotalForm.billingpostalcode_ingenico.$setValidity("required",!0));var d=!0;!o.isMyCheckPaymentEnabled||r||o.bookNowDisplay||(d=!1);var p=!1;!o.isBrainTreePaymentEnabled&&!o.isAmadeusPaymentEnabled||o.bookNowDisplay||Ee||(0===document.querySelectorAll("amadeus-hos-res-wc-payments .form-control.is-invalid").length&&document.querySelectorAll("amadeus-hos-res-wc-payments .form-control.is-valid").length>0&&(p=!0),o.isAmadeusPaymentEnabled&&document.querySelectorAll("amadeus-hos-res-wc-payments")[0].shadowRoot.querySelector("amadeus-checkout-sdk-mop ngco-card-form .ama-checkout-cc-container").classList.contains("ng-valid")&&(p=!0));var y=!0;if(!o.isBrainTreePaymentEnabled&&!o.isAmadeusPaymentEnabled||o.bookNowDisplay||Ee||document.getElementsByTagName("amadeus-hos-res-wc-payments")[0].shadowRoot.querySelector("#amadeus-hos-res-id-use-same-address-consent-checkbox")&&!document.getElementsByTagName("amadeus-hos-res-wc-payments")[0].shadowRoot.querySelector("#amadeus-hos-res-id-use-same-address-consent-checkbox").hasAttribute("checked")&&document.getElementsByTagName("amadeus-hos-res-wc-payments")[0].shadowRoot.querySelector("amadeus-hos-res-wc-guest-details")&&0!=document.getElementsByTagName("amadeus-hos-res-wc-payments")[0].shadowRoot.querySelector("amadeus-hos-res-wc-guest-details").shadowRoot.querySelectorAll(".guest-details .error").length&&(y=!1),!o.isBrainTreePaymentEnabled&&!o.isAmadeusPaymentEnabled||o.bookNowDisplay||Ee||p&&y||(d=!1),(o.isBrainTreePaymentEnabled||o.isAmadeusPaymentEnabled)&&(o.GuestsTotalForm.tcAccept&&o.GuestsTotalForm.tcAccept.$error.required||!d||!o.GuestsTotalForm.$valid)&&(o.isBrainTreePaymentEnabled&&(o.enableBrainTreeButton=!0),o.isAmadeusPaymentEnabled&&(o.enableAmadeusButton=!0)),!o.isBrainTreePaymentEnabled&&!o.isAmadeusPaymentEnabled||o.bookNowDisplay||p||Ee||(u.TCCommonService.EventService.broadcast(document,"EVT_WC_PAYMENTS_ON_GET_PAYMENT_DETAILS"),o.isBrainTreePaymentEnabled&&(o.enableBrainTreeButton=!0),o.isAmadeusPaymentEnabled&&(o.enableAmadeusButton=!0)),o.alertVariable=!1,e(function(){o.alertVariable=!0},50),o.GuestsTotalForm.$valid&&o.insuranceObj&&o.insuranceObj.showInsurance&&o.insuranceObj.hasInsuranceOffers&&!o.checkIsNoInsuranceOptionSelected()&&(o.insuranceObj.showInsurancePopUp=!0,d=!1,P.onModalOpen("","insurance-popup-id","insurance-pop-up-title-id",!1,o.hideInsurancePopUp)),o.GuestsTotalForm.$valid&&d){if(!o.isTAAvailable)return g.clear(),void g.pop({type:"error",title:"",body:o.translate.page_TAcoderequired_TACodeRequiredForGtdMsg});if(!o.isCorpCodeAvailable&&!t.gmsPromoCode)return g.clear(),void g.pop({type:"error",title:"",body:o.translate.page_rateaccesscoderequired_AccessCodeRequiredForGtdMsg});if(0==o.termsAndConditionsDisplayFormat)return void o.showTCModalPopup("TC");"deposit"==Qe.policies.guaranteePolicies[0].policyType.toLowerCase()||Me?(t.MRB&&void 0!=o.itineraryDepositAmt||!t.MRB&&Qe.roomStays[0].depositPayments.depositAmt)&&("IATA"!=Qe.policies.guaranteePolicies[0].acceptTender||ke)?o.showConfirmationPaymentPopup():!o.isBrainTreePaymentEnabled&&!o.isAmadeusPaymentEnabled||o.bookNowDisplay?l.getCybersource3DSV2Enabled()&&!o.paypal&&!o.ideal&&o.creditCardFieldRequiredIndicator?o.payerAuthCallForCybersource():o.booknow():u.TCCommonService.EventService.broadcast(document,"EVT_WC_PAYMENTS_ON_GET_PAYMENT_DETAILS"):("guarantee"==Qe.policies.guaranteePolicies[0].policyType.toLowerCase()||Ne)&&(!o.isBrainTreePaymentEnabled&&!o.isAmadeusPaymentEnabled||o.bookNowDisplay?l.getCybersource3DSV2Enabled()&&!o.paypal&&!o.ideal&&o.creditCardFieldRequiredIndicator?o.payerAuthCallForCybersource():o.booknow():u.TCCommonService.EventService.broadcast(document,"EVT_WC_PAYMENTS_ON_GET_PAYMENT_DETAILS"))}else if(u.innerWidth<768){var v=angular.element(m[0].querySelector(".Checkout-body input.ng-invalid,select.ng-invalid"))[0],h=v.getBoundingClientRect().top+window.pageYOffset,R=document.getElementsByClassName("Header-selectionBar")[0].offsetHeight;0==R&&document.getElementsByClassName("Header-only-mobile")[0]&&(R=document.getElementsByClassName("Header-only-mobile")[0].offsetHeight),document.getElementsByClassName("MaxWidth-logo-wrap")[0]&&(R+=document.getElementsByClassName("MaxWidth-logo-wrap")[0].offsetHeight),document.getElementsByClassName("header-multiroom-info")[0]&&(R+=document.getElementsByClassName("header-multiroom-info")[0].offsetHeight),m.scrollTop(h-(R+50),500),v.focus()}a.preventDefault();var f=document.getElementsByClassName("help-inline");if(f[0]){var C=getComputedStyle(f[0]).color,S=document.createElement("style");S.type="text/css",S.innerHTML=".Checkout-section .border-bottom-red { border-bottom: 1px solid "+C+" !important}",document.getElementsByTagName("head")[0]&&document.getElementsByTagName("head")[0].appendChild(S)}},o.cancelBooking=function(){o.showConfirmModal="display-none"},q(),o.updateGuestInfo=function(e){var a="string"!=e.profile.customer.namePrefix&&""!=e.profile.customer.namePrefix?e.profile.customer.namePrefix:"";if(""!=a&&void 0!=a&&null!=a){var t=s.checkForSaturation(o.titles,a);1==t.length&&(o.salutation=t[0].name)}if(o.firstName="string"!=e.profile.customer.givenName?e.profile.customer.givenName:"",o.lastName="string"!=e.profile.customer.surName?e.profile.customer.surName:"",o.email=e.profile.customer.email,e.uniqueId&&(o.selectedGuestId=e.uniqueId.id),void 0!=e.profile.customer.telephone&&e.profile.customer.telephone.length>0&&(o.phoneNumber="string"!=e.profile.customer.telephone[0].phoneNumber?e.profile.customer.telephone[0].phoneNumber:""),void 0!=e.profile.customer.telephone&&e.profile.customer.address.length>0){if(o.address1="string"!=e.profile.customer.address[0].addressLine1?e.profile.customer.address[0].addressLine1:"",o.address2="string"!=e.profile.customer.address[0].addressLine2?e.profile.customer.address[0].addressLine2:"",o.city="string"!=e.profile.customer.address[0].cityName?e.profile.customer.address[0].cityName:"",e.profile.customer.address[0].countryCode&&"string"!=e.profile.customer.address[0].countryCode&&""!=e.profile.customer.address[0].countryCode&&"default"!=e.profile.customer.address[0].countryCode)o.selectedCountry=e.profile.customer.address[0].countryCode;else{var r="string"!=e.profile.customer.address[0].countryName&&"default"!=e.profile.customer.address[0].countryCode?e.profile.customer.address[0].countryName:"";if(""!=r&&void 0!=r&&null!=r){var n=s.checkForSaturation(o.countries,r);1==n.length&&(o.selectedCountry=n[0].code)}}if(o.selectedCountry&&"string"!=o.selectedCountry&&"default"!=o.selectedCountry&&o.countryChange(),void 0!=e.profile.customer.address[0].stateName){var i="string"!=e.profile.customer.address[0].stateName&&"default"!=e.profile.customer.address[0].stateName?e.profile.customer.address[0].stateName:"",l=c("filter")(o.states,{code:i},!1);0==l.length&&(l=c("filter")(o.states,{name:i},!1)),1==l.length&&(o.selectedState=l[0].code)}o.postalcode="string"!=e.profile.customer.address[0].postalCode?e.profile.customer.address[0].postalCode:""}0==Ve&&(o.readOnlyConfig.firstNameReadOnlyIndicator=""!=o.firstName&&void 0!=o.firstName&&1==o.ResAndPayConfig.firstNameReadOnlyIndicator,o.readOnlyConfig.lastNameReadOnlyIndicator=""!=o.lastName&&void 0!=o.lastName&&1==o.ResAndPayConfig.lastNameReadOnlyIndicator,o.readOnlyConfig.emailAddressReadOnlyIndicator=""!=o.email&&void 0!=o.email&&1==o.ResAndPayConfig.emailAddressReadOnlyIndicator,o.readOnlyConfig.readOnlyFrequentGuestId=""!=o.selectedGuestId&&void 0!=o.selectedGuestId&&1==o.ResAndPayConfig.readOnlyFrequentGuestId)},o.setInfo=function(){var e=t.MRB?i.getMainReservationArray()[0]:i.getMainReservation();a.debug(JSON.stringify(e)+"mainReservation in total ");var r=e.resGuests[0],n=e.resGlobalInfo,s=e.roomStays[0],d=l.getHotelDesc().paymentProviders,g=!1,m=!1,u=!1;v.forEach(d,function(e){"creditcard-ingenico"==e.vendorKey&&(g=!0),"altpayment-ingenico"==e.vendorKey&&(m=!0),"hosting-ogone"==e.vendorKey&&(u=!0)}),void 0!=n.guaranteesAccepted[0].paymentCard.cardCode&&("paypal"==n.guaranteesAccepted[0].paymentCard.cardCode.toLowerCase()&&1!=o.xpaycredit&&1!=o.paymentexpress&&1!=o.enabledMyCheckCreditCard&&1!=o.isBrainTreePaymentEnabled&&1!=o.isAmadeusPaymentEnabled?(t.MRB&&void 0!=o.itineraryDepositAmt||!t.MRB&&void 0!=s.depositPayments.depositAmt)&&1==Ia?Fe||(o.paypal=!0,o.enablePayPal=!0):g&&(m||u)?(o.credit=!1,o.paypal=!1,o.ideal=!1):(o.credit=!0,o.paypal=!1,o.ideal=!1):"ideal"==n.guaranteesAccepted[0].paymentCard.cardCode.toLowerCase()?(t.MRB&&void 0!=o.itineraryDepositAmt||!t.MRB&&void 0!=s.depositPayments.depositAmt)&&1==Ia&&1==ba?Fe||(o.ideal=!0,o.enableIDeal=!0):g&&(m||u)?(o.credit=!1,o.paypal=!1,o.ideal=!1):(o.credit=!0,o.paypal=!1,o.ideal=!1):1!=o.ingenico&&1!=o.reddot&&1!=o.paymentexpress&&1!=o.nets&&1!=o.xpaywechat&&1!=o.xpayalipay&&1!=o.xpaypaypal&&1!=o.xpaycredit&&1!=o.adyenDotPay&&1!=o.enabledMyCheckCreditCard&&1!=o.isBrainTreePaymentEnabled&&1!=o.isAmadeusPaymentEnabled&&(o.credit=!0,o.paypal=!1,o.ideal=!1)),o.salutation=$()&&"N/A"!=r.profile.customer.namePrefix?r.profile.customer.namePrefix:null;var p=r.profile.customer.givenName,y=r.profile.customer.surName;o.firstName=$()?p.replace(/\s/g,"").length?p:"":null,o.lastName=$()?y.replace(/\s/g,"").length?y:"":null,o.email=$()?r.profile.customer.email:null,r.profile.customer.telephone.length>0?"1"==r.profile.customer.telephone[0].phoneUseType&&(o.phoneNumber=$()?r.profile.customer.telephone[0].phoneNumber:null):o.phoneNumber=null;var h=!!(r&&r.profile&&r.profile.customer&&r.profile.customer.givenName);if(o.bookerInfo={},o.ResAndPayConfig.displayBookerSalutationFieldIndicator?o.bookerInfo.salutation=h&&r.profile.booker&&r.profile.booker.salutation&&"N/A"!=r.profile.booker.salutation?r.profile.booker.salutation:null:o.bookerInfo.salutation=null,o.ResAndPayConfig.displayBookerFirstNameFieldIndicator?o.bookerInfo.firstName=h&&r.profile.booker&&r.profile.booker.firstName&&r.profile.booker.firstName.replace(/\s/g,"").length?r.profile.booker.firstName:null:o.bookerInfo.firstName=null,o.ResAndPayConfig.displayBookerLastNameFieldIndicator?o.bookerInfo.lastName=h&&r.profile.booker&&r.profile.booker.lastName&&r.profile.booker.lastName.replace(/\s/g,"").length?r.profile.booker.lastName:null:o.bookerInfo.lastName=null,o.ResAndPayConfig.displayBookerEmailAddressFieldIndicator?o.bookerInfo.email=h&&r.profile.booker?r.profile.booker.email:null:o.bookerInfo.email=null,(o.bookerInfo.salutation&&o.ResAndPayConfig.displayBookerSalutationFieldIndicator||o.bookerInfo.firstName&&o.ResAndPayConfig.displayBookerFirstNameFieldIndicator||o.bookerInfo.lastName&&o.ResAndPayConfig.displayBookerLastNameFieldIndicator||o.bookerInfo.email&&o.ResAndPayConfig.displayBookerEmailAddressFieldIndicator)&&(o.showBooker=!0,o.bookerEmailRegex=o.emailRegex),o.selectedGuestId=$()?r.uniqueId.id:null,r.profile.customer.address.length>0){var f=c("filter")(r.profile.customer.address,{useType:1})[0];void 0!=f&&(o.address1=$()?f.addressLine1:null,o.address2=$()?f.addressLine2:null,o.city=$()?f.cityName:null,o.selectedCountry=$()?f.countryCode:o.selectedCountry,o.selectedCountry&&o.countryChange(),o.selectedState=$()?f.stateCode:null,o.postalcode=$()?f.postalCode:null)}if(o.nameOnCard=$()&&e.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderInfoRequired?e.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardHolderName:null,o.cardNumber&&(o.cardNumber=o.cardNumber.replace(/\d{12}(\d{4})/,"xxxx xxxx xxxx $1")),a.debug(o.expiry+"  expiry"),t.$on("3D_SECURE_CANCEL",function(){o.expiry=null}),r.profile.customer.address.length>0&&!o.isBrainTreePaymentEnabled&&!o.isAmadeusPaymentEnabled){var C,P=c("filter")(r.profile.customer.address,{useType:3});P.length>0&&(C=P[0],o.useSameContactAddress=!C,o.billingAddressLine1=$()?C.addressLine1:null,o.billingAddressLine2=$()?C.addressLine2:null,o.billingCity=$()?C.cityName:null,o.selectedBillingCountry=$()?C.countryCode:null,o.selectedBillingCountry&&o.billingCountryChange(),void 0!=C.stateCode?o.selectedBillingState=$()?C.stateCode.trim():null:o.selectedBillingState=$()?C.stateCode:null,o.billingPostalCode=$()?C.postalCode:null)}if(o.isBrainTreePaymentEnabled||o.isAmadeusPaymentEnabled)if(r.profile.customer.address.length>0){var P,C;P=o.isAmadeusPaymentEnabled?c("filter")(r.profile.customer.address,{useType:1}):c("filter")(r.profile.customer.address,{useType:3}),P.length>0?(C=P[0],k.setBillingAddress(C),o.billingAddress=JSON.stringify(k.getBillingAddress())):(k.setBillingAddress(),o.billingAddress=JSON.stringify(k.getBillingAddress()))}else k.setBillingAddress(),o.billingAddress=JSON.stringify(k.getBillingAddress());$()&&null!=o.firstName&&""!=o.firstName||R.checkGmsLogin()&&o.updateGuestInfo(R.getGmsProfile()),o.isModifyReservation&&(o.readOnlyConfig.readOnlyFrequentGuestId=!!(o.selectedGuestId&&o.ResAndPayConfig.readOnlyFrequentGuestId||S.getIsLoyaltyReservationEnabled()&&o.ResAndPayConfig.readOnlyFrequentGuestId))},o.setInfo(),t.$on(y.GMS_LOGIN_SUCCESS,function(e,a){o.updateGuestInfo(R.getGmsProfile()),o.hideEmailMarketingConsent=R.getEmailMarketingConsentStatusGMS()}),t.$on(y.GMS_LOGOUT_SUCCESS,function(){o.hideEmailMarketingConsent=R.getEmailMarketingConsentStatusGMS()}),t.$on(y.TOTAL_PAGE_GUEST_INFO_RETRIEVED,function(e,a){Ve=!0,o.updateGuestInfo(a)}),o.$on(y.MODIFY_RESERVATION_FROM_TOTAL,function(e,a){q(),o.setInfo(),o.totalData=i.getFormattedReservationData(He),o.taxBreakoutEnabled=o.totalData.taxBreakoutEnabled,o.getFormattedDatePrices();for(var t=0;t<o.totalData.roomsData.length;t++)o.totalData.roomsData[t].nightsCollapse=!o.enableExpandedDailyRates;for(var t=0;t<o.totalData.enhancements.length;t++)o.totalData.enhancements[t].nightsCollapse=!0;for(var t=0;t<o.totalData.packageInclusions.length;t++)o.totalData.packageInclusions[t].nightsCollapse=!0;p.stepsById.total.placeholder=i.getTotalReservationAmount(),o.isModifyReservation=i.canModifyReservation();var r=i.getMainReservation(),n=r.roomStays[0].ratePlans[0].ratePlanType;"Group"==n||"group"==n?o.groupNameModifyFlow=!0:(o.groupNameModifyFlow=!1,o.selectedRatePlanName=r.roomStays[0].ratePlans[0].ratePlanName)}),o.totalData=i.getFormattedReservationData(He),o.taxBreakoutEnabled=o.totalData.taxBreakoutEnabled,o.acceptBooking=function(){var e={};e.salutation=o.salutation,e.firstName=o.firstName,e.lastName=o.lastName,e.email=o.email,e.phoneNumber=o.phoneNumber,e.contactAddress1=o.address1,e.contactAddress2=o.address2,e.contactCity=o.city,e.contactCountry=o.selectedCountry,e.contactState=o.selectedState,e.contactPostalCode=o.postalcode,e.guestId=o.selectedGuestId;var t={};t.nameOnCard=o.nameOnCard,t.cardNumber=o.cardNumber,t.cardType=o.GuestsTotalForm.cardnumber.$ccType,t.cardExpiry=o.expiry,t.ccv=o.ccv,t.useSameContactAddress=o.useSameContactAddress,t.billingAddressLine1=o.useSameContactAddress?o.address1:o.billingAddressLine1,t.billingAddressLine2=o.useSameContactAddress?o.address2:o.billingAddressLine2,t.billingCity=o.useSameContactAddress?o.city:o.billingCity,t.billingCountry=o.useSameContactAddress?o.selectedCountry:o.selectedBillingCountry,t.billingState=o.useSameContactAddress?o.selectedState:o.selectedBillingState,t.billingPostalCode=o.useSameContactAddress?o.postalcode:o.billingPostalCode,t.specialOffersByEmail=o.shareAllMarketInd,t.termsAndConditions=o.tc.confirmCheck,o.bookerInfo=o.showBooker?o.bookerInfo:{},i.setGuestAndPaymentInfo(e,o.bookerInfo,t,Pe()),a.debug(JSON.stringify(i.getMainReservation())),o.showConfirmModal="display-none",r.go("confirmation")},o.toggleAddressChkBox=function(){o.useSameContactAddress||(o.billingAddressLine1=null,o.billingAddressLine2=null,o.billingCity=null,o.selectedBillingCountry=null,o.selectedBillingState=null,o.billingStates=[],o.billingPostalCode=null)},o.cardAccepted=!0,o.selectedCreditCard="",o.$watch(function(e){return e.GuestsTotalForm.cardnumber?e.GuestsTotalForm.cardnumber.$ccType:void 0},function(e,t){if(t!=e&&e){qe=c("filter")(La,{ccType:e})[0];var r=!1;if(qe){var n=o.hotelDesc.policies.guaranteePaymentPolicy.acceptPayments;angular.forEach(n,function(e,a){e.cardCode==qe.newMapping&&(o.cvvRequiredIndicator=e.cvNumberRequired,o.cvvRequiredIndicator?o.showCVV=!0:o.showCVV=!1)}),o.cvvRequiredIndicator&&("AX"==qe.newMapping?o.ccvMinLength=4:o.ccvMinLength=3);var i=0;angular.forEach(o.acceptedCreditCards,function(e,t){e.cardCode===qe.newMapping&&(a.debug(e.cardCode+"Card Code"),o.showHideCreditImage=!0,o.selectedCreditCard="./images/icons/"+e.cardCode+".svg",i++)}),0==i&&(o.showHideCreditImage=!1,o.selectedCreditCard="",o.ccv=void 0),o.GuestsTotalForm.cardnumber.$valid&&o.showCVV&&(o.ccv=void 0),angular.forEach(Ea,function(e,a){qe.newMapping==e.cardCode&&(o.ccTypeMap=qe.linkMapping,o.ccvRequired=e.cvNumberRequired,o.cardId=e.cardId,r=!0),Ea.length==++a&&(o.cardAccepted=!0,r||(o.cardAccepted=!1))})}else o.cvvRequiredIndicator=!1,o.showCVV=!1,o.cardAccepted=!1,o.showHideCreditImage=!1,o.selectedCreditCard="",o.ccv=void 0,o.cvvRequiredIndicator=!1,o.creditCardFieldRequiredIndicator&&(o.hotelDesc.paymentProviders,o.cvvRequiredIndicatorOgone=!1)}else o.showCVV=!1,o.cvvRequiredIndicator=!1,o.showHideCreditImage=!1,o.selectedCreditCard="",o.ccv=void 0,o.cvvRequiredIndicator=!1,o.creditCardFieldRequiredIndicator&&(o.hotelDesc.paymentProviders,o.cvvRequiredIndicatorOgone=!1)});var Ga=!1;o.ccExpiryKeyPress=function(e){Ga=8===e.keyCode},o.ccExpiryChange=function(){2!=o.expiry.length||Ga||("/"!=o.expiry[1]?o.expiry+="/":"/"==o.expiry[1]&&(o.expiry=o.expiry[0]));var e=o.expiry,a=e.split("/"),t=a[0],r=a[1],n=/[^\w\s]/gi,i=/\s/;if(1==i.test(t)||1==n.test(t)||1==i.test(r)||1==n.test(r))return o.GuestsTotalForm.ccExpiry.$setValidity("$valid",!1),o.expiryDatePassed=!1,!1;if(!(parseInt(t,10)<=12))return o.GuestsTotalForm.ccExpiry.$setValidity("$valid",!1),o.expiryDatePassed=!1,!1;if(0===parseInt(t,10))return o.GuestsTotalForm.ccExpiry.$setValidity("$valid",!1),o.expiryDatePassed=!1,!1;o.GuestsTotalForm.ccExpiry.$setValidity("$valid",!0);var s=o.months[(new Date).getMonth()],l=(new Date).getFullYear();if(l=l.toString().slice(-2),l=parseInt(l),parseInt(t,10)<parseInt(s)&&parseInt(r,10)==l)return o.GuestsTotalForm.ccExpiry.$setValidity("$valid",!1),o.expiryDatePassed=!0,!1;if(o.GuestsTotalForm.ccExpiry.$setValidity("$valid",!0),o.expiryDatePassed=!1,!(parseInt(r,10)>=l&&parseInt(r,10)<=l+15)){o.GuestsTotalForm.ccExpiry.$setValidity("$valid",!1);var c=parseInt(r,10);return o.expiryDatePassed=NaN!=c&&c>9&&c<100,!1}o.GuestsTotalForm.ccExpiry.$setValidity("$valid",!0),o.expiryDatePassed=!1},o.startRequest=1,o.specialRequests=s.numToArray(o.startRequest),o.incrementRequest=function(){o.startRequest++,o.specialRequests=s.numToArray(o.startRequest)},o.stateCodes=[{key:"NY",value:"NY"},{key:"NJ",value:"NJ"},{key:"CT",value:"CT"}],o.bookReservation=function(){o.submitted=!0,i.setGuestTotals(o.guestProfile),r.go("confirmation"),o.guestProfile=Fa};var Fa={customer:{givenName:"",surName:"",emails:[],telephones:[{phoneNumber:"",phoneUseType:1}],address:[{countryCode:"",useType:1},{addressLine1:"",addressLine2:"",useType:3,cityName:"",stateCode:"",postalCode:""}]},guarantee:{guaranteesAccepted:[{paymentCard:{cardNumber:"",expireDate:"",seriesCode:""}}]},specialRequests:[],shareAllMarketInd:!0};o.defaultProfile=Fa,o.guestProfile={customer:{givenName:"",surName:"",emails:[],telephones:[{phoneNumber:"",phoneUseType:1}],address:[{countryCode:"",useType:1},{addressLine1:"",addressLine2:"",useType:3,cityName:"",stateCode:"",postalCode:""}]},guarantee:{guaranteesAccepted:[{paymentCard:{cardNumber:"",expireDate:"",seriesCode:""}}]},specialRequests:[],shareAllMarketInd:!0};var Ba=l.getHotelInfo().enableSchedPkgInclusions;1==i.getMainReservation().isModifiable&&1==Ba&&(t.enableSchedPkgInclusions=!0),o.editPackageInclusions=function(e){t.MRB&&(1!=o.mainReservationArray.length||e||(e=o.mainReservationArray[0]),i.changeSelectRoom(e.id));var n=function(){for(var e=0;e<t.RatesAvail.roomStays[0].packageTypes.length;e++)t.RatesAvail.roomStays[0].packageTypes[e].packageCode==l.ratePlanCode&&(t.inclusionsServices=t.RatesAvail.roomStays[0].packageTypes[e].inclusions);0!=t.inclusionsServices.length&&t.inclusionsServices.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var r=i.getResStartDate(),n=i.getResEndDate(),c=moment.utc(n).diff(moment.utc(r),"days")+1,d=[],g=0;g<c;g++){var m=moment.utc(r).add(g,"days").format("YYYY-MM-DD");d.push(m)}for(var u=0;u<t.inclusionsServices.length;u++){0!=t.inclusionsServices[u].serviceOptions.length&&t.inclusionsServices[u].serviceOptions.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});for(var p=[],y=0;y<t.inclusionsServices[u].serviceOptions.length;y++)for(var v=0;v<t.inclusionsServices[u].serviceOptions[y].dailyRates.length;v++)void 0==p[y]?p[y]=t.inclusionsServices[u].serviceOptions[y].dailyRates[v].adultUnitPrice:t.inclusionsServices[u].serviceOptions[y].dailyRates[v].adultRate<=p[y]&&(p[y]=t.inclusionsServices[u].serviceOptions[y].dailyRates[v].adultUnitPrice);if(void 0==t.inclusionsServices[u].minPrice?t.inclusionsServices[u].minPrice=Math.min.apply(Math,p):t.inclusionsServices[u].minPrice>=Math.min.apply(Math,p)&&(t.inclusionsServices[u].minPrice=Math.min.apply(Math,p)),t.inclusionsServices[u].checked=!1,t.inclusionsServices[u].eachDayRate=[],"PER_PERSON_PER_NIGHT"==t.inclusionsServices[u].servicePricingType||"PER_RESERVATION"==t.inclusionsServices[u].servicePricingType||"PER_ROOM_PER_NIGHT"==t.inclusionsServices[u].servicePricingType)for(var h=0;h<d.length;h++){t.inclusionsServices[u].eachDayRate[h]={},t.inclusionsServices[u].eachDayRate[h].serviceDate=d[h],t.inclusionsServices[u].eachDayRate[h].options=[]
;for(var R=0;R<t.inclusionsServices[u].serviceOptions.length;R++)for(var f=0;f<t.inclusionsServices[u].serviceOptions[R].dailyRates.length;f++)t.inclusionsServices[u].serviceOptions[R].dailyRates[f].serviceDate==d[h]&&(t.inclusionsServices[u].eachDayRate[h].options.push(t.inclusionsServices[u].serviceOptions[R].dailyRates[f]),t.inclusionsServices[u].eachDayRate[h].options[t.inclusionsServices[u].eachDayRate[h].options.length-1].serviceOptionId=t.inclusionsServices[u].serviceOptions[R].serviceOptionId,t.inclusionsServices[u].eachDayRate[h].options[t.inclusionsServices[u].eachDayRate[h].options.length-1].serviceOptionName=t.inclusionsServices[u].serviceOptions[R].serviceOptionName,t.inclusionsServices[u].eachDayRate[h].options[t.inclusionsServices[u].eachDayRate[h].options.length-1].sortOrder=t.inclusionsServices[u].serviceOptions[R].sortOrder)}else if("PER_PERSON"==t.inclusionsServices[u].servicePricingType||"PER_ROOM"==t.inclusionsServices[u].servicePricingType){for(var h=0;h<d.length;h++){t.inclusionsServices[u].eachDayRate[h]={},t.inclusionsServices[u].eachDayRate[h].serviceDate=d[h],t.inclusionsServices[u].eachDayRate[h].options=[];for(var R=0;R<t.inclusionsServices[u].serviceOptions.length;R++){for(var f=0;f<t.inclusionsServices[u].serviceOptions[R].dailyRates.length;f++)t.inclusionsServices[u].serviceOptions[R].dailyRates[f].serviceDate==d[h]&&(t.inclusionsServices[u].eachDayRate[h].options.push(t.inclusionsServices[u].serviceOptions[R].dailyRates[f]),t.inclusionsServices[u].eachDayRate[h].options[t.inclusionsServices[u].eachDayRate[h].options.length-1].serviceOptionId=t.inclusionsServices[u].serviceOptions[R].serviceOptionId,t.inclusionsServices[u].eachDayRate[h].options[t.inclusionsServices[u].eachDayRate[h].options.length-1].serviceOptionName=t.inclusionsServices[u].serviceOptions[R].serviceOptionName,t.inclusionsServices[u].eachDayRate[h].options[t.inclusionsServices[u].eachDayRate[h].options.length-1].sortOrder=t.inclusionsServices[u].serviceOptions[R].sortOrder);"PER_ROOM"==t.inclusionsServices[u].servicePricingType&&(t.inclusionsServices[u].eachDayRate[h].tempOptions=angular.copy(t.inclusionsServices[u].eachDayRate[h].options))}}for(var C,P=t.inclusionsServices[u].eachDayRate.length-1;P>=0;P--)t.inclusionsServices[u].eachDayRate[P].options.length>0?(C=t.inclusionsServices[u].eachDayRate[P].options,t.inclusionsServices[u].eachDayRate[P].options=[],"PER_ROOM"==t.inclusionsServices[u].servicePricingType&&(t.inclusionsServices[u].eachDayRate[P].tempOptions=[])):t.inclusionsServices[u].eachDayRate.splice(P,1);t.inclusionsServices[u].eachDayRate[0].options=C,"PER_ROOM"==t.inclusionsServices[u].servicePricingType&&(t.inclusionsServices[u].eachDayRate[0].tempOptions=angular.copy(C))}var S;if("PER_RESERVATION"==t.inclusionsServices[u].servicePricingType){for(var P=0;P<t.inclusionsServices[u].eachDayRate.length;P++)if(t.inclusionsServices[u].eachDayRate[P].options.length>0){t.inclusionsServices[u].eachDayRate[P].serviceDates=[],S=P;break}for(var P=0;P<t.inclusionsServices[u].eachDayRate.length;P++)t.inclusionsServices[u].eachDayRate[P].options.length>0&&(t.inclusionsServices[u].eachDayRate[S].serviceDates.push(t.inclusionsServices[u].eachDayRate[P].serviceDate),P!=S&&(t.inclusionsServices[u].eachDayRate[P].options=[]))}"PER_ROOM_PER_NIGHT"!=t.inclusionsServices[u].servicePricingType&&"PER_ROOM"!=t.inclusionsServices[u].servicePricingType||(o.roomsInservice=s.numToArray(l.rooms+1),o.roomsInservice.splice(0,1));for(var P=0;P<t.inclusionsServices[u].eachDayRate.length;P++){if("PER_PERSON_PER_NIGHT"==t.inclusionsServices[u].servicePricingType||"PER_PERSON"==t.inclusionsServices[u].servicePricingType){if(void 0==t.inclusionsServices[u].eachDayRate[P].adult&&t.inclusionsServices[u].eachDayRate[P].options.length>0&&void 0!=t.inclusionsServices[u].eachDayRate[P].options[0].adultQuantity){t.inclusionsServices[u].eachDayRate[P].adult=t.inclusionsServices[u].eachDayRate[P].options[0].adultQuantity,t.inclusionsServices[u].eachDayRate[P].adultIsSelected=!0;for(var A=0;A<o.selectedPackageInclusions.length;A++)if(o.selectedPackageInclusions[A].serviceTypeId==t.inclusionsServices[u].serviceTypeId)for(var I=0;I<o.selectedPackageInclusions[A].serviceOptions.length;I++)for(var b=0;b<o.selectedPackageInclusions[A].serviceOptions[I].dailyRates.length;b++)for(var D=0;D<t.inclusionsServices[u].eachDayRate[P].options.length;D++)t.inclusionsServices[u].eachDayRate[P].options[D].serviceDate==o.selectedPackageInclusions[A].serviceOptions[I].dailyRates[b].serviceDate&&t.inclusionsServices[u].eachDayRate[P].options[D].serviceOptionId==o.selectedPackageInclusions[A].serviceOptions[I].serviceOptionId&&(t.inclusionsServices[u].eachDayRate[P].selectOption=t.inclusionsServices[u].eachDayRate[P].options[D])}void 0==t.inclusionsServices[u].eachDayRate[P].children&&t.inclusionsServices[u].eachDayRate[P].options.length>0&&void 0!=t.inclusionsServices[u].eachDayRate[P].options[0].childQuantity&&(t.inclusionsServices[u].eachDayRate[P].children=t.inclusionsServices[u].eachDayRate[P].options[0].childQuantity,t.inclusionsServices[u].eachDayRate[P].childrenIsSelected=!0)}if(("PER_ROOM_PER_NIGHT"==t.inclusionsServices[u].servicePricingType||"PER_ROOM"==t.inclusionsServices[u].servicePricingType)&&void 0==t.inclusionsServices[u].eachDayRate[P].room&&t.inclusionsServices[u].eachDayRate[P].options.length>0&&o.roomsInservice.length>0){t.inclusionsServices[u].eachDayRate[P].room=o.roomsInservice[o.roomsInservice.length-1],t.inclusionsServices[u].eachDayRate[P].roomsIsSelected=!0;for(var A=0;A<o.selectedPackageInclusions.length;A++)if(o.selectedPackageInclusions[A].serviceTypeId==t.inclusionsServices[u].serviceTypeId)for(var I=0;I<o.selectedPackageInclusions[A].serviceOptions.length;I++)for(var b=0;b<o.selectedPackageInclusions[A].serviceOptions[I].dailyRates.length;b++)for(var D=0;D<t.inclusionsServices[u].eachDayRate[P].options.length;D++)t.inclusionsServices[u].eachDayRate[P].options[D].serviceDate==o.selectedPackageInclusions[A].serviceOptions[I].dailyRates[b].serviceDate&&t.inclusionsServices[u].eachDayRate[P].options[D].serviceOptionId==o.selectedPackageInclusions[A].serviceOptions[I].serviceOptionId&&(t.inclusionsServices[u].eachDayRate[P].selectOption=t.inclusionsServices[u].eachDayRate[P].options[D])}if("PER_RESERVATION"==t.inclusionsServices[u].servicePricingType&&void 0!=t.inclusionsServices[u].eachDayRate[P].serviceDate&&t.inclusionsServices[u].eachDayRate[P].options.length>0&&t.inclusionsServices[u].eachDayRate[P].serviceDate.length>0){t.inclusionsServices[u].eachDayRate[P].roomsIsSelected=!0;for(var A=0;A<o.selectedPackageInclusions.length;A++)if(o.selectedPackageInclusions[A].serviceTypeId==t.inclusionsServices[u].serviceTypeId){t.inclusionsServices[u].eachDayRate[P].date=o.selectedPackageInclusions[A].serviceOptions[0].dailyRates[0].serviceDate;break}t.inclusionsServices[u].eachDayRate[P].options=[];for(var I=0;I<t.inclusionsServices[u].serviceOptions.length;I++)for(var T=0;T<t.inclusionsServices[u].serviceOptions[I].dailyRates.length;T++)t.inclusionsServices[u].eachDayRate[P].date==t.inclusionsServices[u].serviceOptions[I].dailyRates[T].serviceDate&&t.inclusionsServices[u].eachDayRate[P].options.push(t.inclusionsServices[u].serviceOptions[I].dailyRates[T]);for(var I=0;I<t.inclusionsServices[u].eachDayRate[P].options.length;I++)t.inclusionsServices[u].eachDayRate[P].options[I].serviceOptionId==o.selectedPackageInclusions[A].serviceOptions[0].serviceOptionId&&(t.inclusionsServices[u].eachDayRate[P].selectOption=t.inclusionsServices[u].eachDayRate[P].options[I])}}}a.debug(JSON.stringify(t.inclusionsServices)+"$rootScope.inclusionsServices")};t.editPackageInclusions=!0;var l=i.buildOptions();void 0!=i.getMainReservation().resGlobalInfo.timeSpan.start&&(l.dateIn=i.getMainReservation().resGlobalInfo.timeSpan.start),void 0!=i.getMainReservation().resGlobalInfo.timeSpan.end&&(l.dateOut=i.getMainReservation().resGlobalInfo.timeSpan.end),a.debug(JSON.stringify(l)+"options"),l.ratePlanCode=i.getMainReservation().roomStays[0].ratePlans[0].ratePlanCode,l.ratePlanType=i.getMainReservation().roomStays[0].ratePlans[0].ratePlanType,l.reservationCode=i.getMainReservation().uniqueId,o.selectedPackageInclusions=angular.copy(i.getMainReservation().services),d.getAccommodationRooms(l).getAllRooms().then(function(e){t.RatesAvail=e.data,n(),r.go("accommodation.inclusions")})},o.deleteConfirmation=function(e,a,r){t.MRB&&a&&(i.changeSelectRoom(a.id),o.reservationInContext=a),o.deleteServiceInfo=e,m.scrollTopAnimated(0,1e3),o.deleteConfirmationPopup="display-block";var n=a&&void 0!=a.id?a.id:"";P.onModalOpen("delete-enhancement-"+n+"-"+r+"-id","delete-enhancement-modal-id","delete-enhancement-modal-header-id",!1,o.canceldeleteEnhancement)},o.canceldeleteEnhancement=function(){o.deleteConfirmationPopup="display-none",P.onModalClose()},o.deleteEnhancement=function(){P.onModalClose();var e=o.deleteServiceInfo;if(i.deleteEnhancement(e),!t.MRB||t.MRB&&1==o.mainReservationArray.length?o.totalData.enhancements=c("filter")(o.totalData.enhancements,{serviceTypeId:"!"+e.serviceTypeId}):o.reservationInContext.totalRoomData.enhancements=c("filter")(o.reservationInContext.totalRoomData.enhancements,{serviceTypeId:"!"+e.serviceTypeId}),o.deleteConfirmationPopup="display-none",a.debug(o.enhancementServices),angular.forEach(o.enhancementServices,function(a,t){a.serviceTypeId==e.serviceTypeId&&(o.enhancementServices[t].checked=!1,o.enhancementServices[t].tempChecked=!1)}),o.clearAllSelections(e,o.enhancementServices),o.isModifyReservation){i.removeExistingEnhancements(),i.modifyMainReservation(o.enhancementServices),o.totalData&&o.totalData.specialRequest.length>0&&i.setServicesDataMainReservation(o.totalData);var n=i.getMainReservation();j(),d.modifyHoldReservation(ea,n,!0).success(function(e){i.handleXssVulnerabilities(e),b.setMyCheckRefershTokenDetails(e),i.setReservation(e),z(),Ae()}).error(function(e){g.clear(),g.pop({type:"error",title:"",body:"Modify hold reservation error in total"})})}else{var n=i.getMainReservation();if(j(),t.MRB){var l=n.id;i.setMainReservationArrayById(l,n);var m=i.getMainReservationArray()}void 0!=we&&void 0!=we.guestInfo&&void 0!=we.guestInfo.loyalty&&we.guestInfo.loyalty.length>0&&!0===we.guestInfo.loyalty[0].requireRestrictionCheck&&o.addLoyaltyReqParams(n),d.callHoldReservation(ea,n,m,t.MRB,t.MRB).success(function(e){if(b.setMyCheckRefershTokenDetails(e),t.MRB){i.setMrbItineraryTotals(e.itineraryTotals),i.setMrbItineraryPaymentInfo(e.itineraryPaymentInfo);1==i.setMainReservationByEqual(e.reservationResponses)?m.length>1?(o.initMultiroomData(),i.setMainReservation(l),z()):(o.mainReservationArray=angular.copy(i.getMainReservationArray()),i.setMainReservation(o.mainReservationArray[0].id),z()):(o.failedRoomsId=i.getFailedRoomsId(),o.failedRoomsId.length>1?(o.combinedHoldFailure=!0,P.onModalOpen("book-button-id","combined-hold-failure-totals","combined-hold-failure-title-0",!1)):(s.setObjectData("combinedHoldError",!0),r.go("accommodation")))}else i.setReservation(e),z();ae(),Ae()}).error(function(e){g.clear(),g.pop({type:"error",title:"",body:"Hold reservation error in total"})})}setTimeout(function(){var e=document.getElementById("your-reservation-title");e&&e.focus()})},o.goBack=function(e){var a=!1;1==e.tempChecked?e.tempChecked=!0:e.tempChecked=void 0,o.showServices="display-none",angular.forEach(e.eachDayRate,function(t){if(t.allSelected=t.tempAllSelected,void 0==t.dateIsSelected||0==t.dateIsSelected?(delete t.date,delete t.dropdownDate,delete t.dateColor):(t.date=t.tempDate,t.dateColor="#898989",t.dropdownDate="#eaeaea"),void 0==t.adultIsSelected||0==t.adultIsSelected?(delete t.adult,delete t.dropdownAdult,delete t.adultsColor):(t.adult=t.tempAdult,t.adultsColor="#898989",t.dropdownAdult="#eaeaea"),void 0==t.childrenIsSelected||0==t.childrenIsSelected?(delete t.children,delete t.dropdownChildren,delete t.childrenColor):(t.children=t.tempChildren,t.childrenColor="#898989",t.dropdownChildren="#eaeaea"),void 0==t.roomsIsSelected||0==t.roomsIsSelected?(delete t.room,delete t.dropdownRooms,delete t.roomsColor):void 0!=t.selectOptionIsSelected&&0!=t.selectOptionIsSelected&&(a=!0,t.room=t.tempRooms,t.roomsColor="#898989",t.dropdownRooms="#eaeaea"),1==t.tempIsChecked?(t.isChecked=!0,e.hideAgain=!0):0==t.tempIsChecked&&(t.isChecked=!1,e.hideAgain=!1),void 0==t.selectOptionIsSelected||0==t.selectOptionIsSelected)t.allSelected=!1,delete t.selectOption,delete t.dropdownOptions,delete t.optionsColor,t.options.length>0&&(e.hideAgain=!1),t.isChecked=!1;else{if("PER_RESERVATION"==e.servicePricingType){t.options=t.tempReservationOptions;for(var o=0;o<t.options.length;o++)if(t.tempSelectOption.serviceOptionId==t.options[o].serviceOptionId){t.selectOption=t.options[o];break}}else t.selectOption=t.tempSelectOption;a=!0,t.optionsColor="#898989",t.dropdownOptions="#eaeaea"}1==a?(e.tempChecked=!0,e.checked=!0):(e.tempChecked=!1,e.checked=!1)});for(var t=e.eachDayRate.length-1;t>0;t--)1==e.eachDayRate[t].isAdded&&void 0==e.eachDayRate[t].selectOption&&(e.eachDayRate.splice(t,1),e.addAnotherItemVar=e.addAnotherItemVar-1);P.onModalClose()},o.done=function(e){if(a.debug(e+"Current  Service"),"PER_ROOM"==e.servicePricingType)for(var n=e.eachDayRate.length-1;n>=0;n--)1==e.eachDayRate[n].isAdded&&void 0==e.eachDayRate[n].selectOption?(e.eachDayRate.splice(n,1),e.addAnotherItemVar=e.addAnotherItemVar-1):void 0==e.eachDayRate[n].isAdded&&void 0==e.eachDayRate[n].selectOption&&e.eachDayRate.splice(n,1);var l=!1;o.showServices="display-none";for(var c=[],m=0,u=[],p=[],y=0,v=0,n=0;n<e.eachDayRate.length;n++){if(1==e.eachDayRate[n].allSelected?e.eachDayRate[n].tempAllSelected=!0:e.eachDayRate[n].tempAllSelected=!1,void 0!=e.eachDayRate[n].date?(e.eachDayRate[n].dateIsSelected=!0,e.eachDayRate[n].tempDate=e.eachDayRate[n].date,e.date=e.eachDayRate[n].date):void 0==e.eachDayRate[n].date&&(e.eachDayRate[n].dateIsSelected=!1,delete e.eachDayRate[n].tempDate),1==e.eachDayRate[n].isChecked?(e.eachDayRate[n].tempIsChecked=!0,e.hideAgain=!1):0==e.eachDayRate[n].isChecked&&(e.eachDayRate[n].tempIsChecked=!1,e.hideAgain=!0),void 0!=e.eachDayRate[n].adult&&0!=e.eachDayRate[n].adult?(e.eachDayRate[n].adultIsSelected=!0,e.eachDayRate[n].tempAdult=e.eachDayRate[n].adult,c.push(e.eachDayRate[n].adult)):void 0==e.eachDayRate[n].adult?(e.eachDayRate[n].adultIsSelected=!1,delete e.eachDayRate[n].tempAdult):0==e.eachDayRate[n].adult&&0!=e.eachDayRate[n].children&&void 0!=e.eachDayRate[n].children&&(e.eachDayRate[n].adultIsSelected=!0,e.eachDayRate[n].tempAdult=e.eachDayRate[n].adult,c.push(e.eachDayRate[n].adult)),void 0!=e.eachDayRate[n].children&&0!=e.eachDayRate[n].children&&void 0!=e.eachDayRate[n].selectOption?(e.eachDayRate[n].childrenIsSelected=!0,e.eachDayRate[n].tempChildren=e.eachDayRate[n].children,u.push(e.eachDayRate[n].children)):void 0==e.eachDayRate[n].children?(e.eachDayRate[n].childrenIsSelected=!1,delete e.eachDayRate[n].tempChildren):0==e.eachDayRate[n].children&&0!=e.eachDayRate[n].adult&&void 0!=e.eachDayRate[n].adult&&void 0!=e.eachDayRate[n].selectOption?(e.eachDayRate[n].childrenIsSelected=!0,e.eachDayRate[n].tempChildren=e.eachDayRate[n].children,u.push(e.eachDayRate[n].children)):0==e.eachDayRate[n].children&&void 0==e.eachDayRate[n].adult&&void 0!=e.eachDayRate[n].selectOption?(e.eachDayRate[n].childrenIsSelected=!1,delete e.eachDayRate[n].children,delete e.eachDayRate[n].tempChildren,delete e.eachDayRate[n].selectOption,delete e.eachDayRate[n].dropdownOptions,delete e.eachDayRate[n].optionsColor,delete e.eachDayRate[n].tempSelectOption,e.eachDayRate[n].allSelected=!1,e.eachDayRate[n].selectOptionIsSelected=!1):0==e.eachDayRate[n].children&&0==e.eachDayRate[n].adult&&void 0!=e.eachDayRate[n].selectOption&&(e.eachDayRate[n].adultIsSelected=!1,delete e.eachDayRate[n].adult,delete e.eachDayRate[n].tempAdult,delete e.eachDayRate[n].selectOption,delete e.eachDayRate[n].dropdownOptions,delete e.eachDayRate[n].optionsColor,delete e.eachDayRate[n].tempSelectOption,e.eachDayRate[n].childrenIsSelected=!1,delete e.eachDayRate[n].children,delete e.eachDayRate[n].tempChildren,delete e.eachDayRate[n].selectOption,delete e.eachDayRate[n].dropdownOptions,delete e.eachDayRate[n].optionsColor,delete e.eachDayRate[n].tempSelectOption,e.eachDayRate[n].allSelected=!1,e.eachDayRate[n].selectOptionIsSelected=!1),void 0!=e.eachDayRate[n].room?(e.eachDayRate[n].roomsIsSelected=!0,e.eachDayRate[n].tempRooms=e.eachDayRate[n].room,p.push(e.eachDayRate[n].room)):void 0==e.eachDayRate[n].room&&(e.eachDayRate[n].roomsIsSelected=!1,delete e.eachDayRate[n].tempRooms),1==e.eachDayRate[n].isChecked?e.eachDayRate[n].tempIsChecked=!0:0==e.eachDayRate[n].isChecked&&(e.eachDayRate[n].tempIsChecked=!1),void 0!=e.eachDayRate[n].selectOption?void 0!=e.eachDayRate[n].date||void 0!=e.eachDayRate[n].adult||void 0!=e.eachDayRate[n].children||void 0!=e.eachDayRate[n].room?(e.eachDayRate[n].selectOptionIsSelected=!0,e.eachDayRate[n].tempSelectOption=e.eachDayRate[n].selectOption,"PER_RESERVATION"==e.servicePricingType&&e.eachDayRate[n].options.length>0&&(e.eachDayRate[n].tempReservationOptions=e.eachDayRate[n].options),l=!0):"PER_ROOM"==e.servicePricingType?(delete e.eachDayRate[n].selectOption,delete e.eachDayRate[n].dropdownOptions,delete e.eachDayRate[n].optionsColor,e.eachDayRate[n].selectOptionIsSelected=!1,delete e.eachDayRate[n].tempSelectOption,delete e.eachDayRate[n].isAdded,e.eachDayRate[n].options=[],e.addAnotherItemVar=e.addAnotherItemVar-1):(delete e.eachDayRate[n].selectOption,delete e.eachDayRate[n].dropdownOptions,delete e.eachDayRate[n].optionsColor,e.eachDayRate[n].selectOptionIsSelected=!1,delete e.eachDayRate[n].tempSelectOption,delete e.eachDayRate[n].isAdded):void 0==e.eachDayRate[n].selectOption&&(e.eachDayRate[n].selectOptionIsSelected=!1,delete e.eachDayRate[n].tempSelectOption),void 0!=e.eachDayRate[n].adult&&void 0!=e.eachDayRate[n].selectOption)var h=e.eachDayRate[n].adult*e.eachDayRate[n].selectOption.adultUnitPrice;else var h=0;if("PER_RESERVATION"==e.servicePricingType&&void 0!=e.eachDayRate[n].selectOption)var h=e.eachDayRate[n].selectOption.adultUnitPrice;else if("PER_PERSON_PER_NIGHT"!=e.servicePricingType&&"PER_PERSON"!=e.servicePricingType)var h=0;if(void 0!=e.eachDayRate[n].children&&void 0!=e.eachDayRate[n].selectOption)var R=e.eachDayRate[n].children*e.eachDayRate[n].selectOption.childUnitPrice;else var R=0;if(void 0!=e.eachDayRate[n].room&&void 0!=e.eachDayRate[n].selectOption)var f=e.eachDayRate[n].room*e.eachDayRate[n].selectOption.adultUnitPrice;else var f=0;void 0!=e.eachDayRate[n].selectOption&&void 0!=e.eachDayRate[n].adult&&(o.enhancementFlag=!0,y=y+h+R,v=v+h+R-e.eachDayRate[n].selectOption.discountRate*(e.eachDayRate[n].selectOption.adultUnitPrice+e.eachDayRate[n].selectOption.childUnitPrice)*e.eachDayRate[n].adult),void 0!=e.eachDayRate[n].selectOption&&void 0==e.eachDayRate[n].adult&&void 0!=e.eachDayRate[n].children&&(y+=R,v=v+R-e.eachDayRate[n].selectOption.discountRate*e.eachDayRate[n].selectOption.childUnitPrice*e.eachDayRate[n].children*(1+e.eachDayRate[n].selectOption.taxRate)),void 0!=e.eachDayRate[n].selectOption&&void 0!=e.eachDayRate[n].room&&(o.enhancementFlag=!0,y+=f,v=v+f-e.eachDayRate[n].selectOption.discountRate*e.eachDayRate[n].selectOption.adultUnitPrice*e.eachDayRate[n].room),"PER_RESERVATION"==e.servicePricingType&&void 0!=e.eachDayRate[n].selectOption&&(o.enhancementFlag=!0,y+=h,v=v+h-e.eachDayRate[n].selectOption.discountRate*e.eachDayRate[n].selectOption.adultUnitPrice),e.adult=Math.max.apply(null,c),e.children=Math.max.apply(null,u),e.rooms=Math.max.apply(null,p),((void 0!=e.eachDayRate[n].adult||void 0!=e.eachDayRate[n].room)&&void 0!=e.eachDayRate[n].selectOption&&"PER_PERSON"!=e.servicePricingType&&"PER_ROOM"!=e.servicePricingType||"PER_RESERVATION"==e.servicePricingType&&void 0!=e.eachDayRate[n].selectOption)&&m++}e.days=m,e.price=y,e.finalPrice=v,1==l?(e.tempChecked=!0,e.checked=!0):(e.tempChecked=!1,e.checked=!1),o.subTotalFinalPrice=0;for(var n=0;n<o.enhancementServices.length;n++)void 0!=o.subTotalFinalPrice&&void 0!=o.enhancementServices[n].finalPrice?o.subTotalFinalPrice=o.subTotalFinalPrice+o.enhancementServices[n].finalPrice:void 0!=o.enhancementServices[n].finalPrice&&(o.subTotalFinalPrice=o.enhancementServices[n].finalPrice);for(var C=!1,n=0;n<o.enhancementServices.length;n++)1==o.enhancementServices[n].checked&&(C=!0);o.submitEnable=1!=C,a.debug(e);for(var n=0;n<o.totalData.enhancements.length;n++)if(e.serviceTypeId==o.totalData.enhancements[n].serviceTypeId){n;break}a.debug(JSON.stringify(o.enhancementServices)+"$scope.enhancementServices in total1"),i.removeExistingEnhancements(),i.modifyMainReservation(o.enhancementServices),o.totalData&&o.totalData.specialRequest.length>0&&i.setServicesDataMainReservation(o.totalData),a.debug(JSON.stringify(o.enhancementServices)+"$scope.enhancementServices in total2");var S=i.getMainReservation();if(a.debug("_reservationService"),a.debug(S),a.debug(S.services),j(),o.isModifyReservation)d.modifyHoldReservation(ea,S,!0).success(function(e){i.handleXssVulnerabilities(e),b.setMyCheckRefershTokenDetails(e),g.clear(),i.setReservation(e),z(),a.debug("$scope.totalData.roomsData.formattedTotalRoomPrice"),a.debug(o.totalData),o.enhancementServices=T.deleteOldPriceArray(o.enhancementServices),o.enhancementServices=T.mergeModifyEnhancements(e.services,o.enhancementServices),Ae()}).error(function(e){g.clear(),g.pop({type:"error",title:"",body:"Modify hold reservation error"})});else{if(t.MRB){var A=S.id;i.setMainReservationArrayById(A,S);var I=i.getMainReservationArray()}void 0!=we&&void 0!=we.guestInfo&&void 0!=we.guestInfo.loyalty&&we.guestInfo.loyalty.length>0&&!0===we.guestInfo.loyalty[0].requireRestrictionCheck&&o.addLoyaltyReqParams(S),d.callHoldReservation(ea,S,I,t.MRB,t.MRB).success(function(e){if(b.setMyCheckRefershTokenDetails(e),g.clear(),t.MRB){i.setMrbItineraryTotals(e.itineraryTotals),i.setMrbItineraryPaymentInfo(e.itineraryPaymentInfo);1==i.setMainReservationByEqual(e.reservationResponses)?I.length>1?(o.initMultiroomData(),i.setMainReservation(A),z()):(o.mainReservationArray=angular.copy(i.getMainReservationArray()),i.setMainReservation(o.mainReservationArray[0].id),z()):(o.failedRoomsId=i.getFailedRoomsId(),o.failedRoomsId.length>1?(o.combinedHoldFailure=!0,P.onModalOpen("book-button-id","combined-hold-failure-totals","combined-hold-failure-title-0",!1)):(s.setObjectData("combinedHoldError",!0),r.go("accommodation")))}else i.setReservation(e),z();ae(),Ae()}).error(function(){g.clear(),g.pop({type:"error",title:"",body:"Hold reservation error"}),t.bookedError=!0})}P.onModalClose()},o.enhancementsEnabledFlag=l.getHotelDesc().uxConfiguration.enhancementsEnabled,o.getEnhancementServices=function(e,r){var n=i.buildOptions();o.hideMoreEnhancement=!1,o.servicesLimit=2;var s=i.getMainReservation();n.ratePlanCode=s.roomStays[0].ratePlans[0].ratePlanCode,n.ratePlanType=s.roomStays[0].ratePlans[0].ratePlanType,S.getIsLoyaltyReservationEnabled()&&(S.getIsBrandBarDisplay()||D.getMenubarEnabled())&&S.getLoyaltyTierId()&&(n.loyaltySignIn=S.getLoyaltyTierId()),t.finalServices=angular.copy(n),a.debug(JSON.stringify(n)+"options in enhancement"),d.getEnhancementServices(n).then(function(n){o.enhancementServices=n;for(var s=o.enhancementServices.length-1;s>0;s--)"SERVICE_REQUEST"==o.enhancementServices[s].serviceCategory&&o.enhancementServices.splice(s,1);for(var c=[],d=[],s=0;s<o.enhancementServices.length;s++)"ENHANCEMENT"==o.enhancementServices[s].serviceCategory&&c.push(o.enhancementServices[s]),"PACKAGE_OPTION"==o.enhancementServices[s].serviceCategory&&d.push(o.enhancementServices[s]);0!=c.length&&c.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),0!=d.length&&d.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0}),o.enhancementServices=d.concat(c);for(var g=i.getResStartDate(),m=i.getResEndDate(),u=moment.utc(m).diff(moment.utc(g),"days")+1,p=[],y=0;y<u;y++){var v=moment.utc(g).add(y,"days").format("YYYY-MM-DD");p.push(v)}if(angular.forEach(o.enhancementServices,function(e){!o.hasDiscountServices&&e.discountRuleId&&(o.hasDiscountServices=!0),e.showPriceAsDiscountedPrice=e.showPriceAsDiscountedPrice&&l.getUxConfiguration().strikeThroughPricingEnabled,0!=e.serviceOptions.length&&e.serviceOptions.sort(function(e,a){return e.sortOrder>a.sortOrder?1:e.sortOrder<a.sortOrder?-1:0});var a=T.getMinimumDayRate(e),t=a.selectFirstDateOFDiscount,r=a.tempAdultRate,n=a.tempAdultDiscount;if(void 0==e.minPrice?(e.minPrice=Math.min.apply(Math,r),o.hasDiscountServices&&(minPriceIndex=r.indexOf(Math.min.apply(Math,r)))):e.minPrice>=Math.min.apply(Math,r)&&(e.minPrice=Math.min.apply(Math,r),o.hasDiscountServices&&(minPriceIndex=r.indexOf(Math.min.apply(Math,r)))),o.hasDiscountServices&&void 0==e.discountedPrice&&(e.discountedPrice=e.minPrice-n[minPriceIndex]),e.checked=!1,e.eachDayRate=[],"PER_PERSON_PER_NIGHT"==e.servicePricingType||"PER_RESERVATION"==e.servicePricingType||"PER_ROOM_PER_NIGHT"==e.servicePricingType)for(var i=0;i<p.length;i++){e.eachDayRate[i]={},e.eachDayRate[i].serviceDate=p[i],e.eachDayRate[i].options=[];for(var s=0;s<e.serviceOptions.length;s++)for(var c=0;c<e.serviceOptions[s].dailyRates.length;c++)e.serviceOptions[s].dailyRates[c].serviceDate==p[i]&&(e.eachDayRate[i].options.push(e.serviceOptions[s].dailyRates[c]),e.eachDayRate[i].options[e.eachDayRate[i].options.length-1].serviceOptionId=e.serviceOptions[s].serviceOptionId,e.eachDayRate[i].options[e.eachDayRate[i].options.length-1].serviceOptionName=e.serviceOptions[s].serviceOptionName,e.eachDayRate[i].options[e.eachDayRate[i].options.length-1].sortOrder=e.serviceOptions[s].sortOrder)}else if("PER_PERSON"==e.servicePricingType||"PER_ROOM"==e.servicePricingType){for(var i=0;i<p.length;i++){e.eachDayRate[i]={},e.eachDayRate[i].serviceDate=p[i],e.eachDayRate[i].options=[];for(var s=0;s<e.serviceOptions.length;s++)for(var c=0;c<e.serviceOptions[s].dailyRates.length;c++)e.serviceOptions[s].dailyRates[c].serviceDate==t&&(e.eachDayRate[i].options.push(e.serviceOptions[s].dailyRates[c]),e.eachDayRate[i].options[e.eachDayRate[i].options.length-1].serviceOptionId=e.serviceOptions[s].serviceOptionId,e.eachDayRate[i].options[e.eachDayRate[i].options.length-1].serviceOptionName=e.serviceOptions[s].serviceOptionName,e.eachDayRate[i].options[e.eachDayRate[i].options.length-1].sortOrder=e.serviceOptions[s].sortOrder,"PER_ROOM"==e.servicePricingType&&(e.eachDayRate[i].tempOptions=angular.copy(e.eachDayRate[i].options)))}for(var d,g=0;e.eachDayRate.length>g;g++)if(d=void 0,e.eachDayRate[g].options.length>0?t===e.eachDayRate[g].serviceDate?(d=e.eachDayRate[g].options,e.eachDayRate[g].options=[],"PER_ROOM"==e.servicePricingType&&(e.eachDayRate[g].tempOptions=[])):(e.eachDayRate[g].options=[],"PER_ROOM"==e.servicePricingType&&(e.eachDayRate[g].tempOptions=[])):e.eachDayRate.splice(g,1),t&&d){if("PER_ROOM"==e.servicePricingType)for(ml=0;d.length>ml;ml++)d[ml].maxLimit=e.maxLimit;e.eachDayRate[g].options=d,"PER_ROOM"==e.servicePricingType&&(e.eachDayRate[g].tempOptions=angular.copy(d))}}var m;if("PER_RESERVATION"==e.servicePricingType){for(var g=0;g<e.eachDayRate.length;g++)if(t===e.eachDayRate[g].serviceDate&&e.eachDayRate[g].options.length>0){e.eachDayRate[g].serviceDates=[],m=g;break}for(var g=0;g<e.eachDayRate.length;g++)e.eachDayRate[g].options.length>0&&(e.eachDayRate[m].serviceDates.push(e.eachDayRate[g].serviceDate),g!=m&&(e.eachDayRate[g].options=[]))}}),o.servicesLimit=2,o.hideMoreEnhancement=!1,o.selectedEnhancements=[],void 0!=i.getReservation().services)for(var s=0;s<i.getReservation().services.length;s++)"ENHANCEMENT"!=i.getReservation().services[s].serviceCategory&&"PACKAGE_OPTION"!=i.getReservation().services[s].serviceCategory||o.selectedEnhancements.push(i.getReservation().services[s]);a.debug("selected enhancements"),a.debug(o.selectedEnhancements),o.selectedEnhancements.length>0&&(function(){o.enhancementServices=T.deleteOldPriceArray(o.enhancementServices),o.enhancementServices=T.mergeModifyEnhancements(o.selectedEnhancements,o.enhancementServices),a.debug(JSON.stringify(o.enhancementServices)+" in modify enhancements");for(var e=0;e<o.enhancementServices.length;e++){for(var t=[],r=0,n=[],i=[],s=0,l=0,c=0,d=0,g=0,m=0;m<o.enhancementServices[e].eachDayRate.length;m++){if("PER_PERSON_PER_NIGHT"==o.enhancementServices[e].servicePricingType&&void 0==o.enhancementServices[e].eachDayRate[m].adult&&o.enhancementServices[e].eachDayRate[m].options.length>0)for(var u=0;u<o.selectedEnhancements.length;u++)if(o.selectedEnhancements[u].serviceTypeId==o.enhancementServices[e].serviceTypeId)for(var p=0;p<o.selectedEnhancements[u].serviceOptions.length;p++)for(var y=0;y<o.selectedEnhancements[u].serviceOptions[p].dailyRates.length;y++){for(var v=0;v<o.enhancementServices[e].eachDayRate[m].options.length;v++)o.enhancementServices[e].eachDayRate[m].options[v].serviceDate==o.selectedEnhancements[u].serviceOptions[p].dailyRates[y].serviceDate&&o.enhancementServices[e].eachDayRate[m].options[v].serviceOptionId==o.selectedEnhancements[u].serviceOptions[p].serviceOptionId&&(o.enhancementServices[e].eachDayRate[m].selectOption=o.enhancementServices[e].eachDayRate[m].options[v],o.enhancementServices[e].eachDayRate[m].tempSelectOption=o.enhancementServices[e].eachDayRate[m].options[v],o.enhancementServices[e].eachDayRate[m].selectOptionIsSelected=!0,o.enhancementServices[e].eachDayRate[m].optionsColor="#898989",o.enhancementServices[e].eachDayRate[m].dropdownOptions="#eaeaea");o.selectedEnhancements[u].serviceOptions[p].dailyRates[y].serviceDate==o.enhancementServices[e].eachDayRate[m].serviceDate&&(void 0!=o.selectedEnhancements[u].serviceOptions[p].dailyRates[y].adultQuantity&&(o.enhancementServices[e].eachDayRate[m].oldTotalAdult>0?o.enhancementServices[e].eachDayRate[m].adult=o.enhancementServices[e].eachDayRate[m].oldTotalAdult:o.enhancementServices[e].eachDayRate[m].adult=o.selectedEnhancements[u].serviceOptions[p].dailyRates[y].adultQuantity,o.enhancementServices[e].eachDayRate[m].tempAdult=angular.copy(o.enhancementServices[e].eachDayRate[m].adult),o.enhancementServices[e].eachDayRate[m].adultIsSelected=!0,o.enhancementServices[e].eachDayRate[m].dropdownAdult="#eaeaea",o.enhancementServices[e].eachDayRate[m].adultsColor="#898989",t.push(o.enhancementServices[e].eachDayRate[m].adult)),void 0!=o.selectedEnhancements[u].serviceOptions[p].dailyRates[y].childQuantity&&(o.enhancementServices[e].eachDayRate[m].oldTotalChild>0?o.enhancementServices[e].eachDayRate[m].children=o.enhancementServices[e].eachDayRate[m].oldTotalChild:o.enhancementServices[e].eachDayRate[m].children=o.selectedEnhancements[u].serviceOptions[p].dailyRates[y].childQuantity,o.enhancementServices[e].eachDayRate[m].tempChildren=angular.copy(o.enhancementServices[e].eachDayRate[m].children),o.enhancementServices[e].eachDayRate[m].childrenIsSelected=!0,o.enhancementServices[e].eachDayRate[m].dropdownChildren="#eaeaea",o.enhancementServices[e].eachDayRate[m].childrenColor="#898989",n.push(o.enhancementServices[e].eachDayRate[m].children)))}if("PER_PERSON"==o.enhancementServices[e].servicePricingType&&void 0==o.enhancementServices[e].eachDayRate[m].adult&&o.enhancementServices[e].eachDayRate[m].options.length>0)for(var u=0;u<o.selectedEnhancements.length;u++)if(o.selectedEnhancements[u].serviceTypeId==o.enhancementServices[e].serviceTypeId)for(var p=0;p<o.selectedEnhancements[u].serviceOptions.length;p++)for(var y=0;y<o.selectedEnhancements[u].serviceOptions[p].dailyRates.length;y++){for(var v=0;v<o.enhancementServices[e].eachDayRate[m].options.length;v++)o.enhancementServices[e].eachDayRate[m].options[v].serviceDate==o.selectedEnhancements[u].serviceOptions[p].dailyRates[y].serviceDate&&o.enhancementServices[e].eachDayRate[m].options[v].serviceOptionId==o.selectedEnhancements[u].serviceOptions[p].serviceOptionId&&(o.enhancementServices[e].eachDayRate[m].selectOption=o.enhancementServices[e].eachDayRate[m].options[v],
o.enhancementServices[e].eachDayRate[m].tempSelectOption=o.enhancementServices[e].eachDayRate[m].options[v],o.enhancementServices[e].eachDayRate[m].selectOptionIsSelected=!0,o.enhancementServices[e].eachDayRate[m].optionsColor="#898989",o.enhancementServices[e].eachDayRate[m].dropdownOptions="#eaeaea");void 0!=o.enhancementServices[e].eachDayRate[m].selectOption&&o.selectedEnhancements[u].serviceOptions[p].dailyRates[y].serviceDate==o.enhancementServices[e].eachDayRate[m].selectOption.serviceDate&&(void 0!=o.selectedEnhancements[u].serviceOptions[p].dailyRates[y].adultQuantity&&(o.enhancementServices[e].eachDayRate[m].oldTotalAdult>0?o.enhancementServices[e].eachDayRate[m].adult=o.enhancementServices[e].eachDayRate[m].oldTotalAdult:o.enhancementServices[e].eachDayRate[m].adult=o.selectedEnhancements[u].serviceOptions[p].dailyRates[y].adultQuantity,o.enhancementServices[e].eachDayRate[m].tempAdult=angular.copy(o.enhancementServices[e].eachDayRate[m].adult),o.enhancementServices[e].eachDayRate[m].adultIsSelected=!0,o.enhancementServices[e].eachDayRate[m].dropdownAdult="#eaeaea",o.enhancementServices[e].eachDayRate[m].adultsColor="#898989",t.push(o.enhancementServices[e].eachDayRate[m].adult)),void 0!=o.selectedEnhancements[u].serviceOptions[p].dailyRates[y].childQuantity&&(o.enhancementServices[e].eachDayRate[m].oldTotalChild>0?o.enhancementServices[e].eachDayRate[m].children=o.enhancementServices[e].eachDayRate[m].oldTotalChild:o.enhancementServices[e].eachDayRate[m].children=o.selectedEnhancements[u].serviceOptions[p].dailyRates[y].childQuantity,o.enhancementServices[e].eachDayRate[m].tempChildren=angular.copy(o.enhancementServices[e].eachDayRate[m].children),o.enhancementServices[e].eachDayRate[m].childrenIsSelected=!0,o.enhancementServices[e].eachDayRate[m].dropdownChildren="#eaeaea",o.enhancementServices[e].eachDayRate[m].childrenColor="#898989",n.push(o.enhancementServices[e].eachDayRate[m].children)))}if("PER_ROOM_PER_NIGHT"==o.enhancementServices[e].servicePricingType&&void 0==o.enhancementServices[e].eachDayRate[m].room&&o.enhancementServices[e].eachDayRate[m].options.length>0)for(var u=0;u<o.selectedEnhancements.length;u++)if(o.selectedEnhancements[u].serviceTypeId==o.enhancementServices[e].serviceTypeId)for(var p=0;p<o.selectedEnhancements[u].serviceOptions.length;p++)for(var y=0;y<o.selectedEnhancements[u].serviceOptions[p].dailyRates.length;y++){for(var v=0;v<o.enhancementServices[e].eachDayRate[m].options.length;v++)o.enhancementServices[e].eachDayRate[m].options[v].serviceDate==o.selectedEnhancements[u].serviceOptions[p].dailyRates[y].serviceDate&&o.enhancementServices[e].eachDayRate[m].options[v].serviceOptionId==o.selectedEnhancements[u].serviceOptions[p].serviceOptionId&&(o.enhancementServices[e].eachDayRate[m].selectOption=o.enhancementServices[e].eachDayRate[m].options[v],o.enhancementServices[e].eachDayRate[m].tempSelectOption=o.enhancementServices[e].eachDayRate[m].options[v],o.enhancementServices[e].eachDayRate[m].selectOptionIsSelected=!0,o.enhancementServices[e].eachDayRate[m].optionsColor="#898989",o.enhancementServices[e].eachDayRate[m].dropdownOptions="#eaeaea");o.selectedEnhancements[u].serviceOptions[p].dailyRates[y].serviceDate==o.enhancementServices[e].eachDayRate[m].serviceDate&&void 0!=o.selectedEnhancements[u].serviceOptions[p].dailyRates[y].quantity&&(o.enhancementServices[e].eachDayRate[m].oldTotalRoom>0?o.enhancementServices[e].eachDayRate[m].room=o.enhancementServices[e].eachDayRate[m].oldTotalRoom:o.enhancementServices[e].eachDayRate[m].room=o.selectedEnhancements[u].serviceOptions[p].dailyRates[y].quantity,o.enhancementServices[e].eachDayRate[m].room&&(o.enhancementServices[e].eachDayRate[m].tempRooms=angular.copy(o.enhancementServices[e].eachDayRate[m].room),o.enhancementServices[e].eachDayRate[m].roomsIsSelected=!0),o.enhancementServices[e].eachDayRate[m].dropdownRooms="#eaeaea",o.enhancementServices[e].eachDayRate[m].roomsColor="#898989",i.push(o.enhancementServices[e].eachDayRate[m].room))}if("PER_ROOM"==o.enhancementServices[e].servicePricingType&&void 0==o.enhancementServices[e].eachDayRate[m].room&&o.enhancementServices[e].eachDayRate[m].options.length>0&&void 0==o.enhancementServices[e].eachDayRate[m].selectOption)for(var u=0;u<o.selectedEnhancements.length;u++)if(o.selectedEnhancements[u].serviceTypeId==o.enhancementServices[e].serviceTypeId)for(var h,R=!1,p=0;p<o.selectedEnhancements[u].serviceOptions.length;p++)if(0==R){for(var v=0;v<o.enhancementServices[e].eachDayRate[m].options.length;v++)o.enhancementServices[e].eachDayRate[m].options[v].serviceOptionId==o.selectedEnhancements[u].serviceOptions[p].serviceOptionId&&(o.enhancementServices[e].eachDayRate[m].selectOption=o.enhancementServices[e].eachDayRate[m].options[v],o.enhancementServices[e].eachDayRate[m].tempSelectOption=o.enhancementServices[e].eachDayRate[m].options[v],o.enhancementServices[e].eachDayRate[m].selectOptionIsSelected=!0,o.enhancementServices[e].eachDayRate[m].optionsColor="#898989",o.enhancementServices[e].eachDayRate[m].dropdownOptions="#eaeaea",h=m,R=!0,o.enhancementServices[e].addAnotherItemVar=1);o.selectedEnhancements[u].serviceOptions[p].serviceOptionId==o.enhancementServices[e].eachDayRate[m].selectOption.serviceOptionId&&void 0!=o.selectedEnhancements[u].serviceOptions[p].dailyRates[0].quantity&&(o.enhancementServices[e].eachDayRate[m].selectOption.oldTotalRoom>0?o.enhancementServices[e].eachDayRate[m].room=o.enhancementServices[e].eachDayRate[m].selectOption.oldTotalRoom:o.enhancementServices[e].eachDayRate[m].room=o.selectedEnhancements[u].serviceOptions[p].dailyRates[0].quantity,o.enhancementServices[e].eachDayRate[m].room&&(o.enhancementServices[e].eachDayRate[m].tempRooms=angular.copy(o.enhancementServices[e].eachDayRate[m].room),o.enhancementServices[e].eachDayRate[m].roomsIsSelected=!0),o.enhancementServices[e].eachDayRate[m].dropdownRooms="#eaeaea",o.enhancementServices[e].eachDayRate[m].roomsColor="#898989",i.push(o.enhancementServices[e].eachDayRate[m].room))}else{var h=h+1;if(void 0!=o.enhancementServices[e].eachDayRate[h]){o.enhancementServices[e].eachDayRate[h].options=angular.copy(o.enhancementServices[e].eachDayRate[h-1].options),o.enhancementServices[e].eachDayRate[h].tempOptions=angular.copy(o.enhancementServices[e].eachDayRate[h-1].tempOptions);for(var v=0;v<o.enhancementServices[e].eachDayRate[h].options.length;v++)o.enhancementServices[e].eachDayRate[h].options[v].serviceOptionId==o.selectedEnhancements[u].serviceOptions[p].serviceOptionId&&(o.enhancementServices[e].eachDayRate[h].selectOption=o.enhancementServices[e].eachDayRate[h].options[v],o.enhancementServices[e].eachDayRate[h].tempSelectOption=o.enhancementServices[e].eachDayRate[h].options[v],o.enhancementServices[e].eachDayRate[h].selectOptionIsSelected=!0,o.enhancementServices[e].eachDayRate[h].optionsColor="#898989",o.enhancementServices[e].eachDayRate[h].dropdownOptions="#eaeaea",o.enhancementServices[e].addAnotherItemVar=o.enhancementServices[e].addAnotherItemVar+1);o.selectedEnhancements[u].serviceOptions[p].serviceOptionId==o.enhancementServices[e].eachDayRate[h].selectOption.serviceOptionId&&void 0!=o.selectedEnhancements[u].serviceOptions[p].dailyRates[0].quantity&&(o.enhancementServices[e].eachDayRate[h].selectOption.oldTotalRoom>0?o.enhancementServices[e].eachDayRate[h].room=o.enhancementServices[e].eachDayRate[h].selectOption.oldTotalRoom:o.enhancementServices[e].eachDayRate[h].room=o.selectedEnhancements[u].serviceOptions[p].dailyRates[0].quantity,o.enhancementServices[e].eachDayRate[h].room&&(o.enhancementServices[e].eachDayRate[h].tempRooms=angular.copy(o.enhancementServices[e].eachDayRate[h].room),o.enhancementServices[e].eachDayRate[h].roomsIsSelected=!0),o.enhancementServices[e].eachDayRate[h].dropdownRooms="#eaeaea",o.enhancementServices[e].eachDayRate[h].roomsColor="#898989",i.push(o.enhancementServices[e].eachDayRate[h].room))}else{o.enhancementServices[e].eachDayRate[h]=angular.copy(o.enhancementServices[e].eachDayRate[h-1]),o.enhancementServices[e].eachDayRate[h].options=angular.copy(o.enhancementServices[e].eachDayRate[h-1].options),o.enhancementServices[e].eachDayRate[h].tempOptions=angular.copy(o.enhancementServices[e].eachDayRate[h-1].tempOptions);for(var v=0;v<o.enhancementServices[e].eachDayRate[h].options.length;v++)o.enhancementServices[e].eachDayRate[h].options[v].serviceOptionId==o.selectedEnhancements[u].serviceOptions[p].serviceOptionId&&(o.enhancementServices[e].eachDayRate[h].selectOption=o.enhancementServices[e].eachDayRate[h].options[v],o.enhancementServices[e].eachDayRate[h].tempSelectOption=o.enhancementServices[e].eachDayRate[h].options[v],o.enhancementServices[e].eachDayRate[h].selectOptionIsSelected=!0,o.enhancementServices[e].eachDayRate[h].optionsColor="#898989",o.enhancementServices[e].eachDayRate[h].dropdownOptions="#eaeaea",o.enhancementServices[e].addAnotherItemVar=o.enhancementServices[e].addAnotherItemVar+1);o.selectedEnhancements[u].serviceOptions[p].serviceOptionId==o.enhancementServices[e].eachDayRate[h].selectOption.serviceOptionId&&void 0!=o.selectedEnhancements[u].serviceOptions[p].dailyRates[0].quantity&&(o.enhancementServices[e].eachDayRate[h].selectOption.oldTotalRoom>0?o.enhancementServices[e].eachDayRate[h].room=o.enhancementServices[e].eachDayRate[h].selectOption.oldTotalRoom:o.enhancementServices[e].eachDayRate[h].room=o.selectedEnhancements[u].serviceOptions[p].dailyRates[0].quantity,o.enhancementServices[e].eachDayRate[h].room&&(o.enhancementServices[e].eachDayRate[h].tempRooms=angular.copy(o.enhancementServices[e].eachDayRate[h].room),o.enhancementServices[e].eachDayRate[h].roomsIsSelected=!0),o.enhancementServices[e].eachDayRate[h].dropdownRooms="#eaeaea",o.enhancementServices[e].eachDayRate[h].roomsColor="#898989",i.push(o.enhancementServices[e].eachDayRate[h].room))}}if("PER_RESERVATION"==o.enhancementServices[e].servicePricingType&&void 0!=o.enhancementServices[e].eachDayRate[m].serviceDate&&o.enhancementServices[e].eachDayRate[m].options.length>0&&o.enhancementServices[e].eachDayRate[m].serviceDate.length>0){for(var u=0;u<o.selectedEnhancements.length;u++)if(o.selectedEnhancements[u].serviceTypeId==o.enhancementServices[e].serviceTypeId){o.enhancementServices[e].eachDayRate[m].date=o.selectedEnhancements[u].serviceOptions[0].dailyRates[0].serviceDate,o.enhancementServices[e].eachDayRate[m].tempDate=o.selectedEnhancements[u].serviceOptions[0].dailyRates[0].serviceDate,o.enhancementServices[e].eachDayRate[m].dropdownDate="#eaeaea",o.enhancementServices[e].eachDayRate[m].dateIsSelected=!0,o.enhancementServices[e].eachDayRate[m].dateColor="#898989",o.enhancementServices[e].eachDayRate[m].isChecked=!0,o.enhancementServices[e].eachDayRate[m].tempIsChecked=!0;break}o.enhancementServices[e].eachDayRate[m].options=[];for(var p=0;p<o.enhancementServices[e].serviceOptions.length;p++)for(var f=0;f<o.enhancementServices[e].serviceOptions[p].dailyRates.length;f++)o.enhancementServices[e].eachDayRate[m].date==o.enhancementServices[e].serviceOptions[p].dailyRates[f].serviceDate&&o.enhancementServices[e].eachDayRate[m].options.push(o.enhancementServices[e].serviceOptions[p].dailyRates[f]);for(var p=0;p<o.enhancementServices[e].eachDayRate[m].options.length;p++)o.enhancementServices[e].eachDayRate[m].options[p].serviceOptionId==o.selectedEnhancements[u].serviceOptions[0].serviceOptionId&&(o.enhancementServices[e].eachDayRate[m].tempReservationOptions=o.enhancementServices[e].eachDayRate[m].options,o.enhancementServices[e].eachDayRate[m].selectOption=o.enhancementServices[e].eachDayRate[m].options[p],o.enhancementServices[e].eachDayRate[m].tempSelectOption=o.enhancementServices[e].eachDayRate[m].options[p],o.enhancementServices[e].eachDayRate[m].selectOptionIsSelected=!0,o.enhancementServices[e].eachDayRate[m].optionsColor="#898989",o.enhancementServices[e].eachDayRate[m].dropdownOptions="#eaeaea")}"PER_PERSON_PER_NIGHT"!=o.enhancementServices[e].servicePricingType&&"PER_PERSON"!=o.enhancementServices[e].servicePricingType||void 0!=o.enhancementServices[e].eachDayRate[m].adult&&void 0!=o.enhancementServices[e].eachDayRate[m].selectOption&&(o.enhancementServices[e].eachDayRate[m].allSelected=!0,o.enhancementServices[e].eachDayRate[m].tempAllSelected=!0,o.enhancementServices[e].checked=!0,o.enhancementServices[e].tempChecked=!0),"PER_ROOM"!=o.enhancementServices[e].servicePricingType&&"PER_ROOM_PER_NIGHT"!=o.enhancementServices[e].servicePricingType||void 0!=o.enhancementServices[e].eachDayRate[m].room&&void 0!=o.enhancementServices[e].eachDayRate[m].selectOption&&(o.enhancementServices[e].eachDayRate[m].allSelected=!0,o.enhancementServices[e].eachDayRate[m].tempAllSelected=!0,o.enhancementServices[e].checked=!0,o.enhancementServices[e].tempChecked=!0),"PER_RESERVATION"==o.enhancementServices[e].servicePricingType&&void 0!=o.enhancementServices[e].eachDayRate[m].selectOption&&void 0!=o.enhancementServices[e].eachDayRate[m].date&&(o.enhancementServices[e].eachDayRate[m].allSelected=!0,o.enhancementServices[e].eachDayRate[m].tempAllSelected=!0,o.enhancementServices[e].checked=!0,o.enhancementServices[e].tempChecked=!0),o.enhancementServices[e].eachDayRate[m].options.length>0&&c++,c>1&&(o.enhancementServices[e].UseSelection=!0);var C=T.getTotalEnhancement(o.enhancementServices[e]);s=C.totalPrice,l=C.totalfinalPrice,d=C.packageTotalFinalPrice,g=C.packageTotalFinalPriceDisc,s>0&&(o.enhancementFlag=!0,o.zeroDiscountApplied=C.zeroDiscountApplied),o.enhancementServices[e].adult=Math.max.apply(null,t),o.enhancementServices[e].children=Math.max.apply(null,n),o.enhancementServices[e].rooms=Math.max.apply(null,i),((void 0!=o.enhancementServices[e].eachDayRate[m].adult||void 0!=o.enhancementServices[e].eachDayRate[m].room)&&void 0!=o.enhancementServices[e].eachDayRate[m].selectOption&&"PER_PERSON"!=o.enhancementServices[e].servicePricingType&&"PER_ROOM"!=o.enhancementServices[e].servicePricingType||"PER_RESERVATION"==o.enhancementServices[e].servicePricingType&&void 0!=o.enhancementServices[e].eachDayRate[m].selectOption)&&r++}if("PER_PERSON_PER_NIGHT"==o.enhancementServices[e].servicePricingType){for(var P,m=0;m<o.enhancementServices[e].eachDayRate.length;m++)if(o.enhancementServices[e].eachDayRate[m].options.length>0){P=m;break}if(1==o.enhancementServices[e].eachDayRate[P].allSelected)for(var m=0;m<o.enhancementServices[e].eachDayRate.length;m++)if(o.enhancementServices[e].eachDayRate[P].isChecked=!0,o.enhancementServices[e].eachDayRate[m].options.length>0&&m!=P){if(o.enhancementServices[e].eachDayRate[m].adult!=o.enhancementServices[e].eachDayRate[P].adult||void 0==o.enhancementServices[e].eachDayRate[m].adult){delete o.enhancementServices[e].eachDayRate[P].isChecked;break}if(void 0!=o.enhancementServices[e].eachDayRate[P].children&&(o.enhancementServices[e].eachDayRate[m].children!=o.enhancementServices[e].eachDayRate[P].children||void 0==o.enhancementServices[e].eachDayRate[m].children)){delete o.enhancementServices[e].eachDayRate[P].isChecked;break}if(o.enhancementServices[e].eachDayRate[m].selectOption.serviceOptionId!=o.enhancementServices[e].eachDayRate[P].selectOption.serviceOptionId||void 0==o.enhancementServices[e].eachDayRate[m].selectOption){delete o.enhancementServices[e].eachDayRate[P].isChecked;break}}}if("PER_ROOM_PER_NIGHT"==o.enhancementServices[e].servicePricingType){for(var S,m=0;m<o.enhancementServices[e].eachDayRate.length;m++)if(o.enhancementServices[e].eachDayRate[m].options.length>0){S=m;break}if(1==o.enhancementServices[e].eachDayRate[S].allSelected)for(var m=0;m<o.enhancementServices[e].eachDayRate.length;m++)if(o.enhancementServices[e].eachDayRate[S].isChecked=!0,o.enhancementServices[e].eachDayRate[m].options.length>0&&m!=S){if(o.enhancementServices[e].eachDayRate[m].room!=o.enhancementServices[e].eachDayRate[S].room||void 0==o.enhancementServices[e].eachDayRate[m].room){o.enhancementServices[e].eachDayRate[S].isChecked=!1;break}if(o.enhancementServices[e].eachDayRate[m].selectOption.serviceOptionId!=o.enhancementServices[e].eachDayRate[S].selectOption.serviceOptionId||void 0==o.enhancementServices[e].eachDayRate[m].selectOption){o.enhancementServices[e].eachDayRate[S].isChecked=!1;break}}}if("PER_ROOM"==o.enhancementServices[e].servicePricingType)for(var A=angular.copy(o.enhancementServices[e]),m=0;m<o.enhancementServices[e].eachDayRate.length;m++)for(var f=0;f<A.eachDayRate.length;f++)if(o.enhancementServices[e].eachDayRate[m].options.length>0)for(var I=0;I<o.enhancementServices[e].eachDayRate[m].options.length;I++)void 0!=A.eachDayRate[f].selectOption&&o.enhancementServices[e].eachDayRate[m].options[I].serviceOptionId==A.eachDayRate[f].selectOption.serviceOptionId&&m!=f&&o.enhancementServices[e].eachDayRate[m].options.splice(I,1);o.enhancementServices[e].days=r,o.enhancementServices[e].price=s,o.enhancementServices[e].finalPrice=l,(o.enhancementServices[e].discountRuleId||o.zeroDiscountApplied||o.enhancementServices[e].finalPriceDisc>0)&&(o.enhancementServices[e].priceDisc=d,o.enhancementServices[e].finalPriceDisc=g)}o.subTotalFinalPrice=0,o.totalPrice=0;for(var m=0;m<o.enhancementServices.length;m++)o.enhancementServices[m].discountRuleId||o.enhancementServices[m].finalPriceDisc>0?void 0!=o.subTotalFinalPrice&&void 0!=o.enhancementServices[m].finalPriceDisc?(o.subTotalFinalPrice=o.subTotalFinalPrice+o.enhancementServices[m].finalPriceDisc,o.totalPrice=o.totalPrice+o.enhancementServices[m].priceDisc):void 0!=o.enhancementServices[m].finalPriceDisc&&(o.subTotalFinalPrice=o.enhancementServices[m].finalPriceDisc,o.totalPrice=o.enhancementServices[m].priceDisc):void 0!=o.subTotalFinalPrice&&void 0!=o.enhancementServices[m].finalPrice?(o.subTotalFinalPrice=o.subTotalFinalPrice+o.enhancementServices[m].finalPrice,o.totalPrice=o.totalPrice+o.enhancementServices[m].price):void 0!=o.enhancementServices[m].finalPrice&&(o.subTotalFinalPrice=o.enhancementServices[m].finalPrice);a.debug(JSON.stringify(o.enhancementServices)+"$scope.enhancementServices after modify")}(),a.debug(o.enhancementServices)),e&&t.MRB&&o.showModel(r),i.getConfig("modifyEnhancementInContext")&&J()}),aa=!1,delete n.ratePlanType,delete n.ratePlanCode},t.MRB||o.getEnhancementServices(),o.showEnhancementModelMrb=function(e,a,t){1!=o.mainReservationArray.length||a||(a=o.mainReservationArray[0]),i.changeSelectRoom(a.id);var r=1==o.mainReservationArray.length?"":a.id;o.accessibilityEnhancementServiceId="edit-enhancement-"+r+"-"+t+"-id",o.getEnhancementServices(!0,e)},o.showModel=function(e){var r=e.serviceTypeId;e=c("filter")(o.enhancementServices,{serviceTypeId:r})[0],a.debug(JSON.stringify(e)+"$scope.enhancementServices Bobby"),"PER_ROOM"==e.servicePricingType&&void 0==e.addAnotherItemVar&&(e.addAnotherItemVar=1),a.debug(JSON.stringify(e)+"enhancementService"),o.doneEnable=!0,e.checked=!0,o.showServices="display-block";var n=u.pageYOffset;o.fromTop=n+65+"px",o.currentServices=e,a.debug("current services"),a.debug(o.currentServices),angular.forEach(o.currentServices.eachDayRate,function(e){1==e.allSelected&&(o.doneEnable=!1),"#898989"!=e.dateColor&&(e.dateColor="#d2d2d2"),"#898989"!=e.adultsColor&&(e.adultsColor="#d2d2d2"),"#898989"!=e.childrenColor&&(e.childrenColor="#d2d2d2"),"#898989"!=e.roomsColor&&(e.roomsColor="#d2d2d2"),"#898989"!=e.optionsColor&&(e.optionsColor="#d2d2d2")});for(var d=0;d<o.currentServices.eachDayRate.length;d++)if(o.currentServices.eachDayRate[d].options.length>0){o.firstIndex=d;break}if("PER_PERSON_PER_NIGHT"==e.servicePricingType||"PER_PERSON"==e.servicePricingType)for(var d=0;d<e.eachDayRate.length;d++)if(e.eachDayRate[d].options.length>0){o.adultsInService=s.numToArray(e.eachDayRate[d].options[0].adultQuantity+1),o.childrenInService=s.numToArray(e.eachDayRate[d].options[0].childQuantity+1);break}var g=i.buildOptions();if("PER_ROOM_PER_NIGHT"!=e.servicePricingType&&"PER_ROOM"!=e.servicePricingType||(o.roomsInservice=s.numToArray(g.rooms+1),o.roomsInservice.splice(0,1)),"PER_ROOM"==e.servicePricingType){var m=0;angular.forEach(e.eachDayRate,function(a,t){e.addAnotherItemVar>1&&a.room>0&&a.options.length>0&&(t>0?(a.options[0].maxLimit=e.maxLimit-m==0?-1:e.maxLimit-m,m+=a.room):(m=a.room,a.options[0].maxLimit=e.maxLimit))})}for(var d=0;d<o.currentServices.eachDayRate.length;d++)"PER_PERSON_PER_NIGHT"!=e.servicePricingType&&"PER_PERSON"!=e.servicePricingType||void 0==o.currentServices.eachDayRate[d].adult&&void 0==o.currentServices.eachDayRate[d].children&&o.currentServices.eachDayRate[d].options.length>0&&(o.adultsInService.length>0&&(o.currentServices.eachDayRate[d].adult=o.adultsInService[o.adultsInService.length-1],o.currentServices.eachDayRate[d].adultIsSelected=!0,o.currentServices.eachDayRate[d].adultsColor="#898989",o.currentServices.eachDayRate[d].dropdownAdult="#eaeaea"),o.childrenInService.length>0&&(o.currentServices.eachDayRate[d].children=o.childrenInService[o.childrenInService.length-1],o.currentServices.eachDayRate[d].childrenIsSelected=!0,o.currentServices.eachDayRate[d].childrenColor="#898989",o.currentServices.eachDayRate[d].dropdownChildren="#eaeaea")),"PER_ROOM_PER_NIGHT"!=e.servicePricingType&&"PER_ROOM"!=e.servicePricingType||void 0==e.eachDayRate[d].room&&e.eachDayRate[d].options.length>0&&o.roomsInservice.length>0&&(o.currentServices.eachDayRate[d].room=o.currentServices.rooms,o.currentServices.eachDayRate[d].roomsIsSelected=!0,o.currentServices.eachDayRate[d].roomsColor="#898989",o.currentServices.eachDayRate[d].dropdownRooms="#eaeaea"),"PER_ROOM"==e.servicePricingType&&1==e.eachDayRate[d].isAdded&&void 0==e.eachDayRate[d].selectOption&&(delete e.eachDayRate[d].selectOption,delete e.eachDayRate[d].dropdownOptions,delete e.eachDayRate[d].optionsColor,e.eachDayRate[d].selectOptionIsSelected=!1,delete e.eachDayRate[d].tempSelectOption,delete e.eachDayRate[d].isAdded,1!=e.addAnotherItemVar&&(e.addAnotherItemVar=e.addAnotherItemVar-1,e.eachDayRate[d].options=[]));var p=T.getTotalEnhancement(e),y=p.totalPrice,v=p.totalfinalPrice,h=p.packageTotalFinalPrice,R=p.packageTotalFinalPriceDisc;y>0&&(o.enhancementFlag=!0,o.zeroDiscountApplied=p.zeroDiscountApplied),l.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(o.totalPrice=parseFloat(y).toFixed(2),o.totalFinalPrice=parseFloat(v).toFixed(2),o.packageTotalFinalPrice=parseFloat(h).toFixed(2),o.packageTotalFinalPriceDiscount=parseFloat(R).toFixed(2)):(o.totalPrice=parseFloat(y).toFixed(0),o.totalFinalPrice=parseFloat(v).toFixed(0),o.packageTotalFinalPrice=parseFloat(h).toFixed(0),o.packageTotalFinalPriceDiscount=parseFloat(R).toFixed(0)),angular.forEach(o.currentServices.eachDayRate,function(e){1==e.allSelected&&(o.doneEnable=!1),"#898989"!=e.dateColor&&(e.dateColor="#d2d2d2"),"#898989"!=e.adultsColor&&(e.adultsColor="#d2d2d2"),"#898989"!=e.childrenColor&&(e.childrenColor="#d2d2d2"),"#898989"!=e.roomsColor&&(e.roomsColor="#d2d2d2"),"#898989"!=e.optionsColor&&(e.optionsColor="#d2d2d2")}),t.MRB?P.onModalOpen(o.accessibilityEnhancementServiceId,"totalPage-enhancement-modal","enhancement-title",!1,o.goBack,e):P.onModalOpen("edit-enhancement-id-"+e.serviceTypeId,"totalPage-enhancement-modal","enhancement-title",!1,o.goBack,e)},o.addAnotherItem=function(e,a){var t=angular.copy(a.eachDayRate[0]);if(t.allSelected=!1,t.roomsIsSelected=!0,t.selectOptionIsSelected=!1,t.roomsColor="#898989",t.optionsColor="#d2d2d2",t.room=o.roomsInservice[o.roomsInservice.length-1],delete t.adultsColor,delete t.dropdownOptions,delete t.temRooms,delete t.selectOption,delete t.tempSelectOption,void 0!=a.eachDayRate[a.addAnotherItemVar]){if(a.eachDayRate[a.addAnotherItemVar].tempOptions=a.eachDayRate[0].tempOptions,0==a.eachDayRate[a.addAnotherItemVar].options.length){for(var r=0;r<t.options.length;r++)for(var n=0;n<a.eachDayRate.length;n++)if(void 0!=a.eachDayRate[n].selectOption&&a.eachDayRate[n].selectOption.serviceOptionId==t.options[r].serviceOptionId){t.options.splice(r,1);break}a.eachDayRate[a.addAnotherItemVar]=t,a.eachDayRate[a.addAnotherItemVar].isAdded=!0}}else{for(var r=0;r<t.options.length;r++)for(var n=0;n<a.eachDayRate.length;n++)void 0!=a.eachDayRate[n].selectOption&&a.eachDayRate[n].selectOption.serviceOptionId==t.options[r].serviceOptionId&&t.options.splice(r,1);t.isAdded=!0,a.eachDayRate.push(t)}if(a.addAnotherItemVar++,"PER_ROOM"==a.servicePricingType){var i=0;angular.forEach(a.eachDayRate,function(e,t){a.addAnotherItemVar>1&&e.room>0&&e.options.length>0&&(t>0?(e.options[0].maxLimit=a.maxLimit-i==0?-1:a.maxLimit-i,i+=e.room):(i=e.room,e.options[0].maxLimit=a.maxLimit))})}},o.clearAllSelections=function(e){if(1==e.checked)e.checked=!1,o.showModel(e);else if(delete e.date,delete e.price,delete e.finalPrice,delete e.adult,delete e.children,delete e.rooms,delete e.days,delete e.tempChecked,angular.forEach(e.eachDayRate,function(e){delete e.date,delete e.tempDate,delete e.dateIsSelected,delete e.dateColor,delete e.dropdownDate,delete e.adult,delete e.tempAdult,delete e.adultIsSelected,delete e.adultsColor,delete e.dropdownAdult,delete e.children,delete e.dropdownChildren,delete e.childrenIsSelected,delete e.childrenColor,delete e.dropdownRooms,delete e.roomsIsSelected,delete e.roomsColor,delete e.room,delete e.dropdownOptions,delete e.optionsColor,delete e.tempChecked,delete e.selectOptionIsSelected,delete e.selectOption,delete e.tempSelectOption,delete e.isChecked,delete e.allSelected,delete e.oldPriceArray,delete e.resOwnAmount,delete e.resOwnDiscountAmount,delete e.resOwnServiceDate,delete e.oldTotalAdult,delete e.oldTotalChild,delete e.oldTotalRoom,angular.forEach(e.options,function(e){delete e.oldPriceArray,delete e.oldTotalRoom})}),void 0!=o.enhancementServices){o.subTotalFinalPrice=0;for(var a=0;a<o.enhancementServices.length;a++)void 0!=o.subTotalFinalPrice&&void 0!=o.enhancementServices[a].finalPrice?o.subTotalFinalPrice=o.subTotalFinalPrice+o.enhancementServices[a].finalPrice:void 0!=o.enhancementServices[a].finalPrice&&(o.subTotalFinalPrice=o.enhancementServices[a].finalPrice)}var t=!1;if(o.enhancementServices&&o.enhancementServices.length>0)for(var a=0;a<o.enhancementServices.length;a++)1==o.enhancementServices[a].checked&&(t=!0);o.submitEnable=1!=t};var xa=function(e){for(var a=0,t=0;t<e.eachDayRate.length;t++)e.eachDayRate[t].options.length>0&&a++;a>1&&(e.UseSelection=!0);for(var t=0;t<e.eachDayRate.length;t++){if(e.eachDayRate[t].isChecked=!1,void 0!=e.eachDayRate[t].adult||"PER_PERSON_PER_NIGHT"==e.servicePricingType&&"PER_PERSON"==e.servicePricingType||(e.hideAgain=!1),("PER_PERSON_PER_NIGHT"==e.servicePricingType||"PER_PERSON"==e.servicePricingType)&&(o.doneEnable=!0,void 0!=e.eachDayRate[t].selectOption&&void 0!=e.eachDayRate[t].adult)){o.doneEnable=!1;break}if(("PER_ROOM_PER_NIGHT"==e.servicePricingType||"PER_ROOM"==e.servicePricingType)&&(o.doneEnable=!0,void 0!=e.eachDayRate[t].selectOption&&void 0!=e.eachDayRate[t].room)){o.doneEnable=!1;break}}for(var t=0;t<e.eachDayRate.length;t++)void 0!=e.eachDayRate[t].room||"PER_ROOM"==e.servicePricingType&&"PER_ROOM_PER_NIGHT"==e.servicePricingType||(e.hideAgain=!1);for(var t=0;t<e.eachDayRate.length;t++)void 0!=e.eachDayRate[t].children||void 0==o.childrenInService||"PER_PERSON_PER_NIGHT"!=e.servicePricingType&&"PER_PERSON"!=e.servicePricingType||o.childrenInService.length>1&&(e.hideAgain=!1);for(var t=0;t<e.eachDayRate.length;t++)void 0==e.eachDayRate[t].selectOption&&(e.hideAgain=!1);var r=T.getTotalEnhancement(e),n=r.totalPrice,i=r.totalfinalPrice,s=r.packageTotalFinalPrice,c=r.packageTotalFinalPriceDisc;n>0&&(o.enhancementFlag=!0,o.zeroDiscountApplied=r.zeroDiscountApplied);var d=!0,g=!1;o.totalPrice=n,l.getHotelDesc().uxConfiguration.displayDecimalRatesIndicator?(o.totalPrice=parseFloat(n).toFixed(2),o.totalFinalPrice=parseFloat(i).toFixed(2),o.packageTotalFinalPrice=parseFloat(s).toFixed(2),o.packageTotalFinalPriceDiscount=parseFloat(c).toFixed(2)):(o.totalPrice=parseFloat(n).toFixed(0),o.totalFinalPrice=parseFloat(i).toFixed(0),o.packageTotalFinalPrice=parseFloat(s).toFixed(0),o.packageTotalFinalPriceDiscount=parseFloat(c).toFixed(0)),W();var m=angular.copy(e);if(v.remove(m.eachDayRate,function(e){return 0===e.options.length?e:""}),"PER_ROOM"==e.servicePricingType){var u=0;angular.forEach(e.eachDayRate,function(a,t){e.addAnotherItemVar>1&&a.room>0&&a.options.length>0&&(t>0?(a.options[0].maxLimit=e.maxLimit-u==0?-1:e.maxLimit-u,u+=a.room):(u=a.room,a.options[0].maxLimit=e.maxLimit))})}angular.forEach(m.eachDayRate,function(e){e.allSelected||(d=!1),"PER_PERSON_PER_NIGHT"!=m.servicePricingType&&"PER_PERSON"!=m.servicePricingType||(o.doneEnable=!0,0!=e.options[0].adultQuantity&&0!=e.options[0].childQuantity?void 0!==e.selectOption&&(0===e.options[0].adultQuantity||void 0!==e.adult&&0!==e.adult||0===e.options[0].childQuantity||void 0!==e.children&&0!==e.children)&&(g=!0):void 0!==e.selectOption&&(0===e.options[0].adultQuantity||void 0!==e.adult&&0!==e.adult)&&(0===e.options[0].childQuantity||void 0!==e.children&&0!==e.children)&&(g=!0))}),"PER_PERSON_PER_NIGHT"!=m.servicePricingType&&"PER_PERSON"!=m.servicePricingType||(o.doneEnable=!g),e.eachDayRate[o.firstIndex].isChecked=!!d};o.allSelectedChanged=function(e,a){0==e.allSelected?(delete e.adult,delete e.dropdownAdult,e.adultsColor="#d2d2d2",delete e.children,delete e.dropdownChildren,e.roomsColor="#d2d2d2",delete e.room,delete e.dropdownRooms,e.childrenColor="#d2d2d2",delete e.selectOption,delete e.dropdownOptions,delete e.date,delete e.dropdownDate,e.optionsColor="#d2d2d2",e.dateColor="#d2d2d2",xa(a),"PER_RESERVATION"==a.servicePricingType&&(o.doneEnable=!0),void 0!=o.firstIndex&&(a.eachDayRate[o.firstIndex].isChecked=!1)):((void 0!=o.adultsInService&&o.adultsInService.length>0&&"PER_PERSON_PER_NIGHT"==a.servicePricingType||"PER_PERSON"==a.servicePricingType)&&(e.adult=o.adultsInService[o.adultsInService.length-1],o.changeDropdownAdult(e,a)),void 0!=e.serviceDates&&e.serviceDates.length>0&&"PER_RESERVATION"==a.servicePricingType&&(e.date=e.serviceDates[0],o.changeDropdownDate(e,a)),void 0!=o.childrenInService&&o.childrenInService.length>0&&("PER_PERSON_PER_NIGHT"==a.servicePricingType||"PER_PERSON"==a.servicePricingType)&&(e.children=o.childrenInService[o.childrenInService.length-1],o.changeDropdownChildren(e,a)),void 0!=o.roomsInservice&&o.roomsInservice.length>0&&("PER_ROOM_PER_NIGHT"==a.servicePricingType||"PER_ROOM"==a.servicePricingType)&&(e.room=o.roomsInservice[o.roomsInservice.length-1],o.changeDropdownRoom(e,a)),e.selectOption=e.options[0],o.changeDropdownOptions(e,a));var t=document.getElementById("enhancementDetail");t&&t.focus()},o.totalServices={},o.setUpDateOption=function(e,a){if(e.dateDropdownOption={},e&&e.serviceDates&&a&&a.serviceOptions)for(var t=0;t<e.serviceDates.length;t++)for(var o=0;o<a.serviceOptions.length;o++)for(var r=0;r<a.serviceOptions[o].dailyRates.length;r++)if(e.serviceDates[t]==a.serviceOptions[o].dailyRates[r].serviceDate){e.dateDropdownOption[e.serviceDates[t]]=a.serviceOptions[o].dailyRates[r];for(var n=0;n<a.eachDayRate.length;n++)void 0!=e.resOwnServiceDate&&e.resOwnServiceDate==e.serviceDates[n]&&void 0!=e.resOwnAmount&&e.dateDropdownOption[e.serviceDates[n]]&&(e.dateDropdownOption[e.serviceDates[n]].resOwnAmount=e.resOwnAmount,e.dateDropdownOption[e.serviceDates[n]].resOwnDiscountAmount=e.resOwnDiscountAmount)}},o.changeDropdownDate=function(e,a){e.dateColor="#898989",e.dropdownDate="#eaeaea";var t;if("PER_RESERVATION"==a.servicePricingType){void 0!=e.date&&void 0!=e.selectOption&&(e.allSelected=!0,o.doneEnable=!1,t=angular.copy(e.selectOption)),e.options=[];for(var r=0;r<a.serviceOptions.length;r++)for(var n=0;n<a.serviceOptions[r].dailyRates.length;n++)e.date==a.serviceOptions[r].dailyRates[n].serviceDate&&e.options.push(a.serviceOptions[r].dailyRates[n]),e.optionsColor="#d2d2d2",delete e.selectOption,delete e.dropdownOptions}if(t)for(var r=0;r<e.options.length;r++)e.options[r].serviceOptionId===t.serviceOptionId&&(e.selectOption=e.options[r],e.optionsColor="#898989",e.dropdownOptions="#eaeaea");xa(a),K(e,a)},o.changeDropdownAdult=function(e,a){if(e.adultsColor="#898989",e.dropdownAdult="#eaeaea",
"PER_PERSON_PER_NIGHT"!=a.servicePricingType&&"PER_PERSON"!=a.servicePricingType||void 0!=e.adult&&void 0!=e.selectOption&&(e.allSelected=!0,o.doneEnable=!1),xa(a),"PER_PERSON_PER_NIGHT"==a.servicePricingType)for(var t=0;t<a.eachDayRate.length;t++)if(1==a.eachDayRate[t].isChecked)for(var r=0;r<a.eachDayRate.length;r++)a.eachDayRate[r].adult!=e.adult&&(a.eachDayRate[t].isChecked=!1);K(e,a)},o.changeDropdownChildren=function(e,a){if(e.childrenColor="#898989",e.dropdownChildren="#eaeaea","PER_PERSON_PER_NIGHT"!=a.servicePricingType&&"PER_PERSON"!=a.servicePricingType||(void 0!=e.adult&&void 0!=e.selectOption&&(e.allSelected=!0,o.doneEnable=!1),void 0!=e.children&&void 0!=e.selectOption&&(e.allSelected=!0,o.doneEnable=!1)),xa(a),"PER_PERSON_PER_NIGHT"==a.servicePricingType)for(var t=0;t<a.eachDayRate.length;t++)if(1==a.eachDayRate[t].isChecked)for(var r=0;r<a.eachDayRate.length;r++)a.eachDayRate[r].children!=e.children&&(a.eachDayRate[t].isChecked=!1);K(e,a)},o.changeDropdownRoom=function(e,a){if(e.roomsColor="#898989",e.dropdownRooms="#eaeaea","PER_ROOM"!=a.servicePricingType&&"PER_ROOM_PER_NIGHT"!=a.servicePricingType||void 0!=e.room&&void 0!=e.selectOption&&(e.allSelected=!0,o.doneEnable=!1),xa(a),"PER_ROOM_PER_NIGHT"==a.servicePricingType)for(var t=0;t<a.eachDayRate.length;t++)if(1==a.eachDayRate[t].isChecked)for(var r=0;r<a.eachDayRate.length;r++)a.eachDayRate[r].room!=e.room&&(a.eachDayRate[t].isChecked=!1);K(e,a)},o.changeDropdownOptions=function(e,a){if(e.optionsColor="#898989",e.dropdownOptions="#eaeaea","PER_PERSON_PER_NIGHT"!=a.servicePricingType&&"PER_PERSON"!=a.servicePricingType||(void 0!=e.adult&&void 0!=e.selectOption&&(e.allSelected=!0,o.doneEnable=!1),void 0!=e.children&&void 0!=e.selectOption&&(e.allSelected=!0,o.doneEnable=!1)),"PER_ROOM"!=a.servicePricingType&&"PER_ROOM_PER_NIGHT"!=a.servicePricingType||void 0!=e.room&&void 0!=e.selectOption&&(e.allSelected=!0,o.doneEnable=!1),"PER_RESERVATION"==a.servicePricingType&&void 0!=e.selectOption&&void 0!=e.date&&(e.allSelected=!0,o.doneEnable=!1),"PER_ROOM"==a.servicePricingType&&(void 0==e.selectOption||e.selectOption.oldPriceArray||angular.forEach(e.options,function(a){!e.selectOption.oldPriceArray&&a.oldPriceArray&&a.oldPriceArray.length>0&&(e.selectOption.oldPriceArray=a.oldPriceArray,e.selectOption.oldDiscountedPerRoomCount=a.oldDiscountedPerRoomCount,e.selectOption.oldTotalRoom=a.oldTotalRoom)})),xa(a),"PER_ROOM_PER_NIGHT"==a.servicePricingType||"PER_PERSON_PER_NIGHT"==a.servicePricingType)for(var t=0;t<a.eachDayRate.length;t++)if(1==a.eachDayRate[t].isChecked)for(var r=0;r<a.eachDayRate.length;r++)void 0!=a.eachDayRate[r].selectOption&&a.eachDayRate[r].selectOption.serviceOptionName!=e.selectOption.serviceOptionName&&(a.eachDayRate[t].isChecked=!1);K(e,a)},o.changedCheckBoxSecond=function(e,a){1==e.isChecked&&(angular.forEach(a.eachDayRate,function(t){if(void 0!=e.adult&&t.options.length>0&&(t.adult=e.adult,t.adultsColor="#898989",t.dropdownAdult="#eaeaea"),void 0!=e.children&&t.options.length>0&&(t.children=e.children,t.childrenColor="#898989",t.dropdownChildren="#eaeaea"),void 0!=e.room&&t.options.length>0&&(t.room=e.room,t.roomsColor="#898989",t.dropdownRooms="#eaeaea"),e.selectOption)for(var o=0;o<t.options.length;o++)t.options[o].serviceOptionId==e.selectOption.serviceOptionId&&(t.selectOption=t.options[o],t.optionsColor="#898989",t.dropdownOptions="#eaeaea");t.allSelected=!0,t.options.length>0&&K(t,a),xa(a)}),a.hideAgain=!0)},o.$on("EVENT.REVIEW_GRP_DETAILS",function(e,r){if(o.showGroupModal="display-block",!0===l.getHotelDesc().uxConfiguration.accomodationsConfig.enableCarouselAutoScroll?o.myInterval=2500:o.myInterval=0,o.noWrapSlides=!1,m.scrollTopAnimated(-35,1e3),i.getAllCode())void 0!=i.getAllCode().group?o.code=i.getAllCode().group:o.code=i.getAllCode().Group;else{var n=i.getMainReservation().posSource.requestorIds,g=c("filter")(n,{codeType:"group"});g.length>0&&(o.code=g[0].id)}var u=i.getLanguage();d.getGSplashDetails(ea,"Group",o.code,u).then(function(e){a.debug(JSON.stringify(e)+"response"),void 0!=e.data.groupRules&&(t.hidePriceFromAttendees=e.data.groupRules.hidePriceFromAttendees),o.gSplashDetails=e.data,o.slides=o.gSplashDetails.media,i.setGroup(e.data),s.setUserTiming("Interaction","CodeWIdget")}),o.bookNowBtn=!1}),o.closeGSplashPopup=function(){o.showGroupModal="display-none"};var wa=function(){var e=i.buildOptions();e.reservationCode=i.getMainReservation().uniqueId,Ue=E.getIncludeMemberRate(),Ue&&(e.includeMemberRate=Ue),d.getAccommodationRooms(e).getAllRooms().then(function(e){if(t.RatesAvail=e.data,void 0!=t.RatesAvail){var a=t.RatesAvail.roomStays[0].ratePlans,r=Qe.roomStays[0].ratePlans[0].ratePlanCode,n=Qe.roomStays[0].ratePlans[0].ratePlanType;o.selectedRatePlanObj=_.filter(a,{ratePlanCode:r}),o.selectedRatePlanObj.length>0&&(o.selectedRatePlanName=o.selectedRatePlanObj[0].ratePlanName),"Group"!=n&&"group"!=n||(o.selectedRatePlanName=a[0].ratePlanName,0==o.selectedRatePlanObj.length&&(o.selectedRatePlanObj=a))}else t.totalRatePlanIconHide=!0})};o.$on(y.LANG_CHANGE_AFTER_API_CURRENCY_CHANGE,function(){L(),o.translationLabels=k.getTranslationLabels(),o.initializeInsuranceOnCurrencyORLanguageChange()});var Ua=function(){var e=i.getMainReservation();e&&e.services.length>0&&o.isModifyReservation?(i.setConfig("modifyEnhancementInContext"),o.getEnhancementServices()):J()};o.$on(y.LANG_CHANGE,function(){o.langObj={language:i.getLanguage()},o.languageCode=i.getLanguage();var e=i.getMainReservation();if(void 0!=e.roomStays&&e.roomStays.length&&void 0!=e.roomStays[0]&&void 0!=e.roomStays[0].total){if(t.MRB){if(!o.isModifyReservation){j();var e=i.getMainReservation(),n=e.id,c=i.getMainReservationArray();void 0!=we&&void 0!=we.guestInfo&&void 0!=we.guestInfo.loyalty&&we.guestInfo.loyalty.length>0&&!0===we.guestInfo.loyalty[0].requireRestrictionCheck&&o.addLoyaltyReqParams(e),d.callHoldReservation(ea,e,c,t.MRB,t.MRB).success(function(e){if(b.setMyCheckRefershTokenDetails(e),i.setMrbItineraryTotals(e.itineraryTotals),i.setMrbItineraryPaymentInfo(e.itineraryPaymentInfo),1==i.setMainReservationByEqual(e.reservationResponses)){if(c.length>1){o.initMultiroomData(),i.setMainReservation(n),z();for(var a=0;a<o.mainReservationArray.length;a++)o.mainReservationArray[a].totalRoomData&&o.mainReservationArray[a].totalRoomData.specialRequest.length>0&&o.getSpecialRequests(o.mainReservationArray[a])}else o.mainReservationArray=angular.copy(i.getMainReservationArray()),i.setMainReservation(o.mainReservationArray[0].id),o.addSpecialRequestToReservation(),z();var g=v.findIndex(e.reservationResponses,function(e){return e.id==n}),m=angular.copy(e.reservationResponses[g]);o.textualPolicies=m.policies.textualPolicies,p.stepsById.accommodations.placeholder=m.roomStays[0].roomRates[0].roomTypeName;var u=m.roomStays[0].roomRates,y=m.roomStays[0].ratePlans;if(p.stepsById.accommodations.rooms=[],p.stepsById.accommodations.ratePlan=[],angular.forEach(u,function(e){p.stepsById.accommodations.rooms.push(e),p.stepsById.accommodations.placeholder=e.roomTypeName}),"Package"!=y[0].ratePlanType&&"group"!=y[0].ratePlanType.toLowerCase()?(p.stepsById.accommodations.ratePlan=y,void 0!=m.merchandisedPromoData&&(p.stepsById.accommodations.merchandisedPromotionData=m.merchandisedPromoData)):(p.stepsById.accommodations.package=[],"Package"==y[0].ratePlanType&&(p.stepsById.accommodations.package=y,p.stepsById.accommodations.placeholder=y[0].ratePlanName)),"group"==y[0].ratePlanType.toLowerCase()){p.stepsById.accommodations.group=[];var h={};h.codeType=y[0].ratePlanType;var R,f=m.posSource.requestorIds;angular.forEach(f,function(e){"group"==e.codeType.toLowerCase()&&(R=e.id)}),h.id=R;var C=l.getHotelInfo().hotelCode,S=i.getLanguage();d.getGSplashDetails(C,y[0].ratePlanType,R,S).then(function(e){void 0!=e.data.groupRules&&(t.hidePriceFromAttendees=e.data.groupRules.hidePriceFromAttendees),i.setGroup(e.data),s.setUserTiming("Interaction","CodeWIdget"),void 0!=i.getGroup().groupName&&(h.name=i.getGroup().groupName),p.stepsById.accommodations.group.push(h),p.stepsById.accommodations.placeholder=h.name})}te(),G()}else o.failedRoomsId=i.getFailedRoomsId(),o.failedRoomsId.length>1?(o.combinedHoldFailure=!0,P.onModalOpen("book-button-id","combined-hold-failure-totals","combined-hold-failure-title-0",!1)):(s.setObjectData("combinedHoldError",!0),r.go("accommodation"))}).error(function(e){g.clear(),g.pop({type:"error",title:"",body:"Hold reservation error in total"})})}}else{var e=i.getMainReservation(),m=Qe.roomStays[0].depositPayments.depositAmt;o.depositAmt=F(m),o.getEnhancementServices(),o.isModifyReservation?d.modifyHoldReservation(ea,e,!0).success(function(e){i.handleXssVulnerabilities(e),b.setMyCheckRefershTokenDetails(e),g.clear(),i.setReservation(e),o.totalData=i.getFormattedReservationData(He),o.taxBreakoutEnabled=o.totalData.taxBreakoutEnabled,o.totalData.roomsData.roomTypeName=e.roomStays[0].roomRates[0].roomTypeName,p.stepsById.accommodations.placeholder=e.roomStays[0].roomRates[0].roomTypeName;var r=e,n=r.roomStays[0].roomRates,c=r.roomStays[0].ratePlans;if(p.stepsById.accommodations.rooms=[],p.stepsById.accommodations.ratePlan=[],a.debug(r),o.mainReservation=i.getMainReservation(),o.textualPolicies=o.mainReservation.policies.textualPolicies,angular.forEach(n,function(e){p.stepsById.accommodations.rooms.push(e),p.stepsById.accommodations.placeholder=e.roomTypeName}),"Package"!=c[0].ratePlanType&&"group"!=c[0].ratePlanType.toLowerCase()?(p.stepsById.accommodations.ratePlan=c,void 0!=r.merchandisedPromoData&&(p.stepsById.accommodations.merchandisedPromotionData=r.merchandisedPromoData)):(p.stepsById.accommodations.package=[],"Package"==c[0].ratePlanType&&(p.stepsById.accommodations.package=c,p.stepsById.accommodations.placeholder=c[0].ratePlanName,o.selectedRatePlanName=c[0].ratePlanName)),"group"==c[0].ratePlanType.toLowerCase()){p.stepsById.accommodations.group=[];var m={};m.codeType=c[0].ratePlanType;var u,y=i.getMainReservation(),v=y.posSource.requestorIds;angular.forEach(v,function(e){"group"==e.codeType.toLowerCase()&&(u=e.id)}),m.id=u;var h=l.getHotelInfo().hotelCode;d.getGSplashDetails(h,c[0].ratePlanType,u,ra).then(function(e){void 0!=e.data.groupRules&&(t.hidePriceFromAttendees=e.data.groupRules.hidePriceFromAttendees),i.setGroup(e.data),s.setUserTiming("Interaction","CodeWIdget"),void 0!=i.getGroup().groupName&&(m.name=i.getGroup().groupName),p.stepsById.accommodations.group.push(m),p.stepsById.accommodations.placeholder=m.name,o.selectedRatePlanName=m.name})}o.getFormattedDatePrices(),o.addSpecialRequestToReservation(),G()}).error(function(){g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}),a.debug(JSON.stringify(e)),h.clearAll()}):(void 0!=we&&void 0!=we.guestInfo&&void 0!=we.guestInfo.loyalty&&we.guestInfo.loyalty.length>0&&!0===we.guestInfo.loyalty[0].requireRestrictionCheck&&o.addLoyaltyReqParams(e),d.callHoldReservation(ea,e).success(function(e){b.setMyCheckRefershTokenDetails(e),g.clear(),i.setReservation(e),o.totalData=i.getFormattedReservationData(He),o.taxBreakoutEnabled=o.totalData.taxBreakoutEnabled,o.totalData.roomsData.roomTypeName=e.roomStays[0].roomRates[0].roomTypeName,p.stepsById.accommodations.placeholder=e.roomStays[0].roomRates[0].roomTypeName;var r=e,n=r.roomStays[0].roomRates,c=r.roomStays[0].ratePlans;if(p.stepsById.accommodations.rooms=[],p.stepsById.accommodations.ratePlan=[],a.debug(r),o.mainReservation=i.getMainReservation(),o.textualPolicies=o.mainReservation.policies.textualPolicies,angular.forEach(n,function(e){p.stepsById.accommodations.rooms.push(e),p.stepsById.accommodations.placeholder=e.roomTypeName}),"Package"!=c[0].ratePlanType&&"group"!=c[0].ratePlanType.toLowerCase()?(p.stepsById.accommodations.ratePlan=c,void 0!=r.merchandisedPromoData&&(p.stepsById.accommodations.merchandisedPromotionData=r.merchandisedPromoData)):(p.stepsById.accommodations.package=[],"Package"==c[0].ratePlanType&&(p.stepsById.accommodations.package=c,p.stepsById.accommodations.placeholder=c[0].ratePlanName)),"group"==c[0].ratePlanType.toLowerCase()){p.stepsById.accommodations.group=[];var m={};m.codeType=c[0].ratePlanType;var u,y=i.getMainReservation(),v=y.posSource.requestorIds;angular.forEach(v,function(e){"group"==e.codeType.toLowerCase()&&(u=e.id)}),m.id=u;var h=l.getHotelInfo().hotelCode;d.getGSplashDetails(h,c[0].ratePlanType,u,ra).then(function(e){void 0!=e.data.groupRules&&(t.hidePriceFromAttendees=e.data.groupRules.hidePriceFromAttendees),i.setGroup(e.data),s.setUserTiming("Interaction","CodeWIdget"),void 0!=i.getGroup().groupName&&(m.name=i.getGroup().groupName),p.stepsById.accommodations.group.push(m),p.stepsById.accommodations.placeholder=m.name})}o.getFormattedDatePrices(),o.addSpecialRequestToReservation(),wa(),te(),G()}).error(function(){g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}),a.debug(JSON.stringify(e)),h.clearAll()}))}L()}}),o.$on("EVENT.HOTEL_DATA_UPDATED",function(e){Ce()}),Q(),t.$on(y.GROUP_PAYMENT_INCONTEXT,function(){Q()}),o.continueShowPaymentCancelModal=function(){o.showPaymentCancelModal=!1,o.showIdealPaymentCancelModal=!1,P.onModalClose()},o.showRatePolicies=function(e,a,r){if(t.MRB&&void 0!=a&&void 0!=t.RatesAvail){o.selectedRatePlanName=a.roomStays[0].ratePlans[0].ratePlanName;var n=t.RatesAvail.roomStays[0].ratePlans,s=(a.roomStays[0].ratePlans[0].ratePlanCode,a.roomStays[0].ratePlans[0].ratePlanType);void 0!=i.getRatePlanInfoObject(a.id)&&(o.selectedRatePlanObj=i.getRatePlanInfoObject(a.id).rateInfo),"Group"!=s&&"group"!=s||void 0!=o.selectedRatePlanName||(o.selectedRatePlanName=n[0].ratePlanName,0==o.selectedRatePlanObj.length&&(o.selectedRatePlanObj=n)),void 0!=o.selectedRatePlanObj&&(e=o.selectedRatePlanObj[0])}var e=angular.copy(o.selectedRatePlanObj[0]);void 0==a&&(a=i.getMainReservation(),void 0==a.merchandisedPromoData.promotionName?e.merchandisedPromoData={}:e.merchandisedPromoData=a.merchandisedPromoData),void 0==a.merchandisedPromoData.promotionName?e.merchandisedPromoData={}:e.merchandisedPromoData=a.merchandisedPromoData,o.ratePlanDetails=e,o.showRatePlanDetail=!0,o.scrollTopRPPopup=u.pageYOffset+"px";var l="";void 0!=r&&(l="-"+r),P.onModalOpen("PricingBox-info-circle-id"+l,"rate-plan-detail-popup-id","rate-plan-detail-title-id",!1,o.hideRatePolicies)},o.hideRatePolicies=function(){o.showRatePlanDetail=!1,P.onModalClose()},o.onRetrieveInfoClick=function(){var e=u.pageYOffset+100+"px";t.$broadcast(y.SHOW_RETRIEVE_GUEST_INFO_POPUP,{scrollTopRPPopup:e})},o.multiRoomGuestsInfo=function(){o.singleGuestsInfo&&(o.collapseGuestDetails=!1),o.singleGuestsInfo,o.singleGuestsInfo,o.useSameContactAddress=!!o.singleGuestsInfo,o.toggleAddressChkBox()},o.initGuestInfoArray=function(e){var a={useType:"1",countryCode:"",stateCode:"",stateName:"",cityName:"",postalCode:"",addressLine1:"",addressLine2:""};a.countryCode="1"==o.ResAndPayConfig.defaultCountry?o.hotelDesc.address.countryCode:null,0==e.resGuests[0].profile.customer.address.length&&e.resGuests[0].profile.customer.address.push(a),void 0==e.resGuests[0].profile.customer.namePrefix&&(e.resGuests[0].profile.customer.namePrefix=""),e.resGuests[0].uniqueId.idContext="ProfileID";var t={phoneUseType:"1",phoneNumber:""};0==e.resGuests[0].profile.customer.telephone.length&&e.resGuests[0].profile.customer.telephone.push(t),S.getIsLoyaltyReservationEnabled()&&S.getIsLoyaltyUserLogIn()&&(e.resGuests[0].profile.customer.email=o.email,e.resGuests[0].uniqueId.id=o.selectedGuestId)},o.getStates=function(e){var a=c("filter")(o.countries,{code:e}),t=a[0].states;return t=c("orderBy")(t,"name")},o.guestStateChange=function(e,a,t){if(a){var r=o.getStates(t),n=c("filter")(r,{code:e}),i=n[0];a.resGuests[0].profile.customer.address[0].stateName=i.name}},o.getSpecialRequests=function(e){var a={hotelCode:ea,queryString:"lang="+e.languageCode+"&dateIn="+e.totalRoomData.dateIn+"&dateOut="+e.totalRoomData.dateOut+"&rooms="+e.totalRoomData.roomCount+"&adults="+e.totalRoomData.guestCounts.adults+"&children="+e.totalRoomData.guestCounts.children+"&ratePlanCode="+e.totalRoomData.ratePlanCode+"&ratePlanType="+e.totalRoomData.ratePlanType+"&roomTypeCode="+e.totalRoomData.roomTypeCode},t=i.buildOptions();if(void 0!=t.allCodes&&Object.keys(t.allCodes).length>0)for(ya=0;ya<Object.keys(t.allCodes).length;ya++){if("travelagent"===Object.keys(t.allCodes)[ya].toLowerCase()){var o=t.allCodes.TravelAgent?t.allCodes.TravelAgent:t.allCodes.travelagent;a.queryString+="&taCode="+o}if("discount"===Object.keys(t.allCodes)[ya].toLowerCase()){var r=t.allCodes.Discount?t.allCodes.Discount:t.allCodes.discount;a.queryString+="&discountCode="+r}if("corporate"===Object.keys(t.allCodes)[ya].toLowerCase()){var n=t.allCodes.Corporate?t.allCodes.Corporate:t.allCodes.corporate;a.queryString+="&corpCode="+n}if("group"===Object.keys(t.allCodes)[ya].toLowerCase()){var l=t.allCodes.Group?t.allCodes.Group:t.allCodes.group;a.queryString+="&groupCode="+l}}var c;void 0!=t.allCodes&&(c=Object.keys(t.allCodes).find(function(e){return"travelagent"===e.toLowerCase()})),void 0==t.taCode||t.allCodes&&void 0!=c||(a.queryString+="&taCode="+t.taCode);var g;void 0!=t.allCodes&&(g=Object.keys(t.allCodes).find(function(e){return"discount"===e.toLowerCase()})),void 0==t.Discount||t.allCodes&&void 0!=g||(a.queryString+="&discountCode="+t.Discount);var m;void 0!=t.allCodes&&(m=Object.keys(t.allCodes).find(function(e){return"corporate"===e.toLowerCase()})),void 0==t.Corporate||t.allCodes&&void 0!=m||(a.queryString+="&corpCode="+t.Corporate);var u;void 0!=t.allCodes&&(u=Object.keys(t.allCodes).find(function(e){return"group"===e.toLowerCase()})),void 0==t.groupCode||t.allCodes&&void 0!=u||(a.queryString+="&groupCode="+t.groupCode),t.bookerIdentifier&&(a.queryString+="&bookerIdentifier="+t.bookerIdentifier),t.partnerIdentifier&&(a.queryString+="&partnerIdentifier="+t.partnerIdentifier),d.getSpecialServices(a).then(function(a){var t=1,o=!0,r=[];angular.forEach(a,function(a,n){o&&(t>4&&(o=!1),"SERVICE_REQUEST"===a.serviceCategory&&(angular.forEach(e.totalRoomData.selectedSpecialRequests,function(e){a.serviceTypeId==e.serviceTypeId&&(a.selectedRequest=e.serviceOptions[0])}),r.push(a),t++))}),v.forEach(e.totalRoomData.specialRequest,function(e){if(e.selectedRequest){var a=v.findIndex(r,function(a){return a.serviceTypeId==e.serviceTypeId});-1!=a&&(r[a].selectedRequest=angular.copy(e.selectedRequest))}}),e.totalRoomData.specialRequest=angular.copy(r),s.setUserTiming("PageLoad","Payment")})},o.selectRoomOnHoldFailure=function(){o.combinedHoldFailure=!1,P.onModalClose(),r.go("accommodation")},o.getRoomIndex=function(e){return v.findIndex(o.mainReservationArray,function(a){return a.id==e})+1},o.notifySpecialOffer=function(){var e;e=o.shareAllMarketInd?"1":"0",f.eventTrack("ClickSpecialOffersNotification",{category:"UserNavigation",label:e})},o.notifySpecialOffer(),o.$on("$locationChangeStart",function(e,a,t){t.indexOf("/total")>-1&&1==o.isModifyReservation&&e.preventDefault()}),t.$on("$stateChangeStart",function(e,a,t,r,n){o.isMyCheckPaymentEnabled&&(mycheck.wallet||mycheckWallet)&&(o.isMycheckV2Enabled?mycheckWallet.destroy():mycheck.wallet.destroy())}),o.toggleGuestDetails=function(e){e?e.collapseGuestDetails=!e.collapseGuestDetails:t.MRB&&o.mainReservationArray.length>1&&(o.collapseGuestDetails=!o.collapseGuestDetails)},o.getInfo=function(e){var a=[];if(a={},null!=o.salutation&&(a.salutation=o.salutation),null!=o.firstName&&(a.firstName=o.firstName),null!=o.lastName&&(a.lastName=o.lastName),null!=o.email&&(a.email=o.email),null!=o.phoneNumber&&(a.phoneNumber=o.phoneNumber),null!=o.address1&&(a.contactAddress1=o.address1),null!=o.address2&&(a.contactAddress2=o.address2),null!=o.city&&(a.contactCity=o.city),null!=o.selectedCountry&&(a.contactCountry=o.selectedCountry),null!=o.states){var t=c("filter")(o.states,{code:o.selectedState},!1);1===t.length&&(a.contactState=t[0].code);var r=c("filter")(o.states,{name:o.stateName},!1);1===r.length&&(a.contactStateName=r[0].name)}null!=o.postalcode&&(a.contactPostalCode=o.postalcode),null!=o.selectedGuestId&&(a.guestId=o.selectedGuestId);var n={};if(n.label={},n.label=angular.copy(a),n.label.action="sendGuestDetails",e){var i=angular.equals({},a),s=angular.equals(a,xe);i||s||(xe=angular.copy(a),d.gmsAbandonmentPost(n).then(function(e){}))}else d.gmsAbandonmentPost(n).then(function(e){})},o.$on(y.SUBMIT_GMS_FORM,function(){o.getInfo()}),o.$on("EVENT.SEND_GUESTINFO_TO_GMS",function(){o.shareAllMarketInd&&o.getInfo(!0)}),o.shiftFocusToMinusSpRequests=function(e){setTimeout(function(){if(void 0!=e)var a=document.getElementById("close-special-request-"+e);else var a=document.getElementById("close-special-request");a&&a.focus()})},o.shiftFocusToAddSpRequests=function(e){setTimeout(function(){if(void 0!=e)var a=document.getElementById("open-special-request-"+e);else var a=document.getElementById("open-special-request");a&&a.focus()})},window.innerWidth>786?o.hideEnhancementCheckBox=!0:o.hideEnhancementCheckBox=!1,o.$on("EVENT.GMS_REMOVE_PRIVATEOFFERS",function(){var e=i.getMainReservation();1==i.getGmsLoginState()&&void 0!=e.roomStays&&e.roomStays.length>0&&void 0!=e.roomStays[0].ratePlans&&e.roomStays[0].ratePlans.length>0&&"Group"!=e.roomStays[0].ratePlans[0].ratePlanType&&(o.continueDeleteRatePlan(),o.continueDeleteRoom(),o.continueDeletePackage(),Ot(),t.MRB&&(i.revertAllAccommodationsMrb(),p.stepsById.accommodations.placeholderMRB=i.getBookedRoomCount()))});var Ha=angular.copy(o.enablePayPal),Va=angular.copy(o.enableIDeal),$a=angular.copy(o.enableCreditCard),qa=angular.copy(o.enable3DSecure),Ya=angular.copy(o.paypal),ja=angular.copy(o.credit),za=angular.copy(o.ideal),Wa=angular.copy(o.secure3D),Ka=angular.copy(o.ingenico),Ja=angular.copy(o.nets),Qa=angular.copy(o.paymentexpress),Xa=angular.copy(o.reddot),Za=angular.copy(o.creditCardFieldRequiredIndicator),et=angular.copy(o.showCreditCardFields),at=angular.copy(o.bookNowDisplay),tt=angular.copy(o.alternatePaymentIngenico),ot=angular.copy(o.payment.method),rt=angular.copy(o.enableXpayCreditCard),nt=angular.copy(o.enableXpayPayPal),it=angular.copy(o.enableXpayWeChat),st=angular.copy(o.enableXpayAliPay),lt=angular.copy(o.xpaywechat),ct=angular.copy(o.xpayalipay),dt=angular.copy(o.xpaypaypal),gt=angular.copy(o.xpaycredit),mt=angular.copy(o.enableAdyenDotPay),ut=angular.copy(o.adyenDotPay),pt=angular.copy(o.enableAdyenMbank),yt=angular.copy(o.enableAdyenIpko),vt=angular.copy(o.enableAdyenPrzelew24),ht=angular.copy(o.enableAdyenING),Rt=angular.copy(o.enableAdyenMillennium),ft=angular.copy(o.enableAdyenAliorBank),Ct=angular.copy(o.enableAdyenCitiHandlowy),Pt=angular.copy(o.enableAdyenEurobank),St=angular.copy(o.enableAdyenRPrzelew),At=angular.copy(o.enableAdyenBlik),It=o.enabledMyCheckCreditCard,bt=o.enabledMyCheckPaypal,Dt=o.enabledMyCheckApplePay,Tt=o.enabledMyCheckGpay;(o.isVoucherPaymentEnabled||o.isLoyaltyReservationEnabled)&&(Z(),le(),o.insuranceObj&&o.insuranceObj.showInsurance&&o.changeInPaymentVariables&&(o.insuranceObj._showCreditCardFieldsLoyalty=angular.copy(et),o.insuranceObj.changeInPaymentVariables=o.changeInPaymentVariables)),o.toggleDirectApplyButton=function(e,a){o.displayMaximumPointsPaymentView=!o.displayMaximumPointsPaymentView,o.removeLoyaltyPoints(),e&&o.applyMaximumLoyaltyPoints(a)},o.applyMaximumLoyaltyPoints=function(e){var a=ne("loyalty-payment"),t=S.getMaxPointsToEnter(a);S.setIsMaximumPointsApplied(!0),o.applyLoyaltyPoints(t,e)},o.applyLoyaltyPoints=function(e,a){S.setBurnPoints(e),o.loyaltyBurnPoints=e,ee("loyalty-payment"),a.preventDefault()},o.removeLoyaltyPoints=function(e){S.getBurnPoints()&&f.eventTrack("RemoveAppliedPoints",{category:"UserNavigation",label:"RemoveAppliedPoints"}),e||(S.setBurnPoints(void 0),S.setIsMaximumPointsApplied(!1)),de(),o.showLoyaltyErrorMessage=!1,o.loyaltyBurnPoints=void 0,ee("loyalty-payment")},o.inputPointsValidationAndCashEquivalent=function(e){var a=ne("loyalty-payment"),t=S.getMinPointsForRedemption(),r=S.getMaxPointsToEnter(a);if(o.minPointsMsg=!1,o.maxPointsErrorMessage=!1,o.invalidPointsErrorMessage=!1,o.showLoyaltyErrorMessage=!1,e&&(!e.toString().match(o.onlyNumbers)||e.toString().match(o.onlyNumbers)&&e>r))o.showLoyaltyErrorMessage=!0,e.toString().match(o.onlyNumbers)?e>r&&(o.maxPointsToEnter=S.getMaxPointsToEnter(a),o.maxPointsErrorMessage=!0,o.invalidPointsErrorMessage=!1):(o.maxPointsErrorMessage=!1,o.invalidPointsErrorMessage=!0);else if(isNaN(e))o.showLoyaltyErrorMessage=!0,o.maxPointsErrorMessage=!1,o.invalidPointsErrorMessage=!0;else if(e&&e<t)o.showLoyaltyErrorMessage=!0,o.minPointsMsg=!0;else if(e){var n=S.getBurnPointsCurrencyValueFromPassedPoints(e,a);o.displayCashValueOfLoyaltyPoints=c("currencyConversionWithTwoDecimalPlaces")(n),o.showLoyaltyErrorMessage=!1}else o.showLoyaltyErrorMessage=!1;if(o.showLoyaltyErrorMessage){var i;o.invalidPointsErrorMessage?i="001":o.maxPointsErrorMessage?i="002":o.minPointsMsg&&(i="003"),i&&f.eventTrack("RewardsErrorMessageCode",{category:"UserNavigation",label:i})}},o.preventCharacters=function(e){69!=e.keyCode&&107!=e.keyCode&&109!=e.keyCode||e.preventDefault()},o.isLoyaltyReservationEnabled&&oe();var Ot=function(){var e=i.getMainReservation(),a=e.posSource.requestorIds;if(i.getSignInRequiredFlag()&&void 0!=a)for(var t=0;t<a.length;t++)if("corporate"===a[t].codeType){i.deleteAllCodeByKey(a[t].codeType),i.deleteCodeTypeByIndex(t),i.removeOtherCode(a[t].codeType.toLowerCase()),i.setSignInRequiredFlag(!1);break}};o.$on("LOYALTY_USER_LOGIN_SUCCESS",function(){o.showHideBookerSection=!0,M.isAudienceEvaluatorEnabled()?ue():(Ua(),e(function(){o.isLoyaltyReservationEnabled&&oe()})),o.hideEmailMarketingConsent=S.getEmailMarketingConsentStatus()}),o.$on("LOYALTY_USER_LOGOUT_SUCCESS",function(){if(o.showHideBookerSection=!1,M.isAudienceEvaluatorEnabled()){M.resetAudienceLists(),M.resetReservationHistoryObject();var e=M.getAudienceEvaluatorCriteria(),a=l.getHotelDesc(),t=a&&a.chainInfo&&a.chainInfo.length?a.chainInfo[0]:"";d.callAudienceEvaluator(a.hotelCode,t,e).then(function(e){M.setAudienceLists(e.data),pe()},function(e){console.log(e),pe()})}else pe()}),o.$on("LOYALTY_CONFIG_DATA_SUCCESS",function(){S.getLoyaltyConfig()&&!o.isModifyReservation&&S.getIsLoyaltyReservationEnabled()&&(o.showLoyaltyPoints=!S.getLoyaltyConfig()||!S.getLoyaltyConfig().showHideLoyaltyPoints||"hide"!==S.getLoyaltyConfig().showHideLoyaltyPoints.toLowerCase(),o.programName=S.getLoyaltyConfig().programName,o.programCurrency=S.getLoyaltyConfig().programCurrency)}),o.isVoucherPaymentEnabled&&ve(),o.applyVoucherPayment=function(e){e.preventDefault(),o.voucherErrorObject={show:!1,message:""};var a=!1;d.validateVoucherCode(o.voucherDetails.voucherCode).then(function(e){var t=e.data;if(t&&t.errorCode&&"1000"===t.errorCode)o.voucherErrorObject={show:!0,message:"global_PleaseEnterAValidVoucherCode-msgentervalidvouchercode"};else if(t&&t.errorCode&&"1002"===t.errorCode)o.voucherErrorObject={show:!0,message:"global_ThisVoucherCannotBeRedeemedOnline-msgvouchercannotberedeemedonline"};else if(t&&1===t.status&&t.currentAmount){var r=ne("voucher-payment");t.partlyRedeemable?(o.voucherDetails.redeemedCashValue=A.calculateRedeemableVoucherAmount(r,t.currentAmount,t.currency),a=!0):r>=A.convertVoucherCashValueInBaseCurrency(t.currentAmount,t.currency)?(o.voucherDetails.redeemedCashValue=A.convertVoucherCashValueInBaseCurrency(t.currentAmount,t.currency),a=!0):o.voucherErrorObject={show:!0,message:"global_PartialVoucherRedemptionIsNotSupported-AmountMustBeGreaterThanOrEqualToTheValueOfTheVoucher-msgpartialvoucherredemptionisnotsupported"},a&&(o.voucherDetails.details=t,A.setVoucherDetails(o.voucherDetails),o.voucherApplied=!0,ee("voucher-payment"))}else o.voucherErrorObject={show:!0,message:"global_PleaseEnterAValidVoucherCode-msgentervalidvouchercode"}},function(e){o.voucherErrorObject={show:!0,message:"global_PleaseTryAgain-msgpleasetryagain"}})},o.removeVoucherPayment=function(){o.voucherErrorObject={show:!1,message:""},o.voucherDetails={},o.voucherApplied=!1,A.resetVoucherDetails(),ee("voucher-payment")},t.$on("EVENT.HOTEL_DATA_UPDATED",function(){o.voucherPaymentProvidersList=A.getVoucherPaymentProvidersList()}),Ce(),o.openTaxBreakdown=function(){o.showTaxBreakdown=!0},o.hideTaxBreakdown=function(){o.showTaxBreakdown=!1},o.reloadBEOnCosmoFailure=function(){o.showMessageOnCosmoFailure=!1,I.removeToken(),t.startTime=Date.now(),s.startNewReservation()},o.$on("EVENT.MYCHECK_AFTER3DSCOMPLETE_DATA",function(e,a){var r=t.MRB?i.getMainReservationArray()[0]:i.getMainReservation();"COMPLETE_AUTH_3DS"===a.method&&(a.transaction_id===r.resGlobalInfo.guaranteesAccepted[0].walletRedemption.transactionId?i.canModifyReservation()?t.MRB?o.callModifyReservationAPI(i.getMainReservationArray(),t.MRB):o.callModifyReservationAPI(i.getMainReservation()):t.MRB?o.callReservationAPI(i.getMainReservationArray(),t.MRB):o.callReservationAPI(i.getMainReservation()):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})))}),o.findAdultObject=function(e,a){return T.adultEnhancementPriceObj(e,a)},o.findChildObject=function(e,a){return T.childEnhancementPriceObj(e,a)},o.findRoomObject=function(e,a){return T.roomEnhancementPriceObj(e,a)},o.adultPriceBreakUp=function(e,a,t){return T.adultPriceBreakUp(e,a,t)},o.childPriceBreakUp=function(e,a,t){return T.childPriceBreakUp(e,a,t)},o.showDiscountedChildOnly=function(e,a,t){return T.showDiscountedChildOnly(e,a,t)},o.clearGuestDeatilsForInvalidData=function(){var e=_.isEmpty(R.getGmsProfile()),a=S.getIsLoyaltyUserLogIn();if(o.salutation=null,o.firstName=e&&!a||!o.ResAndPayConfig.firstNameReadOnlyIndicator?"":o.firstName,o.lastName=e&&!a||!o.ResAndPayConfig.lastNameReadOnlyIndicator?"":o.lastName,o.email=e&&!a||!o.ResAndPayConfig.emailAddressReadOnlyIndicator?"":o.email,o.bookerInfo.salutation=o.ResAndPayConfig.displayBookerSalutationFieldIndicator?null:o.bookerInfo.salutation,o.bookerInfo.firstName=o.ResAndPayConfig.displayBookerFirstNameFieldIndicator?"":o.bookerInfo.firstName,o.bookerInfo.lastName=o.ResAndPayConfig.displayBookerLastNameFieldIndicator?"":o.bookerInfo.lastName,o.bookerInfo.email=o.ResAndPayConfig.displayBookerEmailAddressFieldIndicator?"":o.bookerInfo.email,o.phoneNumber="",o.address1="",o.address2="",o.city="",o.selectedCountry="1"==o.ResAndPayConfig.defaultCountry?o.hotelDesc.address.countryCode:null,o.selectedState=null,o.postalcode="",o.billingAddressLine1="",o.billingAddressLine2="",o.billingCity="",o.selectedBillingCountry=null,o.selectedBillingState=null,o.billingPostalCode="",o.nameOnCard="",o.cardNumber="",o.expiry="",o.cvv="",o.totalData&&(o.totalData.arrivalTimeInfo=o.totalData.arrivalTimeInfo?"":o.totalData.arrivalTimeInfo,o.totalData.additionalComment=o.totalData.additionalComment?"":o.totalData.additionalComment),t.MRB&&o.mainReservationArray)v.forEach(o.mainReservationArray,function(e){if(e&&e.totalRoomData&&(e.totalRoomData.arrivalTimeInfo=e.totalRoomData.arrivalTimeInfo?"":e.totalRoomData.arrivalTimeInfo,e.totalRoomData.additionalComment=e.totalRoomData.additionalComment?"":e.totalRoomData.additionalComment),e&&e.resGuests&&e.resGuests.length>0){if(e.resGuests[0].profile&&e.resGuests[0].profile.customer&&(e.resGuests[0].profile.customer.namePrefix=null,e.resGuests[0].profile.customer.givenName="",e.resGuests[0].profile.customer.surName="",e.resGuests[0].profile.customer.email="",e.resGuests[0].profile.customer.telephone&&e.resGuests[0].profile.customer.telephone.length>0&&(e.resGuests[0].profile.customer.telephone[0].phoneNumber=""),e.resGuests[0].profile.customer.address&&e.resGuests[0].profile.customer.address.length>0))for(var a=0;a<e.resGuests[0].profile.customer.address.length;a++)e.resGuests[0].profile.customer.address[a].addressLine1="",e.resGuests[0].profile.customer.address[a].addressLine2="",e.resGuests[0].profile.customer.address[a].cityName="",
e.resGuests[0].profile.customer.address[a].countryCode="1"==o.ResAndPayConfig.defaultCountry?o.hotelDesc.address.countryCode:null,e.resGuests[0].profile.customer.address[a].countryName="",e.resGuests[0].profile.customer.address[a].stateCode=null,e.resGuests[0].profile.customer.address[a].stateName="",e.resGuests[0].profile.customer.address[a].postalCode="";e.resGlobalInfo.arrivalTime&&(e.resGlobalInfo.arrivalTime=""),e.resGlobalInfo.comments&&e.resGlobalInfo.comments.length>0&&(e.resGlobalInfo.comments[0].comment="")}i.setMainReservationArrayById(e.id,e),i.setMainReservation(e.id)});else{var r=o.mainReservation;if(r&&r.resGuests&&r.resGuests.length>0&&r.resGuests[0].profile&&r.resGuests[0].profile.customer&&(r.resGuests[0].profile.customer.namePrefix=null,r.resGuests[0].profile.customer.givenName="",r.resGuests[0].profile.customer.surName="",r.resGuests[0].profile.customer.email="",r.resGuests[0].profile.customer.telephone&&r.resGuests[0].profile.customer.telephone.length>0&&(r.resGuests[0].profile.customer.telephone[0].phoneNumber=""),r.resGuests[0].profile.customer.address&&r.resGuests[0].profile.customer.address.length>0))for(var n=0;n<r.resGuests[0].profile.customer.address.length;n++)r.resGuests[0].profile.customer.address[n].addressLine1="",r.resGuests[0].profile.customer.address[n].addressLine2="",r.resGuests[0].profile.customer.address[n].cityName="",r.resGuests[0].profile.customer.address[n].countryCode="1"==o.ResAndPayConfig.defaultCountry?o.hotelDesc.address.countryCode:null,r.resGuests[0].profile.customer.address[n].stateCode=null,r.resGuests[0].profile.customer.address[n].postalCode="";r&&r.resGlobalInfo&&(r.resGlobalInfo.arrivalTime&&(r.resGlobalInfo.arrivalTime=""),r.resGlobalInfo.comments&&r.resGlobalInfo.comments.length>0&&(r.resGlobalInfo.comments[0].comment="")),i.setReservation(r)}},o.insuranceObj&&o.insuranceObj.showInsurance&&(o.insuranceObj.creditCardFieldRequiredIndicatorOriginalValue=angular.copy(o.creditCardFieldRequiredIndicator),N.setPaymentSupportedCardVendor(o.acceptedCreditCardsLogos),o.insuranceObj.acceptedCreditCardsLogos=N.getSupportedCardVendors(),o.$on("INSURANCE_COMPONENT_INSURANCE_SELECTION",function(e,a){o.$apply(function(){o.submitted=!1,a&&a.data?(o.insuranceObj.selectedInsurance=angular.copy(a.data),N.setSelectedInsurance(o.insuranceObj.selectedInsurance),"ACCEPTED"===a.data.selectionStatus?(o.isInsuranceSelected=!0,o.insuranceObj.selectedInsurance.priceDetails&&(o.displayCurrencySymbolOnLeft?o.insuranceTotalPrice=o.insuranceObj.selectedInsurance.priceDetails.currencySymbol+" "+o.insuranceObj.selectedInsurance.priceDetails.total:o.insuranceTotalPrice=o.insuranceObj.selectedInsurance.priceDetails.total+" "+o.insuranceObj.selectedInsurance.priceDetails.currencySymbol)):(o.isInsuranceSelected=!1,o.insuranceTotalPrice="",o.GuestsTotalForm&&o.GuestsTotalForm.$dirty&&o.GuestsTotalForm.$error&&o.GuestsTotalForm.$error.required&&o.GuestsTotalForm.$error.required.length&&angular.forEach(o.GuestsTotalForm.$error.required,function(e,a){e&&"ccExpiry"===e.$name&&!e.$valid&&o.GuestsTotalForm[e.$name].$setValidity("$valid",!0)}),o.insuranceObj.creditCardFieldRequiredIndicatorOriginalValue!==o.creditCardFieldRequiredIndicator&&(o.creditCardFieldRequiredIndicator=o.insuranceObj.creditCardFieldRequiredIndicatorOriginalValue),(o.isVoucherPaymentEnabled||o.isLoyaltyReservationEnabled)&&o.changeInPaymentVariables&&le()),"ACCEPTED"===a.data.selectionStatus&&Se()):o.insuranceObj.selectedInsurance=a})}),o.$on("INSURANCE_COMPONENT_INSURANCE_WIDGET_READY",function(e,a){o.displayCurrencySymbolOnLeft=!(o.currencyDetail&&o.currencyDetail.displayRightEnabled),a&&a.data&&a.data&&o.$apply(function(){o.insuranceObj.hasInsuranceOffers=!0,o.insuranceObj.selectedInsurance={},N.setSelectedInsurance(o.insuranceObj.selectedInsurance)})}),o.$on("INSURANCE_COMPONENT_INSURANCE_ERROR",function(e,a){a&&a.data&&a.data&&o.$apply(function(){o.insuranceObj.hasInsuranceOffers=!1,o.insuranceObj.selectedInsurance={},N.setSelectedInsurance(o.insuranceObj.selectedInsurance)})}),o.checkIsNoInsuranceOptionSelected=function(){return!(!o.insuranceObj.selectedInsurance||"ACCEPTED"!==o.insuranceObj.selectedInsurance.selectionStatus&&"REFUSED"!==o.insuranceObj.selectedInsurance.selectionStatus||!u.AmadeusHosResInsuranceServices.InitializeInsuranceSdk.isSelectionCompleted())},o.bookInsurance=function(e){return n(function(a,r){var n=[];if(t.MRB?n=e:n.push(e),t.MRB&&i.getMainReservationArray()&&i.getMainReservationArray().length>1)r(n);else{t.showSpinner=!0;var s=i.getInsuranceSuccessAndReservationFails();if(s&&s.isInsuranceSuccess&&null!=s.policyConfirmationNumber&&void 0!=s.policyConfirmationNumber&&s.isReservationFailed){t.showSpinner=!1,o.insuranceObj.isInsuranceSuccessReservationFails=!0;var l=N.prepareInsuranceObject(n,s.selectedInsurance.insuranceSuccessData);l&&l.length>0&&(i.setMainReservationByEqual(l),i.setReservation(l[0])),a(l)}else{var c=be(n[0]);N.bookingInsuranceMethod(c,o.cardDetails),u.TCCommonService.EventService.subscribe("EVT_WC_ON_INSURANCE_COMPLETED",function(e,s){if(t.showSpinner=!1,s&&s.data&&(s.data.id||s.data.policyConfirmationNumber)){var l=N.prepareInsuranceObject(n,s.data);if(l&&l.length>0){i.setMainReservationByEqual(l);var c={isInsuranceSuccess:!0,id:s.data.id,policyConfirmationNumber:s.data.policyConfirmationNumber,reservationNumber:l[0].uniqueId,isReservationFailed:!1,selectedInsurance:o.insuranceObj.selectedInsurance};o.insuranceObj.reservationData.isInsuranceSuccess=!0,i.setReservation(l[0]),o.insuranceObj.selectedInsurance.insuranceErrorData={},o.insuranceObj.selectedInsurance.insuranceSuccessData=angular.copy(s.data),i.setInsuranceSuccessAndReservationFails(c),o.insuranceObj.isInsuranceSuccessReservationFails=!0,N.setSelectedInsurance(o.insuranceObj.selectedInsurance),u.dataLayer.push({ihInsurancePurchased:"Yes"}),a(l)}}else r(n)}),o.$on("INSURANCE_COMPONENT_INSURANCE_BOOKING_ERROR",function(e,a){if(t.showSpinner=!1,a&&a.data&&a.data[0].errorCode&&"booking"===a.data[0].errorCode.toLowerCase()){var s={isInsuranceSuccess:!1,id:null,policyConfirmationNumber:null,reservationNumber:n[0].uniqueId,isReservationFailed:!1,selectedInsurance:o.insuranceObj.selectedInsurance};o.insuranceObj.reservationData.isInsuranceSuccess=!1,o.insuranceObj.selectedInsurance.insuranceSuccessData={},o.insuranceObj.selectedInsurance.insuranceErrorData=angular.copy(a.data[0]),i.setInsuranceSuccessAndReservationFails(s),N.setSelectedInsurance(o.insuranceObj.selectedInsurance),u.dataLayer.push({ihInsurancePurchased:"No"}),r(n)}})}}})},o.bookInsuranceAndCallReservation=function(e){o.bookInsurance(e).then(function(e){o.callReservationsWithInsurance(e)},function(e){o.callReservationsWithInsurance(e)})}),o.callReservationsWithInsurance=function(e){o.isModifyReservation?o.callModifyReservationAPI(e[0]):t.MRB?o.callReservationAPI(e,t.MRB):o.callReservationAPI(e[0])},o.setReservationFailsFlagForInsurance=function(){if(o.insuranceObj&&o.insuranceObj.showInsurance&&o.insuranceObj.selectedInsurance&&o.insuranceObj.selectedInsurance.insuranceSuccessData&&o.insuranceObj.selectedInsurance.insuranceSuccessData.policyConfirmationNumber&&i.getInsuranceSuccessAndReservationFails()){var e=i.getInsuranceSuccessAndReservationFails();e.isReservationFailed=!0,i.setInsuranceSuccessAndReservationFails(e),o.insuranceObj.reservationData.isReservationFailed=!0,N.setSelectedInsurance(o.insuranceObj.selectedInsurance)}},o.clearInsuranceDataFromReservationService=function(){l.getEnableInsurance()&&o.insuranceObj&&o.insuranceObj.showInsurance&&i.getInsuranceSuccessAndReservationFails()&&(i.setInsuranceSuccessAndReservationFails({}),o.insuranceObj.isInsuranceSuccessReservationFails=!1)},o.initializeInsuranceOnCurrencyORLanguageChange=function(){if(o.insuranceObj&&o.insuranceObj.showInsurance&&o.selectedCountry&&("US"!==o.selectedCountry||"US"===o.selectedCountry&&o.selectedState)){var e={countryCode:o.selectedCountry};o.selectedState&&(e.stateCode=o.selectedState),o.initializeInsuranceOnDataUpdate(e)}},o.payerAuthCallForCybersource=function(){o.enabledCybersourceButton=!1;var e=l.getHotelInfo().hotelCode,a=o.expiry.split("/"),t={billTo_city:o.city,billTo_country:o.selectedCountry,billTo_email:o.email,billTo_firstName:o.firstName,billTo_lastName:o.lastName,billTo_postalCode:o.postalcode,billTo_state:o.selectedState,billTo_street1:o.address1,card_accountNumber:o.cardNumber,card_cardType:o.getCardType(o.cardNumber),card_expirationMonth:a[0],card_expirationYear:a[1],ics_applications:"ics_pa_setup",merchantID:"patest",merchantReferenceCode:"0001",payerAuthSetupService_run:"true"};d.callIcsPaSetupCybersource(t,e).then(function(e){e.data&&(Te=e.data.payerAuthSetupReply_referenceID,Oe=e.data.payerAuthSetupReply_deviceDataCollectionURL,e.data&&(o.prepareFrameForCyberSource(),document.getElementById("cardinal_collection_form_input").value=e.data.payerAuthSetupReply_accessToken,o.ddcCall(),i.setAltPaymentLstToReservationList(Te)))},function(e){console.log(e),o.enabledCybersourceButton=!0})},o.getCardType=function(e){return null!==e.match(new RegExp("^4"))?"001":/^(5[1-5][0-9]{14}|2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12}))$/.test(e)?"002":null!==e.match(new RegExp("^3[47]"))?"003":null!==e.match(new RegExp("^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)"))?"004":null!==e.match(new RegExp("^36"))?"005":null!==e.match(new RegExp("^30[0-5]"))?"006":null!==e.match(new RegExp("^35(2[89]|[3-8][0-9])"))?"007":null!==e.match(new RegExp("^(4026|417500|4508|4844|491(3|7))"))?"033":""},o.ddcCall=function(){function e(a){if(a.data){1==JSON.parse(a.data).Status?o.booknow():o.enabledCybersourceButton=!0}window.removeEventListener("message",e)}var a=document.querySelector("#cardinal_collection_form");a&&a.submit(),!l.getCybersource3DSV2Enabled()||o.paypal||o.ideal||window.addEventListener("message",e)},o.prepareFrameForCyberSource=function(){var e=document.createElement("div"),a=document.createElement("iframe"),t=document.createElement("form"),r=document.createElement("input"),n={type:"hidden",id:"cardinal_collection_form_input",name:"JWT"},i={height:"43px",name:"collectionIframe"},s={id:"cardinal_collection_form",action:Oe,method:"POST",target:"collectionIframe"};o.assignKeyValuesForIframe(r,n),o.assignKeyValuesForIframe(a,i),o.assignKeyValuesForIframe(t,s),a.style.cssText="display: none;",e.appendChild(a),e.appendChild(t),t.appendChild(r),document.body.appendChild(e)},o.assignKeyValuesForIframe=function(e,a){for(var t in a)e.setAttribute(t,a[t])}}function updateBillingAddress(e){return{require:"form",link:function(a,t,o){var r=e(o.formOnChange);t.on("change",function(){r(a)})}}}function totalRoomDetail(){return{restrict:"E",templateUrl:"./total/totalRoomDetail.html",replace:"true"}}function totalRoomDetailMrb(e,a,t,o){return{restrict:"E",templateUrl:"./total/totalRoomDetailMrb.html",replace:"true",link:function(e,a,t){e.reservation=e.$eval(t.reservation),e.index=e.$eval(t.index),e.toggleRoomSummary=function(a){o.eventTrack("ClickRoomReservationDetails",{category:"UserNavigation",label:a.roomStays[0].roomRates[0].roomTypeCode}),"true"===e.breakDown?a.totalRoomData.roomsData[0].breakDownNightsCollapse=!a.totalRoomData.roomsData[0].breakDownNightsCollapse:a.totalRoomData.roomsData[0].nightsCollapse=!a.totalRoomData.roomsData[0].nightsCollapse}}}}function totalReservation(e,a,t,o,r,n,s,l,c,d,g,m){return{restrict:"E",templateUrl:"./total/total.reservation.html",replace:"true",link:function(m,u,p){setTimeout(function(){var e=document.getElementById("your-reservation-title");e&&!m.showPromotionQualify&&(e.focus(),l.scrollTopAnimated(0,0))}),m.isFinalConfirmation=p.isFinalConfirmation,m.breakDown=p.breakDown,m.isUpdatedResDataRequired=!0,"true"===m.isFinalConfirmation||e.getTaxBreakDownFinalConfirmation()?m.isFinalConfirmation=!0:m.isFinalConfirmation=!1,m.enableSchedPkgInclusions=t.getHotelDesc().enableSchedPkgInclusions,m.$root.MRB&&(m.finalMultiRoomReservation=e.getMainReservationArray()[0]);var y=m.isFinalConfirmation?m.isSelectedCurrencyMerchandised?"currencyConversionWithTwoDecimalPlaces":m.fixedMerchandiseCurrency?"currencyConversionWithTwoDecimalPlaces":"defaultCurrencySymbol":"currencyConversionWithTwoDecimalPlaces";m.getFormattedDatePrices=function(){"true"===m.breakDown&&(m.isUpdatedResDataRequired=!1,m.totalData=e.getFormattedDataForTaxBreakdown()),"true"!=m.breakDown&&m.isUpdatedResDataRequired&&(m.totalData=e.getFormattedReservationData(y),m.isUpdatedResDataRequired=!1),m.roomDetailClick=function(){s.eventTrack("ClickRoomReservationDetails",{category:"UserNavigation",label:e.getMainReservation().roomStays[0].roomRates[0].roomTypeCode})};var a,t=e.getFixedMerchandisedCurrency();t&&("defaultCurrencySymbol"==y?a=!1:"currencyConversionWithTwoDecimalPlaces"==y&&(a=t)),m.totalData.formattedSubtotalExcludeDiscount=o(y)(m.totalData.subtotalExcludeDiscount,a),m.totalData.formattedSubtotal=o(y)(m.totalData.subtotal,a),m.totalData.formattedTaxes=o(y)(m.totalData.taxes,a),m.totalData.formattedResortFees=o(y)(m.totalData.resortFees,a),m.totalData.formattedServiceCharge=o(y)(m.totalData.serviceCharge,a),m.totalData.formattedTotal=o(y)(m.totalData.total,a),angular.forEach(m.totalData.roomsData,function(e,t){e.formattedTotalRoomPrice=o(y)(e.totalRoomPrice,a),angular.forEach(e.datesOfStay,function(e){e.formattedDate=o("formatServicesDate")(e.date),e.formattedPrice=o(y)(e.price,a)})}),angular.forEach(m.totalData.packageInclusions,function(e,t){angular.forEach(e.daysArray,function(e){e.formattedDate=o("formatServicesDate")(e.date),e.formattedPrice=o(y)(e.price,a)})}),angular.forEach(m.totalData.enhancements,function(e,t){e.formattedServiceTotalPrice=o(y)(e.serviceTotalPrice,a),angular.forEach(e.daysArray,function(e){e.formattedDate=o("formatServicesDate")(e.date),e.formattedPrice=o(y)(e.price,a)})}),(!c.MRB||c.MRB&&e.getMainReservationArray()&&1==e.getMainReservationArray().length)&&setTimeout(function(){var a,t=document.getElementById("formatted-reservation-total-id"),o=angular.copy(e.getMainReservation());o&&o.roomStays&&o.roomStays.length>0&&o.roomStays[0].total&&(a=parseFloat(o.roomStays[0].total.amountAfterTax)/1);if(t&&a){var r=t.innerHTML;!d.is("total")||g.getBurnPoints()||0==a||null==r.match("^[^1-9]+$")&&r.match("^(?!.*undefined).*$")||c.$broadcast("UNKNOWN_APPLICATION_ERROR",{applicationReset:!1,eventLabel:"AngularDigestException"})}},3e3)};var v=function(){m.finalReservation=angular.copy(e.getMainReservation()),m.finalReservation.resGlobalInfo.timeSpan.start=moment.utc(m.finalReservation.resGlobalInfo.timeSpan.start).format("MMM DD,YYYY"),m.finalReservation.resGlobalInfo.timeSpan.end=moment.utc(m.finalReservation.resGlobalInfo.timeSpan.end).format("MMM DD,YYYY")};if(m.addSpecialRequestToReservation=function(){if(m.isFinalConfirmation)m.totalData.selectedSpecialRequests=[],angular.forEach(m.finalReservation.services,function(e,a){"SERVICE_REQUEST"===e.serviceCategory&&m.totalData.selectedSpecialRequests.push(e)});else{m.totalData.specialRequest=[];var t="";void 0!=e.getLanguage()&&(t+="lang="+e.getLanguage()),void 0!=m.totalData.guestCounts.adults&&(t+="&adults="+m.totalData.guestCounts.adults),void 0!=m.totalData.guestCounts.children&&0!=m.totalData.guestCounts.children&&(t+="&children="+m.totalData.guestCounts.children),void 0!=m.totalData.guestCounts.infants&&0!=m.totalData.guestCounts.infants&&(t+="&infants="+m.totalData.guestCounts.infants),void 0!=m.totalData.roomCount&&(t+="&rooms="+m.totalData.roomCount),void 0!=m.totalData.dateIn&&(t+="&dateIn="+m.totalData.dateIn),void 0!=m.totalData.dateOut&&(t+="&dateOut="+m.totalData.dateOut),void 0!=m.totalData.ratePlanCode&&(t+="&ratePlanCode="+m.totalData.ratePlanCode),void 0!=m.totalData.ratePlanType&&(t+="&ratePlanType="+m.totalData.ratePlanType),void 0!=m.totalData.roomTypeCode&&(t+="&roomTypeCode="+m.totalData.roomTypeCode),t+="&";var o={hotelCode:m.totalData.hotelCode,queryString:t},n=e.buildOptions();if(void 0!=n.allCodes&&Object.keys(n.allCodes).length>0)for(i=0;i<Object.keys(n.allCodes).length;i++){if("travelagent"===Object.keys(n.allCodes)[i].toLowerCase()){var s=n.allCodes.TravelAgent?n.allCodes.TravelAgent:n.allCodes.travelagent;o.queryString+="taCode="+s+"&"}if("discount"===Object.keys(n.allCodes)[i].toLowerCase()){var l=n.allCodes.Discount?n.allCodes.Discount:n.allCodes.discount;o.queryString+="discountCode="+l+"&"}if("corporate"===Object.keys(n.allCodes)[i].toLowerCase()){var c=n.allCodes.Corporate?n.allCodes.Corporate:n.allCodes.corporate;o.queryString+="corpCode="+c+"&"}if("group"===Object.keys(n.allCodes)[i].toLowerCase()){var d=n.allCodes.Group?n.allCodes.Group:n.allCodes.group;o.queryString+="groupCode="+d+"&"}}var g;void 0!=n.allCodes&&(g=Object.keys(n.allCodes).find(function(e){return"travelagent"===e.toLowerCase()})),void 0==n.taCode||n.allCodes&&void 0!=g||(o.queryString+="taCode="+n.taCode+"&");var u;void 0!=n.allCodes&&(u=Object.keys(n.allCodes).find(function(e){return"discount"===e.toLowerCase()})),void 0==n.Discount||n.allCodes&&void 0!=u||(o.queryString+="discountCode="+n.Discount+"&");var p;void 0!=n.allCodes&&(p=Object.keys(n.allCodes).find(function(e){return"corporate"===e.toLowerCase()})),void 0==n.Corporate||n.allCodes&&void 0!=p||(o.queryString+="corpCode="+n.Corporate+"&");var y;void 0!=n.allCodes&&(y=Object.keys(n.allCodes).find(function(e){return"group"===e.toLowerCase()})),void 0==n.groupCode||n.allCodes&&void 0!=y||(o.queryString+="groupCode="+n.groupCode+"&"),a.getSpecialServices(o).then(function(e){var a=1,t=!0;angular.forEach(e,function(e,o){t&&(a>4&&(t=!1),"SERVICE_REQUEST"===e.serviceCategory&&(angular.forEach(m.totalData.selectedSpecialRequests,function(a){e.serviceTypeId==a.serviceTypeId&&(e.selectedRequest=a.serviceOptions[0])}),m.totalData.specialRequest.push(e),a++))}),v(),r.setUserTiming("PageLoad","Payment")})}},m.isFinalConfirmation){v();var h=m.finalReservation.resGlobalInfo.guaranteesAccepted[0].paymentCard.cardCode;h&&(m.finalReservation.resGlobalInfo.guaranteesAccepted[0].paymentCard.capitalizeCardCode=h.charAt(0).toUpperCase()+h.substr(1).toLowerCase())}"true"!==m.breakDown&&(!m.$root.MRB||m.$root.MRB&&1==m.mainReservationArray.length)&&m.totalData.specialRequestForm&&m.addSpecialRequestToReservation(),m.$on(n.LANG_CHANGE,m.getFormattedDatePrices),m.getFormattedDatePrices()}}}function packageInclusionDetail(e){return{restrict:"E",templateUrl:"./total/packageInclusionDetail.html",replace:"true",link:function(a,t,o){a.isEnahancements=o.isEnahancements,"false"===a.isEnahancements?a.isEnahancements=!1:a.isEnahancements=!0,a.isOnTotalPage="total"==e.current.name}}}function totalGuestInfo(){return{restrict:"E",templateUrl:"./total/total.guestInfo.html",replace:"true"}}function totalPaymentMethod(){return{restrict:"E",templateUrl:"./total/total.paymentMethod.html",replace:"true"}}function customPositionBookNow(e,a,t,o){return{restrict:"A",replace:"true",link:function(r,n,i){var s;r.$watch(function(){var t=o.MRB?100:200;s=e[0].querySelector(".Footer-wrap").getBoundingClientRect().top-a.innerHeight+a.pageYOffset-t}),n[0].classList.add("Checkout-submit"),e.on("scroll",function(){a.innerWidth<991&&t.includes("total")&&(e.scrollTop()<s?n[0].classList.add("Checkout-submit"):n[0].classList.remove("Checkout-submit"))})}}}function ofacModalPopup(){return{restrict:"E",templateUrl:"./total/ofacmodel.html",replace:"true",scope:{togglePopup:"=",submitData:"=",ofacInputData:"=",sucessCallback:"&"},controller:["$scope","reservationService","$rootScope","$element","accessibilityService",function(e,a,t,o,r){e.submitted=!1,e.guest=[],e.autoAddressStatus=[],e.reservationArray=[],e.ofacDetails={visitPurpose:"",guestDetails:{}},t.MRB?e.reservationArray=angular.copy(a.getMainReservationArray()):e.reservationArray.push(angular.copy(a.getMainReservation())),e.oncontinue=function(){if(e.submitted=!0,e.OFACDetailsForm.$valid)e.submitData=e.ofacDetails,e.togglePopup=!1,e.sucessCallback&&setTimeout(function(){e.sucessCallback()},0),setTimeout(function(){r.onModalClose()},0);else{var a=o.find("form");if(a.length){var t=a[0].querySelector(".ng-invalid");t&&t.focus()}}},e.closepopup=function(){e.submitted=!1,e.autoAddressStatus=[],e.clearData(),e.togglePopup=!1,setTimeout(function(){r.onModalClose()},0)},e.clearData=function(){e.ofacDetails.visitPurpose="";for(var a=e.reservationArray,t=0;t<a.length;t++)for(var o=a[t].uniqueId,r=e.ofacDetails.guestDetails[o],n=0;n<r.length;n++)r[n].firstName="",r[n].lastName="",r[n].address=""},e.setBookingAddress=function(a,t,o){var r;r=1===e.ofacInputData.addressList.length?e.ofacInputData.addressList[0]:e.ofacInputData.addressList[a];var n=e.autoAddressStatus[t][o];e.ofacDetails.guestDetails[t][o].address=n?r:""},e.getGuestCollection=function(e){return new Array(parseInt(e,10))},e.ofacInputData.ofacClose=e.closepopup}]}}function mycheckWalletInit(e,a,t,o,r){return{restrict:"E",replace:"true",scope:{refreshAndPublishableKey:"=",alternatePaymentOptions:"=",amountWallet:"=",currencyDetail:"="},link:function(e,n,s){var l=o.getHotelDesc().enable3DSv1PaymentProcessing;l?n[0].setAttribute("id","mywalletSdk"):n[0].setAttribute("id","mycheck-wallet-v3");var c=[];if(a.enabledMyCheckButton=!1,e.alternatePaymentOptions.length>1)for(i=0;i<e.alternatePaymentOptions.length;i++)"altpayment-mycheck"==e.alternatePaymentOptions[i].vendorKey&&e.alternatePaymentOptions[i].displayName&&c.push(e.alternatePaymentOptions[i].displayName.toLowerCase());l?mycheckWallet.init("mywalletSdk",{publishableKey:e.refreshAndPublishableKey.publishableKey,refreshToken:e.refreshAndPublishableKey.refreshToken,local:"en",acceptedAlternativeWallets:c,checkoutPage:!0,events:{after3DsComplete:function(a){e.$emit("EVENT.MYCHECK_AFTER3DSCOMPLETE_DATA",a)},onReady:function(){a.enabledMyCheckButton=!0},onInitFailure:function(e){t.clear(),t.pop({type:"error",title:"",body:a.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})}}}):(mycheck.auth.connect({publishableKey:e.refreshAndPublishableKey.publishableKey,refreshToken:e.refreshAndPublishableKey.refreshToken}),mycheck.wallet.init({settings:{locale:"en",view:"CHECKOUT",acceptedPaymentMethods:c},payment_details:{currency:e.currencyDetail.currencyCode,amount:e.amountWallet},events:{after3DsComplete:function(a){e.$emit("EVENT.MYCHECK_AFTER3DSCOMPLETE_DATA",a)},onReady:function(){a.enabledMyCheckButton=!0},onInitFailure:function(e){t.clear(),t.pop({type:"error",title:"",body:a.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})}}}),mycheck.wallet.on("ready",function(){if(0==c.length){var e=document.querySelector("div[data-test-id='credit-card-section'] > .CreditCards_divider__3PNWo");e&&(e.style.display="none")}}),mycheck.wallet.on("paymentCompleted",function(o){"SUCCESS"==o.status&&e.$emit("EVENT.MYCHECK_AFTER3DSCOMPLETE_DATA",o),"FAILURE"==o.status&&(t.clear(),t.pop({type:"error",title:"",body:a.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg}))}),mycheck.wallet.on("checkoutReady",function(e,t){const o={data:t,status:e};r.setMyCheckV2CardDetails(o),a.enabledMyCheckButton=!!e}))}}}function roundedTo(){return function(e,a){if(isNaN(e))return e;for(var t=1,o=0;o<Number(a);o++)t*=10;return Math.round(e*t)/t}}function adultsReservationFilter(){return function(e){return 1===e?e+" Adult":e+" Adults"}}function childrenReservationFilter(){return function(e){return 1===e?e+" Child":e+" Children"}}function infantsReservationFilter(){return function(e){return 1===e?e+" Infant":e+" Infants"}}function nightsFilterLowercase(e){return function(a){return console.log(a),a>1?a+"  "+e.translate.global_nights_NightsLowerCaseLbl:a+" "+e.translate.global_night_NightLowerCaseLbl}}function adultsFilterLowercase(e,a,t){return function(t){return t>1?e.translate.global_adults_AdultsLowerCaseLbl.match(/#/g)?a("replaceHash")(e.translate.global_adults_AdultsLowerCaseLbl,t):t+" "+e.translate.global_adults_AdultsLowerCaseLbl:e.translate.global_adult_AdultLowerCaseLbl.match(/1/g)?e.translate.global_adult_AdultLowerCaseLbl:t+" "+e.translate.global_adult_AdultLowerCaseLbl}}function childrenFilterLowercase(e,a,t){return function(t){return t>1?e.translate.global_children_ChildrenLowerCaseLbl.match(/#/g)?a("replaceHash")(e.translate.global_children_ChildrenLowerCaseLbl,t):t+" "+e.translate.global_children_ChildrenLowerCaseLbl:e.translate.global_child_ChildLowerCaseLbl.match(/1/g)?e.translate.global_child_ChildLowerCaseLbl:t+" "+e.translate.global_child_ChildLowerCaseLbl}}function infantsFilterLowercase(e,a,t){return function(t){return t>1?e.translate.global_infants_InfantsLowerCaseLbl.match(/#/g)?a("replaceHash")(e.translate.global_infants_InfantsLowerCaseLbl,t):t+" "+e.translate.global_infants_InfantsLowerCaseLbl:e.translate.global_infant_InfantLowerCaseLbl.match(/1/g)?e.translate.global_infant_InfantLowerCaseLbl:t+" "+e.translate.global_infant_InfantLowerCaseLbl}}function roomsFilterLowercase(e,a,t){return function(t){return t>1?e.translate.global_rooms_RoomsLowerCaseLbl.match(/#/g)?a("replaceHash")(e.translate.global_rooms_RoomsLowerCaseLbl,t):t+" "+e.translate.global_rooms_RoomsLowerCaseLbl:e.translate.global_room_RoomLowerCaseLbl.match(/1/g)?e.translate.global_room_RoomLowerCaseLbl:t+" "+e.translate.global_room_RoomLowerCaseLbl}}angular.module("TravelClApp",["ngSanitize","ui.bootstrap","ui.router","ngAnimate","toaster","duScroll","angular-cache","credit-cards","angulartics","angulartics.google.analytics","uiGmapgoogle-maps","angulartics.google.tagmanager","ngTouch","angular-jwt","angular-storage","ngCookies","ngAria","datetime"]),angular.module("TravelClApp").run(["$rootScope","$state","$stateParams","$http","CacheFactory","$document","$window",function(e,a,t,o,r,n,i){return e.ACCESSIBILITY_SPACE=32,e.ACCESSIBILITY_ENTER=13,e.ACCESSIBILITY_UP_ARROW=38,e.ACCESSIBILITY_DOWN_ARROW=40,e.ACCESSIBILITY_TAB=9,e.$state=a,e.bgHideSpinner=!0,e.$on("$stateChangeStart",function(e,a){a.name&&(a.name.includes("accommodation")?i.dataLayer.push({"pageSubsection ":"be_accommodation"}):a.name.includes("guestsandrooms")?i.dataLayer.push({"pageSubsection ":"be_guest_and_rooms"}):a.name.includes("datesofstay")?i.dataLayer.push({"pageSubsection ":"be_datesofstay"}):a.name.includes("total")?i.dataLayer.push({"pageSubsection ":"be_total"}):a.name.includes("confirmation")&&i.dataLayer.push({"pageSubsection ":"be_confirmation"}))}),e.$on("$stateChangeSuccess",function(){n.scrollTopAnimated(0,0)}),o.defaults.cache=r("defaultCache",{maxAge:3e5,cacheFlushInterval:18e5,deleteOnExpire:"aggressive"}),e.$stateParams=t}]).config(["datetimePlaceholder","$stateProvider","$urlRouterProvider","$locationProvider","$uiViewScrollProvider","$analyticsProvider","$httpProvider","$provide","$logProvider","GMS_EVENTS",function(e,a,t,o,r,n,i,s,l,c){function d(){return angular.element(document.documentElement).injector()}angular.extend(e,{year:"YYYY",month:"MM",date:"DD"});var g="true"===window.logEnabled;l.debugEnabled(g),s.decorator("$exceptionHandler",["$delegate","$analytics",function(e,a){return function(t,o){e(t,o);var r={};r.appId="BE4.0",r.appName="BE4.0",r.appVersion="1.0",r.fatal=!1,r.description=t.stack,a.exceptionTrack(r)}}]),n.settings.ga.additionalAccountNames=["additionalTracker"],n.registerPageTrack(function(e){if("/confirmation"===e){var a=d().get("reservationService"),t=a.getMainReservation(),o=d().get("MyUsageTrackingService"),r={eventType:"COMPLETED_PAGE",label:{}},n={};if(void 0!=a.getMainReservationArray()&&a.getMainReservationArray().length>0)for(var i,s=0;s<a.getMainReservationArray().length;s++)i=void 0==i?a.getMainReservationArray()[s].uniqueId:i+","+a.getMainReservationArray()[s].uniqueId,n.webReservationId=i;else t.uniqueId&&(n.webReservationId=t.uniqueId);"0"==t.resGuests[0].profile.shareAllMarketInd?n.tcgmsOptIn="1":n.tcgmsOptIn="0",r.label=n,o.trackPage(r)}}),n.registerEventTrack(function(e,a){var t=d().get("MyUsageTrackingService");if(e&&"AltPayRedirection"!==e){var o,r=d().get("reservationService"),n=d().get("gmsService"),i=r.resFromCache(),s=r.getMainReservation(),l=(r.curFromCache(),r.getExtendHoldReservation()),g=n.getGmsProfile();if(void 0!=r.getMainReservationArray()&&r.getMainReservationArray().length>0)for(var m=0;m<r.getMainReservationArray().length;m++)if(r.getMainReservationArray()[m].id==r.getMainReservation().id){o=m,o++;break}if(c[e]){if("NO_PARAM"!==c[e]&&"SPECIAL_CASE"!==c[e]){var u={eventType:e,category:a.category},p={};p[c[e]]=a.label,void 0!=o&&(p.roomSeqNo=o),u.label=p}else if("SPECIAL_CASE"==c[e])if("ClickRoomBook"==e||"ClickAddRoomCheckout"==e){var u={eventType:e,category:a.category,label:a.label},p={};if(void 0!=o&&(p.roomSeqNo=o),s.roomStays[0].ratePlans[0]&&s.roomStays[0].ratePlans[0].ratePlanCode&&(p.rateCode=s.roomStays[0].ratePlans[0].ratePlanCode),s.roomStays[0].roomRates[0]&&s.roomStays[0].roomRates[0].roomTypeName&&(p.roomCode=s.roomStays[0].roomRates[0].roomTypeName),s.roomStays[0].roomRates[0]&&s.roomStays[0].roomRates[0].roomTypeCode&&(p.currentRoom=s.roomStays[0].roomRates[0].roomTypeCode),s.resGlobalInfo.timeSpan.start&&(p.checkIn=s.resGlobalInfo.timeSpan.start),s.resGlobalInfo.timeSpan.end&&(p.checkOut=s.resGlobalInfo.timeSpan.end),s.roomStays[0].roomRates[0]&&s.roomStays[0].roomRates[0].numberOfUnits&&(p.numberOfRooms=s.roomStays[0].roomRates[0].numberOfUnits),void 0!=s.services&&s.services.length>0){p.serviceCode="";for(var m=0;m<s.services.length;m++)m==s.services.length-1?p.serviceCode+=s.services[m].serviceTypeId:p.serviceCode+=s.services[m].serviceTypeId+","}u.label=p}else{if("ExtendedHoldShown"==e||"ConfirmExtendedHoldShown"==e){var u={eventType:e,category:a.category,label:a.label},p={};return p.device=a.label,angular.equals(l,{})||l.resGuests[0].profile.customer.email&&(p.email=l.resGuests[0].profile.customer.email),void 0!=o&&(p.roomSeqNo=o),u.label=p,void t.trackEventPost(u)}if("SuccesfulSignIn/SignUp"==e||"SuccesfulSignUp"==e||"SuccesfulSignIn"==e){var u={eventType:e,category:a.category,label:a.label},p={};return"SuccesfulSignUp"==e||"SuccesfulSignIn"==e?p.loginType="GMS":"SuccesfulSignIn/SignUp"==e&&(p.loginType=a.label),angular.equals(g,{})||(g.profile.customer.email&&(p.email=g.profile.customer.email),g.profile.customer.specialOfferConsent&&(p.optIn=g.profile.customer.specialOfferConsent)),void 0!=o&&(p.roomSeqNo=o),u.label=p,void t.trackEventPost(u)}if("BannerClick"==e){if(""!=a.label)var y=JSON.parse(a.label);else y="";var u={eventType:e,category:a.category,label:y}}else if("ClickAddCode"==e){var u={eventType:e,category:a.category,label:a.label},v=a.label.split("--"),p={};p.codeType=v[0],p[v[0]]=v[1],void 0!=o&&(p.roomSeqNo=o),u.label=p}else{if("PostBooking"==e&&void 0!=i.uniqueId){var h=i.uniqueId,u={eventType:e,category:a.category,label:a.label},p={};return angular.equals(i.resGuests,{})||(i.resGuests[0].profile.customer.givenName&&(p.firstName=i.resGuests[0].profile.customer.givenName),i.resGuests[0].profile.customer.surName&&(p.lastName=i.resGuests[0].profile.customer.surName),i.resGuests[0].profile.customer.email&&(p.email=i.resGuests[0].profile.customer.email)),p.webReservationId=h,void 0!=o&&(p.roomSeqNo=o),u.label=p,void t.trackEventPost(u)}if("onLoadEvent"==e){if(""!=a.label){var y;y="object"!=typeof a.label?JSON.parse(a.label):a.label,console.log("object"+JSON.stringify(y))}else y="";var u={eventType:e,category:a.category,label:y}}}}}else{if("sendGuestDetails"==e){var u={eventType:e,category:a.category,label:a.label},p={};return p=a.label,u.label=p,void t.trackEventPost(u)}var u={eventType:e,category:a.category,label:a.label}}}else var u={eventType:e,category:a.category,label:a.label};t.trackEvent(u)}),r.useAnchorScroll(),t.otherwise("/guestsandrooms"),i.interceptors.push("APIInterceptor"),a.state("guestsandrooms",{url:"/guestsandrooms",templateUrl:"./guestsandrooms/guestsandrooms.html",controller:"GuestsAndRoomsController"}).state("datesofstay",{url:"/datesofstay",templateUrl:"./datesofstay/datesofstay.html",controller:"DatesOfStayController"}).state("accommodation",{url:"/accommodation",
templateUrl:"./accommodation/accommodation.html",controller:"AccommodationController"}).state("accommodation.room",{url:"/room",templateUrl:"./accommodation/room.html"}).state("accommodation.package",{url:"/package",templateUrl:"./accommodation/package.html"}).state("accommodation.inclusions",{url:"/inclusions",templateUrl:"./accommodation/inclusions.html"}).state("international",{url:"/international",templateUrl:"./international/international.html",controller:"InternationalController"}).state("total",{url:"/total",templateUrl:"./total/total.html",controller:"TotalController"}).state("confirmation",{url:"/confirmation",templateUrl:"./confirmation/confirmation.html",controller:"ConfirmationController"})}]),angular.module("TravelClApp").directive("applicationError",["$rootScope","$state","CacheFactory","$window","$analytics",applicationError]),angular.module("TravelClApp").controller("MainController",["$scope","reservationService","EVENT","$rootScope","hotelFactory","$analytics","$window","$location","navDataFactory","$log","apiFactory","toaster","gmsService","commonFactory","$state","GMS_LANDING_EVENT_MAP","$timeout","accessibilityService","loyaltyPointsService","lodash","$filter","voucherPaymentService","CacheFactory","menubarService","cookieConsentService","audienceEvaluatorService",function(e,a,t,o,r,n,i,s,l,c,d,g,m,u,p,y,v,h,R,f,C,P,S,A,I,b){function D(){try{if(b.isAudienceEvaluatorEnabled()&&!i.evaluatorResponse){var e=F&&F.chainInfo&&F.chainInfo.length?F.chainInfo[0]:"",a=b.getAudienceEvaluatorCriteria();d.callAudienceEvaluator(F.hotelCode,e,a).then(function(e){b.setAudienceLists(e.data),T()},function(e){console.log(e),T()})}else T()}catch(e){console.log(e),T()}}function T(){try{if(sessionStorage&&JSON.parse(sessionStorage.getItem("allPromotionsCache/"+F.hotelCode))){var e=JSON.parse(sessionStorage.getItem("allPromotionsCache/"+F.hotelCode));void 0!=e&&(allPromotions=e,o.$broadcast("PROMOTIONS_AVAILABLE_FROM_API"))}else{var t=F&&F.chainInfo&&F.chainInfo.length?"&chainCode="+F.chainInfo[0]:"";d.getAllPromotions(F.hotelCode,F.currentLanguage.languageCode,t,!1).then(function(e){allPromotions=e.data,sessionStorage&&(a.setPromotionsList(allPromotions),a.setDisplayPromotions(allPromotions)),o.$broadcast("PROMOTIONS_AVAILABLE_FROM_API"),G&&G.length>0&&allPromotions&&allPromotions.length>0&&!O(allPromotions,G)&&o.$broadcast("REMOVE_PROMOTIONS_AVAILABLE_FROM_API")},function(e){console.log(e)})}}catch(e){console.log(e)}}function O(e,t){var o=!1;return a.getPromotionDetailsInContext()?angular.forEach(e,function(e){angular.forEach(t,function(t){e.promotionId!=t.promotionId||!a.getPromotionDetailsInContext()||t.promotionId!=a.getPromotionDetailsInContext().promotionId||void 0==i.route||"GUEST_AND_ROOMS"!==i.route&&"CALENDAR"!==i.route||(o=!0)})}):o=!0,o}function E(e){var t=window.navigator.userAgent,i=(new Date).toUTCString(),s=r.getHotelInfo().hotelCode,l=e,c="";if(o.MRB){var d=a.getMainReservationArray();f.forEach(d,function(e){c=c+e.itineraryId+"-"+e.uniqueId+" || "})}else c=a.getMainReservation().uniqueId;var g="LOG :: Browser Info - "+t+" | Time Info - "+i+" | Hotel Id - "+s+" | Order Status - "+l+" | Order Id - "+c;n.eventTrack("3DSecureApplicationLogs",{category:"Be4ApplicationsLogs",label:g})}function M(e){e.indexOf("?")>-1&&(e=e.split("?")[1]);var a=e.split("&"),t={};return a.forEach(function(e){e=e.split("="),t[e[0]]=decodeURIComponent(e[1]||"")}),t}function _(e){0!=o.recallAPIFromHTML5Geolocation&&(o.recallAPIFromHTML5Geolocation=!0),o.showPosition=!0,o.$broadcast(t.LANG_CHANGE),o.$broadcast("EVENT.RECALL_BASIC_AVAIL"),a.setHTML5Selected(!0),o.latitude=e.coords.latitude,o.longitude=e.coords.longitude,a.setLatitude(o.latitude),a.setLongitude(o.longitude),o.$apply()}function k(){navigator.geolocation?navigator.geolocation.getCurrentPosition(_,X):alert("Geolocation is not supported by this browser.")}function N(){r.getUxConfiguration().enabledGeolocationMessage?(o.showHTML5GeoLocationModal="display-block",setTimeout(function(){h.onModalOpen("guestsAndRoomsHeader","html5-geolocation-id","html5-geolocation-title-id",!0,e.closeHTML5GeoLocationModal)},3e3)):(void 0===o.GDPREnabled||void 0!==o.GDPREnabled&&!0===o.GDPREnabled)&&k()}function L(){if(void 0!=i.route&&"CALENDAR"===i.route)void 0!=i.multiRoomReservation&&(o.ManagerURLRes=angular.copy(i.multiRoomReservation),a.setMainReservationByEqual(angular.copy(o.ManagerURLRes)),a.assignIdForReservationArray(),a.assignIdForReservation(),a.setConfig("MULTIROOM_MANAGER"),a.setConfig("Manager_Url_MRB")),void 0!=a.getMainReservation().roomStays[0].ratePlans[0]&&"Package"==a.getMainReservation().roomStays[0].ratePlans[0].ratePlanType?(a.setConfig("SET_PACKAGE_PLACEHOLDER"),a.setConfig("SET_PACKAGE")):void 0!=a.getMainReservation().roomStays[0].roomRates[0].roomTypeCode&&(a.setConfig("SET_ACCOMMODATION_PLACEHOLDER"),a.setConfig("LOAD_ROOM_DETAIL")),void 0!=a.getMainReservation().currency&&a.setConfig("SET_CURRENCY"),s.path("/datesofstay");else if(void 0!=i.route&&"GUEST_AND_ROOMS"===i.route&&void 0==i.multiRoomReservation){if(c.debug(JSON.stringify(a.getMainReservation())+"get Mainreservation"),void 0!=a.getMainReservation().roomStays[0].ratePlans[0]&&"Package"==a.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&void 0!=a.getMainReservation().roomStays[0].roomRates[0].roomTypeCode?(void 0==l.stepsById.accommodations.package&&(l.stepsById.accommodations.package=[]),l.stepsById.accommodations.package.push(a.getMainReservation().roomStays[0].ratePlans[0]),Z||a.setConfig("LOAD_ROOM_DETAIL"),a.setConfig("SET_ACCOMMODATION_PLACEHOLDER")):void 0!=a.getMainReservation().roomStays[0].ratePlans[0]&&"Package"==a.getMainReservation().roomStays[0].ratePlans[0].ratePlanType?(a.setConfig("SET_PACKAGE_PLACEHOLDER"),a.setConfig("SET_PACKAGE")):void 0!=a.getMainReservation().roomStays[0].roomRates[0].roomTypeCode&&(a.setConfig("SET_ACCOMMODATION_PLACEHOLDER"),Z||a.setConfig("LOAD_ROOM_DETAIL")),void 0!=a.getMainReservation().currency&&a.setConfig("SET_CURRENCY"),void 0!=a.getMainReservation().posSource.requestorIds){var y=a.getMainReservation().posSource.requestorIds;angular.forEach(y,function(e){if("group"==e.codeType.toLowerCase()){a.setConfig("GROUP_SPlASH"),m.disableGmsLoginForm();void 0!=a.getMainReservation().resGlobalInfo.guestCounts[1]?s.path("/guestsandrooms"):(void 0!=a.getMainReservation().roomStays[0].roomRates[0].roomTypeCode&&(a.setConfig("SET_ACCOMMODATION_PLACEHOLDER"),Z||a.setConfig("LOAD_ROOM_DETAIL")),s.path("/datesofstay"))}})}oe(),s.path("/guestsandrooms"),l.navToggle.datesSelected=!0}else if(void 0!=i.route&&"ACCOMMODATIONS"===i.route)void 0!=i.multiRoomReservation&&(o.enabelRoomSelector=!0,o.ManagerURLRes=angular.copy(i.multiRoomReservation),a.setMainReservationByEqual(angular.copy(o.ManagerURLRes)),a.assignIdForReservationArray(),a.assignIdForReservation(),a.setConfig("Manager_Url_MRB"),a.setConfig("MULTIROOM_MANAGER")),void 0!=a.getMainReservation().roomStays[0].ratePlans[0]&&"Package"==a.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&void 0!=a.getMainReservation().roomStays[0].roomRates[0].roomTypeCode?(void 0==l.stepsById.accommodations.package&&(l.stepsById.accommodations.package=[]),l.stepsById.accommodations.package.push(a.getMainReservation().roomStays[0].ratePlans[0]),a.setConfig("OPEN_ROOM_DETAIL"),a.setConfig("OPEN_ROOM_DETAIL_FOR_HTML5GEOLOCATION"),a.setConfig("SET_ACCOMMODATION_PLACEHOLDER")):void 0!=a.getMainReservation().roomStays[0].ratePlans[0]&&"Package"==a.getMainReservation().roomStays[0].ratePlans[0].ratePlanType?(a.setConfig("OPEN_PACKAGE_DETAIL"),a.setConfig("OPEN_PACKAGE_DETAILL_FOR_HTML5GEOLOCATION"),a.setConfig("SET_PACKAGE_PLACEHOLDER")):void 0!=a.getMainReservation().roomStays[0].roomRates[0].roomTypeCode&&void 0!=a.getMainReservation().roomStays[0].ratePlans[0]&&"Group"==a.getMainReservation().roomStays[0].ratePlans[0].ratePlanType?(a.setConfig("SET_GROUP_PLACEHOLDER"),a.setConfig("OPEN_ROOM_DETAIL")):void 0!=a.getMainReservation().roomStays[0].roomRates[0].roomTypeCode?(a.setConfig("OPEN_ROOM_DETAIL"),a.setConfig("OPEN_ROOM_DETAIL_FOR_HTML5GEOLOCATION"),a.setConfig("SET_ACCOMMODATION_PLACEHOLDER")):void 0!=a.getMainReservation().roomStays[0].ratePlans[0]&&"Group"==a.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&a.setConfig("SET_GROUP_PLACEHOLDER"),void 0!=a.getMainReservation().currency&&a.setConfig("SET_CURRENCY"),s.path("/accommodation/room");else if(void 0!=i.route&&"PACKAGE_DETAILS"===i.route){void 0!=i.multiRoomReservation&&(o.enabelRoomSelector=!0,o.ManagerURLRes=angular.copy(i.multiRoomReservation),a.setMainReservationByEqual(angular.copy(o.ManagerURLRes)),a.assignIdForReservationArray(),a.assignIdForReservation(),a.setConfig("MULTIROOM_MANAGER"),a.setConfig("Manager_Url_MRB"));var v=!1;void 0!=a.getMainReservation().roomStays[0].ratePlans[0]&&"Package"==a.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&void 0!=a.getMainReservation().roomStays[0].roomRates[0].roomTypeCode?(void 0==l.stepsById.accommodations.package&&(l.stepsById.accommodations.package=[]),l.stepsById.accommodations.package.push(a.getMainReservation().roomStays[0].ratePlans[0]),void 0!=i.multiRoomReservation&&a.setConfig("PACKAGE_IN_CONTEXT_MULTIROOM"),a.setConfig("OPEN_ROOM_DETAIL"),a.setConfig("OPEN_ROOM_DETAIL_FOR_HTML5GEOLOCATION"),a.setConfig("SET_ACCOMMODATION_PLACEHOLDER"),v=!0):void 0!=a.getMainReservation().roomStays[0].ratePlans[0]&&"Package"==a.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&(a.setConfig("OPEN_PACKAGE_DETAIL"),a.setConfig("OPEN_PACKAGE_DETAIL_FOR_HTML5GEOLOCATION"),a.setConfig("SET_PACKAGE_PLACEHOLDER")),void 0!=a.getMainReservation().currency&&a.setConfig("SET_CURRENCY"),1==v?s.path("/accommodation/room"):s.path("/accommodation/package")}else if(void 0!=i.route&&"GROUP_SPLASH"===i.route){void 0!=i.multiRoomReservation&&(o.ManagerURLRes=angular.copy(i.multiRoomReservation),a.setMainReservationByEqual(angular.copy(o.ManagerURLRes)),a.assignIdForReservationArray(),a.assignIdForReservation(),a.setConfig("MULTIROOM_MANAGER"),a.setConfig("Manager_URL_Group_Splash")),m.disableGmsLoginForm(),a.setConfig("GROUP_SPlASH");var h=a.getMainReservation().resGlobalInfo.guestCounts;void 0!=h[1]?s.path("/guestsandrooms"):(void 0!=a.getMainReservation().roomStays[0].roomRates[0].roomTypeCode&&(a.setConfig("SET_ACCOMMODATION_PLACEHOLDER"),a.setConfig("LOAD_ROOM_DETAIL")),s.path("/datesofstay"))}else if(void 0!=i.route&&"RETRIEVE_RESERVATION_POPUP"===i.route)m.disableGmsLoginForm(),a.setConfig("RETRIEVE_RESERVATION_POPUP"),s.path("/guestsandrooms");else if(void 0!=i.route&&"ALTERNATE_HOTEL_SPLASH"===i.route)void 0!=i.multiRoomReservation&&(o.ManagerURLRes=angular.copy(i.multiRoomReservation),a.setMainReservationByEqual(angular.copy(o.ManagerURLRes)),a.assignIdForReservationArray(),a.assignIdForReservation(),a.setConfig("MULTIROOM_MANAGER"),a.setConfig("Manager_Url_MRB")),m.disableGmsLoginForm(),void 0!=a.getMainReservation().currency&&a.setConfig("SET_CURRENCY"),a.setConfig("ALTERNATE_HOTEL_SPLASH"),s.path("/datesofstay");else if(void 0!=i.route&&"EXTENDED_HOLD_PAGE"===i.route)void 0!=i.multiRoomReservation&&(o.ManagerURLRes=angular.copy(i.multiRoomReservation),a.setMainReservationByEqual(angular.copy(o.ManagerURLRes)),a.assignIdForReservationArray(),a.assignIdForReservation(),a.setConfig("MULTIROOM_MANAGER"),a.setConfig("Manager_Url_MRB")),m.disableGmsLoginForm(),void 0!=a.getMainReservation().currency&&a.setConfig("SET_CURRENCY"),a.setConfig("EXTENDED_HOLD_PAGE"),void 0==a.getMainReservation().ebhResStatus?s.path("/guestandroom"):s.path("/datesofstay");else if(void 0!=i.route&&"GMS_SOCIAL_LOGIN_SUCCESS"===i.route){void 0!=i.multiRoomReservation&&(void 0!=o.reservationArray&&o.reservationArray.length>0?o.ManagerURLRes=angular.copy(o.reservationArray):(o.ManagerURLRes=angular.copy(i.multiRoomReservation),a.setMainReservationByEqual(angular.copy(o.ManagerURLRes)),a.assignIdForReservationArray(),a.assignIdForReservation()),a.setConfig("MULTIROOM_MANAGER"),a.setConfig("Manager_Url_MRB"));var f=a.getGmsProfile();if(void 0==f){var P=a.resFromCache();a.setReservation(P);var S=P.languageCode,A=r.getCurrentLanguages().languageCode;if(S!=A&&r.getTranslations(x.hotelCode,S,o),""!=i.gmsToken&&""!=i.userName){var I=r.getHotelInfo().hotelCode,b=a.getLanguage();b||(b=r.getCurrentLanguages().languageCode),r.getCRMLoyaltyV2Enable()?d.getGuestInfo(I,i.gmsToken,b).success(function(e){m.disableGmsLoginForm(),a.setGmsProfile(e),m.saveGmsProfile(e),n.eventTrack("SuccesfulSignIn/SignUp",{category:"UserNavigation",label:i.gmsSocialPlatform}),o.$broadcast(t.GMS_LOGIN_SUCCESS)}).error(function(e){n.eventTrack("UnsuccesfulSignIn/SignUp",{category:"UserNavigation",label:i.gmsSocialPlatform}),o.isGmsSocialLoginError=!0,o.$broadcast(t.GMS_SOCIAL_LOGIN_ERROR)}):d.validateGmsOuthToken(x.hotelCode,i.userName,i.gmsToken).success(function(e){m.disableGmsLoginForm(),a.setGmsProfile(e),m.saveGmsProfile(e),n.eventTrack("SuccesfulSignIn/SignUp",{category:"UserNavigation",label:i.gmsSocialPlatform}),o.$broadcast(t.GMS_LOGIN_SUCCESS)}).error(function(e){n.eventTrack("UnsuccesfulSignIn/SignUp",{category:"UserNavigation",label:i.gmsSocialPlatform}),o.isGmsSocialLoginError=!0,o.$broadcast(t.GMS_SOCIAL_LOGIN_ERROR)})}else n.eventTrack("UnsuccesfulSignIn/SignUp",{category:"UserNavigation",label:i.gmsSocialPlatform}),o.isGmsSocialLoginError=!0,i.errormessage.indexOf("An email has been sent to")>-1?o.$broadcast(t.GMS_SOCIAL_ACCOUNT_ERROR):o.$broadcast(t.GMS_SOCIAL_LOGIN_ERROR);var D=a.getGmsRouteCache();D?(D.indexOf("accomodation")>-1&&(l.navToggle.accommodationSelected=!0),D.indexOf("total")>-1&&(l.navToggle.accommodationSelected=!0,l.navToggle.totalSelected=!0),s.path("/"+D)):s.path("/guestsandrooms"),setTimeout(function(){o.$broadcast(t.UPDATE_NAV_FOR_GMS)},3e3)}else s.path("/guestsandrooms")}else if(void 0!=i.route&&"NAVBAR_SOCIAL_LOGIN_SUCCESS"===i.route){void 0!=i.multiRoomReservation&&(void 0!=o.reservationArray&&o.reservationArray.length>0?o.ManagerURLRes=angular.copy(o.reservationArray):(o.ManagerURLRes=angular.copy(i.multiRoomReservation),a.setMainReservationByEqual(angular.copy(o.ManagerURLRes)),a.assignIdForReservationArray(),a.assignIdForReservation()),a.setConfig("MULTIROOM_MANAGER"),a.setConfig("Manager_Url_MRB"));var P=a.resFromCache();a.setReservation(P);var S=P.languageCode,A=r.getCurrentLanguages().languageCode;S!=A&&r.getTranslations(x.hotelCode,S,o);try{var T=sessionStorage.getItem("applicationRoute/"+x.hotelCode);T?(T.indexOf("accomodation")>-1?l.navToggle.accommodationSelected=!0:T.indexOf("total")>-1&&(l.navToggle.accommodationSelected=!0,l.navToggle.totalSelected=!0),s.path(T)):s.path("/guestsandrooms")}catch(e){s.path("/guestsandrooms")}setTimeout(function(){o.$broadcast(t.UPDATE_NAV_FOR_GMS)},3e3)}else if(void 0!=i.route&&"ALTERNATE_PAYMENT_RESPONSE"===i.route){if(void 0!=i.alternatPayment){var O;if(o.gmsPromoCode)O=o.gmsPromoCode;else{var M=a.getGmsProfile();M&&M.loyalty&&M.loyalty.length>0&&M.loyalty[0].memberOfferCode&&(O=M.loyalty[0].memberOfferCode)}m.disableGmsLoginForm(),void 0==o.MRB&&(o.MRB=r.getHotelDesc().enableMultiRoomTypeBookings&&!a.getMainReservation().isModifiable),o.MRB&&a.getCurrency()&&-1!=B.indexOf(a.getCurrency())?a.disabledMultiRoomBehavior():o.MRB&&!a.getCurrency()&&a.getCurrencyDetails()&&a.getCurrencyDetails().currencyCode&&-1!=B.indexOf(a.getCurrencyDetails().currencyCode)&&a.disabledMultiRoomBehavior();var P=o.MRB?a.getMainReservationArray()[0]:a.resFromCache();a.setReservation(P);var S=P.languageCode,A=r.getCurrentLanguages().languageCode;S!=A&&r.getTranslations(x.hotelCode,S,o);var _=i.altPayResParamLst,k=i.alternatPayment;if(void 0!=k)if("paypal"===k.type){if("Success"===k.status)if(o.showPaymentProcessingModal="display-block",P.resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst=_,void 0==P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId&&void 0==P.resGlobalInfo.guaranteesAccepted[0].vendorKey&&(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="4",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-ogone"),c.debug(JSON.stringify(P)+"resFromCache"),s.path("/total"),U)O&&a.addGmsRateAccessCodeInReservation(P),d.callModifyReservation(x.hotelCode,P).success(function(e){var r=window.manageUrlParams.ccid;a.logGAEvents(r,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(e),O&&a.removeRateAccessCodeInReservation(e,P),a.setReservation(e),a.setConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),c.debug(JSON.stringify(e)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,o.showPaymentProcessingModal="display-none",p.go("confirmation")}).error(function(t){a.deleteConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),s.path("/total"),e.clearOnFocus=!1;var r,n,i=t.errors?t.errors:void 0;i&&(r=i[0].errorCode,n=i[0].errorMessage),V.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):Y.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))});else{if(o.MRB){for(var N=angular.copy(a.getMainReservationArray()),L=0;L<N.length;L++)N[L].resGlobalInfo.guaranteesAccepted=angular.copy(P.resGlobalInfo.guaranteesAccepted),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest&&(N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!1),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&(N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption=[]),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&(N[L].resGlobalInfo.guaranteesAccepted[0].voucherRedemption={});if(N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption[0].pointsValue&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption.redemptionQuantity&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),!r.getHotelDesc().enable3DSv1PaymentProcessing&&r.getCybersource3DSV2Enabled()){var G=N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[0],F=N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[1];F.paramKey="TransactionId",N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[0]=F,N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[1]=G}P=angular.copy(N)}O&&a.addGmsRateAccessCodeInReservation(P),d.callReservation(x.hotelCode,P,o.MRB).success(function(r){var n=window.manageUrlParams.ccid;if(a.logGAEvents(n,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(r),O&&(o.MRB?a.removeRateAccessCodeInReservation(r.reservationResponses,P):a.removeRateAccessCodeInReservation(r,P)),o.MRB){o.showPaymentProcessingModal="display-none";var i=a.validateMultiRoomCommitResponse(r.reservationResponses);if(0==i.isError)a.setMrbItineraryTotals(r.itineraryTotals),a.setMrbItineraryPaymentInfo(r.itineraryPaymentInfo),a.setMainReservationByEqual(r.reservationResponses),o.arrivedConfirmation=!0,s.path("/confirmation");else{e.clearOnFocus=!1;var d,m,u=i.errorInfo?i.errorInfo:void 0;u&&(d=u.errorCode,m=u.errorMessage),q.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):Y.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))}}else a.setReservation(r),c.debug(JSON.stringify(r)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,o.showPaymentProcessingModal="display-none",s.path("/confirmation")}).error(function(t){o.MRB&&a.revertGuaranteesAcceptedObject(),o.showPaymentProcessingModal="display-none",s.path("/total"),e.clearOnFocus=!1;var r,n,i=t.errors?t.errors:void 0;i&&(r=i[0].errorCode,n=i[0].errorMessage),V.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):Y.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))})}if("Cancelled"===k.status||"Declined"===k.status||"Exception"===k.status){o.MRB&&a.revertGuaranteesAcceptedObject(),a.setConfig("PAYPAL_CANCEL");var P=a.getMainReservation();a.setConfig("PAYPAL_CANCEL_LANGUAGE"),u.setObjectData("paypalCancelModalFlag",!0),s.path("/total")}}else if("ideal"===k.type){if(window.iDealLogs){var w=window.navigator.userAgent,H=(new Date).toUTCString(),W=r.getHotelInfo().hotelCode,K="callingCommit || "+k.status,J=window.manageUrlParams.amount,Q=window.manageUrlParams.orderid,X=a.getIdealLocalStorageStatus(),ee=a.getOrderIdInCacheIdealTracking();J||(J=ee.amount),Q||(Q=ee.orderId);var ae="LOG :: Browser Info - "+w+" | Time Info - "+H+" | Hotel Id - "+W+" | Order Status - "+K+" | Order Id - "+Q+" | Amount - "+J+" | Local Storage Status - "+X;n.eventTrack("idealApplicationLogs",{category:"Be4ApplicationsLogs",label:ae})}if("Success"===k.status||"Exception"===k.status)if(o.showPaymentProcessingModal="display-block",P.resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst=_,void 0==P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId&&void 0==P.resGlobalInfo.guaranteesAccepted[0].vendorKey&&(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="3",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-ogone"),c.debug(JSON.stringify(P)+"resFromCache"),s.path("/total"),U)O&&a.addGmsRateAccessCodeInReservation(P),d.callModifyReservation(x.hotelCode,P).success(function(e){var r=window.manageUrlParams.ccid;a.logGAEvents(r,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(e),O&&a.removeRateAccessCodeInReservation(e,P),a.setReservation(e),a.setConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),c.debug(JSON.stringify(e)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,o.showPaymentProcessingModal="display-none",p.go("confirmation")}).error(function(t){a.deleteConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),s.path("/total"),e.clearOnFocus=!1;var r,n,i=t.errors?t.errors:void 0;i&&(r=i[0].errorCode,n=i[0].errorMessage),V.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):Y.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))});else{if(o.MRB){for(var N=angular.copy(a.getMainReservationArray()),L=0;L<N.length;L++)N[L].resGlobalInfo.guaranteesAccepted=angular.copy(P.resGlobalInfo.guaranteesAccepted),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest&&(N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!1),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&(N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption=[]),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&(N[L].resGlobalInfo.guaranteesAccepted[0].voucherRedemption={});if(N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption[0].pointsValue&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption.redemptionQuantity&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),!r.getHotelDesc().enable3DSv1PaymentProcessing&&r.getCybersource3DSV2Enabled()){var G=N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[0],F=N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[1];F.paramKey="TransactionId",N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[0]=F,N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[1]=G}P=angular.copy(N)}O&&a.addGmsRateAccessCodeInReservation(P),d.callReservation(x.hotelCode,P,o.MRB).success(function(r){var n=window.manageUrlParams.ccid;if(a.logGAEvents(n,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(r),O&&(o.MRB?a.removeRateAccessCodeInReservation(r.reservationResponses,P):a.removeRateAccessCodeInReservation(r,P)),o.MRB){o.showPaymentProcessingModal="display-none";var i=a.validateMultiRoomCommitResponse(r.reservationResponses);if(0==i.isError)a.setMrbItineraryTotals(r.itineraryTotals),a.setMrbItineraryPaymentInfo(r.itineraryPaymentInfo),a.setMainReservationByEqual(r.reservationResponses),o.arrivedConfirmation=!0,s.path("/confirmation");else{e.clearOnFocus=!1;var d,m,u=i.errorInfo?i.errorInfo:void 0;u&&(d=u.errorCode,m=u.errorMessage),q.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):Y.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))}}else a.setReservation(r),c.debug(JSON.stringify(r)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,o.showPaymentProcessingModal="display-none",s.path("/confirmation")}).error(function(t){o.MRB&&a.revertGuaranteesAcceptedObject(),o.showPaymentProcessingModal="display-none",s.path("/total"),e.clearOnFocus=!1;var r,n,i=t.errors?t.errors:void 0;i&&(r=i[0].errorCode,n=i[0].errorMessage),V.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):Y.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))})}if("Cancelled"===k.status||"Declined"===k.status){o.MRB&&a.revertGuaranteesAcceptedObject(),a.setConfig("IDEAL_CANCEL");var P=a.getMainReservation();a.setConfig("IDEAL_CANCEL_LANGUAGE"),u.setObjectData("idealCancelModalFlag",!0),s.path("/total")}}else if("3dsecure"===k.type){if(i._3DSecureLogs&&E("3DSecureRedirectBackToBE4"),o.showPaymentProcessingModal="display-block",!r.getHotelDesc().enable3DSv1PaymentProcessing&&r.getCybersource3DSV2Enabled()){for(var te=0;te<_.length;te++){const re=_[te];if("transactionid"==re.paramKey.toLowerCase()){var ne=te;re.paramKey="TransactionId"}}_[ne];const ie=_.slice(ne,ne+1);_.splice(ne,ne),_.unshift(ie[0])}P.resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst=_;var se=r.getPaymentProviders();if(void 0==P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId&&void 0==P.resGlobalInfo.guaranteesAccepted[0].vendorKey){P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="2";var le=C("filter")(se,{paymentMethod:2},!0);!r.getHotelDesc().enable3DSv1PaymentProcessing&&r.getCybersource3DSV2Enabled()?P.resGlobalInfo.guaranteesAccepted[0].vendorKey="3DSecureV2-cybersource":P.resGlobalInfo.guaranteesAccepted[0].vendorKey=le[0].vendorKey}if(c.debug(JSON.stringify(P)+"resFromCache"),s.path("/total"),U)O&&a.addGmsRateAccessCodeInReservation(P),i._3DSecureLogs&&E("3DSecureCallingModifyCommit"),d.callModifyReservation(x.hotelCode,P).success(function(e){var r=window.manageUrlParams.ccid;a.logGAEvents(r,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(e),i._3DSecureLogs&&E("3DSecureModifyCommitSuccess"),O&&a.removeRateAccessCodeInReservation(e,P),a.setReservation(e),a.setConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),c.debug(JSON.stringify(e)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,
o.showPaymentProcessingModal="display-none",p.go("confirmation")}).error(function(t){i._3DSecureLogs&&E("3DSecureModifyCommitError - "+JSON.stringify(t.errors));var r=a.getMainReservation();void 0!=r.resGlobalInfo.guaranteesAccepted[0].paymentCard&&(r.resGlobalInfo.guaranteesAccepted[0].paymentCard={}),void 0!=r.resGlobalInfo.guaranteesAccepted[0].alternatePayment&&(r.resGlobalInfo.guaranteesAccepted[0].alternatePayment={}),a.setReservation(r),a.deleteConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),o.$broadcast("3D_SECURE_CANCEL"),e.clearOnFocus=!1,o.showPaymentProcessingModal="display-none",a.setConfig("SECURE_3D_CANCEL"),a.getMainReservation(),a.setConfig("SECURE_3D_CANCEL_LANGUAGE");var n,s,l=t.errors?t.errors:void 0;l&&(n=l[0].errorCode,s=l[0].errorMessage),V.indexOf(n)>-1&&void 0!=n?(o.roomUnavailableMsg=s,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(n)>-1&&void 0!=n?(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):j.indexOf(n)>-1&&void 0!=n?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):q.indexOf(n)>-1&&void 0!=n?(o.roomUnavailableMsg=s,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):Y.indexOf(n)>-1&&void 0!=n?(o.roomUnavailableMsg=s,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))});else{if(o.MRB){for(var N=angular.copy(a.getMainReservationArray()),L=0;L<N.length;L++)N[L].resGlobalInfo.guaranteesAccepted=angular.copy(P.resGlobalInfo.guaranteesAccepted),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest&&(N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!1),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&(N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption=[]),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&(N[L].resGlobalInfo.guaranteesAccepted[0].voucherRedemption={});N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption[0].pointsValue&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption.redemptionQuantity&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),P=angular.copy(N)}O&&a.addGmsRateAccessCodeInReservation(P),i._3DSecureLogs&&E("3DSecureCallingCommit"),d.callReservation(x.hotelCode,P,o.MRB).success(function(r){var n=window.manageUrlParams.ccid;if(a.logGAEvents(n,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(r),O&&(o.MRB?a.removeRateAccessCodeInReservation(r.reservationResponses,P):a.removeRateAccessCodeInReservation(r,P)),o.MRB){o.showPaymentProcessingModal="display-none";var d=a.validateMultiRoomCommitResponse(r.reservationResponses);if(0==d.isError)i._3DSecureLogs&&E("3DSecureCommitSuccess"),a.setMrbItineraryTotals(r.itineraryTotals),a.setMrbItineraryPaymentInfo(r.itineraryPaymentInfo),a.setMainReservationByEqual(r.reservationResponses),o.arrivedConfirmation=!0,s.path("/confirmation");else{i._3DSecureLogs&&E("3DSecureCommitError - "+JSON.stringify(d.errorInfo)),o.$broadcast("3D_SECURE_CANCEL"),e.clearOnFocus=!1,o.showPaymentProcessingModal="display-none",a.setConfig("SECURE_3D_CANCEL"),a.setConfig("SECURE_3D_CANCEL_LANGUAGE");var m,u,p=d.errorInfo?d.errorInfo:void 0;p&&(m=p.errorCode,u=p.errorMessage),j.indexOf(m)>-1&&void 0!=m?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):q.indexOf(m)>-1&&void 0!=m?(o.roomUnavailableMsg=u,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):Y.indexOf(m)>-1&&void 0!=m?(o.roomUnavailableMsg=u,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))}}else i._3DSecureLogs&&E("3DSecureCommitSuccess"),a.setReservation(r),c.debug(JSON.stringify(r)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,o.showPaymentProcessingModal="display-none",s.path("/confirmation")}).error(function(t){i._3DSecureLogs&&E("3DSecureCommitError - "+JSON.stringify(t.errors)),o.MRB&&a.revertGuaranteesAcceptedObject(),o.showPaymentProcessingModal="display-none";var r=a.getMainReservation();void 0!=r.resGlobalInfo.guaranteesAccepted[0].paymentCard&&(r.resGlobalInfo.guaranteesAccepted[0].paymentCard={}),void 0!=r.resGlobalInfo.guaranteesAccepted[0].alternatePayment&&(r.resGlobalInfo.guaranteesAccepted[0].alternatePayment={}),a.setReservation(r),o.$broadcast("3D_SECURE_CANCEL"),e.clearOnFocus=!1,o.showPaymentProcessingModal="display-none",a.setConfig("SECURE_3D_CANCEL"),a.getMainReservation(),a.setConfig("SECURE_3D_CANCEL_LANGUAGE");var n,s,l=t.errors?t.errors:void 0;l&&(n=l[0].errorCode,s=l[0].errorMessage),V.indexOf(n)>-1&&void 0!=n?(o.roomUnavailableMsg=s,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(n)>-1&&void 0!=n?(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):j.indexOf(n)>-1&&void 0!=n?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):q.indexOf(n)>-1&&void 0!=n?(o.roomUnavailableMsg=s,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):Y.indexOf(n)>-1&&void 0!=n?(o.roomUnavailableMsg=s,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))})}}else if("ingenico"===k.type)if(o.showPaymentProcessingModal="display-block",P.resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst=_,void 0==P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId&&void 0==P.resGlobalInfo.guaranteesAccepted[0].vendorKey&&(1==a.getIngenicoAlternatePayment()?(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="5",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-ingenico"):(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-ingenico")),c.debug(JSON.stringify(P)+"resFromCache"),s.path("/total"),U)O&&a.addGmsRateAccessCodeInReservation(P),d.callModifyReservation(x.hotelCode,P).success(function(e){var r=window.manageUrlParams.ccid;a.logGAEvents(r,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(e),O&&a.removeRateAccessCodeInReservation(e,P),a.setReservation(e),a.setConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),c.debug(JSON.stringify(e)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,o.showPaymentProcessingModal="display-none",p.go("confirmation")}).error(function(t){a.deleteConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),o.showPaymentProcessingModal="display-none",s.path("/total"),e.clearOnFocus=!1;var r,n,i=t.errors?t.errors:void 0;i&&(r=i[0].errorCode,n=i[0].errorMessage),V.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):j.indexOf(r)>-1&&void 0!=r?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))});else{if(o.MRB){for(var N=angular.copy(a.getMainReservationArray()),L=0;L<N.length;L++)N[L].resGlobalInfo.guaranteesAccepted=angular.copy(P.resGlobalInfo.guaranteesAccepted),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest&&(N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!1),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&(N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption=[]),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&(N[L].resGlobalInfo.guaranteesAccepted[0].voucherRedemption={});if(N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption[0].pointsValue&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption.redemptionQuantity&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),!r.getHotelDesc().enable3DSv1PaymentProcessing&&r.getCybersource3DSV2Enabled()){var G=N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[0],F=N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[1];F.paramKey="TransactionId",N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[0]=F,N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[1]=G}P=angular.copy(N)}O&&a.addGmsRateAccessCodeInReservation(P),d.callReservation(x.hotelCode,P,o.MRB).success(function(r){var n=window.manageUrlParams.ccid;if(a.logGAEvents(n,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(r),O&&(o.MRB?a.removeRateAccessCodeInReservation(r.reservationResponses,P):a.removeRateAccessCodeInReservation(r,P)),o.MRB){o.showPaymentProcessingModal="display-none";var i=a.validateMultiRoomCommitResponse(r.reservationResponses);if(0==i.isError)a.setMrbItineraryTotals(r.itineraryTotals),a.setMrbItineraryPaymentInfo(r.itineraryPaymentInfo),a.setMainReservationByEqual(r.reservationResponses),o.arrivedConfirmation=!0,s.path("/confirmation");else{e.clearOnFocus=!1;var d,m,u=i.errorInfo?i.errorInfo:void 0;u&&(d=u.errorCode,m=u.errorMessage),V.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):j.indexOf(d)>-1&&void 0!=d?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))}}else a.setReservation(r),c.debug(JSON.stringify(r)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,o.showPaymentProcessingModal="display-none",s.path("/confirmation")}).error(function(t){o.MRB&&a.revertGuaranteesAcceptedObject(),o.showPaymentProcessingModal="display-none",s.path("/total"),e.clearOnFocus=!1;var r,n,i=t.errors?t.errors:void 0;i&&(r=i[0].errorCode,n=i[0].errorMessage),V.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):j.indexOf(r)>-1&&void 0!=r?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))})}else if("paymentexpress"===k.type)if(o.showPaymentProcessingModal="display-block",P.resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst=_,void 0==P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId&&void 0==P.resGlobalInfo.guaranteesAccepted[0].vendorKey&&(1==a.getPaymentExpressAlternatePayment()?(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="8",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-paymentexpress"):(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-paymentexpress")),c.debug(JSON.stringify(P)+"resFromCache"),s.path("/total"),U)O&&a.addGmsRateAccessCodeInReservation(P),d.callModifyReservation(x.hotelCode,P).success(function(e){var r=window.manageUrlParams.ccid;a.logGAEvents(r,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(e),O&&a.removeRateAccessCodeInReservation(e,P),a.setReservation(e),a.setConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),c.debug(JSON.stringify(e)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,o.showPaymentProcessingModal="display-none",p.go("confirmation")}).error(function(t){a.deleteConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),o.showPaymentProcessingModal="display-none",s.path("/total"),e.clearOnFocus=!1;var r,n,i=t.errors?t.errors:void 0;i&&(r=i[0].errorCode,n=i[0].errorMessage),V.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):j.indexOf(r)>-1&&void 0!=r?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))});else{if(o.MRB){for(var N=angular.copy(a.getMainReservationArray()),L=0;L<N.length;L++)N[L].resGlobalInfo.guaranteesAccepted=angular.copy(P.resGlobalInfo.guaranteesAccepted),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest&&(N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!1),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&(N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption=[]),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&(N[L].resGlobalInfo.guaranteesAccepted[0].voucherRedemption={});if(N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption[0].pointsValue&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption.redemptionQuantity&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),!r.getHotelDesc().enable3DSv1PaymentProcessing&&r.getCybersource3DSV2Enabled()){var G=N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[0],F=N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[1];F.paramKey="TransactionId",N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[0]=F,N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[1]=G}P=angular.copy(N)}O&&a.addGmsRateAccessCodeInReservation(P),d.callReservation(x.hotelCode,P,o.MRB).success(function(r){var n=window.manageUrlParams.ccid;if(a.logGAEvents(n,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(r),O&&(o.MRB?a.removeRateAccessCodeInReservation(r.reservationResponses,P):a.removeRateAccessCodeInReservation(r,P)),o.MRB){o.showPaymentProcessingModal="display-none";var i=a.validateMultiRoomCommitResponse(r.reservationResponses);if(0==i.isError)a.setMrbItineraryTotals(r.itineraryTotals),a.setMrbItineraryPaymentInfo(r.itineraryPaymentInfo),a.setMainReservationByEqual(r.reservationResponses),o.arrivedConfirmation=!0,s.path("/confirmation");else{e.clearOnFocus=!1;var d,m,u=i.errorInfo?i.errorInfo:void 0;u&&(d=u.errorCode,m=u.errorMessage),V.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):j.indexOf(d)>-1&&void 0!=d?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))}}else a.setReservation(r),c.debug(JSON.stringify(r)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,o.showPaymentProcessingModal="display-none",s.path("/confirmation")}).error(function(t){o.MRB&&a.revertGuaranteesAcceptedObject(),o.showPaymentProcessingModal="display-none",s.path("/total"),e.clearOnFocus=!1;var r,n,i=t.errors?t.errors:void 0;i&&(r=i[0].errorCode,n=i[0].errorMessage),V.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):j.indexOf(r)>-1&&void 0!=r?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))})}else if("reddot"===k.type){if(o.MRB)var Q=P.resGlobalInfo.guaranteesAccepted[0].alternatePayment.order_id;else var Q=P.resGlobalInfo.guaranteesAccepted[0].alternatePayment.order_id;if(o.showPaymentProcessingModal="display-block",P.resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst=_,void 0==P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId&&void 0==P.resGlobalInfo.guaranteesAccepted[0].vendorKey&&(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="7",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="allpayment-reddot"),void 0!=P.resGlobalInfo.guaranteesAccepted[0].alternatePayment&&void 0!=P.resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst&&P.resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst.length>0&&P.resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst.push({paramKey:"order_id",paramValue:Q}),c.debug(JSON.stringify(P)+"resFromCache"),s.path("/total"),U)O&&a.addGmsRateAccessCodeInReservation(P),d.callModifyReservation(x.hotelCode,P).success(function(e){var r=window.manageUrlParams.ccid;a.logGAEvents(r,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(e),O&&a.removeRateAccessCodeInReservation(e,P),a.setReservation(e),a.setConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),c.debug(JSON.stringify(e)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,o.showPaymentProcessingModal="display-none",p.go("confirmation")}).error(function(t){a.deleteConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),o.showPaymentProcessingModal="display-none",s.path("/total"),e.clearOnFocus=!1;var r,n,i=t.errors?t.errors:void 0;i&&(r=i[0].errorCode,n=i[0].errorMessage),z.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):V.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):j.indexOf(r)>-1&&void 0!=r?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))});else{if(o.MRB){for(var N=angular.copy(a.getMainReservationArray()),L=0;L<N.length;L++)N[L].resGlobalInfo.guaranteesAccepted=angular.copy(P.resGlobalInfo.guaranteesAccepted),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest&&(N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!1),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&(N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption=[]),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&(N[L].resGlobalInfo.guaranteesAccepted[0].voucherRedemption={});if(N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption[0].pointsValue&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption.redemptionQuantity&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),!r.getHotelDesc().enable3DSv1PaymentProcessing&&r.getCybersource3DSV2Enabled()){var G=N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[0],F=N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[1];F.paramKey="TransactionId",N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[0]=F,N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[1]=G}P=angular.copy(N)}O&&a.addGmsRateAccessCodeInReservation(P),d.callReservation(x.hotelCode,P,o.MRB).success(function(r){var n=window.manageUrlParams.ccid;if(a.logGAEvents(n,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(r),O&&(o.MRB?a.removeRateAccessCodeInReservation(r.reservationResponses,P):a.removeRateAccessCodeInReservation(r,P)),o.MRB){o.showPaymentProcessingModal="display-none";var i=a.validateMultiRoomCommitResponse(r.reservationResponses);if(0==i.isError)a.setMrbItineraryTotals(r.itineraryTotals),a.setMrbItineraryPaymentInfo(r.itineraryPaymentInfo),a.setMainReservationByEqual(r.reservationResponses),o.arrivedConfirmation=!0,s.path("/confirmation");else{e.clearOnFocus=!1;var d,m,u=i.errorInfo?i.errorInfo:void 0;u&&(d=u.errorCode,m=u.errorMessage),z.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):V.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):j.indexOf(d)>-1&&void 0!=d?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))}}else a.setReservation(r),c.debug(JSON.stringify(r)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,o.showPaymentProcessingModal="display-none",s.path("/confirmation")}).error(function(t){o.MRB&&a.revertGuaranteesAcceptedObject(),o.showPaymentProcessingModal="display-none",s.path("/total"),e.clearOnFocus=!1;var r,n,i=t.errors?t.errors:void 0;i&&(r=i[0].errorCode,n=i[0].errorMessage),z.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):V.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):j.indexOf(r)>-1&&void 0!=r?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))})}}else if("nets"===k.type)if(o.showPaymentProcessingModal="display-block",P.resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst=_,void 0==P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId&&void 0==P.resGlobalInfo.guaranteesAccepted[0].vendorKey&&(1==a.getNetsAlternatePayment()?(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="9",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-nets"):(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-nets")),c.debug(JSON.stringify(P)+"resFromCache"),s.path("/total"),U)O&&a.addGmsRateAccessCodeInReservation(P),d.callModifyReservation(x.hotelCode,P).success(function(e){var r=window.manageUrlParams.ccid;a.logGAEvents(r,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(e),O&&a.removeRateAccessCodeInReservation(e,P),a.setReservation(e),a.setConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),
c.debug(JSON.stringify(e)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,o.showPaymentProcessingModal="display-none",p.go("confirmation")}).error(function(t){a.deleteConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),o.showPaymentProcessingModal="display-none",s.path("/total"),e.clearOnFocus=!1;var r,n,i=t.errors?t.errors:void 0;i&&(r=i[0].errorCode,n=i[0].errorMessage),V.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):j.indexOf(r)>-1&&void 0!=r?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))});else{if(o.MRB){for(var N=angular.copy(a.getMainReservationArray()),L=0;L<N.length;L++)N[L].resGlobalInfo.guaranteesAccepted=angular.copy(P.resGlobalInfo.guaranteesAccepted),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest&&(N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!1),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&(N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption=[]),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&(N[L].resGlobalInfo.guaranteesAccepted[0].voucherRedemption={});if(N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption[0].pointsValue&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption.redemptionQuantity&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),!r.getHotelDesc().enable3DSv1PaymentProcessing&&r.getCybersource3DSV2Enabled()){var G=N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[0],F=N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[1];F.paramKey="TransactionId",N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[0]=F,N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[1]=G}P=angular.copy(N)}O&&a.addGmsRateAccessCodeInReservation(P),d.callReservation(x.hotelCode,P,o.MRB).success(function(r){var n=window.manageUrlParams.ccid;if(a.logGAEvents(n,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(r),O&&(o.MRB?a.removeRateAccessCodeInReservation(r.reservationResponses,P):a.removeRateAccessCodeInReservation(r,P)),o.MRB){o.showPaymentProcessingModal="display-none";var i=a.validateMultiRoomCommitResponse(r.reservationResponses);if(0==i.isError)a.setMrbItineraryTotals(r.itineraryTotals),a.setMrbItineraryPaymentInfo(r.itineraryPaymentInfo),a.setMainReservationByEqual(r.reservationResponses),o.arrivedConfirmation=!0,s.path("/confirmation");else{e.clearOnFocus=!1;var d,m,u=i.errorInfo?i.errorInfo:void 0;u&&(d=u.errorCode,m=u.errorMessage),V.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):j.indexOf(d)>-1&&void 0!=d?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))}}else a.setReservation(r),c.debug(JSON.stringify(r)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,o.showPaymentProcessingModal="display-none",s.path("/confirmation")}).error(function(t){o.MRB&&a.revertGuaranteesAcceptedObject(),o.showPaymentProcessingModal="display-none",s.path("/total"),e.clearOnFocus=!1;var r,n,i=t.errors?t.errors:void 0;i&&(r=i[0].errorCode,n=i[0].errorMessage),V.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):j.indexOf(r)>-1&&void 0!=r?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))})}else if("xpay"===k.type)if(o.showPaymentProcessingModal="display-block",P.resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst=_,void 0==P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId&&void 0==P.resGlobalInfo.guaranteesAccepted[0].vendorKey&&("xpaypaypal"==a.getXpayAlternatePayment().alternatePayment?(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="4",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-xpay"):"xpayalipay"==a.getXpayAlternatePayment().alternatePayment?(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="12",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-xpay"):"xpaywechat"==a.getXpayAlternatePayment().alternatePayment?(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="13",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="altpayment-xpay"):"xpaycredit"==a.getXpayAlternatePayment().alternatePayment&&(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="1",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="creditcard-xpay")),c.debug(JSON.stringify(P)+"resFromCache"),s.path("/total"),U)O&&a.addGmsRateAccessCodeInReservation(P),d.callModifyReservation(x.hotelCode,P).success(function(e){var r=window.manageUrlParams.ccid;a.logGAEvents(r,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(e),O&&a.removeRateAccessCodeInReservation(e,P),a.setReservation(e),a.setConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),c.debug(JSON.stringify(e)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,o.showPaymentProcessingModal="display-none",p.go("confirmation")}).error(function(t){a.deleteConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),o.showPaymentProcessingModal="display-none",s.path("/total"),e.clearOnFocus=!1;var r,n,i=t.errors?t.errors:void 0;i&&(r=i[0].errorCode,n=i[0].errorMessage),V.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):j.indexOf(r)>-1&&void 0!=r?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))});else{if(o.MRB){for(var N=angular.copy(a.getMainReservationArray()),L=0;L<N.length;L++)N[L].resGlobalInfo.guaranteesAccepted=angular.copy(P.resGlobalInfo.guaranteesAccepted),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest&&(N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!1),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&(N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption=[]);if(N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption[0].pointsValue&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption.redemptionQuantity&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),!r.getHotelDesc().enable3DSv1PaymentProcessing&&r.getCybersource3DSV2Enabled()){var G=N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[0],F=N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[1];F.paramKey="TransactionId",N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[0]=F,N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[1]=G}P=angular.copy(N)}O&&a.addGmsRateAccessCodeInReservation(P),d.callReservation(x.hotelCode,P,o.MRB).success(function(r){var n=window.manageUrlParams.ccid;if(a.logGAEvents(n,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(r),O&&(o.MRB?a.removeRateAccessCodeInReservation(r.reservationResponses,P):a.removeRateAccessCodeInReservation(r,P)),o.MRB){o.showPaymentProcessingModal="display-none";var i=a.validateMultiRoomCommitResponse(r.reservationResponses);if(0==i.isError)a.setMrbItineraryTotals(r.itineraryTotals),a.setMrbItineraryPaymentInfo(r.itineraryPaymentInfo),a.setMainReservationByEqual(r.reservationResponses),o.arrivedConfirmation=!0,s.path("/confirmation");else{e.$broadcast("OnFailureManipulationComments"),e.clearOnFocus=!1;var d,m,u=i.errorInfo?i.errorInfo:void 0;u&&(d=u.errorCode,m=u.errorMessage),V.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):j.indexOf(d)>-1&&void 0!=d?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))}}else a.setReservation(r),c.debug(JSON.stringify(r)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,o.showPaymentProcessingModal="display-none",s.path("/confirmation")}).error(function(t){o.MRB&&a.revertGuaranteesAcceptedObject(),o.showPaymentProcessingModal="display-none",s.path("/total"),e.$broadcast("OnFailureManipulationComments"),e.clearOnFocus=!1;var r,n,i=t.errors?t.errors:void 0;i&&(r=i[0].errorCode,n=i[0].errorMessage),V.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):j.indexOf(r)>-1&&void 0!=r?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))})}else if("adyenhosting"===k.type)if(o.showPaymentProcessingModal="display-block",P.resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst=_,void 0==P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId&&void 0==P.resGlobalInfo.guaranteesAccepted[0].vendorKey&&("mbank"==a.getAdyenDotpayPayment().alternatePayment?(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="14",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"):"ipko"==a.getAdyenDotpayPayment().alternatePayment?(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="15",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"):"przelew24"==a.getAdyenDotpayPayment().alternatePayment?(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="16",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"):"ing"==a.getAdyenDotpayPayment().alternatePayment?(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="17",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"):"millennium"==a.getAdyenDotpayPayment().alternatePayment?(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="18",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"):"aliorbank"==a.getAdyenDotpayPayment().alternatePayment?(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="19",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"):"citihandlowy"==a.getAdyenDotpayPayment().alternatePayment?(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="20",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"):"rprzelew"==a.getAdyenDotpayPayment().alternatePayment?(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="21",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"):"eurobank"==a.getAdyenDotpayPayment().alternatePayment?(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="22",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen"):"blik"==a.getAdyenDotpayPayment().alternatePayment&&(P.resGlobalInfo.guaranteesAccepted[0].paymentMethodId="23",P.resGlobalInfo.guaranteesAccepted[0].vendorKey="hosting-adyen")),c.debug(JSON.stringify(P)+"resFromCache"),s.path("/total"),U)O&&a.addGmsRateAccessCodeInReservation(P),d.callModifyReservation(x.hotelCode,P).success(function(e){var r=window.manageUrlParams.ccid;a.logGAEvents(r,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(e),O&&a.removeRateAccessCodeInReservation(e,P),a.setReservation(e),a.setConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),c.debug(JSON.stringify(e)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,o.showPaymentProcessingModal="display-none",p.go("confirmation")}).error(function(t){a.deleteConfig("MODIFY_RESERVATION_FROM_FOOTER_LINK"),o.showPaymentProcessingModal="display-none",s.path("/total"),e.clearOnFocus=!1;var r,n,i=t.errors?t.errors:void 0;i&&(r=i[0].errorCode,n=i[0].errorMessage),V.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):j.indexOf(r)>-1&&void 0!=r?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))});else{if(o.MRB){for(var N=angular.copy(a.getMainReservationArray()),L=0;L<N.length;L++)N[L].resGlobalInfo.guaranteesAccepted=angular.copy(P.resGlobalInfo.guaranteesAccepted),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest&&(N[L].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!1),0!=L&&R.getIsLoyaltyReservationEnabled()&&N[L].resGlobalInfo&&N[L].resGlobalInfo.guaranteesAccepted&&N[L].resGlobalInfo.guaranteesAccepted.length>0&&N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&(N[L].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption=[]);if(N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].loyaltyRedemption[0].pointsValue&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),N[0].resGlobalInfo&&N[0].resGlobalInfo.guaranteesAccepted&&N[0].resGlobalInfo.guaranteesAccepted.length>0&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption&&N[0].resGlobalInfo.guaranteesAccepted[0].voucherRedemption.redemptionQuantity&&(N[0].resGlobalInfo.guaranteesAccepted[0].primaryBookingRequest=!0),!r.getHotelDesc().enable3DSv1PaymentProcessing&&r.getCybersource3DSV2Enabled()){var G=N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[0],F=N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[1];F.paramKey="TransactionId",N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[0]=F,N[0].resGlobalInfo.guaranteesAccepted[0].alternatePayment.altPayResParamLst[1]=G}P=angular.copy(N)}O&&a.addGmsRateAccessCodeInReservation(P),d.callReservation(x.hotelCode,P,o.MRB).success(function(r){var n=window.manageUrlParams.ccid;if(a.logGAEvents(n,t.AFTER_REDIRECT_COMMIT),a.handleXssVulnerabilities(r),O&&(o.MRB?a.removeRateAccessCodeInReservation(r.reservationResponses,P):a.removeRateAccessCodeInReservation(r,P)),o.MRB){o.showPaymentProcessingModal="display-none";var i=a.validateMultiRoomCommitResponse(r.reservationResponses);if(0==i.isError)a.setMrbItineraryTotals(r.itineraryTotals),a.setMrbItineraryPaymentInfo(r.itineraryPaymentInfo),a.setMainReservationByEqual(r.reservationResponses),o.arrivedConfirmation=!0,s.path("/confirmation");else{e.$broadcast("OnFailureManipulationComments"),e.clearOnFocus=!1;var d,m,u=i.errorInfo?i.errorInfo:void 0;u&&(d=u.errorCode,m=u.errorMessage),V.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):j.indexOf(d)>-1&&void 0!=d?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(d)>-1&&void 0!=d?(o.roomUnavailableMsg=m,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))}}else a.setReservation(r),c.debug(JSON.stringify(r)+"this is data in second API"),l.stepsById.total.placeholder=a.getTotalReservationAmount(),o.arrivedConfirmation=!0,o.showPaymentProcessingModal="display-none",s.path("/confirmation")}).error(function(t){o.MRB&&a.revertGuaranteesAcceptedObject(),o.showPaymentProcessingModal="display-none",s.path("/total"),e.$broadcast("OnFailureManipulationComments"),e.clearOnFocus=!1;var r,n,i=t.errors?t.errors:void 0;i&&(r=i[0].errorCode,n=i[0].errorMessage),V.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,p.go("accommodation.room"),g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg})):$.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,g.clear(),g.pop({type:"error",title:"",body:o.translate.page_ensurecorrectdetails_PaymentProcessingFailedMsg})):q.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardprocessingfailed_CreditCardProcessingFailedMsg})):j.indexOf(r)>-1&&void 0!=r?(g.clear(),g.pop({type:"error",title:"",body:o.translate.global_unabletoauthenticateyourcreditcard_PayerAuthfailureLbl})):Y.indexOf(r)>-1&&void 0!=r?(o.roomUnavailableMsg=n,e.clearOnFocus=!0,g.clear(),g.pop({type:"error",title:"",body:o.translate.global_creditcardcouldnotbeprocessed_CreditCardCouldNotBeProcessedMsg})):(g.clear(),g.pop({type:"error",title:"",body:o.translate.page_thisroomisnolongeravailable_ThisRoomIsNoLongerAvailableMsg}))})}}}else void 0!=i.route&&"GUEST_AND_ROOMS"===i.route&&void 0!=i.multiRoomReservation&&(void 0!=o.reservationArray&&o.reservationArray.length>0?o.ManagerURLRes=angular.copy(o.reservationArray):(o.ManagerURLRes=angular.copy(i.multiRoomReservation),a.setMainReservationByEqual(angular.copy(o.ManagerURLRes)),a.assignIdForReservationArray(),a.assignIdForReservation()),a.setConfig("MULTIROOM_MANAGER"),a.setConfig("Manager_Url_MRB"),c.debug(JSON.stringify(a.getMainReservation())+"get Mainreservation"),void 0!=a.getMainReservation().roomStays[0].ratePlans[0]&&"Package"==a.getMainReservation().roomStays[0].ratePlans[0].ratePlanType&&void 0!=a.getMainReservation().roomStays[0].roomRates[0].roomTypeCode?(void 0==l.stepsById.accommodations.package&&(l.stepsById.accommodations.package=[]),l.stepsById.accommodations.package.push(a.getMainReservation().roomStays[0].ratePlans[0]),a.setConfig("LOAD_ROOM_DETAIL"),a.setConfig("SET_ACCOMMODATION_PLACEHOLDER")):void 0!=a.getMainReservation().roomStays[0].ratePlans[0]&&"Package"==a.getMainReservation().roomStays[0].ratePlans[0].ratePlanType?(a.setConfig("SET_PACKAGE_PLACEHOLDER"),a.setConfig("SET_PACKAGE")):void 0!=a.getMainReservation().roomStays[0].roomRates[0].roomTypeCode&&(a.setConfig("SET_ACCOMMODATION_PLACEHOLDER"),a.setConfig("LOAD_ROOM_DETAIL")),void 0!=a.getMainReservation().currency&&a.setConfig("SET_CURRENCY"),oe(),s.path("/guestsandrooms"),l.navToggle.datesSelected=!0)}var G,F=r.getHotelDesc();D(),o.$on("RECALL_MERCHANDISING_API",function(){sessionStorage&&JSON.parse(sessionStorage.getItem("allPromotionsCache/"+F.hotelCode))&&(G=angular.copy(allPromotions),sessionStorage.removeItem("allPromotionsCache/"+F.hotelCode),allPromotions=void 0,a.setDisplayPromotions(!1)),T()});var B=r.getRatePlanMerchandisedCurrencies();o.hideCodeWidget=window.hideCodeWidget,1!=a.getCosmoHideCodeWidget()||"ALTERNATE_PAYMENT_RESPONSE"!==i.route&&"GMS_SOCIAL_LOGIN_SUCCESS"!==i.route&&"NAVBAR_SOCIAL_LOGIN_SUCCESS"!==i.route||(o.hideCodeWidget=a.getCosmoHideCodeWidget()),a.setCosmoHideCodeWidget(o.hideCodeWidget),a.setZeroDollarExceptionFlag(!1),1==i.isFromAreaSearch&&n.eventTrack("bookingEngineClickThrough",{category:"UserNavigation",label:"bookingEngineClickThrough"}),o.switchRoom="display-none",o.maxRoom=r.getHotelDesc().maxMultiRoomLimit,1==i.flagForChina&&(o.flagForChina=!0),o.showPaymentProcessingModal="display-none";var x=r.getHotelInfo(),w=r.getUxConfiguration(),U=(r.getCalConfigInfo(),a.canModifyReservation()),H=function(e,a){var t="";if(i.getComputedStyle)t=getComputedStyle(e).getPropertyValue(a);else if(e.currentStyle)try{t=e.currentStyle[a]}catch(e){}return t}(i.document.body,"font-family");H.indexOf(",")<0&&i.document.body.style.setProperty("font-family",H+",Roboto, sans-serif ","important");var V=["INVALID_ROOM_ID","BOOKCHK_NO_ROOMS_STAYDATES","BOOKCHK_NO_ROOMS_STAYDATES_RATEPLAN","BOOKCHK_NO_GENERAL_INVENTORY","BOOKCHK_NO_ROOMTYPE_LEVEL_INVENTORY","BOOKCHK_NO_PRODUCT_LEVEL_INVENTORY","BOOKCHK_NO_PROPERTY_LEVEL_INVENTORY","BOOK_NEW_NO_LONGER_AVAILABLE"],$=["PAYMENT_STATUS_UNKNOWN","ALT_PAYMENT_PROCESSING_FAILED"],q=["CREDIT_CARD_NUMBER_NOT_VALID","CREDIT_CARD_EXPIRED","CREDIT_CARD_EXPIRY_MISSING_OR_FORMAT_NOT_VALID","CREDIT_CARD_HOLDER_NAME_REQUIRED","CREDIT_CARD_INFO_INCOMPLETE","PAYMENT_PROCESS_FAILED"],Y=["CREDIT_CARD_PROCESSING_FAILURE","CREDIT_CARD_NOT_ACTIVE_FOR_HOTEL","CREDIT_CARD_TYPE_NOT_VALID","CREDIT_CARD_TYPE_REQUIRED"],j=["PAYMENT_PROCESS_FAILED","PAYER_CARD_NOT_AUTHORIZED","REQUEST_NOT_FOUND","PAYER_SESSION_INIT_FAIL","CREDIT_CARD_NUMBER_NOT_VALID"],z=["PAYER_SESSION_INIT_FAIL","PAYMENT_PROCESS_FAILED"];i.location.search&&v(function(){if(void 0==i.multiRoomReservation){var e=M(i.location.search.split("?")[1]);if(e){if(angular.isObject(e)){for(var a in e)if(e.hasOwnProperty(a)){var t=a.toLowerCase();if(void 0!=y[t])if("nights"!=y[t]&&"length"!=y[t]||void 0!=e.dateout||void 0!=e.checkOut)e[y[t]]=e[a],y[t]!=a&&delete e[a];else{if(void 0!=e.datein){if(void 0!=e.datein.toLowerCase())var o=new Date(e.datein)}else if(void 0!=e.checkIn&&void 0!=e.checkIn.toLowerCase())var o=new Date(e.checkIn);o.setDate(o.getDate()+parseInt(e.nights||e.length));var r=moment(o).format("MM/DD/YYYY");e.checkOut=r,e.length&&delete e.length,e.nights&&delete e.nights}}e=JSON.stringify(e),console.log(e),n.eventTrack("onLoadEvent",{category:"UserNavigation",label:e})}}}else for(var s=0;s<i.multiRoomReservation.length;s++){var l,c={},d=void 0,g=void 0,m=void 0,u=void 0,p=void 0;l=s+1;for(var v=0;v<i.multiRoomReservation[s].resGlobalInfo.guestCounts.length;v++)"10"==i.multiRoomReservation[s].resGlobalInfo.guestCounts[v].ageQualifyingCode?void 0==d?d=parseInt(angular.copy(i.multiRoomReservation[s].resGlobalInfo.guestCounts[v].count)):d+=parseInt(angular.copy(i.multiRoomReservation[s].resGlobalInfo.guestCounts[v].count)):"8"==i.multiRoomReservation[s].resGlobalInfo.guestCounts[v].ageQualifyingCode&&(void 0==g?g=parseInt(angular.copy(i.multiRoomReservation[s].resGlobalInfo.guestCounts[v].count)):g+=parseInt(angular.copy(i.multiRoomReservation[s].resGlobalInfo.guestCounts[v].count)),void 0!=i.multiRoomReservation[s].resGlobalInfo.guestCounts[v].age&&(m=void 0==m?i.multiRoomReservation[s].resGlobalInfo.guestCounts[v].age:m+","+i.multiRoomReservation[s].resGlobalInfo.guestCounts[v].age)),void 0!=i.multiRoomReservation[s].resGlobalInfo.timeSpan.start&&(u=angular.copy(i.multiRoomReservation[s].resGlobalInfo.timeSpan.start)),void 0!=i.multiRoomReservation[s].resGlobalInfo.timeSpan.end&&(p=angular.copy(i.multiRoomReservation[s].resGlobalInfo.timeSpan.end));void 0!=g&&(c.children=g),void 0!=d&&(c.adults=d),void 0!=m&&(c.childrenAge=m),void 0!=u&&(c.checkIn=u),void 0!=p&&(c.checkOut=p),c.roomSeqNo=l,c.numberOfRooms=i.multiRoomReservation.length,JSON.stringify(c),n.eventTrack("onLoadEvent",{category:"UserNavigation",label:c})}},2e3);var W,K,J=new MobileDetect(window.navigator.userAgent);J.tablet()?K=!0:J.mobile()||J.phone()?K=!0:(K=!1,o.flagForDeskTop=!0);var Q=r.getUxConfiguration().enabledGeolocationPopUp;o.showHTML5GeoLocationModal="display-none",o.showDefaultGeoLocationModal="display-none";var X=function(e,n){a.setHTML5Selected(!1),u.setCookie("html5Geolocation"+r.getHotelInfo().hotelCode,"false",1440),W=void 0,L(),o.$broadcast(t.HTML_CLICK_YES),o.showDefaultGeoLocationModal="display-none",o.$apply()};e.getLocation=function(){u.setCookie("html5Geolocation"+r.getHotelInfo().hotelCode,"true",1440),o.showHTML5GeoLocationModal="display-none",h.onModalClose(),k()},e.closeHTML5GeoLocationModal=function(){u.setCookie("html5Geolocation"+r.getHotelInfo().hotelCode,"false",1440),o.showHTML5GeoLocationModal="display-none",h.onModalClose()};var Z,ee,ae=r.getUxConfiguration().enableGeoAndCurrencyPricingConsent;if(""===u.getCookie("PricingConsent-"+r.getHotelInfo().hotelCode)&&ae&&(Z=!0),o.showGDPRModal="display-none",Z&&"GMS_SOCIAL_LOGIN_SUCCESS"!=i.route&&"ALTERNATE_PAYMENT_RESPONSE"!=i.route&&"NAVBAR_SOCIAL_LOGIN_SUCCESS"!=i.route){var te=r.getHotelDescUpdated().consents;angular.forEach(te,function(a){"pricing_consent"===a.category.toLowerCase()&&(e.pricingConsentText=a.text.replace("%PROPERTY_NAME%",r.getHotelDescUpdated().hotelName))}),ee=angular.copy(i.route),i.route="GUEST_AND_ROOMS",I.executeAfterCookieBanner().then(function(){o.showGDPRModal="display-block",setTimeout(function(){h.onModalOpen("guestsAndRoomsHeader","gdpr-geolocation-id","defaultFocusOnGDPR",!0,e.disableGDPR)},3e3)})}""!==u.getCookie("PricingConsent-"+r.getHotelInfo().hotelCode)&&"true"===u.getCookie("PricingConsent-"+r.getHotelInfo().hotelCode,"|").cookieFirstString?o.GDPREnabled=!0:""!==u.getCookie("PricingConsent-"+r.getHotelInfo().hotelCode)&&"false"===u.getCookie("PricingConsent-"+r.getHotelInfo().hotelCode,"|").cookieFirstString&&(o.GDPREnabled=!1);var oe=function(){var e=i.errorList
;if(void 0!=e&&void 0!=e.errors&&e.errors.length>0)for(var t=0;t<e.errors.length;t++)if("MAX_OCCUPANCY_EXCEEDED"==e.errors[t].errorCode){a.setConfig("MAX_OCCUPANCY_EXCEEDED");break}};L(),function(){var e=r.getCurrentLanguages().languageCode;if(i.route){var a=e.toLowerCase().substring(0,2);document.getElementsByTagName("html")[0].lang=a}}(),e.enableGDPR=function(){i.evaluatorResponse=void 0,sessionStorage&&JSON.parse(sessionStorage.getItem("allPromotionsCache/"+F.hotelCode))&&(G=angular.copy(allPromotions),sessionStorage.removeItem("allPromotionsCache/"+F.hotelCode),allPromotions=void 0,a.setDisplayPromotions(!1)),D();var n=moment().format(),s="PricingConsent-"+r.getHotelInfo().hotelCode,l=encodeURIComponent(e.pricingConsentText);u.setCookie(s,"true|"+n,43200),u.setCookie("PricingConsentWording-"+r.getHotelInfo().hotelCode,l,43200),d.postPricingConsent(r.getHotelInfo().hotelCode,{optinWording:e.pricingConsentText,date:n,cookieId:"true"}),o.showGDPRModal="display-none",h.onModalClose(),i.route=ee,Z=void 0,o.GDPREnabled=!0,L(),o.$broadcast(t.GDPR_SELECTED),K&&Q&&k()},e.disableGDPR=function(){i.evaluatorResponse=void 0,sessionStorage&&JSON.parse(sessionStorage.getItem("allPromotionsCache/"+F.hotelCode))&&(G=angular.copy(allPromotions),sessionStorage.removeItem("allPromotionsCache/"+F.hotelCode),allPromotions=void 0,a.setDisplayPromotions(!1)),D();var n=moment().format(),s="PricingConsent-"+r.getHotelInfo().hotelCode,l=encodeURIComponent(e.pricingConsentText);i.route=ee,u.setCookie(s,"false|"+n,43200),u.setCookie("PricingConsentWording-"+r.getHotelInfo().hotelCode,l,43200),d.postPricingConsent(r.getHotelInfo().hotelCode,{optinWording:e.pricingConsentText,date:n,cookieId:"false"}),o.showGDPRModal="display-none",h.onModalClose(),Z=void 0,o.GDPREnabled=!1,L(),o.$broadcast(t.GDPR_SELECTED)},I.executeAfterCookieBanner().then(function(){!Z&&K&&Q&&"false"==u.getCookie("html5Geolocation"+r.getHotelInfo().hotelCode)||(!Z&&K&&Q&&"true"==u.getCookie("html5Geolocation"+r.getHotelInfo().hotelCode)&&1==a.getHTML5Selected()?(o.latitude=a.getLatitude(),o.longitude=a.getLongitude()):!Z&&K&&Q&&0!=a.getHTML5Selected()&&""==u.getCookie("html5Geolocation"+r.getHotelInfo().hotelCode)?N():!Z&&K&&Q&&"true"==u.getCookie("html5Geolocation"+r.getHotelInfo().hotelCode)&&k())}),void 0==o.MRB&&(o.MRB=r.getHotelDesc().enableMultiRoomTypeBookings&&!a.getMainReservation().isModifiable),o.MRB&&a.getCurrency()&&-1!=B.indexOf(a.getCurrency())?a.disabledMultiRoomBehavior():o.MRB&&!a.getCurrency()&&i.baseRes&&i.baseRes.currency&&-1!=B.indexOf(i.baseRes.currency)&&a.disabledMultiRoomBehavior(),o.MRB&&(o.reservationArray=a.getMainReservationArray());var re=r.getBrandInfo().logo.type;(function(){var e=w.displayDecimalRatesIndicator?"Enable":"Disable",a=1===w.calendarConfig.visibleMonths?"1 month view":"2 months view",t=w.calendarConfig.weekFormat?"Monday":"Sunday",o=w.strikeThroughPricingEnabled?"Enable":"Disable",i=w.interactiveMessagesEnabled?"Enable":"Disable",s="wide-logo-banner"==re?"Large logo":"Small logo",l=w.enhancementsEnabled?"Enable":"Disable",c=w.specialCodesFieldEnabled?"Enable":"Disable",d=w.roomUpgradeEnabled?"Enable":"Disable",g=w.accomodationsConfig.defaultDisplayFormat?"list":"grid",m=w.accomodationsConfig.displayIconsIndicator?"Enable":"Disable",u=w.accomodationsConfig.enableVideoAutoPlay?"Enable":"Disable",p=x.enableSchedPkgInclusions?"Enable":"Disable",y=w.accomodationsConfig.displayPromotionalTag?"Enable":"Disable",v=w.accomodationsConfig.displayUrgencyMessaging?"Enable":"Disable",h=w.reservationAndPaymentConfig.specialRequestForm?"Enable":"Disable",R=w.confirmationConfig.displayMapsIndicator?"Enable":"Disable",f=w.reservationAndPaymentConfig.displayFrequentGuestIdIndicator?"Enable":"Disable",C=w.reservationAndPaymentConfig.privacyPolicyEnabled?"Enable":"Disable",P=w.reservationAndPaymentConfig.termsAndConditionsDisplayFormat?"Checkbox":"Popup",S=r.getEnableInsurance();n.setUserProperties({dimension1:"Web4"}),n.setUserProperties({dimension2:x.hotelCode}),n.setUserProperties({dimension3:e}),n.setUserProperties({dimension4:l}),n.setUserProperties({dimension5:c}),n.setUserProperties({dimension6:g}),n.setUserProperties({dimension7:a}),n.setUserProperties({dimension8:w.calendarConfig.monthsToLookAhead}),n.setUserProperties({dimension9:t}),n.setUserProperties({dimension10:o}),n.setUserProperties({dimension11:y}),n.setUserProperties({dimension12:m}),n.setUserProperties({dimension13:v}),n.setUserProperties({dimension14:h}),n.setUserProperties({dimension15:p}),n.setUserProperties({dimension16:d}),n.setUserProperties({dimension17:f}),n.setUserProperties({dimension18:P}),n.setUserProperties({dimension19:C}),n.setUserProperties({dimension20:i}),n.setUserProperties({dimension21:R}),n.setUserProperties({dimension22:u}),n.setUserProperties({dimension23:s}),n.setUserProperties({dimension25:S})})(),v(function(){n.eventTrack("DefaultLanguage",{category:"UserNavigation",label:r.getCurrentLanguages().languageCode});var e=S.get("pageCache"),a=o.currentCurrency;a=o.currentCurrency?o.currentCurrency:e&&e.get("/page/currency/"+r.getHotelDesc().hotelCode)?e.get("/page/currency/"+r.getHotelDesc().hotelCode).currencyCode:i.baseRes.currency,n.eventTrack("DefaultCurrency",{category:"UserNavigation",label:a})},3e3),document.body.addEventListener("ga_event",function(e){var a=e.detail.Action_Name,t=e.detail.Label,o=e.detail.Category;n.eventTrack(a,{category:o,label:t})}),o.$on(t.DISPLAY_ALL_PROMOTIONS_EVENT,function(){n.eventTrack("DisplayPromo",{category:"UserNavigation",label:"Display All Promos"})}),o.$on(t.APPLY_PROMOTION_TO_RESERVATION,function(){var e=a.getPromotionInContext();e&&n.eventTrack("ApplyPromo",{category:"UserNavigation",label:e.promoName})}),o.$on(t.PROMOTION_DOES_NOT_QUALIFY,function(e,a){n.eventTrack("DoesNotQualify",{category:"UserNavigation",label:a.promotionName})})}]),angular.module("TravelClApp").factory("accessibilityService",["lodash","$rootScope","$timeout","accessibilityTrapFocus","cookieConsentService",accessibilityService]),angular.module("TravelClApp").factory("accessibilityTrapFocus",accessibilityTrapFocus),angular.module("TravelClApp").controller("AccommodationController",["accessibilityService","CacheFactory","$filter","EVENT","$window","$rootScope","$http","$q","$log","apiFactory","$scope","hotelFactory","toaster","$state","$document","$timeout","reservationService","gmsService","navDataFactory","$analytics","commonFactory","$sce","lodash","loyaltyPointsService","voucherPaymentService","myCheckWalletService","menubarService","enhancementsService","memberRateService","audienceEvaluatorService","cookieConsentService",AccommodationController]),angular.module("TravelClApp").directive("accommodationGridRow",["$log",accommodationGridRow]).directive("accommodationListRow",accommodationListRow).directive("accommodationGrid",accommodationGrid).directive("accommodationGridPackage",accommodationGridPackage).directive("accommodationList",["$timeout","EVENT",accommodationList]).directive("accommodationListPackage",accommodationListPackage).directive("accommodationRoomDetail",["$log","$timeout","$analytics","EVENT",accommodationRoomDetail]).directive("accommodationGetOffset",["$timeout","$document","$window","$rootScope","$state",accommodationGetOffset]).directive("accommodationRow",accommodationRow).directive("accommodationRowpackage",accommodationRowpackage).directive("accommodationPackageDetail",["$log","$timeout","$document","$window",accommodationPackageDetail]).directive("accommodationPlist",["$timeout",accommodationPList]).directive("accommodationCustomBookBtn",["$timeout","$document","$window","$rootScope",accommodationCustomBookBtn]).directive("accommodationRoomDetailList",["$log","$timeout","$analytics","EVENT",accommodationRoomDetailList]).directive("accommodationPackageDetailList",["$log","$timeout","$document","$window",accommodationPackageDetailList]).directive("svgImport",svgImport).directive("equalizeHeight",["$timeout",equalizeHeight]).directive("equalizeHeightAdd",["$timeout",equalizeHeightAdd]).directive("showRatePlanDetail",showRatePlanDetail).directive("countdown",["commonFactory","$interval",timer]).directive("accommodationMultirateList",["$timeout","EVENT",accommodationMultirateList]).directive("multirateRoomDetailList",["$timeout","$analytics","EVENT",multirateRoomDetailList]).directive("allRatePlansPopup",["accessibilityService",allRatePlansPopup]).directive("accommodationFilterPosition",["$rootScope",accommodationFilterPosition]),angular.module("TravelClApp").filter("ratePlanFilter",ratePlanFilter).filter("guestsFilter",["$rootScope",guestsFilter]).filter("daysFilter",["$rootScope",daysFilter]).filter("nightsFilter",["$rootScope",nightsFilter]).filter("capitalize",capitlizeFilter).filter("ellipsisFilter",ellipsisFilter).filter("ellipsisFilterForGeoPricing",ellipsisFilterForGeoPricing).filter("htmlUnicodeFilter",["$sce",htmlUnicodeFilter]).filter("unescapeFilter",unescapeFilter).filter("roomSizeFilter",["$rootScope","$sce",roomSizeFilter]),angular.module("TravelClApp").controller("ConfirmationController",["$log","EVENT","apiFactory","CacheFactory","$window","$rootScope","$scope","$state","$timeout","reservationService","commonFactory","hotelFactory","$analytics","navDataFactory","lodash","$filter","$sce","accessibilityService","loyaltyPointsService","voucherPaymentService","toaster","myCheckWalletService","menubarService","enhancementsService","insuranceService",ConfirmationController]),angular.module("TravelClApp").directive("confirmEnhance",confirmEnhance).directive("confirmGetAround",["$window","hotelFactory","commonFactory",confirmGetAround]).directive("customGoogleMap",["hotelFactory","commonFactory",customGoogleMap]).directive("upgradeRoom",upgradeRoom),angular.module("TravelClApp").controller("CurrencyDropdownController",["$rootScope","$scope","hotelFactory","EVENT","$analytics","reservationService",CurrencyDropdownController]),CurrencyDropdownController.$inject=["$rootScope","$scope","hotelFactory","EVENT","$analytics","reservationService"],angular.module("TravelClApp").directive("currencyBar",currencyBar),angular.module("TravelClApp").filter("calRatesFilter",["hotelFactory","$filter","$log","reservationService",calRatesFilter]).filter("calRatesFilters",["hotelFactory","$filter","$log","reservationService",calRatesFilters]).filter("distanceConvert",distanceConvert),angular.module("TravelClApp").directive("calendarDays",calendarDays).directive("deleteRoom",deleteRoom).directive("deleteRatePlan",deleteRatePlan).directive("deletePackage",deletePackage).directive("deleteGroup",deleteGroup).directive("alternateProperties",alternateProperties).directive("paymentProcess",paymentProcess).directive("monthYearDropdown",["hotelFactory","commonFactory","$rootScope","EVENT",monthYearDropdown]),angular.module("TravelClApp").directive("calendarWeeks",calendarWeeks),angular.module("TravelClApp").controller("DatesOfStayController",["$filter","$timeout","EVENT","$rootScope","$scope","$log","toaster","apiFactory","$state","navDataFactory","reservationService","hotelFactory","commonFactory","$document","$window","lodash","$analytics","accessibilityService","loyaltyPointsService","cookieConsentService","memberRateService","audienceEvaluatorService","gmsService",DatesOfStayController]),angular.module("TravelClApp").factory("datesOfStayFactory",["$http","apiFactory",datesOfStayFunction]),function(){function e(e){return{getAllDates:function(){return e.when(a)}}}angular.module("TravelClApp").factory("datesOfStayFactoryMock",e);var a={hotelCode:1234,languageCode:"EN_US",currencyCode:"USD",minimumLengthOfStay:3,dates:[{date:"2015-11-23",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-11-24",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-11-25",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-11-26",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-11-27",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-11-28",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-11-29",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-11-30",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-12-01",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-12-02",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-12-03",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-12-04",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-12-05",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-12-06",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-12-07",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-12-08",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-12-09",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-12-10",available:!0,status:"AvailableForSale",displayStatus:null,rate:180},{date:"2015-12-11",available:!0,status:"AvailableForSale",displayStatus:null,rate:180},{date:"2015-12-12",available:!0,status:"AvailableForSale",displayStatus:null,rate:180},{date:"2015-12-13",available:!0,status:"AvailableForSale",displayStatus:null,rate:180},{date:"2015-12-14",available:!0,status:"AvailableForSale",displayStatus:null,rate:180},{date:"2015-12-15",available:!0,status:"AvailableForSale",displayStatus:null,rate:180},{date:"2015-12-16",available:!0,status:"AvailableForSale",displayStatus:null,rate:180},{date:"2015-12-17",available:!0,status:"AvailableForSale",displayStatus:null,rate:200},{date:"2015-12-18",available:!0,status:"AvailableForSale",displayStatus:null,rate:200},{date:"2015-12-19",available:!0,status:"AvailableForSale",displayStatus:null,rate:225},{date:"2015-12-20",available:!0,status:"AvailableForSale",displayStatus:null,rate:225},{date:"2015-12-21",available:!0,status:"AvailableForSale",displayStatus:null,rate:225},{date:"2015-12-22",available:!0,status:"AvailableForSale",displayStatus:null,rate:225},{date:"2015-12-23",available:!0,status:"AvailableForSale",displayStatus:null,rate:250},{date:"2015-12-24",available:!1,status:"NotAvailableForSale",displayStatus:"Sold Out",rate:250},{date:"2015-12-25",available:!1,status:"NotAvailableForSale",displayStatus:"Sold Out",rate:250},{date:"2015-12-26",available:!1,status:"NotAvailableForSale",displayStatus:"Sold Out",rate:250},{date:"2015-12-27",available:!0,status:"AvailableForSale",displayStatus:null,rate:120},{date:"2015-12-28",available:!0,status:"AvailableForSale",displayStatus:null,rate:210},{date:"2015-12-29",available:!0,status:"AvailableForSale",displayStatus:null,rate:210},{date:"2015-12-30",available:!0,status:"AvailableForSale",displayStatus:null,rate:210},{date:"2015-12-31",available:!0,status:"AvailableForSale",displayStatus:null,rate:210}]}}(),angular.module("TravelClApp").filter("currencyConversionAndSymbol",["$rootScope","reservationService","$filter","hotelFactory",currencyConversionAndSymbol]).filter("currencyConversionAndSymbolDisplayLogic",["$rootScope","reservationService","$filter","hotelFactory",currencyConversionAndSymbolDisplayLogic]).filter("defaultCurrencySymbol",["$rootScope","reservationService","$filter","hotelFactory",defaultCurrencySymbol]).filter("currencyConversionWithTwoDecimalPlaces",["$rootScope","reservationService","$filter","hotelFactory",currencyConversionWithTwoDecimalPlaces]).filter("replaceHash",replaceHash).filter("replaceHashWithPercent",replaceHashWithPercent).filter("replaceDollerOneToAmount",replaceDollerOneToAmount).filter("replaceHashMRB",replaceHashMRB).filter("replaceHashDiscountMRB",["$filter",replaceHashDiscountMRB]).filter("replaceHashFreeNights",["$filter",replaceHashFreeNights]).filter("replaceUserName",replaceUserName).filter("alternateAvailCurrency",["$filter","reservationService","hotelFactory",alternateAvailCurrency]).filter("replaceHotelName",replaceHotelName),angular.module("TravelClApp").filter("formatServicesDate",["commonFactory",formatServicesDate]).filter("formatPackageDate",["commonFactory",formatPackageDate]).filter("formatGroupDate",["commonFactory",formatGroupDate]).filter("formatDateMMMDDYYYY",["commonFactory",formatDateMMMDDYYYY]).filter("formatDateMMMDDYYYYInDatesofStay",["commonFactory",formatDateMMMDDYYYYInDatesofStay]).filter("formatDates",["commonFactory",formatDates]),angular.module("TravelClApp").filter("imageUrlFilter",imageUrlFilter),angular.module("TravelClApp").filter("replaceByValue",replaceByProgramName).filter("replaceByProgramCurrency",replaceByProgramCurrency),angular.module("TravelClApp").filter("newline",["$rootScope",newline]),angular.module("TravelClApp").filter("packageFeatures",packageFeatures).filter("packageFeaturesImage",packageFeaturesImage),angular.module("TravelClApp").filter("range",rangeFilter),angular.module("TravelClApp").directive("flexTax",["$rootScope",flexTaxes]).directive("showTaxBreakdown",showTaxBreakdown),angular.module("TravelClApp").controller("FooterController",["gmsService","$rootScope","$scope","$state","hotelFactory","navDataFactory","reservationService","apiFactory","toaster","commonFactory","$window","$document","CacheFactory","EVENT","$analytics","$log","$location","accessibilityService","$timeout","loyaltyPointsService","lodash","voucherPaymentService","tokenService","myCheckWalletService","cookieConsentService","$filter",FooterController]),FooterController.$inject=["gmsService","$rootScope","$scope","$state","hotelFactory","navDataFactory","reservationService","apiFactory","toaster","commonFactory","$window","$document","CacheFactory","EVENT","$analytics","$log","$location","accessibilityService","$timeout","loyaltyPointsService","lodash","voucherPaymentService","tokenService","myCheckWalletService","cookieConsentService","$filter"],angular.module("TravelClApp").directive("footerBar",footerBar).directive("propertyDetails",propertyDetails).directive("chinaCdn",chinaCdn).directive("htmlGeolocation",htmlGeolocation).directive("gdpr",Gdpr).directive("browserDefault",browserDefault).directive("showMoreText",["$filter",showMoreText]),angular.module("TravelClApp").controller("GmsController",["$analytics","$scope","$rootScope","gmsService","apiFactory","hotelFactory","EVENT",GmsController]),GmsController.$inject=["$analytics","$scope","$rootScope","gmsService","apiFactory","hotelFactory","EVENT"],angular.module("TravelClApp").directive("gmsUi",gmsUIBlock),angular.module("TravelClApp").controller("GmsFormsController",["$analytics","$state","$scope","$rootScope","gmsService","apiFactory","hotelFactory","reservationService","accessibilityService","EVENT","toaster","$window","$document","$location","commonFactory","$timeout","cookieConsentService",GmsFormsController]),GmsFormsController.$inject=["$analytics","$state","$scope","$rootScope","gmsService","apiFactory","hotelFactory","reservationService","accessibilityService","EVENT","toaster","$window","$document","$location","commonFactory","$timeout","cookieConsentService"],GmsFormsController.$inject=["$analytics","$state","$scope","$rootScope","gmsService","apiFactory","hotelFactory","reservationService","accessibilityService","EVENT","toaster","$window","$document","$location","commonFactory","$timeout","cookieConsentService"],angular.module("TravelClApp").directive("gmsFormsUi",gmsFormsUi),angular.module("TravelClApp").factory("gmsService",["$rootScope","EVENT","hotelFactory","reservationService","apiFactory","$window",gmsService]),angular.module("TravelClApp").controller("GuestRetrieveController",["$scope","$rootScope","apiFactory","hotelFactory","reservationService","EVENT","accessibilityService","$timeout",GuestRetrieveController]),GuestRetrieveController.$inject=["$scope","$rootScope","apiFactory","hotelFactory","reservationService","EVENT","accessibilityService","$timeout"],angular.module("TravelClApp").directive("guestRetriveForm",guestRetriveForm),angular.module("TravelClApp").controller("GuestsAndRoomsController",["$window","$document","$timeout","$rootScope","$log","toaster","hotelFactory","$scope","$state","navDataFactory","reservationService","commonFactory","$filter","EVENT","$analytics","apiFactory","accessibilityService","loyaltyPointsService","memberRateService","audienceEvaluatorService",GuestsAndRoomsController]),angular.module("TravelClApp").filter("adultsFilter",["$rootScope","$filter","reservationService",adultsFilter]).filter("childrenFilter",["$rootScope","$filter","reservationService",childrenFilter]).filter("infantsFilter",["$rootScope","$filter","reservationService",infantsFilter]).filter("roomsFilter",["$rootScope","$filter","reservationService",roomsFilter]).filter("ageFilter",["$rootScope",ageFilter]),angular.module("TravelClApp").directive("insuranceComponent",["$rootScope","$window","accessibilityService","hotelFactory","reservationService","insuranceService",insuranceComponent]).directive("insurancePopUp",["$rootScope",insurancePopUp]),angular.module("TravelClApp").directive("insuranceMessageComponent",[insuranceMessageComponent]),angular.module("TravelClApp").controller("InternationalController",["$rootScope","$log","$scope","hotelFactory","reservationService","EVENT","$state","$analytics","navDataFactory","toaster","$timeout","apiFactory","lodash","loyaltyPointsService","accessibilityService","resetBookingEngineService","menubarService","cookieConsentService","$window","audienceEvaluatorService",InternationalController]),InternationalController.$inject=["$rootScope","$log","$scope","hotelFactory","reservationService","EVENT","$state","$analytics","navDataFactory","toaster","$timeout","apiFactory","lodash","loyaltyPointsService","accessibilityService","resetBookingEngineService","menubarService","cookieConsentService","$window","audienceEvaluatorService"],angular.module("TravelClApp").directive("intlBar",intlBar),angular.module("TravelClApp").directive("menubar",["hotelFactory","menubarService","$window","reservationService","loyaltyPointsService",menubar]),angular.module("TravelClApp").directive("switchRoom",switchRoom).directive("confirmBookRoom",confirmBookRoom).directive("manageMultiRoom",manageMultiRoom),angular.module("TravelClApp").controller("MultiRoomController",["commonFactory","navDataFactory","$log","$analytics","$state","$scope","$rootScope","apiFactory","hotelFactory","reservationService","EVENT","toaster","$window","$document","$location","lodash","$filter","accessibilityService","loyaltyPointsService","voucherPaymentService",MultiRoomController]),MultiRoomController.$inject=["commonFactory","navDataFactory","$log","$analytics","$state","$scope","$rootScope","apiFactory","hotelFactory","reservationService","EVENT","toaster","$window","$document","$location","lodash","$filter","accessibilityService","loyaltyPointsService","voucherPaymentService","myCheckWalletService"],MultiRoomController.$inject=["commonFactory","navDataFactory","$log","$analytics","$state","$scope","$rootScope","apiFactory","hotelFactory","reservationService","EVENT","toaster","$window","$document","$location","lodash","$filter","accessibilityService","loyaltyPointsService","voucherPaymentService","myCheckWalletService"],NavbarController.$inject=["$filter","$log","$rootScope","$scope","$state","hotelFactory","navDataFactory","reservationService","EVENT","$window","apiFactory","commonFactory","$timeout","$document","accessibilityService","gmsService","loyaltyPointsService","menubarService","cookieConsentService"],angular.module("TravelClApp").directive("navBar",navBar).directive("navBarAccommodationsDrawer",navBarAccommodationsDrawer).directive("navBarMultiroomDrawer",navBarMultiroomDrawer).directive("setHeightToNavbarDynamically",["$document","$timeout","$interval","$rootScope",setHeightToNavbarDynamically]),angular.module("TravelClApp").factory("navDataFactory",["reservationService","hotelFactory","$rootScope",navDataFactory]),angular.module("TravelClApp").directive("paymentComponent",["$rootScope","hotelFactory","$window","reservationService","paymentComponentService",paymentComponent]),angular.module("TravelClApp").directive("promotionBanner",["lodash","reservationService","$analytics","$rootScope","$timeout",promotionBanner]),angular.module("TravelClApp").directive("promotionBannerTotal",["$timeout","reservationService",promotionBannerTotal]),angular.module("TravelClApp").directive("promotionDetailsModal",["lodash","reservationService","$analytics","$rootScope","accessibilityService","$state",promotionDetailsModal]),angular.module("TravelClApp").filter("replaceNumberDealsCarousal",["$rootScope",replaceNumberDealsCarousal]),angular.module("TravelClApp").directive("promotionsRightRail",["lodash","reservationService","$analytics","$rootScope","$timeout","$state","accessibilityService","$window","commonFactory",promotionsRightRail]),angular.module("TravelClApp").factory("apiFactory",["CacheFactory","$rootScope","$window","$http","$q","$log","$cookies","$state","loyaltyPointsService","menubarService","audienceEvaluatorService",apiFunction]),angular.module("TravelClApp").service("APIInterceptor",["EVENT","$q","$rootScope","$log","$location","$window","$timeout","CacheFactory","loyaltyPointsService","tokenService","menubarService","audienceEvaluatorService",function(e,a,t,o,r,n,i,s,c,d,g,m){var u=this,p=n.HotelDescriptiveInfo2,y=p.enableMemberRateMerchandising;u.request=function(e){if(o.debug("service.request:Show Spinner"),e.url.indexOf(".html")<0&&e.url.indexOf(".php")<0){void 0!=e&&void 0!=e.data&&1==e.data.preFetch&&(t.bgHideSpinner=!1);var a=!0;e&&!1===e.headers["MONITOR-REQUEST"]&&(a=!1),a&&(t.bgHideSpinner?t.showSpinner=!0:t.bgHideSpinner=!0),delete e.headers["MONITOR-REQUEST"]}var r,i="/hotel/"+p.hotelCode+"/",u=e.url.indexOf(i+"basicavail")>-1||e.url.indexOf(i+"avail")>-1||e.url.indexOf(i+"services")>-1||e.url.indexOf(i+"reservation")>-1||e.url.indexOf(i+"hold-reservation")>-1||e.url.indexOf(i+"specialcodes")>-1,v=s.get("pageCache");u&&(r=t.currentCurrency?"currency="+t.currentCurrency:v&&v.get("/page/currency/"+p.hotelCode)?"currency="+v.get("/page/currency/"+p.hotelCode).currencyCode:"currency="+n.baseRes.currency),void 0===t.GDPREnabled||!u&&-1==e.url.indexOf("evaluator")||(r?r+=",tcShareLocation="+t.GDPREnabled:r="tcShareLocation="+t.GDPREnabled),c.getIsLoyaltyReservationEnabled()&&(c.getIsBrandBarDisplay()||g.getMenubarEnabled())&&c.getLoyaltyTierId()&&(r?r+=",loyaltyTierId="+c.getLoyaltyTierId():r="loyaltyTierId="+c.getLoyaltyTierId()),y&&t.gmsUserLoggedIn&&p&&p.privateOffersEnabled&&p.privateOfferLoyaltyInfo&&p.privateOfferLoyaltyInfo.programTierMapping&&p.privateOfferLoyaltyInfo.programTierMapping[0].tierId&&(r?r+=",loyaltyTierId="+p.privateOfferLoyaltyInfo.programTierMapping[0].tierId:r="loyaltyTierId="+p.privateOfferLoyaltyInfo.programTierMapping[0].tierId),v.get("/page/promotionInContext/"+p.hotelCode)&&v.get("/page/promotionInContext/"+p.hotelCode).promotionId&&(-1!=e.url.indexOf("travelclick.com")||-1!=e.url.indexOf("travelclickchina.cn"))&&(r?r+=",promotionId="+v.get("/page/promotionInContext/"+p.hotelCode).promotionId:r="promotionId="+v.get("/page/promotionInContext/"+p.hotelCode).promotionId),t.latitude&&(r?r+=",latitude="+t.latitude+",longitude="+t.longitude:r="latitude="+t.latitude+",longitude="+t.longitude);var h;if(m.getAudienceLists()&&(-1!=e.url.indexOf("travelclick.com")||-1!=e.url.indexOf("travelclickchina.cn"))&&-1==e.url.indexOf("evaluator")){var R=m.getAudienceLists();if(R&&R.length>0){for(l=0;R.length>l;l++){var f=R[l].percentage?R[l].percentage:100;h?h+="|"+R[l].id+"_percentage:"+f:h=R[l].id+"_percentage:"+f}r?r+=",audience="+h:r="audience="+h}}!r||-1!=e.url.indexOf("loyalty/v2")||-1==e.url.indexOf("travelclick.com")&&-1==e.url.indexOf("evaluator")&&-1==e.url.indexOf("travelclickchina.cn")||(e.headers["x-tc-header"]=r);var C=d.getToken();o.debug("setting bearer token in service.request"),void 0!=C&&e.url.indexOf("evaluator")<0&&(-1!=e.url.indexOf("travelclick.com")||-1!=e.url.indexOf("travelclickchina.cn"))?e.headers.Authorization="Bearer "+C:-1!=e.url.indexOf("tcgms.net")&&(e.headers["Content-Type"]=void 0);var P=window.bmak;return void 0==P||-1==e.url.indexOf("travelclick.com")&&-1==e.url.indexOf("travelclickchina.cn")||(e.headers["Akamai-BM-Telemetry"]=P.get_telemetry()),e},u.requestError=function(e){return o.debug("service.requestError:Show Spinner"),t.showSpinner=!0,e},u.response=function(e){if(o.debug("service.response:Hide Spinner"),e.config.url.indexOf(".html")<0&&e.config.url.indexOf(".php")<0){var a=!1;void 0!=e.config&&void 0!=e.config.data&&1==e.config.data.preFetch&&(a=!0),a||1==t.ALTERNATE_HOTEL_SPLASH||1==t.MULRIROOM_AVAILCALL||1==t.MULRIROOM_COMBINEDHOLD||(t.showSpinner=!1)}return e},u.responseError=function(r){if(401!=r.status&&403!=r.status||(d.removeToken(),t.$broadcast(e.AUTH_ERROR)),o.debug("service.responseError:Hide Spinner"),console.log("error "+r.config.url),r.config.url.indexOf(".html")<0&&1!=t.MULRIROOM_AVAILCALL&&1!=t.ALTERNATE_HOTEL_SPLASH&&1!=t.MULRIROOM_COMBINEDHOLD){var n=!1;void 0!=r.config&&void 0!=r.config.data&&1==r.config.data.preFetch&&(n=!0),n||(t.showSpinner=!1)}return a.reject(r)}}]),angular.module("TravelClApp").factory("audienceEvaluatorService",["$window","CacheFactory","lodash","loyaltyPointsService","$rootScope",audienceEvaluatorService]),angular.module("TravelClApp").constant("EVENT",{LANG_CHANGE:"language_change",CURRENCY_CHANGE:"currency_change",PRICETAG_CHANGE:"priceTag_change",MODIFY_RESERVATION:"modify_reservation",SELECT_ACCOMMODATION:"select_accommodation",REMOVE_ACCOMMODATION:"remove_accommodation",MODIFY_RESERVATION_FROM_TOTAL:"modify_reservation_from_total",CONFIRM_DELETE_ROOM:"confirm_delete_room",REMOVE_RATEPLAN:"remove_rateplan",CONFIRM_DELETE_RATEPLAN:"confirm_delete_rateplan",REMOVE_ACCOMMODATION_TOTAL:"remove_accommodation_total",REMOVE_PACKAGE:"remove_package",REMOVE_GROUP:"remove_group",RETRIEVE_RESERVATION_POPUP:"retrieve_reservation_popup",OPEN_ROOM_DETAIL:"open_room_detail",ADD_ANOTHER_ENHANCEMENT:"add_another_enhancement",CHANGE_PLACEHOLDER:"change_placeholder",CONTINUE_MODIFY:"continue_modify",CHANGE_RADIOBUTTON:"change_radiobutton",CHANGE_TOTAL_PLACEHOLDER:"change_total_placeholder",REVIEW_PACKAGE:"review_package",EMPTY_CHILDREN_DROPDOWN:"empty_children_dropdown",TRIGGER_EXTEND_HOLD:"trigger_extend_hold",SEND_GUESTINFO_TO_GMS:"send_guestinfo_to_gms",EXTENDHOLD_REMOVE_ROOM:"extendhold_remove_room",EXTENDHOLD_REMOVE_RATEPLAN:"extendhold_remove_rateplan",EXTENDHOLD_REMOVE_PACKAGE:"extendhold_remove_package",EXTENDHOLD_REMOVE_GROUP:"extendhold_remove_group",PAYPAL_CANCEL:"paypal_cancel",GMS_LOGIN_SUCCESS:"gms_login_success",GMS_SIGNUP_SUCCESS:"gms_signup_success",GMS_SHOW_LOGIN_FORM:"gms_show_login_form",GMS_SHOW_SIGNUP_FORM:"gms_show_signup_form",GMS_SHOW_SIGNIN_FORM:"gms_show_signin_form",GMS_HIDE_LOGIN_FORM:"gms_hide_login_form",GMS_SOCIAL_LOGIN:"gms_social_login",GMS_LOGOUT_SUCCESS:"gms_logout_success",UPDATE_NAV_FOR_GMS:"update_nav_for_gms",GMS_SOCIAL_LOGIN_ERROR:"gms_social_login_error",GMS_SOCIAL_ACCOUNT_ERROR:"gms_social_account_error",SHOW_RETRIEVE_GUEST_INFO_POPUP:"show_retreive_guest_info_popup",TOTAL_PAGE_GUEST_INFO_RETRIEVED:"total_page_guest_info_retrieved",AUTH_ERROR:"auth_error",ADD_ROOMSELECTOR:"add_roomselector",DELETE_ROOM_ROOMSELECTOR:"delete_room_roomselector",REMOVE_CONFIRM_DELETE_ROOM_ROOMSELECTOR:"remove_confirm_delete_room_roomselector",CHANGE_ROOM_SELECTOR:"change_room_selector",REMOVE_CONFIRM_DELETE_ROOM_GNB:"remove_confirm_delete_room_gnb",IDEAL_CANCEL:"IDEAL_CANCEL",TRIGGER_GMS:"trigger_gms",GMS_OPENED:"gms_opened",DELETE_ROOM_AFTER_LAND_TOTAL:"delete_room_after_land_total",SUBMIT_GMS_FORM:"submit_gms_form",NEXT_MONTH_LOADED:"next_month_loaded",UPDATE_CURRENCY:"update_currency",UPDATE_DATES_FIELD:"update_dates_field",HTML_CLICK_YES:"html_click_yes",
DISPLAY_ALL_PROMOTIONS_EVENT:"DISPLAY_ALL_PROMOTIONS_EVENT",APPLY_PROMOTION_TO_RESERVATION:"APPLY_PROMOTION_TO_RESERVATION",PROMOTION_DOES_NOT_QUALIFY:"PROMOTION_DOES_NOT_QUALIFY",CONTINUE_TO_CHANGE_RATE_PLAN:"CONTINUE_TO_CHANGE_RATE_PLAN",CONFIRMED_TO_CHANGE_RATE_PLAN:"CONFIRMED_TO_CHANGE_RATE_PLAN",CONTINUE_TO_SWITCH_ROOM_DETAIL:"CONTINUE_TO_SWITCH_ROOM_DETAIL",GMS_REMOVE_PRIVATEOFFERS:"gms_remove_privateoffers",GMS_SHOW_LOGOUT_POPUP:"gms_show_logout_popup",GMS_LOGOUT_EVENT:"gms_logout_event",COSMO_LOGOUT:"COSMO_LOGOUT",GDPR_SELECTED:"gdpr_selected",HOTEL_DATA_UPDATED:"HOTEL_DATA_UPDATED",GROUP_PAYMENT_INCONTEXT:"GROUP_PAYMENT_INCONTEXT",LANG_CHANGE_AFTER_API:"LANG_CHANGE_AFTER_API",LANG_CHANGE_AFTER_API_CURRENCY_CHANGE:"LANG_CHANGE_AFTER_API_CURRENCY_CHANGE",COSMO_SPECIALCODES_LOGIN_LABEL:"cosmo_specialcodes_login_label",COSMO_SPECIALCODES_REMOVE_LABEL:"cosmo_specialcodes_remove_label",SPECIALCODES_REMOVE_MANUAL_LABEL_AFTER_LOGOUT:"specialcodes_remove_manual_label_after_logout",CALL_CURRENCY_CHANGE_MENUBAR:"call_currency_change_menubar",BROADCAST_CURRENCY_TO_CURRENCY_DROPDOWN:"broadcast_currency_to_currency_dropdown",BEFORE_REDIRECT:"BeforeRedirect",AFTER_REDIRECT:"AfterRedirect",AFTER_REDIRECT_COMMIT:"AfterRedirectCommit"}),angular.module("TravelClApp").constant("GMS_EVENTS",{ClickRoomBook:"SPECIAL_CASE",ClickAddRoomCheckout:"SPECIAL_CASE",ExtendedHoldConsentCheckbox:"optIn",ClickViewPackageDetails:"rateCode",ClickCheckout:"rateCode",ClickSpecialOffersNotification:"optIn",ClickRoomReservationDetails:"roomCode",ClickPackageInclusionDetails:"rateCode",ChangeLanguage:"language",ChangeCurrency:"currency",SelectPackagesFromList:"packageCatgCode",SelectRoomCategoriesFromList:"roomCatgCode",ClickAddCode:"SPECIAL_CASE",SuccesfulSignUp:"SPECIAL_CASE","SuccesfulSignIn/SignUp":"SPECIAL_CASE",SuccesfulSignIn:"SPECIAL_CASE",BannerClick:"SPECIAL_CASE",PostBooking:"SPECIAL_CASE",ClickRoom:"roomCode",ClickRoomUpgrade:"roomCode",ClickConfirmUpgrade:"roomCode",SelectRateFromList:"rateCode",SelectRatePlanInRoomDetail:"rateCode",SelectEnhancementFromRoom:"serviceCode",SelectEnhancementFromConfirm:"serviceCode",ClickAddAdults:"adults",ClickAddChildren:"children",ClickAddInfants:"infants",ClickAddChildrenAge:"childAge",ClickAddRooms:"numberOfRooms",SelectDatesCheckIn:"checkIn",SelectDatesCheckOut:"checkOut",ExtendedHoldShown:"SPECIAL_CASE",ConfirmExtendedHoldShown:"SPECIAL_CASE",Confirmation:"SPECIAL_CASE",onLoadEvent:"SPECIAL_CASE"}),angular.module("TravelClApp").constant("GMS_LANDING_EVENT_MAP",{datein:"checkIn",dateout:"checkOut",adults:"adults",children:"children",children2:"infants",rooms:"numberOfRooms",nights:"nights",length:"length",rateplanid:"rateCode",packageid:"rateCode",prodid:"rateCode",roomtypeid:"roomCode",packagecategoryid:"rateCode",groupid:"Group",discount:"Discount",languageid:"language",currency:"currency",iata:"TravelAgent",identifier:"Corporate",subchan:"metaPartners",roomcategoryid:"rateCode",childage:"childAge",portal:"portal",adult:"adults",confirmid:"webReservationId"}),angular.module("TravelClApp").factory("commonFactory",["$rootScope","hotelFactory","CacheFactory","$window","$state","$timeout","$analytics",commonFactory]),angular.module("TravelClApp").factory("cookieConsentService",["$window","hotelFactory","$timeout","$q",cookieConsentService]),angular.module("TravelClApp").factory("enhancementsService",["lodash","reservationService",enhancementsService]),angular.module("TravelClApp").factory("hotelFactory",["$window","$filter","apiFactory","$q","EVENT","lodash","loyaltyPointsService","menubarService",hotelFunction]),function(){function e(e){var t=a,o=angular.copy(t);return{getHotelInfo:function(){var a={};return a.hotelCode=o.hotelCode,a.hotelName=o.hotelName,a.maxRoomsPerBooking=o.maxRoomsPerBooking,a.webAddress=o.webAddress,a.roomCategoriesEnabled=o.roomCategoriesEnabled,a.interactiveMessagesEnabled=o.interactiveMessagesEnabled,a.currentLanguageCode=o.currentLanguage.languageCode,e.when(a)},getHotelDescriptiveInfo:function(){return e.when(o)},getOccupancyInfo:function(){return e.when(o.occupancyInfo)}}}angular.module("TravelClApp").factory("hotelFactoryMock",e);var a={hotelCode:1234,hotelName:"The Andreu Hotel",maxRoomsPerBooking:3,webAddress:"http://localhost",roomCategoriesEnabled:!0,interactiveMessagesEnabled:!0,currentLanguage:{languageCode:"en-us",description:"English (US)"},languages:[{isPrimaryLanguage:!0,languageCode:"en-us",description:"English (US)"},{isPrimaryLanguage:!1,languageCode:"es-es",description:"Español"}],currentCurrency:{currencyCode:"USD",displayFormat:"############.##"},currencies:[{something:"USD",displayFormat:"############.##"},{something:"EUR",displayFormat:"############.##"}],hotelLogo:{type:"image",imageSource:"./assets/images/global/logo-nav-andreu-hotel.png"},occupancyInfo:{familyPricingEnabled:!0,allowChildren:!0,allowInfants:!0,defaultRooms:1,defaultAdults:2,defaultChildren:0,defaultInfants:0,maxAdultsCountSupported:12,maxChildCountSupported:2,maxQualifyingAgeForChild:17,minChildAge:0,maxChildAge:17,ageBuckets:[{start:0,end:3,description:"0 to 3"},{start:4,end:9,description:"4 to 9"},{start:10,end:17,description:"10 to 17"}]},translations:{global_header_lblGuestAndRoom:"GUESTS & ROOMS",global_header_lblDatesOfStay:"DATES OF STAY",global_header_lblAccomodations:"ACCOMMODATIONS",global_header_lblTotal:"TOTAL",global_header_lblSelect:"Select",global_month_shortJan:"Jan",global_month_shortFeb:"Feb",global_month_shortMar:"Mar",global_month_shortApr:"Apr",global_month_shortMay:"May",global_month_shortJun:"Jun",global_month_shortJul:"Jul",global_month_shortAug:"Aug",global_month_shortSep:"Sep",global_month_shortOct:"Oct",global_month_shortNov:"Nov",global_month_shortDec:"Dec",global_month_longJan:"January",global_month_longFeb:"February",global_month_longMar:"March",global_month_longApr:"April",global_month_longMay:"May",global_month_longJun:"June",global_month_longJul:"July",global_month_longAug:"August",global_month_longOct:"October",global_month_longNov:"November",global_month_longDec:"December",global_day_shortMon:"MON",global_day_shortTue:"TUE",global_day_shortWed:"WED",global_day_shortThu:"THU",global_day_shortFri:"FRI",global_day_shortSat:"SAT",global_day_shortSun:"SUN",page_calendar_lblDatesOfStay:"Dates of Stay",page_calendar_btnGoBack:"GO BACK",page_calendar_btnConfirmDatesOfStay:"CONFIRM DATES OF STAY"}}}(),angular.module("TravelClApp").factory("insuranceService",["$rootScope","hotelFactory","$window","$q","reservationService",insuranceService]),angular.module("TravelClApp").factory("lodash",["$window",lodashFactoryMethod]),lodashFactoryMethod.$inject=["$window"],angular.module("TravelClApp").factory("loyaltyPointsService",["CacheFactory","$rootScope","$window","lodash",loyaltyPointsService]),angular.module("TravelClApp").factory("memberRateService",["$rootScope","$window","gmsService","loyaltyPointsService","menubarService",memberRateService]),angular.module("TravelClApp").factory("menubarService",["$window","tokenService","loyaltyPointsService","$rootScope","$timeout",menubarService]),angular.module("TravelClApp").factory("myCheckWalletService",["$rootScope","CacheFactory","lodash","hotelFactory",myCheckWalletService]),angular.module("TravelClApp").factory("paymentComponentService",["lodash","$rootScope","hotelFactory","$window","reservationService",paymentComponentService]),angular.module("TravelClApp").factory("reservationService",["$log","$rootScope","$timeout","EVENT","hotelFactory","commonFactory","CacheFactory","$window","$filter","lodash","apiFactory","$state","loyaltyPointsService","tokenService","$analytics",reservationService]),angular.module("TravelClApp").factory("resetBookingEngineService",["$rootScope","$timeout","reservationService","navDataFactory","myCheckWalletService",resetBookingEngineService]),angular.module("TravelClApp").factory("svgCacheService",svgCacheService),angular.module("TravelClApp").service("tokenService",["$log","$window",function(e,a){function t(a,t){if(a&&t)try{var o=""+r.hotelCode,n=a.substring(a.length-(16-o.length))+o,i=aesjs.utils.utf8.toBytes(n),s=aesjs.utils.hex.toBytes(t),l=new aesjs.ModeOfOperation.ctr(i),c=l.decrypt(s);return aesjs.utils.utf8.fromBytes(c)}catch(a){a.stack&&e.error(a.stack)}}e.debug("tokenService initialized");var o,r=angular.copy(a.HotelDescriptiveInfo2),n=angular.copy(a.ts),i=angular.copy(a.tk),s=angular.copy(a.gts),l=angular.copy(a.gtk);o=t(n,i),this.removeToken=function(){return o=void 0},this.getToken=function(){return o||(o=t(n,i)),o},this.getDecryptedValue=function(e,a){return t(e,a)},this.getGmsToken=function(){return t(s,l)}}]),angular.module("TravelClApp").factory("MyUsageTrackingService",["$log","apiFactory",function(e,a){return{trackEvent:function(e){a.trackEvent(e).then(function(e){console.log("trackEvent : "+e)})},trackPage:function(e){a.trackPage(e).then(function(e){console.log("trackPage : "+e)})},trackEventPost:function(e){a.trackEventPost(e).then(function(e){console.log("trackEventPost : "+e)})}}}]),angular.module("TravelClApp").factory("voucherPaymentService",["CacheFactory","lodash","hotelFactory",voucherPaymentService]),angular.module("TravelClApp").directive("toggleArrow",["$timeout","$document",toggleArrow]),function(){"use strict";function e(e,a,t,o,r,n,i,s,l,c,d,g,m,u,p,y,v,h,R,f){var C,P,S,A,I=!1;return{restrict:"E",templateUrl:"./specialCodes/specialcodes.html",link:function(r,g,b){function D(e){var a=new Date(e),t=a.getUTCDay(),o=d.translateWeekShortName(t),r=a.getUTCMonth();return o+", "+d.translateMonthShortName((r+1).toString())+" "+a.getUTCDate().toString()+", "+a.getUTCFullYear()}function T(){void 0!=r.gSplashDetails&&(r.formattedGSplashCutOffDate=m("formatGroupDate")(r.gSplashDetails.groupRules.cutoffDate),r.formattedGSplashLatestCheckoutDate=m("formatGroupDate")(r.gSplashDetails.groupRules.latestCheckoutDate),r.formattedGSplashEndDate=m("formatGroupDate")(r.gSplashDetails.endDate),r.formattedGSplashStartDate=m("formatGroupDate")(r.gSplashDetails.startDate),r.formattedGSplashEarliestCheckInDate=m("formatGroupDate")(r.gSplashDetails.groupRules.earliestCheckInDate))}r.bookNowBtn=!0,r.alertVariable=!0,r.showGroupModal="display-none",r.groupCannotRemoved=!1,r.reviewGroupDetails=!1;var O=t.getHotelInfo().hotelCode;a.getLanguage(),r.checkEnhancementsOnAccomodation=!0;var E=t.getUxConfiguration().enableGeoAndCurrencyPricingConsent,M=function(){var e=a.getMainReservation();r.codes=[],angular.forEach(e.posSource.requestorIds,function(a){"Group"==a.codeType||"group"==a.codeType?(r.groupExist=!0,r.codeType=a.codeType,r.code=a.id,j(),r.placeHolder=!0):1==e.isModifiable&&"corporate"==a.codeType||"Corporate"==a.codeType?c.gmsPromoCode=a.id:(r.codeType=a.codeType,r.code=a.id,j(),r.placeHolder=!0)}),e.roomStays&&e.roomStays.length>0&&e.roomStays[0].discountCode&&(r.codeType="discount",r.code=e.roomStays[0].discountCode,j(),r.placeHolder=!0),r.codeType=null,r.code=null};c.$on(u.MODIFY_RESERVATION,function(){a.getCodeTypes()||M()}),r.displayWidget=!1,0==t.getUxConfiguration().enableTravelAgencyCodes&&0==t.getUxConfiguration().enablePromotionalCodes&&0==t.getUxConfiguration().enableDiscountCode&&0==t.getUxConfiguration().enableGroupCode&&(r.displayWidget=!0);var _=function(){var e=a.getMainReservation(),t=e.posSource.requestorIds,o=!1;if(t.length>0){for(var n=0;n<t.length;n++)if("corporate"==t[n].codeType.toLowerCase()||"group"==t[n].codeType.toLowerCase()){o=!0,r.showCorpLoginLabel=!1;break}}else if(void 0!=a.getCodeTypes()&&a.getCodeTypes().length>0)for(var n=0;n<a.getCodeTypes().length;n++)if("corporate"==a.getCodeTypes()[n].toLowerCase()||"group"==a.getCodeTypes()[n].toLowerCase()){o=!0,r.showCorpLoginLabel=!1;break}o||(r.showCorpLoginLabel=!0,r.placeHolder=!0),void 0==r.incorrectCode&&(r.toggle=!1)},k=function(){if(a.getSignInRequiredFlag()&&void 0!=a.getCodeTypes()){for(var e=0;e<a.getCodeTypes().length;e++)if("corporate"===a.getCodeTypes()[e].toLowerCase()){a.removeOtherCode(a.getCodeTypes()[e].toLowerCase()),r.codes.splice(e,1),a.deleteAllCodeByKey(a.getCodeTypes()[e]),a.deleteCodeTypeByIndex(e),a.setSignInRequiredFlag(!1);break}(void 0==a.getCodeTypes()||void 0!=a.getCodeTypes()&&a.getCodeTypes().length<=0)&&h(function(){r.placeHolder=!1},0)}},N=function(){r.codes=[];var t=!1;e.debug(a.getCodeTypes()),a.getCodeTypes()?(angular.forEach(a.getCodeTypes(),function(e){"Group"!=e&&"group"!=e||(r.groupExist=!0),"corporate"!=e&&"Corporate"!=e||(t=!0);var o=a.getCodeValue(e);o&&r.codes.push(o)}),r.codes[0]&&(r.placeHolder=!0),0==t&&(v.checkGmsLogin()||R.getIsLoyaltyUserLogIn())&&""!=c.gmsPromoCode&&c.hidePublicRates&&_()):((v.checkGmsLogin()||R.getIsLoyaltyUserLogIn())&&""!=c.gmsPromoCode&&c.hidePublicRates&&_(),void 0==a.getConfig("GROUP_SPlASH")&&M())};r.setSelectedItem=function(e){r.selected=e.language,r.codeType=e.name},a.getConfig("INVALID_CORP_CODE")?(a.deleteConfig("INVALID_CORP_CODE"),r.incorrectCode=a.getIncorrectCode()):a.getConfig("GROUP_CUTOFF_DATE_PASSED")&&(a.deleteConfig("GROUP_CUTOFF_DATE_PASSED"),r.incorrectCode=a.getIncorrectCode(),a.deleteConfig("GROUP_SPlASH"));var L=function(){if(r.incorrectCode){r.toggle=!0,r.addError="1px solid red",r.addBorder="1px solid #ccc",1==r.combinationError&&(r.combinationError=!1),r.cantFind=!0,r.alertVariable=!0;for(var e=0;e<r.incorrectCode.length;e++){if("corporate"===r.incorrectCode[e].codeType){r.code=r.incorrectCode[e].id,r.codeType=r.incorrectCode[e].codeType;break}if("group"===r.incorrectCode[e].codeType){r.code=r.incorrectCode[e].id,r.codeType=r.incorrectCode[e].codeType;break}}for(var e=0;e<t.getCodeDisplay().length;e++){if("Corporate"==t.getCodeDisplay()[e].code&&"corporate"==r.codeType){r.selected=r.translate[t.getCodeDisplay()[e].name];break}if("Group"==t.getCodeDisplay()[e].code&&"group"==r.codeType){r.codeType="Group",r.selected=r.translate[t.getCodeDisplay()[e].name],r.cantFind=!1,r.showCutOffError=!0,a.setConfig("SHOW_GROUP_CUTOFF_DATE_ERROR");break}}}},G=function(){var e=[];if(r.codeTypes=[],1!=r.displayWidget){for(var a=0;a<t.getCodeDisplay().length;a++)"TravelAgent"==t.getCodeDisplay()[a].code&&1==t.getUxConfiguration().enableTravelAgencyCodes?e.push({name:t.getCodeDisplay()[a].code,language:r.translate[t.getCodeDisplay()[a].name]}):"Corporate"==t.getCodeDisplay()[a].code&&1==t.getUxConfiguration().enablePromotionalCodes?e.push({name:t.getCodeDisplay()[a].code,language:r.translate[t.getCodeDisplay()[a].name]}):"Discount"==t.getCodeDisplay()[a].code&&1==t.getUxConfiguration().enableDiscountCode?e.push({name:t.getCodeDisplay()[a].code,language:r.translate[t.getCodeDisplay()[a].name]}):"Group"==t.getCodeDisplay()[a].code&&1==t.getUxConfiguration().enableGroupCode&&e.push({name:t.getCodeDisplay()[a].code,language:r.translate[t.getCodeDisplay()[a].name]});e.sort(function(e,a){if(void 0!=e.language&&void 0!=a.language){var t=e.language.toUpperCase(),o=a.language.toUpperCase();return t<o?-1:t>o?1:0}}),r.codeTypes=e,r.codeType=r.codeTypes[0].name,r.selected=r.codeTypes[0].language,r.gSplashCutOffDate=D(r.gSplashCutOffDate),r.gSplashLatestCheckoutDate=D(r.gSplashLatestCheckoutDate),r.gSplashEndDate=D(r.gSplashEndDate),r.gSplashStartDate=D(r.gSplashStartDate),r.gSplashEarliestCheckInDate=D(r.gSplashEarliestCheckInDate)}L()},F=function(){"Discount"!=r.codeType&&"group"==a.getCodeTypes()[S].toLowerCase()&&(console.error("GroupExistsAddDiscount"),r.code=void 0,r.codeType=void 0,r.selected=r.codeTypes[0].language,r.errGroupExistsAddDiscount=!0,r.combinationError=!0,r.alertVariable=!1,h(function(){r.alertVariable=!0},50))},B=function(){"Discount"!=r.codeType&&"Corporate"!=r.codeType&&"travelagent"==a.getCodeTypes()[S].toLowerCase()&&(console.error("TaExistsAddProDiscount"),r.code=void 0,r.codeType=void 0,r.selected=r.codeTypes[0].language,r.errGroupExistsAddDiscount=!0)},x=function(){"Discount"!=r.codeType&&"Corporate"!=r.codeType&&"TravelAgent"!=r.codeType&&"discount"==a.getCodeTypes()[S].toLowerCase()&&(r.code=void 0,r.codeType=void 0,r.selected=r.codeTypes[0].language,r.errGroupExistsAddDiscount=!0)},w=function(){"Discount"!=r.codeType&&"TravelAgent"!=r.codeType&&"corporate"==a.getCodeTypes()[S].toLowerCase()&&(console.error(r.codeType),console.error(a.getCodeTypes()),console.error("PromoExistsAddTaDiscount"),r.code=void 0,r.codeType=void 0,r.selected=r.codeTypes[0].language,r.errGroupExistsAddDiscount=!0)},U=function(){"Discount"!=r.codeType&&"travelagent"==a.getCodeTypes()[S].toLowerCase()&&"corporate"==a.getCodeTypes()[S].toLowerCase()&&(console.error("TaProExistsAddDiscount"),r.code=void 0,r.codeType=void 0,r.selected=r.codeTypes[0].language,r.errGroupExistsAddDiscount=!0)},H=function(){if("Group"==r.codeType&&"Corporate"==a.getCodeTypes()[S])for(1==r.cantFind&&(r.cantFind=!1),r.combinationError=!0,r.alertVariable=!1,h(function(){r.alertVariable=!0},50),r.addBorder="1px solid #ccc",r.addError="1px solid red",a.deleteCodeTypeByIndex(S),a.deleteAllCodeByKey("Corporate"),r.codes.splice(S,1),A=0;A<a.getCodeTypes().length;A++)"TravelAgent"==a.getCodeTypes()[A]&&(a.deleteCodeTypeByIndex(A),a.deleteAllCodeByKey("TravelAgent"),r.codes.splice(A,1))},V=function(){"Corporate"==r.codeType&&"group"==a.getCodeTypes()[S].toLowerCase()&&(1==r.cantFind&&(r.cantFind=!1),r.combinationError=!0,r.alertVariable=!1,h(function(){r.alertVariable=!0},50),r.addBorder="1px solid #ccc",r.addError="1px solid red",a.deleteCodeTypeByIndex(S),a.deleteAllCodeByKey("Group"),r.codes.splice(S,1))},$=function(){if("Group"==r.codeType&&"TravelAgent"==a.getCodeTypes()[S])for(1==r.cantFind&&(r.cantFind=!1),r.combinationError=!0,r.alertVariable=!1,h(function(){r.alertVariable=!0},50),r.addBorder="1px solid #ccc",r.addError="1px solid red",a.deleteCodeTypeByIndex(S),a.deleteAllCodeByKey("TravelAgent"),r.codes.splice(S,1),A=0;A<a.getCodeTypes().length;A++)"Corporate"==a.getCodeTypes()[A]&&(a.deleteCodeTypeByIndex(A),a.deleteAllCodeByKey("Corporate"),r.codes.splice(A,1))},q=function(){"TravelAgent"==r.codeType&&"group"==a.getCodeTypes()[S].toLowerCase()&&(1==r.cantFind&&(r.cantFind=!1),r.combinationError=!0,r.alertVariable=!1,h(function(){r.alertVariable=!0},50),r.addBorder="1px solid #ccc",r.addError="1px solid red",r.codeType="Group",r.code=a.getCodeValue(r.codeType))},Y=function(){for(P=0;P<a.getCodeTypes().length;P++)a.getCodeTypes()[P]==r.codeType&&(I=!0,C=P,e.info(C+"seems not enter this function"))},j=function(){I?(r.codes[C]=r.code,a.addToAllCodes(r.codeType,r.code),I=!1):r.code&&(r.codes.push(r.code),a.setCodeType(r.codeType),a.addToAllCodes(r.codeType,r.code)),e.debug(JSON.stringify(a.getMainReservation())+"special code")};N(),r.toggle=!1,G(),r.$watch("translate",G);var z=a.canModifyReservation();r.Show=function(e){c.toggle.intlMenu=!1,c.$broadcast("CancelAccommodation"),0==r.cantFind&&0==r.combinationError&&(r.addBorder="",r.addError=""),r.toggle=!r.toggle,0==r.toggle&&r.cancelAdd(),e.preventDefault()},r.$on(u.LANG_CHANGE,T);var W,K;r.$on(u.CONFIRMED_TO_CHANGE_RATE_PLAN,function(e,a){r.checkEnhancementsOnAccomodation=!1,a?r.addCode():r.remove(K,W)}),r.$on("EVENT.RECALL_SPECIAL_CODE",function(e,a){a&&r.addCode(a)}),r.addCode=function(n){if(null==r.codeType&&(r.codeType=r.codeTypes[0].name,r.selected=r.codeTypes[0].language),r.codeType&&r.code){if(r.checkEnhancementsOnAccomodation&&"group"!==r.codeType.toLowerCase()&&"discount"!==r.codeType.toLowerCase()&&i.includes("accommodation"))return void c.$broadcast(u.CONTINUE_TO_CHANGE_RATE_PLAN,!0);r.checkEnhancementsOnAccomodation=!0,c.startTime=Date.now(),r.cantFind=!1,r.combinationError=!1,r.showCutOffError=!1,void 0!=document.getElementById("AccommodationsGridId")&&0!=document.getElementById("AccommodationsGridId").getElementsByClassName("AccommodationsGridId-errormsg").length&&(document.getElementById("AccommodationsGridId").classList.remove("AccommodationsGridId-errormsg"),document.getElementById("AccommodationsListId").classList.remove("AccommodationsGridId-errormsg")),r.code=r.code.toLowerCase();var l=r.codeType.toLowerCase(),g=!1;(v.checkGmsLogin()||R.getIsLoyaltyUserLogIn())&&(g=!0),o.validateCodes(O,l,r.code,g).then(function(g){a.getConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE")&&a.deleteConfig("ADD_ENHANCEMENT_AUTO_CHECKOUT_CREATE");var m=t.getRatePlanMerchandisedCurrencies(),u=a.getCurrencyDetails();if(g.data.ratePlanCurrency&&u&&u.currencyCode!=g.data.ratePlanCurrency&&-1!=m.indexOf(g.data.ratePlanCurrency)&&!n){var v=g.data.ratePlanCurrency;return void c.$broadcast("EVENT.UPDATE_CURRENCY_THROUGH_RATEACCESSCODE",v)}"corporate"==r.codeType.toLowerCase()&&(r.showCorpLoginLabel=!1,a.setSignInRequiredFlag(g.data.signInRequired)),a.setDisplayPromotions(!1),c.$broadcast("PROMOTIONS_DISPLAY_ON_BE"),"Group"===r.codeType&&a.dropPromotionForGroupCode();var R=document.getElementById("add-code-dropdown-id");if(R&&R.focus(),"Group"!=r.codeType){var f=r.codeType+"--"+r.code;p.eventTrack("ClickAddCode",{category:"UserNavigation",label:f})}if(!z&&"Group"===r.codeType){var C=g.data.groupRules.cutoffDate,P=g.data.endDate,A=moment.utc().utcOffset(60*t.getTimeZone().gmtOffset);if(A=moment.utc(A).format("YYYY-MM-DD"),!0===g.data.groupRules.elasticInventory&&A>P||!1===g.data.groupRules.elasticInventory&&A>C)return r.showCutOffError=!0,r.alertVariable=!1,h(function(){r.alertVariable=!0},50),r.code=void 0,void 0!=document.getElementById("AccommodationsGridId")&&(document.getElementById("AccommodationsGridId").classList.add("AccommodationsGridId-errormsg"),document.getElementById("AccommodationsListId").classList.add("AccommodationsGridId-errormsg")),!1;r.showGroupModal="display-block",setTimeout(function(){y.onModalOpen("","group-splash-parent-id","group-splash-title-id",!1,r.closeGSplashPopup)}),c.displayPromo="none",!0===t.getHotelDesc().uxConfiguration.accomodationsConfig.enableCarouselAutoScroll?r.myInterval=2500:r.myInterval=0,r.noWrapSlides=!1,s.scrollTopAnimated(-35,1e3),c.MRB&&(c.roominContext=!1),0==t.getOccupancyInfo().familyPricingEnabled&&(a.setConfig("GROUP_FPDISABLED"),a.removeChildrenAndInfants(),c.$broadcast("EVENT.EMPTY_CHILDREN_DROPDOWN"),e.debug(JSON.stringify(a.getMainReservation())+"after remove group")),1==c.MRB&&"guestsandrooms"!=i.current.name&&a.setConfig("CHANGE_OCCUPANTS");var b=a.getLanguage();o.getGSplashDetails(O,l,r.code,b).then(function(e){var t="Group--"+e.data.groupId;p.eventTrack("ClickAddCode",{category:"UserNavigation",label:t}),r.gSplashDetails=e.data,r.gSplashCutOffDate=moment.utc(r.gSplashDetails.groupRules.cutoffDate),r.gSplashCutOffDate=r.gSplashCutOffDate.format("ddd, DD MMM YYYY"),r.gSplashLatestCheckoutDate=moment.utc(r.gSplashDetails.groupRules.latestCheckoutDate),r.gSplashLatestCheckoutDate=r.gSplashLatestCheckoutDate.format("ddd, DD MMM YYYY"),r.gSplashEndDate=moment.utc(r.gSplashDetails.endDate),r.gSplashEndDate=r.gSplashEndDate.format("ddd, DD MMM YYYY"),r.gSplashStartDate=moment.utc(r.gSplashDetails.startDate),r.gSplashStartDate=r.gSplashStartDate.format("ddd, DD MMM YYYY"),r.gSplashEarliestCheckInDate=moment.utc(r.gSplashDetails.groupRules.earliestCheckInDate),r.gSplashEarliestCheckInDate=r.gSplashEarliestCheckInDate.format("ddd, DD MMM YYYY"),void 0!=e.data.groupRules&&(c.hidePriceFromAttendees=e.data.groupRules.hidePriceFromAttendees),r.slides=r.gSplashDetails.media,a.setGroup(e.data),d.setUserTiming("Interaction","CodeWIdget"),c.$broadcast("EVENT.RES_SELECTION_CHANGE_GROUP"),T()})}if(void 0!=a.getCodeTypes()){e.debug("enter the validateTAPromoDiscount success function");var D=a.getCodeTypes().length;for(S=0;S<a.getCodeTypes().length;S++)console.error("for loop"),z?(F(),B(),x(),w(),U()):(H(),V(),$(),q()),S+1==D&&(console.error(S),console.error(a.getCodeTypes().length),Y(),e.info(I+"this is flag"))}j(),0==r.combinationError?(r.toggle=!1,r.addBorder="",r.addError=""):r.toggle=!0,r.placeHolder=!0,"discount"===r.codeType.toLowerCase()&&i.includes("accommodation")&&a.setConfig("RES_CHANGED_AFTER_ADD_REMOVE_CODE"),r.codeType=r.codeTypes[0].name,r.setSelectedItem(r.codeTypes[0]),r.code=void 0},function(a){e.debug(a.status+"this status in error function"),e.debug("enter the validateTAPromoDiscount error function"),r.addError="1px solid red",r.addBorder="1px solid #ccc",1==r.combinationError&&(r.combinationError=!1),r.cantFind=!0,r.alertVariable=!1,h(function(){r.alertVariable=!0},50),r.code=void 0})}else r.addError="1px solid red",r.addBorder="1px solid #ccc",1==r.combinationError&&(r.combinationError=!1),r.cantFind=!0,r.alertVariable=!1,h(function(){r.alertVariable=!0},50)},r.$on("EVENT.REVIEW_GRP_DETAILS",function(n,i){r.reviewGroupDetails=!0,r.showGroupModal="display-block",setTimeout(function(){y.onModalOpen("","group-splash-parent-id","group-splash-title-id",!1,r.closeGSplashPopup)}),!0===t.getHotelDesc().uxConfiguration.accomodationsConfig.enableCarouselAutoScroll?r.myInterval=2500:r.myInterval=0,r.noWrapSlides=!1,s.scrollTopAnimated(-35,1e3),e.debug(a.getAllCode()+"  allcode funciton"),a.getAllCode()&&(void 0!=a.getAllCode().group?r.code=a.getAllCode().group:r.code=a.getAllCode().Group),e.debug(JSON.stringify(a.getAllCode().group)+"  get allcode function"),e.debug(r.code+"  code number");var l=a.getLanguage();o.getGSplashDetails(O,"Group",r.code,l).then(function(t){e.debug(JSON.stringify(t)+"response"),r.gSplashDetails=t.data,void 0!=t.data.groupRules&&(c.hidePriceFromAttendees=t.data.groupRules.hidePriceFromAttendees),r.gSplashCutOffDate=moment.utc(r.gSplashDetails.groupRules.cutoffDate),r.gSplashCutOffDate=r.gSplashCutOffDate.format("ddd, DD MMM YYYY"),r.gSplashLatestCheckoutDate=moment.utc(r.gSplashDetails.groupRules.latestCheckoutDate),r.gSplashLatestCheckoutDate=r.gSplashLatestCheckoutDate.format("ddd, DD MMM YYYY"),r.gSplashEndDate=moment.utc(r.gSplashDetails.endDate),r.gSplashEndDate=r.gSplashEndDate.format("ddd, DD MMM YYYY"),r.gSplashStartDate=moment.utc(r.gSplashDetails.startDate),r.gSplashStartDate=r.gSplashStartDate.format("ddd, DD MMM YYYY"),r.gSplashEarliestCheckInDate=moment.utc(r.gSplashDetails.groupRules.earliestCheckInDate),r.gSplashEarliestCheckInDate=r.gSplashEarliestCheckInDate.format("ddd, DD MMM YYYY"),r.slides=r.gSplashDetails.media,a.setGroup(t.data),d.setUserTiming("Interaction","CodeWIdget"),T()}),r.bookNowBtn=!1}),r.cancelAdd=function(){r.toggle=!1,r.cantFind=!1;var e=document.getElementById("add-code-dropdown-id");e&&e.focus(),r.code=void 0,r.codeType=r.codeTypes[0].name,r.setSelectedItem(r.codeTypes[0]),r.addError="",r.combinationError=!1,r.showCutOffError=!1,void 0!=document.getElementById("AccommodationsGridId")&&0!=document.getElementById("AccommodationsGridId").getElementsByClassName("AccommodationsGridId-errormsg").length&&(document.getElementById("AccommodationsGridId").classList.remove("AccommodationsGridId-errormsg"),document.getElementById("AccommodationsListId").classList.remove("AccommodationsGridId-errormsg")),l.clear()},c.$on("CancelAddCode",function(){r.toggle=!1,r.cantFind=!1,r.code=void 0,r.codeType=r.codeTypes[0].name,r.setSelectedItem(r.codeTypes[0]),r.addError="",r.combinationError=!1,r.showCutOffError=!1,void 0!=document.getElementById("AccommodationsGridId")&&0!=document.getElementById("AccommodationsGridId").getElementsByClassName("AccommodationsGridId-errormsg").length&&(document.getElementById("AccommodationsGridId").classList.remove("AccommodationsGridId-errormsg"),document.getElementById("AccommodationsListId").classList.remove("AccommodationsGridId-errormsg")),l.clear()});var J=function(){if(c.accommodations=!1,n.navToggle.accommodationSelected=!1,void 0!=c.navData.accommodations&&void 0!=c.navData.accommodations.group)var e=c.navData.accommodations.group[0];a.deleteGroupCode(e),n.stepsById.accommodations={id:"accommodations",label:"Accommodations",placeholder:"Select",placeholderMRB:n.stepsById.accommodations.placeholderMRB,className:"Header-step--extended",rooms:[]},a.revertAccommadationRooms(),a.revertServices()};r.continueDeleteGroup=function(){J(),"display-block"==r.deleteGroup&&y.onModalClose(),r.deleteGroup="display-none",c.$broadcast("EVENT.CONFIRM_DELETE_ROOM"),"datesofstay"==i.current.name?i.go(".",{},{reload:!0}):"guestsandrooms"!=i.current.name&&i.go("datesofstay"),a.getCodeTypes()&&!(a.getCodeTypes().length<=0)||a.getPromotionInContext()||v.checkGmsLogin()||(a.setDisplayPromotions(!0),c.$broadcast("PROMOTIONS_DISPLAY_ON_BE"))},r.cancelDeleteGroup=function(){r.deleteGroup="display-none",y.onModalClose()},r.remove=function(t,o){var n=a.getCodeTypes()[t];if(e.debug(n),r.checkEnhancementsOnAccomodation&&"group"!==n.toLowerCase()&&"discount"!==n.toLowerCase()&&i.includes("accommodation"))return W=o,K=t,void c.$broadcast(u.CONTINUE_TO_CHANGE_RATE_PLAN,!1);"discount"===n.toLowerCase()&&i.includes("accommodation")&&a.setConfig("RES_CHANGED_AFTER_ADD_REMOVE_CODE"),r.checkEnhancementsOnAccomodation=!0;var s=document.getElementById("add-code-dropdown-id");if(s&&s.focus(),e.debug(t),r.groupCannotRemoved=!1,a.canModifyReservation()){if("group"==n.toLowerCase())return r.groupCannotRemoved=!0,r.alertVariable=!1,h(function(){r.alertVariable=!0},50),!1;"discount"==n.toLowerCase()?a.removeDiscountCode():a.removeOtherCode(n.toLowerCase())}else{if("group"==n.toLowerCase())return c.$broadcast("EVENT.DELETE_GROUP"),!1;"discount"==n.toLowerCase()?a.removeDiscountCode():a.removeOtherCode(n.toLowerCase())}r.codes.splice(t,1),a.deleteAllCodeByKey(a.getCodeTypes()[t]),a.deleteCodeTypeByIndex(t),a.getCodeTypes().length<=0&&1!=r.showCorpLoginLabel&&(r.placeHolder=!1),o.stopPropagation(),a.getCodeTypes()&&!(a.getCodeTypes().length<=0)||a.getPromotionInContext()||v.checkGmsLogin()||"group"==n||(a.setDisplayPromotions(!0),c.$broadcast("PROMOTIONS_DISPLAY_ON_BE")),"corporate"==n.toLowerCase()&&(v.checkGmsLogin()||R.getIsLoyaltyUserLogIn())&&""!=c.gmsPromoCode&&c.hidePublicRates&&_()},r.removePrivateOffersCode=function(){r.showCorpLoginLabel=!1,c.gmsPromoCode="",c.hidePublicRates=!1,v.checkGmsLogin()&&c.$broadcast(u.RES_SELECTION_CHANGE),(void 0==a.getCodeTypes()||void 0!=a.getCodeTypes()&&a.getCodeTypes().length<=0)&&(r.placeHolder=!1)},r.$on("EVENT.DELETED_GROUP",function(e,t){c.MRB&&(a.reverMainReservationArrayAfterAddGroupCode(),i.go("guestsandrooms")),y.onModalClose(),r.showGroupModal="display-none",a.getCodeTypes().length<=0&&(r.placeHolder=!1),N()}),c.$on("EVENT.GMS_OPENED",function(){r.showGroupModal="display-none",r.deleteGroup="display-none"}),r.closeGSplashPopup=function(){if(r.reviewGroupDetails)y.onModalClose(),r.showGroupModal="display-none";else{r.groupCannotRemoved=!1;var t=a.getCodeTypes();e.debug(t);if(a.canModifyReservation()){if("group"==t[0].toLowerCase())return y.onModalClose(),r.showGroupModal="display-none",!1}else if(t&&"group"==t[0].toLowerCase())return y.onModalClose(),r.showGroupModal="display-none",c.$broadcast("EVENT.DELETE_GROUP"),!1;a.deleteAllCodeByKey(a.getCodeTypes()),a.deleteCodeTypeByIndex(),a.getCodeTypes().length<=0&&(r.placeHolder=!1),e.debug(a.getMainReservation()),y.onModalClose(),r.showGroupModal="display-none"}},r.bookGSplash=function(){if(c.MRB&&(a.getMainReservationArray().length>1||a.getInitOptionsArrays().length>1||void 0!=c.initArrays&&c.initArrays.length>1))1!=a.getConfig("Manager_URL_Group_Splash")?(a.deleteConfig("FIRST_TIME_LAND_CALENDAR"),a.reverMainReservationArrayAfterAddGroupCode()):a.deleteConfig("Manager_URL_Group_Splash"),r.showGroupModal="display-none",y.onModalClose(),"guestsandrooms"==i.current.name?i.go(".",{},{reload:!0}):i.go("guestsandrooms");else{if(c.MRB&&a.getMainReservationArray().length>1&&c.enabelRoomSelector&&(a.deleteConfig("FIRST_TIME_LAND_CALENDAR"),a.reverMainReservationArrayAfterAddGroupCode()),"datesofstay"==i.current.name)r.showGroupModal="display-none",y.onModalClose(),i.go(".",{},{reload:!0});else{if(i.current.name.indexOf("accommodation.")>=0){var t=a.buildOptions(),n=a.getAllCode();void 0!=n&&Object.keys(n).length>0&&(t.allCodes=n),o.getBasicAvail(t,a.getMainReservationArray(),a.getMainReservation(),c.MRB,a.getConfig("FIRST_TIME_LAND_CALENDAR"),!1,a.getSupplementalObj(),a.getloyaltyReqParams()).getAllDates().then(function(e){if(a.resetLoyaltyParams(e),e){
var o=e.dates,n=moment.utc(t.dateIn),s=moment.utc(t.dateOut),l=moment().range(n,s),c=!0;l.by("days",function(e){var a=e.format("YYYY-MM-DD"),t=m("filter")(o,{date:a.toString()});t&&t[0]&&(t[0].isAvailable||(c=!1))}),r.showGroupModal="display-none",y.onModalClose(),c?i.go(".",{},{reload:!0}):i.go("datesofstay")}})}else i.go("datesofstay"),r.showGroupModal="display-none",y.onModalClose()}"guestsandrooms"==i.current.name&&(0==r.errorAge?(e.debug(r.errorAge+"error age flag"),i.go("datesofstay"),r.showGroupModal="display-none",y.onModalClose()):(i.go("guestsandrooms"),r.showGroupModal="display-none",y.onModalClose()))}},void 0!=a.getConfig("GROUP_SPlASH")&&(void 0!==c.GDPREnabled&&E||void 0===c.GDPREnabled&&!E)&&1==a.getConfig("GROUP_SPlASH")&&f.executeAfterCookieBanner().then(function(){r.showGroupModal="display-block",setTimeout(function(){y.onModalOpen("","group-splash-parent-id","group-splash-title-id",!1,r.closeGSplashPopup)}),!0===t.getHotelDesc().uxConfiguration.accomodationsConfig.enableCarouselAutoScroll?r.myInterval=2500:r.myInterval=0,r.noWrapSlides=!1,r.codeType="Group";var e=a.getMainReservation().posSource.requestorIds[0];r.code=void 0!=e?a.getMainReservation().posSource.requestorIds[0].id:r.codes[0];var n=r.code.toLowerCase(),i=r.codeType.toLowerCase(),s=a.getLanguage();o.getGSplashDetails(O,i,n,s).then(function(e){r.gSplashDetails=e.data,void 0!=e.data.groupRules&&(c.hidePriceFromAttendees=e.data.groupRules.hidePriceFromAttendees),r.gSplashCutOffDate=moment.utc(r.gSplashDetails.groupRules.cutoffDate),r.gSplashCutOffDate=r.gSplashCutOffDate.format("ddd, DD MMM YYYY"),r.gSplashLatestCheckoutDate=moment.utc(r.gSplashDetails.groupRules.latestCheckoutDate),r.gSplashLatestCheckoutDate=r.gSplashLatestCheckoutDate.format("ddd, DD MMM YYYY"),r.gSplashEndDate=moment.utc(r.gSplashDetails.endDate),r.gSplashEndDate=r.gSplashEndDate.format("ddd, DD MMM YYYY"),r.gSplashStartDate=moment.utc(r.gSplashDetails.startDate),r.gSplashStartDate=r.gSplashStartDate.format("ddd, DD MMM YYYY"),r.gSplashEarliestCheckInDate=moment.utc(r.gSplashDetails.groupRules.earliestCheckInDate),r.gSplashEarliestCheckInDate=r.gSplashEarliestCheckInDate.format("ddd, DD MMM YYYY"),r.slides=r.gSplashDetails.media,a.setGroup(e.data),d.setUserTiming("Interaction","CodeWIdget"),c.$broadcast("EVENT.RES_SELECTION_CHANGE_GROUP"),T()}),a.deleteConfig("GROUP_SPlASH"),j(),r.placeHolder=!0,r.code=void 0}),r.$on(u.GDPR_SELECTED,function(){if(void 0!=a.getConfig("GROUP_SPlASH")&&1==a.getConfig("GROUP_SPlASH")){r.showGroupModal="display-block",setTimeout(function(){y.onModalOpen("","group-splash-parent-id","group-splash-title-id",!1,r.closeGSplashPopup)}),!0===t.getHotelDesc().uxConfiguration.accomodationsConfig.enableCarouselAutoScroll?r.myInterval=2500:r.myInterval=0,r.noWrapSlides=!1,r.codeType="Group";var e=a.getMainReservation().posSource.requestorIds[0];r.code=void 0!=e?a.getMainReservation().posSource.requestorIds[0].id:r.codes[0];var n=r.code.toLowerCase(),i=r.codeType.toLowerCase(),s=a.getLanguage();o.getGSplashDetails(O,i,n,s).then(function(e){r.gSplashDetails=e.data,r.gSplashCutOffDate=moment.utc(r.gSplashDetails.groupRules.cutoffDate),r.gSplashCutOffDate=r.gSplashCutOffDate.format("ddd, DD MMM YYYY"),r.gSplashLatestCheckoutDate=moment.utc(r.gSplashDetails.groupRules.latestCheckoutDate),r.gSplashLatestCheckoutDate=r.gSplashLatestCheckoutDate.format("ddd, DD MMM YYYY"),r.gSplashEndDate=moment.utc(r.gSplashDetails.endDate),r.gSplashEndDate=r.gSplashEndDate.format("ddd, DD MMM YYYY"),r.gSplashStartDate=moment.utc(r.gSplashDetails.startDate),r.gSplashStartDate=r.gSplashStartDate.format("ddd, DD MMM YYYY"),r.gSplashEarliestCheckInDate=moment.utc(r.gSplashDetails.groupRules.earliestCheckInDate),r.gSplashEarliestCheckInDate=r.gSplashEarliestCheckInDate.format("ddd, DD MMM YYYY"),r.slides=r.gSplashDetails.media,a.setGroup(e.data),d.setUserTiming("Interaction","CodeWIdget"),c.$broadcast("EVENT.RES_SELECTION_CHANGE_GROUP"),T()}),a.deleteConfig("GROUP_SPlASH"),r.groupExist||j(),r.placeHolder=!0,r.code=void 0}}),r.keyDown=function(e){var a,t=e.keyCode;if(38==t){for(var o=0;o<r.codeTypes.length;o++)if(console.log(r.codeTypes[o]),r.codeType==r.codeTypes[o].name){a=o;break}0==a||r.setSelectedItem(r.codeTypes[a-1]),setTimeout(function(){var e=document.getElementById("id-special-code-dropdown-id");if(e){var t=r.codeTypes[a-1].language;e.setAttribute("aria-label",t),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-hidden",!1),e.innerHTML="";var o=document.createTextNode(t);e.appendChild(o),setTimeout(function(){e.setAttribute("aria-hidden",!0)},500)}}),e.preventDefault()}else if(40==t){for(var o=0;o<r.codeTypes.length;o++)if(r.codeType==r.codeTypes[o].name){a=o;break}a==r.codeTypes.length-1||r.setSelectedItem(r.codeTypes[a+1]),setTimeout(function(){var e=document.getElementById("id-special-code-dropdown-id");if(e){var t=r.codeTypes[a+1].language;e.setAttribute("aria-label",t),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-hidden",!1),e.innerHTML="";var o=document.createTextNode(t);e.appendChild(o),setTimeout(function(){e.setAttribute("aria-hidden",!0)},500)}}),e.preventDefault()}},r.$on("EVENT.COSMO_SPECIALCODES_LOGIN_LABEL",function(){_()}),r.$on("EVENT.COSMO_SPECIALCODES_REMOVE_LABEL",function(){r.removePrivateOffersCode()}),r.$on("EVENT.SPECIALCODES_REMOVE_MANUAL_LABEL_AFTER_LOGOUT",function(){k()})}}}angular.module("TravelClApp").directive("tcSpecialCodes",["$log","reservationService","hotelFactory","apiFactory","$http","navDataFactory","$state","$document","toaster","$rootScope","commonFactory","$window","$filter","EVENT","$analytics","accessibilityService","gmsService","$timeout","loyaltyPointsService","cookieConsentService",e])}(),angular.module("TravelClApp").controller("TotalController",["$timeout","$log","$rootScope","$scope","$state","$q","reservationService","commonFactory","hotelFactory","$filter","apiFactory","toaster","$document","$window","navDataFactory","EVENT","lodash","CacheFactory","gmsService","$analytics","$sce","accessibilityService","loyaltyPointsService","voucherPaymentService","tokenService","myCheckWalletService","menubarService","enhancementsService","cookieConsentService","memberRateService","audienceEvaluatorService","paymentComponentService","insuranceService",TotalController]),angular.module("TravelClApp").directive("totalRoomDetail",totalRoomDetail).directive("totalRoomDetailMrb",["reservationService","$filter","commonFactory","$analytics",totalRoomDetailMrb]).directive("totalReservation",["reservationService","apiFactory","hotelFactory","$filter","commonFactory","EVENT","$analytics","$document","$rootScope","$state","loyaltyPointsService","lodash",totalReservation]).directive("packageInclusionDetail",["$state",packageInclusionDetail]).directive("totalGuestInfo",totalGuestInfo).directive("totalPaymentMethod",totalPaymentMethod).directive("customPositionBookNow",["$document","$window","$state","$rootScope",customPositionBookNow]).directive("ofacModalPopup",ofacModalPopup).directive("mycheckWalletInit",["$state","$rootScope","toaster","hotelFactory","myCheckWalletService",mycheckWalletInit]).directive("formOnChange",["$parse",updateBillingAddress]),angular.module("TravelClApp").filter("roundedTo",roundedTo).filter("adultsReservationFilter",adultsReservationFilter).filter("childrenReservationFilter",childrenReservationFilter).filter("infantsReservationFilter",infantsReservationFilter).filter("adultsFilterLowercase",["$rootScope","$filter","reservationService",adultsFilterLowercase]).filter("childrenFilterLowercase",["$rootScope","$filter","reservationService",childrenFilterLowercase]).filter("infantsFilterLowercase",["$rootScope","$filter","reservationService",infantsFilterLowercase]).filter("roomsFilterLowercase",["$rootScope","$filter","reservationService",roomsFilterLowercase]).filter("nightsFilterLowercase",["$rootScope",nightsFilterLowercase]);