PageSourceSearch

https://www.searchandstay.com/_nuxt/DqFhJ_wK.js

js searchandstay.com collected 2026-09-24 13:04:37 UTC 33,146 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CxZ5tGmI.js","./D9Q9swNm.js","./DlAUqK2U.js","./Error.CfWu_peP.css"])))=>i.map(i=>d[i]);
2import{_ as Z}from"./ZdSR-3Is.js";import{u as ee,_ as te}from"#entry";import{at as ie,I as g,ap as se,J as L,a1 as u,_ as H,aj as q,a6 as b,ac as R,ah as A,j as K,a4 as N,al as ae,a2 as _,f as oe,a3 as Q,Y as W,ad as E,W as ne}from"./D9Q9swNm.js";import{u as U}from"./CeGCRHgb.js";import re from"./DclrCUym.js";import{_ as de}from"./DlAUqK2U.js";import"./BrDF5UPz.js";import"./EFBNc4s0.js";import"./DS6nK5rs.js";const le=["id"],he={key:1},me=["data-tip"],ce=["id"],fe={key:1},ue={props:{afterToday:{type:Boolean,default:!1},isSelected:{type:Boolean,default:!1},isInfinity:{type:Boolean,default:!1},isRange:{type:Boolean,default:!1},picker:{type:Boolean,default:!1},validCheckout:{type:Boolean,default:!1},lastDayOfMonth:{type:[Number,String],default:void 0},today:{type:Boolean,default:!1},day:{type:Object,default:()=>({})},positionGrid:{type:[Number,String],default:0},mindex:{type:[Number,String],default:void 0},gi:{type:[Number,String],default:void 0},g:{type:[Number,String],default:void 0},detailed:{type:Boolean,default:!1}},emits:["click","hover"],data(){return{show:!1}},computed:{elementId(){return`${this.picker?"picker_":""}date_${this.mindex}_${this.gi}`},listeners(){const e={click:()=>{if(!this.afterToday&&!this.isInfinity||this.today)return!1;this.$emit("click",{...this.$props})}};return{...this.$attrs,...e}},tooltipTrigger(){return this.isSelected?"manual":"hover"}},watch:{isSelected(e){e&&this.showTooltip()}},methods:{hoverMe(e){this.$emit("hover",{isHover:e,...this.$props})},showTooltip(){this.show=!!this.day.summary,setTimeout(()=>{this.show=!1},5e3)}}},ye=Object.assign(ue,{__name:"CalendarDay",setup(e){const{$screen:t}=ee();return(i,o)=>{const r=ie("sas-tooltip");return L(t)?.isMobile?(u(),g("div",{key:0,class:A(["calendar-month-week-grid-day-parent",{"tooltip tooltip-accent":e.day?.summary&&!L(t)?.isMobile}]),onMouseleave:o[0]||(o[0]=a=>i.hoverMe(!1)),onMouseover:o[1]||(o[1]=a=>i.hoverMe(!0))},[e.positionGrid>=1&&e.positionGrid<=e.lastDayOfMonth?(u(),g("div",H({key:0,class:{afterToday:e.isInfinity||e.afterToday,isSelected:e.isSelected,isRange:e.isRange,validCheckout:e.validCheckout,"calendar-month-week-grid-day":!0,today:e.today,blocked:e.day.isBlocked,blockedMorning:e.day.isBlockedMorning,blockedAfternoon:e.day.isBlockedAfternoon,blockedFull:e.day.isBlockedFull,restricted:e.day.isRestricted||e.day.isCheckoutUnavailable,booked:e.day.isBooked,checkin:e.day.isCheckin,checkout:e.day.isCheckout,bookingAfternoon:e.day.isBookingAfternoon,bookingMorning:e.day.isBookingMorning,bookedFull:e.day.isBookedFull,cleaningAfternoon:e.day.isCleaningAfternoon,cleaningMorning:e.detailed?e.day.isCleaningMorning:!1,cleaning:e.detailed?e.day.isCleaning:!1}},q(i.listeners,!0)),[b("div",{id:i.elementId},R(e.positionGrid),9,le)],16)):(u(),g("div",he," "))],34)):se((u(),g("div",{key:1,"data-tip":e.day?.summary,class:A(["calendar-month-week-grid-day-parent",{"tooltip tooltip-accent":e.day?.summary&&!L(t)?.isMobile}]),onMouseleave:o[2]||(o[2]=a=>i.hoverMe(!1)),onMouseover:o[3]||(o[3]=a=>i.hoverMe(!0))},[e.positionGrid>=1&&e.positionGrid<=e.lastDayOfMonth?(u(),g("div",H({key:0,class:{afterToday:e.isInfinity||e.afterToday,isSelected:e.isSelected,isRange:e.isRange,validCheckout:e.validCheckout,"calendar-month-week-grid-day":!0,today:e.today,blocked:e.day.isBlocked,blockedMorning:e.day.isBlockedMorning,blockedAfternoon:e.day.isBlockedAfternoon,blockedFull:e.day.isBlockedFull,restricted:e.day.isRestricted||e.day.isCheckoutUnavailable,booked:e.day.isBooked,checkin:e.day.isCheckin,checkout:e.day.isCheckout,bookingAfternoon:e.day.isBookingAfternoon,bookingMorning:e.day.isBookingMorning,bookedFull:e.day.isBookedFull,cleaningAfternoon:e.day.isCleaningAfternoon,cleaningMorning:e.detailed?e.day.isCleaningMorning:!1,cleaning:e.detailed?e.day.isCleaning:!1}},q(i.listeners,!0)),[b("div",{id:i.elementId},R(e.positionGrid),9,ce)],16)):(u(),g("div",fe," "))],42,me)),[[r,"calendar-container"]])}}}),ke={props:{controls:{type:Boolean,default:!1},externalControls:{type:Boolean,default:!1},dark:{type:Boolean,default:!1},detailed:{type:Boolean,default:!1},downloadable:{type:Boolean,default:!1},forceBlockedDates:{type:Array,default:()=>[]},forceDates:{type:Array,default:()=>[]},light:{type:Boolean,default:!1},infinity:{type:Boolean,default:!1},months:{type:Number,default:2},noBlocks:{type:Boolean,default:!1},noPeriodCheck:{type:Boolean,default:!1},noValidation:{type:Boolean,default:!1},picker:{type:Boolean,default:!1},property:{type:Object,default:()=>({})},showSummary:{type:Boolean,default:!1},forceSeasons:{type:Array,default:()=>[]}},data(){return{minimumStay:1,validPeriod:{}}},computed:{stateSeasons(){return U().seasonsPropertyMonth??{}},isCheckinMorning(){return parseInt(this.property.property_configurations?.hour_check_in)<=12},isCheckoutMorning(){return parseInt(this.property.property_configurations?.hour_check_out)<=12},isCheckouting(){return this.currentAction==="to"},propertyHasConnection(){return this.property.properties?.connections?.p},seasons(){return this.noValidation?[]:(this.stateSeasons[this.property?.properties?.id]||this.currentProperty?.property_seasons||this.forceSeasons)??[]}}
2,watch:{month:{handler(){this.getSeasonMonth()},immediate:!0,deep:!0},year:{handler(){this.getSeasonMonth()},immediate:!0}},mounted(){window.currentSeasonOfDate=this.currentSeasonOfDate},methods:{getSeasonMonth(){const e=this.$moment(`${this.month}/${this.year}`,"MM/YYYY");if(this.picker&&!this.noValidation&&!this.loading&&!Array.isArray(this.seasons)&&this.propertyHasConnection){const t=[];this.seasons[e.format("MM/YYYY")]||t.push(U().getSeasonsByPropertyByMonth({id:this.property?.properties?.id,start_date_from:e.startOf("month").format("YYYY-MM-DD"),start_date_end:e.endOf("month").format("YYYY-MM-DD")}));const i=e.add(1,"month");this.seasons[i.format("MM/YYYY")]||t.push(U().getSeasonsByPropertyByMonth({id:this.property?.properties?.id,start_date_from:i.startOf("month").format("YYYY-MM-DD"),start_date_end:i.endOf("month").format("YYYY-MM-DD")})),t.length&&(this.loading=!0,Promise.all(t).finally(()=>{this.loading=!1}))}},currentSeasonOfDate(e){if(!this.property||!Object.keys(this.property).length)return{};let t=this.seasons??[];return Array.isArray(t)||(t=this.seasons[e.format("MM/YYYY")]??[]),t.find(i=>{if(i.start_date&&i.published)return e.startOf("day").isBetween(i.start_date,i.end_date,null,"[]")})??{}},getYear(e){return this.$moment(this.month+"/"+this.year,"MM/YYYY").add(e,"months").format("YYYY")},getMonthOffset(e,t){const i=t??this.$moment(this.month+"/"+this.year,"MM/YYYY");return(e.year()-i.year())*12+(e.month()-i.month())},getGridWeekDay(e){return e%7},getMinimumStayFromDate(e){const i=this.currentSeasonOfDate(e);return i&&i.minimum_stay?i.minimum_stay:this.property?.property_pricings&&this.property.property_pricings?this.property.property_pricings.minimum_stay:1},getMinimumStay(e){const t=this.currentSeasonOfDate(e);if(t&&t.minimum_stay){this.minimumStay=t.minimum_stay;return}if(this.property?.property_pricings){this.minimumStay=this.property.property_pricings.minimum_stay||1;return}return 1},getPeriodMessage(e,t=!1){let i="";return e.dateFrom?(i+=`The closest valid booking period is ${e.dateFrom.format("Do MMMM YYYY")}`,e.dateTo&&(i+=` to ${e.dateTo.format("Do MMMM YYYY")}`)):t||(i+="There are no days available for booking"),i},getValidPeriod(e){if(!e)return{};let t=!0;const i={},o=this.$moment().add(this.maxDaysAllowed,"months"),r=this.$moment(this.month+"/"+this.year,"MM/YYYY"),a=e.clone();let s=1;do{const c=a.clone().endOf("month").date(),D=this.getMonthOffset(a,r);for(let y=a.date();y<c+1;y++){const f=a.clone();f.set({date:y});const m=this.checkBlocked(y,D,f.day());if(m.isRestricted&&m.isRestrictedCheckInDays,m.isRangeValid||m.isBlockedFull||m.isRestrictedCheckin||m.isBookedFull)continue;s=this.getMinimumStayFromDate(f);const k=f.clone().add(s,"days");let d,Y=!0,C=!0;for(let B=1;C&&Y;B++){const v=f.clone().add(B,"days"),$=this.checkBlocked(v.date(),this.getMonthOffset(v,r),v.day(),{from:f.format("YYYY-MM-DD"),range:!0});Y=!$.isBlockedFull&&!$.isBookedFull&&!$.isCheckoutUnavailable,Y&&v.isSameOrAfter(k)&&!$.isRestricted&&(d=v,C=!1)}if(Y){i.dateFrom=f,i.dateTo=d,t=!1;break}}if(t){a.add(1,"month").startOf("month");const y=a.clone().set({date:o.date()}).endOf("day");t=o.isAfter(y)}}while(t);return this.validPeriod=i,i},checkValidDayPeriod(e,t){return!(e&&(t.isBlockedAfternoon||t.isBlockedMorning)||!e&&t.isBlockedAfternoon||e&&(t.isBookingMorning||t.isBookingAfternoon)||!e&&t.isBookingAfternoon)},checkValidPeriod(e){const t=e.from,i=e.to,o=this.$moment(this.month+"/"+this.year,"MM/YYYY");let r=!0;for(let a=t.clone();a.isSameOrBefore(i)&&r;a.add(1,"days")){const s=this.checkBlocked(a.date(),this.getMonthOffset(a,o),a.day());if(s.isRangeValid){r=!0;continue}const c=a.isSame(i,"day"),D=a.isSame(t,"day");if(r=!(s.isBlockedFull||s.isBookedFull||(D||c)&&s.isRestricted&&!s.isRestrictedCheckInOutDays),!!r)if(c){if(this.isCheckoutMorning)continue;r=this.checkValidDayPeriod(this.isCheckoutMorning,s)}else D?r=this.checkValidDayPeriod(this.isCheckinMorning,s)&&!s.isCheckoutUnavailable:r=!(s.isBlockedMorning||s.isBlockedAfternoon||s.isBookingMorning||s.isBookingAfternoon)}return r},checkSummaryText(e){const t="Unavailable";return["airbnb","vrbo","booking.com"].filter(o=>e.toLowerCase().includes(o)).length?t:e},checkBlocked(e,t,i,o={}){let r=this.$moment(this.month+"/"+this.year,"MM/YYYY").add(t,"months").format("MM");const a=this.$moment(this.getYear(t)+"-"+r+"-"+e,"YYYY-MM-DD");let s=a.format("YYYY-MM-DD");this.$moment().startOf("day");let c=!1,D=!1,y=!1,f=!1,m=!1,k=!1,d=!1,Y=!1,C=!1,B=!1,v=!1,$=!1,V=!1,O=!1,F=!1,w=!1,I=!1,z=!1,x=!1,T=!1,G=!1,j=!1,h="",p=null,X={};if(!this.isAfterToday(e,t)&&!o.range)return{isBlocked:c,isBlockedMorning:D,isBlockedAfternoon:y,isBlockedFull:f,isBlockedArrival:k,isRestricted:d,isRestrictedCheckInOutDays:Y,isRestrictedCheckInDays:C,isRestrictedCheckOutDays:B,isBooked:v,isCheckin:$,isCheckout:V,isBookingMorning:O,isBookingAfternoon:F,isBookedFull:w,isCleaningMorning:z,isCleaningAfternoon:x,isCleaning:T,isCheckoutUnavailable:G,isRangeValid:j,summary:h};if(p=this.currentSeasonOfDate(a),this.maxDaysAllowed){const n=this.$moment().add(this.maxDaysAllowed,"months").format("YYYY-MM-DD");this.$moment(s,"YYYY-MM-DD").isSameOrAfter(this.$moment(n,"YYYY-MM-DD"))&&(c=!0,f=!0,this.picker?h="Blocked Date":h=`Blocked Date - Max allowed date is ${this.maxDaysAllowed} month${this.maxDaysAllowed>1?"s":""} in advance`)}if(this.blockedDates){let n=this.blockedDates.filter(function(l){return typeof l=="object"&&l!==null}),M=this.blockedDates.filter(function(l){return typeof l=="string"});
2n.forEach(l=>{const S=this.$moment(l.start_date),P=this.$moment(l.end_date);(this.$moment(s).isBetween(S,P,null,"[]")||this.$moment(s).startOf("day").isSame(S.startOf("day"))||this.$moment(s).startOf("day").isSame(P.startOf("day")))&&(c=!0,d=!1,this.detailed?h=l.summary?this.checkSummaryText(l.summary.split(" - ")[0].trim()):"":h="Blocked",this.$moment(s).isSame(l.start_date)&&(y=!0),this.$moment(s).isSame(l.end_date)&&(D=!0),(!this.$moment(s).startOf("day").isSame(S.startOf("day"))&&!this.$moment(s).startOf("day").isSame(P.startOf("day"))||this.$moment(s).startOf("day").isSame(S.startOf("day"))&&this.$moment(s).startOf("day").isSame(P.startOf("day")))&&(m=!0))}),M.forEach(l=>{s===l&&(c=!0,this.detailed?h=l.summary?this.checkSummaryText(l.summary.split(" - ")[0].trim()):"":h="Blocked",this.$moment(s).isSame(l.start_date)&&(y=!0),this.$moment(s).isSame(l.end_date)&&(D=!0),(!this.$moment(s).isSame(l.start_date)&&!this.$moment(s).isSame(l.end_date)||this.$moment(s).isSame(l.start_date)&&this.$moment(s).isSame(l.end_date))&&(m=!0))})}this.bookings.length>0&&(this.bookings.filter(n=>n.type=="booked").map(n=>{this.$moment(s).startOf("day").isBetween(n.booking_checkin_date,n.booking_checkout_date,"day","[]")&&(c=!1,d=!1,v=!0,h="Blocked",this.$moment(s).isSame(n.booking_checkin_date,"day")&&($=!0,h+=" - Check-in",F=!0),this.$moment(s).isSame(n.booking_checkout_date,"day")&&(V=!0,h+=" - Check-out",O=!0),!this.$moment(s).isSame(n.booking_checkout_date,"day")&&!this.$moment(s).isSame(n.booking_checkin_date,"day")&&(I=!0))}),this.bookings.filter(n=>n.type=="cleaning").map(n=>{const M=this.$moment(n.booking_checkin_date),l=this.$moment(n.booking_checkout_date);(this.$moment(s).startOf("day").isBetween(M,l,"day","{]")||this.$moment(s).startOf("day").isSame(M.startOf("day"))||this.$moment(s).startOf("day").isSame(l.startOf("day")))&&(c=!1,d=!1,T=!0,this.detailed?(v&&V&&O&&(x=!0),v&&T?h+=" - Checkout / Cleaning day":h="Cleaning Day"):(v=!0,h="Blocked",this.$moment(s).isSame(M,"day")&&($=!0,F=!0),this.$moment(s).isSame(l,"day")&&(V=!0,h+=" - Check-out",O=!0)),!this.$moment(s).isSame(n.booking_checkout_date,"day")&&!this.$moment(s).isSame(n.booking_checkin_date,"day")&&(I=!0))})),I&&(w=!0),this.property?.properties?.blocked_dates_system&&this.property?.properties?.blocked_dates_system?.forEach(n=>{const M=this.$moment(n.from),l=this.$moment(n.to);(this.$moment(s).startOf("day").isBetween(M.startOf("day"),l.startOf("day"),null,"[]")||this.$moment(s).startOf("day").isSame(M.startOf("day"))||this.$moment(s).startOf("day").isSame(l.startOf("day")))&&(c=!0,d=!1,h="Blocked",this.showSummary&&(n.summary?h=n.summary:n.block_type&&(h+=` ${n.block_type}`)),this.$moment(s).startOf("day").isSame(M.startOf("day"))&&(y=!0),this.$moment(s).startOf("day").isSame(l.startOf("day"))&&(D=!0),!this.$moment(s).startOf("day").isSame(M.startOf("day"))&&!this.$moment(s).startOf("day").isSame(l.startOf("day"))&&(m=!0))}),this.vendorBlocking.forEach(n=>{this.$moment(s).isBetween(n.from,n.to,null,"[]")&&(c=!0,d=!1,h="Blocked",this.showSummary&&(n.summary?h=n.summary:n.block_type&&(h+=` ${n.block_type}`)),this.$moment(s).isSame(n.from)&&(y=!0),this.$moment(s).isSame(n.to)&&(D=!0),!this.$moment(s).isSame(n.from)&&!this.$moment(s).isSame(n.to)&&(m=!0))}),(m||D&&y)&&(f=!0);const J=Object.keys(o).length;if(!c&&!d&&!J&&this.innerValue.from?(d=[1,3].includes(p?.changeover),Y=d,B=d,d&&(h="Restricted Check-out Day")):!c&&!d&&!J&&(d=[2,3].includes(p?.changeover),Y=d,C=d,d&&(h="Restricted Check-in Day")),this.property?.property_configurations?.time_before_arrival){const n=a.clone().subtract(this.property?.property_configurations?.time_before_arrival,"hours");this.$moment().isSameOrAfter(n)&&(k=!0,c=!0,f=!0,h=`Preparation time before arrival is ${this.property?.property_configurations?.time_before_arrival} hours`)}if(!f&&!d&&!w&&(p?.check_in_days?.length>0&&p?.checkin_active_flag&&!p?.check_in_days.includes(parseInt(this.getGridWeekDay(i)))&&!this.isCheckouting?(d=!0,Y=!0,C=!0,this.detailed?h=`Season ${p.name} - Restricted Check-in Day`:this.showSummary&&(h="Restricted Check-in Day")):p?.check_out_days?.length>0&&p?.checkout_active_flag&&!p?.check_out_days.includes(parseInt(this.getGridWeekDay(i)))&&this.isCheckouting?(d=!0,Y=!0,B=!0,this.detailed?h=`Season ${p.name} - Restricted Check-out Day`:this.showSummary&&(h="Restricted Check-out Day")):!this.isCheckouting&&!Y&&this.property?.property_pricings?.checkin_active_flag&&!this.property?.property_pricings?.check_in_days?.includes(parseInt(this.getGridWeekDay(i)))?(d=!0,Y=!0,C=!0,h="Restricted Check-in Day"):this.isCheckouting&&!Y&&this.property?.property_pricings?.checkout_active_flag&&!this.property?.property_pricings?.check_out_days?.includes(parseInt(this.getGridWeekDay(i)))&&(d=!0,Y=!0,B=!0,h="Restricted Check-out Day")),!this.property?.property_pricings?.checkout_active_flag&&!Y&&!v&&!y&&!Y&&!this.isCheckouting&&(d=!1,h=""),this.picker&&!o.range){const n=o.from||this.innerValue.from,M=this.$moment(n);if(n&&a.isAfter(M)){let l=this.getMinimumStayFromDate(M);this.getMinimumStay(M);const S=this.$moment(this.$moment(n,"YYYY-MM-DD").add(l,"days").toDate()),P=w;a.isBefore(S)&&!P&&(G=!0,h=`${l} night${l>1?"s":""} minimum stay`)}else n===s&&!this.innerValue.to&&(h="Select date to checkout")}if(this.forceDates.length){const n=this.forceDates.find(M=>M.date===s);n&&(!this.isCheckouting&&s!==this.innerValue.from?d=!n.checkin:s!==this.innerValue.from&&(d=!n.checkout),j=!n.checkin&&!n.checkout)}return{isBlocked:c,isBlockedMorning:D,isBlockedAfternoon:y,isBlockedFull:f,isBlockedArrival:k,isRestricted:d,isRestrictedCheckInOutDays:Y,isRestrictedCheckInDays:C,isRestrictedCheckOutDays:B,isBooked:v,isCheckin:$,isCheckout:V,isBookingMorning:O,isBookingAfternoon:F,isBookedFull:w,isCleaningMorning:z,isCleaningAfternoon:x,isCleaning:T,isCheckoutUnavailable:G,isRangeValid:j,summary:h,options:X}}}},ge=ne(()=>Z(()=>import("./CxZ5tGmI.js"),__vite__mapDeps([0,1,2,3]),import.meta.url).then(e=>e.default||e)),Ye={components:{LoadingSpinner:re,CalendarDay:ye},mixins:[ke],inheritAttrs:!1,props:{actionPicker:{type:String,default:"from"},modelValue:{type:Object,default:()=>({})},dateParams:{type:Object,default:()=>({})},single:{type:Boolean,default:!1},stateLoading:{type:Boolean,default:!1},noCheckPeriod:{type:Boolean,default:!1}},emits:["select:to","select:from","next:year","update:modelValue","update:stateLoading","prevNextMonth","invali
2d","action"],data(){return{disableNavPast:!0,disableNavFuture:!1,innerValue:{from:"",to:""},currentAction:"",hoverTo:null,message:"",messageType:"alert-error",dismissCountDown:10,stateMonth:this.$moment().format("MM"),stateYear:this.$moment().format("YYYY")}},computed:{showAlert(){return!!this.message},month:{get(){return this.stateMonth},set(e){return this.setMonth(e)}},year:{get(){return this.stateYear},set(e){return this.setYear(e)}},loading:{get(){return this.stateLoading},set(e){return this.setLoading(e)}},blockedDates(){return this.noValidation?[]:this.currentProperty?.properties?.blocked_dates||[]},bookings(){return this.noValidation?[]:this.currentProperty?.property_booking_reservations||[]},currentProperty(){return this.noValidation?{}:this.property},maxDaysAllowed(){return this.noValidation||this.noBlocks?null:this.currentProperty?.properties?.maximum_rental_days_allowed},vendorBlocking(){if(this.noValidation)return[];const e=[...this.currentProperty?.property_blocked_dates||[]];return this.forceBlockedDates?.length&&e.push(...this.forceBlockedDates),e},calendarClasses(){const e={"opacity-25":this.loading};return e[`sm:grid-cols-${this.months}`]=this.months>1,e}},watch:{actionPicker:{handler(e){this.currentAction=e}},currentAction:{handler(e){this.$emit("action",e)}},currentProperty:{deep:!0,immediate:!0,handler(e){if(e&&Object.keys(e).length){const t=this.checkCurrentDates();t.valid||this.$emit("invalid",t)}}},innerValue:{deep:!0,handler(e){this.$emit("update:modelValue",e)}},modelValue:{deep:!0,immediate:!0,handler(e){e?this.innerValue=e:this.innerValue={from:"",to:""}}},dateParams:{deep:!0,handler(e){e.from!==void 0&&e.to!==void 0&&(this.innerValue.from=this.$moment(e.from).format("YYYY-MM-DD"),this.innerValue.to=this.$moment(e.to).format("YYYY-MM-DD"))}}},beforeMount(){this.months===12&&this.setMonth(1)},mounted(){if(this.innerValue.from){const e=this.$moment(this.innerValue.from,"YYYY-MM-DD");this.month=e.format("MM"),this.year=e.format("YYYY")}this.testPastNav(),this.testFutureNav(),window.$moment=this.$moment()},methods:{setMonth(e){this.stateMonth=e},setYear(e){this.stateYear=e},setLoading(e){this.$emit("update:stateLoading",e)},setActionPicker(e){this.currentAction=e},setMessage(e,t){this.message=e,this.messageType=t},checkCurrentDates(){if(!this.innerValue?.from||!this.innerValue.to)return{valid:!0};const e={from:this.$moment(this.modelValue.from),to:this.$moment(this.modelValue.to)},t=this.checkValidPeriod(e);if(!t){this.getMinimumStay(e.from);const i=this.getValidPeriod(e.from),o=`Date is not available for booking. ${this.getPeriodMessage(i)}`;return{valid:t,validPeriod:i,message:o}}return{valid:!0}},dismissedAlert(){this.message="",this.dismissCountDown=10},checkDateSelected(e,t){const i=this.$moment(`${this.month}/${this.year}`,"MM/YYYY").add(t,"months").add(e-1,"days").startOf("day"),o=this.innerValue.from?this.$moment(this.innerValue.from,"YYYY-MM-DD").startOf("day"):null,r=this.innerValue.to?this.$moment(this.innerValue.to,"YYYY-MM-DD").startOf("day"):null;return i.isSame(o)||i.isSame(r)},checkDateRange(e,t){const i=this.$moment(`${this.month}/${this.year}`,"MM/YYYY").add(t,"months").add(e-1,"days").startOf("day"),o=this.innerValue.from?this.$moment(this.innerValue.from,"YYYY-MM-DD").startOf("day"):null;let r=this.innerValue.to?this.$moment(this.innerValue.to,"YYYY-MM-DD").startOf("day"):null;return this.isCheckouting&&this.hoverTo&&(r=this.hoverTo),i.isAfter(o)&&i.isBefore(r)},selectDay(e){if(!e.day||!e.picker)return!1;this.message="";const t=this.$moment(`${this.month}/${this.year}`,"MM/YYYY").add(e.mindex,"months").startOf("day").set({date:e.positionGrid});if(this.innerValue.from!==void 0&&this.innerValue.to!==void 0){this.innerValue.from=t.format("YYYY-MM-DD"),this.innerValue.to=void 0,this.currentAction="to";return}const i=this.innerValue.from?this.$moment(this.innerValue.from,"YYYY-MM-DD"):null,o=!this.innerValue.from||this.currentAction==="from";if(!o&&(t.isBefore(i)||t.isSame(i))){this.message="Checkout date must be after checkin date";return}if(this.noBlocks){o?this.changeDateFrom(t,e.day):this.changeDateTo(t,e.day);return}const r=(a="",s={},c=!1)=>{const D=a;let y="";
2return s?.dateFrom?(y+=` The closest valid booking period is ${s.dateFrom.format("Do MMMM YYYY")}`,s?.dateTo&&(y+=` to ${s.dateTo.format("Do MMMM YYYY")}`)):c||(y+=" There are no days available for booking"),`${D}.${y}`};if(e.day.isBookedFull){this.message=r("Date already booked",this.noPeriodCheck?"":this.getValidPeriod(o?t:i,o),this.noPeriodCheck);return}if(e.day.isBlockedFull){this.message=r("Date is blocked",this.noPeriodCheck?"":this.getValidPeriod(o?t:i,o),this.noPeriodCheck);return}if(e.day.isRestricted){this.message=r("Date not available for booking",this.noPeriodCheck?"":this.getValidPeriod(o?t:i,o),this.noPeriodCheck);return}if(e.day.isCheckoutUnavailable){this.message=r(`${this.minimumStay} night${this.minimumStay>1?"s":""} minimum stay`,{},!0);return}if(o&&e.day.isBooked&&e.day.isCheckin){this.message=r("Date already have a checkin",this.noPeriodCheck?"":this.getValidPeriod(o?t:i,o),this.noPeriodCheck);return}else if(!o&&e.day.isBooked&&e.day.isCheckout){this.message=r("Date already have a checkout",{},!0);return}if(o&&this.innerValue.to){if(!this.checkValidDayPeriod(this.isCheckinMorning,e.day)){this.message=r("Date not available for booking",this.noPeriodCheck?"":this.getValidPeriod(o?t:i,o),this.noPeriodCheck);return}this.checkValidPeriod({from:t,to:this.$moment(this.innerValue.to,"YYYY-MM-DD")})||(this.innerValue.to="",this.message=r("Invalid date",this.noPeriodCheck?"":this.getValidPeriod(o?t:i,o),this.noPeriodCheck)),this.changeDateFrom(t,e.day)}else if(o){if(!this.checkValidDayPeriod(this.isCheckinMorning,e.day)){this.message=r("Date not available for booking",this.noPeriodCheck?"":this.getValidPeriod(o?t:i,o),this.noPeriodCheck);return}this.changeDateFrom(t,e.day)}else this.checkValidPeriod({from:i,to:t})||this.propertyHasConnection?this.changeDateTo(t,e.day):this.message=r("Invalid date",this.noPeriodCheck?"":this.getValidPeriod(o?t:i,o),this.noPeriodCheck)},changeDateFrom(e,t){const i=this.innerValue.to?this.$moment(this.innerValue.to,"YYYY-MM-DD"):null;i&&i.isBefore(e)&&(this.innerValue.to=""),this.currentProperty&&Object.keys(this.currentProperty).length&&this.getMinimumStay(e),this.currentAction="to",this.innerValue.from=e.format("YYYY-MM-DD"),this.$emit("select:from",{controller:{setMessage:this.setMessage,setActionPicker:this.setActionPicker},date:this.innerValue.from,dayProps:t})},changeDateTo(e,t){if(!this.noBlocks&&this.currentProperty&&Object.keys(this.currentProperty).length){const i=this.currentProperty?.property_booking_reservations?.map?.(s=>({...s,checkin:this.$moment(s.booking_calendar_hour_check_in).startOf("day"),checkout:this.$moment(s.booking_calendar_hour_check_out).startOf("day")}))||[],o=this.$moment(this.innerValue.from,"YYYY-MM-DD").startOf("day");if(i?.filter(s=>s.checkin.isBetween(o,e)||s.checkout.isBetween(o,e)).length){this.message="Date is not available for checkout. There are some dates reserved";return}if(Number(this.currentProperty?.property_configurations?.block_cleaning||0)){const s=e.clone().add(Number(this.currentProperty.property_configurations.block_cleaning),"days").startOf("day");if(i?.filter(c=>s.isBetween(c.checkin,c.checkout)).length){this.messageType="alert-error",this.message=`Property needs ${this.currentProperty.property_configurations.block_cleaning} day${Number(this.currentProperty.property_configurations.block_cleaning)>1?"s":""} reserved for cleaning`;return}}const a=this.currentSeasonOfDate(e);if(a&&Object.keys(a).length&&a.block_cleaning_days){const s=e.clone().add(a.block_cleaning_days,"days").startOf("day");if(i?.filter(c=>c.checkin.isSame(s)||c.checkout.isSame(s)).length){this.messageType="alert-error",this.message=`Property needs ${a.block_cleaning_days} day${a.block_cleaning_days>1?"s":""} reserved for cleaning`;return}}}this.innerValue.to=e.format("YYYY-MM-DD"),this.$emit("select:to",{controller:{setMessage:this.setMessage,setActionPicker:this.setActionPicker},date:this.innerValue.to,dayProps:t})},async downloadCalendar(){const e=`${window.location}/${this.currentProperty.id}/ical`;try{await navigator.clipboard.writeText(e),alert("Link copied to clipboard")}catch(t){alert("Error in copying link: ",t)}}
2,hoverDay(e){if(this.isCheckouting&&e.isHover&&this.innerValue.from&&!this.innerValue.to){const t=this.$moment(`${this.month}/${this.year}`,"MM/YYYY").add(e.mindex,"months").startOf("day");if(t.set({date:e.positionGrid}),t.isBefore(this.$moment(this.innerValue.from,"YYYY-MM-DD")))return!1;this.hoverTo=t}else this.hoverTo=null},nextYear(){this.year=this.$moment(this.year,"YYYY").add(1,"year").format("YYYY"),this.testPastNav(),this.testFutureNav(),this.$emit("prevNextMonth",this.month,this.year),this.$emit("next:year",this.year)},prevYear(){const e=this.$moment(`${this.year}-${this.month}`,"YYYY-MM"),t=e.diff(this.today(),"years");let i;this.infinity||t>0?i=e.clone().subtract(1,"years"):i=this.$moment(this.today()),this.month=i.format("MM"),this.year=i.format("YYYY"),this.testPastNav(),this.testFutureNav(),this.$emit("prevNextMonth",this.month,this.year)},nextMonth(){const e=this.month;this.month=this.$moment(e+"/"+this.year,"MM/YYYY").add(1,"month").format("MM"),this.year=this.$moment(e+"/"+this.year,"MM/YYYY").add(1,"month").format("YYYY"),this.testPastNav(),this.testFutureNav(),this.$emit("prevNextMonth",this.month,this.year)},prevMonth(){const e=this.month;this.month=this.$moment(e+"/"+this.year,"MM/YYYY").subtract(1,"month").format("MM"),this.year=this.$moment(e+"/"+this.year,"MM/YYYY").subtract(1,"month").format("YYYY"),this.testPastNav(),this.testFutureNav("prev"),this.$emit("prevNextMonth",this.month,this.year)},today(){return this.$moment().format("YYYY-MM-DD")},isAfterToday(e,t){const i=this.$moment().startOf("day"),o=this.$moment(`${this.month}/${this.year}`,"MM/YYYY").add(t,"months").add(e-1,"days");return i.isSameOrBefore(o)},isToday(e,t){const i=this.$moment(this.month+"/"+this.year,"MM/YYYY").add(t,"months").format("MM");return parseInt(this.$moment().format("YYYY"))===parseInt(this.year)&&parseInt(this.$moment().format("MM"))===parseInt(i)&&parseInt(this.$moment().format("DD"))===parseInt(e)},currentYear(){return this.$moment().format("YYYY")},currentMonth(){return this.$moment().format("MM")},getThisDate(){return this.$moment(this.month+"/"+this.year,"MM/YYYY").format("YYYY-MM")},getMonthYear(e){return this.$moment(this.month+"/"+this.year,"MM/YYYY").add(e,"months").format("MMMM YYYY")},getLastDayOfMonth(e){return this.$moment(this.month,"M").add(e,"months").endOf("month").format("DD")},getWeekDayLabel(e){return this.$moment(e,"e").format("ddd")},getWeekDayStartMonth(e){const t=this.$moment(this.month+"/"+this.year,"MM/YYYY").add(e,"months").format("MM"),i=this.$moment(this.month+"/"+this.year,"MM/YYYY").add(e,"months").format("YYYY");return this.$moment("01/"+t+"/"+i,"DD/MM/YYYY").format("e")},calcDayPositionGrid(e,t){return parseInt(t)-parseInt(this.getWeekDayStartMonth(e))},testPastNav(){this.disableNavPast=!this.infinity&&!this.$moment(`${this.year}-${this.month}`,"YYYY-MM").isAfter(this.today())},testFutureNav(e){if(this.infinity||!this.maxDaysAllowed)return this.disableNavFuture=!1,!1;const t=this.$moment(this.year+"-"+this.month,"YYYY-MM").add(this.months-1,"months"),i=this.$moment().add(this.maxDaysAllowed,"months");if(this.disableNavFuture=!1,t.isSameOrAfter(i)){if(e==="prev"){this.disableNavFuture=!1;return}this.year=i.format("YYYY"),this.month=i.format("MM"),this.disableNavFuture=!0}},clear(){this.innerValue.from=void 0,this.innerValue.to=void 0,this.currentAction="from",this.message=""}}},Me={key:0,class:"my-3"},De={class:"calendar-container md:min-h-96"},be={class:"flex flex-row calendar-nav w-full max-w-80 md:w-80"},ve={class:"flex basis-full justify-between items-center"},pe=["disabled"],$e={key:1,class:"calendar-nav-arrow"},Ce=["disabled"],Be={key:3,class:"calendar-nav-arrow"},Se={class:"calendar-month-title grow text-nowrap font-bold m-3"},Pe=["disabled"],_e={key:5,class:"calendar-nav-arrow"},Ve=["disabled"],Oe={key:7,class:"calendar-nav-arrow"},we={class:"calendar-month-week-header text-center"},Ae={class:"calendar-month-days"},Fe={class:"flex justify-end"};function Te(e,t,i,o,r,a){const s=te,c=K("loading-spinner"),D=K("CalendarDay"),y=ge;return u(),g("div",H(e.$attrs,{class:"sas-calendar"}),[e.downloadable?(u(),g("div",Me,[b("button",{class:"btn action",onClick:t[0]||(t[0]=(...f)=>a.downloadCalendar&&a.downloadCalendar(...f))},[_(s,{class:"mr-2",icon:["fas","calendar"]}
2),t[7]||(t[7]=oe(" Copy iCal Link ",-1))])])):N("",!0),b("div",De,[a.loading?(u(),Q(c,{key:0,classes:{icon:"h-14 absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-primary"}})):N("",!0),b("div",{class:A([a.calendarClasses,"grid grid-flow-row grid-cols-1 gap-8 w-full md:grid-flow-col"])},[(u(!0),g(W,null,E(e.months,(f,m)=>(u(),g("div",{key:f},[b("div",{class:A([{single:i.single},"calendar-month"])},[b("div",be,[b("div",ve,[m===0&&e.controls?(u(),g("button",{key:0,disabled:r.disableNavPast,class:"btn calendar-nav-arrow prev year btn-ghost disabled:!bg-transparent disabled:!text-grey-medium",onClick:t[1]||(t[1]=(...k)=>a.prevYear&&a.prevYear(...k))},[_(s,{icon:["fas","angles-left"]})],8,pe)):(u(),g("div",$e,"   ")),m===0&&e.controls?(u(),g("button",{key:2,disabled:r.disableNavPast,class:"btn calendar-nav-arrow prev month mx-2 btn-ghost disabled:!bg-transparent disabled:!text-grey-medium",onClick:t[2]||(t[2]=(...k)=>a.prevMonth&&a.prevMonth(...k))},[_(s,{icon:["fas","caret-left"]})],8,Ce)):(u(),g("div",Be,"   ")),b("h4",Se,R(a.getMonthYear(m)),1),f===e.months&&e.controls?(u(),g("button",{key:4,disabled:r.disableNavFuture,class:"btn calendar-nav-arrow next month mx-2 btn-ghost disabled:!bg-transparent disabled:!text-grey-medium",onClick:t[3]||(t[3]=(...k)=>a.nextMonth&&a.nextMonth(...k))},[_(s,{icon:["fas","caret-right"]})],8,Pe)):(u(),g("div",_e,"   ")),f===e.months&&e.controls?(u(),g("button",{key:6,disabled:r.disableNavFuture,class:"btn calendar-nav-arrow next year btn-ghost disabled:!bg-transparent disabled:!text-grey-medium",onClick:t[4]||(t[4]=(...k)=>a.nextYear&&a.nextYear(...k))},[_(s,{icon:["fas","angles-right"]})],8,Ve)):(u(),g("div",Oe,"   "))])]),b("div",{class:A([{picker:e.picker,isCheckouting:e.isCheckouting,notDetailed:!e.detailed},"calendar-month-body"])},[b("div",we,[(u(),g(W,null,E(7,(k,d)=>b("div",{key:d,class:"calendar-month-week-grid calendar-month-week-grid--label"},R(a.getWeekDayLabel(d)),1)),64))]),b("div",Ae,[(u(),g(W,null,E(37,(k,d)=>b("div",{key:d,class:"calendar-month-week-grid"},[_(D,{"after-today":a.isAfterToday(a.calcDayPositionGrid(m,k),m),day:e.checkBlocked(a.calcDayPositionGrid(m,k),m,d),detailed:e.detailed,g:k,gi:d,"is-infinity":e.infinity,"is-selected":a.checkDateSelected(a.calcDayPositionGrid(m,k),m),"is-range":a.checkDateRange(a.calcDayPositionGrid(m,k),m),"last-day-of-month":a.getLastDayOfMonth(m),mindex:m,picker:e.picker,"position-grid":a.calcDayPositionGrid(m,k),today:a.isToday(a.calcDayPositionGrid(m,k),m),onClick:a.selectDay,onHover:a.hoverDay},null,8,["after-today","day","detailed","g","gi","is-infinity","is-selected","is-range","last-day-of-month","mindex","picker","position-grid","today","onClick","onHover"])])),64))])],2)],2)]))),128))],2),r.message&&r.dismissCountDown?(u(),Q(y,{key:1,modelValue:r.message,"onUpdate:modelValue":t[5]||(t[5]=f=>r.message=f),class:"my-2",onDismiss:a.dismissedAlert},null,8,["modelValue","onDismiss"])):N("",!0)]),ae(e.$slots,"default",{},()=>[b("div",Fe,[r.innerValue.from?(u(),g("button",{key:0,class:"btn btn-link text-black text-base font-normal shadow-none no-underline",onClick:t[6]||(t[6]=(...f)=>a.clear&&a.clear(...f))}," Clear Dates ")):N("",!0)])],!0)],16)}const He=de(Ye,[["render",Te],["__scopeId","data-v-24b7a4ba"]]);export{He as default};

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.