1import{a as kt}from"./chunk-QLTRNXEK.js";import{b as fe}from"./chunk-TEFEWVO6.js";import{a as Ke,b as Qe}from"./chunk-3HFTO6XY.js";import{a as qe,b as Ge,d as Ye,g as ze}from"./chunk-IZKA562T.js";import{a as he,i as _e,k as Ce}from"./chunk-Y2KCFOCP.js";import{a as Se}from"./chunk-NXTJBJRP.js";import{$b as ke,C as wt,Cc as Ae,D as ce,E as me,Ec as Rt,Fb as Fe,Gb as Pt,Hb as De,Ia as nt,Ib as we,Jb as Ee,Kb as Ie,Mb as at,Sc as Ve,Tf as Le,Tg as He,a as Dt,af as Mt,b as ae,bf as At,c as L,cg as je,d as j,dc as Pe,e as le,gd as $e,hh as We,jb as ge,jc as Re,k as H,ka as It,kc as Me,kh as Ue,l as oe,lb as ye,le as Be,nd as Ne,od as Lt,qd as dt,r as re,rd as jt,s as se,ub as ve,ve as Oe,xb as Te,yb as be}from"./chunk-X5J6QTCG.js";import{$ as zt,$a as p,Aa as yt,Ad as pe,C as Yt,Db as X,Fa as s,Fb as A,Gb as $t,Hb as Zt,Ib as t,Jb as T,Ka as F,Kb as g,Lb as bt,Lc as ee,Ma as O,Mb as ct,Na as Qt,Qb as k,Rb as P,Sa as D,Sb as R,Sc as Ft,Tc as tt,U as N,Wc as et,Xc as ie,Yb as Xt,_ as ft,_a as Jt,a as xt,ad as ne,ba as Kt,bb as u,be as it,cc as Nt,d as ht,db as K,dc as Bt,di as ue,e as Z,eb as U,fa as C,fb as q,ff as W,fi as xe,ga as f,gb as h,hb as l,hd as Ot,ib as a,jb as y,k as _t,lc as w,ma as E,mc as I,nb as rt,nc as te,o as qt,ob as st,pb as Y,pj as Et,q as Ct,qb as b,qc as mt,ra as gt,sb as S,sf as V,tb as m,u as Gt,xb as St,ya as G,yb as vt,yd as de,zb as Tt}from"./chunk-SMW7PHYX.js";import{a as Ut,j as ut}from"./chunk-BMIYOSOG.js";var lt=(function(o){return o[o.AtBooking=1]="AtBooking",o[o.BeforeEvent=2]="BeforeEvent",o[o.AfterEvent=3]="AfterEvent",o})(lt||{});var z=(()=>{let c=class c{constructor(e){this.webApiService=e,this.baseUrl="public/facility-rentals"}getSettings(){return this.webApiService.getData(`${this.baseUrl}/settings`)}isFacilityRentalsEnabled(){return this.webApiService.getData(`${this.baseUrl}/is-enabled`)}getAvailableFacilities(){return this.webApiService.getData(`${this.baseUrl}/facilities`)}getFacilityTimeSlotsForDate(e,n){let r=new Ot().set("facilityId",e.toString()).set("date",V(n));return this.webApiService.getData(`${this.baseUrl}/time-slots/facility`,r)}getVirtualAndSavedTimeSlots(e,n,r){let d=new Ot().set("facilityFieldID",e.toString()).set("startDate",V(n));return r&&(d=d.set("endDate",V(r))),this.webApiService.getData(`${this.baseUrl}/time-slots/virtual`,d)}getFacilityField(e,n){return this.webApiService.getData(`${this.baseUrl}/fields/${n}?id=${e}`)}createRental(e){return this.webApiService.postData(`${this.baseUrl}/purchase`,e)}validateTimeSlotAvailability(e){return this.webApiService.postData(`${this.baseUrl}/validate-availability`,e)}};c.\u0275fac=function(n){return new(n||c)(Kt(xe))},c.\u0275prov=ft({token:c,factory:c.\u0275fac,providedIn:"root"});let o=c;return o})();var B=(()=>{let c=class c{constructor(){this.cartItems$=new Z([]),this.cartTotal$=new Z(0),this.cartSurchargeID$=new Z(null)}addItem(e,n,r,d,x){let _=this.cartItems$.value;if(_.length>0&&this.cartSurchargeID$.value!==d){let ot=_[0].facilityName;return{success:!1,errorMessage:`Cannot add time slots from ${n} to cart. Your cart contains items from ${ot} with a different tax/surcharge configuration. Please complete your current purchase or clear your cart before selecting from a different facility.`}}if(_.findIndex(M=>M.timeSlot.facilityFieldID===e.facilityFieldID&&V(M.timeSlot.slotDate)===V(e.slotDate)&&M.timeSlot.startTime===e.startTime&&M.timeSlot.endTime===e.endTime)>=0)return{success:!0};_.length===0&&this.cartSurchargeID$.next(d);let $={id:this.generateCartItemId(e),timeSlot:e,facilityName:n,fieldName:r,displayDate:this.formatDate(W(e.slotDate)),displayTime:`${this.formatTime(e.startTime)} - ${this.formatTime(e.endTime)}`,price:e.price||0,clubSurchargeID:d,facilityId:x},J=[..._,$];return this.cartItems$.next(J),this.updateCartTotal(J),{success:!0}}removeItem(e){let r=this.cartItems$.value.filter(d=>d.id!==e);this.cartItems$.next(r),this.updateCartTotal(r),r.length===0&&this.cartSurchargeID$.next(null)}clearCart(){this.cartItems$.next([]),this.cartTotal$.next(0),this.cartSurchargeID$.next(null)}getCartItems(){return this.cartItems$.asObservable()}getCurrentCartItems(){return this.cartItems$.value}getCartTotal(){return this.cartTotal$.asObservable()}getCurrentCartTotal(){return this.cartTotal$.value}getCartItemCount(){return this.cartItems$.value.length}hasItems(){return this.cartItems$.value.length>0}getCartSummary(){let e=this.cartItems$.value,n=[...new Set(e.map(r=>r.timeSlot.facilityFieldID))];return{itemCount:e.length,total:this.cartTotal$.value,facilityFieldIDs:n}}getCartSurchargeID(){return this.cartSurchargeID$.value}isCompatibleWithCart(e){return this.hasItems()?this.cartSurchargeID$.value===e:!0}getIncompatibleFacilityIds(e){if(!this.hasItems())return[];let n=this.cartSurchargeID$.value;return e.filter(r=>r.clubSurchargeID!==n).map(r=>r.facilityId)}generateCartItemId(e){let n=V(e.slotDate);return`${e.facilityFieldID}_${n}_${e.startTime}_${e.endTime}`}updateCartTotal(e){let n=e.reduce((r,d)=>r+d.price,0);this.cartTotal$.next(n)}formatDate(e){return e.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric",year:"numeric"})}formatTime(e){if(!e)return"";let[n,r]=e.split(":"),d=parseInt(n,10),x=parseInt(r,10),_=d>=12?"PM":"AM",v=d===0?12:d>12?d-12:d,$=x.toString().padStart(2,"0");return`${v}:${$} ${_}`}};c.\u0275fac=function(n){return new(n||c)},c.\u0275prov=ft({token:c,factory:c.\u0275fac,providedIn:"root"});let o=c;return o}
1)();function oi(o,c){o&1&&(t(0,` 2 `),l(1,"app-loader"),t(2,"Loading available dates..."),a(),t(3,` 3`))}function ri(o,c){if(o&1&&(t(0,` 4 `),l(1,"div",4),t(2),a(),t(3,` 5 `)),o&2){let i=c.$implicit,e=m(2);s(),A("available",e.isDateAvailable(e.getDateFromCalendarDate(i)))("disabled",e.isDateDisabled(e.getDateFromCalendarDate(i))||e.isDateInPast(e.getDateFromCalendarDate(i)))("selected",e.isDateSelected(i))("date-indicator",e.isDateAvailable(e.getDateFromCalendarDate(i))&&!e.isDateDisabled(e.getDateFromCalendarDate(i))&&!e.isDateInPast(e.getDateFromCalendarDate(i))),h("title",e.getDateTooltip(e.getDateFromCalendarDate(i))),s(),g(` 6 `,i.day,` 7 `)}}function si(o,c){if(o&1){let i=b();t(0,` 8 `),l(1,"div",1),t(2,` 9 `),l(3,"p-datepicker",2),R("ngModelChange",function(n){C(i);let r=m();return P(r.selectedDate,n)||(r.selectedDate=n),f(n)}),S("onSelect",function(n){C(i);let r=m();return f(r.onDateSelect(n))})("onMonthChange",function(n){C(i);let r=m();return f(r.onMonthChange(n))})("onYearChange",function(n){C(i);let r=m();return f(r.onYearChange(n))}),t(4,` 10 `),D(5,ri,4,10,"ng-template",3),t(6,` 11 `),a(),t(7,` 12 `),a(),t(8,` 13`)}if(o&2){let i=m();s(3),k("ngModel",i.selectedDate),h("dateFormat",i.dateFormat)("showButtonBar",i.showButtonBar)("showIcon",i.showIcon)("minDate",i.minDate)("maxDate",i.maxDate)("disabledDates",i.disabledDates)("inline",!0)("selectionMode","single")}}function ci(o,c){o&1&&(t(0,` 14 `),l(1,"div",5),t(2,` 15 `),y(3,"i",6),t(4,` 16 `),l(5,"h6",7),t(6,"No Available Dates"),a(),t(7,` 17 `),l(8,"p",8),t(9,` 18 There are currently no available rental dates for this facility. 19 `),y(10,"br"),t(11,` 20 `),l(12,"small"),t(13,"Please check back later or contact us for assistance."),a(),t(14,` 21 `),a(),t(15,` 22 `),a(),t(16,` 23`))}function mi(o,c){o&1&&(t(0,` 24 `),l(1,"div",9),t(2,` 25 `),l(3,"div",10),t(4,` 26 `),l(5,"div",11),t(6,` 27 `),y(7,"div",12),t(8,` 28 `),l(9,"small",13),t(10,"Available"),a(),t(11,` 29 `),a(),t(12,` 30 `),l(13,"div",11),t(14,` 31 `),y(15,"div",14),t(16,` 32 `),l(17,"small",13),t(18,"Selected"),a(),t(19,` 33 `),a(),t(20,` 34 `),l(21,"div",11),t(22,` 35 `),y(23,"div",15),t(24,` 36 `),l(25,"small",13),t(26,"Unavailable"),a(),t(27,` 37 `),a(),t(28,` 38 `),a(),t(29,` 39 `),a(),t(30,` 40`))}var Xe=(()=>{let c=class c{constructor(){this.disabledDates=[],this.loading=!1,this.dateSelected=new E,this.dateChange=new E,this.calendarView=new Date,this.availableDates=[],this.dateFormat="mm/dd/yy",this.showButtonBar=!0,this.showIcon=!0,this.isDaySelectable=e=>this.isDateAvailable(e)&&!this.isDateDisabled(e)&&!this.isDateInPast(e),this.getDateStyleClass=e=>{let n=[];return this.isDateAvailable(e)&&n.push("available-date"),this.isDateDisabled(e)&&n.push("disabled-date"),this.isDateInPast(e)&&n.push("past-date"),n.join(" ")},this.setupDateConstraints()}ngOnInit(){this.updateAvailableDates()}ngOnChanges(e){(e.availableEvents$||e.facilityId)&&this.updateAvailableDates(),e.selectedDate&&this.onDateSelectionChange()}setupDateConstraints(){this.minDate||(this.minDate=new Date,this.minDate.setHours(0,0,0,0)),this.maxDate||(this.maxDate=new Date,this.maxDate.setMonth(this.maxDate.getMonth()+6))}updateAvailableDates(){this.availableEvents$&&this.availableEvents$.subscribe(e=>{this.availableDates=this.extractAvailableDates(e)})}extractAvailableDates(e){let n=[],r=new Set;return e.forEach(d=>{if(d.eventStart){let x=W(d.eventStart),_=V(x);r.has(_)||(r.add(_),n.push(new Date(x)))}}),n.sort((d,x)=>d.getTime()-x.getTime())}onDateSelect(e){if(console.log("Calendar onDateSelect called with:",e),console.log("isDateAvailable:",this.isDateAvailable(e)),console.log("isDateDisabled:",this.isDateDisabled(e)),console.log("isDateInPast:",this.isDateInPast(e)),console.log("availableDates:",this.availableDates),!this.isDateInPast(e)&&!this.isDateDisabled(e)){console.log("Date selection allowed - emitting event");let n=W(e);this.selectedDate=n,this.dateSelected.emit(n),this.dateChange.emit(n)}else console.log("Date selection blocked - date is in past or disabled")}onDateSelectionChange(){this.selectedDate&&this.dateChange.emit(this.selectedDate)}isDateAvailable(e){if(!e)return!1;let n=new Date(e);return n.setHours(0,0,0,0),!this.availableDates||this.availableDates.length===0?!this.isDateInPast(e)&&!this.isDateDisabled(e):this.availableDates.some(r=>{let d=new Date(r);return d.setHours(0,0,0,0),d.getTime()===n.getTime()})}isDateDisabled(e){if(!e)return!0;let n=new Date(e);return n.setHours(0,0,0,0),this.disabledDates.some(r=>{let d=new Date(r);return d.setHours(0,0,0,0),d.getTime()===n.getTime()})}isDateInPast(e){if(!e)return!0;let n=new Date(e);n.setHours(0,0,0,0);let r=new Date;return r.setHours(0,0,0,0),n.getTime()<r.getTime()}onMonthChange(e){this.calendarView=e.month}onYearChange(e){this.calendarView=e.year}clearSelection(){this.selectedDate=void 0,this.dateSelected.emit(void 0),this.dateChange.emit(void 0)}goToToday(){let e=new Date;this.calendarView=e,this.isDateAvailable(e)&&!this.isDateDisabled(e)&&this.onDateSelect(e)}getAvailableDatesInMonth(e,n){return this.availableDates.filter(r=>r.getMonth()===e&&r.getFullYear()===n)}hasAvailableDatesInMonth(e,n){return this.getAvailableDatesInMonth(e,n).length>0}getNextAvailableDate(){let e=new Date;return e.setHours(0,0,0,0),this.availableDates.find(n=>{let r=new Date(n);return r.setHours(0,0,0,0),r.getTime()>=e.getTime()&&!this.isDateDisabled(n)})||null}getYearRange(){let e=new Date().getFullYear(),n=e,r=e+2;return`${n}:${r}`}getDateTooltip(e){return this.isDateInPast(e)?"Date is in the past":this.isDateDisabled(e)?"Date is not available":this.isDateAvailable(e)?"Available for rental":"No time slots available"}getDateFromCalendarDate(e){return e&&typeof e=="object"&&e.year!==void 0?new Date(e.year,e.month,e.day):e instanceof Date?e:new Date}isDateSelected(e){if(!this.selectedDate||!e)return!1;let n=this.getDateFromCalendarDate(e),r=new Date(this.selectedDate);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}};c.\u0275fac=function(n){return new(n||c)},c.\u0275cmp=O({type:c,selectors:[["app-facility-date-calendar"]],inputs:{facilityId:"facilityId",availableEvents$:"availableEvents$",selectedDate:"selectedDate",minDate:"minDate",maxDate:"maxDate",disabledDates:"disabledDates",loading:"loading"},outputs:{dateSelected:"dateSelected",dateChange:"dateChange"},standalone:!1,features:[gt],decls:14,vars:4,consts:[[1,"facility-date-calendar"],[1,"calendar-container"],[3,"ngModelChange","onSelect","onMonthChange","onYearChange","ngModel","dateFormat","showButtonBar","showIcon","minDate","maxDate","disabledDates","inline","selectionMode"],["pTemplate","date"],[1,"custom-date-cell",3,"title"],[1,"no-dates-message","text-center","p-4"],[1,"fa-regular","fa-calendar-xmark","fs-2","text-muted","mb-3"],[1,"text-muted","mb-2"],[1,"text-muted","mb-0"],[1,"calendar-legend","mt-3"],[1,"legend-items","d-flex","flex-wrap","justify-content-center","gap-3"],[1,"legend-item","d-flex","align-items-center"],[1,"legend-indicator","available","me-2"],[1,"text-muted"],[1,"legend-indicator","selected","me-2"],[1,"legend-indicator","disabled","me-2"]],template:function(n,r){n&1&&(l(0,"div",0),t(1,` 41 `),t(2,` 42 `),t(3,` 43 44`),t(4,` 45`),t(5,` 46 47`),t(6,` 48`),t(7,` 49 50`),t(8,` 51`),p(9,oi,4,0),p(10,si,9,9),p(11,ci,17,0),p(12,mi,31,0),a(),t(13,` 52`)),n&2&&(s(9),u(r.loading?9:-1),s(),u(r.loading?-1:10),s(),u(!r.loading&&r.facilityId&&r.availableDates.length===0?11:-1),s(),u(!r.loading&&r.availableDates.length>0?12:-1))},dependencies:[j,H,Re,it,nt],styles:['.facility-date-calendar[_ngcontent-%COMP%] .p-calendar{min-width:350px}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker{border-color:transparent;border-bottom:var(--border);margin-bottom:2rem;border-radius:0;width:unset!important}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker table td>span{background:unset;width:unset;height:unset}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker table td>span:hover{background:unset!important;width:unset;height:unset}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker table td>span .custom-date-cell{position:relative;width:2.65rem;height:2.65rem;display:flex;align-items:center;justify-content:center;border-radius:50%;background-color:transparent;transition:all .1s linear;font-size:var(--text-default);margin:.25rem;font-weight:600;-webkit-user-select:none;user-select:none}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker table td>span .custom-date-cell:hover{background-color:var(--grey-100)}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker table td>span .custom-date-cell.available{background-color:var(--blue-100);color:var(--primary-link);font-weight:600}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker table td>span .custom-date-cell.available:hover{background-color:var(--blue-200)}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker table td>span .custom-date-cell.selected{color:var(--color-white);background-color:var(--blue-900);font-weight:600}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker table td>span .custom-date-cell.disabled{opacity:.6;pointer-events:none;cursor:default}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker table td>span .custom-date-cell.date-indicator:after{content:" ";font-size:0;width:.25rem;height:.25rem;background-color:currentColor;border-radius:50%;position:absolute;bottom:20%;right:calc(50% - .125rem)}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker-title{line-height:1.6875rem}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker-title:after{content:"\\f107";display:inline-block;padding:0 1rem 0 .5rem;font-family:var(--icon-font);font-size:1.375rem}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker-decade{padding:0 0 0 1rem;font-size:var(--text-default);font-family:var(--body-font)}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker .p-datepicker-header .p-datepicker-title .p-datepicker-month+.p-datepicker-year{padding-left:0}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker .p-datepicker-header .p-datepicker-title .p-datepicker-month{padding-right:0;padding-left:1rem}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker .p-datepicker-header .p-datepicker-title .p-datepicker-year, .facility-date-calendar[_ngcontent-%COMP%] .p-datepicker .p-datepicker-header .p-datepicker-title .p-datepicker-month{font-size:1.375rem;padding-top:0;padding-bottom:0}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker .p-datepicker-header .p-datepicker-prev, .facility-date-calendar[_ngcontent-%COMP%] .p-datepicker .p-datepicker-header .p-datepicker-next{width:2.25rem;border:var(--border);border-radius:50%;height:2.25rem}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker .p-datepicker-header .p-datepicker-prev .pi, .facility-date-calendar[_ngcontent-%COMP%] .p-datepicker .p-datepicker-header .p-datepicker-next .pi{font-size:var(--text-default)!important;color:var(--002d73)}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker .p-datepicker-header .p-datepicker-prev .pi-chevron-left:before, .facility-date-calendar[_ngcontent-%COMP%] .p-datepicker .p-datepicker-header .p-datepicker-next .pi-chevron-left:before{content:"\\f060";font-family:var(--icon-font)}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker .p-datepicker-header .p-datepicker-prev .pi-chevron-right:before, .facility-date-calendar[_ngcontent-%COMP%] .p-datepicker .p-datepicker-header .p-datepicker-next .pi-chevron-right:before{content:"\\f061";font-family:var(--icon-font)}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker .p-datepicker-header .p-datepicker-prev:enabled:hover, .facility-date-calendar[_ngcontent-%COMP%] .p-datepicker .p-datepicker-header .p-datepicker-next:enabled:hover{border:var(--border);color:var(--blue-600)!important;background-color:var(--grey-200)}.facility-date-calendar[_ngcontent-%COMP%] .p-datepicker .p-datepicker-header .p-datepicker-prev:enabled:hover .pi, .facility-date-calendar[_ngcontent-%COMP%] .p-datepicker .p-datepicker-header .p-datepicker-next:enabled:hover .pi{color:var(--blue-600)!important}.p-datepicker[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse}']});let o=c;return o}
52)();var ti=o=>({timeSlot:o});function hi(o,c){if(o&1&&t(0),o&2){let i=c.$implicit,e=m(2);g(` 53 `,i.value==="field"?e.sportLocation+" View":"List View",` 54 `)}}function _i(o,c){if(o&1){let i=b();t(0,` 55 `),l(1,"div",4),t(2,` 56 `),t(3,` 57 `),t(4,` 58 `),t(5,` 59 `),t(6,` 60 `),l(7,"div",5),t(8,` 61 `),l(9,"div",6),t(10,` 62 `),t(11,` 63 `),l(12,"div",7),t(13,` 64 `),l(14,"div",8),t(15,` 65 `),l(16,"div"),t(17,` 66 `),y(18,"i",9),t(19,` 67 `),a(),t(20,` 68 `),l(21,"div",10),t(22,` 69 `),l(23,"p-slider",11),R("ngModelChange",function(n){C(i);let r=m();return P(r.selectedTimeRange,n)||(r.selectedTimeRange=n),f(n)}),S("onChange",function(n){C(i);let r=m();return f(r.onTimeRangeChange(n))}),a(),t(24,` 70 `),l(25,"div",12),t(26,` 71 `),l(27,"span",13),t(28),a(),t(29,` 72 `),l(30,"span"),t(31),a(),t(32,` 73 `),a(),t(33,` 74 `),a(),t(34,` 75 `),a(),t(35,` 76 `),a(),t(36,` 77 `),l(37,"div"),t(38,` 78 `),l(39,"div",14),t(40,` 79 `),l(41,"p-selectButton",15),R("ngModelChange",function(n){C(i);let r=m();return P(r.selectedDisplayMode,n)||(r.selectedDisplayMode=n),f(n)}),t(42,` 80 `),D(43,hi,1,1,"ng-template",null,0,mt),t(45,` 81 `),a(),t(46,` 82 `),a(),t(47,` 83 `),a(),t(48,` 84 `),a(),t(49,` 85 `),a(),t(50,` 86 `),a(),t(51,` 87 `)}if(o&2){let i=m();s(23),k("ngModel",i.selectedTimeRange),h("min",i.timeRange.min)("max",i.timeRange.max)("step",i.getSliderStep())("range",!0),s(5),T(i.formatTimeLabel(i.selectedTimeRange[0])),s(3),T(i.formatTimeLabel(i.selectedTimeRange[1])),s(10),h("options",i.displayModeOptions),k("ngModel",i.selectedDisplayMode),h("allowEmpty",!1)}}function Ci(o,c){o&1&&(t(0,` 88 `),l(1,"app-loader"),t(2,"Loading available time slots..."),a(),t(3,` 89 `))}function fi(o,c){if(o&1&&(t(0,` 90 `),l(1,"div",16),t(2,` 91 `),l(3,"app-null-card",17),t(4,` 92 `),a(),t(5,` 93 `),a(),t(6,` 94 `)),o&2){let i=m();s(3),h("text","Please select a date to view available time slots.")("image",i.imageType.CALENDAR)("showButton",!1)("showCard",!0)}}function gi(o,c){if(o&1&&(t(0,` 95 `),l(1,"span",26),t(2),a(),t(3,` 96 `)),o&2){let i=m().$implicit;s(2),g(` 97 `,i.key,` 98 `)}}function yi(o,c){if(o&1){let i=b();t(0,` 99 `),l(1,"button",27),S("click",function(){C(i);let n=m().$implicit,r=m(3);return f(r.openFieldDetails(n.value[0]))}),t(2),a(),t(3,` 100 `)}if(o&2){let i=m(4);s(2),g("",i.sportLocation," Details")}}function Si(o,c){o&1&&Y(0)}function vi(o,c){if(o&1&&(t(0,` 101 `),D(1,Si,1,0,"ng-container",29),t(2,` 102 `)),o&2){let i=c.$implicit;m(4);let e=X(9);s(),h("ngTemplateOutlet",e)("ngTemplateOutletContext",Bt(2,ti,i))}}function Ti(o,c){if(o&1&&(t(0,` 103 `),l(1,"div",28),t(2,` 104 `),U(3,vi,3,4,null,null,K),a(),t(5,` 105 `)),o&2){let i=m().$implicit;s(),h("@slideDown",void 0),s(2),q(i.value)}}function bi(o,c){if(o&1){let i=b();t(0,` 106 `),l(1,"div",20),t(2,` 107 `),l(3,"div",21),t(4,` 108 `),l(5,"div",8),t(6,` 109 `),p(7,gi,4,1),a(),t(8,` 110 `),l(9,"span",22),t(10,` 111 `),l(11,"span",23),t(12),a(),t(13,` 112 `),p(14,yi,4,1),l(15,"button",24),S("click",function(){let n=C(i).$implicit,r=m(3);return f(r.toggleFieldExpansion(n.key))}),t(16,` 113 `),y(17,"i",25),t(18,` 114 `),a(),t(19,` 115 `),a(),t(20,` 116 `),a(),t(21,` 117 `),p(22,Ti,6,1),a(),t(23,` 118 `)}if(o&2){let i=c.$implicit,e=m(3);s(3),A("border-bottom",e.isFieldExpanded(i.key))("mb-0",!e.isFieldExpanded(i.key)),s(4),u(i.value.length>0?7:-1),s(5),g("(",i.value.length," slots)"),s(2),u(i.value.length>0?14:-1),s(3),h("ngClass",e.isFieldExpanded(i.key)?"fa-chevron-up":"fa-chevron-down"),s(5),u(e.isFieldExpanded(i.key)?22:-1)}}function Fi(o,c){if(o&1&&(t(0,` 119 `),l(1,"div",19),t(2,` 120 `),U(3,bi,24,9,null,null,K),w(5,"keyvalue"),a(),t(6,` 121 `)),o&2){let i=m(2);s(3),q(I(5,0,i.filteredGroupedFieldSlots))}}function Di(o,c){o&1&&Y(0)}function wi(o,c){if(o&1&&(t(0,` 122 `),D(1,Di,1,0,"ng-container",29),t(2,` 123 `)),o&2){let i=c.$implicit;m(2);let e=X(9);s(),h("ngTemplateOutlet",e)("ngTemplateOutletContext",Bt(2,ti,i))}}function Ei(o,c){if(o&1&&(t(0,` 124 `),l(1,"div",30),t(2,` 125 `),U(3,wi,3,4,null,null,K),a(),t(5,` 126 `)),o&2){let i=m(2);s(3),q(i.filteredTimeSlots)}}function Ii(o,c){if(o&1){let i=b();t(0,` 127 `),l(1,"a",41),S("click",function(){C(i);let n=m(2).timeSlot,r=m(2);
127return f(r.openFieldDetails(n))}),t(2),a(),t(3,` 128 `)}if(o&2){let i=m(2).timeSlot;s(2),g(` 129 `,i.fieldName,` 130 `)}}function ki(o,c){if(o&1&&(t(0,` 131 `),l(1,"div",40),t(2,` 132 `),p(3,Ii,4,1),a(),t(4,` 133 `)),o&2){let i=m().timeSlot;s(3),u(i.fieldName?3:-1)}}function Pi(o,c){o&1&&(t(0,` 134 `),y(1,"i",42),t(2,` 135 `))}function Ri(o,c){if(o&1){let i=b();t(0,` 136 `),l(1,"div",31),t(2,` 137 `),l(3,"div",32),t(4),a(),t(5,` 138 `),l(6,"div",33),t(7,` 139 `),t(8,` 140 `),l(9,"div",34),t(10,` 141 `),y(11,"app-time-dots",35),t(12,` 142 `),l(13,"span",36),t(14),a(),t(15,` 143 `),a(),t(16,` 144 `),t(17,` 145 `),p(18,ki,5,1),l(19,"div",37),t(20,` 146 `),l(21,"span",38),t(22),a(),t(23,` 147 `),a(),t(24,` 148 `),t(25,` 149 `),l(26,"div",37),t(27,` 150 `),l(28,"button",39),S("click",function(){let n=C(i).timeSlot,r=m(2);return f(r.onTimeSlotSelect(n))}),t(29),p(30,Pi,3,0),t(31,` 151 Cart 152 `),a(),t(32,` 153 `),a(),t(33,` 154 `),a(),t(34,` 155 `),a(),t(35,` 156 `)}if(o&2){let i=c.timeSlot,e=m(2);s(4),g(` 157 `,e.formatTimeRange(i.startTime,i.endTime),` 158 `),s(7),h("durationInMinutes",e.getCartItemDuration(i)),s(3),T(e.formatDuration(e.getCartItemDuration(i))),s(4),u(e.selectedDisplayMode==="list"?18:-1),s(4),T(e.formatPrice(i.price)),s(6),Zt(e.getTimeSlotStatusClass(i)),A("btn-primary",e.isTimeSlotSelectedBySlot(i))("btn-red",e.isTimeSlotSelectedBySlot(i)),h("disabled",!i.isAvailable&&!e.isTimeSlotSelectedBySlot(i)),s(),g(` 159 `,e.isTimeSlotSelectedBySlot(i)?"In":"",` 160 `),s(),u(!e.isTimeSlotSelectedBySlot(i)&&i.isAvailable?30:-1)}}function Mi(o,c){if(o&1&&(t(0,` 161 `),l(1,"div",43),t(2,` 162 `),l(3,"app-null-card",17),w(4,"date"),t(5,` 163 `),a(),t(6,` 164 `),a(),t(7,` 165 `)),o&2){let i=m(2);s(3),h("text","There are no available time slots for "+te(4,4,i.selectedDate,"fullDate")+".<br><small>Please try selecting a different date or time.</small>")("image",i.imageType.CALENDAR)("showButton",!1)("showCard",!1)}}function Ai(o,c){if(o&1&&(t(0,` 166 `),l(1,"div",18),t(2,` 167 `),t(3,` 168 `),t(4,` 169 `),t(5,` 170 `),p(6,Fi,7,2),p(7,Ei,6,0),D(8,Ri,36,14,"ng-template",null,1,mt),t(10,` 171 `),t(11,` 172 `),p(12,Mi,8,7),a(),t(13,` 173 `)),o&2){let i=m();s(6),u(i.selectedDisplayMode==="field"?6:-1),s(),u(i.selectedDisplayMode==="list"?7:-1),s(5),u(i.availableTimeSlots.length===0&&i.selectedDate&&!i.loading?12:-1)}}function Vi(o,c){o&1&&(t(0,` 174 `),l(1,"app-loader"),t(2,"Loading field details..."),a(),t(3,` 175 `))}function $i(o,c){if(o&1&&(t(0,` 176 `),y(1,"img",54),t(2,` 177 `)),o&2){let i=m(2);s(),h("src",i.selectedFieldDetails.practiceFacility==null?null:i.selectedFieldDetails.practiceFacility.file,yt)("alt",i.selectedFieldDetails.practiceFacility.name)}}function Ni(o,c){if(o&1&&(t(0,` 178 `),y(1,"img",54),t(2,` 179 `)),o&2){let i=m(2);s(),h("src",i.selectedFieldDetails.imageFileName,yt)("alt",i.selectedFieldDetails.fieldName)}}function Bi(o,c){if(o&1&&(t(0,` 180 `),l(1,"app-pill",55),t(2),a(),t(3,` 181 `)),o&2){let i=c.$implicit;s(2),g(` 182 `,i.label||"Tag #"+i.value,` 183 `)}}function Oi(o,c){if(o&1&&(t(0,` 184 `),l(1,"span"),t(2,` 185 `),U(3,Bi,4,1,null,null,K),a(),t(5,` 186 `)),o&2){let i=m(2);s(3),q(i.selectedFieldDetails.tagsView)}}function Li(o,c){if(o&1&&(t(0,` 187 `),l(1,"a",58),t(2),a(),t(3,` 188 `)),o&2){let i=m(4);s(),h("href",Xt("https://www.google.com/maps/search/?api=1&query=",i.selectedFieldDetail
188s.practiceFacility.latitude,",",i.selectedFieldDetails.practiceFacility.longitude),yt),s(),g(` 189 `,i.selectedFieldDetails.practiceFacility.address1,` 190 `)}}function ji(o,c){if(o&1&&t(0),o&2){let i=m(4);g(` 191 `,i.selectedFieldDetails.practiceFacility.address1,` 192 `)}}function Hi(o,c){if(o&1&&(t(0,` 193 `),l(1,"div"),t(2),a(),t(3,` 194 `)),o&2){let i=m(4);s(2),g(` 195 `,i.selectedFieldDetails.practiceFacility.address2,` 196 `)}}function Wi(o,c){if(o&1&&(t(0,` 197 `),l(1,"div",56),t(2,` 198 `),l(3,"div",45),t(4,` 199 `),l(5,"div",57),t(6,` 200 `),p(7,Li,4,4),p(8,ji,1,1),a(),t(9,` 201 `),p(10,Hi,4,1),l(11,"div"),t(12),a(),t(13,` 202 `),a(),t(14,` 203 `),a(),t(15,` 204 `)),o&2){let i=m(3);s(7),u(i.selectedFieldDetails.practiceFacility.latitude&&i.selectedFieldDetails.practiceFacility.longitude?7:-1),s(),u(!i.selectedFieldDetails.practiceFacility.latitude||!i.selectedFieldDetails.practiceFacility.longitude?8:-1),s(2),u(i.selectedFieldDetails.practiceFacility.address2?10:-1),s(2),ct(` 205 `,i.selectedFieldDetails.practiceFacility.city,`, 206 `,i.selectedFieldDetails.practiceFacility.state,` 207 `,i.selectedFieldDetails.practiceFacility.zip,` 208 `)}}function Ui(o,c){if(o&1&&(t(0,` 209 `),t(1,` 210 `),p(2,Wi,16,6)),o&2){let i=m(2);s(2),u(i.selectedFieldDetails.practiceFacility.address1?2:-1)}}function qi(o,c){if(o&1&&(t(0,` 211 `),l(1,"app-pill"),t(2),a(),t(3,` 212 `)),o&2){let i=c.$implicit;s(2),g(` 213 `,i.label||"Config #"+i.value,` 214 `)}}function Gi(o,c){if(o&1&&(t(0,` 215 `),l(1,"div",47),t(2,` 216 `),U(3,qi,4,1,null,null,K),a(),t(5,` 217 `)),o&2){let i=m(2);s(3),q(i.selectedFieldDetails.configurationView)}}function Yi(o,c){if(o&1&&(t(0,` 218 `),l(1,"div",47),t(2,` 219 `),l(3,"div",59),t(4,` 220 Description 221 `),a(),t(5,` 222 `),l(6,"p",57),t(7),a(),t(8,` 223 `),a(),t(9,` 224 `)),o&2){let i=m(2);s(7),T(i.selectedFieldDetails.description)}}function zi(o,c){if(o&1&&(t(0,` 225 `),l(1,"span"),t(2),a(),t(3,` 226 `)),o&2){let i=m().$implicit,e=m(2);s(2),bt(` 227 `,e.formatTimeSpan(i.startTime)," - ",e.formatTimeSpan(i.endTime),` 228 `)}}function Ki(o,c){o&1&&(t(0,` 229 `),l(1,"span",63),t(2,"Not available"),a(),t(3,` 230 `))}function Qi(o,c){if(o&1&&(t(0,` 231 `),l(1,"div",60),t(2,` 232 `),l(3,"div",61),t(4),a(),t(5,` 233 `),l(6,"div",62),t(7,` 234 `),p(8,zi,4,2),p(9,Ki,4,0),a(),t(10,` 235 `),a(),t(11,` 236 `)),o&2){let i=c.$implicit,e=c.$index,n=c.$count,r=m(2);s(),A("pt-1",e===0)("pb-1",e===n-1),s(3),T(r.getDayName(i.dayOfWeekID)),s(4),u(i.startTime&&i.endTime?8:-1),s(),u(!i.startTime||!i.endTime?9:-1)}}function Ji(o,c){if(o&1&&(t(0,` 237 `),l(1,"div",65),t(2,` 238 `),l(3,"h6"),t(4,` 239 `),y(5,"i",66),t(6,` 240 Facility Notes 241 `),a(),t(7,` 242 `),l(8,"div",67),t(9,` 243 `),l(10,"div",68),t(11,` 244 `),y(12,"div",69),t(13,` 245 `),a(),t(14,` 246 `),a(),t(15,` 247 `),a(),t(16,` 248 `)),o&2){let i=m(3);s(12),h("innerHTML",i.selectedFieldDetails.practiceFacility.note,G)}}function Zi(o,c){if(o&1&&(t(0,` 249 `),l(1,"div",64),t(2,` 250 `),t(3,` 251 `),p(4,Ji,17,1),a(),t(5,` 252 `)),o&2){let i=m(2);s(4),u(i.selectedFieldDetails.practiceFacility.note?4:-1)}}function Xi(o,c){if(o&1&&(t(0,` 253 `),l(1,"div",44),t(2,` 254 `),t(3,` 255 `),l(4,"div",45),t(5,` 256 `),p(6,$i,3,2),p(7,Ni,3,2),a(),t(8,` 257 `),l(9,"div",46),t(10),a(),t(11,` 258 `),l(12,"div",45),t(13),t(14,` 259 `),p(15,Oi,6,0),a(),t(16,` 260 `),l(17,"div",47),t(18,` 261 `),p(19,Ui,3,1),p(20,Gi,6,0),a(),t(21,` 262 `),t(22,` 263 `),p(23,Yi,10,1),l(24,"div",48),t(25,` 264 `),t(26,` 265 `),l(27,"div",49),t(28,` 266 `),l(29,"div",50),t(30,` 267 `),l(31,"div",51),t(32,` 268 `),l(33,"div",52),t(34,` 269 `),l(35,"span"),t(36,"Day"),a(),t(37,` 270 `),a(),t(38,` 271 `),l(39,"div",53),t(40,` 272 `),l(41,"span"),t(42,"Hours"),a(),t(43,` 273 `),a(),t(44,` 274 `),a(),t(45,`
275 `),U(46,Qi,12,7,null,null,K),a(),t(48,` 276 `),a(),t(49,` 277 `),a(),t(50,` 278 `),p(51,Zi,6,1),a(),t(52,` 279 `)),o&2){let i=m();s(6),u(!i.selectedFieldDetails.imageFileName&&(!(i.selectedFieldDetails==null||i.selectedFieldDetails.practiceFacility==null)&&i.selectedFieldDetails.practiceFacility.file)?6:-1),s(),u(i.selectedFieldDetails.imageFileName?7:-1),s(3),T(i.selectedFieldDetails.fieldName),s(3),g(` 280 `,i.selectedFieldDetails.practiceFacility==null?null:i.selectedFieldDetails.practiceFacility.name,` 281 `),s(2),u(i.selectedFieldDetails.tagsView&&i.selectedFieldDetails.tagsView.length>0?15:-1),s(4),u(i.selectedFieldDetails.practiceFacility!=null&&i.selectedFieldDetails.practiceFacility.address1?19:-1),s(),u(i.selectedFieldDetails.configurationView&&i.selectedFieldDetails.configurationView.length>0?20:-1),s(3),u(i.selectedFieldDetails.description?23:-1),s(23),q(i.selectedFieldDetails.availabilities),s(5),u(i.selectedFieldDetails.practiceFacility?51:-1)}}var ei=(()=>{let c=class c{constructor(e,n,r){this.cartService=e,this.publicFacilityRentalService=n,this.consentGatedStorageService=r,this.selectedTimeSlots=[],this.loading=!1,this.allowMultipleSlots=!0,this.maxSlots=50,this.sportLocation="Field",this.timeSlotsSelected=new E,this.timeSlotAdded=new E,this.timeSlotRemoved=new E,this.availableTimeSlots=[],this.groupedTimeSlots={},this.groupedFieldSlots={},this.imageType=Mt,this.filteredTimeSlots=[],this.filteredGroupedTimeSlots={},this.filteredGroupedFieldSlots={},this.selectedSlotLookup=new Set,this.timeRange={min:0,max:1440},this.selectedTimeRange=[0,1440],this.timeSlotDuration=60,this.hasUserAdjustedTimeFilter=!1,this.TIME_FILTER_STORAGE_KEY="facilityRentalTimeFilter",this.TIME_FILTER_ADJUSTED_KEY="facilityRentalTimeFilterAdjusted",this.expandedHours=new Set,this.expandedFields=new Set,this.selectedDisplayMode="list",this.displayModeOptions=[{value:"list"},{value:"field"}],this.sortBy="time",this.cartSubscription=new xt,this.showFieldDetailsModal=!1,this.selectedFieldDetails=null,this.loadingFieldDetail
281s=!1}ngOnInit(){this.loadTimeFilterFromStorage(),this.updateAvailableTimeSlots(),this.updateTimeSlotDuration(),this.subscribeToCartChanges()}ngOnDestroy(){this.cartSubscription.unsubscribe()}subscribeToCartChanges(){this.cartSubscription.add(this.cartService.getCartItems().subscribe(e=>{this.syncSelectionWithCart(e)}))}syncSelectionWithCart(e){this.selectedTimeSlots=e.map(n=>n.timeSlot),this.updateSelectedSlotLookup()}ngOnChanges(e){(e.selectedDate||e.availableTimeSlots$||e.facilityId)&&this.updateAvailableTimeSlots(),e.settings&&this.updateTimeSlotDuration(),e.selectedTimeSlots&&this.updateSelectedSlotLookup()}updateTimeSlotDuration(){this.settings?.timeSlotDurationMinutes&&(this.timeSlotDuration=this.settings.timeSlotDurationMinutes)}updateAvailableTimeSlots(){if(!this.selectedDate||!this.availableTimeSlots$){this.availableTimeSlots=[],this.groupedTimeSlots={},this.resetTimeRange();return}this.availableTimeSlots$.subscribe(e=>{this.calculateTimeRangeFromSlots(e),this.availableTimeSlots=this.filterTimeSlotsForDate(e,this.selectedDate),this.groupedTimeSlots=this.groupTimeSlotsByHour(this.availableTimeSlots),this.groupedFieldSlots=this.groupTimeSlotsByField(this.availableTimeSlots),this.sortTimeSlots(),this.updateFilteredResults()})}resetTimeRange(){this.timeRange={min:360,max:1320},this.selectedTimeRange=[360,1320]}calculateTimeRangeFromSlots(e){if(!e||e.length===0){this.resetTimeRange();return}let n=e.map(x=>this.parseTimeToMinutes(x.startTime)).filter(x=>!isNaN(x));if(n.length===0){this.resetTimeRange();return}let r=Math.min(...n),d=Math.max(...n)+this.timeSlotDuration;console.log("calculateTimeRangeFromSlots - API data:",{minTime:r,maxTime:d,timeSlots:e.length}),console.log("calculateTimeRangeFromSlots - Before update:",{currentTimeRange:this.timeRange,currentSelectedRange:this.selectedTimeRange,hasUserAdjusted:this.hasUserAdjustedTimeFilter}),this.timeRange={min:r,max:d},this.hasUserAdjustedTimeFilter?this.selectedTimeRange=[Math.max(r,Math.min(this.selectedTimeRange[0],d)),Math.max(r,Math.min(this.selectedTimeRange[1],d))]:this.selectedTimeRange=[r,d],console.log("calculateTimeRangeFromSlots - After update:",{newTimeRange:this.timeRange,newSelectedRange:this.selectedTimeRange})}loadTimeFilterFromStorage(){try{let e=localStorage.getItem(this.TIME_FILTER_ADJUSTED_KEY);if(console.log("loadTimeFilterFromStorage - adjustedFlag:",e),e==="true"){this.hasUserAdjustedTimeFilter=!0;let n=localStorage.getItem(this.TIME_FILTER_STORAGE_KEY);if(console.log("loadTimeFilterFromStorage - savedFilter:",n),n){let r=JSON.parse(n);Array.isArray(r)&&r.length===2&&(this.selectedTimeRange=r,console.log("loadTimeFilterFromStorage - loaded selectedTimeRange:",this.selectedTimeRange))}}}catch(e){console.warn("Failed to load time filter from localStorage:",e)}}saveTimeFilterToStorage(){try{this.consentGatedStorageService.setLocalItem(this.TIME_FILTER_ADJUSTED_KEY,this.hasUserAdjustedTimeFilter.toString()),this.hasUserAdjustedTimeFilter&&this.consentGatedStorageService.setLocalItem(this.TIME_FILTER_STORAGE_KEY,JSON.stringify(this.selectedTimeRange))}catch(e){console.warn("Failed to save time filter to localStorage:",e)}}clearTimeFilterFromStorage(){try{localStorage.removeItem(this.TIME_FILTER_STORAGE_KEY),localStorage.removeItem(this.TIME_FILTER_ADJUSTED_KEY)}catch(e){console.warn("Failed to clear time filter from localStorage:",e)}}parseTimeToMinutes(e){if(!e)return NaN;try{let n,r;if(e.includes("AM")||e.includes("PM")){let d=e.includes("PM"),x=e.replace(/\s*(AM|PM)/i,""),[_,v]=x.split(":");n=parseInt(_,10),r=parseInt(v||"0",10),d&&n!==12?n+=12:!d&&n===12&&(n=0)}else{let[d,x]=e.split(":");n=parseInt(d,10),r=parseInt(x||"0",10)}return isNaN(n)||isNaN(r)||n<0||n>23||r<0||r>59?NaN:n*60+r}catch(n){return console.warn("Error parsing time string:",e,n),NaN}}filterTimeSlotsForDate(e,n){let r=V(n),d=new Date;return e.filter(x=>{if(V(x.slotDate)!==r)return!1;let[_,v]=x.startTime.split(":").map(Number),$=W(x.slotDate);return $.setHours(_,v,0,0),$>d})}groupTimeSlotsByHour(e){let n={};return e.forEach(r=>{let d=r.startTime,[x]=d.split(":").map(Number),_=this.formatHourKey(x);n[_]||(n[_]=[]),n[_].push(r)}
281),Object.keys(n).forEach(r=>{n[r].sort((d,x)=>{let _=this.parseTime(d.startTime),v=this.parseTime(x.startTime);return _.getTime()-v.getTime()})}),n}groupTimeSlotsByField(e){let n={};return e.forEach(r=>{let d=r.fieldName||"Unknown Field";n[d]||(n[d]=[]),n[d].push(r)}),Object.keys(n).forEach(r=>{n[r].sort((d,x)=>{let _=this.parseTime(d.startTime),v=this.parseTime(x.startTime);return _.getTime()-v.getTime()})}),n}parseTime(e){let[n,r]=e.split(":").map(Number),d=new Date;return d.setHours(n,r,0,0),d}formatHourKey(e){let n=e>=12?"PM":"AM";return`${e===0?12:e>12?e-12:e}:00 ${n}`}updateSelectedSlotLookup(){this.selectedSlotLookup.clear(),this.selectedTimeSlots.forEach(e=>{let n=e.facilityRentalTimeSlotGuid||e.facilityRentalTimeSlotID?.toString();n&&this.selectedSlotLookup.add(n)})}isTimeSlotSelectedBySlot(e){let n=e.facilityRentalTimeSlotGuid||e.facilityRentalTimeSlotID?.toString();return n?this.selectedSlotLookup.has(n):!1}onTimeSlotSelect(e){if(!e.isAvailable)return;this.isTimeSlotSelectedBySlot(e)?(e.facilityRentalTimeSlotGuid?this.selectedTimeSlots=this.selectedTimeSlots.filter(r=>r.facilityRentalTimeSlotGuid!==e.facilityRentalTimeSlotGuid):e.facilityRentalTimeSlotID>0&&(this.selectedTimeSlots=this.selectedTimeSlots.filter(r=>r.facilityRentalTimeSlotID!==e.facilityRentalTimeSlotID)),this.removeTimeSlotFromCart(e),this.timeSlotRemoved.emit(e)):(this.allowMultipleSlots||(this.selectedTimeSlots=[]),this.selectedTimeSlots.length<this.maxSlots&&(this.selectedTimeSlots.push(Ut({},e)),this.timeSlotAdded.emit(e))),this.updateSelectedSlotLookup(),this.timeSlotsSelected.emit([...this.selectedTimeSlots])}removeTimeSlotFromCart(e){let r=this.cartService.getCurrentCartItems().find(d=>{let x=d.timeSlot;return e.facilityRentalTimeSlotGuid&&x.facilityRentalTimeSlotGuid?e.facilityRentalTimeSlotGuid===x.facilityRentalTimeSlotGuid:e.facilityRentalTimeSlotID>0&&x.facilityRentalTimeSlotID>0?e.facilityRentalTimeSlotID===x.facilityRentalTimeSlotID:x.facilityFieldID===e.facilityFieldID&&x.slotDate===e.slotDate&&x.startTime===e.startTime&&x.endTime===e.endTime});r&&this.cartService.removeItem(r.id)}toggleHourExpansion(e){this.expandedHours.has(e)?this.expandedHours.delete(e):this.expandedHours.add(e)}isHourExpanded(e){return this.expandedHours.has(e)}toggleFieldExpansion(e){this.expandedFields.has(e)?this.expandedFields.delete(e):this.expandedFields.add(e)}isFieldExpanded(e){return this.expandedFields.has(e)}setSortBy(e){this.sortBy=e,this.sortTimeSlots(),this.updateFilteredResults()}onTimeRangeChange(e){this.hasUserAdjustedTimeFilter=!0,e.values&&Array.isArray(e.values)?this.selectedTimeRange=[e.values[0],e.values[1]]:e.target&&e.target.value&&(this.selectedTimeRange=[e.target.value[0],e.target.value[1]]),this.saveTimeFilterToStorage(),this.updateFilteredResults()}formatTimeLabel(e){if(isNaN(e)||e<0||e>=1440)return"12 AM";let n=Math.floor(e/60),r=n>=12?"PM":"AM";return`${n===0?12:n>12?n-12:n} ${r}`}getSliderStep(){return Math.max(this.timeSlotDuration,15)}sortTimeSlots(){this.availableTimeSlots.sort((e,n)=>{switch(this.sortBy){case"time":{let r=this.parseTime(e.startTime),d=this.parseTime(n.startTime);return r.getTime()-d.getTime()}case"price":return e.price-n.price;default:return 0}}),this.groupedTimeSlots=this.groupTimeSlotsByHour(this.availableTimeSlots),this.groupedFieldSlots=this.groupTimeSlotsByField(this.availableTimeSlots)}updateFilteredResults(){this.filteredTimeSlots=this.availableTimeSlots.filter(e=>{let n=this.parseTimeToMinutes(e.startTime);return n>=this.selectedTimeRange[0]&&n<=this.selectedTimeRange[1]-this.timeSlotDuration}),this.filteredGroupedTimeSlots=this.groupTimeSlotsByHour(this.filteredTimeSlots),this.filteredGroupedFieldSlots=this.groupTimeSlotsByField(this.filteredTimeSlots)}getTotalSelectedPrice(){return this.selectedTimeSlots.reduce((e,n)=>e+n.price,0)}getTotalSelectedDuration(){return this.selectedTimeSlots.reduce((e,n)=>{let r=this.calculateDurationInMinutes(n.startTime,n.endTime);return e+r},0)}getSelectionPercentage(){return this.maxSlots===0?0:Math.round(this.selectedTimeSlots.length/this.maxSlots*100)}calculateDurationInMinutes(e,n){let r=this.parseTime(e);return(this.parseTime(n).getTime()-r.getTime())/(1e3*60)}clearAllSelections(){this.cartService.clearCart(),this.selectedTimeSlots=[],this.updateSelectedSlotLookup(),this.timeSlotsSelected.emit([]),this.hasUserAdjustedTimeFilter=!1,this.clearTimeFilterFromStorage(),this.selectedTimeRange=[this.timeRange.min,this.timeRange.max],this.updateFilteredResults()}formatTime(e){return e.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}formatTimeRange(e,n){let r=this.parseTime(e),d=this.parseTime(n),x=r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}),_=d.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0});return`${x} - ${_}`}formatDuration(e){let n=Math.floor(e/60),r=e%60;return n===0?`${r}min`:r===0?`${n}hr`:`${n}hr ${r}min`}formatPrice(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(e)}getTimeSlotStatusClass(e){let n=["time-slot"];return this.isTimeSlotSelectedBySlot(e)?n.push("selected"):e.isAvailable?n.push("available"):n.push("unavailable"),n.join(" ")}
281expandAllHours(){Object.keys(this.groupedTimeSlots).forEach(e=>{this.expandedHours.add(e)})}collapseAllHours(){this.expandedHours.clear()}expandAllFields(){Object.keys(this.groupedFieldSlots).forEach(e=>{this.expandedFields.add(e)})}collapseAllFields(){this.expandedFields.clear()}getCartItemDuration(e){let[n,r]=e.startTime.split(":").map(Number),[d,x]=e.endTime.split(":").map(Number),_=n*60+r;return d*60+x-_}openFieldDetails(e){if(!e.facilityFieldID){console.error("Missing facility field ID in time slot:",e);return}let n=this.facilityId;console.log("Opening field details for:",{facilityFieldID:e.facilityFieldID,facilityId:n,fieldName:e.fieldName,facilityName:e.facilityName}),this.loadingFieldDetails=!0,this.showFieldDetailsModal=!0,this.selectedFieldDetails=null,this.publicFacilityRentalService.getFacilityField(n,e.facilityFieldID).subscribe({next:r=>{this.selectedFieldDetails=r,this.loadingFieldDetails=!1,console.log("Field details loaded successfully:",r)},error:r=>{console.error("Error loading field details:",r),this.loadingFieldDetail
281s=!1}})}closeFieldDetails(){this.showFieldDetailsModal=!1,this.selectedFieldDetails=null,this.loadingFieldDetails=!1}getMapOptions(e){return!e.latitude||!e.longitude?null:{center:{lat:e.latitude,lng:e.longitude},zoom:15,disableDefaultUI:!1,zoomControl:!0,mapTypeControl:!1,streetViewControl:!0,fullscreenControl:!0}}getMarkerPosition(e){return!e.latitude||!e.longitude?null:{lat:e.latitude,lng:e.longitude}}getDayName(e){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e]||"Unknown"}formatTimeSpan(e){if(!e)return"";let n=e.split(":");if(n.length>=2){let r=parseInt(n[0]),d=n[1],x=r>=12?"PM":"AM";return r===0?r=12:r>12&&(r=r-12),`${r}:${d} ${x}`}return e}};c.\u0275fac=function(n){return new(n||c)(F(B),F(z),F(kt))},c.\u0275cmp=O({type:c,selectors:[["app-facility-time-slot-selection"]],inputs:{facilityId:"facilityId",selectedDate:"selectedDate",availableTimeSlots$:"availableTimeSlots$",selectedTimeSlots:"selectedTimeSlots",loading:"loading",allowMultipleSlots:"allowMultipleSlots",maxSlots:"maxSlots",settings:"settings",sportLocation:"sportLocation"},outputs:{timeSlotsSelected:"timeSlotsSelected",timeSlotAdded:"timeSlotAdded",timeSlotRemoved:"timeSlotRemoved"},standalone:!1,features:[gt],decls:13,vars:10,consts:[["item",""],["timeSlotRow",""],[1,"facility-time-slot-selection"],["draggable","false",1,"standardWidthDialog",3,"visibleChange","onHide","visible","modal","closable","header"],[1,"time-slot-header"],[1,"controls-row","mb-3"],[1,"d-block","d-md-flex","align-items-center","full-width","full-height","py-1"],[1,"flex-grow-1","bg-secondary","mr-2","border-radius-sm","px-3","py-2"],[1,"d-flex","align-items-center"],[1,"fal","fa-clock","text-larger","mr-3","mt-2"],[1,"flex-grow-1","pt-3","pb-2"],[1,"w-100",3,"ngModelChange","onChange","ngModel","min","max","step","range"],[1,"d-flex","justify-content-between","full-width","mt-2","text-small"],[1,"flex-grow-1"],[1,"bg-secondary","p-2","border-radius-sm","text-center"],["optionValue","value","size","large",3,"ngModelChange","options","ngModel","allowEmpty"],[1,"no-date-selected"],[3,"text","image","showButton","showCard"],[1,"time-slots-container"],[1,"time-slots-field"],[1,"card"],[1,"card-header","d-flex","justify-content-between","border-bottom","align-items-center"],[1,"d-inline-flex","align-items-center"],[1,"mr-2"],[1,"btn","btn-tertiary-inverted","line-height-1","p-2",3,"click"],[1,"fa-solid",3,"ngClass"],[1,"text-primary","text-decoration-underline","text-largest","fw-700"],[1,"btn","btn-sm","mr-2","py-1",3,"click"],[1,"field-time-slots","pt-3"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"time-slots-list"],[1,"list-row","border-all","border-radius","px-2","py-2","text-medium","mb-2"],[1,"list-row-body","nowrap"],[1,"list-row-meta"],[1,"list-row-item","list-row-item-xl"],[3,"durationInMinutes"],[1,"d-inline-block","ml-2"],[1,"list-row-item","list-row-item-md"],[1,"price"],["type","button",1,"btn","btn-sm","p-1",3,"click","disabled"],[1,"list-row-item","list-row-item-lg"],["href","javascript:void(0)","title","Click to view field details",1,"text-primary","text-decoration-underline",2,"cursor","pointer",3,"click"],[1,"fa","fa-plus"],[1,"no-time-slots"],[1,"field-details-content"],[1,""],[1,"text-large","fw-700"],[1,"mb-3"],[1,"mb-4","col-6","p-0"],[1,"card","border-radius-sm","p-0"],[1,"card-body","p-0"],[1,"row","border-bottom","border-lg","text-md","no-gutters","text-small","fw-800"],[1,"col","px-2","py-1"],[1,"col","text-right","px-2","py-1"],[1,"rental-details-hero",3,"src","alt"],["status","secondary"],[1,"facility-address"],[1,"text-small"],["target","_blank",3,"href"],[1,"text-h5","text-medium","mb-1"],[1,"row","text-small","no-gutters"],[1,"col","px-2"],[1,"col","text-right","px-2"],[1,"text-muted"],[1,"facility-location"],[1,"facility-note"],[1,"fa","fa-sticky-note","me-2"],[1,"card","bg-light"],[1,"card-body","py-2"],[3,"innerHTML"]],template:function(n,r){n&1&&(l(0,"div",2),t(1,` 282 `),p(2,_i,52,10),p(3,Ci,4,0),p(4,fi,7,4),p(5,Ai,14,3),a(),t(6,` 283 284`),t(7,` 285`),l(8,"p-dialog",3),R("visibleChange",function(x){return P(r.showFieldDetail
285sModal,x)||(r.showFieldDetailsModal=x),x}),S("onHide",function(){return r.closeFieldDetails()}),t(9,` 286 287 `),t(10,` 288 `),p(11,Vi,4,0),p(12,Xi,53,9),a()),n&2&&(s(2),u(r.loading?-1:2),s(),u(r.loading?3:-1),s(),u(!r.loading&&!r.selectedDate?4:-1),s(),u(!r.loading&&r.selectedDate?5:-1),s(3),k("visible",r.showFieldDetailsModal),h("modal",!0)("closable",!0)("header",(r.selectedFieldDetails==null?null:r.selectedFieldDetails.fieldName)+" - "+r.sportLocation+" Details"),s(3),u(r.loadingFieldDetails?11:-1),s(),u(!r.loadingFieldDetails&&r.selectedFieldDetails?12:-1))},dependencies:[ee,Ft,j,H,Pt,nt,Ie,At,Le,Ae,$e,et,ie],styles:[".rental-details-hero[_ngcontent-%COMP%]{width:100%;aspect-ratio:25/9;object-fit:cover;margin-bottom:1rem}"],data:{animation:[Ne("slideDown",[jt(":enter",[dt({height:"0",overflow:"hidden"}),Lt("200ms ease-in",dt({height:"*"}))]),jt(":leave",[dt({height:"*",overflow:"hidden"}),Lt("200ms ease-out",dt({height:"0"}))])])]}});let o=c;return o})();function en(o,c){if(o&1){let i=b();t(0,` 289 `),l(1,"div",16),t(2,` 290 `),t(3,` 291 `),l(4,"div",17),t(5,` 292 `),l(6,"div",18),t(7,` 293 `),l(8,"div",19),t(9,` 294 `),l(10,"div",20),t(11,` 295 `),l(12,"div",21),t(13),a(),t(14,` 296 `),l(15,"div",22),t(16),a(),t(17,` 297 `),a(),t(18,` 298 `),l(19,"div",23),t(20,` 299 `),l(21,"div",24),t(22,` 300 `),y(23,"i",25),t(24,` 301 `),l(25,"span",26),t(26),a(),t(27,` 302 `),a(),t(28,` 303 `),l(29,"div",24),t(30,` 304 `),y(31,"i",27),t(32,` 305 `),l(33,"span",26),t(34),l(35,"span",28),t(36),a(),t(37,` 306 `),a(),t(38,` 307 `),a(),t(39,` 308 `),a(),t(40,` 309 `),a(),t(41,` 310 `),l(42,"div"),t(43,` 311 `),t(44,` 312 `),l(45,"button",29),S("click",function(n){let r=C(i).$implicit,d=m(3);return f(d.removeItem(r,n))}),t(46,` 313 `),y(47,"i",30),t(48,` 314 `),a(),t(49,` 315 `),a(),t(50,` 316 `),a(),t(51,` 317 `),l(52,"div",31),t(53,` 318 `),l(54,"div",19),t(55,` 319 Reservation 320 `),a(),t(56,` 321 `),l(57,"div",32),t(58),a(),t(59,` 322 `),a(),t(60,` 323 `),a(),t(61,` 324 `),a(),t(62,` 325 `)}if(o&2){let i=c.$implicit,e=c.$index,n=m(3);s(),A("mt-3",e===0),s(12),T(i.facilityName),s(3),T(i.fieldName),s(10),T(i.displayDate),s(8),g(` 326 `,n.formatTimeRange(i.timeSlot.startTime,i.timeSlot.endTime),` 327 `),s(2),g(` 328 (`,n.formatDuration(n.getCartItemDuration(i)),`) 329 `),s(22),g(` 330 `,n.formatPrice(i.price),` 331 `)}}function nn(o,c){o&1&&(t(0,` 332 `),l(1,"div",33),t(2,` 333 `),l(3,"div",34),t(4,` 334 `),y(5,"i",35),t(6,` 335 `),a(),t(7,` 336 `),l(8,"h6",36),t(9,"Your cart is empty"),a(),t(10,` 337 `),l(11,"p",37),t(12,"Select time slots to add them to your cart"),a(),t(13,` 338 `),a(),t(14,` 339 `))}function an(o,c){if(o&1&&(t(0,` 340 `),l(1,"div",14),t(2,` 341 `),t(3,` 342 `),l(4,"div",15),t(5,` 343 `),U(6,en,63,8,null,null,Jt().trackByItemId,!0),a(),t(8,` 344 `),t(9,` 345 `),p(10,nn,15,0),a(),t(11,` 346 `)),o&2){let i=m();s(6),q(c),s(4),u(i===0?10:-1)}}function ln(o,c){if(o&1){let i=b();t(0,` 347 `),l(1,"div",46),t(2,` 348 `),l(3,"label",47),t(4,` 349 `),l(5,"input",48),R("ngModelChange",function(n){C(i);let r=m(3);return P(r.termsConfirmed,n)||(r.termsConfirmed=n),f(n)}),S("change",function(n){C(i);let r=m(3);return f(r.onTermsCheckboxChange(n))}),a(),t(6,` 350 `),l(7,"span",49),t(8,` 351 I agree to the 352 `),l(9,"a",50),S("click",function(){C(i);let n=m(3);return f(n.onViewTerms())}),t(10,` 353 Terms & Conditions 354 `),a(),t(11,` 355 `),a(),t(12,` 356 `),a(),t(13,` 357 `),a(),t(14,` 358 `)}if(o&2){let i=m(3);s(5),k("ngModel",i.termsConfirmed)}}function on(o,c){o&1&&(t(0,` 359 `),l(1,"app-inline-alert",51),t(2,` 360 Please accept the terms to continue 361 `),a(),t(3,` 362 `)),o&2&&(s(),h("isInline",!0)("alertType","warning"))}function rn(o,c){if(o&1&&(t(0,` 363 `),l(1,"div"),t(2,` 364 `),p(3,on,4,2),a(),t(4,` 365 `)),o&2){let i=m(3);s(3),u(i.termsConfirmed?-1:3)}}
365function sn(o,c){if(o&1){let i=b();t(0,` 366 `),l(1,"div",38),t(2,` 367 `),t(3,` 368 `),l(4,"div",39),t(5,` 369 `),l(6,"div",40),t(7,` 370 `),l(8,"span",41),t(9,"Total:"),a(),t(10,` 371 `),l(11,"span",42),t(12),w(13,"async"),a(),t(14,` 372 `),a(),t(15,` 373 `),a(),t(16,` 374 `),t(17,` 375 `),p(18,ln,15,1),l(19,"div",43),t(20,` 376 `),t(21,` 377 `),l(22,"div",19),t(23,` 378 `),l(24,"button",44),S("click",function(){C(i);let n=m(2);return f(n.onCheckout())}),t(25),a(),t(26,` 379 `),a(),t(27,` 380 `),a(),t(28,` 381 `),p(29,rn,5,1),rt(30),t(31,` 382 `),l(32,"button",45),S("click",function(){C(i);let n=m(2);return f(n.onViewCancellationPolicy())}),t(33,` 383 Cancellation Policy 384 `),a(),t(34,` 385 `),st(),t(35,` 386 `),a(),t(36,` 387 `)}if(o&2){let i=m(2);s(12),g(` 388 `,i.formatPrice(I(13,5,i.totalAmount$)||0),` 389 `),s(6),u(i.showTermsAndConditions&&(i.settings!=null&&i.settings.isTermsConfirmationRequired)&&(i.settings!=null&&i.settings.termsAndConditions)?18:-1),s(6),h("disabled",!i.canProceedToCheckout()),s(),g(` 390 `,i.getCheckoutButtonText(),` 391 `),s(4),u(i.showTermsAndConditions&&(i.settings!=null&&i.settings.isTermsConfirmationRequired)&&(i.settings!=null&&i.settings.termsAndConditions)?29:-1)}}function cn(o,c){if(o&1){let i=b();t(0,` 392 `),l(1,"div",1),t(2,` 393 `),t(3,` 394 `),l(4,"button",2,0),S("click",function(){C(i);let n=m();return f(n.toggleCart())}),t(6,` 395 `),y(7,"i",3),t(8),t(9,` 396 `),l(10,"span",4),t(11,"Cart"),a(),t(12,` 397 `),a(),t(13,` 398 `),t(14,` 399 `),l(15,"p-drawer",5),R("visibleChange",function(n){C(i);let r=m();return P(r.isCartOpen,n)||(r.isCartOpen=n),f(n)}),t(16,` 400 `),t(17,` 401 `),l(18,"div",6),t(19,` 402 `),l(20,"div",7),t(21,` 403 `),l(22,"div",8),t(23,` 404 `),l(24,"button",9),S("click",function(){C(i);let n=m();return f(n.closeCart())}),t(25,` 405 `),y(26,"i",10),t(27,` 406 `),a(),t(28,` 407 `),l(29,"div",11),t(30,` 408 `),l(31,"span"),t(32,"Your Cart"),a(),t(33,` 409 `),t(34,` 410 `),a(),t(35,` 411 `),a(),t(36,` 412 `),l(37,"div"),t(38,` 413 `),l(39,"button",12),S("click",function(){C(i);let n=m();return f(n.clearCart())}),t(40,` 414 Clear Cart 415 `),a(),t(41,` 416 `),a(),t(42,` 417 `),a(),t(43,` 418 `),t(44,` 419 `),l(45,"div",13),t(46,` 420 `),p(47,an,12,1),w(48,"async"),a(),t(49,` 421 `),a(),t(50,` 422 `),t(51,` 423 `),p(52,sn,37,7),a(),t(53,` 424`),a(),t(54,` 425`)}if(o&2){let i,e=c,n=m();s(4),A("has-items",e>0)("pulsing",e>0),h("title",e>0?"View cart ("+e+" items)":"Cart is empty"),s(4),g(` 426 `,e>99?"99+":e,` 427 `),s(7),k("visible",n.isCartOpen),h("baseZIndex",1e3),s(32),u((i=I(48,10,n.cartItems$))?47:-1,i),s(5),u(e>0?52:-1)}}var ni=(()=>{let c=class c{constructor(e,n){this.cartService=e,this.datePipe=n,this.settings=null,this.requiresImmediatePayment=!0,this.showTermsAndConditions=!0,this.itemRemoved=new E,this.cartCleared=new E,this.checkoutClicked=new E,this.viewTerms=new E,this.viewCancellationPolicy=new E,this.isCartOpen=!1,this.termsConfirmed=!1,this.subscription=new xt,this.cartItems$=this.cartService.getCartItems(),this.totalAmount$=this.cartService.getCartTotal(),this.itemCount$=this.cartService.getCartItems().pipe(Ct(r=>r.length))}ngOnInit(){this.subscription.add(this.cartItems$.subscribe(e=>{e.length===0&&(this.termsConfirmed=!1,this.isCartOpen&&this.closeCart())}))}ngOnDestroy(){this.subscription.unsubscribe()}toggleCart(){this.isCartOpen=!this.isCartOpen}openCart(){this.isCartOpen=!0}closeCart(){this.isCartOpen=!1}removeItem(e,n){n&&n.stopPropagation(),this.cartService.removeItem(e.id),this.itemRemoved.emit(e)}clearCart(){this.cartService.clearCart(),this.termsConfirmed=!1,this.cartCleared.emit()}onCheckout(){this.showTermsAndConditions&&this.settings?.isTermsConfirmationRequired&&!this.termsConfirmed||(this.closeCart(),this.checkoutClicked.emit())}onViewTerms(){this.viewTerms.emit()}onTermsCheckboxChange(e){let n=e.target;this.termsConfirmed=n.checked}onViewCancellationPolicy(){this.viewCancellationPolicy.emit()}canProceedToCheckout(){return this.showTermsAndConditions&&this.settings?.isTermsConfirmationRequired?this.termsConfirmed:!0}getCheckoutButtonText(){return this.requiresImmediatePayment?"Proceed to Checkout":"Book Now"}getCheckoutButtonIcon(){return this.requiresImmediatePayment?"fa-credit-card":"fa-calendar-plus"}formatPrice(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(e)}formatDate(e){return new Date(e).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}getCartItemDuration(e){let[n,r]=e.timeSlot.startTime.split(":").map(Number),[d,x]=e.timeSlot.endTime.split(":").map(Number),_=n*60+r;return d*60+x-_}formatDuration(e){let n=Math.floor(e/60),r=e%60;return n===0?`${r}min`:r===0?`${n}hr`:`${n}hr ${r}min`}formatTimeTo12Hour(e){if(!e||typeof e!="string")return e;let n=new Date,[r,d]=e.split(":").map(Number);return isNaN(r)||isNaN(d)?e:(n.setHours(r,d,0,0),this.datePipe.transform(n,"h:mm a")||e)}formatTimeRange(e,n){let r=this.formatTimeTo12Hour(e),d=this.formatTimeTo12Hour(n);return`${r} - ${d}`}trackByItemId(e,n){return n.id}};c.\u0275fac=function(n){return new(n||c)(F(B),F(et))},c.\u0275cmp=O({type:c,selectors:[["app-cart-button"]],inputs:{settings:"settings",requiresImmediatePayment:"requiresImmediatePayment",showTermsAndConditions:"showTermsAndConditions"},outputs:{itemRemoved:"itemRemoved",cartCleared:"cartCleared",checkoutClicked:"checkoutClicked",viewTerms:"viewTerms",viewCancellationPolicy:"viewCancellationPolicy"},standalone:!1,decls:3,vars:3,consts:[["cartButton",""],[1,"cart-button-container"],["type","button",1,"btn","btn-primary","btn-lg","text-larger","px-4",3,"click","title"],[1,"fas","fa-shopping-cart","mr-3"],[1,"sr-only"],["position","right","styleClass","cart-sidebar",3,"visibleChange","visible","baseZIndex"],[1,"px-3","pt-3","pb-0","overflow-auto","d-flex","flex-column"],[1,"cart-modal-header","d-flex","align-items-center","justify-content-between","mb-3"],[1,"d-flex","align-items-center"],["type","button","title","Close cart",1,"btn-a11y","cursor-pointer",3,"click"],[1,"far","fa-times-circle","text-largest"],[1,"cart-title","text-h4","ml-3"],["type","button",1,"btn","btn-naked","btn-sm",3,"click"],[1,"cart-modal-content","overflow-auto"],[1,"cart-items-scroll"],[1,"cart-items"],[1,"cart-item","border-all","border-radius-xl","bg-white","py-2","px-3","mb-3"],[1,"item-content"],[1,"d-flex","align-items-center","full-width"],[1,"flex-grow-1"],[1,"facility-info"],[1,"facility-name"],[1,"field-name"],[1,"rental-details"],[1,"detail-row"],[1,"fal","fa-calendar","detail-icon"],[1,"detail-text"],[1,"fal","fa-clock","detail-icon"],[1,"duration-text"],["type","button","title","Remove from cart",1,"remove-item-button","btn-a11y",3,"click"],[1,"fal","fa-tras
427h","text-large"],[1,"d-flex","align-items-center","full-width","mt-2"],[1,"item-price"],[1,"empty-cart-state"],[1,"empty-icon"],[1,"fa","fa-shopping-cart"],[1,"empty-title"],[1,"empty-message"],[1,"cart-modal-footer","border-top","px-3","pb-2","mt-0","position-sticky-bottom","bg-white"],[1,"total-checkout-section"],[1,"total-info","text-right"],[1,"total-label"],[1,"total-amount"],[1,"d-flex"],["type","button",1,"btn","btn-primary","book-now-btn","full-width",3,"click","disabled"],["type","button","aria-label","Read the cancellation policy",1,"btn-a11y","text-primary-link",3,"click"],[1,"terms-section"],[1,"terms-checkbox"],["type","checkbox",3,"ngModelChange","change","ngModel"],[1,"terms-text"],["href","javascript:void(0)",1,"terms-link",3,"click"],[3,"isInline","alertType"]],template:function(n,r){if(n&1&&(t(0,` 428`),p(1,cn,55,12),w(2,"async")),n&2){let d;s(),u((d=I(2,1,r.itemCount$))?1:-1,d)}},dependencies:[Dt,j,H,we,at,tt],styles:[".cart-sidebar{width:450px!important;max-width:90vw!important} .cart-sidebar .p-sidebar-content{padding:0;display:flex;flex-direction:column;height:100%;overflow:hidden}@media(max-width:767.98px){ .cart-sidebar{width:100vw!important;max-width:100vw!important}}.detail-icon[_ngcontent-%COMP%]{width:1.25rem;margin-right:.25rem;display:inline-block;margin-left:.1rem}"]});let o=c;return o})();var xn=["paymentForm"];function hn(o,c){if(o&1&&(t(0,` 429 `),l(1,"tr"),t(2,` 430 `),l(3,"th"),t(4),a(),t(5,` 431 `),l(6,"th"),t(7,"Date & Time"),a(),t(8,` 432 `),l(9,"th"),t(10,"Duration"),a(),t(11,` 433 `),l(12,"th"),t(13,"Price"),a(),t(14,` 434 `),a(),t(15,` 435 `)),o&2){let i=m(2);s(4),g("Facility & ",i.sportLocation)}}function _n(o,c){if(o&1){let i=b();t(0,` 436 `),l(1,"tr"),t(2,` 437 `),l(3,"td"),t(4,` 438 `),l(5,"div"),t(6),a(),t(7,` 439 `),l(8,"span",18),t(9),a(),t(10,` 440 `),a(),t(11,` 441 `),l(12,"td"),t(13,` 442 `),l(14,"div"),t(15),a(),t(16,` 443 `),l(17,"span",18),t(18),a(),t(19,` 444 `),a(),t(20,` 445 `),l(21,"td"),t(22),a(),t(23,` 446 `),l(24,"td",19),t(25),l(26,"button",20),S("click",function(){let n=C(i).$implicit,r=m(2);return f(r.removeItem(n))}),t(27,` 447 `),y(28,"i",21),t(29,` 448 `),a(),t(30,` 449 `),a(),t(31,` 450 `),a(),t(32,` 451 `)}if(o&2){let i=c.$implicit,e=m(2);s(6),T(i.facilityName),s(3),T(i.fieldName),s(6),T(i.displayDate),s(3),T(i.displayTime),s(4),T(e.getDurationFromTimeSlot(i.timeSlot)),s(3),g(` 452 `,e.formatPrice(i.price),` 453 `)}}function Cn(o,c){if(o&1&&(t(0,` 454 `),l(1,"div",28),t(2,` 455 `),l(3,"span"),t(4),a(),t(5,` 456 `),l(6,"span"),t(7),w(8,"async"),a(),t(9,` 457 `),a(),t(10,` 458 `)),o&2){let i=c,e=m(3);s(4),bt("",i.length," ",i.length===1?"rental":"rentals"),s(3),T(e.formatPrice(I(8,3,e.totalAmount$)||0))}}function fn(o,c){if(o&1&&(t(0,` 459 `),l(1,"div",28),t(2,` 460 `),l(3,"span"),t(4),a(),t(5,` 461 `),l(6,"span"),t(7),a(),t(8,` 462 `),a(),t(9,` 463 `)),o&2){let i=m(3);s(4),T(i.getSurchargeName()),s(3),T(i.formatPrice(i.getSurchargeAmount()))}}function gn(o,c){if(o&1&&(t(0,` 464 `),l(1,"div",28),t(2,` 465 `),l(3,"span"),t(4),a(),t(5,` 466 `),l(6,"span"),t(7),a(),t(8,` 467 `),a(),t(9,` 468 `)),o&2){let i=m(3);s(4),T(i.selectedClubPaymentFee.paymentType.feeDescription),s(3),T(i.formatPrice(i.getPaymentFee()))}}function yn(o,c){if(o&1&&(t(0,` 469 `),l(1,"tr",22),t(2,` 470 `),l(3,"td",23),t(4,` 471 `),t(5,` 472 `),l(6,"span",24),t(7,` 473 `),p(8,Cn,11,5),w(9,"async"),p(10,fn,10,2),p(11,gn,10,2),y(12,"hr",25),t(13,` 474 `),l(14,"div",26),t(15,` 475 `),l(16,"span"),t(17,"Total Due"),a(),t(18,` 476 `),l(19,"span",27),t(20),a(),t(21,` 477 `),a(),t(22,` 478 `),a(),t(23,` 479 `),a(),t(24,` 480 `),a(),t(25,` 481 `)),o&2){let i,e=m(2);s(8),u((i=I(9,4,e.cartItems$))?8:-1,i),s(2),u(e.getSurchargeAmount()>0?10:-1),s(),u(e.getPaymentFee()>0?11:-1),s(9),T(e.formatPrice(e.getTotalWithFees()))}}function Sn(o,c){o&1&&(t(0,` 482 `),l(1,"span"),t(2,` 483 Payment will be processed automatically before your rental begins. A saved 484 payment 485 method is required to 486 book. 487 `),a(),t(3,` 488 `))}function vn(o,c){o&1&&(t(0,` 489 `),l(1,"span"),t(2,` 490 Payment will be processed automatically after your rental ends. A saved payment 491 method 492 is required to book. 493 `),a(),t(3,` 494 `))}function Tn(o,c){if(o&1&&(t(0,` 495 `),l(1,"app-inline-alert",29),t(2,` 496 `),p(3,Sn,4,0),p(4,vn,4,0),a(),t(5,` 497 `)),o&2){let i=m(2);s(),h("isInline",!0),s(2),u(i.settings.facilityRentalPaymentTimingID===i.PaymentTiming.BeforeEvent?3:-1),s(),u(i.settings.facilityRentalPaymentTimingID===i.PaymentTiming.AfterEvent?4:-1)}}function bn(o,c){o&1&&(t(0,` 498 `),l(1,"div",30),t(2,` 499 `),y(3,"i",31),t(4,` 500 `),l(5,"h6",32),t(6,"Your cart is empty"),a(),t(7,` 501 `),l(8,"p",33),t(9,"Go back to add time slots to your cart"),a(),t(10,` 502 `),a(),t(11,` 503 `))}function Fn(o,c){if(o&1&&(t(0,` 504 `),l(1,"div",12),t(2,` 505 `),l(3,"p-table",13),t(4,` 506 `),D(5,hn,16,1,"ng-template",14),t(6,` 507 `),D(7,_n,33,6,"ng-template",15),t(8,` 508 `),D(9,yn,26,6,"ng-template",16),t(10,` 509 `),a(),t(11,` 510 `),t(12,` 511 `),l(13,"div",17),t(14,` 512 `),p(15,Tn,6,3),a(),t(16,` 513 `),t(17,` 514 `),p(18,bn,12,0),a(),t(19,` 515 `)),o&2){let i=c,e=m();s(3),h("value",i),s(12),u(e.settings&&(e.settings.facilityRentalPaymentTimingID===e.PaymentTiming.BeforeEvent||e.settings.facilityRentalPaymentTimingID===e.PaymentTiming.AfterEvent)?15:-1),s(3),u(i.length===0?18:-1)}}function Dn(o,c){o&1&&(t(0,` 516 `),l(1,"small"),t(2,`First 517 name 518 is 519 required.`),a(),t(3,` 520 `))}
520function wn(o,c){o&1&&(t(0,` 521 `),l(1,"small"),t(2,`First 522 name 523 cannot exceed 50 524 characters.`),a(),t(3,` 525 `))}function En(o,c){if(o&1&&(t(0,` 526 `),l(1,"div",48),t(2,` 527 `),p(3,Dn,4,0),p(4,wn,4,0),a(),t(5,` 528 `)),o&2){let i,e,n=m(2);s(3),u(!((i=n.guestInfoForm.get("firstName"))==null||i.errors==null)&&i.errors.required?3:-1),s(),u(!((e=n.guestInfoForm.get("firstName"))==null||e.errors==null)&&e.errors.maxlength?4:-1)}}function In(o,c){o&1&&(t(0,` 529 `),l(1,"small"),t(2,`Last name 530 is 531 required.`),a(),t(3,` 532 `))}function kn(o,c){o&1&&(t(0,` 533 `),l(1,"small"),t(2,`Last 534 name 535 cannot exceed 50 536 characters.`),a(),t(3,` 537 `))}function Pn(o,c){if(o&1&&(t(0,` 538 `),l(1,"div",48),t(2,` 539 `),p(3,In,4,0),p(4,kn,4,0),a(),t(5,` 540 `)),o&2){let i,e,n=m(2);s(3),u(!((i=n.guestInfoForm.get("lastName"))==null||i.errors==null)&&i.errors.required?3:-1),s(),u(!((e=n.guestInfoForm.get("lastName"))==null||e.errors==null)&&e.errors.maxlength?4:-1)}}function Rn(o,c){o&1&&(t(0,` 541 `),l(1,"small"),t(2,`Email 542 address is 543 required.`),a(),t(3,` 544 `))}function Mn(o,c){o&1&&(t(0,` 545 `),l(1,"small"),t(2,`Please enter a 546 valid email 547 address.`),a(),t(3,` 548 `))}function An(o,c){if(o&1&&(t(0,` 549 `),l(1,"div",48),t(2,` 550 `),p(3,Rn,4,0),p(4,Mn,4,0),a(),t(5,` 551 `)),o&2){let i,e,n=m(2);s(3),u(!((i=n.guestInfoForm.get("email"))==null||i.errors==null)&&i.errors.required?3:-1),s(),u(!((e=n.guestInfoForm.get("email"))==null||e.errors==null)&&e.errors.email?4:-1)}}function Vn(o,c){o&1&&(t(0,` 552 `),l(1,"small"),t(2,`Please 553 confirm your email 554 address.`),a(),t(3,` 555 `))}function $n(o,c){if(o&1&&(t(0,` 556 `),l(1,"div",48),t(2,` 557 `),p(3,Vn,4,0),a(),t(4,` 558 `)),o&2){let i,e=m(2);s(3),u(!((i=e.guestInfoForm.get("confirmEmail"))==null||i.errors==null)&&i.errors.required?3:-1)}}function Nn(o,c){o&1&&(t(0,` 559 `),l(1,"div",48),t(2,` 560 `),l(3,"small"),t(4,"Email addresses do not match."),a(),t(5,` 561 `),a(),t(6,` 562 `))}function Bn(o,c){o&1&&(t(0,` 563 `),l(1,"div",52),t(2,` 564 `),l(3,"small"),t(4,"Please complete the security verification to continue."),a(),t(5,` 565 `),a(),t(6,` 566 `))}function On(o,c){if(o&1){let i=b();t(0,` 567 `),l(1,"div",49),t(2,` 568 `),l(3,"div",50),t(4,` 569 `),l(5,"h6",42),t(6,"Security Verification"),a(),t(7,` 570 `),l(8,"re-captcha",51,0),S("resolved",function(n){C(i);let r=m(2);return f(r.resolved(n))})("errored",function(){C(i);let n=m(2);return f(n.reCaptchaErrored())}),a(),t(10,` 571 `),p(11,Bn,7,0),a(),t(12,` 572 `),a(),t(13,` 573 `)}if(o&2){let i=m(2);s(8),h("siteKey",i.captchaSettings.siteKey),s(3),u(i.showCaptchaError?11:-1)}}function Ln(o,c){if(o&1&&(t(0,` 574 `),l(1,"div",34),t(2,` 575 `),l(3,"div",35),t(4,` 576 `),l(5,"span",36),t(6,` 577 Your Information 578 `),a(),t(7,` 579 `),a(),t(8,` 580 `),l(9,"div",37),t(10,` 581 `),l(11,"app-inline-alert",38),t(12,` 582 Your rental confirmation will be sent to the email address you provide. 583 `),a(),t(13,` 584 `),l(14,"form",39),t(15,` 585 `),l(16,"div",40),t(17,` 586 `),l(18,"div",41),t(19,` 587 `),l(20,"div",42),t(21,` 588 `),l(22,"label",43),t(23,"First Name *"),a(),t(24,` 589 `),y(25,"input",44),t(26,` 590 `),p(27,En,6,2),a(),t(28,` 591 `),a(),t(29,` 592 `),l(30,"div",41),t(31,` 593 `),l(32,"div",42),t(33,` 594 `),l(34,"label",43),t(35,"Last Name *"),a(),t(36,` 595 `),y(37,"input",45),t(38,` 596 `),p(39,Pn,6,2),a(),t(40,` 597 `),a(),t(41,` 598 `),a(),t(42,` 599 `),l(43,"div",40),t(44,` 600 `),l(45,"div",41),t(46,` 601 `),l(47,"div",42),t(48,` 602 `),l(49,"label",43),t(50,"Email Address *"),a(),t(51,` 603 `),y(52,"input",46),t(53,` 604 `),p(54,An,6,2),a(),t(55,` 605 `),a(),t(56,` 606 `),l(57,"div",41),t(58,` 607 `),l(59,"div",42),t(60,` 608 `),l(61,"label",43),t(62,"Confirm Email Address *"),a(),t(63,` 609 `),y(64,"input",47),t(65,` 610 `),p(66,$n,5,1),p(67,Nn,7,0),a(),t(68,` 611 `),a(),t(69,` 612 `),a(),t(70,` 613 `),a(),t(71,` 614 `),t(72,` 615 `),p(73,On,14,2),a(),t(74,` 616 `),a(),t(75,` 617 `)),o&2){let i,e,n,r,d,x=m();s(11),h("isInline",!0),s(3),h("formGroup",x.guestInfoForm),s(13),u((i=x.guestInfoForm.get("firstName"))!=null&&i.invalid&&((i=x.guestInfoForm.get("firstName"))!=null&&i.touched)?27:-1),s(12),u((e=x.guestInfoForm.get("lastName"))!=null&&e.invali
617d&&((e=x.guestInfoForm.get("lastName"))!=null&&e.touched)?39:-1),s(15),u((n=x.guestInfoForm.get("email"))!=null&&n.invalid&&((n=x.guestInfoForm.get("email"))!=null&&n.touched)?54:-1),s(12),u((r=x.guestInfoForm.get("confirmEmail"))!=null&&r.invalid&&((r=x.guestInfoForm.get("confirmEmail"))!=null&&r.touched)?66:-1),s(),u(x.guestInfoForm.errors!=null&&x.guestInfoForm.errors.emailMismatch&&((d=x.guestInfoForm.get("confirmEmail"))!=null&&d.touched)?67:-1),s(6),u(x.captchaSettings&&!x.captcha?73:-1)}}function jn(o,c){if(o&1){let i=b();t(0,` 618 `),l(1,"app-payment-form",53,1),S("paymentMethodChanged",function(n){C(i);let r=m();return f(r.paymentProfileChange(n))})("paymentTypeChanged",function(n){C(i);let r=m();return f(r.paymentTypeChange(n))})("stripeSetupAttempted",function(n){C(i);let r=m();return f(r.handleStripeSetupAttempt(n))}),t(3,` 619 `),a(),t(4,` 620 `)}if(o&2){let i=m();s(),h("paymentData",i.paymentData)("includeHeader",!1)("paymentIntentMetadata",i.paymentIntentMetadata)("sitePaymentTypeID",i.SitePaymentType.FACILITY_RENTAL)("useSetupIntents",!0)("horizontalForm",!1)("savePaymentInfoRequired",i.savePaymentInfoRequired)("disableACH",i.disableACH)("firstName",i.isGuestCheckout?i.guestInfoForm==null||i.guestInfoForm.value==null?null:i.guestInfoForm.value.firstName:null)("lastName",i.isGuestCheckout?i.guestInfoForm==null||i.guestInfoForm.value==null?null:i.guestInfoForm.value.lastName:null)("email",i.isGuestCheckout?i.guestInfoForm==null||i.guestInfoForm.value==null?null:i.guestInfoForm.value.email:null)}}function Hn(o,c){if(o&1){let i=b();t(0,` 621 `),l(1,"div",34),t(2,` 622 `),l(3,"div",37),t(4,` 623 `),l(5,"div",54),t(6,` 624 `),l(7,"label",55),t(8,` 625 `),l(9,"input",56),R("ngModelChange",function(n){C(i);let r=m();return P(r.termsConfirmed,n)||(r.termsConfirmed=n),f(n)}),S("change",function(n){C(i);let r=m();return f(r.onTermsCheckboxChange(n))}),a(),t(10,` 626 `),l(11,"span",57),t(12,` 627 I agree to the 628 `),l(13,"a",58),S("click",function(){C(i);let n=m();return f(n.onViewTerms())}),t(14,` 629 Terms & Conditions 630 `),a(),t(15,` 631 `),a(),t(16,` 632 `),a(),t(17,` 633 `),t(18,` 634 `),l(19,"a",59),S("click",function(){C(i);let n=m();return f(n.onViewCancellationPolicy())}),t(20,` 635 View Cancellation Policy 636 `),a(),t(21,` 637 `),a(),t(22,` 638 `),a(),t(23,` 639 `),a(),t(24,` 640 `)}if(o&2){let i=m();s(9),k("ngModel",i.termsConfirmed)}}function Wn(o,c){o&1&&(t(0,` 641 `),y(1,"span",60),t(2,` 642 Processing... 643 `))}function Un(o,c){o&1&&t(0,` 644 Complete Booking 645 `)}var ai=(()=>{let c=class c{constructor(e,n,r,d,x,_,v){this.cartService=e,this.publicFacilityRentalService=n,this.siteDataService=r,this.paymentService=d,this.formService=x,this.fb=_,this.analyticsService=v,this.settings=null,this.requiresImmediatePayment=!0,this.isGuestCheckout=!1,this.sportLocation="Field",this.backToSelection=new E,this.purchaseComplete=new E,this.viewTerms=new E,this.viewCancellationPolicy=new E,this.captcha=null,this.showCaptchaError=!1,this.savePaymentInfoRequired=!1,this.purchasedItems=[],this.paymentData=[],this.paymentIntentMetadata=new qe(It.FACILITY_RENTAL),this.SitePaymentType=It,this.PaymentTiming=lt,this.disableACH=!1,this.purchasing=!1,this.submittingPayment=!1,this.termsConfirmed=!1,this.unsubscribe$=new ht,this.cartItems$=this.cartService.getCartItems(),this.totalAmount$=this.cartService.getCartTotal(),this.guestInfoForm=this.fb.group({firstName:["",[L.required,L.maxLength(50)]],lastName:["",[L.required,L.maxLength(50)]],email:["",[L.required,L.email,L.maxLength(100)]],confirmEmail:["",[L.required,L.email]]},{validator:this.emailMatchValidator})}ngOnInit(){this.setupPaymentData(),this.checkACHEligibility(),this.settings.facilityRentalPaymentTimingID!==lt.AtBooking&&!this.isGuestCheckout&&(this.savePaymentInfoRequired=!0),this.validateCartAvailability().pipe(N(this.unsubscribe$)).subscribe()}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete()}setupPaymentData(){let e=this.cartService.getCartSummary(),n=e.total;this.selectedClubPaymentFee?.userFee>0&&(n+=this.selectedClubPaymentFee.userFee),this.paymentIntentMetadata.amount=n,this.paymentData=[{sitePaymentTypeID:It.FACILITY_RENTAL,amount:n,facilityRentalSettingsID:this.settings.facilityRentalSettingsID,facilityFieldIDs:e.facilityFieldIDs}]}onBackClick(){this.backToSelection.emit()}onPurchaseClick(){this.purchasing=!0,this.validateCartAvailability().pipe(N(this.unsubscribe$)).subscribe({next:e=>{e?this.purchasing=!1:this.requiresImmediatePayment?!this.selectedClubUserPaymentMethod||this.selectedClubUserPaymentMethod.clubUserPaymentMethodID===-1?this.paymentService.submitSetupIntent():this.onPaymentComplete():this.proceedWithoutImmediatePayment()},error:()=>{this.siteDataService.showSiteErrorAlert("There was a problem validating your cart. Please try again."),this.purchasing=!1}})}proceedWithoutImmediatePayment(){return ut(this,null,function*(){if(!this.validateForm()){this.purchasing=!1;return}let e=this.cartService.getCurrentCartItems(),n=this.buildPurchaseRequest
645(e);this.publicFacilityRentalService.createRental(n).pipe(N(this.unsubscribe$)).subscribe({next:r=>{r.success?this.completePurchase(r):this.siteDataService.showSiteErrorAlert(r.message||"Booking failed. Please try again."),this.isGuestCheckout&&this.guestInfoForm.reset(),this.purchasing=!1},error:r=>{let d=r?.error?.Message||r?.error?.message||"Booking failed. Please try again.";this.siteDataService.showSiteErrorAlert(d),this.purchasing=!1}})})}handleStripeSetupAttempt(e){let n="There was an error completing your payment";this.formService.clearFormErrorMessage(),e.success?this.onPaymentComplete():(this.formService.showFormErrorMessage(n),this.siteDataService.showSiteErrorAlert(n),this.submittingPayment=!1)}onPaymentComplete(){let e=this.cartService.getCurrentCartItems(),n=this.buildPurchaseRequest(e);this.publicFacilityRentalService.createRental(n).pipe(N(this.unsubscribe$)).subscribe({next:r=>{r.success?this.completePurchase(r):this.siteDataService.showSiteErrorAlert(r.message||"Purchase failed. Please try again."),this.purchasing=!1,this.submittingPayment=!1},error:r=>{let d=r?.error?.Message||r?.error?.message||"Purchase failed. Please try again.";this.siteDataService.showSiteErrorAlert(d),this.purchasing=!1,this.submittingPayment=!1}})}completePurchase(e){this.purchasedItems=[...this.cartService.getCurrentCartItems()];let n=this.cartService.getCurrentCartTotal();this.cartService.clearCart();let r=this.purchasedItems.map(x=>{let _=new he(`facility_time_slot_${x.timeSlot?.facilityRentalTimeSlotID??x.id}`,`${x.facilityName} - ${x.fieldName}`);return _.item_category="Facility Rental",_.price=x.price,_.quantity=1,_}),d=`facility_rental_${e.rentalId??e.confirmationNumber}`;this.analyticsService.makePurchase(new _e(d,e.totalAmount??n,r)),this.purchaseComplete.emit({facilityRentalPurchaseResult:e,purchasedItems:this.purchasedItems})}buildPurchaseRequest(e){let n=null;if(this.isGuestCheckout&&this.guestInfoForm.valid){let r=this.guestInfoForm.value;n={firstName:r.firstName,lastName:r.lastName,email:r.email}}return{timeSlotIds:e.filter(r=>r.timeSlot.facilityRentalTimeSlotID>0).map(r=>r.timeSlot.facilityRentalTimeSlotID),virtualTimeSlots:e.filter(r=>r.timeSlot.facilityRentalTimeSlotID===0).map(r=>({facilityFieldID:r.timeSlot.facilityFieldID,slotDate:this.formatSlotDateForApi(r.timeSlot.slotDate),startTime:r.timeSlot.startTime,endTime:r.timeSlot.endTime,price:r.timeSlot.price||0})),paymentInfo:this.paymentForm.value,guestCustomerInfo:n,totalAmount:this.cartService.getCurrentCartTotal(),facilityRentalSettingsID:this.settings.facilityRentalSettingsID}}formatSlotDateForApi(e){let n=typeof e=="string"?new Date(e):e,r=n.getFullYear(),d=String(n.getMonth()+1).padStart(2,"0"),x=String(n.getDate()).padStart(2,"0");return`${r}-${d}-${x}`}paymentTypeChange(e){this.selectedClubPaymentFee=e.clubPaymentFee,this.surchargeDetail=e.surchargeDetail,this.setupPaymentData()}getTotalWithFees(){let n=this.cartService.getCurrentCartTotal();return this.selectedClubPaymentFee?.userFee>0&&(n+=this.selectedClubPaymentFee.userFee),this.surchargeDetail?.perItemRoundedTotal>0&&(n+=this.surchargeDetail.perItemRoundedTotal),n}getSurchargeAmount(){return this.surchargeDetail?.perItemRoundedTotal||0}getSurchargeName(){if(this.surchargeDetail?.facilityRentalSurchargeDetails&&this.settings?.facilityRentalSettingsID){let e=this.surchargeDetail.facilityRentalSurchargeDetails.find(n=>n.facilityRentalSettingsID===this.settings.facilityRentalSettingsID);if(e?.surchargeName)return e.surchargeName}return"Surcharge"}getPaymentFee(){return this.selectedClubPaymentFee?.userFee||0}onViewTerms(){this.viewTerms.emit()}onViewCancellationPolicy(){this.viewCancellationPolicy.emit()}onTermsCheckboxChange(e){let n=e.target;this.termsConfirmed=n.checked}canProceedToCheckout(){return this.paymentForm&&!this.paymentForm.isValid?!1:this.settings&&this.settings.termsAndConditions?.length>0&&this.settings.isTermsConfirmationRequired?this.termsConfirmed:!0}paymentProfileChange(e){this.selectedClubUserPaymentMethod=e}validateForm(){if(this.isGuestCheckout){if(this.guestInfoForm.invalid)return this.guestInfoForm.markAllAsTouched(),!1;if(this.captchaSettings&&!this.captcha)return this.showCaptchaError=!0,!1}return!(this.settings?.isTermsConfirmationRequired&&!this.termsConfirmed)}emailMatchValidator(e){let n=e.get("email"),r=e.get("confirmEmail");return n&&r&&n.value!==r.value?{emailMismatch:!0}:null}resolved(e){this.captcha=e,this.showCaptchaError=!1}reCaptchaErrored(){this.captcha=null,this.showCaptchaError=!0}getDurationFromTimeSlot(e){let n=new Date(`1970-01-01T${e.startTime}`),x=(new Date(`1970-01-01T${e.endTime}`).getTime()-n.getTime())/(1e3*60);if(x>=60){let _=Math.floor(x/60),v=x%60;return v>0?`${_}hr ${v}min`:`${_}hr`}else return`${x}min`}formatPrice(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(e)}removeItem(e){this.cartService.removeItem(e.id)}trackByItemId(e,n){return n.id}checkACHEligibility(){let n=this.cartService.getCurrentCartItems().some(r=>{let d=new Date(r.timeSlot.slotDate);return this.isDateWithin7Days(d)});this.disableACH=this.isGuestCheckout||n}isDateWithin7Days(e){let n=new Date;n.setHours(0,0,0,0);let r=new Date(e);r.setHours(0,0,0,0);let x=(r.getTime()-n.getTime())/(1e3*60*60*24);return x>=0&&x<=7}validateGuestCheckout(){if(this.isGuestCheckout){if(this.guestInfoForm.invali
645d)return this.guestInfoForm.markAllAsTouched(),!1;if(this.captchaSettings&&!this.captcha)return this.showCaptchaError=!0,!1}return!0}validateCartAvailability(){let e=this.cartService.getCurrentCartItems(),n={timeSlotIds:e.filter(r=>r.timeSlot.facilityRentalTimeSlotID>0).map(r=>r.timeSlot.facilityRentalTimeSlotID),virtualTimeSlots:e.filter(r=>r.timeSlot.facilityRentalTimeSlotID===0).map(r=>({facilityFieldID:r.timeSlot.facilityFieldID,slotDate:this.formatSlotDateForApi(r.timeSlot.slotDate),startTime:r.timeSlot.startTime,endTime:r.timeSlot.endTime,price:r.timeSlot.price||0}))};return this.publicFacilityRentalService.validateTimeSlotAvailability(n).pipe(Ct(r=>{let d=r.unavailableTimeSlotIds?.length>0||r.unavailableVirtualTimeSlots?.length>0;if(d){e.forEach(v=>{let $=r.unavailableTimeSlotIds?.includes(v.timeSlot.facilityRentalTimeSlotID),J=r.unavailableVirtualTimeSlots?.some(M=>M.facilityFieldID===v.timeSlot.facilityFieldID&&M.slotDate===this.formatSlotDateForApi(v.timeSlot.slotDate)&&M.startTime===v.timeSlot.startTime&&M.endTime===v.timeSlot.endTime);($||J)&&this.cartService.removeItem(v.id)});let _=(r.unavailableTimeSlotIds?.length||0)+(r.unavailableVirtualTimeSlots?.length||0)===1?"One time slot is no longer available and has been removed from your cart.":"Some time slots are no longer available and have been removed from your cart.";this.siteDataService.showSiteErrorAlert(_)}return d}),Yt(()=>(console.error("Failed to validate time slot availability"),_t(!1))))}};c.\u0275fac=function(n){return new(n||c)(F(B),F(z),F(Et),F(Ge),F(ke),F(wt),F(Ce))},c.\u0275cmp=O({type:c,selectors:[["app-facility-rental-checkout"]],viewQuery:function(n,r){if(n&1&&St(xn,5),n&2){let d;vt(d=Tt())&&(r.paymentForm=d.first)}},inputs:{settings:"settings",requiresImmediatePayment:"requiresImmediatePayment",isGuestCheckout:"isGuestCheckout",captchaSettings:"captchaSettings",sportLocation:"sportLocation"},outputs:{backToSelection:"backToSelection",purchaseComplete:"purchaseComplete",viewTerms:"viewTerms",viewCancellationPolicy:"viewCancellationPolicy"},standalone:!1,decls:40,vars:14,consts:[["recaptcha",""],["paymentForm",""],[1,"facility-rental-checkout"],[1,"container-fluid","py-4"],["parentLink","/admin/dashboard","parentLinkText","Facility Rentals",3,"backButtonClicked","pageTitle","showBackButton","useBackButtonEmitter"],[1,"row","mt-3"],[1,"col-lg-8"],[1,"card","mb-4","pb-0"],[1,"d-flex","gap-3","mb-4"],["type","button",1,"btn","btn-primary",3,"click","disabled"],["type","button",1,"btn","btn-outline-secondary",3,"click"],[1,"col-lg-4"],[1,"cart-items-list"],[3,"value"],["pTemplate","header"],["pTemplate","body"],["pTemplate","footer"],[1,"my-3"],[1,"text-medium"],[1,"text-right"],["type","button","title","Remove from cart",1,"btn","btn-sm","btn-tertiary",3,"click"],[1,"fal","fa-trash"],[1,""],["colspan","4",1,"text-right","border-none"],[1,"full-width","right","d-block"],[1,"my-1"],[1,"d-flex","justify-content-between","fw-600"],[1,"text-primary"],[1,"d-flex","justify-content-between","mb-2","text-medium","fw-400"],["alertType","info",3,"isInline"],[1,"empty-cart-state","text-center","py-5"],[1,"fa","fa-shopping-cart","text-muted",2,"font-size","3rem"],[1,"mt-3","text-muted"],[1,"text-muted"],[1,"card","mb-4"],[1,"card-header"],[1,"text-large","border-bottom"],[1,"card-body"],["alertType","info",1,"mb-3",3,"isInline"],[3,"formGroup"],[1,"row"],[1,"col-md-6"],[1,"mb-3"],[1,"form-label"],["type","text","formControlName","firstName","placeholder","Enter your first name",1,"form-control"],["type","text","formControlName","lastName","placeholder","Enter your last name",1,"form-control"],["type","email","formControlName","email","placeholder","Enter your email address",1,"form-control"],["type","email","formControlName","confirmEmail","placeholder","Confirm your email address",1,"form-control"],[1,"text-danger","mt-1"],[1,"mt-3"],[1,"border","rounded","p-3"],["action","facility-rental-purchase",3,"resolved","errored","siteKey"],[1,"text-danger","mt-2"],[3,"paymentMethodChanged","paymentTypeChanged","stripeSetupAttempted","paymentData","includeHeader","paymentIntentMetadata","
645sitePaymentTypeID","useSetupIntents","horizontalForm","savePaymentInfoRequired","disableACH","firstName","lastName","email"],[1,"d-flex","justify-content-between","align-items-center"],[1,"form-check","mb-0"],["type","checkbox",1,"form-check-input",3,"ngModelChange","change","ngModel"],[1,"form-check-label"],["href","javascript:void(0)",1,"text-decoration-underline",3,"click"],["href","javascript:void(0)",1,"text-decoration-underline","small",3,"click"],["role","status","aria-hidden","true",1,"spinner-border","spinner-border-sm","me-2"]],template:function(n,r){if(n&1&&(l(0,"div",2),t(1,` 646 `),l(2,"div",3),t(3,` 647 `),t(4,` 648 `),l(5,"app-admin-header",4),S("backButtonClicked",function(){return r.onBackClick()}),t(6,` 649 `),a(),t(7,` 650 651 `),l(8,"div",5),t(9,` 652 `),t(10,` 653 `),l(11,"div",6),t(12,` 654 `),l(13,"div",7),t(14,` 655 `),p(15,Fn,20,3),w(16,"async"),a(),t(17,` 656 657 658 `),t(18,` 659 `),p(19,Ln,76,8),p(20,jn,5,11),p(21,Hn,25,1),l(22,"div",8),t(23,` 660 `),l(24,"button",9),w(25,"async"),S("click",function(){return r.onPurchaseClick()}),t(26,` 661 `),p(27,Wn,3,0),p(28,Un,1,0),a(),t(29,` 662 `),l(30,"button",10),S("click",function(){return r.onBackClick()}),t(31,` 663 Cancel 664 `),a(),t(32,` 665 `),a(),t(33,` 666 `),a(),t(34,` 667 668 `),l(35,"div",11),t(36,` 669 `),a(),t(37,` 670 `),a(),t(38,` 671 `),a(),t(39,` 672`),a()),n&2){let d,x;s(5),h("pageTitle","Checkout")("showBackButton",!0)("useBackButtonEmitter",!0),s(10),u((d=I(16,10,r.cartItems$))?15:-1,d),s(4),u(r.isGuestCheckout?19:-1),s(),u(r.paymentIntentMetadata&&(r.paymentData!=null&&r.paymentData.length)?20:-1),s(),u(r.settings!=null&&r.settings.isTermsConfirmationRequired&&(r.settings!=null&&r.settings.termsAndConditions)?21:-1),s(3),h("disabled",r.purchasing||!r.canProceedToCheckout()||((x=I(25,12,r.cartItems$))==null?null:x.length)===0),s(3),u(r.purchasing?27:-1),s(),u(r.purchasing?-1:28)}},dependencies:[oe,ae,Dt,j,le,H,se,re,Ye,Ke,it,at,Oe,Rt,tt],encapsulation:2});let o=c;return o})();var Gn=["rentalCart"],li=()=>({width:"70vw",maxWidth:"800px"});function Yn(o,c){o&1&&(t(0,` 673 `),l(1,"div",11),t(2,"Rent a Facility"),a(),t(3,` 674 `))}function zn(o,c){if(o&1){let i=b();t(0,` 675 `),l(1,"app-cart-button",12),S("checkoutClicked",function(){C(i);let n=m(2);return f(n.onProceedToPayment())})("viewTerms",function(){C(i);let n=m(2);return f(n.onViewTerms())})("viewCancellationPolicy",function(){C(i);let n=m(2);return f(n.onViewCancellationPolicy())}),t(2,` 676 `),a(),t(3,` 677 `)}if(o&2){let i=m(2);s(),h("settings",i.settings)("requiresImmediatePayment",i.requiresImmediatePayment)("showTermsAndConditions",!1)}}function Kn(o,c){if(o&1&&(t(0,` 678 `),l(1,"div",8),t(2,` 679 `),p(3,Yn,4,0),l(4,"div",9),t(5,` 680 `),l(6,"a",10),t(7,"My Rentals"),a(),t(8,` 681 `),t(9,` 682 `),p(10,zn,4,3),a(),t(11,` 683 `),a(),t(12,` 684 `)),o&2){let i=m();s(3),u(i.showCheckout?-1:3),s(3),h("routerLink","/account/manage/facility-rentals"),s(4),u(i.showCheckout?-1:10)}}function Qn(o,c){o&1&&Y(0)}function Jn(o,c){if(o&1&&(t(0,` 685 `),l(1,"div",13),t(2,` 686 `),D(3,Qn,1,0,"ng-container",14),t(4,` 687 `),a(),t(5,` 688 `)),o&2){m();let i=X(31);s(3),h("ngTemplateOutlet",i)}}function Zn(o,c){if(o&1){let i=b();t(0,` 689 `),l(1,"app-facility-rental-checkout",16),S("backToSelection",function(){C(i);let n=m(2);return f(n.onBackFromCheckout())})("purchaseComplete",function(n){C(i);let r=m(2);return f(r.onCheckoutComplete(n))})("viewTerms",function(){C(i);let n=m(2);return f(n.onViewTerms())})("viewCancellationPolicy",function(){C(i);let n=m(2);return f(n.onViewCancellationPolicy())}),t(2,` 690 `),a(),t(3,` 691 `)}if(o&2){let i=m(2);s(),h("settings",i.settings)("isGuestCheckout",i.isGuestCheckout)("captchaSettings",i.captchaSettings)("sportLocation",i.sportLocation)}}function Xn(o,c){if(o&1&&(t(0,` 692 `),l(1,"tr"),t(2,` 693 `),l(3,"th"),t(4),a(),t(5,` 694 `),l(6,"th"),t(7,"Date & Time"),a(),t(8,` 695 `),l(9,"th"),t(10,"Duration"),a(),t(11,` 696 `),l(12,"th"),t(13,"Price"),a(),t(14,` 697 `),a(),t(15,` 698 `)),o&2){let i=m(3);s(4),g("Facility & ",i.sportLocation)}}function ta(o,c){if(o&1&&(t(0,` 699 `),l(1,"tr"),t(2,` 700 `),l(3,"td"),t(4,` 701 `),l(5,"div"),t(6),a(),t(7,` 702 `),l(8,"span",28),t(9),a(),t(10,` 703 `),a(),t(11,` 704 `),l(12,"td"),t(13,` 705 `),l(14,"div"),t(15),a(),t(16,` 706 `),l(17,"span",28),t(18),a(),t(19,` 707 `),a(),t(20,` 708 `),l(21,"td"),t(22,` 709 `),l(23,"span"),t(24),a(),t(25,` 710 `),a(),t(26,` 711 `),l(27,"td"),t(28,` 712 `),l(29,"span"),t(30),a(),t(31,` 713 `),a(),t(32,` 714 `),a(),t(33,` 715 `)),o&2){let i=c.$implicit,e=m(3);s(6),T(i.facilityName),s(3),T(i.fieldName),s(6),T(i.displayDate),s(3),T(i.displayTime),s(6),g(` 716 `,e.getDurationFromTimeSlot(i.timeSlot),` 717 `),s(6),g("$",i.price.toFixed(2))}}function ea(o,c){if(o&1&&(t(0,` 718 `),l(1,"div",31),t(2,` 719 `),l(3,"span"),t(4),a(),t(5,` 720 `),l(6,"span",32),t(7),a(),t(8,` 721 `),a(),t(9,` 722 `)),o&2){let i=m(5);s(4),g("",i.purchaseConfirmation.facilityRentalSurchargeDetail.surchargeName,":"),s(3),g(` 723 $`,i.purchaseConfirmation.facilityRentalSurchargeDetail.amount.toFixed(2),` 724 `)}}function ia(o,c){if(o&1&&(t(0,` 725 `),l(1,"div",31),t(2,` 726 `),l(3,"span"),t(4),a(),t(5,` 727 `),l(6,"span",32),t(7),a(),t(8,` 728 `),a(),t(9,` 729 `)),o&2){let i=m(5);s(4),g("",i.purchaseConfirmation.userFeeDescription,":"),s(3),g(` 730 $`,i.purchaseConfirmation.userFee.toFixed(2),` 731 `)}}function na(o,c){if(o&1&&(t(0,` 732 `),l(1,"span",30),t(2,` 733 `),l(3,"div",31),t(4,` 734 `),l(5,"span"),t(6,"Subtotal:"),a(),t(7,` 735 `),l(8,"span",32),t(9),a(),t(10,` 736 `),a(),t(11,` 737 `),t(12,` 738 `),p(13,ea,10,2),p(14,ia,10,2),y(15,"hr",33),t(16,` 739 `),l(17,"div",34),t(18,` 740 `),l(19,"span"),t(20,"Total Amount"),a(),t(21,` 741 `),l(22,"span",35),t(23),a(),t(24,` 742 `),a(),t(25,` 743 `),a(),t(26,` 744 `)),o&2){let i=m(4);s(9),g(` 745 $`,i.getPurchasedItemsTotal().toFixed(2),` 746 `),s(4),u((i.purchaseConfirmation==null||i.purchaseConfirmation.facilityRentalSurchargeDetail==null?null:i.purchaseConfirmation.facilityRentalSurchargeDetail.amount)>0?13:-1),s(),u((i.purchaseConfirmation==null?null:i.purchaseConfirmation.userFee)>0?14:-1),s(9),g("$",i.getFinalTotal().toFixed(2))}}function aa(o,c){if(o&1&&(t(0,` 747 `),l(1,"tr"),t(2,` 748 `),l(3,"td",29),t(4,` 749 `),p(5,na,27,4),a()()),o&2){let i=m(3);s(5),u(i.hasFeesOrSurcharges()?5:-1)}}function la(o,c){if(o&1&&(t(0,` 750 `),l(1,"app-inline-alert",36),t(2,` 751 `),l(3,"strong"),t(4,"Cancellation Period:"),a(),y(5,"br"),t(6,` 752 Cancellations must be made at least `),l(7,"strong"),t(8),a(),t(9,` before your scheduled time. 753 `),a(),t(10,` 754 `)),o&2){let i=m(3);s(),h("isInline",!0),s(7),g("",i.settings.cancellationPeriodHours," hours")}}function oa(o,c){if(o&1&&(t(0,` 755 `),l(1,"div"),t(2,` 756 `),y(3,"div",4),w(4,"safeHtml"),t(5,` 757 `),a(),t(6,` 758 `)),o&2){let i=m(3);s(3),h("innerHTML",I(4,1,i.settings.cancellationPolicyText),G)}}function ra(o,c){o&1&&(t(0,`
759 `),l(1,"div",37)(2,"strong"),t(3,"Full Refund:"),a(),t(4," Cancel with proper notice"),a(),t(5,` 760 `),l(6,"div",38)(7,"strong"),t(8,"No Refund:"),a(),t(9," Late cancellations or no-shows"),a(),t(10,` 761 `))}function sa(o,c){if(o&1&&(t(0,` 762 `),l(1,"div"),t(2,` 763 `),y(3,"div",4),w(4,"safeHtml"),t(5,` 764 `),a(),t(6,` 765 `)),o&2){let i=m(3);s(3),h("innerHTML",I(4,1,i.settings.rentalGuidelines),G)}}function ca(o,c){o&1&&(t(0,` 766 `),l(1,"ul",38),t(2,` 767 `),l(3,"li"),t(4,"Arrive 15 minutes before your scheduled time"),a(),t(5,` 768 `),l(6,"li"),t(7,"Bring proper athletic equipment"),a(),t(8,` 769 `),l(9,"li"),t(10,"Clean up after your session"),a(),t(11,` 770 `),l(12,"li"),t(13,"Respect facility rules and other users"),a(),t(14,` 771 `),a(),t(15,` 772 `))}function ma(o,c){if(o&1&&(t(0,` 773 `),l(1,"div",20),t(2,` 774 `),l(3,"div",21),t(4,` 775 Terms & Conditions 776 `),a(),t(5,` 777 `),l(6,"div",22),t(7,` 778 `),y(8,"div",39),w(9,"safeHtml"),t(10,` 779 `),a(),t(11,` 780 `),a(),t(12,` 781 `)),o&2){let i=m(3);s(8),h("innerHTML",I(9,1,i.settings.termsAndConditions),G)}}function da(o,c){if(o&1){let i=b();t(0,` 782 `),l(1,"div",17),t(2,` 783 `),l(3,"div",18),t(4,` 784 `),l(5,"div",19),t(6,` 785 `),t(7,` 786 `),l(8,"div",20),t(9,` 787 `),l(10,"div",21),t(11,"Rental Confirmed!"),a(),t(12,` 788 `),l(13,"div",22),t(14,"Your facility rental has been successfully booked with "),l(15,"strong"),t(16),a()(),t(17,` 789 `),a(),t(18,` 790 `),t(19,` 791 `),l(20,"div",20),t(21,` 792 `),l(22,"div",21),t(23,"Purchase Details"),a(),t(24,` 793 `),l(25,"div",22),t(26,` 794 `),l(27,"p-table",23),t(28,` 795 `),D(29,Xn,16,1,"ng-template",24),t(30,` 796 `),D(31,ta,34,6,"ng-template",25),t(32,` 797 `),D(33,aa,6,1,"ng-template",5),t(34,` 798 `),a(),t(35,` 799 `),a(),t(36,` 800 `),a(),t(37,` 801 `),t(38,` 802 `),t(39,` 803 `),l(40,"div",20),t(41,` 804 `),l(42,"div",21),t(43,` 805 Cancellation Policy 806 `),a(),t(44,` 807 `),l(45,"div",22),t(46,` 808 `),p(47,la,11,2),p(48,oa,7,3)(49,ra,11,0),a(),t(50,` 809 `),a(),t(51,` 810 `),t(52,` 811 `),l(53,"div",20),t(54,` 812 `),l(55,"div",21),t(56,` 813 Rental Guidelines 814 `),a(),t(57,` 815 `),l(58,"div",22),t(59,` 816 `),p(60,sa,7,3)(61,ca,16,0),a(),t(62,` 817 `),a(),t(63,` 818 `),t(64,` 819 `),p(65,ma,13,3),l(66,"div",26),t(67,` 820 `),l(68,"button",27),S("click",function(){C(i);let n=m(2);return f(n.startNewRental())}),t(69,` 821 Book Another Rental 822 `),a(),t(70,` 823 `),a(),t(71,` 824 `),a(),t(72,` 825 `),a(),t(73,` 826 `),a(),t(74,` 827 `)}if(o&2){let i=m(2);s(16),g("confirmation #",i.purchaseConfirmation.confirmationNumber),s(11),h("value",i.purchasedItems),s(20),u(i.settings!=null&&i.settings.cancellationPeriodHours?47:-1),s(),u(i.settings!=null&&i.settings.cancellationPolicyText?48:49),s(12),u(i.settings!=null&&i.settings.rentalGuidelines?60:61),s(5),u(i.settings!=null&&i.settings.termsAndConditions?65:-1)}}function pa(o,c){o&1&&(t(0,` 828 `),l(1,"span"),t(2,` 829 Payment will be processed automatically before your rental begins. 830 `),a(),t(3,` 831 `))}
831function ua(o,c){o&1&&(t(0,` 832 `),l(1,"span"),t(2,` 833 Payment will be processed automatically after your rental ends. 834 `),a(),t(3,` 835 `))}function xa(o,c){if(o&1&&(t(0,` 836 `),l(1,"div",54),t(2,` 837 `),l(3,"app-inline-alert",55),t(4,` 838 `),l(5,"strong",56),t(6,"Payment Information:"),a(),t(7,` 839 `),p(8,pa,4,0),p(9,ua,4,0),a(),t(10,` 840 `),a(),t(11,` 841 `)),o&2){let i=m(3);s(3),h("alertType","info")("isInline",!0),s(5),u(i.settings.facilityRentalPaymentTimingID===i.PaymentTiming.BeforeEvent?8:-1),s(),u(i.settings.facilityRentalPaymentTimingID===i.PaymentTiming.AfterEvent?9:-1)}}function ha(o,c){o&1&&(t(0,` 842 `),l(1,"app-loader"),t(2,"Loading time slots..."),a(),t(3,` 843 `))}function _a(o,c){if(o&1&&(t(0,` 844 `),l(1,"span",57),t(2,` 845 `),l(3,"span",58),t(4),l(5,"span",59),t(6),a(),t(7,` 846 `),a(),t(8,` 847 `),a(),t(9,` 848 `)),o&2){let i=m(4);s(4),g(` 849 `,i.selectedFacilityObject.facilityName,` 850 `),s(2),ct(` 851 (`,(i.selectedFacilityObject.fields==null?null:i.selectedFacilityObject.fields.length)||0," ",i.sportLocation,"",((i.selectedFacilityObject.fields==null?null:i.selectedFacilityObject.fields.length)||0)!==1?"s":"",` available) 852 `)}}function Ca(o,c){if(o&1&&(t(0,` 853 `),p(1,_a,10,4)),o&2){let i=m(3);s(),u(i.selectedFacilityObject?1:-1)}}function fa(o,c){o&1&&(t(0,` 854 `),y(1,"i",63),t(2,` 855 `))}function ga(o,c){if(o&1&&(t(0,` 856 `),l(1,"span"),t(2),a(),t(3,` 857 `)),o&2){let i=m().$implicit,e=m(3);s(2),g(` 858 `,e.getFacilityPriceRange(i),` 859 `)}}function ya(o,c){if(o&1&&(t(0,` 860 `),l(1,"div",60),t(2,` 861 `),l(3,"div",61),t(4,` 862 `),l(5,"div",50),t(6,` 863 `),l(7,"div"),t(8),p(9,fa,3,0),l(10,"span",62),t(11),a(),t(12,` 864 `),a(),t(13,` 865 `),a(),t(14,` 866 `),p(15,ga,4,1),a(),t(16,` 867 `),t(17,` 868 `),a(),t(18,` 869 `)),o&2){let i=c.$implicit,e=m(3);s(),A("disabled",!e.isFacilityCompatibleWithCart(i)),h("pTooltip",e.getFacilityIncompatibilityMessage(i)),s(6),A("text-muted",!e.isFacilityCompatibleWithCart(i)),s(),g(` 870 `,i.facilityName,` 871 `),s(),u(e.isFacilityCompatibleWithCart(i)?-1:9),s(2),ct(` 872 (`,(i.fields==null?null:i.fields.length)||0," ",e.sportLocation,"",((i.fields==null?null:i.fields.length)||0)!==1?"s":"",` 873 available) 874 `),s(4),u(e.getFacilityPriceRange(i)?15:-1)}}function Sa(o,c){if(o&1&&(t(0,` 875 `),l(1,"div",64),t(2,` 876 `),l(3,"app-inline-alert",65),t(4,` 877 `),y(5,"i",66),t(6),a(),t(7,` 878 `),a(),t(8,` 879 `)),o&2){let i=m(3);s(6),g(` 880 `,i.getFacilityIncompatibilityMessage(i.selectedFacilityObject),` 881 `)}}function va(o,c){if(o&1){let i=b();t(0,` 882 `),l(1,"div"),t(2,` 883 `),t(3,` 884 `),l(4,"app-facility-time-slot-selection",67),S("timeSlotAdded",function(n){C(i);let r=m(3);return f(r.onTimeSlotSelected(n))}),t(5,` 885 `),a(),t(6,` 886 `),a(),t(7,` 887 `)}if(o&2){let i=m(3);s(4),h("selectedDate",i.selectedDate)("availableTimeSlots$",i.availableTimeSlots$)("settings",i.settings)("loading",!1)("allowMultipleSlots",!0)("maxSlots",50)("facilityId",i.selectedFacility)("sportLocation",i.sportLocation)}}
887function Ta(o,c){o&1&&Y(0)}function ba(o,c){if(o&1&&(t(0,` 888 `),l(1,"div",13),t(2,` 889 `),D(3,Ta,1,0,"ng-container",14),t(4,` 890 `),a(),t(5,` 891 `)),o&2){m(3);let i=X(31);s(3),h("ngTemplateOutlet",i)}}function Fa(o,c){if(o&1&&(t(0,` 892 `),l(1,"div",68),t(2,` 893 `),t(3,` 894 `),l(4,"app-inline-alert",55),t(5),a(),t(6,` 895 `),a(),t(7,` 896 `)),o&2){let i=m(3);s(4),h("alertType","info")("isInline",!0),s(),g(` 897 Please choose a date from the calendar to view available time slots for `,i.selectedFacilityObject.facilityName,`. 898 `)}}function Da(o,c){if(o&1&&(t(0,` 899 `),l(1,"div",69),t(2,` 900 `),l(3,"app-null-card",70),t(4,` 901 `),a(),t(5,` 902 `),a(),t(6,` 903 `)),o&2){let i=m(3);s(3),h("text","Please choose a facility above to view available dates and time slots.")("image",i.imageType.CALENDAR)("showButton",!1)("showCard",!0)}}function wa(o,c){if(o&1&&(t(0,` 904 `),l(1,"div",40),t(2,` 905 `),l(3,"div",71),t(4,` 906 `),l(5,"app-null-card",70),t(6,` 907 `),a(),t(7,` 908 `),a(),t(8,` 909 `),a(),t(9,` 910 `)),o&2){let i=m(3);s(5),h("text","There are currently no facilities available for rental. Please check back later or contact support.")("image",i.imageType.FLAG)("showButton",!1)("showCard",!0)}}function Ea(o,c){if(o&1){let i=b();t(0,` 911 `),l(1,"div"),t(2,` 912 `),t(3,` 913 `),t(4,` 914 `),t(5,` 915 `),p(6,xa,12,4),w(7,"async"),l(8,"div",40),t(9,` 916 `),l(10,"div",41),t(11,` 917 `),l(12,"div",42),t(13,` 918 Select a Date 919 `),a(),t(14,` 920 `),t(15,` 921 `),l(16,"div"),t(17,` 922 `),l(18,"app-facility-date-calendar",43),S("dateSelected",function(n){C(i);let r=m(2);return f(r.onDateSelected(n))}),a(),t(19,` 923 `),a(),t(20,` 924 `),p(21,ha,4,0),a(),t(22,` 925 `),t(23,` 926 `),l(24,"div",44),t(25,` 927 `),t(26,` 928 `),l(27,"div",45),t(28,` 929 Select a Location & Time 930 `),a(),t(29,` 931 `),l(30,"div",46),t(31,` 932 `),l(32,"div",47),t(33,` 933 `),l(34,"div",48),t(35,` 934 `),y(36,"i",49),t(37,` 935 `),a(),t(38,` 936 `),l(39,"div",50),t(40,` 937 `),t(41,` 938 `),l(42,"p-select",51),R("ngModelChange",function(n){C(i);let r=m(2);return P(r.selectedFacility,n)||(r.selectedFacility=n),f(n)}),S("onChange",function(n){C(i);let r=m(2);return f(r.onFacilitySelected(n.value))}),t(43,` 939 `),D(44,Ca,2,1,"ng-template",52),t(45,` 940 `),D(46,ya,19,11,"ng-template",53),t(47,` 941 `),a(),t(48,` 942 `),a(),t(49,` 943 `),a(),t(50,` 944 `),t(51,` 945 `),t(52,` 946 `),a(),t(53,` 947 `),t(54,` 948 `),p(55,Sa,9,1),p(56,va,8,8),p(57,ba,6,1),p(58,Fa,8,3),p(59,Da,7,4),a(),t(60,` 949 `),a(),t(61,` 950 `),t(62,` 951 `),p(63,wa,10,4),a(),t(64,` 952 `)}if(o&2){let i,e=m(2);s(6),u(!e.requiresImmediatePayment&&e.settings&&((i=I(7,19,e.cartItems$))==null?null:i.length)>0?6:-1),s(10),A("opacity-50",e.loadingTimeSlots)("pointer-events-none",e.loadingTimeSlots),s(2),h("maxDate",e.maxBookingDate)("selectedDate",e.selectedDate),s(3),u(e.loadingTimeSlots?21:-1),s(21),h("options",e.availableFacilities),k("ngModel",e.selectedFacility),h("showClear",!1)("styleClass","full-width")("optionDisabled","disabled"),s(13),u(e.selectedDate&&e.selectedFacilityObject&&!e.isFacilityCompatibleWithCart(e.selectedFacilityObject)?55:-1),s(),u(e.selectedDate&&e.selectedFacilityObject&&!e.loadingTimeSlots&&e.isFacilityCompatibleWithCart(e.selectedFacilityObject)?56:-1),s(),u(e.selectedDate&&e.selectedFacilityObject&&e.loadingTimeSlots?57:-1),s(),u(e.selectedFacilityObject&&!e.selectedDate?58:-1),s(),u(e.selectedFacilityObject?-1:59),s(4),u(!e.loading&&e.availableFacilities.length===0&&e.selectedFacilityObject?63:-1)}}function Ia(o,c){if(o&1&&(t(0,` 953 `),l(1,"div",15),t(2,` 954 `),t(3,` 955 `),p(4,Zn,4,4),p(5,da,75,6),p(6,Ea,65,21),a(),t(7,` 956`)),o&2){let i=m();s(4),u(i.showCheckout&&!i.showConfirmation?4:-1),s(),u(i.showConfirmation?5:-1),s(),u(!i.showCheckout&&!i.showConfirmation?6:-1)}}function ka(o,c){if(o&1){let i=b();t(0,` 957 `),l(1,"app-dialog-footer"),t(2,` 958 `),Y(3,72),t(4,` 959 `),rt(5,73),t(6,` 960 `),l(7,"button",74),S("click",function(){C(i);let n=m();return f(n.onTermsModalClosed())}),t(8,"Close"),a(),t(9,` 961 `),st(),t(10,` 962 `),a(),t(11,` 963 `)}}function Pa(o,c){if(o&1&&(t(0,` 964 `),l(1,"div",75),t(2,` 965 `),l(3,"app-inline-alert",55),t(4,` 966 `),l(5,"span")(6,"strong"),t(7,"Cancellation Period:"),a(),t(8),a(),t(9,` 967 `),a(),t(10,` 968 `),a(),t(11,` 969 `)),o&2){let i=m();s(3),h("alertType","info")("isInline",!1),s(5),g(` 970 Cancellations must be made at least `,i.settings.cancellationPeriodHours,` hours before the 971 scheduled time.`)}}function Ra(o,c){if(o&1&&(t(0,` 972 `),y(1,"div",4),w(2,"safeHtml"),t(3,` 973 `)),o&2){let i=m();s(),h("innerHTML",I(2,1,i.settings==null?null:i.settings.cancellationPolicyText),G)}}function Ma(o,c){if(o&1){let i=b();t(0,` 974 `),l(1,"app-dialog-footer"),t(2,` 975 `),Y(3,72),t(4,` 976 `),rt(5,73),t(6,` 977 `),l(7,"button",74),S("click",function(){C(i);let n=m();return f(n.onCancellationPolicyModalClosed())}),t(8,"Close"),a(),t(9,` 978 `),st(),t(10,` 979 `),a(),t(11,` 980`)}}
980function Aa(o,c){o&1&&(t(0,` 981 `),l(1,"div",76),t(2,` 982 `),l(3,"app-loader"),t(4,"Processing your rental..."),a(),t(5,` 983 `),a(),t(6,` 984`))}function Va(o,c){o&1&&(t(0,` 985 `),y(1,"app-loader"),t(2,` 986`))}var No=(()=>{let c=class c{get cartItems$(){return this.cartService.getCartItems()}get requiresImmediatePayment(){return this.settings?.facilityRentalPaymentTimingID===this.PaymentTiming.AtBooking}constructor(e,n,r,d,x,_,v,$){this.clubCalendarService=e,this.publicFacilityRentalService=n,this.cartService=r,this.siteDataService=d,this.fb=x,this.authorizeService=_,this.clubService=v,this.consentGatedStorageService=$,this.isGuestCheckout=!1,this.settings=null,this.sportLocation="Field",this.selectedDate=null,this.availableFacilities=[],this.selectedFacility=null,this.selectedFacilityObject=null,this.availableTimeSlots=[],this.availableTimeSlots$=new Z([]),this.cartItems=[],this.cartTotal=0,this.showCheckout=!1,this.FACILITY_STORAGE_KEY="facilityRentalSelectedFacility",this.pageTitle="Rent a Field",this.maxBookingDate=void 0,this.loading=!0,this.loadingFacilities=!1,this.loadingTimeSlots=!1,this.purchasing=!1,this.showTermsModal=!1,this.showCancellationPolicyModal=!1,this.submittingPayment=!1,this.PaymentTiming=lt,this.imageType=Mt,this.showConfirmation=!1,this.purchaseConfirmation=null,this.purchasedItems=[],this.unsubscribe$=new ht}ngOnInit(){this.selectedDate=W(new Date),this.initializeUserAndClub(),this.initializeCartSubscription()}initializeCartSubscription(){this.cartService.getCartItems().pipe(N(this.unsubscribe$)).subscribe(e=>{this.cartItems=e,this.cartTotal=this.cartService.getCurrentCartTotal(),this.availableFacilities&&this.availableFacilities.length>0&&this.updateFacilityCompatibility()})}initializeUserAndClub(){return ut(this,null,function*(){this.user=yield qt(this.authorizeService.getUser()),this.user?(this.clubID=+this.user.clubID,this.isGuestCheckout=!1,this.loadInitialData()):(this.isGuestCheckout=!0,Gt({club:this.clubService.getAnonymousClub(),captcha:this.user?_t(void 0):this.siteDataService.getRecaptchaConfig()}).pipe(N(this.unsubscribe$)).subscribe({next:({club:e,captcha:n})=>{this.clubID=e.clubID,this.captchaSettings=n,this.loadInitialData()},error:()=>{this.siteDataService.showSiteErrorAlert("Unable to load club information."),this.loading=!1}}))})}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete()}loadInitialData(){this.loading=!0,this.publicFacilityRentalService.getSettings().pipe(N(this.unsubscribe$)).subscribe({next:e=>{this.settings=e,this.updateComputedProperties(),this.loadSportLocationName(),this.loadAvailableFacilities()},error:()=>{this.siteDataService.showSiteErrorAlert("Unable to load facility rental settings."),this.loading=!1}})}loadSportLocationName(){this.clubCalendarService.getCalendarEventSettings().pipe(N(this.unsubscribe$)).subscribe({next:e=>{this.sportLocation=e?.fieldName||"Field",this.updateComputedProperties()},error:()=>{this.sportLocation="Field",this.updateComputedProperties()}})}updateComputedProperties(){if(this.pageTitle=`Rent a ${this.sportLocation}`,this.settings?.daysInAdvanceToRelease){let e=new Date;e.setDate(e.getDate()+this.settings.daysInAdvanceToRelease),this.maxBookingDate=e}else this.maxBookingDate=void 0}loadAvailableFacilities(){this.publicFacilityRentalService.getAvailableFacilities().pipe(N(this.unsubscribe$)).subscribe({next:e=>{if(console.log("Loaded facilities:",e),this.availableFacilities=e,this.updateFacilityCompatibility(),e&&e.length>0){let n=this.loadFacilityFromStorage(),r=null;if(n){let d=e.find(x=>x.facilityId===n);d&&this.isFacilityCompatibleWithCart(d)?(r=d,console.log("Restored facility ID from localStorage:",n)):d&&!this.isFacilityCompatibleWithCart(d)&&console.log("Stored facility is incompatible with cart, selecting first compatible facility")}r||(r=e.find(d=>this.isFacilityCompatibleWithCart(d)),r?console.log("Auto-selected first compatible facility ID:",r.facilityId):(r=e[0],console.log("No compatible facilities found, selected first facility but will prevent time slot selection"))),r&&(this.selectedFacility=r.facilityId,this.saveFacilityToStorage(this.selectedFacility),this.syncSelectedFacilityObject(),this.selectedDate&&this.selectedFacilityObject&&this.isFacilityCompatibleWithCart(this.selectedFacilityObject)&&this.loadTimeSlotsForFacility(this.selectedFacilityObject.facilityId,this.selectedDate))}this.loading=!1},error:e=>{console.error("Error loading facilities:",e),this.siteDataService.showSiteErrorAlert("Unable to load available facilities."),this.loading=!1}})}
986updateFacilityCompatibility(){this.availableFacilities.forEach(e=>{e.disabled=!this.isFacilityCompatibleWithCart(e)})}onDateSelected(e){console.log("Date selected:",e),this.selectedDate=e&&W(e),this.selectedFacilityObject?this.loadTimeSlotsForFacility(this.selectedFacilityObject.facilityId,this.selectedDate):(this.availableTimeSlots=[],this.availableTimeSlots$.next([]))}onFacilitySelected(e){console.log("Facility selected:",e);let n=this.availableFacilities.find(r=>r.facilityId===e);if(!n){console.error("Selected facility not found:",e);return}if(!this.isFacilityCompatibleWithCart(n)){let r=this.getFacilityIncompatibilityMessage(n);this.siteDataService.showSiteErrorAlert(r||"Cannot select this facility due to incompatible surcharge configuration.");return}this.selectedFacility=e,this.syncSelectedFacilityObject(),this.saveFacilityToStorage(e),this.selectedDate&&this.selectedFacilityObject?(console.log("Date already selected, loading time slots for new facility"),this.loadTimeSlotsForFacility(this.selectedFacilityObject.facilityId,this.selectedDate)):(this.availableTimeSlots=[],this.availableTimeSlots$.next([])),this.selectedFacilityObject&&console.log("Selected facility:",this.selectedFacilityObject.facilityName,"saved to localStorage")}loadTimeSlotsForFacility(e,n){if(console.log("loadTimeSlotsForFacility called with:",e,n),!e||!n){console.log("Exiting early - missing facilityId or date"),this.availableTimeSlots=[],this.availableTimeSlots$.next([]);return}this.loadingTimeSlots=!0,this.publicFacilityRentalService.getFacilityTimeSlotsForDate(e,n).pipe(N(this.unsubscribe$)).subscribe({next:r=>{console.log("Time slots for facility:",r),this.availableTimeSlots=r||[],this.availableTimeSlots$.next(this.availableTimeSlots),this.loadingTimeSlots=!1},error:r=>{console.error("Error loading time slots:",r),this.siteDataService.showSiteErrorAlert("Unable to load available time slots for the selected facility."),this.availableTimeSlots=[],this.availableTimeSlots$.next([]),this.loadingTimeSlots=!1}})}onTimeSlotSelected(e,n,r){let d=this.cartService.getCurrentCartItems();if(console.log("Current cart items count:",d.length),d.length>=50){this.siteDataService.showSiteWarnAlert("You have reached the maximum limit of 50 time slots per transaction. Please complete your current purchase or remove items from your cart to add more.");return}let x=e.facilityName||n||"Facility",_=e.fieldName||r||"Field",v=this.selectedFacilityObject||this.availableFacilities.find(ot=>ot.facilityId===this.selectedFacility);if(!v){console.error("Cannot add time slot: facility not found"),this.siteDataService.showSiteErrorAlert("Unable to add time slot. Please try again.");return}if(!this.isFacilityCompatibleWithCart(v)){let ot=this.getFacilityIncompatibilityMessage(v);this.siteDataService.showSiteErrorAlert(ot||"Cannot add time slot from this facility due to incompatible surcharge configuration.");return}let $=v.clubSurchargeID||null,J=v.facilityId,M=this.cartService.addItem(e,x,_,$,J);!M.success&&M.errorMessage&&this.siteDataService.showSiteErrorAlert(M.errorMessage)}onRemoveFromCart(e){this.cartService.removeItem(e)}onProceedToPayment(){if(!this.cartService.hasItems()){this.siteDataService.showSiteWarnAlert("Please select at least one time slot before proceeding to payment.");return}this.showCheckout=!0}onBackFromCheckout(){this.showCheckout=!1}onCheckoutComplete(e){this.purchaseConfirmation=e.facilityRentalPurchaseResult,this.purchasedItems=e.purchasedItems,this.showConfirmation=!0,this.showCheckout=!1}onViewTerms(){this.showTermsModal=!0}onViewCancellationPolicy(){this.showCancellationPolicyModal=!0}onTermsModalClosed(){this.showTermsModal=!1,this.rentalCartComponent&&this.settings?.isTermsConfirmationRequired&&this.rentalCartComponent.onTermsConfirmed()}onCancellationPolicyModalClosed(){this.showCancellationPolicyModal=!1}trackByFacilityId(e,n){return n.facilityId||e}getFacilityById(e){return this.availableFacilities.find(n=>n.facilityId===e)}syncSelectedFacilityObject(){if(this.selectedFacility&&this.availableFacilities.length>0){let e=this.availableFacilities.find(n=>n.facilityId===this.selectedFacility);e&&(this.selectedFacilityObject=e,console.log("Synced selectedFacilityObject:",this.selectedFacilityObject.facilityName))}}saveFacilityToStorage(e){try{this.consentGatedStorageService.setLocalItem(this.FACILITY_STORAGE_KEY,e.toString())}catch(n){console.warn("Failed to save facility to localStorage:",n)}}loadFacilityFromStorage(){try{let e=localStorage.getItem(this.FACILITY_STORAGE_KEY);return e?parseInt(e,10):null}catch(e){return console.warn("Failed to load facility from localStorage:",e),null}}getFacilityPriceRange(e){if(!e?.fields||!this.settings)return"";let n=[];if(e.fields.forEach(_=>{let v=_.defaultRentalPrice??this.settings.defaultPricePerTimeSlot;v>0&&n.push(v)}),n.length===0)return"";let r=Math.min(...n),d=Math.max(...n),x=this.settings.timeSlotDurationMinutes;return r===d?`$${r}/${x}min`:`$${r}-$${d}/${x}min`}startNewRental(){this.showConfirmation=!1,this.purchaseConfirmation=null,this.purchasedItems=[],this.selectedDate=null,this.selectedFacility=null,this.selectedFacilityObject=null,this.availableTimeSlots=[],this.availableTimeSlots$.next([]),this.loadAvailableFacilities()}getPurchasedItemsTotal(){return this.purchasedItems.reduce((e,n)=>e+n.price,0)}getDurationFromTimeSlot(e){let n=new Date(`1970-01-01T${e.startTime}`),x=(new Date(`1970-01-01T${e.endTime}`).getTime()-n.getTime())/(1e3*60);if(x>=60){let _=Math.floor(x/60),v=x%60;return v>0?`${_}h ${v}m`:`${_}h`}else return`${x}m`}isFacilityCompatibleWithCart(e){if(!this.cartService.hasItems())return!0;let n=e.clubSurchargeID??null;return this.cartService.isCompatibleWithCart(n)}getFacilityIncompatibilityMessage(e){if(this.isFacilityCompatibleWithCart(e))return null;let n=this.cartService.getCurrentCartItems();return n.length===0?null:`Cannot select this facility. Your cart contains items from ${n[0].facilityName} with a different tax/surcharge configuration.`}
986hasFeesOrSurcharges(){let e=this.purchaseConfirmation?.facilityRentalSurchargeDetail?.amount>0,n=this.purchaseConfirmation?.userFee>0;return e||n}getFinalTotal(){let e=this.getPurchasedItemsTotal();return this.purchaseConfirmation?.facilityRentalSurchargeDetail?.amount>0&&(e+=this.purchaseConfirmation.facilityRentalSurchargeDetail.amount),this.purchaseConfirmation?.userFee>0&&(e+=this.purchaseConfirmation.userFee),e}};c.\u0275fac=function(n){return new(n||c)(F(Be),F(z),F(B),F(Et),F(wt),F(ue),F(Se),F(kt))},c.\u0275cmp=O({type:c,selectors:[["app-facility-rental-purchase"]],viewQuery:function(n,r){if(n&1&&St(Gn,5),n&2){let d;vt(d=Tt())&&(r.rentalCartComponent=d.first)}},standalone:!1,decls:32,vars:21,consts:[["spinnerTemplate",""],[1,"facility-rental-purchase"],["header","Rental Terms & Conditions",3,"visibleChange","onHide","visible","modal","closable"],[1,"terms-content"],[3,"innerHTML"],["pTemplate","footer"],["header","Cancellation Policy",3,"visibleChange","onHide","visible","modal","closable"],[1,"cancellation-policy-content"],[1,"d-flex","align-items-center","justify-content-between","border-bottom","border-lg","mb-3","pb-2"],[1,"d-flex"],[1,"btn","btn-large","mr-2","facility-rental-purchase-my-rentals-btn","align-items-center",3,"routerLink"],[1,"text-larger","fw-600"],[3,"checkoutClicked","viewTerms","viewCancellationPolicy","settings","requiresImmediatePayment","showTermsAndConditions"],[1,"text-center","py-5"],[4,"ngTemplateOutlet"],[1,""],[3,"backToSelection","purchaseComplete","viewTerms","viewCancellationPolicy","settings","isGuestCheckout","captchaSettings","sportLocation"],[1,"confirmation-container"],[1,"row"],[1,"col-lg-10","col-xl-8"],[1,"card","p-0"],[1,"card-header","border-bottom","py-2","px-3","mb-0"],[1,"card-body","py-2","px-3"],[3,"value"],["pTemplate","header"],["pTemplate","body"],[1,"mb-4"],["type","button",1,"btn","btn-primary","btn-lg","mr-3",3,"click"],[1,"text-medium"],["colspan","4",1,"text-right","border-none"],[1,"full-width","right","d-block"],[1,"d-flex","justify-content-between","mb-2","text-medium","fw-400"],[1,"text-end"],[1,"my-1"],[1,"d-flex","justify-content-between","fw-600"],[1,"text-primary"],["alertType","warning",1,"mb-3",3,"isInline"],[1,"mb-2"],[1,"mb-0"],[1,"terms-summary",3,"innerHTML"],[1,"row","mb-4"],[1,"col-auto","pr-4","border-right"],[1,"text-large"],[3,"dateSelected","maxDate","selectedDate"],[1,"col","pl-4"],[1,"text-large","mb-2"],[1,"facility-selection","mb-2"],[1,"d-block","d-md-flex","bg-secondary","px-3","py-2","align-items-center","border-radius-sm"],[1,"d-none","d-md-block"],[1,"fal","fa-map-marker-alt","text-larger","mr-3"],[1,"flex-grow-1"],["optionLabel","facilityName","optionValue","facilityId","placeholder","Choose a facility...",3,"ngModelChange","onChange","options","ngModel","showClear","styleClass","optionDisabled"],["pTemplate","selectedItem"],["pTemplate","item"],[1,"required-payment-alert"],[3,"alertType","isInline"],[1,"mr-2"],[1,"selected-facility-display","d-flex","align-items-center","py-1"],[1,"flex-grow-1","text-overflow-ellipsis"],[1,"text-small"],["tooltipPosition","top",1,"facility-dropdown-item",3,"pTooltip"],[1,"d-flex","justify-content-between","align-items-start"],[1,"text-small","d-block"],[1,"fa-regular","fa-lock","ml-2","text-warning"],[1,"mt-3"],["alertType","warning"],[1,"fa-regular","fa-lock","mr-2"],[3,"timeSlotAdded","selectedDate","availableTimeSlots$","settings","loading","allowMultipleSlots","maxSlots","facilityId","sportLocation"],[1,"p-3"],[1,"text-center","py-3"],[3,"text","image","showButton","showCard"],[1,"col-12"],["slot","secondary"],["slot","primary"],["type","button",1,"btn","btn-primary",3,"click"],[1,"cancellation-hours","mb-3"],[1,"processing-overlay"]],template:function(n,r){if(n&1){let d=b();l(0,"div",1),t(1,` 987 `),p(2,Kn,13,3),p(3,Jn,6,1),p(4,Ia,8,3),l(5,"p-dialog",2),R("visibleChange",function(_){return C(d),P(r.showTermsModal,_)||(r.showTermsModal=_),f(_)}),S("onHide",function(){return r.onTermsModalClosed()}),t(6,` 988 `),l(7,"div",3),t(8,` 989 `),y(9,"div",4),w(10,"safeHtml"),t(11,` 990 `),a(),t(12,` 991 `),D(13,ka,12,0,"ng-template",5),t(14,` 992`),a(),t(15,` 993 994`),t(16,` 995`),l(17,"p-dialog",6),R("visibleChange",function(_){return C(d),P(r.showCancellationPolicyModal,_)||(r.showCancellationPolicyModal=_),f(_)}),S("onHide",function(){return r.onCancellationPolicyModalClosed()}),t(18,` 996 `),l(19,"div",7),t(20,` 997 `),p(21,Pa,12,3),p(22,Ra,4,3),a(),t(23,` 998`),D(24,Ma,12,0,"ng-template",5),t(25,` 999`),a(),t(26,` 1000 1001`),t(27,` 1002`),p(28,Aa,7,0),a(),t(29,` 1003 1004`),D(30,Va,3,0,"ng-template",null,0,mt)}n&2&&(s(2),u(r.showCheckout?-1:2),s(),u(r.loading?3:-1),s(),u(r.loading?-1:4),s(),$t(Nt(19,li)),k("visible",r.showTermsModal),h("modal",!0)("closable",!0),s(4),h("innerHTML",I(10,17,r.settings==null?null:r.settings.termsAndConditions),G),s(8),$t(Nt(20,li)),k("visible",r.showCancellationPolicyModal),h("modal",!0)("closable",!0),s(4),u(r.settings!=null&&r.settings.cancellationPeriodHours?21:-1),s(),u(r.settings!=null&&r.settings.cancellationPolicyText?22:-1),s(6),u(r.purchasing?28:-1))},dependencies:[Ft,j,H,de,it,Pt,Te,nt,at,At,Ve,Rt,ge,Xe,ei,ni,ai,tt,ye],styles:[".facility-rental-purchase-my-rentals-btn[_ngcontent-%COMP%]{display:flex} body.admin-wrapper .facility-rental-purchase-my-rentals-btn{display:none}"]});let o=c;return o}
1004)();var Cr=(()=>{let c=class c{};c.\u0275fac=function(n){return new(n||c)},c.\u0275mod=Qt({type:c}),c.\u0275inj=zt({providers:[et,B,z],imports:[ne,ce,me,pe,ze,Qe,Me,De,Fe,ve,be,Pe,We,fe,He,je,Ee,Ue]});let o=c;return o})();export{z as a,lt as b,No as c,Cr as d};
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.