/*! FullCalendar v5.3.2 Docs & License: https://fullcalendar.io/ (c) 2020 Adam Shaw */ import"./main.css";import{createRef,getStickyHeaderDates,createElement,ViewRoot,SimpleScrollGrid,getStickyFooterScrollbar,DateComponent,renderScrollShim,createFormatter,setRef,buildNavLinkData,DayCellRoot,WeekNumberRoot,RenderHook,DayCellContent,Fragment,BaseComponent,buildSegTimeText,EventRoot,StandardEvent,sortEventSegs,addDays,intersectRanges,RefMap,isPropsEqual,getSegMeta,buildEventRangeKey,BgEvent,renderFill,PositionCache,mapHash,DelayedRunner,applyStyle,memoize,NowTimer,EventApi,Slicer,DayHeader,DaySeriesModel,DayTableModel,addWeeks,diffWeeks,DateProfileGenerator,identity,createPlugin}from"@fullcalendar/common";import{__extends,__assign,__spreadArrays}from"tslib";var TableView=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.headerElRef=createRef(),t}return __extends(t,e),t.prototype.renderSimpleLayout=function(e,t){var n=this.props,r=this.context,o=[],a=getStickyHeaderDates(r.options);return e&&o.push({type:"header",key:"header",isSticky:a,chunk:{elRef:this.headerElRef,tableClassName:"fc-col-header",rowContent:e}}),o.push({type:"body",key:"body",liquid:!0,chunk:{content:t}}),createElement(ViewRoot,{viewSpec:r.viewSpec},(function(e,t){return createElement("div",{ref:e,className:["fc-daygrid"].concat(t).join(" ")},createElement(SimpleScrollGrid,{liquid:!n.isHeightAuto&&!n.forPrint,cols:[],sections:o}))}))},t.prototype.renderHScrollLayout=function(e,t,n,r){var o=this.context.pluginHooks.scrollGridImpl;if(!o)throw new Error("No ScrollGrid implementation");var a=this.props,i=this.context,s=!a.forPrint&&getStickyHeaderDates(i.options),l=!a.forPrint&&getStickyFooterScrollbar(i.options),d=[];return e&&d.push({type:"header",key:"header",isSticky:s,chunks:[{key:"main",elRef:this.headerElRef,tableClassName:"fc-col-header",rowContent:e}]}),d.push({type:"body",key:"body",liquid:!0,chunks:[{key:"main",content:t}]}),l&&d.push({type:"footer",key:"footer",isSticky:!0,chunks:[{key:"main",content:renderScrollShim}]}),createElement(ViewRoot,{viewSpec:i.viewSpec},(function(e,t){return createElement("div",{ref:e,className:["fc-daygrid"].concat(t).join(" ")},createElement(o,{liquid:!a.isHeightAuto&&!a.forPrint,colGroups:[{cols:[{span:n,minWidth:r}]}],sections:d}))}))},t}(DateComponent);function splitSegsByRow(e,t){for(var n=[],r=0;ri.top)return!1}return!0}(e,t,n)){for(var r=e.firstCol;r<=e.lastCol;r++){for(var o=l[r],a=0;a=o[a].top;)a++;o.splice(a,0,{seg:e,top:n,bottom:n+t})}return!0}return!1}for(var w in o)o[w]||(c[w.split(":")[0]]=!0);return{segsByFirstCol:l.map(extractFirstColSegs),segsByEachCol:l.map((function(t,n){var r=extractAllColSegs(t);return r=resliceDaySegs(r,e[n].date,n)})),segIsHidden:c,segTops:u,segMarginTops:p,moreCnts:d,moreTops:f,paddingBottoms:g}}function extractFirstColSegs(e,t){for(var n=[],r=0,o=e;rc;)g(s[l].pop(),s[l].length,!1)}}}}function resliceDaySegs(e,t,n){for(var r={start:t,end:addDays(t,1)},o=[],a=0,i=e;a1,showWeekNumbers:t.showWeekNumbers,todayRange:m,dateProfile:n,cells:a,renderIntro:t.renderRowIntro,businessHourSegs:l[i],eventSelection:t.eventSelection,bgEventSegs:d[i].filter(isSegAllDay),fgEventSegs:c[i],dateSelectionSegs:u[i],eventDrag:p[i],eventResize:f[i],dayMaxEvents:o,dayMaxEventRows:r,clientWidth:t.clientWidth,clientHeight:t.clientHeight,buildMoreLinkText:g,onMoreClick:e.handleMoreLinkClick})})))),!t.forPrint&&i&&i.currentFgEventSegs===t.fgEventSegs&&createElement(MorePopover,{date:i.date,dateProfile:n,segs:i.allSegs,alignmentEl:i.dayEl,topAlignmentEl:1===s?t.headerAlignElRef.current:null,onCloseClick:e.handleMorePopoverClose,selectedInstanceId:t.eventSelection,hiddenInstances:(t.eventDrag?t.eventDrag.affectedInstances:null)||(t.eventResize?t.eventResize.affectedInstances:null)||{},todayRange:m}))})))},t.prototype.prepareHits=function(){this.rowPositions=new PositionCache(this.rootEl,this.rowRefs.collect().map((function(e){return e.getCellEls()[0]})),!1,!0),this.colPositions=new PositionCache(this.rootEl,this.rowRefs.currentMap[0].getCellEls(),!0,!1)},t.prototype.positionToHit=function(e,t){var n=this.colPositions,r=this.rowPositions,o=n.leftToIndex(e),a=r.topToIndex(t);if(null!=a&&null!=o)return{row:a,col:o,dateSpan:{range:this.getCellRange(a,o),allDay:!0},dayEl:this.getCellEl(a,o),relativeRect:{left:n.lefts[o],right:n.rights[o],top:r.tops[a],bottom:r.bottoms[a]}}},t.prototype.getCellEl=function(e,t){return this.rowRefs.currentMap[e].getCellEls()[t]},t.prototype.getCellRange=function(e,t){var n=this.props.cells[e][t].date;return{start:n,end:addDays(n,1)}},t}(DateComponent);function buildBuildMoreLinkText(e){return"function"==typeof e?e:function(t){return"+"+t+" "+e}}function isSegAllDay(e){return e.eventRange.def.allDay}var DayTable=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.slicer=new DayTableSlicer,t.tableRef=createRef(),t.handleRootEl=function(e){e?t.context.registerInteractiveComponent(t,{el:e}):t.context.unregisterInteractiveComponent(t)},t}return __extends(t,e),t.prototype.render=function(){var e=this.props,t=this.context;return createElement(Table,__assign({ref:this.tableRef,elRef:this.handleRootEl},this.slicer.sliceProps(e,e.dateProfile,e.nextDayThreshold,t,e.dayTableModel),{dateProfile:e.dateProfile,cells:e.dayTableModel.cells,colGroupNode:e.colGroupNode,tableMinWidth:e.tableMinWidth,renderRowIntro:e.renderRowIntro,dayMaxEvents:e.dayMaxEvents,dayMaxEventRows:e.dayMaxEventRows,showWeekNumbers:e.showWeekNumbers,expandRows:e.expandRows,headerAlignElRef:e.headerAlignElRef,clientWidth:e.clientWidth,clientHeight:e.clientHeight,forPrint:e.forPrint}))},t.prototype.prepareHits=function(){this.tableRef.current.prepareHits()},t.prototype.queryHit=function(e,t){var n=this.tableRef.current.positionToHit(e,t);if(n)return{component:this,dateSpan:n.dateSpan,dayEl:n.dayEl,rect:{left:n.relativeRect.left,right:n.relativeRect.right,top:n.relativeRect.top,bottom:n.relativeRect.bottom},layer:0}},t}(DateComponent),DayTableSlicer=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.forceDayIfListItem=!0,t}return __extends(t,e),t.prototype.sliceRange=function(e,t){return t.sliceRange(e)},t}(Slicer),DayTableView=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.buildDayTableModel=memoize(buildDayTableModel),t.headerRef=createRef(),t.tableRef=createRef(),t}return __extends(t,e),t.prototype.render=function(){var e=this,t=this.context,n=t.options,r=t.dateProfileGenerator,o=this.props,a=this.buildDayTableModel(o.dateProfile,r),i=n.dayHeaders&&createElement(DayHeader,{ref:this.headerRef,dateProfile:o.dateProfile,dates:a.headerDates,datesRepDistinctDays:1===a.rowCnt}),s=function(t){return createElement(DayTable,{ref:e.tableRef,dateProfile:o.dateProfile,dayTableModel:a,businessHours:o.businessHours,dateSelection:o.dateSelection,eventStore:o.eventStore,eventUiBases:o.eventUiBases,eventSelection:o.eventSelection,eventDrag:o.eventDrag,eventResize:o.eventResize,nextDayThreshold:n.nextDayThreshold,colGroupNode:t.tableColGroupNode,tableMinWidth:t.tableMinWidth,dayMaxEvents:n.dayMaxEvents,dayMaxEventRows:n.dayMaxEventRows,showWeekNumbers:n.weekNumbers,expandRows:!o.isHeightAuto,headerAlignElRef:e.headerElRef,clientWidth:t.clientWidth,clientHeight:t.clientHeight,forPrint:o.forPrint})};return n.dayMinWidth?this.renderHScrollLayout(i,s,a.colCnt,n.dayMinWidth):this.renderSimpleLayout(i,s)},t}(TableView);function buildDayTableModel(e,t){var n=new DaySeriesModel(e.renderRange,t);return new DayTableModel(n,/year|month|week/.test(e.currentRangeUnit))}var TableDateProfileGenerator=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.buildRenderRange=function(t,n,r){var o,a=this.props.dateEnv,i=e.prototype.buildRenderRange.call(this,t,n,r),s=i.start,l=i.end;if(/^(year|month)$/.test(n)&&(s=a.startOfWeek(s),(o=a.startOfWeek(l)).valueOf()!==l.valueOf()&&(l=addWeeks(o,1))),this.props.monthMode&&this.props.fixedWeekCount){var d=Math.ceil(diffWeeks(s,l));l=addWeeks(l,6-d)}return{start:s,end:l}},t}(DateProfileGenerator),OPTION_REFINERS={moreLinkClick:identity,moreLinkClassNames:identity,moreLinkContent:identity,moreLinkDidMount:identity,moreLinkWillUnmount:identity},main=createPlugin({initialView:"dayGridMonth",optionRefiners:OPTION_REFINERS,views:{dayGrid:{component:DayTableView,dateProfileGeneratorClass:TableDateProfileGenerator},dayGridDay:{type:"dayGrid",duration:{days:1}},dayGridWeek:{type:"dayGrid",duration:{weeks:1}},dayGridMonth:{type:"dayGrid",duration:{months:1},monthMode:!0,fixedWeekCount:!0}}});export default main;export{DayTableView as DayGridView,DayTable,DayTableSlicer,Table,TableView,buildDayTableModel};