1function _createForOfIteratorHelper(e,t){var a,n,i,r,s="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(s)return i=!(n=!0),{s:function(){s=s.call(e)},n:function(){var e=s.next();return n=e.done,e},e:function(e){i=!0,a=e},f:function(){try{n||null==s.return||s.return()}finally{if(i)throw a}}};if(Array.isArray(e)||(s=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length)return s&&(e=s),r=0,{s:t=function(){},n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var a;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(a="Object"===(a={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:a)||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=Array(t);a<t;a++)n[a]=e[a];return n}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}(A=>{A(function(){MPHB.calendarHelper={ROOM_STATUS_AVAILABLE:"available",ROOM_STATUS_NOT_AVAILABLE:"not-available",ROOM_STATUS_BOOKED:"booked",ROOM_STATUS_PAST:"past",ROOM_STATUS_EARLIER_MIN_ADVANCE:"earlier-min-advance",ROOM_STATUS_LATER_MAX_ADVANCE:"later-max-advance",ROOM_STATUS_BOOKING_BUFFER:"booking-buffer",getCalendarDateAttributesFromAvailability:function(e,t,a,n){var i,r,s,o,l,c,h,d,m,u,p,y,f,b,_,k,g,C,v,S,D=4<arguments.length&&void 0!==arguments[4]&&arguments[4],P=5<arguments.length&&void 0!==arguments[5]?arguments[5]:null,M=6<arguments.length&&void 0!==arguments[6]?arguments[6]:null,w=7<arguments.length&&void 0!==arguments[7]?arguments[7]:null,H=8<arguments.length&&void 0!==arguments[8]?arguments[8]:null,B=9<arguments.length&&void 0!==arguments[9]?arguments[9]:null,I={selectable:!1,dateClass:"mphb-date-cell",title:""};return a?void 0!==(i=n[A.datepick.formatDate("yyyy-mm-dd",t)])&&0!==Object.keys(i).length&&i.hasOwnProperty("roomTypeStatus")&&((h=new Date(t.getTime())).setDate(h.getDate()-1),r=void 0!==(h=n[A.datepick.formatDate("yyyy-mm-dd",h)])&&h.hasOwnProperty("roomTypeStatus")&&MPHB.calendarHelper.ROOM_STATUS_AVAILABLE===h.roomTypeStatus,s=void 0!==h&&h.hasOwnProperty("roomTypeStatus")&&MPHB.calendarHelper.ROOM_STATUS_PAST===h.roomTypeStatus,o=void 0!==h&&h.hasOwnProperty("roomTypeStatus")&&MPHB.calendarHelper.ROOM_STATUS_NOT_AVAILABLE===h.roomTypeStatus,l=void 0!==h&&h.hasOwnProperty("isCheckInNotAllowed")&&h.isCheckInNotAllowed,c=void 0!==h&&h.hasOwnProperty("isStayInNotAllowed")&&h.isStayInNotAllowed,h=o&&!c&&void 0!==h&&h.hasOwnProperty("availableRoomsCount")&&0<h.availableRoomsCount,(d=new Date(t.getTime())).setDate(t.getDate()+1),d=void 0!==(n=n[A.datepick.formatDate("yyyy-mm-dd",d)])&&n.hasOwnProperty("isStayInNotAllowed")&&n.isStayInNotAllowed,m=void 0!==n&&n.hasOwnProperty("isCheckOutNotAllowed")&&n.isCheckOutNotAllowed,n=(u=void 0!==n&&n.hasOwnProperty("roomTypeStatus")&&MPHB.calendarHelper.ROOM_STATUS_NOT_AVAILABLE===n.roomTypeStatus)&&!d&&void 0!==n&&n.hasOwnProperty("availableRoomsCount")&&0<n.availableRoomsCount,p=MPHB.calendarHelper.ROOM_STATUS_NOT_AVAILABLE===i.roomTypeStatus,S=!(MPHB.calendarHelper.ROOM_STATUS_BOOKED!==i.roomTypeStatus||i.hasOwnProperty("isCheckInDate")&&i.isCheckInDate||i.hasOwnProperty("isCheckOutDate")&&i.isCheckOutDate),y=i.hasOwnProperty("isCheckInDate")&&i.isCheckInDate,f=i.hasOwnProperty("isCheckOutDate")&&i.isCheckOutDate,b=i.hasOwnProperty("isStayInNotAllowed")&&i.isStayInNotAllowed,_=i.hasOwnProperty("isCheckInNotAllowed")&&i.isCheckInNotAllowed,k=i.hasOwnProperty("isCheckOutNotAllowed")&&i.isCheckOutNotAllowed,g=i.hasOwnProperty("isEarlierThanMinAdvanceDate")&&i.isEarlierThanMinAdvanceDate,C=i.hasOwnProperty("isLaterThanMaxAdvanceDate")&&i.isLaterThanMaxAdvanceDate,v=p&&!b&&i.hasOwnProperty("availableRoomsCount")&&
10<i.availableRoomsCount,MPHB.calendarHelper.ROOM_STATUS_PAST===i.roomTypeStatus?(I.dateClass+=" mphb-past-date",I.isPastDate=!0):(MPHB.calendarHelper.ROOM_STATUS_AVAILABLE===i.roomTypeStatus?I.dateClass+=" mphb-available-date":MPHB.calendarHelper.ROOM_STATUS_NOT_AVAILABLE===i.roomTypeStatus?I.dateClass+=" mphb-not-available-date":MPHB.calendarHelper.ROOM_STATUS_BOOKED===i.roomTypeStatus&&(I.dateClass+=" mphb-booked-date"),y?I.dateClass+=" mphb-date-check-in":f&&(I.dateClass+=" mphb-date-check-out",MPHB.calendarHelper.ROOM_STATUS_EARLIER_MIN_ADVANCE!==i.roomTypeStatus&&MPHB.calendarHelper.ROOM_STATUS_LATER_MAX_ADVANCE!==i.roomTypeStatus||(I.dateClass+=" mphb-booked-date mphb-available-date"))),b&&(I.dateClass+=" mphb-not-stay-in-date"),v&&k?(1===e?I.dateClass+=" mphb-out-of-season-date":2===e?I.dateClass+=" mphb-not-check-in-date":3===e&&(I.dateClass+=" mphb-not-check-out-date"),I.isUnavailable=!0):((r&&v&&!k||f&&v||n&&m&&_)&&(1===e?I.dateClass+=" mphb-out-of-season-date--check-in":2===e&&(I.dateClass+=" mphb-not-check-in-date"),I.isUnavailableCheckIn=!0),h&&k&&(1===e?I.dateClass+=" mphb-out-of-season-date--check-out":3===e&&(I.dateClass+=" mphb-not-check-out-date"),I.isUnavailableCheckOut=!0)),p&&!b&&!v&&(!r||l)||S||c&&y||f&&b||b&&k?(1===e?I.dateClass+=" mphb-mark-as-unavailable":2===e?I.dateClass+=" mphb-not-check-in-date":3===e&&(I.dateClass+=" mphb-not-check-out-date"),I.isUnavailable=!0):((b||y||g&&1!==e||C&&1!==e||_&&2===e||_&&d&&m||_&&u&&!v&&!n&&!d||p&&r&&!v&&!l)&&(1===e?I.dateClass+=" mphb-mark-as-unavailable--check-in":2===e&&(I.dateClass+=" mphb-not-check-in-date"),I.isUnavailableCheckIn=!0),(f||k&&3===e||c&&k||s&&k||o&&k&&!h)&&(1===e?I.dateClass+=" mphb-mark-as-unavailable--check-out":3===e&&(I.dateClass+=" mphb-not-check-out-date"),I.isUnavailableCheckOut=!0)),I.title="",S=[],MPHB.calendarHelper.ROOM_STATUS_PAST===i.roomTypeStatus?I.title=MPHB._data.translations.past:(MPHB.calendarHelper.ROOM_STATUS_AVAILABLE===i.roomTypeStatus&&(I.title=MPHB._data.translations.available+" ("+(i.hasOwnProperty("availableRoomsCount")?i.availableRoomsCount:"undefined")+")"),MPHB.calendarHelper.ROOM_STATUS_NOT_AVAILABLE===i.roomTypeStatus&&(I.title=MPHB._data.translations.notAvailable),MPHB.calendarHelper.ROOM_STATUS_BOOKED===i.roomTypeStatus&&(I.title=MPHB._data.translations.booked),MPHB.calendarHelper.ROOM_STATUS_EARLIER_MIN_ADVANCE!==i.roomTypeStatus&&MPHB.calendarHelper.ROOM_STATUS_LATER_MAX_ADVANCE!==i.roomTypeStatus||(I.title=MPHB._data.translations.notAvailable),MPHB.calendarHelper.ROOM_STATUS_NOT_AVAILABLE!==i.roomTypeStatus&&MPHB.calendarHelper.ROOM_STATUS_BOOKED!==i.roomTypeStatus||3!==e||k||(I.title=MPHB._data.translations.available),b&&3!==e&&S.push(MPHB._data.translations.notStayIn),!g&&MPHB.calendarHelper.ROOM_STATUS_EARLIER_MIN_ADVANCE!==i.roomTypeStatus||S.push(MPHB._data.translations.earlierMinAdvance),!C&&MPHB.calendarHelper.ROOM_STATUS_LATER_MAX_ADVANCE!==i.roomTypeStatus||S.push(MPHB._data.translations.laterMaxAdvance),_&&3!==e&&S.push(MPHB._data.translations.notCheckIn),k&&2!==e&&S.push(MPHB._data.translations.notCheckOut)),S.length&&(I.title+="\n"+MPHB._data.translations.rules+" "+S.join(", ")),D&&i.hasOwnProperty("price")&&(I.content=t.getDate()+'<span class="mphb-date-cell__price">'+i.price+"</span>"),2===e?!a||I.isPastDate||I.isUnavailable||I.isUnavailableCheckIn?I.dateClass+=" mphb-unselectable-date":(I.selectable=!0,I.dateClass+=" mphb-selectable-date"):3===e&&(a&&(null!==P&&MPHB.Utils.formatDateToCompare(t)===MPHB.Utils.formatDateToCompare(P)&&(I.title+=" "+MPHB._data.translations.checkInDate,I.dateClass+=" mphb-check-in-date"),null!==M&&M.getTime()>t.getTime()&&(I.title+="\n"+MPHB._data.translations.lessThanMinDaysStay,I.dateClass+=" mphb-earlier-min-date"),null!==w)&&w.getTime()<t.getTime()&&(I.title+="\n"+MPHB._data.translations.moreThanMaxDaysStay,I.dateClass+=" mphb-later-max-date"),(null===H||H.getTime()<=t.getTime())&&(null===B||B.getTime()>=t.getTime())&&!I.isUnavailableCheckOut&&!I.isUnavailable?(I.selectable=!0,I.dateClass+=" mphb-selectable-date"):I.dateClass+=" mphb-unselectable-date")):I.dateClass+=" mphb-extra-date",I},calculateMinMaxCheckOutDateForSelection:function(e,t){var a=MPHB.Utils.cloneDate(e),n=A.datepick.formatDate("yyyy-mm-dd",a),i=null,r=!1,s=(a.setHours(12,0,0,0),null),o=null,l=null,c=null;if(void 0===(i=t[n])||0===Object.keys(i).length||!i.hasOwnProperty("roomTypeStatus"))return{minStayDateAfterCheckIn:null,maxStayDateAfterCheckIn:null,minCheckOutDateForSelection:null,maxCheckOutDateForSelection:null};for(i.hasOwnProperty("minStayNights")&&(a.setDate(a.getDate()+i.minStayNights),a.setHours(23,59,59,999),n=A.datepick.formatDate("yyyy-mm-dd",a),(s=MPHB.Utils.cloneDate(a)).setHours(0,0,0,1)),i.hasOwnProperty("maxStayNights")&&((o=MPHB.Utils.cloneDate(e)).setDate(o.getDate()+i.maxStayNights),o.setHours(23,59,59,999));void 0!==(i=t[n])&&0!==Object.keys(i).length&&i.hasOwnProperty("roomTypeStatus")&&(MPHB.calendarHelper.ROOM_STATUS_PAST===i.roomTypeStatus||MPHB.calendarHelper.ROOM_STATUS_EARLIER_MIN_ADVANCE===i.roomTypeStatus||i.hasOwnProperty("isCheckOutNotAllowed")&&i.isCheckOutNotAllowed||(null===l&&(l=MPHB.Utils.cloneDate(a)),c=MPHB.Utils.cloneDate(a)),r=i.hasOwnProperty("roomTypeStatus")&&(!i.hasOwnProperty("isStayInNotAllowed")||!i.isStayInNotAllowed)&&(null===o||o.getTime()>a.getTime())&&MPHB.calendarHelper.ROOM_STATUS_BOOKED!==i.roomTypeStatus&&MPHB.calendarHelper.ROOM_STATUS_NOT_AVAILABLE!==i.roomTypeStatus,a.setDate(a.getDate()+1),n=A.datepick.formatDate("yyyy-mm-dd",a),r););return null!==l&&l.setHours(0,0,0,1),null!==c&&c.setHours(23,59,59,999),{minStayDateAfterCheckIn:s,maxStayDateAfterCheckIn:o,minCheckOutDateForSelection:l,maxCheckOutDateForSelection:c}}},can.Control("MPHB.Datepicker",{},{$datepickerInputElement:null,form:null,hiddenElement:null,roomTypeId:null,firstAvailableCheckInDate:null,init:function(e,t){this.$datepickerInputElement=e,this.form=t.form,this.roomTypeId=t.roomTypeId,this.firstAvailableCheckInDate=new Date(t.firstAvailableCheckInDateYmd);var e=this.element.attr("id")+"-hidden";this.hiddenElement=A("#"+e),this.hiddenElement.val()&&(t=A.datepick.parseDate(MPHB._data.settings.dateTransferFormat,this.hiddenElement.val()),e=A.datepick.formatDate(MPHB._data.settings.dateFormat,t),this.element.val(e)),this.initDatepick()},initDatepick:function(){var e={dateFormat:MPHB._data.settings.dateFormat,altFormat:MPHB._data.settings.dateTransferFormat,altField:this.hiddenElement,minDate:A.datepick.parseDate(MPHB._data.settings.dateTransferFormat,MPHB._data.today),monthsToShow:MPHB._data.settings.numberOfMonthDatepicker,firstDay:MPHB._data.settings.firstDay,pickerClass:MPHB._data.settings.datepickerClass,useMouseWheel:!1,showSpeed:0},e=A.extend(e,this.getDatepickSettings());this.element.datepick(e)},getDatepickSettings:function(){return{}},getDate:function(){var e=this.element.val(),t=null;try{t=A.datepick.parseDate(MPHB._data.settings.dateFormat,e)}catch(e){t=null}return t},getFormattedDate:function(e){void 0===e&&(e=MPHB._data.settings.dateFormat);var t=this.getDate();return t?A.datepick.formatDate(e,t):""},setDate:function(e){this.element.datepick("setDate",e)},getOption:function(e){return this.element.datepick("option",e)},setOption:function(e,t){this.element.datepick("option",e,t)},getMinDate:function(){var e=this.getOption("minDate");return null!==e&&""!==e?MPHB.Utils.cloneDate(e):null},getMaxDate:function(){var e=this.getOption("maxDate");return null!==e&&""!==e?MPHB.Utils.cloneDate(e):null},getMaxAdvanceDate:function(){var e=this.getOption("maxAdvanceDate");return e?MPHB.Utils.cloneDate(e):null},clear:function(){this.element.datepick("clear")},formatDate:function(e,t){return A.datepick.formatDate(t=void 0!==t?t:"yyyy-mm-dd",e)},lock:function(){A(".datepick-popup").addClass("mphb-loading")},unlock:function(){A(".datepick-popup").removeClass("mphb-loading")},refresh:function(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0];A.datepick._update(this.element[0],!0),e&&A.datepick._updateInput(this.element[0],!1)}}),MPHB.FlexsliderGallery=can.Control.extend({},{sliderEl:null,navSliderEl:null,groupId:null,init:function(e,t){this.sliderEl=e,this.groupId=e.data("group");
1var e=A('.mphb-gallery-thumbnail-slider[data-group="'+this.groupId+'"]'),a=(e.length&&(this.navSliderEl=e),this);A(window).on("load",function(){a.initSliders()}),"complete"==document.readyState&&this.initSliders()},initSliders:function(){var e,t;this.slidersLoaded||(e=this.sliderEl.data("flexslider-atts"),this.navSliderEl&&((t=this.navSliderEl.data("flexslider-atts")).asNavFor='.mphb-flexslider-gallery-wrapper[data-group="'+this.groupId+'"]',t.itemWidth=this.navSliderEl.find("ul > li img").width(),e.sync='.mphb-gallery-thumbnail-slider[data-group="'+this.groupId+'"]',this.navSliderEl.addClass("flexslider mphb-flexslider mphb-gallery-thumbnails-slider").flexslider(t)),this.sliderEl.addClass("flexslider mphb-flexslider mphb-gallery-slider").flexslider(e),this.slidersLoaded=!0)}}),MPHB.format_price=function(e,t){t=t||{};var a=MPHB._data.settings.currency,a=(t=A.extend({trim_zeros:!1},a,t),e=MPHB.number_format(e,t.decimals,t.decimal_separator,t.thousand_separator),t.price_format.replace("%s",e));return t.trim_zeros&&(e=new RegExp("\\"+t.decimal_separator+"0+$|(\\"+t.decimal_separator+"\\d*[1-9])0+$"),a=a.replace(e,"$1")),'<span class="mphb-price">'+a+"</span>"},MPHB.number_format=function(e,t,a,n){var i,r,s="";return t=t||0,a=a||".",n=n||",",e<0&&(s="-",e*=-1),3<(r=(i=parseInt(e=(+e||0).toFixed(t))+"").length)?r%=3:r=0,s+(r?i.substr(0,r)+n:"")+i.substr(r).replace(/(\d{3})(?=\d)/g,"$1"+n)+(t?a+Math.abs(e-i).toFixed(t).replace(/-/,0).slice(2):"")},MPHB.post=function(e,t,a){t=A.extend({action:e="mphb_"+e,mphb_nonce:MPHB._data.nonces[e],lang:MPHB._data.settings.currentLanguage},t);e=A.extend({url:MPHB._data.ajaxUrl,type:"POST",dataType:"json",data:t},a);return A.ajax(e)},MPHB.get_today_date=function(){return A.datepick.parseDate(MPHB._data.settings.dateTransferFormat,MPHB._data.today)},MPHB.TermsSwitcher=can.Construct.extend({},{init:function(e,t){var a=e.children(".mphb-terms-and-conditions");0<a.length&&e.find(".mphb-terms-and-conditions-link").on("click",function(e){e.preventDefault(),a.toggleClass("mphb-active")})}}),MPHB.Utils=can.Construct.extend({formatDateToCompare:function(e){return A.datepick.formatDate("yyyymmdd",e)},compareDates:function(e,t,a){e=MPHB.Utils.formatDateToCompare(e),t=MPHB.Utils.formatDateToCompare(t);if(null==a)return t<e?1:e<t?-1:0;switch(a){case">":return t<e;case">=":return t<=e;case"<":return e<t;case"<=":return e<=t;case"=":case"==":return e==t;case"!=":return e!=t;default:return!1}},cloneDate:function(e){return new Date(e.getTime())},arrayUnique:function(e){return e.filter(function(e,t,a){return a.indexOf(e)===t})},arrayMin:function(e){return Math.min.apply(null,e)},arrayMax:function(e){return Math.max.apply(null,e)},arrayDiff:function(e,t){return e.filter(function(e){return t.indexOf(e)<0})},inArray:function(e,t){return-1!==t.indexOf(e)}},{}),MPHB.Gateway=can.Construct.extend({},{amount:0,paymentFee:0,paymentFeeHtml:"",paymentDescription:"",paymentFields:{},mountWrapper:null,init:function(e,t){this.billingSection=t.billingSection,this.gatewayId=e,this.initSettings(t.settings)},initSettings:function(e){var t;this.amount=e.amount,this.paymentFee=null!=(t=e.paymentFee)?t:0,this.paymentFeeHtml=null!=(t=e.paymentFeeHtml)?t:"",this.paymentDescription=e.paymentDescription},afterProcessing:function(e){return Promise.resolve(null)},afterSelection:function(e){this.mountWrapper=e},canSubmit:function(e,t){return Promise.resolve(!0)},cancelSelection:function(){this.mountWrapper=null},getGatewayId:function(){return this.gatewayId},getPaymentField:function(e){e="mphb_"+this.getGatewayId()+"_"+e;return this.paymentFields[e]||""},getPaymentFields:function(){return this.paymentFields},hasPaymentField:function(e){return"mphb_"+this.getGatewayId()+"_"+e in this.paymentFields},onInput:function(e,t){},updateData:function(e){this.amount=e.amount,this.paymentFee=e.paymentFee,this.paymentFeeHtml=e.paymentFeeHtml,this.paymentDescription=e.paymentDescription},_setPaymentField:function(e,t){e="mphb_"+this.getGatewayId()+"_"+e;this.paymentFields[e]=t,null!==this.mountWrapper&&this.mountWrapper.find("#"+e).val(t)}}),MPHB.BillingSection=can.Control.extend({},{updateBillingFieldsTimeout:null,parentForm:null,billingFieldsWrapperEl:null,gateways:{},amounts:{},lastGatewayId:null,init:function(e,t){this.parentForm=t.form,this.billingFieldsWrapperEl=this.element.find(".mphb-billing-fields"),this.initGateways(t.gateways)},initGateways:function(e){var i=this;
1A.each(e,function(e,t){var a={billingSection:i,settings:t},n=null;try{switch(e){case"braintree":n=new MPHB.BraintreeGateway(e,a);break;case"beanstream":n=new MPHB.BeanstreamGateway(e,a);break;case"stripe":n=new("payment"===t.paymentMode?MPHB.StripeGateway:MPHB.StripeLegacyGateway)(e,a);break;default:n=new MPHB.Gateway(e,a)}}catch(e){console.error(e)}null!=n&&(i.gateways[e]=n,i.amounts[e]=t.amount)}),this.notifySelectedGateway()},isEmpty:function(){return 0===this.element.length},getBookingDetails:function(){return this.parentForm.parseFormToJSON()},getCheckoutForm:function(){return this.parentForm},getPaymentDetails:function(){var e=this.getSelectedGatewayId(),t=this.gateways[e];return{gateway_id:e,payment_fields:t?t.getPaymentFields():{}}},getRoomDetails:function(){return this.getBookingDetails().mphb_room_details||{}},getRoomTypeIds:function(){var e,t=this.getRoomDetails(),a=[];for(e in t){var n=parseInt(t[e].room_type_id);isNaN(n)||-1!=a.indexOf(n)||a.push(n)}return a},updateBillingInfo:function(e,t){var a=this,n=e.val();this.showPreloader(),this.billingFieldsWrapperEl.empty().addClass("mphb-billing-fields-hidden"),clearTimeout(this.updateBillingFieldsTimeout),this.updateBillingFieldsTimeout=setTimeout(function(){var e=a.getBookingDetails();A.ajax({url:MPHB._data.ajaxUrl,type:"GET",dataType:"json",data:{action:"mphb_get_billing_fields",mphb_nonce:MPHB._data.nonces.mphb_get_billing_fields,mphb_gateway_id:n,formValues:e,lang:MPHB._data.settings.currentLanguage},success:function(e){e.hasOwnProperty("success")?e.success?(a.lastGatewayId&&a.gateways[a.lastGatewayId].cancelSelection(),a.billingFieldsWrapperEl.html(e.data.fields),e.data.hasVisibleFields?a.billingFieldsWrapperEl.removeClass("mphb-billing-fields-hidden"):a.billingFieldsWrapperEl.addClass("mphb-billing-fields-hidden"),a.notifySelectedGateway(n)):a.showError(e.data.message):a.showError(MPHB._data.translations.errorHasOccured)},error:function(e){a.showError(MPHB._data.translations.errorHasOccured)},complete:function(e){a.hidePreloader()}})},500)},'[name="mphb_gateway_id"] change':function(e,t){this.updateBillingInfo(e,t)},hideErrors:function(){this.parentForm.hideErrors()},showError:function(e){this.parentForm.showError(e)},showPreloader:function(){this.parentForm.showPreloader()},hidePreloader:function(){this.parentForm.hidePreloader()},onInput:function(e,t){var a=this.getSelectedGateway();a&&a.onInput(e,t)},canSubmit:function(e,t){var a=this.getSelectedGateway();return a?a.canSubmit(e,t):Promise.resolve(!0)},afterProcessing:function(e){var t=this.getSelectedGateway();return null!==t?t.afterProcessing(e):Promise.resolve(null)},getSelectedGateway:function(){return this.gateways[this.getSelectedGatewayId()]||null},getSelectedGatewayId:function(){var e=this.getSelectedGatewayEl();return e&&0<e.length?e.val():""},getSelectedGatewayEl:function(){var e=this.element.find('[name="mphb_gateway_id"]');return 1==e.length?e:e.filter(":checked")},getSelectedGatewayAmount:function(){var e=this.getSelectedGatewayId();return this.amounts.hasOwnProperty(e)?this.amounts[e]:0},getSelectedGatewayPaymentFeeAmount:function(){var e=this.getSelectedGateway();return null!==e&&null!=(e=e.paymentFee)?e:0},getSelectedGatewayPaymentFeeHtml:function(){var e=this.getSelectedGateway();return null!==e&&null!=(e=e.paymentFeeHtml)?e:""},notifySelectedGateway:function(e){var t;(e=e||this.getSelectedGatewayId())&&this.gateways.hasOwnProperty(e)&&(this.gateways[e].afterSelection(this.billingFieldsWrapperEl),!1!==(t=this.parentForm.getCountry()))&&this.gateways[e].onInput("country",t),this.lastGatewayId=e},updateGatewaysData:function(e){var a=this;A.each(e,function(e,t){a.gateways.hasOwnProperty(e)&&a.gateways[e].updateData(t)})}}),MPHB.CouponSection=can.Control.extend({},{applyCouponTimeout:null,parentForm:null,appliedCouponEl:null,couponEl:null,messageHolderEl:null,init:function(e,t){this.parentForm=t.form,this.couponEl=e.find('[name="mphb_coupon_code"]'),this.appliedCouponEl=e.find('[name="mphb_applied_coupon_code"]'),this.messageHolderEl=e.find(".mphb-coupon-message")},".mphb-apply-coupon-code-button click":function(e,t){t.preventDefault(),t.stopPropagation(),this.clearMessage();var a,n=this.couponEl.val();n.length?(this.appliedCouponEl.val(""),(a=this).showPreloader(),clearTimeout(this.applyCouponTimeout),this.applyCouponTimeout=setTimeout(function(){var e=a.parentForm.parseFormToJSON();A.ajax({url:MPHB._data.ajaxUrl,type:"POST",dataType:"json",data:{action:"mphb_apply_coupon",mphb_nonce:MPHB._data.nonces.mphb_apply_coupon,mp
1hb_coupon_code:n,formValues:e,lang:MPHB._data.settings.currentLanguage},success:function(e){e.hasOwnProperty("success")?e.success?(a.parentForm.setCheckoutData(e.data),a.couponEl.val(""),a.appliedCouponEl.val(e.data.coupon.applied_code),a.showMessage(e.data.coupon.message)):a.showMessage(e.data.message):a.showMessage(MPHB._data.translations.errorHasOccured)},error:function(e){a.showMessage(MPHB._data.translations.errorHasOccured)},complete:function(e){a.hidePreloader()}})},500)):this.showMessage(MPHB._data.translations.emptyCouponCode)},removeCoupon:function(){this.appliedCouponEl.val(""),this.clearMessage()},showPreloader:function(){this.parentForm.showPreloader()},hidePreloader:function(){this.parentForm.hidePreloader()},clearMessage:function(){this.messageHolderEl.html("").addClass("mphb-hide")},showMessage:function(e){this.messageHolderEl.html(e).removeClass("mphb-hide")}}),MPHB.CheckoutForm=can.Control.extend({myThis:null},{priceBreakdownTableEl:null,bookBtnEl:null,errorsWrapperEl:null,preloaderEl:null,billingSection:null,couponSection:null,waitResponse:!1,updateInfoTimeout:null,updateRatesTimeout:null,freeBooking:!1,currentInfoAjax:null,total:0,deposit:0,paymentFee:0,toPay:0,mode:"booking",bookingId:0,init:function(e,t){var a;e.length&&(MPHB.CheckoutForm.myThis=this,t&&(t.bookingId&&(this.bookingId=t.bookingId),t.mode)&&(this.mode=t.mode),this.bookBtnEl=this.element.find("input[type=submit]"),this.errorsWrapperEl=this.element.find(".mphb-errors-wrapper"),this.preloaderEl=this.element.find(".mphb-preloader"),this.priceBreakdownTableEl=this.element.find("table.mphb-price-breakdown"),MPHB._data.settings.useBilling&&(this.billingSection=new MPHB.BillingSection(this.element.find("#mphb-billing-details"),{form:this,gateways:MPHB._data.gateways})),MPHB._data.settings.useCoupons&&(this.couponSection=new MPHB.CouponSection(this.element.find("#mphb-coupon-details"),{form:this})),this.element.find(".mphb-room-details").each(function(e,t){new MPHB.GuestsChooser(A(t),{minAdults:MPHB._data.checkout.min_adults,minChildren:MPHB._data.checkout.min_children})}),a=this,A(".mphb-room-details").each(function(){a.updateRatePrices(A(this))}),A('[name="mphb_gateway_id"]').on("change",function(e){a.setPaymentFee(),a.element[0].dispatchEvent(new CustomEvent("CheckoutDataChanged",{detail:{total:this.total,deposit:this.deposit,toPay:this.toPay,paymentFee:this.paymentFee}}))}),this.setCheckoutData({newAmount:MPHB._data.checkout.total,depositAmount:MPHB._data.checkout.total,gateways:MPHB._data.gateways}),this.updateCheckoutInfo())},updateCheckoutInfo:function(){var a=this;a.hideErrors(),a.showPreloader(),clearTimeout(this.updateInfoTimeout),this.updateInfoTimeout=setTimeout(function(){var e=a.parseFormToJSON();a.currentInfoAjax=A.ajax({url:MPHB._data.ajaxUrl,type:"GET",dataType:"json",data:{action:"mphb_update_checkout_info",mphb_nonce:MPHB._data.nonces.mphb_update_checkout_info,formValues:e,lang:MPHB._data.settings.currentLanguage},beforeSend:function(){null!=a.currentInfoAjax&&(a.currentInfoAjax.abort(),a.hideErrors())},success:function(e){e.hasOwnProperty("success")&&e.success&&e.data&&a.setCheckoutData(e.data)},error:function(e){var t;a.showError(null!=(e=null!=(t=null==(t=e.responseJSON)||null==(t=t.data)?void 0:t.message)?t:null==(t=e.responseJSON)||null==(t=t.data)?void 0:t.errorMessage)?e:MPHB._data.translations.errorHasOccured)},complete:function(e){a.hidePreloader(),a.currentInfoAjax=null}})},500)},setCheckoutData:function(e){MPHB._data.settings.useBilling&&this.billingSection.updateGatewaysData(e.gateways),this.total=e.newAmount,this.toPay=this.total,e.priceHtml&&this.element.find(".mphb-total-price-field").html(e.priceHtml),e.priceBreakdown&&(this.priceBreakdownTableEl.replaceWith(e.priceBreakdown),this.priceBreakdownTableEl=this.element.find("table.mphb-price-breakdown")),MPHB._data.settings.useBilling&&(e.depositAmount&&(this.deposit=e.depositAmount,this.toPay=this.deposit,this.element.find(".mphb-deposit-amount-field").html(e.depositPrice)),e.isFree?this.setFreeMode():this.unsetFreeMode(),this.setPaymentFee()),this.element[0].dispatchEvent(new CustomEvent("CheckoutDataChanged",{detail:{total:this.total,deposit:this.deposit,toPay:this.toPay,paymentFee:this.paymentFee}}))},setPaymentFee:function(){var e,t;this.paymentFee=this.billingSection.getSelectedGatewayPaymentFeeAmount(),!this.freeBooking&&0<this.paymentFee?(e=this.element.find(".mphb-total-price .mphb-payment-fee"),
1(t=this.element.find(".mphb-deposit-amount .mphb-payment-fee")).length&&this.total!==this.deposit?(e.addClass("mphb-hide"),e.find(".mphb-payment-fee-field").html(""),t.removeClass("mphb-hide"),t.find(".mphb-payment-fee-field").html(this.billingSection.getSelectedGatewayPaymentFeeHtml())):(e.removeClass("mphb-hide"),e.find(".mphb-payment-fee-field").html(this.billingSection.getSelectedGatewayPaymentFeeHtml()),t.addClass("mphb-hide"),t.find(".mphb-payment-fee-field").html(""))):(this.element.find(".mphb-payment-fee-field").html(""),this.element.find(".mphb-payment-fee").addClass("mphb-hide")),this.toPay=this.total===this.deposit?this.total:this.deposit,this.freeBooking||(this.toPay+=this.paymentFee)},setFreeMode:function(){this.freeBooking=!0,this.billingSection.element.addClass("mphb-hide"),this.element.append(A("<input />",{type:"hidden",name:"mphb_gateway_id",value:"manual",id:"mphb-manual-payment-input"}))},unsetFreeMode:function(){this.freeBooking=!1,this.billingSection.element.removeClass("mphb-hide"),this.element.find("#mphb-manual-payment-input").remove()},updateRatePrices:function(e){var t,a,n,i,r,s;e&&e.length&&(t=parseInt(e.attr("data-index")),a=e.find(".mphb_sc_checkout-rate"),(n=A.map(a,function(e){return parseInt(e.value)})).length<=1||(e=(i=this.parseFormToJSON()).mphb_room_details[t],r=e.adults||"",s=e.children||"",clearTimeout(this.updateRatesTimeout),this.updateRatesTimeout=setTimeout(function(){A.ajax({url:MPHB._data.ajaxUrl,type:"GET",dataType:"json",data:{action:"mphb_update_rate_prices",mphb_nonce:MPHB._data.nonces.mphb_update_rate_prices,rates:n,adults:r,children:s,check_in_date:i.mphb_check_in_date,check_out_date:i.mphb_check_out_date,lang:MPHB._data.settings.currentLanguage},success:function(e){var n;e.hasOwnProperty("success")&&(n=e.data,A.each(a,function(e,t){var a=t.value;null!=n[a]&&((t=A(t).parent().children("strong")).children(".mphb-price").remove(),t.append(n[a]))}))}})},500)))},".mphb_checkout-guests-chooser change":function(e,t){this.updateRatePrices(e.closest(".mphb-room-details")),this.updateCheckoutInfo()},".mphb_checkout-rate change":function(e,t){this.updateCheckoutInfo()},".mphb_checkout-service, .mphb_checkout-service-adults change":function(e,t){this.updateCheckoutInfo()},".mphb_checkout-service-quantity input":function(e,t){this.updateCheckoutInfo()},'select[name="mphb_country"] change':function(e,t){null!=this.billingSection&&(e=A(e).val(),this.billingSection.onInput("country",e))},getCountry:function(){return this.getCustomerDetail("country")},".mphb-price-breakdown-expand click":function(e,t){t.preventDefault(),A(e).blur();t=A(e).parents("tr.mphb-price-breakdown-group");t.find(".mphb-price-breakdown-rate").toggleClass("mphb-hide"),t.nextUntil("tr.mphb-price-breakdown-group").toggleClass("mphb-hide"),A(e).children(".mphb-inner-icon").toggleClass("mphb-hide")},hideErrors:function(){this.errorsWrapperEl.empty().addClass("mphb-hide")},showError:function(e){this.errorsWrapperEl.html(e).removeClass("mphb-hide")},showPreloader:function(){this.waitResponse=!0,this.bookBtnEl.attr("disabled","disabled"),this.preloaderEl.removeClass("mphb-hide")},hidePreloader:function(){this.waitResponse=!1,this.bookBtnEl.removeAttr("disabled"),this.preloaderEl.addClass("mphb-hide")},parseFormToJSON:function(){return!!(this.element&&0<this.element.length)&&this.element.serializeJSON()},isRequiredField:function(e){e=document.getElementById("mphb_"+e);return null!==e&&e.required},getCustomerDetail:function(e){e=this.element.find("#mphb_"+e);return 0<e.length&&e.val()},getCustomerDetails:function(){var a={email:"",first_name:"",last_name:""},n=this;return["name","first_name","last_name","email","phone","country","address1","city","state","zip"].forEach(function(e){var t=n.getCustomerDetail(e);!1!==t&&(a[e]=t)}),a.name||(a.name=(a.first_name+" "+a.last_name).trim()),a},getCustomerEmail:function(){return this.getCustomerDetail("email")},getToPayAmount:function(){var e=this.toPay;return e=0==e?this.billingSection.getSelectedGatewayAmount():e},submit:function(e,t){var a,n,i;return this.waitResponse||(this.hideErrors(),this.showPreloader(),a=this._parseBookingDetails(),n=MPHB._data.settings.useBilling&&!this.freeBooking,i=this,(n?this.billingSection.canSubmit(this.getToPayAmount(),a.customer):Promise.resolve(!0)).then(function(e){if(e)return"booking"===i.mode?i._submitCheckout(a):((e=a.payment_details).custom_fields=a.custom_fields,MPHB.restApiHelper.submitPayment(e));throw new Error}).then(function(e){var t;return(n?(t=e.payment_fields||{},i.billingSection.afterProcessing(t)):Promise.resolve(null)).then(function(){return e})}).then(function(e){var t=e.success_message;
1e.redirect_url&&(t+=' <span class="mphb-preloader"></span>'),i.element.html('<p class="mphb_checkout-success-reservation-message">'+t+"</p>"),i.element[0].scrollIntoView(),e.redirect_url&&(window.location.href=e.redirect_url)}).catch(function(e){i.hidePreloader(),""!==e.message&&i.showError(e.message)})),!1},"#mphb-price-details .mphb-remove-coupon click":function(e,t){t.preventDefault(),t.stopPropagation(),MPHB._data.settings.useCoupons&&(this.couponSection.removeCoupon(),this.updateCheckoutInfo())},_buildFormData:function(e){e=e||this._parseBookingDetails();var t,a=new FormData;for(t in e){var n,i=e[t];if("custom_fields"===t)for(var r in i)""!==(n=i[r])&&a.append("customer_fields[".concat(r,"]"),n);else if("customer"===t)for(var r in i)""!==(n=i[r])&&a.append("customer_fields[mphb_".concat(r,"]"),n);else if("files"===t)for(var r in i)a.append(r,i[r]);else if("note"===t)a.append("customer_fields[mphb_".concat(t,"]"),i);else if("payment_details"===t)for(var r in i)if("payment_fields"!==r)a.append("".concat(t,"[").concat(r,"]"),i[r]);else for(var s in i[r])a.append("".concat(t,"[").concat(r,"][").concat(s,"]"),i[r][s]);else if("room_details"===t)for(var o in i){var l=i[o];for(r in l)if("services"!==r)a.append("".concat(t,"[").concat(o,"][").concat(r,"]"),l[r]);else{var c,h=l[r];for(c in h){var d,m=h[c];for(d in m)a.append("".concat(t,"[").concat(o,"][").concat(r,"][").concat(c,"][").concat(d,"]"),m[d])}}}else a.append(t,i)}return a},_parseBookingDetails:function(){var e=this.parseFormToJSON(),t=[];if("object"===_typeof(e.mphb_room_details)){var a,n=MPHB._data.checkout.min_adults,i=MPHB._data.checkout.min_children;for(a in e.mphb_room_details){var r=e.mphb_room_details[a],s=r.adults?parseInt(r.adults):n,o=r.children?parseInt(r.children):i,l=r.rate_id?parseInt(r.rate_id):0,c=r.room_id?parseInt(r.room_id):0,h=r.room_type_id?parseInt(r.room_type_id):0;if(s&&!isNaN(o)&&l&&!isNaN(c)&&h){var d=[];if("object"===_typeof(r.services))for(var m in r.services){var m=r.services[m],u=m.id?parseInt(m.id):0,p=m.adults?parseInt(m.adults):0,m=m.quantity?parseInt(m.quantity):1;u&&p&&m&&d.push({id:u,adults:p,quantity:m})}t.push({adults:s,children:o,guest_name:r.guest_name||"",rate_id:l,room_id:c,room_type_id:h,services:d})}}}var y,f={check_in_date:e.mphb_check_in_date||"",check_out_date:e.mphb_check_out_date||"",checkout_id:e["mphb-checkout-id"]||"",coupon_code:e.mphb_applied_coupon_code||"",custom_fields:{},customer:this.getCustomerDetails(),files:{},lang:MPHB._data.settings.currentLanguage,note:e.mphb_note||"",room_details:t},b=(MPHB._data.settings.useBilling&&!this.freeBooking&&(f.payment_details=this.billingSection.getPaymentDetails(),"payment"===this.mode&&(f.payment_details.amount=this.getToPayAmount(),0!==this.bookingId)&&(f.payment_details.booking_id=this.bookingId),this.billingSection.isEmpty())&&(f.payment_details.gateway_id=e.mphb_gateway_id||""),["mphb_applied_coupon_code","mphb_check_in_date","mphb_check_out_date","mphb-checkout-id","mphb-checkout-nonce","mphb_coupon_code","mphb_gateway_id","mphb_new_booking_status","mphb_note","mphb_room_details"]);for(y in e){var _=y.replace("mphb_","");b.includes(y)||0!==y.indexOf("mphb")||_ in f.customer||(f.custom_fields[y]=e[y])}var k=this.element.find('input[type="file"]');return 0<k.length&&k.each(function(e,t){0<t.files.length&&(f.files[t.name]=t.files[0])}),f},_setField:function(e,t){var e="mphb_"+e,a=this.element.find("#"+e);0<a.length?a.val(t):this.element.append(A("<input>",{id:e,name:e,type:"hidden",value:t}))},_submitCheckout:function(e){return MPHB.restApiHelper.submitCheckout(this._buildFormData(e))}}),MPHB.AdminCheckoutForm=MPHB.CheckoutForm.extend({},{_parseBookingDetails:function(){var e=this._super(),t=this.element.find('select[name="mphb_new_booking_status"]');return 0!==t.length&&(e.status=t.val()),e},_submitCheckout:function(e){return MPHB.restApiHelper.submitAdminCheckout(this._buildFormData(e))}}),MPHB.BeanstreamGateway=MPHB.Gateway.extend({},{scriptUrl:"",isCanSubmit:!1,loadHandler:null,validityHandler:null,tokenRequestHandler:null,tokenUpdatedHandler:null,initSettings:function(e){this._super(e),this.scriptUrl=e.scriptUrl||"https://payform.beanstream.com/v1.1.0/payfields/beanstream_payfields.js",this.validityHandler=this.validityChanged.bind(this),this.tokenRequestHandler=this.tokenRequested.bind(this),this.tokenUpdatedHandler=this.tokenUpdated.bind(this)},canSubmit:function(e,t){return Promise.resolve(this.isCanSubmit)},afterSelection:function(t){var e;this._super(t),0<t.length&&((e=document.createElement("script")).id="payfields-script",e.src=this.scriptUrl,e.dataset.async="true",null!=this.loadHandler&&A(document).off("beanstream_payfields_loaded",this.loadHandler),this.loadHandler=function(e){A("[data-beanstream-id]").appendTo(t)},A(document).on("beanstream_payfields_loaded",this.loadHandler),t.append(e),t.removeClass("mphb-billing-fields-hidden")),A(document).on("beanstream_payfields_inputValidityChanged",this.validityHandler).on("beanstream_payfields_tokenRequested",this.tokenRequestHandler).on("beanstream_payfields_tokenUpdated",this.tokenUpdatedHandler)},cancelSelection:function(){this._super(),A(document).off("beanstream_payfields_inputValidityChanged",this.validityHandler).off("beanstream_payfields_tokenRequested",this.tokenRequestHandler).off("beanstream_payfields_tokenUpdated",this.tokenUpdatedHandler)},validityChanged:function(e){(e.eventDetail||e.originalEvent.eventDetail).isValid||(this.isCanSubmit=!1)},tokenRequested:function(e){this.billingSection.showPreloader()},tokenUpdated:function(e){e=e.eventDetail||e.originalEvent.eventDetail;e.success?this.isCanSubmit=!0:(this.isCanSubmit=!1,this.billingSection.showError(MPHB._data.translations.tokenizationFailure.replace("(%s)",e.message))),this.billingSection.hidePreloader(),e.success&&(this.paymentFields.singleUseToken=e.token,this.billingSection.parentForm.element.submit())}}),MPHB.BraintreeGateway=MPHB.Gateway.extend({},{clientToken:"",checkout:null,initSettings:function(e){this._super(e),this.clientToken=e.clientToken},canSubmit:function(e,t){return Promise.resolve(this.isNonceStored())},isNonceStored:function(){return this.hasPaymentField("payment_nonce")&&""!==this.getPaymentField("payment_nonce")},afterSelection:function(e){var t,a;this._super(e),null!=braintree&&(t="mphb-braintree-container-"+this.clientToken.substr(0,8),e.append('<div id="'+t+'"></div>'),a=this,braintree.setup(this.clientToken,"dropin",{container:t,onReady:function(e){a.checkout=e},onPaymentMethodReceived:function(e){a._setPaymentField("payment_nonce",e.nonce),a.billingSection.parentForm.element.submit(),a.billingSection.showPreloader()}}),e.removeClass("mphb-billing-fields-hidden"))},cancelSelection:function(){var e;this._super(),null!=this.checkout&&(e=this).checkout.teardown(function(){e.checkout=null})}}),MPHB.GuestsChooser=can.Control.extend({},{$adultsChooser:null,$childrenChooser:null,minAdults:0,minChildren:0,maxAdults:0,maxChildren:0,totalCapacity:0,init:function(e,t){e=e.find(".mphb_checkout-guests-chooser");e.length<2||(this.$adultsChooser=A(e[0]),this.$childrenChooser=A(e[1]),this.minAdults=t.minAdults,this.minChildren=t.minChildren,this.maxAdults=parseInt(this.$adultsChooser.data("max-allowed")),this.maxChildren=parseInt(this.$childrenChooser.data("max-allowed")),this.totalCapacity=parseInt(e.data("max-total")),this.maxAdults+this.maxChildren>this.totalCapacity&&this.$adultsChooser.on("change",this.limitChildren.bind(this)))},limitChildren:function(){var e=this.$adultsChooser.val(),t=this.findMax(e,this.minChildren,this.maxChildren);this.limitOptions(this.$childrenChooser,this.minChildren,t,e)},findMax:function(e,t,a){var n=this.totalCapacity;return""!==e&&(n=this.totalCapacity-e,n=Math.max(t,n)),Math.min(n,a)},limitOptions:function(e,t,n,a){var i=t;e.children().each(function(e,t){var a=t.value;""!==a&&(a=parseInt(a),n<a?A(t).remove():i<a&&(i=a))});for(var r=i+1;r<=n;r++){var s=jQuery('<option value="'+r+'">'+r+"</option>");e.append(s)}""!==a&&e.children(":selected").prop("selected",!1)}}),(t=jQuery)("#mphb-render-checkout-login").click(function(e){e.preventDefault(),e.stopPropagation();e=t(this).parents(".mphb-login-form-wrap").find(".mphb-login-form");e.hasClass("mphb-hide")?e.removeClass("mphb-hide"):e.addClass("mphb-hide")}),MPHB.StripeGateway=MPHB.Gateway.extend({API_VERSION:"2025-06-30.basil"},{currency:"EUR",locale:"auto",isCountryRequired:MPHB._data.settings.countryRequired,isFullAddressRequired:MPHB._data.settings.fullAddressRequired,isManualCapture:!1,paymentsConfigurationId:"",publicKey:"",returnUrl:"",stripe:null,elements:null,control:null,errorsWrapper:null,defaultCustomer:null,init:function(e,t){this._super(e,t),this.stripe=Stripe(this.publicKey,{apiVersion:MPHB.StripeGateway.API_VERSION})},initSettings:function(e){this._super(e),this.currency=e.currency,this.locale=e.locale,this.isManualCapture=e.isManualCapture,this.paymentsConfigurationId=e.paymentsConfigurationId,this.publicKey=e.publicKey,this.returnUrl=e.returnUrl,this.defaultCustomer=e.customer},afterProcessing:function(e){var t=e.payment_intent;return t&&"requires_action"===t.status?this.stripe.handleNextAction({clientSecret:e.payment_intent.client_secret}):Promise.resolve(null)},afterSelection:function(e){this._super(e),this._mount(e)},cancelSelection:function(){this._super(),this.control.destroy(),this.control=null,this.errorsWrapper=null},canSubmit:function(e,t){this._disableControls(),this._hideErrors();var a=this;return this.elements.submit().then(function(e){if(e.error)throw new Error(e.error.message);return a.stripe.createConfirmationToken({elements:a.elements,params:{payment_method_data:{billing_details:a._toBillingDetails(t)},return_url:a.returnUrl}})}).then(function(e){if(e.error)throw new Error(e.error.message);return a._setPaymentField("payment_method","payment"),a._setPaymentField("confirmation_token_id",e.confirmationToken.id),a._enableControls(),!0}).catch(function(e){return a._showError(e.message),a._enableControls(),!1})},updateData:function(e){this._super(e),0<this.amount&&null!==this.elements&&this.elements.update({amount:this._convertToSmallestUnit(this.amount),currency:this.currency.toLowerCase()})},_convertToSmallestUnit:function(e,t){switch(t=t||this.currency){case"BIF":case"CLP":case"DJF":case"GNF":case"JPY":case"KMF":case"KRW":case"MGA":case"PYG":case"RWF":case"UGX":case"VND":case"VUV":case"XAF":case"XOF":case"XPF":return Math.floor(e);default:return Math.round(100*e)}},_disableControls:function(){null!==this.control&&this.control.update({readOnly:!0})},_enableControls:function(){null!==this.control&&this.control.update({readOnly:!1})},_hideErrors:function(){this.errorsWrapper.addClass("mphb-hide").text("")},_mount:function(e){e.append('<section id="mphb-stripe-payment-container" class="mphb-stripe-payment-container"><div class="mphb-stripe-payment-fields payment"><fieldset><div id="mphb-stripe-payment-element" class="mphb-stripe-element"></div></fieldset></div><div id="mphb-stripe-errors"></div></section>'),this.errorsWrapper=e.find("#mphb-stripe-errors"),null===this.elements&&(this.elements=this.stripe.elements({amount:this._convertToSmallestUnit(this.amount),captureMethod:this.isManualCapture?"manual":"automatic_async",currency:this.currency.toLowerCase(),locale:this.locale,mode:"payment",paymentMethodConfiguration:this.paymentsConfigurationId}));var t=MPHB.CheckoutForm.myThis,a={fields:{billingDetails:{name:t.isRequiredField("name")?"
1never":"auto",email:"never",phone:t.isRequiredField("phone")?"never":"auto"}}},n=(this.isCountryRequired||this.isFullAddressRequired?a.fields.billingDetails.address={city:t.isRequiredField("city")?"never":"auto",country:t.isRequiredField("country")?"never":"auto",line1:t.isRequiredField("address1")?"never":"auto",postalCode:t.isRequiredField("zip")?"never":"auto",state:t.isRequiredField("state")?"never":"auto"}:a.fields.billingDetails.address="if_required",this.control=this.elements.create("payment",a),this.control.mount("#mphb-stripe-payment-element"),this);this.control.on("change",function(e){n._setError(e.error?e.error.message:"")}),e.removeClass("mphb-billing-fields-hidden")},_setError:function(e){""!==e?this._showError(e):this._hideErrors()},_showError:function(e){this.errorsWrapper.html(e).removeClass("mphb-hide")},_toBillingDetails:function(e){var t,a=["name","email","phone"],n=((this.isCountryRequired||this.isFullAddressRequired)&&a.push("country"),{}),i={},r=_createForOfIteratorHelper(a=this.isFullAddressRequired?a.concat(["address1","city","state","zip"]):a);try{for(r.s();!(t=r.n()).done;){var s=t.value,o=e[s]||this.defaultCustomer[s]||"";if(o)switch(s){case"name":case"email":case"phone":n[s]=o;break;case"country":case"city":case"state":i[s]=o;break;case"address1":i.line1=o;break;case"zip":i.postal_code=o}}}catch(e){r.e(e)}finally{r.f()}return 0<Object.keys(i).length&&(n.address=i),n}}),MPHB.StripeLegacyGateway=MPHB.Gateway.extend({},{publicKey:"",locale:"auto",currency:"EUR",returnUrl:window.location.href,defaultCountry:"",paymentDescription:"Accommodation(s) reservation",fullAddressRequired:!1,i18n:{},style:{},api:null,elements:null,cardControl:null,sepaDebitControl:null,payments:null,customer:null,defaultCustomer:null,errorsWrapper:null,hasErrors:!1,undefinedError:MPHB._data.translations.errorHasOccured,init:function(e,t){this._super(e,t),this.api=Stripe(this.publicKey),this.elements=this.api.elements({locale:this.locale}),this.cardControl=this.elements.create("card",{style:this.style,hidePostalCode:this.fullAddressRequired}),this.sepaDebitControl=this.elements.create("iban",{style:this.style,supportedCountries:["SEPA"]}),this.payments=new MPHB.StripeGateway.PaymentMethods(t.settings.paymentMethods,this.defaultCountry,t.settings.currency),this.addListeners()},initSettings:function(e){this._super(e),this.publicKey=e.publicKey,this.locale=e.locale,this.currency=e.currency,this.returnUrl=e.returnUrl,this.defaultCountry=e.defaultCountry,this.paymentDescription=e.paymentDescription,this.fullAddressRequired=MPHB._data.settings.fullAddressRequired,this.defaultCustomer=e.customer,this.i18n=e.i18n,this.style=e.style,this.idempotencyKey=A(".mphb_sc_checkout-form").find('input[name="'+e.idempotencyKeyField+'"]').val()},addListeners:function(){var e=this.onChange.bind(this);this.cardControl.on("change",e),this.sepaDebitControl.on("change",e)},onChange:function(e){e.error?(this.showError(e.error.message),this.hasErrors=!0):(this.hideErrors(),this.hasErrors=!1)},onInput:function(e,t){"country"===e&&this.payments.selectCountry(t)},afterSelection:function(e){this._super(e),e.append(this.mountHtml()),this.errorsWrapper=e.find("#mphb-stripe-errors"),this.cardControl.mount("#mphb-stripe-card-element"),this.payments.isEnabled("sepa_debit")&&this.sepaDebitControl.mount("#mphb-stripe-iban-element"),this.payments.mount(e);var t=this;this.payments.inputs.on("change",function(){switch(t.payments.currentPayment){case"card":t.cardControl.clear();break;case"sepa_debit":t.sepaDebitControl.clear()}t.payments.selectPayment(this.value)}),e.removeClass("mphb-billing-fields-hidden")},cancelSelection:function(){this._super(),this.errorsWrapper=null,this.cardControl.unmount(),this.payments.isEnabled("sepa_debit")&&this.sepaDebitControl.unmount(),this.payments.unmount()},canSubmit:function(e,t){return this.hasErrors?Promise.resolve(!1):(this.setCustomer(t),this.createPaymentMethod().then(this.createPaymentIntent.bind(this,e)).then(this.confirmPayment.bind(this)).then(this.handleStripeErrors.bind(this)).then(this.completePayment.bind(this)))},setCustomer:function(e){e=A.extend({},e);e.email||(e.email=this.defaultCustomer.email),e.name||(e.name=this.defaultCustomer.name),e.hasOwnProperty("country")||(e.country=this.payments.currentCountry),this.customer=e},createPaymentMethod:function(){return"card"===this.payments.currentPayment?this.api.createPaymentMethod({type:"card",card:this.cardControl,billing_details:{name:this.customer.name,email:this.customer.email}}):"bancontact"===this.payments.currentPayment?this.api.createPaymentMethod({type:"bancontact",billing_details:{name:this.customer.name,email:this.customer.email}}):"ideal"===this.payments.currentPayment?this.api.createPaymentMethod({type:"ideal",ideal:{bank:null,bic:null},billing_details:{name:this.customer.name,email:this.customer.email}}):"giropay"===this.payments.currentPayment?this.api.createPaymentMethod({type:"giropay",billing_details:{name:this.customer.name,email:this.customer.email}}):"sepa_debit"===this.payments.currentPayment?this.api.createPaymentMethod({type:"sepa_debit",sepa_debit:this.sepaDebitControl,billing_details:{name:this.customer.name,email:this.customer.email}}):"klarna"===this.payments.currentPayment?this.api.createPaymentMethod({type:"klarna",billing_details:{address:{country:this.customer.country},name:this.customer.name,email:this.customer.email}}):void 0},createPaymentIntent:function(e,n){var i=this;return new Promise(function(t,a){MPHB.post("create_stripe_payment_intent",{amount:e,description:i.paymentDescription,paymentMethodType:n.paymentMethod.type,paymentMethodId:n.paymentMethod.id,idempotencyKey:i.idempotencyKey,roomTypeIds:i.billingSection.getRoomTypeIds(),customerEmail:i.billingSection.getCheckoutForm().getCustomerEmail()},{success:function(e){e.hasOwnProperty("success")&&e.success?t({id:e.data.id,clientSecret:e.data.client_secret,paymentMethodId:n.paymentMethod.id}):(i.showError(i.undefinedError),a(new Error(i.undefinedError)))},error:function(e){void 0!==e.responseJSON.data.errorMessage?(i.showError(e.responseJSON.data.errorMessage),a(new Error(e.responseJSON.data.errorMessage))):(i.showError(i.undefinedError),a(new Error(i.undefinedError)))}})})},confirmPayment:function(e){return"card"===this.payments.currentPayment?this.api.confirmCardPayment(e.clientSecret,{payment_method:e.paymentMethodId}):"bancontact"===this.payments.currentPayment?this.api.confirmBancontactPayment(e.clientSecret,{payment_method:e.paymentMethodId,return_url:this.returnUrl},{handleActions:!1}):"ideal"===this.payments.currentPayment?this.api.confirmIdealPayment(e.clientSecret,{payment_method:e.paymentMethodId,return_url:this.returnUrl},{handleActions:!1}):"giropay"===this.payments.currentPayment?this.api.confirmGiropayPayment(e.clientSecret,{payment_method:e.paymentMethodId,return_url:this.returnUrl},{handleActions:!1}):"sepa_debit"===this.payments.currentPayment?this.api.confirmSepaDebitPayment(e.clientSecret,{payment_method:e.paymentMethodId}):"klarna"===this.payments.currentPayment?this.api.confirmKlarnaPayment(e.clientSecret,{payment_method:e.paymentMethodId,return_url:this.returnUrl},{handleActions:!1}):void 0},handleStripeErrors:function(e){if(e.error)throw this.showError(e.error.message),new Error(e.error.message);if(null!=e.paymentIntent)return e.paymentIntent},completePayment:function(e){return this._setPaymentField("payment_method",this.payments.currentPayment),this._setPaymentField("payment_intent_id",e.id),"requires_action"==e.status&&"redirect_to_url"==e.next_action.type&&this._setPaymentField("redirect_url",e.next_action.redirect_to_url.url),!0}
1,mountHtml:function(){var e='<section id="mphb-stripe-payment-container" class="mphb-stripe-payment-container">';return(e+=this.methodsHtml())+this.fieldsHtml("card")+this.fieldsHtml("bancontact")+this.fieldsHtml("ideal")+this.fieldsHtml("giropay")+this.fieldsHtml("sepa_debit")+this.fieldsHtml("klarna")+'<div id="mphb-stripe-errors"></div>'+"</section>"},methodsHtml:function(){var n,i;return this.payments.onlyCardEnabled()?"":(n=this.i18n,i='<nav id="mphb-stripe-payment-methods">',i+="<ul>",this.payments.forEach(function(e,t,a){t.isEnabled&&(t=a.isSelected(e),i=(i=i+'<li class="mphb-stripe-payment-method '+e+(t?" active":"")+'"><label>')+'<input type="radio" name="stripe_payment_method" value="'+e+'"'+(t?' checked="checked"':"")+" />"+n[e]+"</label></li>")}),i+="</ul></nav>")},fieldsHtml:function(e){if(!this.payments.isEnabled(e))return"";var t=(t="")+('<div class="mphb-stripe-payment-fields '+e+(this.payments.isSelected(e)?"":" mphb-hide")+'">')+"<fieldset>";switch(e){case"card":t+=this.cardHtml();break;case"sepa_debit":t+=this.ibanHtml();break;default:t+=this.redirectHtml()}return t+="</fieldset>","sepa_debit"==e&&(t+='<p class="notice">'+this.i18n.iban_policy+"</p>"),t+="</div>"},cardHtml:function(){var e="";return this.payments.onlyCardEnabled()&&(e+='<label for="mphb-stripe-card-element">'+this.i18n.card_description+"</label>"),e+='<div id="mphb-stripe-card-element" class="mphb-stripe-element"></div>'},ibanHtml:function(){return'<label for="mphb-stripe-iban-element">'+this.i18n.iban+'</label><div id="mphb-stripe-iban-element" class="mphb-stripe-element"></div>'},redirectHtml:function(){return'<p class="notice">'+this.i18n.redirect_notice+"</p>"},showError:function(e){this.errorsWrapper.html(e).removeClass("mphb-hide")},hideErrors:function(){this.errorsWrapper.addClass("mphb-hide").text("")}}),MPHB.DirectBooking=can.Control.extend({},{reservationForm:null,elementsToHide:null,quantitySection:null,wrapperW
1ithSelect:null,wrapperWithoutSelect:null,priceWrapper:null,quantitySelect:null,availableLabel:null,typeId:0,init:function(e,t){this.reservationForm=t.reservationForm,this.elementsToHide=e.find(".mphb-reserve-room-section, .mphb-rooms-quantity-wrapper, .mphb-regular-price"),this.quantitySection=e.find(".mphb-reserve-room-section"),this.wrapperWithSelect=this.quantitySection.find(".mphb-rooms-quantity-wrapper.mphb-rooms-quantity-multiple"),this.wrapperWithoutSelect=this.quantitySection.find(".mphb-rooms-quantity-wrapper.mphb-rooms-quantity-single"),this.priceWrapper=this.quantitySection.find(".mphb-period-price"),this.quantitySelect=this.quantitySection.find(".mphb-rooms-quantity"),this.availableLabel=this.quantitySection.find(".mphb-available-rooms-count"),this.typeId=e.find('input[name="mphb_room_type_id"]').val(),this.typeId=parseInt(this.typeId)},hideSections:function(){this.elementsToHide.addClass("mphb-hide"),this.reservationForm.reserveBtnWrapper.removeClass("mphb-hide")},showSections:function(e){this.reservationForm.reserveBtnWrapper.addClass("mphb-hide"),this.quantitySection.removeClass("mphb-hide"),e&&this.priceWrapper.removeClass("mphb-hide")},resetQuantityOptions:function(e){this.quantitySelect.empty();for(var t=1;t<=e;t++)this.quantitySelect.append('<option value="'+t+'">'+t+"</option>");this.quantitySelect.val(1),this.availableLabel.text(e),(1<e?this.wrapperWithSelect:this.wrapperWithoutSelect).removeClass("mphb-hide")},setupPrice:function(e,t){this.priceWrapper.children(".mphb-price, .mphb-price-period, .mphb-tax-information").remove(),0<e&&""!=t&&this.priceWrapper.append(t)},showError:function(e){this.hideSections(),this.reservationForm.showError(e)},loadAvailabilityAndPriceData:function(){var t,e=this.reservationForm.checkInDatepicker.getDate(),a=this.reservationForm.checkOutDatepicker.getDate();e&&a&&(this.reservationForm.clearErrors(),this.reservationForm.lock(),t=this,A.ajax({url:MPHB._data.ajaxUrl,type:"GET",dataType:"json",data:{action:"mphb_get_room_type_availability_data",mphb_nonce:MPHB._data.nonces.mphb_get_room_type_availability_data,room_type_id:this.typeId,check_in_date:A.datepick.formatDate(MPHB._data.settings.dateTransferFormat,e),check_out_date:A.datepick.formatDate(MPHB._data.settings.dateTransferFormat,a),adults_count:this.reservationForm.getAdults(),children_count:this.reservationForm.getChildren(),lang:MPHB._data.settings.currentLanguage},success:function(e){e.success?(t.resetQuantityOptions(e.data.freeCount),t.setupPrice(e.data.price,e.data.priceHtml),t.showSections(0<e.data.price)):t.showError(e.data.message)},error:function(e){t.showError(MPHB._data.translations.errorHasOccured)},complete:function(e){t.reservationForm.unlock()}}))},"input.mphb-datepick change":function(e,t){this.hideSections()},".mphb-reserve-btn click":function(e,t){t.preventDefault(),t.stopPropagation();var t=this.reservationForm.checkInDatepicker.getDate(),a=this.reservationForm.checkOutDatepicker.getDate();t&&a?this.loadAvailabilityAndPriceData():(t?this.showError(MPHB._data.translations.checkOutNotValid):this.showError(MPHB._data.translations.checkInNotValid),this.reservationForm.unlock())},'input.mphb-datepick, select[name="mphb_children"] change':function(e,t){this.loadAvailabilityAndPriceData()},'select[name="mphb_adults"] change':function(e,t){var a=jQuery('select[name="mphb_children"]');if(a.length&&void 0!==a.data("max-total")){var n=parseInt(a.data("min-allowed")),i=parseInt(a.data("max-allowed")),r=parseInt(a.data("max-total")),e=parseInt(e.val()),s=Math.min(Math.max(n,r-e),i),o=parseInt(a.val());a.empty();for(var l=n;l<=s;l++){var c=jQuery('<option value="'+l+'"'+(l===o?'selected="selected"':"")+">"+l+"</option>");a.append(c)}}this.loadAvailabilityAndPriceData()}}),MPHB.ReservationForm=can.Control.extend({},{$formElement:null,checkInDatepicker:null,checkOutDatepicker:null,reserveBtnWrapper:null,errorsWrapper:null,directBooking:null,roomTypeId:null,init:function(e){this.$formElement=e,this.roomTypeId=parseInt(this.$formElement.attr("id").replace(/^booking-form-/,"")),this.errorsWrapper=this.$formElement.find(".mphb-errors-wrapper");e=(e=this.$formElement.attr("data-first_available_check_in_date"))||A.datepick.formatDate("yyyy-mm-dd",new Date);this.checkInDatepicker=new MPHB.RoomTypeCheckInDatepicker(this.$formElement.find('input[type="text"][id^=mphb_check_in_date]'),{form:this,roomTypeId:"1"==MPHB._data.settings.isDirectBooking?this.roomTypeId:0,firstAvailableCheckInDateYmd:e}),this.checkOutDatepicker=new MPHB.RoomTypeCheckOutDatepicker(this.$formElement.find('input[type="text"][id^=mphb_check_out_date]'),{form:this,roomTypeId:"1"==MPHB._data.settings.isDirectBooking?this.roomTypeId:0,firstAvailableCheckInDateYmd:e}),this.reserveBtnWrapper=this.$formElement.find(".mphb-reserve-btn-wrapper"),"1"==MPHB._data.settings.isDirectBooking&&(this.directBooking=new MPHB.DirectBooking(this.$formElement,{reservationForm:this})),A(window).on("mphb-update-date-room-type-"+this.roomTypeId,this.proxy(function(){this.checkInDatepicker.refresh(),this.checkOutDatepicker.refresh()})),this.unlock()},updateCheckOutLimitations:function(){this.checkOutDatepicker.updateCheckOutLimitations(this.checkInDatepicker.getDate())},getAdults:function(){var e=this.$formElement.find('[name="mphb_adults"]');return 0<e.length?parseInt(e.val()):""},getChildren:function(){var e=this.$formElement.find('[name="mphb_children"]');return 0<e.length?parseInt(e.val()):""},showError:function(e){this.clearErrors();e=A("<p>",{class:"mphb-error",html:e});this.errorsWrapper.append(e).removeClass("mphb-hide")},clearErrors:function(){this.errorsWrapper.empty().addClass("mphb-hide")},lock:function(){this.element.addClass("mphb-loading")},unlock:function(){this.element.removeClass("mphb-loading")},onDatepickChange:function(){null!==this.directBooking&&this.directBooking.hideSections()}}),MPHB.RoomTypeCalendar=can.Control.extend({},{roomTypeId:null,$calendarElement:null,isShowPrices:!1,isTruncatePrices:!0,isShowPricesCurrency:!1,allShownMonthsCount:1,isClickable:!1,reservationFormElement:null,$reservationFormCheckInElement:null,$reservationFormCheckOutElement:null,isSyncWithReservationFormInitialised:!1,isSyncWithReservationFormOn:!0,lastDrawDate:null,isCheckInSelected:!1,isCheckOutSelected:!1,minCheckOutDateForSelection:null,maxCheckOutDateForSelection:null,minStayDateAfterCheckIn:null,maxStayDateAfterCheckIn:null,init:function(e,t){var n=this,e=(this.$calendarElement=e,this.roomTypeId=parseInt(this.$calendarElement.data("roomTypeId")),void 0!==this.$calendarElement.data("is_show_prices")&&(this.isShowPrices=Boolean(this.$calendarElement.data("is_show_prices"))),void 0!==this.$calendarElement.data("is_truncate_prices")&&(this.isTruncatePrices=Boolean(this.$calendarElement.data("is_truncate_prices"))),void 0!==this.$calendarElement.data("is_show_prices_currency")&&(this.isShowPricesCurrency=Boolean(this.$calendarElement.data("is_show_prices_currency"))),MPHB._data.settings.numberOfMonthCalendar),a=this.$calendarElement.attr("data-monthstoshow");a&&(e=1==(i=a.split(",")).length?parseInt(a):i),Array.isArray(e)?this.allShownMonthsCount=parseInt(e[0])*parseInt(e[1]):this.allShownMonthsCount=e,"1"==MPHB._data.settings.isDirectBooking&&(this.reservationFormElement=A("#booking-form-"+this.roomTypeId),this.isClickable=0<this.reservationFormElement.length,this.isClickable)&&(this.$reservationFormCheckInElement=this.reservationFormElement.find('input[type="text"][id^=mphb_check_in_date]'),this.$reservationFormCheckOutElement=this.reservationFormElement.find('input[type="text"][id^=mphb_check_out_date]'));var a=(a=this.$calendarElement.attr("data-first_available_check_in_date"))||A.datepick.formatDate("yyyy-mm-dd",new Date),i=new Date(a);MPHB.restApiHelper.getAvailabilityData({start_date:new Date(i.getFullYear(),i.getMonth(),0),end_date:new Date(i.getFullYear(),i.getMonth()+this.allShownMonthsCount,1),room_type_ids:[this.roomTypeId],is_add_prices:this.isShowPrices,is_truncate_prices:this.isTruncatePrices,is_add_prices_currency:this.isShowPricesCurrency},function(){n.$calendarElement.addClass("mphb-loading")},function(){n.doAfterNewCalendarDataLoaded(n),n.$calendarElement.removeClass("mphb-loading")}),this.$calendarElement.hide().datepick({minDate:MPHB.get_today_date(),defaultDate:i,monthsToShow:e,firstDay:MPHB._data.settings.firstDay,pickerClass:MPHB._data.settings.datepickerClass,useMouseWheel:!1,rangeSelect:n.isClickable,showSpeed:0,onChangeMonthYear:function(e,t){n.isClickable&&(n.lastDrawDate=A.datepick._getInst(n.$calendarElement).drawDate),MPHB.restApiHelper.getAvailabilityData({start_date:new Date(e,t-1,0),end_date:new Date(e,t-1+n.allShownMonthsCount,1),room_type_ids:[n.roomTypeId],is_add_prices:n.isS
1howPrices,is_truncate_prices:n.isTruncatePrices,is_add_prices_currency:n.isShowPricesCurrency},function(){n.$calendarElement.addClass("mphb-loading")},function(){n.doAfterNewCalendarDataLoaded(n),n.$calendarElement.removeClass("mphb-loading")})},onDate:function(e,t){var a=MPHB.restApiHelper.getCachedAvailabilityData([n.roomTypeId],n.isShowPrices,n.isTruncatePrices,n.isShowPricesCurrency),a=MPHB.calendarHelper.getCalendarDateAttributesFromAvailability(1,e,t,null!=(a=a[n.roomTypeId])?a:{},n.isShowPrices);return a=t?n.fillClickableCalendarDateData(a,e):a},onSelect:function(e){var t;n.isClickable&&0!==e.length&&(!n.isCheckInSelected||(n.isCheckInSelected,n.isCheckOutSelected)?(n.isCheckInSelected=!0,n.isCheckOutSelected=!1,t=MPHB.restApiHelper.getCachedAvailabilityData([n.roomTypeId],n.isShowPrices,n.isTruncatePrices,n.isShowPricesCurrency),t=MPHB.calendarHelper.calculateMinMaxCheckOutDateForSelection(e[0],null!=(t=t[n.roomTypeId])?t:{}),n.minCheckOutDateForSelection=t.minCheckOutDateForSelection,n.maxCheckOutDateForSelection=t.maxCheckOutDateForSelection,n.minStayDateAfterCheckIn=t.minStayDateAfterCheckIn,n.maxStayDateAfterCheckIn=t.maxStayDateAfterCheckIn):n.isCheckOutSelected=!0,(t=A.datepick._getInst(n.$calendarElement)).drawDate=n.lastDrawDate,t.options.setSelectedDatesToStatusBar(t,e),n.fillReservationFormWithSelectedDates(e))},onShow:function(e,t){e.find(".datepick-highlight").removeClass("datepick-highlight"),n.isClickable&&(n.lastDrawDate=t.drawDate,t.options.initStatusBar(e,t),t.options.initSelectionOnHover(e,t))},setSelectedDatesToStatusBar:function(e,t){var a=MPHB._data.translations.selectDates;n.isCheckInSelected&&(a=A.datepick.formatDate(MPHB._data.settings.dateFormat,t[0]),n.isCheckOutSelected)&&(a+=" - "+A.datepick.formatDate(MPHB._data.settings.dateFormat,t[1])),e.options.renderer.picker='<div class="datepick"><div class="datepick-nav">{link:prev}{link:today}{link:next}</div>{months}<div class="datepick-ctrl"><div class="mphb-calendar__selected-dates">'+a+'</div>{link:clear}</div><div class="datepick-clear-fix"></div></div>'},initStatusBar:function(e,t){t.options.renderer=Object.assign({},t.options.renderer),t.options.setSelectedDatesToStatusBar(t,n.$calendarElement.datepick("getDate")),t.options.commands=Object.assign({},t.options.commands),t.options.commands.close.keystroke={},t.options.commands.clear.keystroke={keyCode:27,altKey:!1},t.options.commands.clear.action=function(e){var t;e===A.datepick._getInst(n.$calendarElement)||e===A.datepick._getInst(n.$reservationFormCheckInElement)||e===A.datepick._getInst(n.$reservationFormCheckOutElement)?n.isCheckInSelected&&(t=MPHB.Utils.cloneDate(n.lastDrawDate),n.isCheckInSelected=!1,n.isCheckOutSelected=!1,n.$calendarElement.datepick("setDate",null),n.$reservationFormCheckInElement.datepick("setDate",null),n.$reservationFormCheckOutElement.datepick("setDate",null),e.drawDate=t,n.lastDrawDate=t,n.refresh()):e.elem.datepick("clear")}},initSelectionOnHover:function(e,t){e.find(t.get("renderer").daySelector+" a").hover(function(){if(n.isCheckInSelected&&!n.isCheckOutSelected){var e=A.datepick.retrieveDate(n.$calendarElement,this),t=n.$calendarElement.datepick("getDate"),a=MPHB.Utils.cloneDate(t[0]);if(a.setDate(a.getDate()+1),t[0].getTime()<e.getTime()&&n.$calendarElement.datepick("isSelectable",e))for(;e.getTime()>a.getTime();)n.$calendarElement.find(".dp"+a.getTime()).not(".mphb-extra-date").addClass("mphb-selected-date"),a.setDate(a.getDate()+1)}},function(){n.isCheckInSelected&&!n.isCheckOutSelected&&n.$calendarElement.find(".mphb-selected-date").removeClass("mphb-selected-date")})}}).show()},doAfterNewCalendarDataLoaded:function(e){var t,a;e.isCheckInSelected&&!e.isCheckOutSelected&&(t=e.$calendarElement.datepick("getDate"),a=MPHB.restApiHelper.getCachedAvailabilityData([e.roomTypeId],e.isShowPrices,e.isTruncatePrices,e.isShowPricesCurrency),a=MPHB.calendarHelper.calculateMinMaxCheckOutDateForSelection(t[0],null!=(t=a[e.roomTypeId])?t:{}),e.minCheckOutDateForSelection=a.minCheckOutDateForSelection,e.maxCheckOutDateForSelection=a.maxCheckOutDateForSelection,e.minStayDateAfterCheckIn=a.minStayDateAfterCheckIn,e.maxStayDateAfterCheckIn=a.maxStayDateAfterCheckIn),e.refresh(),e.isClickable&&!e.isSyncWithReservationFormInitialised&&(e.isSyncWithReservationFormInitialised=!0,e.initSyncWithReservationForm())},fillClickableCalendarDateData:function(e,t){var a,n,i,r,s;return this.isClickable?(i=MPHB.restApiHelper.getCachedAvailabilityData([this.roomTypeId],this.isShowPrices,this.isTruncatePrices,this.isShowPricesCurrency),a=A.datepick.formatDate("yyyy-mm-dd",t),void 0!==(a=null!=(i=(null!=(i=i[this.roomTypeId])?i:{})[a])?i:{})&&0!==Object.keys(a).length&&a.hasOwnProperty("roomTypeStatus")&&(!this.isCheckInSelected||(this.isCheckInSelected,this.isCheckOutSelected)?MPHB.calendarHelper.ROOM_STATUS_AVAILABLE!==a.roomTypeStatus||a.hasOwnProperty("isCheckInNotAllowed")&&a.isCheckInNotAllowed?(e.selectable=!1,e.dateClass+=" mphb-unselectable-date--check-in"):(e.selectable=!0,e.dateClass+=" mphb-selectable-date--check-in"):(!(null!==this.minCheckOutDateForSelection&&this.minCheckOutDateForSelection.getTime()<=t.getTime()&&(null===this.maxCheckOutDateForSelection||this.maxCheckOutDateForSelection.getTime()>=t.getTime()))||a.hasOwnProperty("isCheckOutNotAllowed")&&a.isCheckOutNotAllowed?(e.selectable=!1,e.dateClass+=" mphb-unselectable-date--check-out"):(e.selectable=!0,e.dateClass+=" mphb-selectable-date--check-out"),null!==this.minStayDateAfterCheckIn&&this.minStayDateAfterCheckIn.getTime()>t.getTime()&&(e.title+="\n"+MPHB._data.translations.lessThanMinDaysStay),null!==this.maxStayDateAfterCheckIn&&this.maxStayDateAfterCheckIn.getTime()<t.getTime()&&(e.title+="\n"+MPHB._data.translations.moreThanMaxDaysStay)),this.isCheckInSelected||this.isCheckOutSelected)&&(i=this.$calendarElement.datepick("getDate"),a=MPHB.Utils.cloneDate(i[0]),n=A.datepick.formatDate("yyyy-mm-dd",a),i=MPHB.Utils.cloneDate(i[1]),r=A.datepick.formatDate("yyyy-mm-dd",i),s=A.datepick.formatDate("yyyy-mm-dd",t),a.setHours(0,0,0,0),i.setHours(23,59,59,999),n===s?e.dateClass+=" mphb-selected-date--check-in":this.isCheckOutSelected&&r===s?e.dateClass+=" mphb-selected-date--check-out":this.isCheckInSelected&&this.isCheckOutSelected&&a.getTime()<=t.getTime()&&i.getTime()>=t.getTime()&&(e.dateClass+=" mphb-selected-date"))):e.selectable=!1,e},selectCheckInDateInCalendar:function(e){var t=this.$calendarElement.datepick("getDate");A.datepick.formatDate("yyyy-mm-dd",t[0])!==A.datepick.formatDate("yyyy-mm-dd",e)&&(this.isCheckInSelected&&!this.isCheckOutSelected&&(this.isCheckInSelected=!1),this.$calendarElement.datepick("setDate",e),A.datepick._getInst(this.$calendarElement).pickingRange=!0,this.refresh())},selectCheckOutDateInCalendar:function(e){var t;this.isCheckInSelected&&(t=this.$calendarElement.datepick("getDate"),A.datepick.formatDate("yyyy-mm-dd",t[1])!==A.datepick.formatDate("yyyy-mm-dd",e))&&(this.isCheckOutSelected&&(this.isCheckOutSelected=!1),this.$calendarElement.datepick("setDate",t[0],e),this.refresh())},initSyncWithReservationForm:function(){var a=this,e=this.$reservationFormCheckInElement.datepick("getDate")[0],t=this.$reservationFormCheckOutElement.datepick("getDate")[0];e&&(this.isSyncWithReservationFormOn=!1,this.selectCheckInDateInCalendar(e),t&&this.selectCheckOutDateInCalendar(t),this.isSyncWithReservationFormOn=!0),this.$reservationFormCheckInElement.change(function(e){var t=a.$reservationFormCheckInElement.datepick("getDate")[0];a.isSyncWithReservationFormOn=!1,a.selectCheckInDateInCalendar(t),a.isSyncWithReservationFormOn=!0}),this.$reservationFormCheckOutElement.change(function(e){var t=a.$reservationFormCheckOutElement.datepick("getDate")[0];void 0!==t&&(a.isSyncWithReservationFormOn=!1,a.selectCheckOutDateInCalendar(t),a.isSyncWithReservationFormOn=!0)})},fillReservationFormWithSelectedDates:function(e){var t;this.isSyncWithReservationFormOn&&(this.isCheckInSelected&&(t=this.$reservationFormCheckInElement.datepick("getDate")[0],A.datepick.formatDate("yyyy-mm-dd",e[0])!==A.datepick.formatDate("yyyy-mm-dd",t))&&this.$reservationFormCheckInElement.datepick("setDate",e[0]),this.isCheckOutSelected?(t=this.$reservationFormCheckOutElement.datepick("getDate")[0],A.datepick.formatDate("yyyy-mm-dd",e[1])!==A.datepick.formatDate("yyyy-mm-dd",t)&&this.$reservationFormCheckOutElement.datepick("setDate",e[1])):this.$reservationFormCheckOutElement.datepick("setDate",null))},refresh:function(){this.$calendarElement.hide(),A.datepick._update(this.$calendarElement,!0),this.$calendarElement.show()}}),MPHB.Datepicker("MPHB.RoomTypeCheckInDatepicker",{},{getDatepickSettings:function(){var n=this;return{defaultDate:this.firstAvailableCheckInDate,onShow:function(e,t){MPHB.restApiHelper.getAvailabilityData({start_date:new Date(t.drawDate.getFullYear(),t.drawDate.getMonth(),0),end_date:new Date(t.drawDate.getFullYear(),t.drawDate.getMonth()+MPHB._data.settings.numberOfMonthDatepicker,1),room_type_ids:[n.roomTypeId]},function(){n.lock()},function(){n.form.updateCheckOutLimitations(),n.refresh(),n.unlock()}),e.find(".datepick-highlight").removeClass("datepick-highlight")},onChangeMonthYear:function(e,t){MPHB.restApiHelper.getAvailabilityData({start_date:new Date(e,t-1,0),end_date:new Date(e,t-1+MPHB._data.settings.numberOfMonthDatepicker,1),room_type_ids:[n.roomTypeId]},function(){n.lock()},function(){n.refresh(),n.unlock()})},onSelect:function(e){n.form.updateCheckOutLimitations(),n.form.onDatepickChange(),n.form.checkOutDatepicker.clear(),n.element.trigger("change")},onDate:function(e,t){var a=MPHB.restApiHelper.getCachedAvailabilityData([n.roomTypeId]);return MPHB.calendarHelper.getCalendarDateAttributesFromAvailability(2,e,t,null!=(e=a[n.roomTypeId])?e:{})},pickerClass:"mphb-datepick-popup mphb-check-in-datepick "+MPHB._data.settings.datepickerClass}}}),MPHB.RoomTypeCheckOutDatepicker=MPHB.Datepicker.extend({},{minCheckOutDateForSelection:null,maxCheckOutDateForSelection:null,minStayDateAfterCheckIn:null,maxStayDateAfterCheckIn:null,updateCheckOutLimitations:function(e){var t;e?(t=MPHB.restApiHelper.getCachedAvailabilityData([this.roomTypeId]),t=MPHB.calendarHelper.calculateMinMaxCheckOutDateForSelection(e,null!=(t=t[this.roomTypeId])?t:{}),this.minCheckOutDateForSelection=t.minCheckOutDateForSelection,this.maxCheckOutDateForSelection=t.maxCheckOutDateForSelection,this.minStayDateAfterCheckIn=t.minStayDateAfterCheckIn,this.maxStayDateAfterCheckIn=t.maxStayDateAfterCheckIn,this.element.datepick("option","defaultDate",this.minCheckOutDateForSelection||e)):(this.minCheckOutDateForSelection=null,this.maxCheckOutDateForSelection=null,this.minStayDateAfterCheckIn=null,this.maxStayDateAfterCheckIn=null,this.element.datepick("option","defaultDate",this.firstAvailableCheckInDate))},getDatepickSettings:function(){var n=this;return{defaultDate:this.minCheckOutDateForSelection||this.firstAvailableCheckInDate,onShow:function(e,t){MPHB.restApiHelper.getAvailabilityData({start_date:new Date(t.drawDate.getFullYear(),t.drawDate.getMonth(),0),end_date:new Date(t.drawDate.getFullYear(),t.drawDate.getMonth()+MPHB._data.settings.numberOfMonthDatepicker,1),room_type_ids:[n.roomTypeId]},function(){n.lock()},function(){n.form.updateCheckOutLimitations(),n.refresh(),n.unlock()}),e.find(".datepick-highlight").removeClass("datepick-highlight")},onChangeMonthYear:function(e,t){MPHB.restApiHelper.getAvailabilityData({start_date:new Date(e,t-1,0),end_date:new Date(e,t-1+MPHB._data.settings.numberOfMonthDatepicker,1),room_type_ids:[n.roomTypeId]},function(){n.lock()},function(){n.form.updateCheckOutLimitations(),n.refresh(),n.unlock()})},onSelect:function(e){n.form.onDatepickChange(),n.element.trigger("change")},onDate:function(e,t){var a=MPHB.restApiHelper.getCachedAvailabilityData([n.roomTypeId]);return MPHB.calendarHelper.getCalendarDateAttributesFromAvailability(3,e,t,null!=(e=a[n.roomTypeId])?e:{},!1,n.form.checkInDatepicker.getDate(),n.minStayDateAfterCheckIn,n.maxStayDateAfterCheckIn,n.minCheckOutDateForSelection,n.maxCheckOutDateForSelection)},pickerClass:"mphb-datepick-popup mphb-check-out-datepick "+MPHB._data.settings.datepickerClass}}}),MPHB.SearchCheckInDatepicker=MPHB.Datepicker.extend({},{getDatepickSettings:function(){var a=this;return{defaultDate:this.firstAvailableCheckInDate,onShow:function(e,t){MPHB.restApiHelper.getAvailabilityData({start_date:new Date(t.drawDate.getFullYear(),t.drawDate.getMonth(),0),end_date:new Date(t.drawDate.getFullYear(),t.drawDate.getMonth()+MPHB._data.settings.numberOfMonthDatepicker,1)},function(){a.lock()},function(){a.form.updateCheckOutLimitations(),a.refresh(),a.unlock()}),e.find(".datepick-highlight").removeClass("datepick-highlight")},onChangeMonthYear:function(e,t){MPHB.restApiHelper.getAvailabilityData({start_date:new Date(e,t-1,0),end_date:new Date(e,t-1+MPHB._data.settings.numberOfMonthDatepicker,1)},function(){a.lock()},function(){a.refresh(),a.unlock()})},onSelect:function(e){a.form.updateCheckOutLimitations()},onDate:function(e,t){var a=MPHB.restApiHelper.getCachedAvailabilityData();return MPHB.calendarHelper.getCalendarDateAttributesFromAvailability(2,e,t,null!=(e=a[0])?e:{})},pickerClass:"mphb-datepick-popup mphb-check-in-datepick "+MPHB._data.settings.datepickerClass}}}),MPHB.SearchCheckOutDatepicker=MPHB.Datepicker.extend({},{minCheckOutDateForSelection:null,maxCheckOutDateForSelection:null,minStayDateAfterCheckIn:null,maxStayDateAfterCheckIn:null,updateCheckOutLimitations:function(e){var t;e?(t=MPHB.restApiHelper.getCachedAvailabilityData(),t=MPHB.calendarHelper.calculateMinMaxCheckOutDateForSelection(e,null!=(t=t[0])?t:{}),this.minCheckOutDateForSelection=t.minCheckOutDateForSelection,this.maxCheckOutDateForSelection=t.maxCheckOutDateForSelection,this.minStayDateAfterCheckIn=t.minStayDateAfterCheckIn,this.maxStayDateAfterCheckIn=t.maxStayDateAfterCheckIn,(!this.getDate()||this.getDate()<=e)&&this.setDate(this.minCheckOutDateForSelection)):(this.minCheckOutDateForSelection=null,this.maxCheckOutDateForSelection=null,this.minStayDateAfterCheckIn=null,this.maxStayDateAfterCheckIn=null)},getDatepickSettings:function(){var i=this;return{defaultDate:this.firstAvailableCheckInDate,onShow:function(e,t){MPHB.restApiHelper.getAvailabilityData({start_date:new Date(t.drawDate.getFullYear(),t.drawDate.getMonth(),0),end_date:new Date(t.drawDate.getFullYear(),t.drawDate.getMonth()+MPHB._data.settings.numberOfMonthDatepicker,1)},function(){i.lock()},function(){i.form.updateCheckOutLimitations(),i.refresh(),i.unlock()}),e.find(".datepick-highlight").removeClass("datepick-highlight")},onChangeMonthYear:function(e,t){var a=A.datepick._getInst(i.element[0]),n=new Date(a.drawDate.getTime()),a=null!=(a=i.form.getCheckInDate(
1))?a:new Date;MPHB.restApiHelper.getAvailabilityData({start_date:new Date(a.getFullYear(),a.getMonth(),0),end_date:new Date(e,t-1+MPHB._data.settings.numberOfMonthDatepicker,1)},function(){i.lock()},function(){i.form.updateCheckOutLimitations(),A.datepick._getInst(i.element[0]).drawDate=n,i.refresh(),i.unlock()})},onDate:function(e,t){var a=MPHB.restApiHelper.getCachedAvailabilityData();return MPHB.calendarHelper.getCalendarDateAttributesFromAvailability(3,e,t,null!=(e=a[0])?e:{},!1,i.form.checkInDatepicker.getDate(),i.minStayDateAfterCheckIn,i.maxStayDateAfterCheckIn,i.minCheckOutDateForSelection,i.maxCheckOutDateForSelection)},pickerClass:"mphb-datepick-popup mphb-check-out-datepick "+MPHB._data.settings.datepickerClass}}}),MPHB.SearchForm=can.Control.extend({},{checkInDatepicker:null,checkOutDatepicker:null,init:function(e){var t=(t=e.attr("data-first_available_check_in_date"))||A.datepick.formatDate("yyyy-mm-dd",new Date);this.checkInDatepicker=new MPHB.SearchCheckInDatepicker(e.find('.mphb-datepick[id^="mphb_check_in_date"]'),{form:this,roomTypeId:0,firstAvailableCheckInDateYmd:t}),this.checkOutDatepicker=new MPHB.SearchCheckOutDatepicker(e.find('.mphb-datepick[id^="mphb_check_out_date"]'),{form:this,roomTypeId:0,firstAvailableCheckInDateYmd:t})},getCheckInDate:function(){return this.checkInDatepicker.getDate()?MPHB.Utils.cloneDate(this.checkInDatepicker.getDate()):null},updateCheckOutLimitations:function(){this.checkOutDatepicker.updateCheckOutLimitations(this.checkInDatepicker.getDate())}}),MPHB.RoomBookSection=can.Control.extend({},{roomTypeId:null,roomTitle:"",roomPrice:0,quantitySelect:null,bookButton:null,confirmButton:null,removeButton:null,messageHolder:null,messageWrapper:null,form:null,init:function(e,t){this.reservationCart=t.reservationCart,this.roomTypeId=parseInt(e.attr("data-room-type-id")),this.roomTitle=e.attr("data-room-type-title"),this.roomPrice=parseFloat(e.attr("data-room-price")),this.confirmButton=e.find(".mphb-confirm-reservation"),this.quantitySelect=e.find(".mphb-rooms-quantity"),this.messageWrapper=e.find(".mphb-rooms-reservation-message-wrapper"),this.messageHolder=e.find(".mphb-rooms-reservation-message")},getRoomTypeId:function(){return this.roomTypeId},getPrice:function(){return this.roomPrice},".mphb-book-button click":function(e,t){t.preventDefault(),t.stopPropagation();t=this.quantitySelect.length?parseInt(this.quantitySelect.val()):1;this.reservationCart.addToCart(this.roomTypeId,t),MPHB._data.settings.isDirectBooking?(e.prop("disabled",!0),this.reservationCart.confirmReservation()):(e=(1==t?MPHB._data.translations.roomsAddedToReservation_singular:MPHB._data.translations.roomsAddedToReservation_plural).replace("%1$d",t).replace("%2$s",this.roomTitle),this.messageHolder.html(e),this.element.addClass("mphb-rooms-added"))},".mphb-remove-from-reservation click":function(e,t){t.preventDefault(),t.stopPropagation(),this.reservationCart.removeFromCart(this.roomTypeId),this.messageHolder.empty(),this.element.removeClass("mphb-rooms-added")},".mphb-confirm-reservation click":function(e,t){t.preventDefault(),t.stopPropagation(),this.reservationCart.confirmReservation()}}),MPHB.ReservationCart=can.Control.extend({},{cartForm:null,cartDetails:null,roomBookSections:{},cartContents:{},init:function(e,t){this.cartForm=e.find("#mphb-reservation-cart"),this.cartDetails=e.find(".mphb-reservation-details"),this.initRoomBookSections(e.find(".mphb-reserve-room-section"))},initRoomBookSections:function(e){var a,n=this;A.each(e,function(e,t){a=new MPHB.RoomBookSection(A(t),{reservationCart:n}),n.roomBookSections[a.getRoomTypeId()]=a})},addToCart:function(e,t){this.cartContents[e]=t,this.updateCartView(),this.updateCartInputs()},removeFromCart:function(e){delete this.cartContents[e],this.updateCartView(),this.updateCartInputs()},calcRoomsInCart:function(){var a=0;return A.each(this.cartContents,function(e,t){a+=t}),a},calcTotalPrice:function(){var a,n=0,i=this;return A.each(this.cartContents,function(e,t){a=i.roomBookSections[e].getPrice(),n+=a*t}),n},updateCartView:function(){var e;A.isEmptyObject(this.cartContents)?this.cartForm.addClass("mphb-empty-cart"):(e=(1==(e=this.calcRoomsInCart())?MPHB._data.translations.countRoomsSelected_singular:MPHB._data.translations.countRoomsSelected_plural).replace("%s",e),this.cartDetails.find(".mphb-cart-message").html(e),e=this.calcTotalPrice(),e=MPHB.format_price(e,{trim_zeros:!0}),this.cartDetails.find(".mphb-cart-total-price>.mphb-cart-total-price-value").html(e),this.cartForm.removeClass("mphb-empty-cart"))},updateCartInputs:function(){this.cartForm.find('[name^="mphb_rooms_details"]').remove();var a=this;A.each(this.cartContents,function(e,t){e=A("<input />",{name:"mphb_rooms_details["+e+"]",type:"hidden",value:t});a.cartForm.prepend(e)})},confirmReservation:function(){this.cartForm.submit()}}),MPHB.StripeGateway.PaymentMethods=can.Construct.extend({},{listAll:["card","bancontact","ideal","giropay","sepa_debit","klarna"],klarnaAllowedCountryCodes:["AT","AU","BE","CA","CH","CZ","DE","DK","ES","FI","FR","GB","GR","IE","IT","NL","NO","NZ","PL","PT","RO","SE","US"],listEnabled:["card"],paymentMethods:{},currentPayment:"card",currentCountry:"",currentCurrencyCode:"",inputs:null,isMounted:!1,init:function(e,t,a){this.listEnabled=e.slice(0),this.currentCurrencyCode=
1a,this.initPayments(),this.selectCountry(t)},initPayments:function(){var t=this;this.forEach(function(e){t.paymentMethods[e]={isEnabled:0<=t.listEnabled.indexOf(e),nav:null,fields:null}})},selectPayment:function(e){e!=this.currentPayment&&this.paymentMethods.hasOwnProperty(e)&&(this.togglePayment(this.currentPayment,!1),this.togglePayment(e,!0),this.currentPayment=e)},togglePayment:function(e,t){this.isMounted&&(this.paymentMethods[e].nav.toggleClass("active",t),this.paymentMethods[e].fields.toggleClass("mphb-hide",!t))},selectCountry:function(e){e!==this.currentCountry&&(this.currentCountry=e,this.selectPayment("card"),this.showRelevantMethods())},showRelevantMethods:function(){var n;this.isMounted&&((n=this).forEach(function(e,t){var a=t.isEnabled;"klarna"===e&&(a=-1!==n.klarnaAllowedCountryCodes.indexOf(n.currentCountry),"GB"===n.currentCountry)&&"GBP"!==n.currentCurrencyCode&&(a=!1),t.nav.toggleClass("mphb-hide",!a),t.fields.toggleClass("mphb-hide",e!=n.currentPayment)}),this.inputs.val([this.currentPayment]))},mount:function(a){this.forEach(function(e,t){t.nav=a.find(".mphb-stripe-payment-method."+e),t.fields=a.find(".mphb-stripe-payment-fields."+e)}),this.inputs=a.find('input[name="stripe_payment_method"]'),this.isMounted=!0,this.showRelevantMethods()},unmount:function(){this.forEach(function(e,t){t.nav=null,t.fields=null}),this.inputs=null,this.isMounted=!1},forEach:function(t){var a=this;this.listAll.forEach(function(e){t(e,a.paymentMethods[e],a)})},isEnabled:function(e){return this.paymentMethods[e].isEnabled},onlyCardEnabled:function(){return 1==this.listEnabled.length&&this.paymentMethods.card.isEnabled},isSelected:function(e){return e==this.currentPayment}}),MPHB._data.page.isCheckoutPage?new MPHB.CheckoutForm(A(".mphb_sc_checkout-form")):MPHB._data.page.isCreateBookingPage&&new MPHB.AdminCheckoutForm(A(".mphb_cb_checkout_form")),MPHB._data.page.isSearchResultsPage&&new MPHB.ReservationCart(A(".mphb_sc_search_results-wrapper"));var t,e=A(".mphb-calendar.mphb-datepick"),e=(A.each(e,function(e,t){new MPHB.RoomTypeCalendar(A(t))}),A(".mphb-booking-form")),e=(A.each(e,function(e,t){new MPHB.ReservationForm(A(t))}),A("form.mphb_sc_search-form, form.mphb_widget_search-form, form.mphb_cb_search_form")),e=(A.each(e,function(e,t){new MPHB.SearchForm(A(t))}),A(".mphb-flexslider-gallery-wrapper")),e=(A.each(e,function(e,t){new MPHB.FlexsliderGallery(t)}),A(".mphb-checkout-terms-wrapper"));0<e.length&&new MPHB.TermsSwitcher(e),null==A.ui&&(A.ui={}),null==A.ui.version&&(A.ui.version="1.5-")})})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.