1import{m as k,a as h,c as u,v as V,e as c,z as g,f as z,n as f,F as v,r as D,q as E,P as y,_ as $}from"./vendor-BlynvCoC.js";import{bu as w,a as O,m as S,aV as T,u as x}from"./main-Bs_lHNW0.js";import{_ as K}from"./playmetrics-logo-black-zX9a8M4H.js";import{_ as H}from"./config-DrDySPH_.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"c27e83a969462e61a866326f8ee6cc37a4feab4d"};var s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="8bf21d9d-e984-4884-b2d8-2b236af1c38e",t._sentryDebugIdIdentifier="sentry-dbid-8bf21d9d-e984-4884-b2d8-2b236af1c38e")}catch(i){}})();const A={setup(){const{formatDate:t,isZeroTime:s}=x();return{formatDate:t,isZeroTime:s}},data(){return{facility:null}},computed:{loading(){return this.facility==null},fields(){return T.sortFields(this.facility.fields,{},!0)},date(){return this.$route.params.date},clubTimezone(){return this.$store.getters.clubDetails.timezone},timezone(){return this.facility&&this.facility.timezone||this.clubTimezone},timezoneAbbr(){return S.showEventTimezoneAlert(this.date,this.timezone,this.$store.getters.clubDetails.timezone)?S.timezoneAbbrForDate(this.date,this.facility.timezone,this.$store.getters.clubDetails.timezone):""},timeRange(){return this.$route.params.hours.split("-").map(t=>parseInt(t,10))},hoursVisible(){const t=[],s=y.tz(this.date,this.clubTimezone).startOf("day");s.add(this.timeRange[0],"hours");for(let i=0;i<=this.timeRange[1]-this.timeRange[0]-1;i+=1)t.push(y(s)),s.add(1,"hours");return t},endHour(){const t=this.hoursVisible[this.hoursVisible.length-1];return y(t).add(1,"hours")},hoursVisibleWithEnd(){const t=[...this.hoursVisible,this.endHour].map(s=>s.hours());return t[t.length-1]===0&&(t[t.length-1]=24),t},eventsToShowByField(){return $(this.fields).keyBy("id").mapValues(this.eventTimeRanges).value()},gridContainerStyle(){let t="30px";return this.fields.forEach(s=>{let i=0;const e=this.eventsToShowByField[s.id];e&&e.length>0&&(i=Math.max(...e.map(n=>n.level))),t+=" calc(34px + (".concat(i," * 24px))")}),{"grid-template-columns":"90px 8px repeat(".concat(this.hoursVisible.length,", 1fr) 8px"),"grid-template-rows":t}}},watch:{loading(t){t||setTimeout(()=>{window.print()},3e3)}},created(){this.fetchFacility()},methods:{fetchFacility(){const t=this.$route.params.facility.split("_");t&&t[0]==="field"?O({showError:!1}).get("/field_planning/facilities?populate=daily_schedule,daily_schedule:from:".concat(this.date)).then(s=>{const e=(s.data.find(n=>n.id===-3).fields||[]).find(n=>n.id===parseInt(t[1],10));e&&(e.fields=[$.cloneDeep(e)],e.id="field_".concat(e.id),e.name=e.facility_name,e.facility=e.facility_name,e.address=e.facility_address,e.fields[0].games_by_time=this.groupEvents(e.games,"game"),e.fields[0].practices_by_time=this.groupEvents(e.practices,"practice"),e.fields[0].reservations_by_time=this.groupEvents(e.reservations,"reservation"),e.fields[0].closures_by_time=this.groupEvents(e.closures,"closed"),e.fields[0].clinic_session_events_by_time=this.groupEvents(e.clinic_session_events,"clinicSessionEvent")),this.facility=e}):O({showError:!1}).get("/field_planning/facilities/".concat(this.$route.params.facility,"?populate=daily_schedule,daily_schedule:from:").concat(this.date)).then(s=>{const i=s.data;i.fields?(i.fields=i.fields.filter(e=>!e.team_id),i.fields.forEach(e=>{e.games_by_time=this.groupEvents(e.games,"game"),e.practices_by_time=this.groupEvents(e.practices,"practice"),e.reservations_by_time=this.groupEvents(e.reservations,"reservation"),e.clinic_session_events_by_time=this.groupEvents(e.clinic_session_events,"clinicSessionEvent"),e.closures_by_time=this.groupEvents(e.closures,"closed")})):i.fields=[],this.facility=i}).catch(s=>{this.$refs.spinner.setError(s)})},groupEvents(t,s){const i={};return $.forEach(t,e=>{if(s==="closed"||!this.isZeroTime(e.start_datetime||e.start_time,this.timezone)){e.type=s;const n=this.timeKey(e);i[n]?i[n].push(e):i[n]=[e]}}),i},timeKey(t,s){const i=y.tz(t.start_time||t.start_datetime,s).format("HHmm"),e=y.tz(t.end_time||t.end_datetime,s).format("HHmm");return"".concat(i,"_").concat(e)},eventKeysSorted(t){const s=Object.keys(t.games_by_time).map(l=>"".concat(l,"_game")),i=Object.keys(t.practices_by_time).map(l=>"".concat(l,"_practice")),e=Object.keys(t.reservations_by_time).map(l=>"".concat(l,"_reservation")),n=Object.keys(t.clinic_session_events_by_time).map(l=>"".concat(l,"_clinicSessionEvent")),a=Object.keys(t.closures_by_time).map(l=>"".concat(l,"_closed"));return $.sortBy([...s,...i,...e,...a,...n],l=>{const o=l.split("_");return[o[0],o[1]]})},getStart(t){return y.tz(t[0].start_datetime||t[0].start_time,this.timezone)},getEnd(t){return y.tz(t[0].end_datetime||t[0].end_time,this.timezone)},eventTimeRanges(t){const s=this.eventKeysSorted(t),i=[];let e=0;for(let n=0;n<s.length;n+=1){const a=s[n].split("_"),l=a.slice(0,2).join("_"),o=a[2];let r=[];o==="game"&&(r=t.games_by_time[l]),o==="practice"&&(r=t.practices_by_time[l]),o==="reservation"&&(r=t.reservations_by_time[l]),o==="closed"&&(r=t.closures_by_time[l]),o==="clinicSessionEvent"&&(r=t.clinic_session_events_by_time[l]);let d=0;if(n>0){const _=this.getStart(r);let m=n-1,b=i[m];for(;m>=e;){const p=_.isBefore(this.getEnd(b.events));
1p?d===0&&(d=1+b.level):d>0&&(d=b.level),m===e&&!p&&(e=n),m-=1,b=i[m]}}i.push({events:r,type:o,timeKey:l,level:d,startEndData:this.getStartEndData(r)})}return i},getStartEndData(t){const s=this.getStart(t),i=this.getEnd(t),e=this.hoursVisibleWithEnd.findIndex(p=>p===s.hours()),n=e===-1,a=n&&s.hours()>this.hoursVisibleWithEnd[this.hoursVisibleWithEnd.length-1],l=this.hoursVisibleWithEnd.findIndex(p=>p===i.hours()||p===24&&i.hours()===0);let o=l===-1;const r=o&&i.hours()<this.hoursVisibleWithEnd[this.hoursVisibleWithEnd.length-1];if(a||r)return null;const d=(o?this.hoursVisible.length:l)-(n?0:e),_=w(s,d),m=w(i,d);o=o||m>0&&l===this.hoursVisible.length;const b=100-(n?0:_)+(o?0:m)-(d===0?100:0);return{startPercentShift:_,endPercentShift:m,startOutOfRange:n,endOutOfRange:o,startHourIndex:e,endHourIndex:l,numBlocks:d,totalWidthPercent:b}},styleForEventBar(t,s){return t.startEndData?{"grid-column":"".concat(t.startEndData.startOutOfRange?3:t.startEndData.startHourIndex+3," / ").concat(t.startEndData.endOutOfRange?-2:t.startEndData.endHourIndex+3),"grid-row":"".concat(s+2," / ").concat(s+3),height:"24px",width:"calc(".concat(t.startEndData.totalWidthPercent,"% - 3px)"),transform:"translateX(2px)","margin-bottom":"calc(6px + (".concat(t.level," * 24px))"),"margin-left":t.startEndData.startOutOfRange?0:"".concat(t.startEndData.startPercentShift,"%"),border:"1px solid white","border-top-left-radius":t.startEndData.startOutOfRange?0:"5px","border-bottom-left-radius":t.startEndData.startOutOfRange?0:"5px","border-top-right-radius":t.startEndData.endOutOfRange?0:"5px","border-bottom-right-radius":t.startEndData.endOutOfRange?0:"5px","z-index":t.level+1}:"display: none"}}},F={key:1,class:"body"},B={class:"level"},W={class:"level-left"},j={class:"level-item content"},P={class:"page-title"},R={class:"box"},M={class:"columns is-vcentered is-mobile",style:{"margin-bottom":"0.5rem"}},Y={class:"column is-font-mont has-text-weight-bold is-text-size-5"},L={key:0,class:"column is-narrow timezone-column"},N={class:"schedule-container"},Z={style:{"white-space":"nowrap"}},C=["title"],q={key:0},G={key:1};function U(t,s,i,e,n,a){const l=k("spinner");return h(),u("div",null,[a.loading?(h(),V(l,{key:0,ref:"spinner"},null,512)):(h(),u("div",F,[c("nav",B,[c("div",W,[c("div",j,[c("h3",P,g(t.$store.getters.getClubSportTerm("Field"))+" Schedule - "+g(e.formatDate(a.date,"dddd, MMMM D, YYYY")),1)])]),s[0]||(s[0]=c("div",{class:"level-right"},[c("div",{class:"level-item"},[c("img",{width:"150",src:K,alt:"playmetrics logo"})])],-1))]),c("div",R,[c("div",M,[c("div",Y,g(n.facility.name),1),a.timezoneAbbr?(h(),u("div",L,[s[1]||(s[1]=c("span",null,"Time Zone:",-1)),c("span",null,g(a.timezoneAbbr),1)])):z("",!0)]),c("div",N,[c("div",{class:"grid-container",style:f(a.gridContainerStyle)},[(h(!0),u(v,null,D(a.hoursVisible,(o,r)=>(h(),u("div",{key:"hour-".concat(r),style:f({"grid-column":"".concat(r+3," / ").concat(r+4),"grid-row":"1 / 2"}),class:"hour-label"},[c("p",null,g(e.formatDate(o,"h A")),1)],4))),128)),(h(),u("div",{key:"hour-end",style:f({"grid-column":"".concat(a.hoursVisible.length+3," / ").concat(a.hoursVisible.length+4),"grid-row":"1 / 2"}),class:"hour-label"},[c("p",Z,g(e.formatDate(a.endHour,"h A")),1)],4)),(h(!0),u(v,null,D(a.fields,(o,r)=>(h(),u(v,{key:o.id},[c("div",{style:f({"grid-row":"".concat(r+2," / ").concat(r+3),"grid-column":"1 / 2"}),class:E(["field-label",{"is-indented":o.parent_field_id>0}]),title:o.display_name},[c("span",null,g(o.identifier),1)],14,C),c("div",{style:f({"grid-row":"".concat(r+2," / ").concat(r+3),"grid-column":"2 / 3"}),class:E([{"last-row":r===a.fields.length-1,"first-column":!0},"background-cell"])},null,6),(h(!0),u(v,null,D(a.hoursVisible,(d,_)=>(h(),u("div",{key:_,style:f({"grid-row":"".concat(r+2," / ").concat(r+3),"grid-column":"".concat(_+3," / ").concat(_+4)}),class:E([{"last-row":r===a.fields.length-1},"background-cell"])},null,6))),128)),c("div",{class:E([{"last-row":r===a.fields.length-1},"background-cell"]),style:f({"grid-row":"".concat(r+2," / ").concat(r+3),"grid-column":"".concat(a.hoursVisible.length+3," / ").concat(a.hoursVisible.length+4)})},null,6),(h(!0),u(v,null,D(a.eventsToShowByField[o.id],d=>
1(h(),u("div",{key:"".concat(d.type,"-").concat(d.timeKey),style:f(a.styleForEventBar(d,r)),class:E("event-bar ".concat(d.type))},[d.type==="closed"?(h(),u("span",q,"CLOSED")):d.events.length>1?(h(),u("span",G,g(d.events.length),1)):z("",!0)],6))),128))],64))),128))],4)])])]))])}const tt=H(A,[["render",U],["__scopeId","data-v-0cc1bf7a"]]);export{tt as default}; 2//# sourceMappingURL=PrintFieldSchedule-Dxy-bnT9.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.