W72crm_web-master/node_modules/@fullcalendar/timeline/main.min.js

6 lines
34 KiB
JavaScript

/*!
FullCalendar Timeline Plugin v4.4.3
Docs & License: https://fullcalendar.io/scheduler
(c) 2019 Adam Shaw
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@fullcalendar/core")):"function"==typeof define&&define.amd?define(["exports","@fullcalendar/core"],t):t((e=e||self).FullCalendarTimeline={},e.FullCalendar)}(this,(function(e,t){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function n(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i,o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},l=function(){function e(){this.gutters={},this.el=t.htmlToElement('<div class="fc-scroller-canvas"> <div class="fc-content"></div> <div class="fc-bg"></div> </div>'),this.contentEl=this.el.querySelector(".fc-content"),this.bgEl=this.el.querySelector(".fc-bg")}return e.prototype.setGutters=function(e){e?o(this.gutters,e):this.gutters={},this.updateSize()},e.prototype.setWidth=function(e){this.width=e,this.updateSize()},e.prototype.setMinWidth=function(e){this.minWidth=e,this.updateSize()},e.prototype.clearWidth=function(){this.width=null,this.minWidth=null,this.updateSize()},e.prototype.updateSize=function(){var e=this.gutters,r=this.el;t.forceClassName(r,"fc-gutter-left",e.left),t.forceClassName(r,"fc-gutter-right",e.right),t.forceClassName(r,"fc-gutter-top",e.top),t.forceClassName(r,"fc-gutter-bottom",e.bottom),t.applyStyle(r,{paddingLeft:e.left||"",paddingRight:e.right||"",paddingTop:e.top||"",paddingBottom:e.bottom||"",width:null!=this.width?this.width+(e.left||0)+(e.right||0):"",minWidth:null!=this.minWidth?this.minWidth+(e.left||0)+(e.right||0):""}),t.applyStyle(this.bgEl,{left:e.left||"",right:e.right||"",top:e.top||"",bottom:e.bottom||""})},e}(),s=function(e){function r(r,n){var i=e.call(this,r,n)||this;return i.reportScroll=function(){i.isScrolling||i.reportScrollStart(),i.trigger("scroll"),i.isMoving=!0,i.requestMovingEnd()},i.reportScrollStart=function(){i.isScrolling||(i.isScrolling=!0,i.trigger("scrollStart",i.isTouching))},i.reportTouchStart=function(){i.isTouching=!0},i.reportTouchEnd=function(){i.isTouching&&(i.isTouching=!1,i.isTouchScrollEnabled&&i.unbindPreventTouchScroll(),i.isMoving||i.reportScrollEnd())},i.isScrolling=!1,i.isTouching=!1,i.isMoving=!1,i.isTouchScrollEnabled=!0,i.requestMovingEnd=t.debounce(i.reportMovingEnd,500),i.canvas=new l,i.el.appendChild(i.canvas.el),i.applyOverflow(),i.bindHandlers(),i}return n(r,e),r.prototype.destroy=function(){e.prototype.destroy.call(this),this.unbindHandlers()},r.prototype.disableTouchScroll=function(){this.isTouchScrollEnabled=!1,this.bindPreventTouchScroll()},r.prototype.enableTouchScroll=function(){this.isTouchScrollEnabled=!0,this.isTouching||this.unbindPreventTouchScroll()},r.prototype.bindPreventTouchScroll=function(){this.preventTouchScrollHandler||this.el.addEventListener("touchmove",this.preventTouchScrollHandler=t.preventDefault)},r.prototype.unbindPreventTouchScroll=function(){this.preventTouchScrollHandler&&(this.el.removeEventListener("touchmove",this.preventTouchScrollHandler),this.preventTouchScrollHandler=null)},r.prototype.bindHandlers=function(){this.el.addEventListener("scroll",this.reportScroll),this.el.addEventListener("touchstart",this.reportTouchStart,{passive:!0}),this.el.addEventListener("touchend",this.reportTouchEnd)},r.prototype.unbindHandlers=function(){this.el.removeEventListener("scroll",this.reportScroll),this.el.removeEventListener("touchstart",this.reportTouchStart,{passive:!0}),this.el.removeEventListener("touchend",this.reportTouchEnd)},r.prototype.reportMovingEnd=function(){this.isMoving=!1,this.isTouching||this.reportScrollEnd()},r.prototype.reportScrollEnd=function(){this.isScrolling&&(this.trigger("scrollEnd"),this.isScrolling=!1)},r.prototype.getScrollLeft=function(){var e=this.el,t=window.getComputedStyle(e).direction,r=e.scrollLeft;if("rtl"===t)switch(a()){case"positive":r=r+e.clientWidth-e.scrollWidth;break;case"reverse":r=-r}return r},r.prototype.setScrollLeft=function(e){var t=this.el;if("rtl"===window.getComputedStyle(t).direction)switch(a()){case"positive":e=e-t.clientWidth+t.scrollWidth;break;case"reverse":e=-e}t.scrollLeft=e},r.prototype.getScrollFromLeft=function(){var e=this.el,t=window.getComputedStyle(e).direction,r=e.scrollLeft;if("rtl"===t)switch(a()){case"negative":r=r-e.clientWidth+e.scrollWidth;break;case"reverse":r=-r-e.clientWidth+e.scrollWidth}return r},r}(t.ScrollComponent);function a(){return i||(i=function(){var e,r=t.htmlToElement('<div style=" position: absolute; top: -1000px; width: 1px; height: 1px; overflow: scroll; direction: rtl; font-size: 100px; ">A</div>');document.body.appendChild(r),r.scrollLeft>0?e="positive":(r.scrollLeft=1,e=r.scrollLeft>0?"reverse":"negative");return t.removeElement(r),e}())}t.EmitterMixin.mixInto(s);var c=function(){function e(e,r,n){this.isHScrollbarsClipped=!1,this.isVScrollbarsClipped=!1,"clipped-scroll"===e&&(e="scroll",this.isHScrollbarsClipped=!0),"clipped-scroll"===r&&(r="scroll",this.isVScrollbarsClipped=!0),this.enhancedScroll=new s(e,r),n.appendChild(this.el=t.createElement("div",{className:"fc-scroller-clip"})),this.el.appendChild(this.enhancedScroll.el)}return e.prototype.destroy=function(){t.removeElement(this.el)},e.prototype.updateSize=function(){var e=this.enhancedScroll,r=e.el,n=t.computeEdges(r),i={marginLeft:0,marginRight:0,marginTop:0,marginBottom:0};this.isVScrollbarsClipped&&(i.marginLeft=-n.scrollbarLeft,i.marginRight=-n.scrollbarRight),this.isHScrollbarsClipped&&(i.marginBottom=-n.scrollbarBottom),t.applyStyle(r,i),!this.isHScrollbarsClipped&&"hidden"!==e.overflowX||!this.isVScrollbarsClipped&&"hidden"!==e.overflowY||n.scrollbarLeft||n.scrollbarRight||n.scrollbarBottom?r.classList.remove("fc-no-scrollbars"):r.classList.add("fc-no-scrollbars")},e.prototype.setHeight=function(e){this.enhancedScroll.setHeight(e)},e.prototype.getScrollbarWidths=function(){var e=this.enhancedScroll.getScrollbarWidths();return this.isVScrollbarsClipped&&(e.left=0,e.right=0),this.isHScrollbarsClipped&&(e.bottom=0),e},e}(),d=function(){function e(e,t){this.axis=e,this.scrollers=t;for(var r=0,n=this.scrollers;r<n.length;r++){var i=n[r];this.initScroller(i)}}return e.prototype.initScroller=function(e){var t=this,r=e.enhancedScroll,n=function(){t.assignMasterScroller(e)};"wheel mousewheel DomMouseScroll MozMousePixelScroll".split(" ").forEach((function(e){r.el.addEventListener(e,n)})),r.on("scrollStart",(function(){t.masterScroller||t.assignMasterScroller(e)})).on("scroll",(function(){if(e===t.masterScroller)for(var n=0,i=t.scrollers;n<i.length;n++){var o=i[n];if(o!==e)switch(t.axis){case"horizontal":o.enhancedScroll.el.scrollLeft=r.el.scrollLeft;break;case"vertical":o.enhancedScroll.setScrollTop(r.getScrollTop())}}})).on("scrollEnd",(function(){e===t.masterScroller&&t.unassignMasterScroller()}))},e.prototype.assignMasterScroller=function(e){this.unassignMasterScroller(),this.masterScroller=e;for(var t=0,r=this.scrollers;t<r.length;t++){var n=r[t];n!==e&&n.enhancedScroll.disableTouchScroll()}},e.prototype.unassignMasterScroller=function(){if(this.masterScroller){for(var e=0,t=this.scrollers;e<t.length;e++){t[e].enhancedScroll.enableTouchScroll()}this.masterScroller=null}},e.prototype.update=function(){for(var e,t,r=this.scrollers.map((function(e){return e.getScrollbarWidths()})),n=0,i=0,o=0,l=0,s=0,a=r;s<a.length;s++)e=a[s],n=Math.max(n,e.left),i=Math.max(i,e.right),o=Math.max(o,e.top),l=Math.max(l,e.bottom);for(t=0;t<this.scrollers.length;t++){var c=this.scrollers[t];e=r[t],c.enhancedScroll.canvas.setGutters("horizontal"===this.axis?{left:n-e.left,right:i-e.right}:{top:o-e.top,bottom:l-e.bottom})}},e}(),h=function(){function e(e,t,r){this.headerScroller=new c("clipped-scroll","hidden",e),this.bodyScroller=new c("auto",r,t),this.scrollJoiner=new d("horizontal",[this.headerScroller,this.bodyScroller])}return e.prototype.destroy=function(){this.headerScroller.destroy(),this.bodyScroller.destroy()},e.prototype.setHeight=function(e,t){var r;r=t?"auto":e-this.queryHeadHeight(),this.bodyScroller.setHeight(r),this.headerScroller.updateSize(),this.bodyScroller.updateSize(),this.scrollJoiner.update()},e.prototype.queryHeadHeight=function(){return this.headerScroller.enhancedScroll.canvas.contentEl.getBoundingClientRect().height},e}(),u=function(e){function r(t){var r=e.call(this)||this;return r.parentEl=t,r}return n(r,e),r.prototype.firstContext=function(e){this.parentEl.appendChild(this.tableEl=t.createElement("table",{className:e.theme.getClass("tableGrid")}))},r.prototype.destroy=function(){t.removeElement(this.tableEl),e.prototype.destroy.call(this)},r.prototype.render=function(e){this.renderDates(e.tDateProfile)},r.prototype.renderDates=function(e){for(var r=this.context,n=r.dateEnv,i=r.theme,o=e.cellRows,l=o[o.length-1],s=t.asRoughMs(e.labelInterval)>t.asRoughMs(e.slotDuration),a=t.isSingleDay(e.slotDuration),c="<colgroup>",d=e.slotCnt-1;d>=0;d--)c+="<col/>";c+="</colgroup>",c+="<tbody>";for(var h=0,u=o;h<u.length;h++){var p=u[h];c+="<tr"+(s&&p===l?' class="fc-chrono"':"")+">";for(var f=0,m=p;f<m.length;f++){var g=m[f],v=[i.getClass("widgetHeader")];g.isWeekStart&&v.push("fc-em-cell"),a&&(v=v.concat(t.getDayClasses(g.date,this.props.dateProfile,this.context,!0))),c+='<th class="'+v.join(" ")+'" data-date="'+n.formatIso(g.date,{omitTime:!e.isTimeScale,omitTimeZoneOffset:!0})+'"'+(g.colspan>1?' colspan="'+g.colspan+'"':"")+'><div class="fc-cell-content">'+g.spanHtml+"</div></th>"}c+="</tr>"}c+="</tbody>",this.tableEl.innerHTML=c,this.slatColEls=t.findElements(this.tableEl,"col"),this.innerEls=t.findElements(this.tableEl.querySelector("tr:last-child"),"th .fc-cell-text"),t.findElements(this.tableEl.querySelectorAll("tr:not(:last-child)"),"th .fc-cell-text").forEach((function(e){e.classList.add("fc-sticky")}))},r}(t.Component),p=function(e){function r(r){var n=e.call(this)||this;return r.appendChild(n.el=t.createElement("div",{className:"fc-slats"})),n}return n(r,e),r.prototype.destroy=function(){t.removeElement(this.el),e.prototype.destroy.call(this)},r.prototype.render=function(e){this.renderDates(e.tDateProfile)},r.prototype.renderDates=function(e){for(var r=this.context,n=r.calendar,i=r.view,o=r.theme,l=r.dateEnv,s=e.slotDates,a=e.isWeekStarts,c='<table class="'+o.getClass("tableGrid")+'"><colgroup>',d=0;d<s.length;d++)c+="<col/>";c+="</colgroup>",c+="<tbody><tr>";for(d=0;d<s.length;d++)c+=this.slatCellHtml(s[d],a[d],e);c+="</tr></tbody></table>",this.el.innerHTML=c,this.slatColEls=t.findElements(this.el,"col"),this.slatEls=t.findElements(this.el,"td");for(d=0;d<s.length;d++)n.publiclyTrigger("dayRender",[{date:l.toDate(s[d]),el:this.slatEls[d],view:i}]);this.outerCoordCache=new t.PositionCache(this.el,this.slatEls,!0,!1),this.innerCoordCache=new t.PositionCache(this.el,t.findChildren(this.slatEls,"div"),!0,!1)},r.prototype.slatCellHtml=function(e,r,n){var i,o=this.context,l=o.theme,s=o.dateEnv;return n.isTimeScale?(i=[]).push(t.isInt(s.countDurationsBetween(n.normalizedRange.start,e,n.labelInterval))?"fc-major":"fc-minor"):(i=t.getDayClasses(e,this.props.dateProfile,this.context)).push("fc-day"),i.unshift(l.getClass("widgetContent")),r&&i.push("fc-em-cell"),'<td class="'+i.join(" ")+'" data-date="'+s.formatIso(e,{omitTime:!n.isTimeScale,omitTimeZoneOffset:!0})+'"><div></div></td>'},r.prototype.updateSize=function(){this.outerCoordCache.build(),this.innerCoordCache.build()},r.prototype.positionToHit=function(e){var r=this.outerCoordCache,n=this.context,i=n.dateEnv,o=n.isRtl,l=this.props.tDateProfile,s=r.leftToIndex(e);if(null!=s){var a=r.getWidth(s),c=o?(r.rights[s]-e)/a:(e-r.lefts[s])/a,d=Math.floor(c*l.snapsPerSlot),h=i.add(l.slotDates[s],t.multiplyDuration(l.snapDuration,d));return{dateSpan:{range:{start:h,end:i.add(h,l.snapDuration)},allDay:!this.props.tDateProfile.isTimeScale},dayEl:this.slatColEls[s],left:r.lefts[s],right:r.rights[s]}}return null},r}(t.Component);t.config.MAX_TIMELINE_SLOTS=1e3;var f=[{years:1},{months:1},{days:1},{hours:1},{minutes:30},{minutes:15},{minutes:10},{minutes:5},{minutes:1},{seconds:30},{seconds:15},{seconds:10},{seconds:5},{seconds:1},{milliseconds:500},{milliseconds:100},{milliseconds:10},{milliseconds:1}];function m(e,r,n,i){var o={labelInterval:y(n,"slotLabelInterval"),slotDuration:y(n,"slotDuration")};!function(e,r,n){var i=r.currentRange;if(e.labelInterval){n.countDurationsBetween(i.start,i.end,e.labelInterval)>t.config.MAX_TIMELINE_SLOTS&&(console.warn("slotLabelInterval results in too many cells"),e.labelInterval=null)}if(e.slotDuration){n.countDurationsBetween(i.start,i.end,e.slotDuration)>t.config.MAX_TIMELINE_SLOTS&&(console.warn("slotDuration results in too many cells"),e.slotDuration=null)}if(e.labelInterval&&e.slotDuration){var o=t.wholeDivideDurations(e.labelInterval,e.slotDuration);(null===o||o<1)&&(console.warn("slotLabelInterval must be a multiple of slotDuration"),e.slotDuration=null)}}(o,e,r),S(o,e,r),function(e,r,n){var i=r.currentRange,o=e.slotDuration;if(!o){for(var l=S(e,r,n),s=0,a=f;s<a.length;s++){var c=a[s],d=t.createDuration(c),h=t.wholeDivideDurations(l,d);if(null!==h&&h>1&&h<=6){o=d;break}}if(o)n.countDurationsBetween(i.start,i.end,o)>200&&(o=null);o||(o=l),e.slotDuration=o}}(o,e,r);var l=n.slotLabelFormat,s=Array.isArray(l)?l:null!=l?[l]:function(e,r,n,i){var o,l,s=e.labelInterval,a=t.greatestDurationDenominator(s).unit,c=i.weekNumbers,d=o=l=null;"week"!==a||c||(a="day");switch(a){case"year":d={year:"numeric"};break;case"month":b("years",r,n)>1&&(d={year:"numeric"}),o={month:"short"};break;case"week":b("years",r,n)>1&&(d={year:"numeric"}),o={week:"narrow"};break;case"day":b("years",r,n)>1?d={year:"numeric",month:"long"}:b("months",r,n)>1&&(d={month:"long"}),c&&(o={week:"short"}),l={weekday:"narrow",day:"numeric"};break;case"hour":c&&(d={week:"short"}),b("days",r,n)>1&&(o={weekday:"short",day:"numeric",month:"numeric",omitCommas:!0}),l={hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"short"};break;case"minute":t.asRoughMinutes(s)/60>=6?(d={hour:"numeric",meridiem:"short"},o=function(e){return":"+t.padStart(e.date.minute,2)}):d={hour:"numeric",minute:"numeric",meridiem:"short"};break;case"second":t.asRoughSeconds(s)/60>=6?(d={hour:"numeric",minute:"2-digit",meridiem:"lowercase"},o=function(e){return":"+t.padStart(e.date.second,2)}):d={hour:"numeric",minute:"2-digit",second:"2-digit",meridiem:"lowercase"};break;case"millisecond":d={hour:"numeric",minute:"2-digit",second:"2-digit",meridiem:"lowercase"},o=function(e){return"."+t.padStart(e.millisecond,3)}}return[].concat(d||[],o||[],l||[])}(o,e,r,n);o.headerFormats=s.map((function(e){return t.createFormatter(e)})),o.isTimeScale=Boolean(o.slotDuration.milliseconds);var a=null;if(!o.isTimeScale){var c=t.greatestDurationDenominator(o.slotDuration).unit;/year|month|week/.test(c)&&(a=c)}o.largeUnit=a,o.emphasizeWeeks=t.isSingleDay(o.slotDuration)&&b("weeks",e,r)>=2&&!n.businessHours;var d,h,u=n.snapDuration;u&&(d=t.createDuration(u),h=t.wholeDivideDurations(o.slotDuration,d)),null==h&&(d=o.slotDuration,h=1),o.snapDuration=d,o.snapsPerSlot=h;var p=t.asRoughMs(e.maxTime)-t.asRoughMs(e.minTime),m=g(e.renderRange.start,o,r),D=g(e.renderRange.end,o,r);o.isTimeScale&&(m=r.add(m,e.minTime),D=r.add(t.addDays(D,-1),e.maxTime)),o.timeWindowMs=p,o.normalizedRange={start:m,end:D};for(var w=[],C=m;C<D;)v(C,o,e,i)&&w.push(C),C=r.add(C,o.slotDuration);o.slotDates=w;var T=-1,x=0,R=[],k=[];for(C=m;C<D;)v(C,o,e,i)?(T++,R.push(T),k.push(x)):R.push(T+.5),C=r.add(C,o.snapDuration),x++;return o.snapDiffToIndex=R,o.snapIndexToDiff=k,o.snapCnt=T+1,o.slotCnt=o.snapCnt/o.snapsPerSlot,o.isWeekStarts=function(e,t){for(var r=e.slotDates,n=e.emphasizeWeeks,i=null,o=[],l=0,s=r;l<s.length;l++){var a=s[l],c=t.computeWeekNumber(a),d=n&&null!==i&&i!==c;i=c,o.push(d)}return o}(o,r),o.cellRows=function(e,r,n){for(var i=e.slotDates,o=e.headerFormats,l=o.map((function(e){return[]})),s=o.map((function(e){return e.getLargestUnit?e.getLargestUnit():null})),a=0;a<i.length;a++)for(var c=i[a],d=e.isWeekStarts[a],h=0;h<o.length;h++){var u=o[h],p=l[h],f=p[p.length-1],m=null;if(o.length>1&&h<o.length-1){var g=r.format(c,u);f&&f.text===g?f.colspan+=1:m=E(c,g,s[h],n,r)}else{if(!f||t.isInt(r.countDurationsBetween(e.normalizedRange.start,c,e.labelInterval)))m=E(c,g=r.format(c,u),s[h],n,r);else f.colspan+=1}m&&(m.weekStart=d,p.push(m))}return l}(o,r,n),o}function g(e,r,n){var i=e;return r.isTimeScale||(i=t.startOfDay(i),r.largeUnit&&(i=n.startOf(i,r.largeUnit))),i}function v(e,r,n,i){if(i.isHiddenDay(e))return!1;if(r.isTimeScale){var o=t.startOfDay(e),l=e.valueOf()-o.valueOf()-t.asRoughMs(n.minTime);return(l=(l%864e5+864e5)%864e5)<r.timeWindowMs}return!0}function y(e,r){var n=e[r];if(null!=n)return t.createDuration(n)}function S(e,r,n){var i=r.currentRange,o=e.labelInterval;if(!o){var l=void 0;if(e.slotDuration){for(var s=0,a=f;s<a.length;s++){l=a[s];var c=t.createDuration(l),d=t.wholeDivideDurations(c,e.slotDuration);if(null!==d&&d<=6){o=c;break}}o||(o=e.slotDuration)}else for(var h=0,u=f;h<u.length;h++){if(l=u[h],o=t.createDuration(l),n.countDurationsBetween(i.start,i.end,o)>=18)break}e.labelInterval=o}return o}function b(e,r,n){var i=r.currentRange,o=null;return"years"===e?o=n.diffWholeYears(i.start,i.end):"months"===e||"weeks"===e?o=n.diffWholeMonths(i.start,i.end):"days"===e&&(o=t.diffWholeDays(i.start,i.end)),o||0}function E(e,r,n,i,o){return{text:r,spanHtml:t.buildGotoAnchorHtml(i,o,{date:e,type:n,forceOff:!n},{class:"fc-cell-text"},t.htmlEscape(r)),date:e,colspan:1,isWeekStart:!1}}var D,w=function(){function e(e,t){this.headParent=e,this.bodyParent=t}return e.prototype.render=function(e,r){var n=r?{right:-e}:{left:e};this.headParent.appendChild(this.arrowEl=t.createElement("div",{className:"fc-now-indicator fc-now-indicator-arrow",style:n})),this.bodyParent.appendChild(this.lineEl=t.createElement("div",{className:"fc-now-indicator fc-now-indicator-line",style:n}))},e.prototype.unrender=function(){this.arrowEl&&t.removeElement(this.arrowEl),this.lineEl&&t.removeElement(this.lineEl)},e}(),C=-1!==(D=t.htmlToElement('<div style="position:-webkit-sticky;position:sticky"></div>').style.position).indexOf("sticky")?D:null,T=/Edge/.test(navigator.userAgent),x="-webkit-sticky"===C,R=function(){function e(e,r,n){var i=this;this.usingRelative=null,this.updateSize=function(){var e=Array.prototype.slice.call(i.scroller.canvas.el.querySelectorAll(".fc-sticky")),r=i.queryElGeoms(e),n=i.scroller.el.clientWidth;i.usingRelative?function(e,r,n){e.forEach((function(e,i){var o=r[i].naturalBound;t.applyStyle(e,{position:"relative",left:n[i].left-o.left,top:n[i].top-o.top})}))}(e,r,i.computeElDestinations(r,n)):function(e,r,n){e.forEach((function(e,i){var o=0;"center"===r[i].intendedTextAlign&&(o=(n-r[i].elWidth)/2,"center"===r[i].computedTextAlign&&(e.setAttribute("data-sticky-center",""),e.parentNode.style.textAlign="left")),t.applyStyle(e,{position:C,left:o,right:0,top:0})}))}(e,r,n)},this.scroller=e,this.usingRelative=!C||T&&r||(T||x)&&n,this.usingRelative&&e.on("scrollEnd",this.updateSize)}return e.prototype.destroy=function(){this.scroller.off("scrollEnd",this.updateSize)},e.prototype.queryElGeoms=function(e){for(var r=this.scroller.canvas.el.getBoundingClientRect(),n=[],i=0,o=e;i<o.length;i++){var l=o[i],s=t.translateRect(l.parentNode.getBoundingClientRect(),-r.left,-r.top),a=l.getBoundingClientRect(),c=window.getComputedStyle(l),d=window.getComputedStyle(l.parentNode).textAlign,h=d,u=null;"sticky"!==c.position&&(u=t.translateRect(a,-r.left-(parseFloat(c.left)||0),-r.top-(parseFloat(c.top)||0))),l.hasAttribute("data-sticky-center")&&(h="center"),n.push({parentBound:s,naturalBound:u,elWidth:a.width,elHeight:a.height,computedTextAlign:d,intendedTextAlign:h})}return n},e.prototype.computeElDestinations=function(e,t){var r=this.scroller.getScrollFromLeft(),n=this.scroller.getScrollTop(),i=r+t;return e.map((function(e){var t,o,l=e.elWidth,s=e.elHeight,a=e.parentBound,c=e.naturalBound;switch(e.intendedTextAlign){case"left":t=r;break;case"right":t=i-l;break;case"center":t=(r+i)/2-l/2}return t=Math.min(t,a.right-l),t=Math.max(t,a.left),o=n,o=Math.min(o,a.bottom-s),{left:t,top:o=Math.max(o,c.top)}}))},e}();var k=function(e){function r(r,n){var i=e.call(this)||this;return i.renderSkeleton=t.memoizeRendering(i._renderSkeleton,i._unrenderSkeleton),i.layout=new h(r,n,"auto"),i}return n(r,e),r.prototype.render=function(e,t){var r=this.tDateProfile=m(e.dateProfile,t.dateEnv,t.options,e.dateProfileGenerator);this.renderSkeleton(t),this.header.receiveProps({dateProfile:e.dateProfile,tDateProfile:r},t),this.slats.receiveProps({dateProfile:e.dateProfile,tDateProfile:r},t)},r.prototype.destroy=function(){this.renderSkeleton.unrender(),this.layout.destroy(),e.prototype.destroy.call(this)},r.prototype._renderSkeleton=function(e){var t=this.layout,r=t.headerScroller.enhancedScroll,n=t.bodyScroller.enhancedScroll;this.headStickyScroller=new R(r,e.isRtl,!1),this.bodyStickyScroller=new R(n,e.isRtl,!1),this.header=new u(r.canvas.contentEl),this.slats=new p(n.canvas.bgEl),this.nowIndicator=new w(r.canvas.el,n.canvas.el)},r.prototype._unrenderSkeleton=function(){this.header.destroy(),this.slats.destroy(),this.nowIndicator.unrender(),this.headStickyScroller.destroy(),this.bodyStickyScroller.destroy()},r.prototype.getNowIndicatorUnit=function(e,r){var n=this.context,i=this.tDateProfile=m(e,n.dateEnv,n.options,r);if(i.isTimeScale)return t.greatestDurationDenominator(i.slotDuration).unit},r.prototype.renderNowIndicator=function(e){t.rangeContainsMarker(this.tDateProfile.normalizedRange,e)&&this.nowIndicator.render(this.dateToCoord(e),this.context.isRtl)},r.prototype.unrenderNowIndicator=function(){this.nowIndicator.unrender()},r.prototype.updateSize=function(e,t,r){this.applySlotWidth(this.computeSlotWidth()),this.layout.setHeight(t,r),this.slats.updateSize()},r.prototype.updateStickyScrollers=function(){this.headStickyScroller.updateSize(),this.bodyStickyScroller.updateSize()},r.prototype.computeSlotWidth=function(){var e=this.context.options.slotWidth||"";return""===e&&(e=this.computeDefaultSlotWidth(this.tDateProfile)),e},r.prototype.computeDefaultSlotWidth=function(e){var r=0;this.header.innerEls.forEach((function(e,t){r=Math.max(r,e.getBoundingClientRect().width)}));var n=Math.ceil(r)+1,i=t.wholeDivideDurations(e.labelInterval,e.slotDuration),o=Math.ceil(n/i),l=window.getComputedStyle(this.header.slatColEls[0]).minWidth;return l&&(l=parseInt(l,10))&&(o=Math.max(o,l)),o},r.prototype.applySlotWidth=function(e){var t=this.layout,r=this.tDateProfile,n="",i="",o="";if(""!==e){n=(e=Math.round(e))*r.slotDates.length,i="",o=e;var l=t.bodyScroller.enhancedScroll.getClientWidth();l>n&&(i=l,n="",o=Math.floor(l/r.slotDates.length))}t.headerScroller.enhancedScroll.canvas.setWidth(n),t.headerScroller.enhancedScroll.canvas.setMinWidth(i),t.bodyScroller.enhancedScroll.canvas.setWidth(n),t.bodyScroller.enhancedScroll.canvas.setMinWidth(i),""!==o&&this.header.slatColEls.slice(0,-1).concat(this.slats.slatColEls.slice(0,-1)).forEach((function(e){e.style.width=o+"px",e.style.minWidth="0"}))},r.prototype.computeDateSnapCoverage=function(e){var r=this.tDateProfile,n=this.context.dateEnv.countDurationsBetween(r.normalizedRange.start,e,r.snapDuration);if(n<0)return 0;if(n>=r.snapDiffToIndex.length)return r.snapCnt;var i=Math.floor(n),o=r.snapDiffToIndex[i];return t.isInt(o)?o+=n-i:o=Math.ceil(o),o},r.prototype.dateToCoord=function(e){var t=this.tDateProfile,r=this.computeDateSnapCoverage(e)/t.snapsPerSlot,n=Math.floor(r),i=r-(n=Math.min(n,t.slotCnt-1)),o=this.slats,l=o.innerCoordCache,s=o.outerCoordCache;return this.context.isRtl?s.rights[n]-l.getWidth(n)*i-s.originClientRect.width:s.lefts[n]+l.getWidth(n)*i},r.prototype.rangeToCoords=function(e){return this.context.isRtl?{right:this.dateToCoord(e.start),left:this.dateToCoord(e.end)}:{left:this.dateToCoord(e.start),right:this.dateToCoord(e.end)}},r.prototype.computeDateScroll=function(e){var r=this.context,n=r.dateEnv,i=r.isRtl,o=this.props.dateProfile,l=0;return o&&(l=this.dateToCoord(n.add(t.startOfDay(o.activeRange.start),e)),!i&&l&&(l+=1)),{left:l}},r.prototype.queryDateScroll=function(){return{left:this.layout.bodyScroller.enhancedScroll.getScrollLeft()}},r.prototype.applyDateScroll=function(e){this.layout.bodyScroller.enhancedScroll.setScrollLeft(e.left||0),this.layout.headerScroller.enhancedScroll.setScrollLeft(e.left||0)},r}(t.Component),z=function(e){function r(t,r){var n=e.call(this)||this;return n.masterContainerEl=t,n.timeAxis=r,n}return n(r,e),r.prototype.renderSegHtml=function(e,r){var n=this.context,i=e.eventRange,o=i.def,l=i.ui,s=t.computeEventDraggable(n,o,l),a=e.isStart&&t.computeEventStartResizable(n,o,l),c=e.isEnd&&t.computeEventEndResizable(n,o,l),d=this.getSegClasses(e,s,a||c,r);d.unshift("fc-timeline-event","fc-h-event");var h=this.getTimeText(i);return'<a class="'+d.join(" ")+'" style="'+t.cssToStr(this.getSkinCss(l))+'"'+(o.url?' href="'+t.htmlEscape(o.url)+'"':"")+">"+(h?'<span class="fc-time-wrap"><span class="fc-time">'+t.htmlEscape(h)+"</span></span>":"")+'<span class="fc-title-wrap"><span class="fc-title fc-sticky">'+(o.title?t.htmlEscape(o.title):"&nbsp;")+"</span></span>"+(a?'<div class="fc-resizer fc-start-resizer"></div>':"")+(c?'<div class="fc-resizer fc-end-resizer"></div>':"")+"</a>"},r.prototype.computeDisplayEventTime=function(){return!this.timeAxis.tDateProfile.isTimeScale},r.prototype.computeDisplayEventEnd=function(){return!1},r.prototype.computeEventTimeFormat=function(){return{hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"narrow"}},r.prototype.attachSegs=function(e,r){if(!this.el&&this.masterContainerEl&&(this.el=t.createElement("div",{className:"fc-event-container"}),r&&this.el.classList.add("fc-mirror-container"),this.masterContainerEl.appendChild(this.el)),this.el)for(var n=0,i=e;n<i.length;n++){var o=i[n];this.el.appendChild(o.el)}},r.prototype.detachSegs=function(e){for(var r=0,n=e;r<n.length;r++){var i=n[r];t.removeElement(i.el)}},r.prototype.computeSegSizes=function(e){for(var r=this.timeAxis,n=0,i=e;n<i.length;n++){var o=i[n],l=r.rangeToCoords(o);t.applyStyle(o.el,{left:o.left=l.left,right:-(o.right=l.right)})}},r.prototype.assignSegSizes=function(e){if(this.el){for(var r=0,n=e;r<n.length;r++){(s=n[r]).height=t.computeHeightAndMargins(s.el)}this.buildSegLevels(e);var i=M(e);t.applyStyleProp(this.el,"height",i);for(var o=0,l=e;o<l.length;o++){var s=l[o];t.applyStyleProp(s.el,"top",s.top)}}},r.prototype.buildSegLevels=function(e){for(var t=[],r=0,n=e=this.sortEventSegs(e);r<n.length;r++){var i=n[r];i.above=[];for(var o=0;o<t.length;){for(var l=!1,s=0,a=t[o];s<a.length;s++){var c=a[s];P(i,c)&&(i.above.push(c),l=!0)}if(!l)break;o+=1}for((t[o]||(t[o]=[])).push(i),o+=1;o<t.length;){for(var d=0,h=t[o];d<h.length;d++){var u=h[d];P(i,u)&&u.above.push(i)}o+=1}}return t},r}(t.FgEventRenderer);function M(e){for(var t=0,r=0,n=e;r<n.length;r++){var i=n[r];t=Math.max(t,I(i))}return t}function I(e){return null==e.top&&(e.top=M(e.above)),e.top+e.height}function P(e,t){return e.left<t.right&&e.right>t.left}var L=function(e){function r(t,r){var n=e.call(this)||this;return n.masterContainerEl=t,n.timeAxis=r,n}return n(r,e),r.prototype.attachSegs=function(e,r){if(r.length){var n=void 0;n="businessHours"===e?"bgevent":e.toLowerCase();var i=t.createElement("div",{className:"fc-"+n+"-container"});this.masterContainerEl.appendChild(i);for(var o=0,l=r;o<l.length;o++){var s=l[o];i.appendChild(s.el)}return[i]}},r.prototype.computeSegSizes=function(e){for(var t=this.timeAxis,r=0,n=e;r<n.length;r++){var i=n[r],o=t.rangeToCoords(i);i.left=o.left,i.right=o.right}},r.prototype.assignSegSizes=function(e){for(var r=0,n=e;r<n.length;r++){var i=n[r];t.applyStyle(i.el,{left:i.left,right:-i.right})}},r}(t.FillRenderer),H=function(e){function r(r,n,i){var o=e.call(this,n)||this;o.slicer=new W,o.renderEventDrag=t.memoizeRendering(o._renderEventDrag,o._unrenderEventDrag),o.renderEventResize=t.memoizeRendering(o._renderEventResize,o._unrenderEventResize),o.fgContainerEl=r,o.timeAxis=i;var l=o.fillRenderer=new L(n,i),s=o.eventRenderer=new z(r,i);return o.mirrorRenderer=new z(r,i),o.renderBusinessHours=t.memoizeRendering(l.renderSegs.bind(l,"businessHours"),l.unrender.bind(l,"businessHours")),o.renderDateSelection=t.memoizeRendering(l.renderSegs.bind(l,"highlight"),l.unrender.bind(l,"highlight")),o.renderBgEvents=t.memoizeRendering(l.renderSegs.bind(l,"bgEvent"),l.unrender.bind(l,"bgEvent")),o.renderFgEvents=t.memoizeRendering(s.renderSegs.bind(s),s.unrender.bind(s)),o.renderEventSelection=t.memoizeRendering(s.selectByInstanceId.bind(s),s.unselectByInstanceId.bind(s),[o.renderFgEvents]),o}return n(r,e),r.prototype.render=function(e,t){var r=this.timeAxis,n=this.slicer.sliceProps(e,e.dateProfile,r.tDateProfile.isTimeScale?null:e.nextDayThreshold,t.calendar,this,r);this.renderBusinessHours(t,n.businessHourSegs),this.renderDateSelection(t,n.dateSelectionSegs),this.renderBgEvents(t,n.bgEventSegs),this.renderFgEvents(t,n.fgEventSegs),this.renderEventSelection(n.eventSelection),this.renderEventDrag(n.eventDrag),this.renderEventResize(n.eventResize)},r.prototype.destroy=function(){e.prototype.destroy.call(this),this.renderBusinessHours.unrender(),this.renderDateSelection.unrender(),this.renderBgEvents.unrender(),this.renderFgEvents.unrender(),this.renderEventSelection.unrender(),this.renderEventDrag.unrender(),this.renderEventResize.unrender()},r.prototype._renderEventDrag=function(e){e&&(this.eventRenderer.hideByHash(e.affectedInstances),this.mirrorRenderer.renderSegs(this.context,e.segs,{isDragging:!0,sourceSeg:e.sourceSeg}))},r.prototype._unrenderEventDrag=function(e){e&&(this.eventRenderer.showByHash(e.affectedInstances),this.mirrorRenderer.unrender(this.context,e.segs,{isDragging:!0,sourceSeg:e.sourceSeg}))},r.prototype._renderEventResize=function(e){if(e){var t=e.segs.map((function(e){return o({},e)}));this.eventRenderer.hideByHash(e.affectedInstances),this.fillRenderer.renderSegs("highlight",this.context,t),this.mirrorRenderer.renderSegs(this.context,e.segs,{isDragging:!0,sourceSeg:e.sourceSeg})}},r.prototype._unrenderEventResize=function(e){e&&(this.eventRenderer.showByHash(e.affectedInstances),this.fillRenderer.unrender("highlight",this.context),this.mirrorRenderer.unrender(this.context,e.segs,{isDragging:!0,sourceSeg:e.sourceSeg}))},r.prototype.updateSize=function(e){var t=this,r=t.fillRenderer,n=t.eventRenderer,i=t.mirrorRenderer;r.computeSizes(e),n.computeSizes(e),i.computeSizes(e),r.assignSizes(e),n.assignSizes(e),i.assignSizes(e)},r}(t.DateComponent),W=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return n(r,e),r.prototype.sliceRange=function(e,r){var n=r.tDateProfile,i=r.props,o=i.dateProfile,l=i.dateProfileGenerator,s=function(e,r,n){if(!r.isTimeScale&&(e=t.computeVisibleDayRange(e),r.largeUnit)){var i=e;((e={start:n.startOf(e.start,r.largeUnit),end:n.startOf(e.end,r.largeUnit)}).end.valueOf()!==i.end.valueOf()||e.end<=e.start)&&(e={start:e.start,end:n.add(e.end,r.slotDuration)})}return e}(e,n,r.context.dateEnv),a=[];if(r.computeDateSnapCoverage(s.start)<r.computeDateSnapCoverage(s.end)){var c=t.intersectRanges(s,n.normalizedRange);c&&a.push({start:c.start,end:c.end,isStart:c.start.valueOf()===s.start.valueOf()&&v(c.start,n,o,l),isEnd:c.end.valueOf()===s.end.valueOf()&&v(t.addMs(c.end,-1),n,o,l)})}return a},r}(t.Slicer),A=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.renderSkeleton=t.memoizeRendering(r._renderSkeleton,r._unrenderSkeleton),r.startInteractive=t.memoizeRendering(r._startInteractive,r._stopInteractive),r}return n(r,e),r.prototype._startInteractive=function(e){this.context.calendar.registerInteractiveComponent(this,{el:e})},r.prototype._stopInteractive=function(){this.context.calendar.unregisterInteractiveComponent(this)},r.prototype.render=function(t,r){e.prototype.render.call(this,t,r),this.renderSkeleton(this.context),this.timeAxis.receiveProps({dateProfileGenerator:t.dateProfileGenerator,dateProfile:t.dateProfile},r),this.startInteractive(this.timeAxis.slats.el),this.lane.receiveProps(o({},t,{nextDayThreshold:this.context.nextDayThreshold}),r),this.startNowIndicator(t.dateProfile,t.dateProfileGenerator)},r.prototype.destroy=function(){this.startInteractive.unrender(),this.renderSkeleton.unrender(),e.prototype.destroy.call(this)},r.prototype._renderSkeleton=function(e){this.el.classList.add("fc-timeline"),!1===e.options.eventOverlap&&this.el.classList.add("fc-no-overlap"),this.el.innerHTML=this.renderSkeletonHtml(),this.timeAxis=new k(this.el.querySelector("thead .fc-time-area"),this.el.querySelector("tbody .fc-time-area")),this.lane=new H(this.timeAxis.layout.bodyScroller.enhancedScroll.canvas.contentEl,this.timeAxis.layout.bodyScroller.enhancedScroll.canvas.bgEl,this.timeAxis)},r.prototype._unrenderSkeleton=function(){this.el.classList.remove("fc-timeline"),this.el.classList.remove("fc-no-overlap"),this.timeAxis.destroy(),this.lane.destroy()},r.prototype.renderSkeletonHtml=function(){var e=this.context.theme;return'<table class="'+e.getClass("tableGrid")+'"> <thead class="fc-head"> <tr> <td class="fc-time-area '+e.getClass("widgetHeader")+'"></td> </tr> </thead> <tbody class="fc-body"> <tr> <td class="fc-time-area '+e.getClass("widgetContent")+'"></td> </tr> </tbody> </table>'},r.prototype.updateSize=function(e,t,r){this.timeAxis.updateSize(e,t,r),this.lane.updateSize(e)},r.prototype.getNowIndicatorUnit=function(e,t){return this.timeAxis.getNowIndicatorUnit(e,t)},r.prototype.renderNowIndicator=function(e){this.timeAxis.renderNowIndicator(e)},r.prototype.unrenderNowIndicator=function(){this.timeAxis.unrenderNowIndicator()},r.prototype.computeDateScroll=function(e){return this.timeAxis.computeDateScroll(e)},r.prototype.applyScroll=function(t,r){e.prototype.applyScroll.call(this,t,r);var n=this.context.calendar;(r||n.isViewUpdated||n.isDatesUpdated||n.isEventsUpdated)&&this.timeAxis.updateStickyScrollers()},r.prototype.applyDateScroll=function(e){this.timeAxis.applyDateScroll(e)},r.prototype.queryScroll=function(){var e=this.timeAxis.layout.bodyScroller.enhancedScroll;return{top:e.getScrollTop(),left:e.getScrollLeft()}},r.prototype.buildPositionCaches=function(){this.timeAxis.slats.updateSize()},r.prototype.queryHit=function(e,t,r,n){var i=this.timeAxis.slats.positionToHit(e);if(i)return{component:this,dateSpan:i.dateSpan,rect:{left:i.left,right:i.right,top:0,bottom:n},dayEl:i.dayEl,layer:0}},r}(t.View),B=t.createPlugin({defaultView:"timelineDay",views:{timeline:{class:A,eventResizableFromStart:!0},timelineDay:{type:"timeline",duration:{days:1}},timelineWeek:{type:"timeline",duration:{weeks:1}},timelineMonth:{type:"timeline",duration:{months:1}},timelineYear:{type:"timeline",duration:{years:1}}}});e.HeaderBodyLayout=h,e.ScrollJoiner=d,e.StickyScroller=R,e.TimeAxis=k,e.TimelineLane=H,e.TimelineView=A,e.default=B,Object.defineProperty(e,"__esModule",{value:!0})}));