From 43989a9d029543aa9fce7342f45d70a1bf9a95ec Mon Sep 17 00:00:00 2001 From: Adam Shaw Date: Sun, 18 Oct 2015 13:43:40 -0700 Subject: [PATCH] version 1.0.2 --- dist/scheduler.css | 467 ++++ dist/scheduler.js | 5138 ++++++++++++++++++++++++++++++++++++++++ dist/scheduler.min.css | 5 + dist/scheduler.min.js | 8 + 4 files changed, 5618 insertions(+) create mode 100644 dist/scheduler.css create mode 100644 dist/scheduler.js create mode 100644 dist/scheduler.min.css create mode 100644 dist/scheduler.min.js diff --git a/dist/scheduler.css b/dist/scheduler.css new file mode 100644 index 000000000..0f1573fbf --- /dev/null +++ b/dist/scheduler.css @@ -0,0 +1,467 @@ +/*! + * FullCalendar Scheduler v1.0.2 + * Docs & License: http://fullcalendar.io/scheduler/ + * (c) 2015 Adam Shaw + */ + +/* TODO: break this file up */ + +/* Scroll Pane +--------------------------------------------------------------------------------------------------*/ + +.fc-scrollpane { + overflow: hidden; /* for clipping scrollbars */ + position: relative; /* so things like scrollfollowers can attach to this */ +} + +.fc-scrollpane-inner { + overflow: hidden; /* for clipping inner content */ + position: relative; /* origin for bg */ + box-sizing: border-box; /* so that padding (for gutter) will be part of height */ + min-height: 100%; +} + +.fc-scrollpane-inner > .fc-bg { + z-index: 1; /* make default? */ +} + +.fc-scrollpane-inner > .fc-content { + z-index: 2; /* make default? */ + position: relative; /* origin for inner content */ +} + +.fc-no-scrollbars::-webkit-scrollbar { /* might be applied to scrollpane-scroller */ + /* supresses rendering of native scrollbars */ + width: 0; + height: 0; +} + + +/* View Structure +--------------------------------------------------------------------------------------------------*/ + +.fc-rtl .fc-timeline { + direction: rtl; +} + +.fc-timeline .fc-divider { + width: 3px; + border-style: double; /* overcome neighboring borders */ +} + +.fc-timeline .fc-head > tr > .fc-divider { + border-bottom: 0; +} + +.fc-timeline .fc-body > tr > .fc-divider { + border-top: 0; +} + +.fc-timeline .fc-body .fc-divider.ui-widget-header { + background-image: none; +} + +.fc-scrolled .fc-head .fc-scrollpane { + z-index: 2; /* so drop shadow will go above body panes */ +} + +.fc-timeline.fc-scrolled .fc-head .fc-scrollpane { + box-shadow: 0 3px 4px rgba(0,0,0,0.075); +} + +.fc-timeline .fc-body .fc-scrollpane { + z-index: 1; +} + +.fc-timeline .fc-scrollpane-inner > .fc-content, +.fc-timeline .fc-scrollpane-inner > .fc-bg { + margin: -1px; +} + + +/* Table Cell Common +--------------------------------------------------------------------------------------------------*/ + +.fc-timeline th, +.fc-timeline td { + white-space: nowrap; +} + +.fc-timeline .fc-cell-content { + overflow: hidden; +} + +.fc-timeline .fc-cell-text { + padding-left: 4px; + padding-right: 4px; +} + +.fc-timeline .fc-col-resizer { + cursor: col-resize; +} + +/* +Cells at the start of a week +TODO: figure out better styling + +.fc-ltr .fc-timeline .fc-em-cell div { + border-left: 3px solid #eee; + height: 100%; +} +.fc-rtl .fc-timeline .fc-em-cell { + border-right-width: 3px; +} +*/ + +/* head */ + +.fc-timeline th { + vertical-align: middle; +} + +.fc-timeline .fc-head .fc-cell-content { + padding-top: 3px; + padding-bottom: 3px; +} + +/* body */ + +.fc-timeline .fc-body .ui-widget-content { + background-image: none; +} + + +/* Resource Area +--------------------------------------------------------------------------------------------------*/ + +.fc-resource-area { + width: 30%; +} + +.fc-resource-area col { + width: 40%; + min-width: 70px; /* will be read by JS */ +} + +.fc-resource-area col.fc-main-col { + width: 60%; /* make the first column in a nested setup bigger */ +} + + +.fc-flat .fc-expander-space { /* fc-flat is opposite of fc-nested */ + display: none; +} + + +.fc-ltr .fc-resource-area tr > * { + text-align: left; +} +.fc-rtl .fc-resource-area tr > * { + text-align: right; +} + +.fc-resource-area .fc-cell-content { + padding-left: 4px; + padding-right: 4px; +} + +/* head */ + +.fc-resource-area .fc-super th { + text-align: center; +} + +.fc-resource-area th > div { + position: relative; +} + +.fc-resource-area th .fc-cell-content { + position: relative; + z-index: 1; +} + +.fc-resource-area th .fc-col-resizer { + position: absolute; + z-index: 2; + top: 0; + bottom: 0; + width: 5px; +} + +.fc-ltr .fc-resource-area th .fc-col-resizer { + right: -3px; +} +.fc-rtl .fc-resource-area th .fc-col-resizer { + left: -3px; +} + +/* body */ + +tr.fc-collapsed > td, /* before the transition (prevents initial flicker) */ +tr.fc-transitioning > td { /* during the transition */ + overflow: hidden; /* prevents absolutely-positioned events from bleeding out */ +} + +tr.fc-transitioning > td > div { + transition: margin-top 0.2s; +} + +tr.fc-collapsed > td > div { + margin-top: -10px; +} + + +.fc-body .fc-resource-area .fc-cell-content { /* might BE the cell */ + padding-top: 8px; + padding-bottom: 8px; +} + +.fc-no-overlap .fc-body .fc-resource-area .fc-cell-content { /* might BE the cell */ + padding-top: 5px; + padding-bottom: 5px; +} + +.fc-resource-area .fc-icon { /* the expander and spacers before the expander */ + font-size: .9em; + vertical-align: middle; + margin-top: -2%; +} + +.fc-resource-area .fc-expander { + cursor: pointer; + color: #666; +} + + +/* Time Area +--------------------------------------------------------------------------------------------------*/ + +.fc-time-area col { + min-width: 2.2em; /* detected by JS */ +} + +/* head */ + +.fc-ltr .fc-time-area .fc-chrono th { + text-align: left; +} +.fc-rtl .fc-time-area .fc-chrono th { + text-align: right; +} + +/* body slats (vertical lines) */ + +.fc-time-area .fc-slats { /* fc-bg is responsible for a lot of this now! */ + position: absolute; + z-index: 1; + top: 0; + left: 0; + right: 0; + bottom: 0; +} + +.fc-time-area .fc-slats table { + height: 100%; +} + +.fc-time-area .fc-slats .fc-minor { + border-style: dotted; +} + +.fc-time-area .fc-slats td { + border-width: 0 1px; /* need to do this. sometimes -1 margin wouldn't hide the dotted */ +} + +.fc-ltr .fc-time-area .fc-slats td { + border-right-width: 0; +} +.fc-rtl .fc-time-area .fc-slats td { + border-left-width: 0; +} + +/* body content containers + can be within rows or directly within the pane's content +*/ + +.fc-time-area .fc-bgevent-container, +.fc-time-area .fc-highlight-container { + position: absolute; + z-index: 2; /* only for directly within pane. not for row. overridden later */ + top: 0; + bottom: 0; + width: 0; +} + +.fc-ltr .fc-time-area .fc-helper-container, /* only within row */ +.fc-ltr .fc-time-area .fc-bgevent-container, +.fc-ltr .fc-time-area .fc-highlight-container { + left: 0; +} +.fc-rtl .fc-time-area .fc-helper-container, /* only within row */ +.fc-rtl .fc-time-area .fc-bgevent-container, +.fc-rtl .fc-time-area .fc-highlight-container { + right: 0; +} + +.fc-time-area .fc-bgevent, +.fc-time-area .fc-highlight { + position: absolute; + top: 0; + bottom: 0; +} + +/* body resource rows */ + +.fc-time-area .fc-rows { + position: relative; + z-index: 3; +} + +.fc-time-area .fc-rows .ui-widget-content { + background: none; +} + +.fc-time-area .fc-rows td > div { + position: relative; +} + +.fc-time-area .fc-rows .fc-bgevent-container, +.fc-time-area .fc-rows .fc-highlight-container { + z-index: 1; +} + +.fc-time-area .fc-event-container { + position: relative; + z-index: 2; /* above bgevent and highlight */ + width: 0; /* for event positioning. will end up on correct side based on dir */ +} + +.fc-time-area .fc-helper-container { /* also an fc-event-container */ + position: absolute; + z-index: 3; + top: 0; +} + +.fc-time-area .fc-event-container { + padding-bottom: 8px; + top: -1px; +} + +.fc-time-area tr:first-child .fc-event-container { + top: 0; +} + +.fc-no-overlap .fc-time-area .fc-event-container { + padding-bottom: 0; + top: 0; +} + + +/* Time Grid Events +--------------------------------------------------------------------------------------------------*/ + +.fc-timeline-event { + position: absolute; + border-radius: 0; + padding: 2px 0; + margin-bottom: 1px; +} + +.fc-no-overlap .fc-timeline-event { + padding: 5px 0; + margin-bottom: 0; +} + +/* don't overlap grid lines at the event's end */ +.fc-ltr .fc-timeline-event { margin-right: 1px } +.fc-rtl .fc-timeline-event { margin-left: 1px } + +.fc-timeline-event .fc-content { + padding: 0 1px; + white-space: nowrap; + overflow: hidden; +} + +.fc-timeline-event .fc-time { + font-weight: bold; + padding: 0 1px; +} + +.fc-rtl .fc-timeline-event .fc-time { + display: inline-block; /* will force it on the other side */ +} + +.fc-timeline-event .fc-title { + padding: 0 1px; +} + +.fc-timeline-event .fc-resizer:after { + width: 1px; /* activate! */ +} + + +/* follower logic */ + + +.fc-ltr .fc-timeline-event .fc-title { + padding-left: 10px; + margin-left: -8px; +} +.fc-rtl .fc-timeline-event .fc-title { + padding-right: 10px; + margin-right: -8px; +} + +.fc-ltr .fc-timeline-event.fc-not-start .fc-title { + margin-left: -2px; +} +.fc-rtl .fc-timeline-event.fc-not-start .fc-title { + margin-right: -2px; +} + +.fc-timeline-event.fc-not-start .fc-title, +.fc-body .fc-time-area .fc-following { + position: relative; +} + +.fc-timeline-event.fc-not-start .fc-title:before, +.fc-body .fc-time-area .fc-following:before { /* generic arrow */ + content: ""; + position: absolute; + top: 50%; + margin-top: -5px; + border: 5px solid #000; + border-top-color: transparent; + border-bottom-color: transparent; + opacity: .5; +} + +.fc-ltr .fc-timeline-event.fc-not-start .fc-title:before, +.fc-ltr .fc-body .fc-time-area .fc-following:before { /* LTR. left pointing arrow */ + border-left: 0; + left: 2px; +} + +.fc-rtl .fc-timeline-event.fc-not-start .fc-title:before, +.fc-rtl .fc-body .fc-time-area .fc-following:before { /* RTL. right pointing arrow */ + border-right: 0; + right: 2px; +} + + +/* License Message +--------------------------------------------------------------------------------------------------*/ + +.fc-license-message { + position: absolute; + z-index: 99999; + bottom: 1px; + left: 1px; + background: #eee; + border-color: #ddd; + border-style: solid; + border-width: 1px 1px 0 0; + padding: 2px 4px; + font-size: 12px; + border-top-right-radius: 3px; +} diff --git a/dist/scheduler.js b/dist/scheduler.js new file mode 100644 index 000000000..3833b017b --- /dev/null +++ b/dist/scheduler.js @@ -0,0 +1,5138 @@ + +/*! +FullCalendar Scheduler v1.0.2 +Docs & License: http://fullcalendar.io/scheduler/ +(c) 2015 Adam Shaw + */ +(function(factory) { + if (typeof define === 'function' && define.amd) { + define([ 'jquery', 'moment' ], factory); + } + else { + factory(jQuery, moment); + } +})(function($, moment) {; +var COL_MIN_WIDTH, Calendar, CalendarExtension, Class, DEFAULT_GRID_DURATION, DragListener, Emitter, EventRow, FC, Grid, HRowGroup, LICENSE_INFO_URL, MAX_AUTO_CELLS, MAX_AUTO_SLOTS_PER_LABEL, MAX_CELLS, MIN_AUTO_LABELS, PRESET_LICENSE_KEYS, RELEASE_DATE, ResourceGrid, ResourceManager, ResourceRow, ResourceTimelineGrid, ResourceTimelineView, ResourceView, RowGroup, RowParent, STOCK_SUB_DURATIONS, ScrollFollower, ScrollFollowerSprite, ScrollJoiner, Scroller, Spreadsheet, TimelineGrid, TimelineView, UPGRADE_WINDOW, VRowGroup, View, applyAll, capitaliseFirstLetter, compareByFieldSpecs, computeIntervalUnit, computeOffsetForSeg, computeOffsetForSegs, copyRect, cssToStr, debounce, detectRtlScrollSystem, divideDurationByDuration, divideRangeByDuration, durationHasTime, flexibleCompare, getFirstOwnRow, getRectHeight, getRectWidth, getScrollFromLeft, getScrollbarWidths, hContainRect, hasAnyScrollbars, htmlEscape, intersectRects, intersectionToSeg, isImmuneUrl, isInt, isValidKey, joinRects, multiplyDuration, normalizedHScroll, parseFieldSpecs, processLicenseKey, proxy, renderingWarningInContainer, rtlScrollSystem, superDisplayEvents, testRectContains, testRectHContains, testRectVContains, timeRowSegsCollide, vContainRect, + slice = [].slice, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +FC = $.fullCalendar; + +Calendar = FC.Calendar; + +Class = FC.Class; + +View = FC.View; + +Grid = FC.Grid; + +intersectionToSeg = FC.intersectionToSeg; + +debounce = FC.debounce; + +isInt = FC.isInt; + +getScrollbarWidths = FC.getScrollbarWidths; + +DragListener = FC.DragListener; + +htmlEscape = FC.htmlEscape; + +computeIntervalUnit = FC.computeIntervalUnit; + +proxy = FC.proxy; + +capitaliseFirstLetter = FC.capitaliseFirstLetter; + +applyAll = FC.applyAll; + +Emitter = FC.Emitter; + +durationHasTime = FC.durationHasTime; + +divideRangeByDuration = FC.divideRangeByDuration; + +divideDurationByDuration = FC.divideDurationByDuration; + +multiplyDuration = FC.multiplyDuration; + +parseFieldSpecs = FC.parseFieldSpecs; + +compareByFieldSpecs = FC.compareByFieldSpecs; + +flexibleCompare = FC.flexibleCompare; + +intersectRects = FC.intersectRects; + + +/* +Gets the first cell that doesn't have a multi-row rowspan. +Accepts a jQuery object of one or more TRs and returns the first TD for each. +Would use the [rowspan] selector, but never not defined in IE8. + */ + +getFirstOwnRow = function(trs) { + return trs.map(function(i, trNode) { + var j, len, ref, tdNode; + ref = $(trNode).find('> td'); + for (j = 0, len = ref.length; j < len; j++) { + tdNode = ref[j]; + if (tdNode.rowSpan <= 1) { + return tdNode; + } + } + }); +}; + +rtlScrollSystem = null; + +normalizedHScroll = function(el, val) { + var direction, node; + direction = el.css('direction'); + node = el[0]; + if (val != null) { + if (direction === 'rtl') { + switch (rtlScrollSystem) { + case 'positive': + val = val - node.clientWidth + node.scrollWidth; + break; + case 'reverse': + val = -val; + } + } + node.scrollLeft = val; + return el; + } else { + val = node.scrollLeft; + if (direction === 'rtl') { + switch (rtlScrollSystem) { + case 'positive': + val = val + node.clientWidth - node.scrollWidth; + break; + case 'reverse': + val = -val; + } + } + return val; + } +}; + +getScrollFromLeft = function(el) { + var direction, node, val; + direction = el.css('direction'); + node = el[0]; + val = node.scrollLeft; + if (direction === 'rtl') { + switch (rtlScrollSystem) { + case 'negative': + val = val - node.clientWidth + node.scrollWidth; + break; + case 'reverse': + val = -val - node.clientWidth + node.scrollWidth; + } + } + return val; +}; + +detectRtlScrollSystem = function() { + var el, node, system; + el = $('
A
').appendTo('body'); + node = el[0]; + system = node.scrollLeft > 0 ? 'positive' : (node.scrollLeft = 1, el.scrollLeft > 0 ? 'reverse' : 'negative'); + el.remove(); + return system; +}; + +$(function() { + return rtlScrollSystem = detectRtlScrollSystem(); +}); + +Scroller = (function() { + Scroller.prototype.el = null; + + Scroller.prototype.innerEl = null; + + Scroller.prototype.contentEl = null; + + Scroller.prototype.bgEl = null; + + Scroller.prototype.overflowX = null; + + Scroller.prototype.overflowY = null; + + Scroller.prototype.isScrolling = false; + + Scroller.prototype.handlers = null; + + Scroller.prototype.height = null; + + Scroller.prototype.contentWidth = null; + + Scroller.prototype.contentMinWidth = null; + + Scroller.prototype.gutters = null; + + + /* + Potential overflowX / overflowY values: + 'hidden', 'scroll', 'invisible-scroll', 'auto' + */ + + function Scroller(overflowX1, overflowY1) { + this.overflowX = overflowX1 != null ? overflowX1 : 'auto'; + this.overflowY = overflowY1 != null ? overflowY1 : 'auto'; + this.el = $('
'); + this.scrollEl = this.el.children(); + this.innerEl = this.scrollEl.children(); + this.contentEl = this.innerEl.find('.fc-content'); + this.bgEl = this.innerEl.find('.fc-bg'); + this.scrollEl.on('scroll', proxy(this, 'handleScroll')).on('scroll', debounce(proxy(this, 'handleScrollStop'), 100)); + this.handlers = {}; + this.gutters = {}; + } + + + /* + TODO: automatically call this on window resize? (potential scrollbar width change) + */ + + Scroller.prototype.update = function() { + var cssProps, isInvisibleScrollX, isInvisibleScrollY, overflowX, overflowY, scrollEl, scrollbarWidths; + scrollEl = this.scrollEl; + overflowX = this.overflowX; + overflowY = this.overflowY; + isInvisibleScrollX = overflowX === 'invisible-scroll'; + isInvisibleScrollY = overflowY === 'invisible-scroll'; + scrollEl.toggleClass('fc-no-scrollbars', (isInvisibleScrollX || overflowX === 'hidden') && (isInvisibleScrollY || overflowY === 'hidden') && !hasAnyScrollbars(scrollEl)); + scrollEl.css({ + overflowX: isInvisibleScrollX ? 'scroll' : overflowX, + overflowY: isInvisibleScrollY ? 'scroll' : overflowY + }); + cssProps = { + marginLeft: 0, + marginRight: 0, + marginTop: 0, + marginBottom: 0 + }; + if (isInvisibleScrollX || isInvisibleScrollY) { + scrollbarWidths = getScrollbarWidths(scrollEl); + if (isInvisibleScrollX) { + cssProps.marginTop = -scrollbarWidths.top; + cssProps.marginBottom = -scrollbarWidths.bottom; + } + if (isInvisibleScrollY) { + cssProps.marginLeft = -scrollbarWidths.left; + cssProps.marginRight = -scrollbarWidths.right; + } + } + return scrollEl.css(cssProps); + }; + + Scroller.prototype.getScrollbarWidths = function() { + var scrollbarWidths; + scrollbarWidths = getScrollbarWidths(this.scrollEl); + if (this.overflowX === 'invisible-scroll') { + scrollbarWidths.top = 0; + scrollbarWidths.bottom = 0; + } + if (this.overflowY === 'invisible-scroll') { + scrollbarWidths.left = 0; + scrollbarWidths.right = 0; + } + return scrollbarWidths; + }; + + Scroller.prototype.handleScroll = function() { + if (!this.isScrolling) { + this.isScrolling = true; + this.trigger('scrollStart'); + } + return this.trigger('scroll', this.scrollEl.scrollTop(), this.scrollEl.scrollLeft()); + }; + + Scroller.prototype.handleScrollStop = function() { + this.isScrolling = false; + return this.trigger('scrollStop'); + }; + + Scroller.prototype.setHeight = function(height1) { + this.height = height1; + return this.updateCss(); + }; + + Scroller.prototype.getHeight = function() { + var ref; + return (ref = this.height) != null ? ref : this.scrollEl.height(); + }; + + Scroller.prototype.setContentWidth = function(contentWidth) { + this.contentWidth = contentWidth; + return this.updateCss(); + }; + + Scroller.prototype.setContentMinWidth = function(contentMinWidth) { + this.contentMinWidth = contentMinWidth; + return this.updateCss(); + }; + + Scroller.prototype.setGutters = function(gutters) { + if (!gutters) { + this.gutters = {}; + } else { + $.extend(this.gutters, gutters); + } + return this.updateCss(); + }; + + Scroller.prototype.updateCss = function() { + var gutters; + this.scrollEl.height(this.height); + gutters = this.gutters; + this.innerEl.css({ + width: this.contentWidth ? this.contentWidth + (gutters.left || 0) + (gutters.right || 0) : '', + minWidth: this.contentMinWidth ? this.contentMinWidth + (gutters.left || 0) + (gutters.right || 0) : void 0, + paddingLeft: gutters.left || '', + paddingRight: gutters.right || '', + paddingTop: gutters.top || '', + paddingBottom: gutters.bottom || '' + }); + return this.bgEl.css({ + left: gutters.left || '', + right: gutters.right || '', + top: gutters.top || '', + bottom: gutters.bottom || '' + }); + }; + + Scroller.prototype.append = function(content) { + return this.contentEl.append(content); + }; + + Scroller.prototype.scrollTop = function(top) { + return this.scrollEl.scrollTop(top); + }; + + Scroller.prototype.scrollLeft = function(left) { + return this.scrollEl.scrollLeft(left); + }; + + Scroller.prototype.on = function(handlerName, handler) { + var base; + ((base = this.handlers)[handlerName] || (base[handlerName] = [])).push(handler); + return this; + }; + + Scroller.prototype.trigger = function() { + var args, handler, handlerName, j, len, ref; + handlerName = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : []; + ref = this.handlers[handlerName] || []; + for (j = 0, len = ref.length; j < len; j++) { + handler = ref[j]; + handler.apply(this, args); + } + }; + + return Scroller; + +})(); + +hasAnyScrollbars = function(el) { + var scrollbarWidths; + scrollbarWidths = getScrollbarWidths(el); + return scrollbarWidths.left || scrollbarWidths.right || scrollbarWidths.top || scrollbarWidths.bottom; +}; + +ScrollJoiner = (function() { + ScrollJoiner.prototype.axis = null; + + ScrollJoiner.prototype.scrollers = null; + + ScrollJoiner.prototype.masterScroller = null; + + ScrollJoiner.prototype.enabled = true; + + function ScrollJoiner(axis, scrollers) { + var j, len, ref, scroller; + this.axis = axis; + this.scrollers = scrollers; + ref = this.scrollers; + for (j = 0, len = ref.length; j < len; j++) { + scroller = ref[j]; + this.initScroller(scroller); + } + } + + ScrollJoiner.prototype.enable = function() { + return this.enabled = true; + }; + + ScrollJoiner.prototype.disable = function() { + return this.enabled = false; + }; + + ScrollJoiner.prototype.initScroller = function(scroller) { + return scroller.on('scrollStart', (function(_this) { + return function() { + if (!_this.masterScroller) { + _this.masterScroller = scroller; + } + }; + })(this)).on('scroll', (function(_this) { + return function(scrollTop, scrollLeft) { + var j, len, otherScroller, ref; + if (scroller === _this.masterScroller) { + ref = _this.scrollers; + for (j = 0, len = ref.length; j < len; j++) { + otherScroller = ref[j]; + if (otherScroller !== _this.masterScroller) { + switch (_this.axis) { + case 'horizontal': + otherScroller.scrollLeft(scrollLeft); + break; + case 'vertical': + otherScroller.scrollTop(scrollTop); + } + } + } + } + }; + })(this)).on('scrollStop', (function(_this) { + return function() { + if (scroller === _this.masterScroller) { + _this.masterScroller = null; + } + }; + })(this)); + }; + + ScrollJoiner.prototype.update = function() { + var allWidths, i, j, k, len, len1, maxBottom, maxLeft, maxRight, maxTop, ref, scroller, widths; + allWidths = (function() { + var j, len, ref, results; + ref = this.scrollers; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + scroller = ref[j]; + results.push(scroller.getScrollbarWidths()); + } + return results; + }).call(this); + maxLeft = maxRight = maxTop = maxBottom = 0; + for (j = 0, len = allWidths.length; j < len; j++) { + widths = allWidths[j]; + maxLeft = Math.max(maxLeft, widths.left); + maxRight = Math.max(maxRight, widths.right); + maxTop = Math.max(maxTop, widths.top); + maxBottom = Math.max(maxBottom, widths.bottom); + } + ref = this.scrollers; + for (i = k = 0, len1 = ref.length; k < len1; i = ++k) { + scroller = ref[i]; + widths = allWidths[i]; + scroller.setGutters(this.axis === 'horizontal' ? { + left: maxLeft - widths.left, + right: maxRight - widths.right + } : { + top: maxTop - widths.top, + bottom: maxBottom - widths.bottom + }); + } + }; + + return ScrollJoiner; + +})(); + +ScrollFollower = (function() { + ScrollFollower.prototype.scroller = null; + + ScrollFollower.prototype.scrollbarWidths = null; + + ScrollFollower.prototype.sprites = null; + + ScrollFollower.prototype.viewportRect = null; + + ScrollFollower.prototype.contentOffset = null; + + ScrollFollower.prototype.isHFollowing = true; + + ScrollFollower.prototype.isVFollowing = false; + + ScrollFollower.prototype.containOnNaturalLeft = false; + + ScrollFollower.prototype.containOnNaturalRight = false; + + ScrollFollower.prototype.shouldRequeryDimensions = false; + + ScrollFollower.prototype.minTravel = 0; + + ScrollFollower.prototype.isForcedAbsolute = false; + + ScrollFollower.prototype.isForcedRelative = false; + + function ScrollFollower(scroller1) { + this.scroller = scroller1; + this.sprites = []; + this.scroller.on('scrollStart', (function(_this) { + return function() { + if (_this.shouldRequeryDimensions) { + return _this.cacheDimensions(); + } + }; + })(this)); + this.scroller.on('scroll', (function(_this) { + return function(scrollTop, scrollLeft) { + var left, scrollEl, top; + scrollEl = _this.scroller.scrollEl; + left = getScrollFromLeft(scrollEl); + top = scrollEl.scrollTop(); + _this.viewportRect = { + left: left, + right: left + scrollEl[0].clientWidth, + top: top, + bottom: top + scrollEl[0].clientHeight + }; + return _this.updatePositions(); + }; + })(this)); + } + + ScrollFollower.prototype.setSprites = function(sprites) { + var j, len, sprite; + this.clearSprites(); + if (sprites instanceof $) { + return this.sprites = (function() { + var j, len, results; + results = []; + for (j = 0, len = sprites.length; j < len; j++) { + sprite = sprites[j]; + results.push(new ScrollFollowerSprite($(sprite), this)); + } + return results; + }).call(this); + } else { + for (j = 0, len = sprites.length; j < len; j++) { + sprite = sprites[j]; + sprite.follower = this; + } + return this.sprites = sprites; + } + }; + + ScrollFollower.prototype.clearSprites = function() { + var j, len, ref, sprite; + ref = this.sprites; + for (j = 0, len = ref.length; j < len; j++) { + sprite = ref[j]; + sprite.clear(); + } + return this.sprites = []; + }; + + ScrollFollower.prototype.cacheDimensions = function() { + var j, left, len, ref, scrollEl, sprite, top; + scrollEl = this.scroller.scrollEl; + left = getScrollFromLeft(scrollEl); + top = scrollEl.scrollTop(); + this.viewportRect = { + left: left, + right: left + scrollEl[0].clientWidth, + top: top, + bottom: top + scrollEl[0].clientHeight + }; + this.scrollbarWidths = this.scroller.getScrollbarWidths(); + this.contentOffset = this.scroller.innerEl.offset(); + ref = this.sprites; + for (j = 0, len = ref.length; j < len; j++) { + sprite = ref[j]; + sprite.cacheDimensions(); + } + }; + + ScrollFollower.prototype.forceAbsolute = function() { + var j, len, ref, results, sprite; + this.isForcedAbsolute = true; + ref = this.sprites; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + sprite = ref[j]; + if (!sprite.doAbsolute) { + results.push(sprite.assignPosition()); + } else { + results.push(void 0); + } + } + return results; + }; + + ScrollFollower.prototype.forceRelative = function() { + var j, len, ref, results, sprite; + this.isForcedRelative = true; + ref = this.sprites; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + sprite = ref[j]; + if (sprite.doAbsolute) { + results.push(sprite.assignPosition()); + } else { + results.push(void 0); + } + } + return results; + }; + + ScrollFollower.prototype.clearForce = function() { + var j, len, ref, results, sprite; + this.isForcedRelative = false; + this.isForcedAbsolute = false; + ref = this.sprites; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + sprite = ref[j]; + results.push(sprite.assignPosition()); + } + return results; + }; + + ScrollFollower.prototype.update = function() { + this.cacheDimensions(); + return this.updatePositions(); + }; + + ScrollFollower.prototype.updatePositions = function() { + var j, len, ref, sprite; + ref = this.sprites; + for (j = 0, len = ref.length; j < len; j++) { + sprite = ref[j]; + sprite.updatePosition(); + } + }; + + ScrollFollower.prototype.getContentRect = function(el) { + var left, res, top; + res = el.offset(); + left = res.left + parseFloat(el.css('border-left-width')) + parseFloat(el.css('padding-left')) - this.contentOffset.left; + top = res.top + parseFloat(el.css('border-left-width')) + parseFloat(el.css('padding-left')) - this.contentOffset.top; + return { + left: left, + right: left + el.width(), + top: top, + bottom: top + el.height() + }; + }; + + ScrollFollower.prototype.getBoundingRect = function(el) { + var left, res, top; + res = el.offset(); + left = res.left - this.contentOffset.left; + top = res.top - this.contentOffset.top; + return { + left: left, + right: left + el.outerWidth(), + top: top, + bottom: top + el.outerHeight() + }; + }; + + return ScrollFollower; + +})(); + +ScrollFollowerSprite = (function() { + ScrollFollowerSprite.prototype.follower = null; + + ScrollFollowerSprite.prototype.el = null; + + ScrollFollowerSprite.prototype.absoluteEl = null; + + ScrollFollowerSprite.prototype.naturalRect = null; + + ScrollFollowerSprite.prototype.parentRect = null; + + ScrollFollowerSprite.prototype.containerRect = null; + + ScrollFollowerSprite.prototype.isEnabled = true; + + ScrollFollowerSprite.prototype.isHFollowing = false; + + ScrollFollowerSprite.prototype.isVFollowing = false; + + ScrollFollowerSprite.prototype.doAbsolute = false; + + ScrollFollowerSprite.prototype.isAbsolute = false; + + ScrollFollowerSprite.prototype.isCentered = false; + + ScrollFollowerSprite.prototype.rect = null; + + ScrollFollowerSprite.prototype.isBlock = false; + + ScrollFollowerSprite.prototype.naturalWidth = null; + + function ScrollFollowerSprite(el1, follower1) { + this.el = el1; + this.follower = follower1 != null ? follower1 : null; + this.isBlock = this.el.css('display') === 'block'; + this.el.css('position', 'relative'); + } + + ScrollFollowerSprite.prototype.disable = function() { + if (this.isEnabled) { + this.isEnabled = false; + this.resetPosition(); + return this.unabsolutize(); + } + }; + + ScrollFollowerSprite.prototype.enable = function() { + if (!this.isEnabled) { + this.isEnabled = true; + return this.assignPosition(); + } + }; + + ScrollFollowerSprite.prototype.clear = function() { + this.disable(); + this.follower = null; + return this.absoluteEl = null; + }; + + ScrollFollowerSprite.prototype.cacheDimensions = function() { + var containerRect, follower, isCentered, isHFollowing, isVFollowing, minTravel, naturalRect, parentEl; + isHFollowing = false; + isVFollowing = false; + isCentered = false; + this.naturalWidth = this.el.width(); + this.resetPosition(); + follower = this.follower; + naturalRect = this.naturalRect = follower.getBoundingRect(this.el); + parentEl = this.el.parent(); + this.parentRect = follower.getBoundingRect(parentEl); + containerRect = this.containerRect = joinRects(follower.getContentRect(parentEl), naturalRect); + minTravel = follower.minTravel; + if (follower.containOnNaturalLeft) { + containerRect.left = naturalRect.left; + } + if (follower.containOnNaturalRight) { + containerRect.right = naturalRect.right; + } + if (follower.isHFollowing) { + if (getRectWidth(containerRect) - getRectWidth(naturalRect) >= minTravel) { + isCentered = this.el.css('text-align') === 'center'; + isHFollowing = true; + } + } + if (follower.isVFollowing) { + if (getRectHeight(containerRect) - getRectHeight(naturalRect) >= minTravel) { + isVFollowing = true; + } + } + this.isHFollowing = isHFollowing; + this.isVFollowing = isVFollowing; + return this.isCentered = isCentered; + }; + + ScrollFollowerSprite.prototype.updatePosition = function() { + this.computePosition(); + return this.assignPosition(); + }; + + ScrollFollowerSprite.prototype.resetPosition = function() { + return this.el.css({ + top: '', + left: '' + }); + }; + + ScrollFollowerSprite.prototype.computePosition = function() { + var containerRect, doAbsolute, parentRect, rect, rectWidth, subjectRect, viewportRect, visibleParentRect; + viewportRect = this.follower.viewportRect; + parentRect = this.parentRect; + containerRect = this.containerRect; + visibleParentRect = intersectRects(viewportRect, parentRect); + rect = null; + doAbsolute = false; + if (visibleParentRect) { + rect = copyRect(this.naturalRect); + subjectRect = intersectRects(rect, parentRect); + if ((this.isCentered && !testRectContains(viewportRect, parentRect)) || (subjectRect && !testRectContains(viewportRect, subjectRect))) { + doAbsolute = true; + if (this.isHFollowing) { + if (this.isCentered) { + rectWidth = getRectWidth(rect); + rect.left = (visibleParentRect.left + visibleParentRect.right) / 2 - rectWidth / 2; + rect.right = rect.left + rectWidth; + } else { + if (!hContainRect(rect, viewportRect)) { + doAbsolute = false; + } + } + if (hContainRect(rect, containerRect)) { + doAbsolute = false; + } + } + if (this.isVFollowing) { + if (!vContainRect(rect, viewportRect)) { + doAbsolute = false; + } + if (vContainRect(rect, containerRect)) { + doAbsolute = false; + } + } + if (!testRectContains(viewportRect, rect)) { + doAbsolute = false; + } + } + } + this.rect = rect; + return this.doAbsolute = doAbsolute; + }; + + ScrollFollowerSprite.prototype.assignPosition = function() { + var left, top; + if (this.isEnabled) { + if (!this.rect) { + return this.unabsolutize(); + } else if ((this.doAbsolute || this.follower.isForcedAbsolute) && !this.follower.isForcedRelative) { + this.absolutize(); + return this.absoluteEl.css({ + top: this.rect.top - this.follower.viewportRect.top + this.follower.scrollbarWidths.top, + left: this.rect.left - this.follower.viewportRect.left + this.follower.scrollbarWidths.left, + width: this.isBlock ? this.naturalWidth : '' + }); + } else { + top = this.rect.top - this.naturalRect.top; + left = this.rect.left - this.naturalRect.left; + this.unabsolutize(); + return this.el.toggleClass('fc-following', Boolean(top || left)).css({ + top: top, + left: left + }); + } + } + }; + + ScrollFollowerSprite.prototype.absolutize = function() { + if (!this.isAbsolute) { + if (!this.absoluteEl) { + this.absoluteEl = this.buildAbsoluteEl(); + } + this.absoluteEl.appendTo(this.follower.scroller.el); + this.el.css('visibility', 'hidden'); + return this.isAbsolute = true; + } + }; + + ScrollFollowerSprite.prototype.unabsolutize = function() { + if (this.isAbsolute) { + this.absoluteEl.detach(); + this.el.css('visibility', ''); + return this.isAbsolute = false; + } + }; + + ScrollFollowerSprite.prototype.buildAbsoluteEl = function() { + return this.el.clone().addClass('fc-following').css({ + 'position': 'absolute', + 'z-index': 1000, + 'font-weight': this.el.css('font-weight'), + 'font-size': this.el.css('font-size'), + 'font-family': this.el.css('font-family'), + 'color': this.el.css('color'), + 'padding-top': this.el.css('padding-top'), + 'padding-bottom': this.el.css('padding-bottom'), + 'padding-left': this.el.css('padding-left'), + 'padding-right': this.el.css('padding-right'), + 'pointer-events': 'none' + }); + }; + + return ScrollFollowerSprite; + +})(); + +copyRect = function(rect) { + return { + left: rect.left, + right: rect.right, + top: rect.top, + bottom: rect.bottom + }; +}; + +getRectWidth = function(rect) { + return rect.right - rect.left; +}; + +getRectHeight = function(rect) { + return rect.bottom - rect.top; +}; + +testRectContains = function(rect, innerRect) { + return testRectHContains(rect, innerRect) && testRectVContains(rect, innerRect); +}; + +testRectHContains = function(rect, innerRect) { + return innerRect.left >= rect.left && innerRect.right <= rect.right; +}; + +testRectVContains = function(rect, innerRect) { + return innerRect.top >= rect.top && innerRect.bottom <= rect.bottom; +}; + +hContainRect = function(rect, outerRect) { + if (rect.left < outerRect.left) { + rect.right = outerRect.left + getRectWidth(rect); + rect.left = outerRect.left; + return true; + } else if (rect.right > outerRect.right) { + rect.left = outerRect.right - getRectWidth(rect); + rect.right = outerRect.right; + return true; + } else { + return false; + } +}; + +vContainRect = function(rect, outerRect) { + if (rect.top < outerRect.top) { + rect.bottom = outerRect.top + getRectHeight(rect); + rect.top = outerRect.top; + return true; + } else if (rect.bottom > outerRect.bottom) { + rect.top = outerRect.bottom - getRectHeight(rect); + rect.bottom = outerRect.bottom; + return true; + } else { + return false; + } +}; + +joinRects = function(rect1, rect2) { + return { + left: Math.min(rect1.left, rect2.left), + right: Math.max(rect1.right, rect2.right), + top: Math.min(rect1.top, rect2.top), + bottom: Math.max(rect1.bottom, rect2.bottom) + }; +}; + +CalendarExtension = (function(superClass) { + extend(CalendarExtension, superClass); + + function CalendarExtension() { + return CalendarExtension.__super__.constructor.apply(this, arguments); + } + + CalendarExtension.prototype.resourceManager = null; + + CalendarExtension.prototype.initialize = function() { + return this.resourceManager = new ResourceManager(this); + }; + + CalendarExtension.prototype.instantiateView = function(viewType) { + var spec, viewClass; + spec = this.getViewSpec(viewType); + viewClass = spec['class']; + if (this.options.resources && spec.options.resources !== false && spec.resourceClass) { + viewClass = spec.resourceClass; + } + return new viewClass(this, viewType, spec.options, spec.duration); + }; + + CalendarExtension.prototype.getResources = function() { + return this.resourceManager.topLevelResources; + }; + + CalendarExtension.prototype.addResource = function(resourceInput, scroll) { + var promise; + if (scroll == null) { + scroll = false; + } + promise = this.resourceManager.addResource(resourceInput); + if (scroll && this.view.scrollToResource) { + promise.done((function(_this) { + return function(resource) { + return _this.view.scrollToResource(resource); + }; + })(this)); + } + }; + + CalendarExtension.prototype.removeResource = function(idOrResource) { + return this.resourceManager.removeResource(idOrResource); + }; + + CalendarExtension.prototype.refetchResources = function() { + this.resourceManager.fetchResources(); + }; + + CalendarExtension.prototype.rerenderResources = function() { + var base; + if (typeof (base = this.view).redisplayResources === "function") { + base.redisplayResources(); + } + }; + + CalendarExtension.prototype.getEventResourceId = function(event) { + return this.resourceManager.getEventResourceId(event); + }; + + CalendarExtension.prototype.getPeerEvents = function(event, range) { + var filteredPeerEvents, j, len, peerEvent, peerEvents, peerResourceId, rangeResourceId; + peerEvents = CalendarExtension.__super__.getPeerEvents.apply(this, arguments); + rangeResourceId = range.resourceId || ''; + filteredPeerEvents = []; + for (j = 0, len = peerEvents.length; j < len; j++) { + peerEvent = peerEvents[j]; + peerResourceId = this.getEventResourceId(peerEvent) || ''; + if (!peerResourceId || peerResourceId === rangeResourceId) { + filteredPeerEvents.push(peerEvent); + } + } + return filteredPeerEvents; + }; + + CalendarExtension.prototype.buildSelectRange = function(start, end, resourceId) { + var range; + range = CalendarExtension.__super__.buildSelectRange.apply(this, arguments); + if (resourceId) { + range.resourceId = resourceId; + } + return range; + }; + + CalendarExtension.prototype.getResourceById = function(id) { + return this.resourceManager.getResourceById(id); + }; + + CalendarExtension.prototype.getResourceEvents = function(idOrResource) { + var eventResourceField, resource; + resource = typeof idOrResource === 'object' ? idOrResource : this.getResourceById(idOrResource); + if (resource) { + eventResourceField = this.resourceManager.getEventResourceField(); + return this.clientEvents(function(event) { + return event[eventResourceField] === resource.id; + }); + } else { + return []; + } + }; + + CalendarExtension.prototype.getEventResource = function(idOrEvent) { + var event, resourceId; + event = typeof idOrEvent === 'object' ? idOrEvent : this.clientEvents(idOrEvent)[0]; + if (event) { + resourceId = this.resourceManager.getEventResourceId(event); + return this.getResourceById(resourceId); + } + return null; + }; + + return CalendarExtension; + +})(Calendar); + +Calendar.prototype = CalendarExtension.prototype; + +superDisplayEvents = View.prototype.displayEvents; + +View.prototype.displayEvents = function(events) { + this.listenToResources(); + processLicenseKey(this.calendar.options.schedulerLicenseKey, this.el); + return this.calendar.resourceManager.getResources().then((function(_this) { + return function() { + return superDisplayEvents.call(_this, events); + }; + })(this)); +}; + +View.prototype.isListeningToResources = false; + +View.prototype.listenToResources = function() { + if (!this.isListeningToResources) { + this.calendar.resourceManager.on('add', proxy(this, 'addResource')).on('remove', proxy(this, 'removeResource')).on('reset', proxy(this, 'resetResources')); + return this.isListeningToResources = true; + } +}; + +View.prototype.addResource = function(resource) { + return this.calendar.rerenderEvents(); +}; + +View.prototype.removeResource = function(resource) { + return this.calendar.rerenderEvents(); +}; + +View.prototype.resetResources = function(resources) { + return this.calendar.rerenderEvents(); +}; + +Grid.prototype.getEventSkinCss = function(event) { + var eventColor, getResourceBackgroundColor, getResourceBorderColor, getResourceTextColor, optionColor, resource, source, sourceColor, view; + view = this.view; + source = event.source || {}; + eventColor = event.color; + sourceColor = source.color; + optionColor = view.opt('eventColor'); + resource = view.calendar.getEventResource(event); + getResourceBackgroundColor = function() { + var currentResource, val; + val = null; + currentResource = resource; + while (currentResource && !val) { + val = currentResource.eventBackgroundColor || currentResource.eventColor; + currentResource = currentResource._parent; + } + return val; + }; + getResourceBorderColor = function() { + var currentResource, val; + val = null; + currentResource = resource; + while (currentResource && !val) { + val = currentResource.eventBorderColor || currentResource.eventColor; + currentResource = currentResource._parent; + } + return val; + }; + getResourceTextColor = function() { + var currentResource, val; + val = null; + currentResource = resource; + while (currentResource && !val) { + val = currentResource.eventTextColor; + currentResource = currentResource._parent; + } + return val; + }; + return { + 'background-color': event.backgroundColor || eventColor || getResourceBackgroundColor() || source.backgroundColor || sourceColor || view.opt('eventBackgroundColor') || optionColor, + 'border-color': event.borderColor || eventColor || getResourceBorderColor() || source.borderColor || sourceColor || view.opt('eventBorderColor') || optionColor, + 'color': event.textColor || getResourceTextColor() || source.textColor || view.opt('eventTextColor') + }; +}; + +ResourceManager = (function(superClass) { + extend(ResourceManager, superClass); + + ResourceManager.mixin(Emitter); + + ResourceManager.resourceGuid = 1; + + ResourceManager.ajaxDefaults = { + dataType: 'json', + cache: false + }; + + ResourceManager.prototype.calendar = null; + + ResourceManager.prototype.topLevelResources = null; + + ResourceManager.prototype.resourcesById = null; + + ResourceManager.prototype.fetching = null; + + function ResourceManager(calendar) { + this.calendar = calendar; + this.unsetResources(); + } + + ResourceManager.prototype.getResources = function() { + var getting; + if (!this.fetching) { + getting = $.Deferred(); + this.fetchResources().done(function(resources) { + return getting.resolve(resources); + }).fail(function() { + return getting.resolve([]); + }); + return getting; + } else { + return $.Deferred().resolve(this.topLevelResources).promise(); + } + }; + + ResourceManager.prototype.fetchResources = function() { + var prevFetching; + prevFetching = this.fetching; + return $.when(prevFetching).then((function(_this) { + return function() { + return _this.fetching = _this.fetchResourceInputs().then(function(resourceInputs) { + _this.setResources(resourceInputs); + if (prevFetching) { + _this.trigger('reset', _this.topLevelResources); + } + return _this.topLevelResources; + }); + }; + })(this)); + }; + + ResourceManager.prototype.fetchResourceInputs = function() { + var deferred, promise, source; + deferred = $.Deferred(); + source = this.calendar.options['resources']; + if ($.type(source) === 'string') { + source = { + url: source + }; + } + switch ($.type(source)) { + case 'function': + source((function(_this) { + return function(resourceInputs) { + return deferred.resolve(resourceInputs); + }; + })(this)); + break; + case 'object': + promise = $.ajax($.extend({}, ResourceManager.ajaxDefaults, source)); + break; + case 'array': + deferred.resolve(source); + break; + default: + deferred.resolve([]); + } + promise || (promise = deferred.promise()); + if (!promise.state() === 'pending') { + this.calendar.pushLoading(); + promise.always(function() { + return this.calendar.popLoading(); + }); + } + return promise; + }; + + ResourceManager.prototype.getResourceById = function(id) { + return this.resourcesById[id]; + }; + + ResourceManager.prototype.unsetResources = function() { + this.topLevelResources = []; + return this.resourcesById = {}; + }; + + ResourceManager.prototype.setResources = function(resourceInputs) { + var j, len, resource, resourceInput, resources, validResources; + this.unsetResources(); + resources = (function() { + var j, len, results; + results = []; + for (j = 0, len = resourceInputs.length; j < len; j++) { + resourceInput = resourceInputs[j]; + results.push(this.buildResource(resourceInput)); + } + return results; + }).call(this); + validResources = (function() { + var j, len, results; + results = []; + for (j = 0, len = resources.length; j < len; j++) { + resource = resources[j]; + if (this.addResourceToIndex(resource)) { + results.push(resource); + } + } + return results; + }).call(this); + for (j = 0, len = validResources.length; j < len; j++) { + resource = validResources[j]; + this.addResourceToTree(resource); + } + return this.calendar.trigger('resourcesSet', null, this.topLevelResources); + }; + + ResourceManager.prototype.addResource = function(resourceInput) { + return $.when(this.fetching).then((function(_this) { + return function() { + var resource; + resource = _this.buildResource(resourceInput); + if (_this.addResourceToIndex(resource)) { + _this.addResourceToTree(resource); + _this.trigger('add', resource); + return resource; + } else { + return false; + } + }; + })(this)); + }; + + ResourceManager.prototype.addResourceToIndex = function(resource) { + var child, j, len, ref; + if (this.resourcesById[resource.id]) { + return false; + } else { + this.resourcesById[resource.id] = resource; + ref = resource.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + this.addResourceToIndex(child); + } + return true; + } + }; + + ResourceManager.prototype.addResourceToTree = function(resource) { + var parent, parentId, siblings; + if (!resource.parent) { + parentId = String(resource[this.getResourceParentField()] || ''); + if (parentId) { + parent = this.resourcesById[parentId]; + if (parent) { + resource.parent = parent; + siblings = parent.children; + } else { + return false; + } + } else { + siblings = this.topLevelResources; + } + siblings.push(resource); + } + return true; + }; + + ResourceManager.prototype.removeResource = function(idOrResource) { + var id; + id = typeof idOrResource === 'object' ? idOrResource.id : idOrResource; + return $.when(this.fetching).then((function(_this) { + return function() { + var resource; + resource = _this.removeResourceFromIndex(id); + if (resource) { + _this.removeResourceFromTree(resource); + _this.trigger('remove', resource); + } + return resource; + }; + })(this)); + }; + + ResourceManager.prototype.removeResourceFromIndex = function(resourceId) { + var child, j, len, ref, resource; + resource = this.resourcesById[resourceId]; + if (resource) { + delete this.resourcesById[resourceId]; + ref = resource.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + this.removeResourceFromIndex(child.id); + } + return resource; + } else { + return false; + } + }; + + ResourceManager.prototype.removeResourceFromTree = function(resource, siblings) { + var i, j, len, sibling; + if (siblings == null) { + siblings = this.topLevelResources; + } + for (i = j = 0, len = siblings.length; j < len; i = ++j) { + sibling = siblings[i]; + if (sibling === resource) { + resource.parent = null; + siblings.splice(i, 1); + return true; + } + if (this.removeResourceFromTree(resource, sibling.children)) { + return true; + } + } + return false; + }; + + ResourceManager.prototype.buildResource = function(resourceInput) { + var child, childInput, rawClassName, ref, resource; + resource = $.extend({}, resourceInput); + resource.id = String(((ref = resourceInput.id) != null ? ref : '_fc' + (ResourceManager.resourceGuid++)) || ''); + rawClassName = resourceInput.eventClassName; + resource.eventClassName = (function() { + switch ($.type(rawClassName)) { + case 'string': + return rawClassName.split(/\s+/); + case 'array': + return rawClassName; + default: + return []; + } + })(); + resource.children = (function() { + var j, len, ref1, ref2, results; + ref2 = (ref1 = resourceInput.children) != null ? ref1 : []; + results = []; + for (j = 0, len = ref2.length; j < len; j++) { + childInput = ref2[j]; + child = this.buildResource(childInput); + child.parent = resource; + results.push(child); + } + return results; + }).call(this); + return resource; + }; + + ResourceManager.prototype.getResourceParentField = function() { + return this.calendar.options['resourceParentField'] || 'parentId'; + }; + + ResourceManager.prototype.getEventResourceId = function(event) { + return String(event[this.getEventResourceField()] || ''); + }; + + ResourceManager.prototype.setEventResourceId = function(event, resourceId) { + return event[this.getEventResourceField()] = String(resourceId || ''); + }; + + ResourceManager.prototype.getEventResourceField = function() { + return this.calendar.options['eventResourceField'] || 'resourceId'; + }; + + return ResourceManager; + +})(Class); + +ResourceView = (function(superClass) { + extend(ResourceView, superClass); + + function ResourceView() { + return ResourceView.__super__.constructor.apply(this, arguments); + } + + ResourceView.prototype.displayingResources = null; + + ResourceView.prototype.assigningResources = null; + + ResourceView.prototype.displayView = function() { + return $.when(ResourceView.__super__.displayView.apply(this, arguments)).then((function(_this) { + return function() { + return _this.displayResources(); + }; + })(this)); + }; + + ResourceView.prototype.displayEvents = function(events) { + return $.when(this.displayResources()).then((function(_this) { + return function() { + return ResourceView.__super__.displayEvents.call(_this, events); + }; + })(this)); + }; + + ResourceView.prototype.unrenderSkeleton = function() { + return this.clearResources(); + }; + + ResourceView.prototype.displayResources = function() { + this.listenToResources(); + return $.when(this.displayingResources).then((function(_this) { + return function() { + return _this.displayingResources || (_this.displayingResources = _this.assignResources().then(function() { + return _this.renderStoredResources(); + })); + }; + })(this)); + }; + + ResourceView.prototype.clearResources = function() { + var displaying; + displaying = this.displayingResources; + if (displaying) { + return displaying.then((function(_this) { + return function() { + _this.clearEvents(); + _this.unrenderStoredResources(); + return _this.displayingResources = null; + }; + })(this)); + } else { + return $.when(); + } + }; + + ResourceView.prototype.redisplayResources = function() { + var scrollState; + scrollState = this.queryScroll(); + return this.clearResources().then((function(_this) { + return function() { + return _this.displayResources(); + }; + })(this)).then((function(_this) { + return function() { + _this.setScroll(scrollState); + return _this.calendar.rerenderEvents(); + }; + })(this)); + }; + + ResourceView.prototype.resetResources = function(resources) { + var scrollState; + if (!this.displayingResources) { + return this.unassignResources().then((function(_this) { + return function() { + return _this.assignResources(resources); + }; + })(this)); + } else { + scrollState = this.queryScroll(); + return this.clearResources().then((function(_this) { + return function() { + return _this.unassignResources(); + }; + })(this)).then((function(_this) { + return function() { + return _this.assignResources(resources); + }; + })(this)).then((function(_this) { + return function() { + return _this.displayResources(); + }; + })(this)).then((function(_this) { + return function() { + _this.setScroll(scrollState); + return _this.calendar.rerenderEvents(); + }; + })(this)); + } + }; + + + /* + resources param is optional. if not given, gets them from resourceManager + */ + + ResourceView.prototype.assignResources = function(resources) { + return this.assigningResources || (this.assigningResources = $.when(resources || this.calendar.resourceManager.getResources()).then((function(_this) { + return function(resources) { + return _this.setResources(resources); + }; + })(this))); + }; + + ResourceView.prototype.unassignResources = function() { + var assigning; + assigning = this.assigningResources; + if (assigning) { + return assigning.then((function(_this) { + return function() { + _this.unsetResources(); + return _this.assigningResources = null; + }; + })(this)); + } else { + return $.when(); + } + }; + + ResourceView.prototype.setResources = function(resources) {}; + + ResourceView.prototype.unsetResources = function() {}; + + ResourceView.prototype.renderStoredResources = function() {}; + + ResourceView.prototype.unrenderStoredResources = function() {}; + + ResourceView.prototype.triggerDayClick = function(cell, dayEl, ev) { + var resourceManager; + resourceManager = this.calendar.resourceManager; + return this.trigger('dayClick', dayEl, cell.start, ev, this, resourceManager.getResourceById(cell.resourceId)); + }; + + ResourceView.prototype.triggerSelect = function(range, ev) { + var resourceManager; + resourceManager = this.calendar.resourceManager; + return this.trigger('select', null, range.start, range.end, ev, this, resourceManager.getResourceById(range.resourceId)); + }; + + + /* Hacks + * ------------------------------------------------------------------------------------------------------------------ + These triggers usually call mutateEvent with dropLocation, which causes an event modification and rerender. + But mutateEvent isn't aware of eventResourceField, so it might be setting the wrong property. Workaround. + TODO: normalize somewhere else. maybe make a hook in core. + */ + + ResourceView.prototype.reportEventDrop = function() { + var dropLocation, event, otherArgs; + event = arguments[0], dropLocation = arguments[1], otherArgs = 3 <= arguments.length ? slice.call(arguments, 2) : []; + return ResourceView.__super__.reportEventDrop.apply(this, [event, this.normalizeDropLocation(dropLocation)].concat(slice.call(otherArgs))); + }; + + ResourceView.prototype.reportExternalDrop = function() { + var dropLocation, meta, otherArgs; + meta = arguments[0], dropLocation = arguments[1], otherArgs = 3 <= arguments.length ? slice.call(arguments, 2) : []; + return ResourceView.__super__.reportExternalDrop.apply(this, [meta, this.normalizeDropLocation(dropLocation)].concat(slice.call(otherArgs))); + }; + + ResourceView.prototype.normalizeDropLocation = function(dropLocation) { + var out; + out = $.extend({}, dropLocation); + delete out.resourceId; + this.calendar.resourceManager.setEventResourceId(out, dropLocation.resourceId); + return out; + }; + + return ResourceView; + +})(View); + +ResourceGrid = (function(superClass) { + extend(ResourceGrid, superClass); + + function ResourceGrid() { + return ResourceGrid.__super__.constructor.apply(this, arguments); + } + + ResourceGrid.prototype.eventsToRanges = function(events) { + var eventRange, eventRanges, j, len; + eventRanges = ResourceGrid.__super__.eventsToRanges.apply(this, arguments); + for (j = 0, len = eventRanges.length; j < len; j++) { + eventRange = eventRanges[j]; + eventRange.resourceId = this.view.calendar.getEventResourceId(eventRange.event); + } + return eventRanges; + }; + + ResourceGrid.prototype.eventRangeToSegs = function(eventRange) { + var j, len, resourceId, seg, segs; + segs = ResourceGrid.__super__.eventRangeToSegs.apply(this, arguments); + resourceId = eventRange.resourceId; + if (resourceId) { + for (j = 0, len = segs.length; j < len; j++) { + seg = segs[j]; + seg.resourceId = resourceId; + } + } + return segs; + }; + + ResourceGrid.prototype.selectionRangeToSegs = function(selectionRange) { + var j, len, resourceId, seg, segs; + segs = ResourceGrid.__super__.selectionRangeToSegs.apply(this, arguments); + resourceId = selectionRange.resourceId; + if (resourceId) { + for (j = 0, len = segs.length; j < len; j++) { + seg = segs[j]; + seg.resourceId = resourceId; + } + } + return segs; + }; + + ResourceGrid.prototype.fabricateHelperEvent = function(eventRange, seg) { + var event; + event = ResourceGrid.__super__.fabricateHelperEvent.apply(this, arguments); + this.view.calendar.resourceManager.setEventResourceId(event, eventRange.resourceId); + return event; + }; + + ResourceGrid.prototype.computeEventDrop = function(startCell, endCell, event) { + var allowResourceChange, eventRange; + if (!endCell.resourceId) { + return null; + } + allowResourceChange = true; + if (!allowResourceChange && startCell.resourceId !== endCell.resourceId) { + return null; + } + eventRange = ResourceGrid.__super__.computeEventDrop.apply(this, arguments); + if (eventRange) { + eventRange.resourceId = endCell.resourceId; + } + return eventRange; + }; + + ResourceGrid.prototype.computeExternalDrop = function(cell, meta) { + var eventRange; + if (!cell.resourceId) { + return null; + } + eventRange = ResourceGrid.__super__.computeExternalDrop.apply(this, arguments); + if (eventRange) { + eventRange.resourceId = cell.resourceId; + } + return eventRange; + }; + + ResourceGrid.prototype.computeEventResize = function(type, startCell, endCell, event) { + var eventRange; + eventRange = ResourceGrid.__super__.computeEventResize.apply(this, arguments); + if (eventRange) { + eventRange.resourceId = startCell.resourceId; + } + return eventRange; + }; + + ResourceGrid.prototype.computeSelection = function(cell0, cell1) { + var selectionRange; + selectionRange = ResourceGrid.__super__.computeSelection.apply(this, arguments); + if (selectionRange) { + selectionRange.resourceId = cell0.resourceId; + } + return selectionRange; + }; + + return ResourceGrid; + +})(Grid); + +TimelineView = (function(superClass) { + extend(TimelineView, superClass); + + function TimelineView() { + return TimelineView.__super__.constructor.apply(this, arguments); + } + + TimelineView.prototype.timeGrid = null; + + TimelineView.prototype.isScrolled = false; + + TimelineView.prototype.initialize = function() { + this.timeGrid = this.instantiateGrid(); + this.intervalDuration = this.timeGrid.duration; + return this.coordMap = this.timeGrid.coordMap; + }; + + TimelineView.prototype.instantiateGrid = function() { + return new TimelineGrid(this); + }; + + TimelineView.prototype.setRange = function(range) { + TimelineView.__super__.setRange.apply(this, arguments); + return this.timeGrid.setRange(range); + }; + + TimelineView.prototype.renderSkeleton = function() { + this.el.addClass('fc-timeline'); + if (this.opt('eventOverlap') === false) { + this.el.addClass('fc-no-overlap'); + } + this.el.html(this.renderSkeletonHtml()); + return this.renderTimeGridSkeleton(); + }; + + TimelineView.prototype.renderSkeletonHtml = function() { + return '
'; + }; + + TimelineView.prototype.renderTimeGridSkeleton = function() { + this.timeGrid.setElement(this.el.find('tbody .fc-time-area')); + this.timeGrid.headEl = this.el.find('thead .fc-time-area'); + this.timeGrid.renderSkeleton(); + this.isScrolled = false; + return this.timeGrid.bodyScroller.on('scroll', proxy(this, 'handleBodyScroll')); + }; + + TimelineView.prototype.handleBodyScroll = function(top, left) { + if (top) { + if (!this.isScrolled) { + this.isScrolled = true; + return this.el.addClass('fc-scrolled'); + } + } else { + if (this.isScrolled) { + this.isScrolled = false; + return this.el.removeClass('fc-scrolled'); + } + } + }; + + TimelineView.prototype.unrenderSkeleton = function() { + this.timeGrid.removeElement(); + this.handleBodyScroll(0); + return TimelineView.__super__.unrenderSkeleton.apply(this, arguments); + }; + + TimelineView.prototype.renderDates = function() { + return this.timeGrid.renderDates(); + }; + + TimelineView.prototype.unrenderDates = function() { + return this.timeGrid.unrenderDates(); + }; + + TimelineView.prototype.renderBusinessHours = function() { + return this.timeGrid.renderBusinessHours(); + }; + + TimelineView.prototype.unrenderBusinessHours = function() { + return this.timeGrid.unrenderBusinessHours(); + }; + + TimelineView.prototype.updateWidth = function() { + return this.timeGrid.updateWidth(); + }; + + TimelineView.prototype.setHeight = function(totalHeight, isAuto) { + var bodyHeight; + if (isAuto) { + bodyHeight = 'auto'; + } else { + bodyHeight = totalHeight - this.timeGrid.headHeight() - this.queryMiscHeight(); + } + return this.timeGrid.bodyScroller.setHeight(bodyHeight); + }; + + TimelineView.prototype.queryMiscHeight = function() { + return this.el.outerHeight() - this.timeGrid.headScroller.el.outerHeight() - this.timeGrid.bodyScroller.el.outerHeight(); + }; + + TimelineView.prototype.computeInitialScroll = function(prevScrollState) { + return this.timeGrid.computeInitialScroll(prevScrollState); + }; + + TimelineView.prototype.queryScroll = function() { + return this.timeGrid.queryScroll(); + }; + + TimelineView.prototype.setScroll = function(state) { + return this.timeGrid.setScroll(state); + }; + + TimelineView.prototype.renderEvents = function(events) { + this.timeGrid.renderEvents(events); + return this.updateWidth(); + }; + + TimelineView.prototype.unrenderEvents = function() { + this.timeGrid.unrenderEvents(); + return this.updateWidth(); + }; + + TimelineView.prototype.renderDrag = function(dropLocation, seg) { + return this.timeGrid.renderDrag(dropLocation, seg); + }; + + TimelineView.prototype.unrenderDrag = function() { + return this.timeGrid.unrenderDrag(); + }; + + TimelineView.prototype.getEventSegs = function() { + return this.timeGrid.getEventSegs(); + }; + + TimelineView.prototype.renderSelection = function(range) { + return this.timeGrid.renderSelection(range); + }; + + TimelineView.prototype.unrenderSelection = function() { + return this.timeGrid.unrenderSelection(); + }; + + return TimelineView; + +})(View); + +cssToStr = FC.cssToStr; + +TimelineGrid = (function(superClass) { + extend(TimelineGrid, superClass); + + TimelineGrid.prototype.slotDates = null; + + TimelineGrid.prototype.headEl = null; + + TimelineGrid.prototype.slatContainerEl = null; + + TimelineGrid.prototype.slatEls = null; + + TimelineGrid.prototype.slatElCoords = null; + + TimelineGrid.prototype.headScroller = null; + + TimelineGrid.prototype.bodyScroller = null; + + TimelineGrid.prototype.joiner = null; + + TimelineGrid.prototype.follower = null; + + TimelineGrid.prototype.eventTitleFollower = null; + + TimelineGrid.prototype.minTime = null; + + TimelineGrid.prototype.maxTime = null; + + TimelineGrid.prototype.slotDuration = null; + + TimelineGrid.prototype.snapDuration = null; + + TimelineGrid.prototype.slotCnt = null; + + TimelineGrid.prototype.snapDiffToCol = null; + + TimelineGrid.prototype.colToSnapDiff = null; + + TimelineGrid.prototype.colsPerSlot = null; + + TimelineGrid.prototype.duration = null; + + TimelineGrid.prototype.labelInterval = null; + + TimelineGrid.prototype.headerFormats = null; + + TimelineGrid.prototype.isTimeScale = null; + + TimelineGrid.prototype.largeUnit = null; + + TimelineGrid.prototype.emphasizeWeeks = false; + + TimelineGrid.prototype.titleFollower = null; + + TimelineGrid.prototype.segContainerEl = null; + + TimelineGrid.prototype.segContainerHeight = null; + + TimelineGrid.prototype.bgSegContainerEl = null; + + TimelineGrid.prototype.helperEls = null; + + TimelineGrid.prototype.innerEl = null; + + function TimelineGrid() { + var input; + TimelineGrid.__super__.constructor.apply(this, arguments); + this.initScaleProps(); + this.minTime = moment.duration(this.opt('minTime') || '00:00'); + this.maxTime = moment.duration(this.opt('maxTime') || '24:00'); + this.snapDuration = (input = this.opt('snapDuration')) ? moment.duration(input) : this.slotDuration; + this.cellDuration = this.snapDuration; + this.colsPerSlot = divideDurationByDuration(this.slotDuration, this.snapDuration); + this.slotWidth = this.opt('slotWidth'); + } + + TimelineGrid.prototype.opt = function(name) { + return this.view.opt(name); + }; + + TimelineGrid.prototype.isValidDate = function(date) { + var time; + if (this.view.isHiddenDay(date)) { + return false; + } else if (this.isTimeScale) { + time = date.time(); + return time >= this.minTime && time < this.maxTime; + } else { + return true; + } + }; + + TimelineGrid.prototype.computeDisplayEventTime = function() { + return !this.isTimeScale; + }; + + TimelineGrid.prototype.computeDisplayEventEnd = function() { + return false; + }; + + TimelineGrid.prototype.computeEventTimeFormat = function() { + return this.opt('extraSmallTimeFormat'); + }; + + + /* + Makes the given date consistent with isTimeScale/largeUnit, + so, either removes the times, ensures a time, or makes it the startOf largeUnit. + Strips all timezones. Returns new copy. + TODO: should maybe be called "normalizeRangeDate". + */ + + TimelineGrid.prototype.normalizeGridDate = function(date) { + var normalDate; + if (this.isTimeScale) { + normalDate = date.clone().stripZone(); + if (!normalDate.hasTime()) { + normalDate.time(0); + } + } else { + normalDate = date.clone().stripTime(); + if (this.largeUnit) { + normalDate.startOf(this.largeUnit); + } + } + return normalDate; + }; + + TimelineGrid.prototype.normalizeGridRange = function(range) { + var adjustedEnd, normalRange; + if (this.isTimeScale) { + normalRange = { + start: this.normalizeGridDate(range.start), + end: this.normalizeGridDate(range.end) + }; + } else { + normalRange = this.view.computeDayRange(range); + if (this.largeUnit) { + normalRange.start.startOf(this.largeUnit); + adjustedEnd = normalRange.end.clone().startOf(this.largeUnit); + if (!adjustedEnd.isSame(normalRange.end) || !adjustedEnd.isAfter(normalRange.start)) { + adjustedEnd.add(this.slotDuration); + } + normalRange.end = adjustedEnd; + } + } + return normalRange; + }; + + TimelineGrid.prototype.rangeUpdated = function() { + var date, slotDates; + this.start = this.normalizeGridDate(this.start); + this.end = this.normalizeGridDate(this.end); + slotDates = []; + date = this.start.clone(); + while (date < this.end) { + if (this.isValidDate(date)) { + slotDates.push(date.clone()); + } + date.add(this.slotDuration); + } + this.slotDates = slotDates; + return this.updateGridDates(); + }; + + TimelineGrid.prototype.updateGridDates = function() { + var col, colToSnapDiff, date, snapDiffToCol, snapIndex; + col = -1; + snapIndex = 0; + snapDiffToCol = []; + colToSnapDiff = []; + date = this.start.clone(); + while (date < this.end) { + if (this.isValidDate(date)) { + col++; + snapDiffToCol.push(col); + colToSnapDiff.push(snapIndex); + } else { + snapDiffToCol.push(col + 0.5); + } + date.add(this.snapDuration); + snapIndex++; + } + this.snapDiffToCol = snapDiffToCol; + this.colToSnapDiff = colToSnapDiff; + return this.colCnt = col + 1; + }; + + TimelineGrid.prototype.build = function() { + return this.rowCnt = 1; + }; + + TimelineGrid.prototype.getRowEl = function() { + return this.bodyScroller.contentEl; + }; + + TimelineGrid.prototype.getCellDayEl = function(cell) { + return this.slatEls.eq(Math.floor(cell.col / this.colsPerSlot)); + }; + + TimelineGrid.prototype.computeColCoords = function() { + var coords, date; + coords = []; + date = this.start.clone(); + while (date < this.end) { + if (this.isValidDate(date)) { + coords.push(this.rangeToOffsets({ + start: date, + end: date.clone().add(this.snapDuration) + })); + } + date.add(this.snapDuration); + } + return coords; + }; + + TimelineGrid.prototype.computeCellRange = function(cell) { + var end, start; + start = this.start.clone(); + start = this.view.calendar.rezoneDate(start); + start.add(multiplyDuration(this.snapDuration, this.colToSnapDiff[cell.col])); + end = start.clone().add(this.snapDuration); + return { + start: start, + end: end + }; + }; + + TimelineGrid.prototype.rangeToSegs = function(range) { + var normalRange, seg; + normalRange = this.normalizeGridRange(range); + seg = intersectionToSeg(normalRange, this); + if (seg) { + if (seg.isStart && !this.isValidDate(seg.start)) { + seg.isStart = false; + } + if (seg.isEnd && seg.end && !this.isValidDate(seg.end.clone().subtract(1))) { + seg.isEnd = false; + } + return [seg]; + } else { + return []; + } + }; + + TimelineGrid.prototype.renderSkeleton = function() { + this.headScroller = new Scroller('invisible-scroll', 'hidden'); + this.headEl.append(this.headScroller.el); + this.bodyScroller = new Scroller(); + this.el.append(this.bodyScroller.el); + this.innerEl = this.bodyScroller.contentEl; + this.slatContainerEl = $('
').appendTo(this.bodyScroller.bgEl); + this.segContainerEl = $('
').appendTo(this.bodyScroller.contentEl); + this.bgSegContainerEl = this.bodyScroller.bgEl; + this.coordMap.containerEl = this.bodyScroller.scrollEl; + this.joiner = new ScrollJoiner('horizontal', [this.headScroller, this.bodyScroller]); + if (true) { + this.follower = new ScrollFollower(this.headScroller); + } + if (true) { + this.eventTitleFollower = new ScrollFollower(this.bodyScroller); + this.eventTitleFollower.minTravel = 50; + if (this.isRTL) { + this.eventTitleFollower.containOnNaturalRight = true; + } else { + this.eventTitleFollower.containOnNaturalLeft = true; + } + } + return TimelineGrid.__super__.renderSkeleton.apply(this, arguments); + }; + + TimelineGrid.prototype.headColEls = null; + + TimelineGrid.prototype.slatColEls = null; + + TimelineGrid.prototype.renderDates = function() { + var date, i, j, len, ref; + this.headScroller.contentEl.html(this.renderHeadHtml()); + this.headColEls = this.headScroller.contentEl.find('col'); + this.slatContainerEl.html(this.renderSlatHtml()); + this.slatColEls = this.slatContainerEl.find('col'); + this.slatEls = this.slatContainerEl.find('td'); + ref = this.slotDates; + for (i = j = 0, len = ref.length; j < len; i = ++j) { + date = ref[i]; + this.view.trigger('dayRender', null, date, this.slatEls.eq(i)); + } + if (this.follower) { + return this.follower.setSprites(this.headEl.find('tr:not(:last-child) span')); + } + }; + + TimelineGrid.prototype.unrenderDates = function() { + if (this.follower) { + this.follower.clearSprites(); + } + this.headScroller.contentEl.empty(); + this.slatContainerEl.empty(); + return this.headScroller.contentEl.add(this.bodyScroller.contentEl).css({ + minWidth: '', + width: '' + }); + }; + + TimelineGrid.prototype.renderHeadHtml = function() { + var cell, cellRows, date, format, formats, html, i, isChrono, isLast, isSuperRow, isWeekStart, j, k, l, labelInterval, leadingCell, len, len1, len2, len3, len4, len5, len6, m, n, newCell, p, prevWeekNumber, q, row, rowCells, slatHtml, slotCells, slotDates, text, weekNumber; + labelInterval = this.labelInterval; + formats = this.headerFormats; + cellRows = (function() { + var j, len, results; + results = []; + for (j = 0, len = formats.length; j < len; j++) { + format = formats[j]; + results.push([]); + } + return results; + })(); + leadingCell = null; + prevWeekNumber = null; + slotDates = this.slotDates; + slotCells = []; + for (j = 0, len = slotDates.length; j < len; j++) { + date = slotDates[j]; + weekNumber = date.week(); + isWeekStart = this.emphasizeWeeks && prevWeekNumber !== null && prevWeekNumber !== weekNumber; + for (row = k = 0, len1 = formats.length; k < len1; row = ++k) { + format = formats[row]; + rowCells = cellRows[row]; + leadingCell = rowCells[rowCells.length - 1]; + isSuperRow = formats.length > 1 && row < formats.length - 1; + newCell = null; + if (isSuperRow) { + text = date.format(format); + if (!leadingCell || leadingCell.text !== text) { + newCell = { + text: text, + colspan: 1 + }; + } else { + leadingCell.colspan += 1; + } + } else { + if (!leadingCell || isInt(divideRangeByDuration(this.start, date, labelInterval))) { + text = date.format(format); + newCell = { + text: text, + colspan: 1 + }; + } else { + leadingCell.colspan += 1; + } + } + if (newCell) { + newCell.weekStart = isWeekStart; + rowCells.push(newCell); + } + } + slotCells.push({ + weekStart: isWeekStart + }); + prevWeekNumber = weekNumber; + } + isChrono = labelInterval > this.slotDuration; + html = ''; + html += ''; + for (l = 0, len2 = slotDates.length; l < len2; l++) { + date = slotDates[l]; + html += ''; + } + html += ''; + html += ''; + for (i = m = 0, len3 = cellRows.length; m < len3; i = ++m) { + rowCells = cellRows[i]; + isLast = i === cellRows.length - 1; + html += ''; + for (n = 0, len4 = rowCells.length; n < len4; n++) { + cell = rowCells[n]; + html += ''; + } + html += ''; + } + html += '
1 ? ' colspan="' + cell.colspan + '"' : '') + '>' + '
' + '' + htmlEscape(cell.text) + '' + '
' + '
'; + slatHtml = ''; + slatHtml += ''; + for (p = 0, len5 = slotCells.length; p < len5; p++) { + cell = slotCells[p]; + slatHtml += ''; + } + slatHtml += ''; + slatHtml += ''; + for (i = q = 0, len6 = slotCells.length; q < len6; i = ++q) { + cell = slotCells[i]; + date = slotDates[i]; + slatHtml += this.slatCellHtml(date, cell.weekStart); + } + slatHtml += '
'; + this._slatHtml = slatHtml; + return html; + }; + + TimelineGrid.prototype.renderSlatHtml = function() { + return this._slatHtml; + }; + + TimelineGrid.prototype.slatCellHtml = function(date, isEm) { + var classes; + if (this.isTimeScale) { + classes = []; + classes.push(isInt(divideRangeByDuration(this.start, date, this.labelInterval)) ? 'fc-major' : 'fc-minor'); + } else { + classes = this.getDayClasses(date); + classes.push('fc-day'); + } + classes.unshift(this.view.widgetContentClass); + if (isEm) { + classes.push('fc-em-cell'); + } + return '
'; + }; + + TimelineGrid.prototype.businessHourSegs = null; + + TimelineGrid.prototype.renderBusinessHours = function() { + var events, segs; + if (!this.largeUnit) { + events = this.view.calendar.getBusinessHoursEvents(!this.isTimeScale); + segs = this.businessHourSegs = this.eventsToSegs(events); + return this.renderFill('businessHours', segs, 'bgevent'); + } + }; + + TimelineGrid.prototype.unrenderBusinessHours = function() { + return this.unrenderFill('businessHours'); + }; + + TimelineGrid.prototype.explicitSlotWidth = null; + + TimelineGrid.prototype.defaultSlotWidth = null; + + TimelineGrid.prototype.updateWidth = function() { + var availableWidth, containerMinWidth, containerWidth, nonLastSlotWidth, slotWidth; + slotWidth = Math.round(this.slotWidth || (this.slotWidth = this.computeSlotWidth())); + containerWidth = slotWidth * this.slotDates.length; + containerMinWidth = ''; + nonLastSlotWidth = slotWidth; + availableWidth = this.bodyScroller.scrollEl[0].clientWidth; + if (availableWidth > containerWidth) { + containerMinWidth = availableWidth; + containerWidth = ''; + nonLastSlotWidth = Math.floor(availableWidth / this.slotDates.length); + } + this.headScroller.setContentWidth(containerWidth); + this.headScroller.setContentMinWidth(containerMinWidth); + this.bodyScroller.setContentWidth(containerWidth); + this.bodyScroller.setContentMinWidth(containerMinWidth); + this.headColEls.slice(0, -1).add(this.slatColEls.slice(0, -1)).width(nonLastSlotWidth); + this.headScroller.update(); + this.bodyScroller.update(); + this.joiner.update(); + this.updateSlatElCoords(); + this.updateSegPositions(); + if (this.follower) { + this.follower.update(); + } + if (this.eventTitleFollower) { + return this.eventTitleFollower.update(); + } + }; + + TimelineGrid.prototype.computeSlotWidth = function() { + var headerWidth, innerEls, maxInnerWidth, minWidth, slotWidth, slotsPerLabel; + maxInnerWidth = 0; + innerEls = this.headEl.find('tr:last-child th span'); + innerEls.each(function(i, node) { + var innerWidth; + innerWidth = $(node).outerWidth(); + return maxInnerWidth = Math.max(maxInnerWidth, innerWidth); + }); + headerWidth = maxInnerWidth + 1; + slotsPerLabel = divideDurationByDuration(this.labelInterval, this.slotDuration); + slotWidth = Math.ceil(headerWidth / slotsPerLabel); + minWidth = this.headColEls.eq(0).css('min-width'); + if (minWidth) { + minWidth = parseInt(minWidth, 10); + if (minWidth) { + slotWidth = Math.max(slotWidth, minWidth); + } + } + return slotWidth; + }; + + TimelineGrid.prototype.updateSlatElCoords = function() { + var coords, divs, i, origin, originEl, slatEl; + divs = this.slatEls.find('> div'); + originEl = this.bodyScroller.innerEl; + if (this.isRTL) { + origin = originEl.offset().left + originEl.outerWidth(); + coords = (function() { + var j, len, results; + results = []; + for (i = j = 0, len = divs.length; j < len; i = ++j) { + slatEl = divs[i]; + results.push($(slatEl).offset().left + $(slatEl).outerWidth() - origin); + } + return results; + })(); + coords[i] = $(slatEl).offset().left - origin; + } else { + origin = originEl.offset().left; + coords = (function() { + var j, len, results; + results = []; + for (i = j = 0, len = divs.length; j < len; i = ++j) { + slatEl = divs[i]; + results.push($(slatEl).offset().left - origin); + } + return results; + })(); + coords[i] = $(slatEl).offset().left + $(slatEl).outerWidth() - origin; + } + return this.slatElCoords = coords; + }; + + TimelineGrid.prototype.dateToCol = function(date) { + var col, snapDiff, snapDiffInt, snapDiffRemainder; + date = date.clone().stripZone(); + snapDiff = divideRangeByDuration(this.start, date, this.snapDuration); + if (snapDiff < 0) { + return 0; + } else if (snapDiff >= this.snapDiffToCol.length) { + return this.colCnt; + } else { + snapDiffInt = Math.floor(snapDiff); + snapDiffRemainder = snapDiff - snapDiffInt; + col = this.snapDiffToCol[snapDiffInt]; + if (isInt(col) && snapDiffRemainder) { + col += snapDiffRemainder; + } + return col; + } + }; + + TimelineGrid.prototype.dateToCoord = function(date) { + var col, coord0, coord1, index0, ms0, ms1, partial, slotIndex; + date = date.clone().stripZone(); + col = this.dateToCol(date); + slotIndex = col / this.colsPerSlot; + slotIndex = Math.max(slotIndex, 0); + slotIndex = Math.min(slotIndex, this.slotDates.length); + if (isInt(slotIndex)) { + return this.slatElCoords[slotIndex]; + } else { + index0 = Math.floor(slotIndex); + ms0 = +this.slotDates[index0]; + ms1 = +this.slotDates[index0].clone().add(this.slotDuration); + partial = (date - ms0) / (ms1 - ms0); + partial = Math.min(partial, 1); + coord0 = this.slatElCoords[index0]; + coord1 = this.slatElCoords[index0 + 1]; + return coord0 + (coord1 - coord0) * partial; + } + }; + + TimelineGrid.prototype.rangeToCoords = function(range) { + if (this.isRTL) { + return { + right: this.dateToCoord(range.start), + left: this.dateToCoord(range.end) + }; + } else { + return { + left: this.dateToCoord(range.start), + right: this.dateToCoord(range.end) + }; + } + }; + + TimelineGrid.prototype.rangeToOffsets = function(range) { + var coords, origin; + coords = this.rangeToCoords(range); + origin = this.isRTL ? this.slatContainerEl.offset().left + this.slatContainerEl.outerWidth() : this.slatContainerEl.offset().left; + coords.left += origin; + coords.right += origin; + return coords; + }; + + TimelineGrid.prototype.headHeight = function() { + var table; + table = this.headScroller.contentEl.find('table'); + return table.height.apply(table, arguments); + }; + + TimelineGrid.prototype.updateSegPositions = function() { + var coords, j, len, seg, segs; + segs = (this.segs || []).concat(this.businessHourSegs || []); + for (j = 0, len = segs.length; j < len; j++) { + seg = segs[j]; + coords = this.rangeToCoords(seg, -1); + seg.el.css({ + left: (seg.left = coords.left), + right: -(seg.right = coords.right) + }); + } + }; + + TimelineGrid.prototype.computeInitialScroll = function(prevState) { + var left, scrollTime; + left = 0; + if (this.isTimeScale) { + scrollTime = this.opt('scrollTime'); + if (scrollTime) { + scrollTime = moment.duration(scrollTime); + left = this.dateToCoord(this.start.clone().time(scrollTime)); + } + } + return { + left: left, + top: 0 + }; + }; + + TimelineGrid.prototype.queryScroll = function() { + return { + left: normalizedHScroll(this.bodyScroller.scrollEl), + top: this.bodyScroller.scrollEl.scrollTop() + }; + }; + + TimelineGrid.prototype.setScroll = function(state) { + normalizedHScroll(this.headScroller.scrollEl, state.left); + normalizedHScroll(this.bodyScroller.scrollEl, state.left); + return this.bodyScroller.scrollEl.scrollTop(state.top); + }; + + TimelineGrid.prototype.renderFgSegs = function(segs) { + segs = this.renderFgSegEls(segs); + this.renderFgSegsInContainers([[this, segs]]); + this.updateSegFollowers(segs); + return segs; + }; + + TimelineGrid.prototype.unrenderFgSegs = function() { + this.clearSegFollowers(); + return this.unrenderFgContainers([this]); + }; + + TimelineGrid.prototype.renderFgSegsInContainers = function(pairs) { + var container, coords, j, k, l, len, len1, len2, len3, len4, len5, len6, len7, m, n, p, q, r, ref, ref1, ref2, ref3, results, seg, segs; + for (j = 0, len = pairs.length; j < len; j++) { + ref = pairs[j], container = ref[0], segs = ref[1]; + for (k = 0, len1 = segs.length; k < len1; k++) { + seg = segs[k]; + coords = this.rangeToCoords(seg, -1); + seg.el.css({ + left: (seg.left = coords.left), + right: -(seg.right = coords.right) + }); + } + } + for (l = 0, len2 = pairs.length; l < len2; l++) { + ref1 = pairs[l], container = ref1[0], segs = ref1[1]; + for (m = 0, len3 = segs.length; m < len3; m++) { + seg = segs[m]; + seg.el.appendTo(container.segContainerEl); + } + } + for (n = 0, len4 = pairs.length; n < len4; n++) { + ref2 = pairs[n], container = ref2[0], segs = ref2[1]; + for (p = 0, len5 = segs.length; p < len5; p++) { + seg = segs[p]; + seg.height = seg.el.outerHeight(true); + } + this.buildSegLevels(segs); + container.segContainerHeight = computeOffsetForSegs(segs); + } + results = []; + for (q = 0, len6 = pairs.length; q < len6; q++) { + ref3 = pairs[q], container = ref3[0], segs = ref3[1]; + for (r = 0, len7 = segs.length; r < len7; r++) { + seg = segs[r]; + seg.el.css('top', seg.top); + } + results.push(container.segContainerEl.height(container.segContainerHeight)); + } + return results; + }; + + TimelineGrid.prototype.buildSegLevels = function(segs) { + var belowSeg, isLevelCollision, j, k, l, len, len1, len2, level, placedSeg, ref, ref1, segLevels, unplacedSeg; + segLevels = []; + this.sortSegs(segs); + for (j = 0, len = segs.length; j < len; j++) { + unplacedSeg = segs[j]; + unplacedSeg.above = []; + level = 0; + while (level < segLevels.length) { + isLevelCollision = false; + ref = segLevels[level]; + for (k = 0, len1 = ref.length; k < len1; k++) { + placedSeg = ref[k]; + if (timeRowSegsCollide(unplacedSeg, placedSeg)) { + unplacedSeg.above.push(placedSeg); + isLevelCollision = true; + } + } + if (isLevelCollision) { + level += 1; + } else { + break; + } + } + (segLevels[level] || (segLevels[level] = [])).push(unplacedSeg); + level += 1; + while (level < segLevels.length) { + ref1 = segLevels[level]; + for (l = 0, len2 = ref1.length; l < len2; l++) { + belowSeg = ref1[l]; + if (timeRowSegsCollide(unplacedSeg, belowSeg)) { + belowSeg.above.push(unplacedSeg); + } + } + level += 1; + } + } + return segLevels; + }; + + TimelineGrid.prototype.unrenderFgContainers = function(containers) { + var container, j, len, results; + results = []; + for (j = 0, len = containers.length; j < len; j++) { + container = containers[j]; + container.segContainerEl.empty(); + container.segContainerEl.height(''); + results.push(container.segContainerHeight = null); + } + return results; + }; + + TimelineGrid.prototype.fgSegHtml = function(seg, disableResizing) { + var classes, event, isDraggable, isResizableFromEnd, isResizableFromStart, timeText; + event = seg.event; + isDraggable = this.view.isEventDraggable(event); + isResizableFromStart = seg.isStart && this.view.isEventResizableFromStart(event); + isResizableFromEnd = seg.isEnd && this.view.isEventResizableFromEnd(event); + classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd); + classes.unshift('fc-timeline-event', 'fc-h-event'); + timeText = this.getEventTimeText(event); + return '' + '
' + (timeText ? '' + htmlEscape(timeText) + '' : '') + '' + (event.title ? htmlEscape(event.title) : ' ') + '' + '
' + '
' + (isResizableFromStart ? '
' : '') + (isResizableFromEnd ? '
' : '') + '
'; + }; + + TimelineGrid.prototype.updateSegFollowers = function(segs) { + var j, len, seg, sprites, titleEl; + if (this.eventTitleFollower) { + sprites = []; + for (j = 0, len = segs.length; j < len; j++) { + seg = segs[j]; + titleEl = seg.el.find('.fc-title'); + if (titleEl.length) { + sprites.push(new ScrollFollowerSprite(titleEl)); + } + } + return this.eventTitleFollower.setSprites(sprites); + } + }; + + TimelineGrid.prototype.clearSegFollowers = function() { + if (this.eventTitleFollower) { + return this.eventTitleFollower.clearSprites(); + } + }; + + TimelineGrid.prototype.segDragStart = function() { + TimelineGrid.__super__.segDragStart.apply(this, arguments); + if (this.eventTitleFollower) { + return this.eventTitleFollower.forceRelative(); + } + }; + + TimelineGrid.prototype.segDragEnd = function() { + TimelineGrid.__super__.segDragEnd.apply(this, arguments); + if (this.eventTitleFollower) { + return this.eventTitleFollower.clearForce(); + } + }; + + TimelineGrid.prototype.segResizeStart = function() { + TimelineGrid.__super__.segResizeStart.apply(this, arguments); + if (this.eventTitleFollower) { + return this.eventTitleFollower.forceRelative(); + } + }; + + TimelineGrid.prototype.segResizeEnd = function() { + TimelineGrid.__super__.segResizeEnd.apply(this, arguments); + if (this.eventTitleFollower) { + return this.eventTitleFollower.clearForce(); + } + }; + + TimelineGrid.prototype.renderHelper = function(event, sourceSeg) { + var segs; + segs = this.eventsToSegs([event]); + segs = this.renderFgSegEls(segs); + return this.renderHelperSegsInContainers([[this, segs]], sourceSeg); + }; + + TimelineGrid.prototype.renderHelperSegsInContainers = function(pairs, sourceSeg) { + var containerObj, coords, helperContainerEl, helperNodes, j, k, l, len, len1, len2, len3, m, ref, ref1, ref2, seg, segs; + helperNodes = []; + for (j = 0, len = pairs.length; j < len; j++) { + ref = pairs[j], containerObj = ref[0], segs = ref[1]; + for (k = 0, len1 = segs.length; k < len1; k++) { + seg = segs[k]; + coords = this.rangeToCoords(seg, -1); + seg.el.css({ + left: (seg.left = coords.left), + right: -(seg.right = coords.right) + }); + if (sourceSeg && sourceSeg.resourceId === ((ref1 = containerObj.resource) != null ? ref1.id : void 0)) { + seg.el.css('top', sourceSeg.el.css('top')); + } else { + seg.el.css('top', 0); + } + } + } + for (l = 0, len2 = pairs.length; l < len2; l++) { + ref2 = pairs[l], containerObj = ref2[0], segs = ref2[1]; + helperContainerEl = $('
').appendTo(containerObj.innerEl); + helperNodes.push(helperContainerEl[0]); + for (m = 0, len3 = segs.length; m < len3; m++) { + seg = segs[m]; + helperContainerEl.append(seg.el); + } + } + if (this.helperEls) { + return this.helperEls = this.helperEls.add($(helperNodes)); + } else { + return this.helperEls = $(helperNodes); + } + }; + + TimelineGrid.prototype.unrenderHelper = function() { + if (this.helperEls) { + this.helperEls.remove(); + return this.helperEls = null; + } + }; + + TimelineGrid.prototype.renderEventResize = function(range, seg) { + this.renderHighlight(this.eventRangeToSegs(range)); + return this.renderRangeHelper(range, seg); + }; + + TimelineGrid.prototype.unrenderEventResize = function() { + this.unrenderHighlight(); + return this.unrenderHelper(); + }; + + TimelineGrid.prototype.renderFill = function(type, segs, className) { + segs = this.renderFillSegEls(type, segs); + this.renderFillInContainers(type, [[this, segs]], className); + return segs; + }; + + TimelineGrid.prototype.renderFillInContainers = function(type, pairs, className) { + var containerObj, j, len, ref, results, segs; + results = []; + for (j = 0, len = pairs.length; j < len; j++) { + ref = pairs[j], containerObj = ref[0], segs = ref[1]; + results.push(this.renderFillInContainer(type, containerObj, segs, className)); + } + return results; + }; + + TimelineGrid.prototype.renderFillInContainer = function(type, containerObj, segs, className) { + var containerEl, coords, j, len, seg; + if (segs.length) { + className || (className = type.toLowerCase()); + containerEl = $('
').appendTo(containerObj.bgSegContainerEl); + for (j = 0, len = segs.length; j < len; j++) { + seg = segs[j]; + coords = this.rangeToCoords(seg, -1); + seg.el.css({ + left: (seg.left = coords.left), + right: -(seg.right = coords.right) + }); + seg.el.appendTo(containerEl); + } + if (this.elsByFill[type]) { + return this.elsByFill[type] = this.elsByFill[type].add(containerEl); + } else { + return this.elsByFill[type] = containerEl; + } + } + }; + + TimelineGrid.prototype.renderDrag = function(dropLocation, seg) { + if (seg) { + this.renderRangeHelper(dropLocation, seg); + this.applyDragOpacity(this.helperEls); + return true; + } else { + this.renderHighlight(this.eventRangeToSegs(dropLocation)); + return false; + } + }; + + TimelineGrid.prototype.unrenderDrag = function() { + this.unrenderHelper(); + return this.unrenderHighlight(); + }; + + return TimelineGrid; + +})(Grid); + +computeOffsetForSegs = function(segs) { + var j, len, max, seg; + max = 0; + for (j = 0, len = segs.length; j < len; j++) { + seg = segs[j]; + max = Math.max(max, computeOffsetForSeg(seg)); + } + return max; +}; + +computeOffsetForSeg = function(seg) { + if (seg.top == null) { + seg.top = computeOffsetForSegs(seg.above); + } + return seg.top + seg.height; +}; + +timeRowSegsCollide = function(seg0, seg1) { + return seg0.left < seg1.right && seg0.right > seg1.left; +}; + +MIN_AUTO_LABELS = 18; + +MAX_AUTO_SLOTS_PER_LABEL = 6; + +MAX_AUTO_CELLS = 200; + +MAX_CELLS = 1000; + +DEFAULT_GRID_DURATION = { + months: 1 +}; + +STOCK_SUB_DURATIONS = [ + { + 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 + } +]; + +TimelineGrid.prototype.initScaleProps = function() { + var input, slotUnit, type; + this.labelInterval = this.queryDurationOption('slotLabelInterval'); + this.slotDuration = this.queryDurationOption('slotDuration'); + this.ensureGridDuration(); + this.validateLabelAndSlot(); + this.ensureLabelInterval(); + this.ensureSlotDuration(); + input = this.opt('slotLabelFormat'); + type = $.type(input); + this.headerFormats = type === 'array' ? input : type === 'string' ? [input] : this.computeHeaderFormats(); + this.isTimeScale = durationHasTime(this.slotDuration); + this.largeUnit = !this.isTimeScale ? (slotUnit = computeIntervalUnit(this.slotDuration), /year|month|week/.test(slotUnit) ? slotUnit : void 0) : void 0; + return this.emphasizeWeeks = this.slotDuration.as('days') === 1 && this.duration.as('weeks') >= 2 && !this.opt('businessHours'); + + /* + console.log('view duration =', @duration.humanize()) + console.log('label interval =', @labelInterval.humanize()) + console.log('slot duration =', @slotDuration.humanize()) + console.log('header formats =', @headerFormats) + console.log('isTimeScale', @isTimeScale) + console.log('largeUnit', @largeUnit) + */ +}; + +TimelineGrid.prototype.queryDurationOption = function(name) { + var dur, input; + input = this.opt(name); + if (input != null) { + dur = moment.duration(input); + if (+dur) { + return dur; + } + } +}; + +TimelineGrid.prototype.validateLabelAndSlot = function() { + var labelCnt, slotCnt, slotsPerLabel; + if (this.labelInterval) { + labelCnt = divideDurationByDuration(this.duration, this.labelInterval); + if (labelCnt > MAX_CELLS) { + FC.warn('slotLabelInterval results in too many cells'); + this.labelInterval = null; + } + } + if (this.slotDuration) { + slotCnt = divideDurationByDuration(this.duration, this.slotDuration); + if (slotCnt > MAX_CELLS) { + FC.warn('slotDuration results in too many cells'); + this.slotDuration = null; + } + } + if (this.labelInterval && this.slotDuration) { + slotsPerLabel = divideDurationByDuration(this.labelInterval, this.slotDuration); + if (!isInt(slotsPerLabel) || slotsPerLabel < 1) { + FC.warn('slotLabelInterval must be a multiple of slotDuration'); + return this.slotDuration = null; + } + } +}; + +TimelineGrid.prototype.ensureGridDuration = function() { + var gridDuration, input, j, labelCnt, labelInterval; + gridDuration = this.duration; + if (!gridDuration) { + gridDuration = this.view.intervalDuration; + if (!gridDuration) { + if (!this.labelInterval && !this.slotDuration) { + gridDuration = moment.duration(DEFAULT_GRID_DURATION); + } else { + labelInterval = this.ensureLabelInterval(); + for (j = STOCK_SUB_DURATIONS.length - 1; j >= 0; j += -1) { + input = STOCK_SUB_DURATIONS[j]; + gridDuration = moment.duration(input); + labelCnt = divideDurationByDuration(gridDuration, labelInterval); + if (labelCnt >= MIN_AUTO_LABELS) { + break; + } + } + } + } + this.duration = gridDuration; + } + return gridDuration; +}; + +TimelineGrid.prototype.ensureLabelInterval = function() { + var input, j, k, labelCnt, labelInterval, len, len1, slotsPerLabel, tryLabelInterval; + labelInterval = this.labelInterval; + if (!labelInterval) { + if (!this.duration && !this.slotDuration) { + this.ensureGridDuration(); + } + if (this.slotDuration) { + for (j = 0, len = STOCK_SUB_DURATIONS.length; j < len; j++) { + input = STOCK_SUB_DURATIONS[j]; + tryLabelInterval = moment.duration(input); + slotsPerLabel = divideDurationByDuration(tryLabelInterval, this.slotDuration); + if (isInt(slotsPerLabel) && slotsPerLabel <= MAX_AUTO_SLOTS_PER_LABEL) { + labelInterval = tryLabelInterval; + break; + } + } + if (!labelInterval) { + labelInterval = this.slotDuration; + } + } else { + for (k = 0, len1 = STOCK_SUB_DURATIONS.length; k < len1; k++) { + input = STOCK_SUB_DURATIONS[k]; + labelInterval = moment.duration(input); + labelCnt = divideDurationByDuration(this.duration, labelInterval); + if (labelCnt >= MIN_AUTO_LABELS) { + break; + } + } + } + this.labelInterval = labelInterval; + } + return labelInterval; +}; + +TimelineGrid.prototype.ensureSlotDuration = function() { + var input, j, labelInterval, len, slotCnt, slotDuration, slotsPerLabel, trySlotDuration; + slotDuration = this.slotDuration; + if (!slotDuration) { + labelInterval = this.ensureLabelInterval(); + for (j = 0, len = STOCK_SUB_DURATIONS.length; j < len; j++) { + input = STOCK_SUB_DURATIONS[j]; + trySlotDuration = moment.duration(input); + slotsPerLabel = divideDurationByDuration(labelInterval, trySlotDuration); + if (isInt(slotsPerLabel) && slotsPerLabel > 1 && slotsPerLabel <= MAX_AUTO_SLOTS_PER_LABEL) { + slotDuration = trySlotDuration; + break; + } + } + if (slotDuration && this.duration) { + slotCnt = divideDurationByDuration(this.duration, slotDuration); + if (slotCnt > MAX_AUTO_CELLS) { + slotDuration = null; + } + } + if (!slotDuration) { + slotDuration = labelInterval; + } + this.slotDuration = slotDuration; + } + return slotDuration; +}; + +TimelineGrid.prototype.computeHeaderFormats = function() { + var format0, format1, format2, gridDuration, labelInterval, unit, view, weekNumbersVisible; + view = this.view; + gridDuration = this.duration; + labelInterval = this.labelInterval; + unit = computeIntervalUnit(labelInterval); + weekNumbersVisible = this.opt('weekNumbers'); + format0 = format1 = format2 = null; + if (unit === 'week' && !weekNumbersVisible) { + unit = 'day'; + } + switch (unit) { + case 'year': + format0 = 'YYYY'; + break; + case 'month': + if (gridDuration.asYears() > 1) { + format0 = 'YYYY'; + } + format1 = 'MMM'; + break; + case 'week': + if (gridDuration.asYears() > 1) { + format0 = 'YYYY'; + } + format1 = this.opt('shortWeekFormat'); + break; + case 'day': + if (gridDuration.asYears() > 1) { + format0 = this.opt('monthYearFormat'); + } else if (gridDuration.asMonths() > 1) { + format0 = 'MMMM'; + } + if (weekNumbersVisible) { + format1 = this.opt('weekFormat'); + } + format2 = 'dd D'; + break; + case 'hour': + if (weekNumbersVisible) { + format0 = this.opt('weekFormat'); + } + if (gridDuration.asDays() > 1) { + format1 = this.opt('dayOfMonthFormat'); + } + format2 = this.opt('smallTimeFormat'); + break; + case 'minute': + if (labelInterval.asMinutes() / 60 >= MAX_AUTO_SLOTS_PER_LABEL) { + format0 = this.opt('hourFormat'); + format1 = '[:]mm'; + } else { + format0 = this.opt('mediumTimeFormat'); + } + break; + case 'second': + if (labelInterval.asSeconds() / 60 >= MAX_AUTO_SLOTS_PER_LABEL) { + format0 = 'LT'; + format1 = '[:]ss'; + } else { + format0 = 'LTS'; + } + break; + case 'millisecond': + format0 = 'LTS'; + format1 = '[.]SSS'; + } + return [].concat(format0 || [], format1 || [], format2 || []); +}; + +FC.views.timeline = { + "class": TimelineView, + defaults: { + eventResizableFromStart: true + } +}; + +FC.views.timelineDay = { + type: 'timeline', + duration: { + days: 1 + } +}; + +FC.views.timelineWeek = { + type: 'timeline', + duration: { + weeks: 1 + } +}; + +FC.views.timelineMonth = { + type: 'timeline', + duration: { + months: 1 + } +}; + +FC.views.timelineYear = { + type: 'timeline', + duration: { + years: 1 + } +}; + +ResourceTimelineView = (function(superClass) { + extend(ResourceTimelineView, superClass); + + function ResourceTimelineView() { + return ResourceTimelineView.__super__.constructor.apply(this, arguments); + } + + ResourceTimelineView.mixin(ResourceView); + + ResourceTimelineView.prototype.resourceGrid = null; + + ResourceTimelineView.prototype.joiner = null; + + ResourceTimelineView.prototype.dividerEls = null; + + ResourceTimelineView.prototype.superHeaderText = null; + + ResourceTimelineView.prototype.isVGrouping = null; + + ResourceTimelineView.prototype.isHGrouping = null; + + ResourceTimelineView.prototype.groupSpecs = null; + + ResourceTimelineView.prototype.colSpecs = null; + + ResourceTimelineView.prototype.orderSpecs = null; + + ResourceTimelineView.prototype.rowHierarchy = null; + + ResourceTimelineView.prototype.resourceRowHash = null; + + ResourceTimelineView.prototype.nestingCnt = 0; + + ResourceTimelineView.prototype.isNesting = null; + + ResourceTimelineView.prototype.dividerWidth = null; + + ResourceTimelineView.prototype.initialize = function() { + ResourceTimelineView.__super__.initialize.apply(this, arguments); + this.processResourceOptions(); + this.resourceGrid = new Spreadsheet(this); + this.rowHierarchy = new RowParent(this); + return this.resourceRowHash = {}; + }; + + ResourceTimelineView.prototype.instantiateGrid = function() { + return new ResourceTimelineGrid(this); + }; + + ResourceTimelineView.prototype.processResourceOptions = function() { + var allColSpecs, allOrderSpecs, colSpec, defaultLabelText, groupColSpecs, groupSpec, groupSpecs, hGroupField, isGroup, isHGrouping, isVGrouping, j, k, l, labelText, len, len1, len2, orderSpec, plainColSpecs, plainOrderSpecs, superHeaderText, textFunc; + allColSpecs = this.opt('resourceColumns') || []; + labelText = this.opt('resourceLabelText'); + defaultLabelText = 'Resources'; + superHeaderText = null; + if (!allColSpecs.length) { + textFunc = this.opt('resourceText'); + textFunc || (textFunc = function(resource) { + return resource.title || resource.id; + }); + allColSpecs.push({ + labelText: labelText || defaultLabelText, + text: textFunc + }); + } else { + superHeaderText = labelText; + } + plainColSpecs = []; + groupColSpecs = []; + groupSpecs = []; + isVGrouping = false; + isHGrouping = false; + for (j = 0, len = allColSpecs.length; j < len; j++) { + colSpec = allColSpecs[j]; + if (colSpec.group) { + groupColSpecs.push(colSpec); + } else { + plainColSpecs.push(colSpec); + } + } + plainColSpecs[0].isMain = true; + if (groupColSpecs.length) { + groupSpecs = groupColSpecs; + isVGrouping = true; + } else { + hGroupField = this.opt('resourceGroupField'); + if (hGroupField) { + isHGrouping = true; + groupSpecs.push({ + field: hGroupField, + text: this.opt('resourceGroupText'), + render: this.opt('resourceGroupRender') + }); + } + } + allOrderSpecs = parseFieldSpecs(this.opt('resourceOrder')); + plainOrderSpecs = []; + for (k = 0, len1 = allOrderSpecs.length; k < len1; k++) { + orderSpec = allOrderSpecs[k]; + isGroup = false; + for (l = 0, len2 = groupSpecs.length; l < len2; l++) { + groupSpec = groupSpecs[l]; + if (groupSpec.field === orderSpec.field) { + groupSpec.order = orderSpec.order; + isGroup = true; + break; + } + } + if (!isGroup) { + plainOrderSpecs.push(orderSpec); + } + } + this.superHeaderText = superHeaderText; + this.isVGrouping = isVGrouping; + this.isHGrouping = isHGrouping; + this.groupSpecs = groupSpecs; + this.colSpecs = groupColSpecs.concat(plainColSpecs); + return this.orderSpecs = plainOrderSpecs; + }; + + ResourceTimelineView.prototype.renderSkeleton = function() { + ResourceTimelineView.__super__.renderSkeleton.apply(this, arguments); + this.renderResourceGridSkeleton(); + this.joiner = new ScrollJoiner('vertical', [this.resourceGrid.bodyScroller, this.timeGrid.bodyScroller]); + return this.initDividerMoving(); + }; + + ResourceTimelineView.prototype.renderSkeletonHtml = function() { + return '
'; + }; + + ResourceTimelineView.prototype.renderResourceGridSkeleton = function() { + this.resourceGrid.el = this.el.find('tbody .fc-resource-area'); + this.resourceGrid.headEl = this.el.find('thead .fc-resource-area'); + return this.resourceGrid.renderSkeleton(); + }; + + ResourceTimelineView.prototype.initDividerMoving = function() { + var ref; + this.dividerEls = this.el.find('.fc-divider'); + this.dividerWidth = (ref = this.opt('resourceAreaWidth')) != null ? ref : this.resourceGrid.tableWidth; + if (this.dividerWidth != null) { + this.positionDivider(this.dividerWidth); + } + return this.dividerEls.on('mousedown', (function(_this) { + return function(ev) { + return _this.dividerMousedown(ev); + }; + })(this)); + }; + + ResourceTimelineView.prototype.dividerMousedown = function(ev) { + var dragListener, isRTL, maxWidth, minWidth, origWidth; + isRTL = this.opt('isRTL'); + minWidth = 30; + maxWidth = this.el.width() - 30; + origWidth = this.getNaturalDividerWidth(); + dragListener = new DragListener({ + dragStart: (function(_this) { + return function() { + return _this.dividerEls.addClass('fc-active'); + }; + })(this), + drag: (function(_this) { + return function(dx, dy) { + var width; + if (isRTL) { + width = origWidth - dx; + } else { + width = origWidth + dx; + } + width = Math.max(width, minWidth); + width = Math.min(width, maxWidth); + _this.dividerWidth = width; + _this.positionDivider(width); + return _this.updateWidth(); + }; + })(this), + dragStop: (function(_this) { + return function() { + return _this.dividerEls.removeClass('fc-active'); + }; + })(this) + }); + return dragListener.mousedown(ev); + }; + + ResourceTimelineView.prototype.getNaturalDividerWidth = function() { + return this.el.find('.fc-resource-area').width(); + }; + + ResourceTimelineView.prototype.positionDivider = function(w) { + return this.el.find('.fc-resource-area').width(w); + }; + + ResourceTimelineView.prototype.renderEvents = function(events) { + this.timeGrid.renderEvents(events); + this.syncRowHeights(); + return this.updateWidth(); + }; + + ResourceTimelineView.prototype.unrenderEvents = function() { + this.timeGrid.unrenderEvents(); + this.syncRowHeights(); + return this.updateWidth(); + }; + + ResourceTimelineView.prototype.updateWidth = function() { + ResourceTimelineView.__super__.updateWidth.apply(this, arguments); + this.resourceGrid.updateWidth(); + this.joiner.update(); + if (this.cellFollower) { + return this.cellFollower.update(); + } + }; + + ResourceTimelineView.prototype.updateHeight = function(isResize) { + ResourceTimelineView.__super__.updateHeight.apply(this, arguments); + if (isResize) { + return this.syncRowHeights(); + } + }; + + ResourceTimelineView.prototype.setHeight = function(totalHeight, isAuto) { + var bodyHeight, headHeight; + headHeight = this.syncHeadHeights(); + if (isAuto) { + bodyHeight = 'auto'; + } else { + bodyHeight = totalHeight - headHeight - this.queryMiscHeight(); + } + this.timeGrid.bodyScroller.setHeight(bodyHeight); + return this.resourceGrid.bodyScroller.setHeight(bodyHeight); + }; + + ResourceTimelineView.prototype.queryMiscHeight = function() { + return this.el.outerHeight() - Math.max(this.resourceGrid.headScroller.el.outerHeight(), this.timeGrid.headScroller.el.outerHeight()) - Math.max(this.resourceGrid.bodyScroller.el.outerHeight(), this.timeGrid.bodyScroller.el.outerHeight()); + }; + + ResourceTimelineView.prototype.syncHeadHeights = function() { + var headHeight; + this.resourceGrid.headHeight('auto'); + this.timeGrid.headHeight('auto'); + headHeight = Math.max(this.resourceGrid.headHeight(), this.timeGrid.headHeight()); + this.resourceGrid.headHeight(headHeight); + this.timeGrid.headHeight(headHeight); + return headHeight; + }; + + ResourceTimelineView.prototype.scrollToResource = function(resource) { + return this.timeGrid.scrollToResource(resource); + }; + + ResourceTimelineView.prototype.setResources = function(resources) { + var j, len, resource; + this.batchRows(); + for (j = 0, len = resources.length; j < len; j++) { + resource = resources[j]; + this.insertResource(resource); + } + this.unbatchRows(); + return this.reinitializeCellFollowers(); + }; + + ResourceTimelineView.prototype.unsetResources = function() { + this.batchRows(); + this.rowHierarchy.removeChildren(); + this.unbatchRows(); + return this.reinitializeCellFollowers(); + }; + + + /* + TODO: the scenario where there were previously unassociated events that are now + attached to this resource. should render those events immediately. + */ + + ResourceTimelineView.prototype.addResource = function(resource) { + this.insertResource(resource); + return this.reinitializeCellFollowers(); + }; + + ResourceTimelineView.prototype.removeResource = function(resource) { + var row; + row = this.getResourceRow(resource.id); + if (row) { + this.batchRows(); + row.remove(); + this.unbatchRows(); + return this.reinitializeCellFollowers(); + } + }; + + ResourceTimelineView.prototype.cellFollower = null; + + ResourceTimelineView.prototype.reinitializeCellFollowers = function() { + var cellContent, j, len, nodes, ref, row; + if (this.cellFollower) { + this.cellFollower.clearSprites(); + } + this.cellFollower = new ScrollFollower(this.resourceGrid.bodyScroller); + this.cellFollower.isHFollowing = false; + this.cellFollower.isVFollowing = true; + nodes = []; + ref = this.rowHierarchy.getNodes(); + for (j = 0, len = ref.length; j < len; j++) { + row = ref[j]; + if (row instanceof VRowGroup) { + if (row.groupTd) { + cellContent = row.groupTd.find('.fc-cell-content'); + if (cellContent.length) { + nodes.push(cellContent[0]); + } + } + } + } + return this.cellFollower.setSprites($(nodes)); + }; + + ResourceTimelineView.prototype.insertResource = function(resource, parentResourceRow) { + var childResource, j, len, parentId, ref, results, row; + row = new ResourceRow(this, resource); + if (parentResourceRow == null) { + parentId = resource.parentId; + if (parentId) { + parentResourceRow = this.getResourceRow(parentId); + } + } + if (parentResourceRow) { + this.insertRowAsChild(row, parentResourceRow); + } else { + this.insertRow(row); + } + ref = resource.children; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + childResource = ref[j]; + results.push(this.insertResource(childResource, row)); + } + return results; + }; + + ResourceTimelineView.prototype.insertRow = function(row, parent, groupSpecs) { + var group; + if (parent == null) { + parent = this.rowHierarchy; + } + if (groupSpecs == null) { + groupSpecs = this.groupSpecs; + } + if (groupSpecs.length) { + group = this.ensureResourceGroup(row, parent, groupSpecs[0]); + if (group instanceof HRowGroup) { + return this.insertRowAsChild(row, group); + } else { + return this.insertRow(row, group, groupSpecs.slice(1)); + } + } else { + return this.insertRowAsChild(row, parent); + } + }; + + ResourceTimelineView.prototype.insertRowAsChild = function(row, parent) { + return parent.addChild(row, this.computeChildRowPosition(row, parent)); + }; + + ResourceTimelineView.prototype.computeChildRowPosition = function(child, parent) { + var cmp, i, j, len, ref, sibling; + if (this.orderSpecs.length) { + ref = parent.children; + for (i = j = 0, len = ref.length; j < len; i = ++j) { + sibling = ref[i]; + cmp = this.compareResources(sibling.resource || {}, child.resource || {}); + if (cmp > 0) { + return i; + } + } + } + return null; + }; + + ResourceTimelineView.prototype.compareResources = function(a, b) { + return compareByFieldSpecs(a, b, this.orderSpecs); + }; + + ResourceTimelineView.prototype.ensureResourceGroup = function(row, parent, spec) { + var cmp, group, groupValue, i, j, k, len, len1, ref, ref1, testGroup; + groupValue = (row.resource || {})[spec.field]; + group = null; + if (spec.order) { + ref = parent.children; + for (i = j = 0, len = ref.length; j < len; i = ++j) { + testGroup = ref[i]; + cmp = flexibleCompare(testGroup.groupValue, groupValue) * spec.order; + if (cmp === 0) { + group = testGroup; + break; + } else if (cmp > 0) { + break; + } + } + } else { + ref1 = parent.children; + for (i = k = 0, len1 = ref1.length; k < len1; i = ++k) { + testGroup = ref1[i]; + if (testGroup.groupValue === groupValue) { + group = testGroup; + break; + } + } + } + if (!group) { + if (this.isVGrouping) { + group = new VRowGroup(this, spec, groupValue); + } else { + group = new HRowGroup(this, spec, groupValue); + } + parent.addChild(group, i); + } + return group; + }; + + ResourceTimelineView.prototype.pairSegsWithRows = function(segs) { + var j, len, pair, pairs, pairsById, resourceId, rowObj, seg; + pairs = []; + pairsById = {}; + for (j = 0, len = segs.length; j < len; j++) { + seg = segs[j]; + resourceId = seg.resourceId || ''; + rowObj = this.getResourceRow(resourceId); + if (rowObj) { + pair = pairsById[resourceId]; + if (!pair) { + pair = [rowObj, []]; + pairs.push(pair); + pairsById[resourceId] = pair; + } + pair[1].push(seg); + } + } + return pairs; + }; + + ResourceTimelineView.prototype.rowAdded = function(row) { + var isNesting, wasNesting; + if (row instanceof ResourceRow) { + this.resourceRowHash[row.resource.id] = row; + } + wasNesting = this.isNesting; + isNesting = Boolean(this.nestingCnt += row.depth ? 1 : 0); + if (wasNesting !== isNesting) { + this.el.toggleClass('fc-nested', isNesting); + this.el.toggleClass('fc-flat', !isNesting); + } + return this.isNesting = isNesting; + }; + + ResourceTimelineView.prototype.rowRemoved = function(row) { + var isNesting, wasNesting; + if (row instanceof ResourceRow) { + delete this.resourceRowHash[row.resource.id]; + } + wasNesting = this.isNesting; + isNesting = Boolean(this.nestingCnt -= row.depth ? 1 : 0); + if (wasNesting !== isNesting) { + this.el.toggleClass('fc-nested', isNesting); + this.el.toggleClass('fc-flat', !isNesting); + } + return this.isNesting = isNesting; + }; + + ResourceTimelineView.prototype.batchRowDepth = 0; + + ResourceTimelineView.prototype.shownRowBatch = null; + + ResourceTimelineView.prototype.hiddenRowBatch = null; + + ResourceTimelineView.prototype.batchRows = function() { + if (!(this.batchRowDepth++)) { + this.shownRowBatch = []; + return this.hiddenRowBatch = []; + } + }; + + ResourceTimelineView.prototype.unbatchRows = function() { + if (!(--this.batchRowDepth)) { + if (this.hiddenRowBatch.length) { + this.rowsHidden(this.hiddenRowBatch); + } + if (this.shownRowBatch.length) { + this.rowsShown(this.shownRowBatch); + } + this.hiddenRowBatch = null; + return this.shownRowBatch = null; + } + }; + + ResourceTimelineView.prototype.rowShown = function(row) { + if (this.shownRowBatch) { + return this.shownRowBatch.push(row); + } else { + return this.rowsShown([row]); + } + }; + + ResourceTimelineView.prototype.rowHidden = function(row) { + if (this.hiddenRowBatch) { + return this.hiddenRowBatch.push(row); + } else { + return this.rowsHidden([row]); + } + }; + + ResourceTimelineView.prototype.rowsShown = function(rows) { + this.syncRowHeights(rows); + return this.updateWidth(); + }; + + ResourceTimelineView.prototype.rowsHidden = function(rows) { + return this.updateWidth(); + }; + + ResourceTimelineView.prototype.tbodyHash = null; + + ResourceTimelineView.prototype.renderStoredResources = function() { + this.tbodyHash = { + spreadsheet: this.resourceGrid.tbodyEl, + event: this.timeGrid.tbodyEl + }; + this.batchRows(); + this.rowHierarchy.show(); + this.unbatchRows(); + return this.reinitializeCellFollowers(); + }; + + ResourceTimelineView.prototype.unrenderStoredResources = function() { + this.batchRows(); + this.rowHierarchy.recursivelyUnrender(); + this.unbatchRows(); + return this.reinitializeCellFollowers(); + }; + + ResourceTimelineView.prototype.syncRowHeights = function(visibleRows, safe) { + var h, h1, h2, i, innerHeights, j, k, len, len1, row; + if (safe == null) { + safe = false; + } + if (visibleRows == null) { + visibleRows = this.getVisibleRows(); + } + for (j = 0, len = visibleRows.length; j < len; j++) { + row = visibleRows[j]; + row.setTrInnerHeight(''); + } + innerHeights = (function() { + var k, len1, results; + results = []; + for (k = 0, len1 = visibleRows.length; k < len1; k++) { + row = visibleRows[k]; + h = row.getMaxTrInnerHeight(); + if (safe) { + h += h % 2; + } + results.push(h); + } + return results; + })(); + for (i = k = 0, len1 = visibleRows.length; k < len1; i = ++k) { + row = visibleRows[i]; + row.setTrInnerHeight(innerHeights[i]); + } + if (!safe) { + h1 = this.resourceGrid.tbodyEl.height(); + h2 = this.timeGrid.tbodyEl.height(); + if (Math.abs(h1 - h2) > 1) { + return this.syncRowHeights(visibleRows, true); + } + } + }; + + ResourceTimelineView.prototype.getVisibleRows = function() { + var j, len, ref, results, row; + ref = this.rowHierarchy.getRows(); + results = []; + for (j = 0, len = ref.length; j < len; j++) { + row = ref[j]; + if (row.isShown) { + results.push(row); + } + } + return results; + }; + + ResourceTimelineView.prototype.getEventRows = function() { + var j, len, ref, results, row; + ref = this.rowHierarchy.getRows(); + results = []; + for (j = 0, len = ref.length; j < len; j++) { + row = ref[j]; + if (row instanceof EventRow) { + results.push(row); + } + } + return results; + }; + + ResourceTimelineView.prototype.getResourceRow = function(resourceId) { + return this.resourceRowHash[resourceId]; + }; + + ResourceTimelineView.prototype.setScroll = function(state) { + ResourceTimelineView.__super__.setScroll.apply(this, arguments); + return this.resourceGrid.bodyScroller.scrollTop(state.top); + }; + + return ResourceTimelineView; + +})(TimelineView); + +ResourceTimelineGrid = (function(superClass) { + extend(ResourceTimelineGrid, superClass); + + function ResourceTimelineGrid() { + return ResourceTimelineGrid.__super__.constructor.apply(this, arguments); + } + + ResourceTimelineGrid.mixin(ResourceGrid); + + ResourceTimelineGrid.prototype.eventRows = null; + + ResourceTimelineGrid.prototype.shownEventRows = null; + + ResourceTimelineGrid.prototype.tbodyEl = null; + + ResourceTimelineGrid.prototype.build = function() { + var row; + this.eventRows = this.view.getEventRows(); + this.shownEventRows = (function() { + var j, len, ref, results; + ref = this.eventRows; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + row = ref[j]; + if (row.isShown) { + results.push(row); + } + } + return results; + }).call(this); + return this.rowCnt = this.shownEventRows.length; + }; + + ResourceTimelineGrid.prototype.clear = function() { + this.eventRows = null; + return this.shownEventRows = null; + }; + + ResourceTimelineGrid.prototype.getRowData = function(row) { + return { + resourceId: this.shownEventRows[row].resource.id + }; + }; + + ResourceTimelineGrid.prototype.getRowEl = function(row) { + return this.shownEventRows[row].getTr('event'); + }; + + ResourceTimelineGrid.prototype.renderSkeleton = function() { + var rowContainerEl; + ResourceTimelineGrid.__super__.renderSkeleton.apply(this, arguments); + this.segContainerEl.remove(); + this.segContainerEl = null; + rowContainerEl = $('
').appendTo(this.bodyScroller.contentEl); + return this.tbodyEl = rowContainerEl.find('tbody'); + }; + + ResourceTimelineGrid.prototype.renderFgSegs = function(segs) { + var containerObj, containerSegs, j, len, pair, pairs, visiblePairs; + segs = this.renderFgSegEls(segs); + pairs = this.view.pairSegsWithRows(segs); + visiblePairs = []; + for (j = 0, len = pairs.length; j < len; j++) { + pair = pairs[j]; + containerObj = pair[0], containerSegs = pair[1]; + containerObj.fgSegs = containerSegs; + if (containerObj.isShown) { + containerObj.isSegsRendered = true; + visiblePairs.push(pair); + } + } + this.renderFgSegsInContainers(visiblePairs); + this.updateSegFollowers(segs); + return segs; + }; + + ResourceTimelineGrid.prototype.unrenderFgSegs = function() { + var eventRow, eventRows, j, len; + this.clearSegFollowers(); + eventRows = this.view.getEventRows(); + for (j = 0, len = eventRows.length; j < len; j++) { + eventRow = eventRows[j]; + eventRow.fgSegs = null; + eventRow.isSegsRendered = false; + } + return this.unrenderFgContainers(eventRows); + }; + + ResourceTimelineGrid.prototype.renderFill = function(type, segs, className) { + var j, k, len, len1, nonResourceSegs, pair, pairs, resourceSegs, rowObj, rowSegs, seg, visiblePairs; + segs = this.renderFillSegEls(type, segs); + resourceSegs = []; + nonResourceSegs = []; + for (j = 0, len = segs.length; j < len; j++) { + seg = segs[j]; + if (seg.resourceId) { + resourceSegs.push(seg); + } else { + nonResourceSegs.push(seg); + } + } + pairs = this.view.pairSegsWithRows(resourceSegs); + visiblePairs = []; + for (k = 0, len1 = pairs.length; k < len1; k++) { + pair = pairs[k]; + rowObj = pair[0], rowSegs = pair[1]; + if (type === 'bgEvent') { + rowObj.bgSegs = rowSegs; + } + if (rowObj.isShown) { + visiblePairs.push(pair); + } + } + if (nonResourceSegs.length) { + visiblePairs.unshift([this, nonResourceSegs]); + } + this.renderFillInContainers(type, visiblePairs, className); + return segs; + }; + + ResourceTimelineGrid.prototype.renderHelper = function(event, sourceSeg) { + var pairs, segs; + segs = this.eventsToSegs([event]); + segs = this.renderFgSegEls(segs); + pairs = this.view.pairSegsWithRows(segs); + return this.renderHelperSegsInContainers(pairs, sourceSeg); + }; + + ResourceTimelineGrid.prototype.computeInitialScroll = function(prevState) { + var state; + state = ResourceTimelineGrid.__super__.computeInitialScroll.apply(this, arguments); + if (prevState) { + state.resourceId = prevState.resourceId; + state.bottom = prevState.bottom; + } + return state; + }; + + ResourceTimelineGrid.prototype.queryScroll = function() { + var el, elBottom, j, len, ref, rowObj, scrollerTop, state; + state = ResourceTimelineGrid.__super__.queryScroll.apply(this, arguments); + scrollerTop = this.bodyScroller.scrollEl.offset().top; + ref = this.view.getVisibleRows(); + for (j = 0, len = ref.length; j < len; j++) { + rowObj = ref[j]; + if (rowObj.resource) { + el = rowObj.getTr('event'); + elBottom = el.offset().top + el.outerHeight(); + if (elBottom > scrollerTop) { + state.resourceId = rowObj.resource.id; + state.bottom = elBottom - scrollerTop; + break; + } + } + } + return state; + }; + + ResourceTimelineGrid.prototype.setScroll = function(state) { + var el, elBottom, innerTop, row; + if (state.resourceId) { + row = this.view.getResourceRow(state.resourceId); + if (row) { + el = row.getTr('event'); + if (el) { + innerTop = this.bodyScroller.innerEl.offset().top; + elBottom = el.offset().top + el.outerHeight(); + state.top = elBottom - state.bottom - innerTop; + } + } + } + return ResourceTimelineGrid.__super__.setScroll.call(this, state); + }; + + ResourceTimelineGrid.prototype.scrollToResource = function(resource) { + var el, innerTop, row, scrollTop; + row = this.view.getResourceRow(resource.id); + if (row) { + el = row.getTr('event'); + if (el) { + innerTop = this.bodyScroller.innerEl.offset().top; + scrollTop = el.offset().top - innerTop; + return this.bodyScroller.scrollEl.scrollTop(scrollTop); + } + } + }; + + return ResourceTimelineGrid; + +})(TimelineGrid); + +COL_MIN_WIDTH = 30; + +Spreadsheet = (function() { + Spreadsheet.prototype.view = null; + + Spreadsheet.prototype.headEl = null; + + Spreadsheet.prototype.el = null; + + Spreadsheet.prototype.tbodyEl = null; + + Spreadsheet.prototype.headScroller = null; + + Spreadsheet.prototype.bodyScroller = null; + + Spreadsheet.prototype.joiner = null; + + function Spreadsheet(view1) { + var colSpec; + this.view = view1; + this.isRTL = this.view.opt('isRTL'); + this.givenColWidths = this.colWidths = (function() { + var j, len, ref, results; + ref = this.view.colSpecs; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + colSpec = ref[j]; + results.push(colSpec.width); + } + return results; + }).call(this); + } + + Spreadsheet.prototype.colGroupHtml = ''; + + Spreadsheet.prototype.headTable = null; + + Spreadsheet.prototype.headColEls = null; + + Spreadsheet.prototype.headCellEls = null; + + Spreadsheet.prototype.bodyColEls = null; + + Spreadsheet.prototype.bodyTable = null; + + Spreadsheet.prototype.renderSkeleton = function() { + this.headScroller = new Scroller('invisible-scroll', 'hidden'); + this.headScroller.contentEl.html(this.renderHeadHtml()); + this.headEl.append(this.headScroller.el); + this.bodyScroller = new Scroller('auto', 'invisible-scroll'); + this.bodyScroller.contentEl.html('' + this.colGroupHtml + '
'); + this.tbodyEl = this.bodyScroller.contentEl.find('tbody'); + this.el.append(this.bodyScroller.el); + this.joiner = new ScrollJoiner('horizontal', [this.headScroller, this.bodyScroller]); + this.headTable = this.headEl.find('table'); + this.headColEls = this.headEl.find('col'); + this.headCellEls = this.headScroller.contentEl.find('tr:last-child th'); + this.bodyColEls = this.el.find('col'); + this.bodyTable = this.el.find('table'); + this.colMinWidths = this.computeColMinWidths(); + this.applyColWidths(); + return this.initColResizing(); + }; + + Spreadsheet.prototype.renderHeadHtml = function() { + var colGroupHtml, colSpecs, html, i, isLast, isMainCol, j, k, len, len1, o; + colSpecs = this.view.colSpecs; + html = ''; + colGroupHtml = ''; + for (j = 0, len = colSpecs.length; j < len; j++) { + o = colSpecs[j]; + if (o.isMain) { + colGroupHtml += ''; + } else { + colGroupHtml += ''; + } + } + colGroupHtml += ''; + this.colGroupHtml = colGroupHtml; + html += colGroupHtml; + html += ''; + if (this.view.superHeaderText) { + html += '' + '' + ''; + } + html += ''; + isMainCol = true; + for (i = k = 0, len1 = colSpecs.length; k < len1; i = ++k) { + o = colSpecs[i]; + isLast = i === colSpecs.length - 1; + html += ''; + } + html += ''; + html += '
' + '
' + '' + htmlEscape(this.view.superHeaderText) + '' + '
' + '
' + '
' + '
' + (o.isMain ? '
' : '') + '' + htmlEscape(o.labelText || '') + '' + '
' + (!isLast ? '
' : '') + '
' + '
'; + return html; + }; + + Spreadsheet.prototype.givenColWidths = null; + + Spreadsheet.prototype.colWidths = null; + + Spreadsheet.prototype.colMinWidths = null; + + Spreadsheet.prototype.tableWidth = null; + + Spreadsheet.prototype.tableMinWidth = null; + + Spreadsheet.prototype.initColResizing = function() { + return this.headEl.find('th .fc-col-resizer').each((function(_this) { + return function(i, resizerEl) { + resizerEl = $(resizerEl); + return resizerEl.on('mousedown', function(ev) { + return _this.colResizeMousedown(i, ev, resizerEl); + }); + }; + })(this)); + }; + + Spreadsheet.prototype.colResizeMousedown = function(i, ev, resizerEl) { + var colWidths, dragListener, minWidth, origColWidth; + colWidths = this.colWidths = this.queryColWidths(); + colWidths.pop(); + colWidths.push('auto'); + origColWidth = colWidths[i]; + minWidth = Math.min(this.colMinWidths[i], COL_MIN_WIDTH); + dragListener = new DragListener({ + dragStart: (function(_this) { + return function() { + return resizerEl.addClass('fc-active'); + }; + })(this), + drag: (function(_this) { + return function(dx, dy) { + var width; + width = origColWidth + (_this.isRTL ? -dx : dx); + width = Math.max(width, minWidth); + colWidths[i] = width; + return _this.applyColWidths(); + }; + })(this), + dragStop: (function(_this) { + return function() { + return resizerEl.removeClass('fc-active'); + }; + })(this) + }); + return dragListener.mousedown(ev); + }; + + Spreadsheet.prototype.applyColWidths = function() { + var allNumbers, anyPercentages, colMinWidths, colWidth, colWidths, cssWidth, cssWidths, defaultCssWidth, i, j, k, l, len, len1, len2, tableMinWidth, total; + colMinWidths = this.colMinWidths; + colWidths = this.colWidths; + allNumbers = true; + anyPercentages = false; + total = 0; + for (j = 0, len = colWidths.length; j < len; j++) { + colWidth = colWidths[j]; + if (typeof colWidth === 'number') { + total += colWidth; + } else { + allNumbers = false; + if (colWidth) { + anyPercentages = true; + } + } + } + defaultCssWidth = anyPercentages ? 'auto' : ''; + cssWidths = (function() { + var k, len1, results; + results = []; + for (i = k = 0, len1 = colWidths.length; k < len1; i = ++k) { + colWidth = colWidths[i]; + results.push(colWidth != null ? colWidth : defaultCssWidth); + } + return results; + })(); + tableMinWidth = 0; + for (i = k = 0, len1 = cssWidths.length; k < len1; i = ++k) { + cssWidth = cssWidths[i]; + tableMinWidth += typeof cssWidth === 'number' ? cssWidth : colMinWidths[i]; + } + for (i = l = 0, len2 = cssWidths.length; l < len2; i = ++l) { + cssWidth = cssWidths[i]; + this.headColEls.eq(i).width(cssWidth); + this.bodyColEls.eq(i).width(cssWidth); + } + this.headScroller.setContentMinWidth(tableMinWidth); + this.bodyScroller.setContentMinWidth(tableMinWidth); + this.tableMinWidth = tableMinWidth; + return this.tableWidth = allNumbers ? total : void 0; + }; + + Spreadsheet.prototype.computeColMinWidths = function() { + var i, j, len, ref, results, width; + ref = this.givenColWidths; + results = []; + for (i = j = 0, len = ref.length; j < len; i = ++j) { + width = ref[i]; + if (typeof width === 'number') { + results.push(width); + } else { + results.push(parseInt(this.headColEls.eq(i).css('min-width')) || COL_MIN_WIDTH); + } + } + return results; + }; + + Spreadsheet.prototype.queryColWidths = function() { + var j, len, node, ref, results; + ref = this.headCellEls; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + node = ref[j]; + results.push($(node).outerWidth()); + } + return results; + }; + + Spreadsheet.prototype.updateWidth = function() { + this.headScroller.update(); + this.bodyScroller.update(); + this.joiner.update(); + if (this.follower) { + return this.follower.update(); + } + }; + + Spreadsheet.prototype.headHeight = function() { + var table; + table = this.headScroller.contentEl.find('table'); + return table.height.apply(table, arguments); + }; + + return Spreadsheet; + +})(); + + +/* +An abstract node in a row-hierarchy tree. +May be a self-contained single row, a row with subrows, +OR a grouping of rows without its own distinct row. + */ + +RowParent = (function() { + RowParent.prototype.view = null; + + RowParent.prototype.parent = null; + + RowParent.prototype.prevSibling = null; + + RowParent.prototype.children = null; + + RowParent.prototype.depth = 0; + + RowParent.prototype.hasOwnRow = false; + + RowParent.prototype.trHash = null; + + RowParent.prototype.trs = null; + + RowParent.prototype.isRendered = false; + + RowParent.prototype.isExpanded = true; + + RowParent.prototype.isShown = false; + + function RowParent(view1) { + this.view = view1; + this.children = []; + this.trHash = {}; + this.trs = $(); + } + + + /* + Adds the given node as a child. + Will be inserted at the `index`. If not given, will be appended to the end. + */ + + RowParent.prototype.addChild = function(child, index) { + var children, j, len, node, ref; + child.remove(); + children = this.children; + if (index != null) { + children.splice(index, 0, child); + } else { + index = children.length; + children.push(child); + } + child.prevSibling = index > 0 ? children[index - 1] : null; + if (index < children.length - 1) { + children[index + 1].prevSibling = child; + } + child.parent = this; + child.depth = this.depth + (this.hasOwnRow ? 1 : 0); + ref = child.getNodes(); + for (j = 0, len = ref.length; j < len; j++) { + node = ref[j]; + node.added(); + } + if (this.isShown && this.isExpanded) { + return child.show(); + } + }; + + + /* + Removes the given child from the node. Assumes it is a direct child. + If not a direct child, returns false and nothing happens. + Unrenders the child and triggers handlers. + */ + + RowParent.prototype.removeChild = function(child) { + var children, i, isFound, j, k, len, len1, ref, row, testChild; + children = this.children; + isFound = false; + for (i = j = 0, len = children.length; j < len; i = ++j) { + testChild = children[i]; + if (testChild === child) { + isFound = true; + break; + } + } + if (!isFound) { + return false; + } else { + if (i < children.length - 1) { + children[i + 1].prevSibling = child.prevSibling; + } + children.splice(i, 1); + child.recursivelyUnrender(); + ref = child.getNodes(); + for (k = 0, len1 = ref.length; k < len1; k++) { + row = ref[k]; + row.removed(); + } + child.parent = null; + child.prevSibling = null; + return child; + } + }; + + + /* + Removes all of the node's children from the hierarchy. Unrenders them and triggers callbacks. + NOTE: batchRows/unbatchRows should probably be called before this happens :( + */ + + RowParent.prototype.removeChildren = function() { + var child, j, k, len, len1, ref, ref1; + ref = this.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + child.recursivelyUnrender(); + } + ref1 = this.getDescendants(); + for (k = 0, len1 = ref1.length; k < len1; k++) { + child = ref1[k]; + child.removed(); + } + return this.children = []; + }; + + + /* + Removes this node from its parent + */ + + RowParent.prototype.remove = function() { + if (this.parent) { + return this.parent.removeChild(this); + } + }; + + + /* + Gets the last direct child node + */ + + RowParent.prototype.getLastChild = function() { + var children; + children = this.children; + return children[children.length - 1]; + }; + + + /* + Walks backward in the hierarchy to find the previous row leaf node. + When looking at the hierarchy in a flat linear fashion, this is the revealed row just before the current. + */ + + RowParent.prototype.getPrevRow = function() { + var lastChild, node; + node = this; + while (node) { + if (node.prevSibling) { + node = node.prevSibling; + while ((lastChild = node.getLastChild())) { + node = lastChild; + } + } else { + node = node.parent; + } + if (node && node.hasOwnRow && node.isShown) { + return node; + } + } + return null; + }; + + + /* + Returns the first node in the subtree that has a revealed row + */ + + RowParent.prototype.getLeadingRow = function() { + if (this.hasOwnRow) { + return this; + } else if (this.isExpanded && this.children.length) { + return this.children[0].getLeadingRow(); + } + }; + + + /* + Generates a flat array containing all the row-nodes of the subtree. Descendants + self + */ + + RowParent.prototype.getRows = function(batchArray) { + var child, j, len, ref; + if (batchArray == null) { + batchArray = []; + } + if (this.hasOwnRow) { + batchArray.push(this); + } + ref = this.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + child.getRows(batchArray); + } + return batchArray; + }; + + + /* + Generates a flat array containing all the nodes (row/non-row) of the subtree. Descendants + self + */ + + RowParent.prototype.getNodes = function(batchArray) { + var child, j, len, ref; + if (batchArray == null) { + batchArray = []; + } + batchArray.push(this); + ref = this.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + child.getNodes(batchArray); + } + return batchArray; + }; + + + /* + Generates a flat array containing all the descendant nodes the current node + */ + + RowParent.prototype.getDescendants = function() { + var batchArray, child, j, len, ref; + batchArray = []; + ref = this.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + child.getNodes(batchArray); + } + return batchArray; + }; + + + /* + Builds and populates the TRs for each row type. Inserts them into the DOM. + Does this only for this single row. Not recursive. If not a row (hasOwnRow=false), does not render anything. + PRECONDITION: assumes the parent has already been rendered. + */ + + RowParent.prototype.render = function() { + var prevRow, ref, renderMethodName, tbody, tr, trNodes, type; + this.trHash = {}; + trNodes = []; + if (this.hasOwnRow) { + prevRow = this.getPrevRow(); + ref = this.view.tbodyHash; + for (type in ref) { + tbody = ref[type]; + tr = $(''); + this.trHash[type] = tr; + trNodes.push(tr[0]); + renderMethodName = 'render' + capitaliseFirstLetter(type) + 'Content'; + if (this[renderMethodName]) { + this[renderMethodName](tr); + } + if (prevRow) { + prevRow.trHash[type].after(tr); + } else { + tbody.prepend(tr); + } + } + } + this.trs = $(trNodes).on('click', '.fc-expander', proxy(this, 'toggleExpanded')); + return this.isRendered = true; + }; + + + /* + Unpopulates and removes all of this row's TRs from the DOM. Only for this single row. Not recursive. + Will trigger "hidden". + */ + + RowParent.prototype.unrender = function() { + var ref, tr, type, unrenderMethodName; + if (this.isRendered) { + ref = this.trHash; + for (type in ref) { + tr = ref[type]; + unrenderMethodName = 'unrender' + capitaliseFirstLetter(type) + 'Content'; + if (this[unrenderMethodName]) { + this[unrenderMethodName](tr); + } + } + this.trHash = {}; + this.trs.remove(); + this.trs = $(); + this.isRendered = false; + this.isShown = false; + return this.hidden(); + } + }; + + + /* + Like unrender(), but does it for this row AND all descendants. + NOTE: batchRows/unbatchRows should probably be called before this happens :( + */ + + RowParent.prototype.recursivelyUnrender = function() { + var child, j, len, ref, results; + this.unrender(); + ref = this.children; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + results.push(child.recursivelyUnrender()); + } + return results; + }; + + + /* + A simple getter for retrieving a TR jQuery object of a certain row type + */ + + RowParent.prototype.getTr = function(type) { + return this.trHash[type]; + }; + + + /* + Renders this row if not already rendered, making sure it is visible. + Also renders descendants of this subtree, based on whether they are expanded or not. + NOTE: If called externally, batchRows/unbatchRows should probably be called before this happens :( + */ + + RowParent.prototype.show = function() { + var child, j, len, ref, results; + if (!this.isShown) { + if (!this.isRendered) { + this.render(); + } else { + this.trs.css('display', ''); + } + if (this.ensureSegsRendered) { + this.ensureSegsRendered(); + } + if (this.isExpanded) { + this.indicateExpanded(); + } else { + this.indicateCollapsed(); + } + this.isShown = true; + this.shown(); + if (this.isExpanded) { + ref = this.children; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + results.push(child.show()); + } + return results; + } + } + }; + + + /* + Temporarily hides this node's TRs (if applicable) as well as all nodes in the subtree + */ + + RowParent.prototype.hide = function() { + var child, j, len, ref, results; + if (this.isShown) { + if (this.isRendered) { + this.trs.hide(); + } + this.isShown = false; + this.hidden(); + if (this.isExpanded) { + ref = this.children; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + results.push(child.hide()); + } + return results; + } + } + }; + + + /* + Reveals this node's children if they have not already been revealed. Changes any expander icon. + */ + + RowParent.prototype.expand = function() { + var child, j, len, ref; + if (!this.isExpanded) { + this.isExpanded = true; + this.indicateExpanded(); + this.view.batchRows(); + ref = this.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + child.show(); + } + this.view.unbatchRows(); + return this.animateExpand(); + } + }; + + + /* + Hides this node's children if they are not already hidden. Changes any expander icon. + */ + + RowParent.prototype.collapse = function() { + var child, j, len, ref; + if (this.isExpanded) { + this.isExpanded = false; + this.indicateCollapsed(); + this.view.batchRows(); + ref = this.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + child.hide(); + } + return this.view.unbatchRows(); + } + }; + + + /* + Switches between expanded/collapsed states + */ + + RowParent.prototype.toggleExpanded = function() { + if (this.isExpanded) { + return this.collapse(); + } else { + return this.expand(); + } + }; + + + /* + Changes the expander icon to the "expanded" state + */ + + RowParent.prototype.indicateExpanded = function() { + return this.trs.find('.fc-expander').removeClass(this.getCollapsedIcon()).addClass(this.getExpandedIcon()); + }; + + + /* + Changes the expander icon to the "collapsed" state + */ + + RowParent.prototype.indicateCollapsed = function() { + return this.trs.find('.fc-expander').removeClass(this.getExpandedIcon()).addClass(this.getCollapsedIcon()); + }; + + + /* + */ + + RowParent.prototype.enableExpanding = function() { + return this.trs.find('.fc-expander-space').addClass('fc-expander'); + }; + + + /* + */ + + RowParent.prototype.disableExpanding = function() { + return this.trs.find('.fc-expander-space').removeClass('fc-expander').removeClass(this.getExpandedIcon()).removeClass(this.getCollapsedIcon()); + }; + + RowParent.prototype.getExpandedIcon = function() { + return 'fc-icon-down-triangle'; + }; + + RowParent.prototype.getCollapsedIcon = function() { + var dir; + dir = this.view.isRTL ? 'left' : 'right'; + return 'fc-icon-' + dir + '-triangle'; + }; + + + /* + Causes a slide-down CSS transition to demonstrate that the expand has happened + */ + + RowParent.prototype.animateExpand = function() { + var ref, ref1, trs; + trs = (ref = this.children[0]) != null ? (ref1 = ref.getLeadingRow()) != null ? ref1.trs : void 0 : void 0; + if (trs) { + trs.addClass('fc-collapsed'); + setTimeout(function() { + trs.addClass('fc-transitioning'); + return trs.removeClass('fc-collapsed'); + }); + return trs.one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function() { + return trs.removeClass('fc-transitioning'); + }); + } + }; + + + /* + Find each TRs "inner div" (div within first cell). This div controls each TRs height. + Returns the max pixel height. + */ + + RowParent.prototype.getMaxTrInnerHeight = function() { + var max; + max = 0; + $.each(this.trHash, (function(_this) { + return function(type, tr) { + var innerEl; + innerEl = getFirstOwnRow(tr).find('> div'); + return max = Math.max(innerEl.height(), max); + }; + })(this)); + return max; + }; + + + /* + Find each TRs "inner div" and sets all of their heights to the same value. + */ + + RowParent.prototype.setTrInnerHeight = function(height) { + return getFirstOwnRow(this.trs).find('> div').height(height); + }; + + + /* + Triggered when the current node has been shown (either freshly rendered or re-shown) + when it had previously been unrendered or hidden. `shown` does not bubble up the hierarchy. + */ + + RowParent.prototype.shown = function() { + if (this.hasOwnRow) { + return this.rowShown(this); + } + }; + + + /* + Triggered when the current node has been hidden (either temporarily or permanently) + when it had previously been shown. `hidden` does not bubble up the hierarchy. + */ + + RowParent.prototype.hidden = function() { + if (this.hasOwnRow) { + return this.rowHidden(this); + } + }; + + + /* + Just like `shown`, but only triggered for nodes that are actual rows. Bubbles up the hierarchy. + */ + + RowParent.prototype.rowShown = function(row) { + return (this.parent || this.view).rowShown(row); + }; + + + /* + Just like `hidden`, but only triggered for nodes that are actual rows. Bubbles up the hierarchy. + */ + + RowParent.prototype.rowHidden = function(row) { + return (this.parent || this.view).rowHidden(row); + }; + + + /* + Triggered when the current node has been added to the hierarchy. `added` does not bubble up. + */ + + RowParent.prototype.added = function() { + if (this.hasOwnRow) { + return this.rowAdded(this); + } + }; + + + /* + Triggered when the current node has been removed from the hierarchy. `removed` does not bubble up. + */ + + RowParent.prototype.removed = function() { + if (this.hasOwnRow) { + return this.rowRemoved(this); + } + }; + + + /* + Just like `added`, but only triggered for nodes that are actual rows. Bubbles up the hierarchy. + */ + + RowParent.prototype.rowAdded = function(row) { + return (this.parent || this.view).rowAdded(row); + }; + + + /* + Just like `removed`, but only triggered for nodes that are actual rows. Bubbles up the hierarchy. + */ + + RowParent.prototype.rowRemoved = function(row) { + return (this.parent || this.view).rowRemoved(row); + }; + + return RowParent; + +})(); + + +/* +An abstract node in a row-hierarchy tree that contains other nodes. +Will have some sort of rendered label indicating the grouping, +up to the subclass for determining what to do with it. + */ + +RowGroup = (function(superClass) { + extend(RowGroup, superClass); + + RowGroup.prototype.groupSpec = null; + + RowGroup.prototype.groupValue = null; + + function RowGroup(view, groupSpec1, groupValue1) { + this.groupSpec = groupSpec1; + this.groupValue = groupValue1; + RowGroup.__super__.constructor.apply(this, arguments); + } + + + /* + Called when this row (if it renders a row) or a subrow is removed + */ + + RowGroup.prototype.rowRemoved = function(row) { + RowGroup.__super__.rowRemoved.apply(this, arguments); + if (row !== this && !this.children.length) { + return this.remove(); + } + }; + + + /* + Renders the content wrapper element that will be inserted into this row's TD cell + */ + + RowGroup.prototype.renderGroupContentEl = function() { + var contentEl, filter; + contentEl = $('
').append(this.renderGroupTextEl()); + filter = this.groupSpec.render; + if (typeof filter === 'function') { + contentEl = filter(contentEl, this.groupValue) || contentEl; + } + return contentEl; + }; + + + /* + Renders the text span element that will be inserted into this row's TD cell. + Goes within the content element. + */ + + RowGroup.prototype.renderGroupTextEl = function() { + var filter, text; + text = this.groupValue || ''; + filter = this.groupSpec.text; + if (typeof filter === 'function') { + text = filter(text) || text; + } + return $('').text(text); + }; + + return RowGroup; + +})(RowParent); + + +/* +A row grouping that renders as a single solid row that spans width-wise (like a horizontal rule) + */ + +HRowGroup = (function(superClass) { + extend(HRowGroup, superClass); + + function HRowGroup() { + return HRowGroup.__super__.constructor.apply(this, arguments); + } + + HRowGroup.prototype.hasOwnRow = true; + + + /* + Renders this row's TR for the "spreadsheet" quadrant, the area with info about each resource + */ + + HRowGroup.prototype.renderSpreadsheetContent = function(tr) { + var contentEl; + contentEl = this.renderGroupContentEl(); + contentEl.prepend(''); + return $('').attr('colspan', this.view.colSpecs.length).append($('
').append(contentEl)).appendTo(tr); + }; + + + /* + Renders this row's TR for the quadrant that contains a resource's events + */ + + HRowGroup.prototype.renderEventContent = function(tr) { + return tr.append('
'); + }; + + return HRowGroup; + +})(RowGroup); + + +/* +A row grouping that renders as a tall multi-cell vertical span in the "spreadsheet" area + */ + +VRowGroup = (function(superClass) { + extend(VRowGroup, superClass); + + function VRowGroup() { + return VRowGroup.__super__.constructor.apply(this, arguments); + } + + VRowGroup.prototype.rowspan = 0; + + VRowGroup.prototype.leadingTr = null; + + VRowGroup.prototype.groupTd = null; + + + /* + Called when a row somewhere within the grouping is shown + */ + + VRowGroup.prototype.rowShown = function(row) { + this.rowspan += 1; + this.renderRowspan(); + return VRowGroup.__super__.rowShown.apply(this, arguments); + }; + + + /* + Called when a row somewhere within the grouping is hidden + */ + + VRowGroup.prototype.rowHidden = function(row) { + this.rowspan -= 1; + this.renderRowspan(); + return VRowGroup.__super__.rowHidden.apply(this, arguments); + }; + + + /* + Makes sure the groupTd has the correct rowspan / place in the DOM. + PRECONDITION: in the case of multiple group nesting, a child's renderRowspan() + will be called before the parent's renderRowspan(). + */ + + VRowGroup.prototype.renderRowspan = function() { + var leadingTr; + if (this.rowspan) { + if (!this.groupTd) { + this.groupTd = $('').append(this.renderGroupContentEl()); + } + this.groupTd.attr('rowspan', this.rowspan); + leadingTr = this.getLeadingRow().getTr('spreadsheet'); + if (leadingTr !== this.leadingTr) { + if (leadingTr) { + leadingTr.prepend(this.groupTd); + } + return this.leadingTr = leadingTr; + } + } else { + if (this.groupTd) { + this.groupTd.remove(); + this.groupTd = null; + } + return this.leadingTr = null; + } + }; + + return VRowGroup; + +})(RowGroup); + +EventRow = (function(superClass) { + extend(EventRow, superClass); + + function EventRow() { + return EventRow.__super__.constructor.apply(this, arguments); + } + + EventRow.prototype.hasOwnRow = true; + + EventRow.prototype.segContainerEl = null; + + EventRow.prototype.segContainerHeight = null; + + EventRow.prototype.innerEl = null; + + EventRow.prototype.bgSegContainerEl = null; + + EventRow.prototype.isSegsRendered = false; + + EventRow.prototype.bgSegs = null; + + EventRow.prototype.fgSegs = null; + + EventRow.prototype.renderEventContent = function(tr) { + tr.html('
'); + this.segContainerEl = tr.find('.fc-event-container'); + this.innerEl = this.bgSegContainerEl = tr.find('td > div'); + return this.ensureSegsRendered(); + }; + + EventRow.prototype.ensureSegsRendered = function() { + if (!this.isSegsRendered) { + if (this.bgSegs) { + this.view.timeGrid.renderFillInContainer('bgEvent', this, this.bgSegs); + } + if (this.fgSegs) { + this.view.timeGrid.renderFgSegsInContainers([[this, this.fgSegs]]); + } + return this.isSegsRendered = true; + } + }; + + EventRow.prototype.unrenderEventContent = function() { + this.bgSegs = null; + this.fgSegs = null; + return this.isSegsRendered = false; + }; + + return EventRow; + +})(RowParent); + + +/* +A row that renders information about a particular resource, as well as it events (handled by superclass) + */ + +ResourceRow = (function(superClass) { + extend(ResourceRow, superClass); + + ResourceRow.prototype.resource = null; + + function ResourceRow(view, resource1) { + this.resource = resource1; + ResourceRow.__super__.constructor.apply(this, arguments); + } + + + /* + Called when a row in the tree has been added + */ + + ResourceRow.prototype.rowAdded = function(row) { + ResourceRow.__super__.rowAdded.apply(this, arguments); + if (row !== this && this.isRendered) { + if (this.children.length === 1) { + this.enableExpanding(); + if (this.isExpanded) { + return this.indicateExpanded(); + } else { + return this.indicateCollapsed(); + } + } + } + }; + + + /* + Called when a row in the tree has been removed + */ + + ResourceRow.prototype.rowRemoved = function(row) { + ResourceRow.__super__.rowRemoved.apply(this, arguments); + if (row !== this && this.isRendered) { + if (!this.children.length) { + return this.disableExpanding(); + } + } + }; + + ResourceRow.prototype.render = function() { + ResourceRow.__super__.render.apply(this, arguments); + if (this.children.length > 0) { + this.enableExpanding(); + } else { + this.disableExpanding(); + } + return this.view.trigger('resourceRender', this.resource, this.resource, this.getTr('spreadsheet').find('> td'), this.getTr('event').find('> td')); + }; + + + /* + Populates the TR with cells containing data about the resource + */ + + ResourceRow.prototype.renderSpreadsheetContent = function(tr) { + var colSpec, contentEl, input, j, len, ref, resource, results, td, text; + resource = this.resource; + ref = this.view.colSpecs; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + colSpec = ref[j]; + if (colSpec.group) { + continue; + } + input = colSpec.field ? resource[colSpec.field] || null : resource; + text = typeof colSpec.text === 'function' ? colSpec.text(resource, input) : input; + contentEl = $('
' + (colSpec.isMain ? this.renderGutterHtml() : '') + '' + (text ? htmlEscape(text) : ' ') + '' + '
'); + if (typeof colSpec.render === 'function') { + contentEl = colSpec.render(resource, contentEl, input) || contentEl; + } + td = $('').append(contentEl); + if (colSpec.isMain) { + td.wrapInner('
'); + } + results.push(tr.append(td)); + } + return results; + }; + + + /* + Renders the HTML responsible for the subrow expander area, + as well as the space before it (used to align expanders of similar depths) + */ + + ResourceRow.prototype.renderGutterHtml = function() { + var html, i, j, ref; + html = ''; + for (i = j = 0, ref = this.depth; j < ref; i = j += 1) { + html += ''; + } + html += ''; + return html; + }; + + return ResourceRow; + +})(EventRow); + +FC.views.timeline.resourceClass = ResourceTimelineView; + +RELEASE_DATE = '2015-10-18'; + +UPGRADE_WINDOW = { + years: 1, + weeks: 1 +}; + +LICENSE_INFO_URL = 'http://fullcalendar.io/scheduler/license/'; + +PRESET_LICENSE_KEYS = ['GPL-My-Project-Is-Open-Source', 'CC-Attribution-NonCommercial-NoDerivatives']; + +processLicenseKey = function(key, containerEl) { + if (!isImmuneUrl(window.location.href) && !isValidKey(key)) { + return renderingWarningInContainer('Please use a valid license key. More Info', containerEl); + } +}; + + +/* +This decryption is not meant to be bulletproof. Just a way to remind about an upgrade. + */ + +isValidKey = function(key) { + var minPurchaseDate, parts, purchaseDate, releaseDate; + if ($.inArray(key, PRESET_LICENSE_KEYS) !== -1) { + return true; + } + parts = (key || '').match(/^(\d+)\-fcs\-(\d+)$/); + if (parts && parts[1].length === 10) { + purchaseDate = moment.utc(parseInt(parts[2]) * 1000); + releaseDate = moment.utc(FC.mockSchedulerReleaseDate || RELEASE_DATE); + if (releaseDate.isValid()) { + minPurchaseDate = releaseDate.clone().subtract(UPGRADE_WINDOW); + if (purchaseDate.isAfter(minPurchaseDate)) { + return true; + } + } + } + return false; +}; + +isImmuneUrl = function(url) { + return Boolean(url.match(/\w+\:\/\/fullcalendar\.io\/|\/demos\/[\w-]+\.html$/)); +}; + +renderingWarningInContainer = function(messageHtml, containerEl) { + return containerEl.append($('
').html(messageHtml)); +}; + +}); diff --git a/dist/scheduler.min.css b/dist/scheduler.min.css new file mode 100644 index 000000000..d14b186bf --- /dev/null +++ b/dist/scheduler.min.css @@ -0,0 +1,5 @@ +/*! + * FullCalendar Scheduler v1.0.2 + * Docs & License: http://fullcalendar.io/scheduler/ + * (c) 2015 Adam Shaw + */.fc-timeline .fc-body .fc-divider.ui-widget-header,.fc-timeline .fc-body .ui-widget-content{background-image:none}.fc-resource-area .fc-cell-content,.fc-timeline .fc-cell-text{padding-left:4px;padding-right:4px}.fc-resource-area th>div,.fc-scrollpane,.fc-scrollpane-inner,.fc-scrollpane-inner>.fc-content{position:relative}.fc-scrollpane,.fc-scrollpane-inner,.fc-timeline .fc-cell-content,tr.fc-collapsed>td,tr.fc-transitioning>td{overflow:hidden}.fc-scrollpane-inner{box-sizing:border-box;min-height:100%}.fc-scrollpane-inner>.fc-bg{z-index:1}.fc-scrollpane-inner>.fc-content{z-index:2}.fc-no-scrollbars::-webkit-scrollbar{width:0;height:0}.fc-rtl .fc-timeline{direction:rtl}.fc-timeline .fc-divider{width:3px;border-style:double}.fc-timeline .fc-head>tr>.fc-divider{border-bottom:0}.fc-timeline .fc-body>tr>.fc-divider{border-top:0}.fc-scrolled .fc-head .fc-scrollpane{z-index:2}.fc-timeline.fc-scrolled .fc-head .fc-scrollpane{box-shadow:0 3px 4px rgba(0,0,0,.075)}.fc-timeline .fc-body .fc-scrollpane{z-index:1}.fc-timeline .fc-scrollpane-inner>.fc-bg,.fc-timeline .fc-scrollpane-inner>.fc-content{margin:-1px}.fc-timeline td,.fc-timeline th{white-space:nowrap}.fc-timeline .fc-col-resizer{cursor:col-resize}.fc-timeline th{vertical-align:middle}.fc-timeline .fc-head .fc-cell-content{padding-top:3px;padding-bottom:3px}.fc-resource-area{width:30%}.fc-resource-area col{width:40%;min-width:70px}.fc-resource-area col.fc-main-col{width:60%}.fc-flat .fc-expander-space{display:none}.fc-ltr .fc-resource-area tr>*{text-align:left}.fc-rtl .fc-resource-area tr>*{text-align:right}.fc-resource-area .fc-super th{text-align:center}.fc-resource-area th .fc-cell-content{position:relative;z-index:1}.fc-resource-area th .fc-col-resizer,.fc-time-area .fc-bgevent,.fc-time-area .fc-highlight,.fc-time-area .fc-slats{top:0;position:absolute;bottom:0}.fc-resource-area th .fc-col-resizer{z-index:2;width:5px}.fc-ltr .fc-resource-area th .fc-col-resizer{right:-3px}.fc-rtl .fc-resource-area th .fc-col-resizer{left:-3px}tr.fc-transitioning>td>div{transition:margin-top .2s}tr.fc-collapsed>td>div{margin-top:-10px}.fc-body .fc-resource-area .fc-cell-content{padding-top:8px;padding-bottom:8px}.fc-no-overlap .fc-body .fc-resource-area .fc-cell-content{padding-top:5px;padding-bottom:5px}.fc-resource-area .fc-icon{font-size:.9em;vertical-align:middle;margin-top:-2%}.fc-resource-area .fc-expander{cursor:pointer;color:#666}.fc-time-area col{min-width:2.2em}.fc-ltr .fc-time-area .fc-chrono th{text-align:left}.fc-rtl .fc-time-area .fc-chrono th{text-align:right}.fc-time-area .fc-slats{z-index:1;left:0;right:0}.fc-time-area .fc-slats table{height:100%}.fc-time-area .fc-slats .fc-minor{border-style:dotted}.fc-time-area .fc-slats td{border-width:0 1px}.fc-ltr .fc-time-area .fc-slats td{border-right-width:0}.fc-rtl .fc-time-area .fc-slats td{border-left-width:0}.fc-time-area .fc-bgevent-container,.fc-time-area .fc-highlight-container{position:absolute;z-index:2;top:0;bottom:0;width:0}.fc-ltr .fc-time-area .fc-bgevent-container,.fc-ltr .fc-time-area .fc-helper-container,.fc-ltr .fc-time-area .fc-highlight-container{left:0}.fc-rtl .fc-time-area .fc-bgevent-container,.fc-rtl .fc-time-area .fc-helper-container,.fc-rtl .fc-time-area .fc-highlight-container{right:0}.fc-time-area .fc-rows{position:relative;z-index:3}.fc-time-area .fc-rows .ui-widget-content{background:0 0}.fc-time-area .fc-rows td>div{position:relative}.fc-time-area .fc-rows .fc-bgevent-container,.fc-time-area .fc-rows .fc-highlight-container{z-index:1}.fc-time-area .fc-event-container{position:relative;z-index:2;width:0}.fc-time-area .fc-helper-container{position:absolute;z-index:3;top:0}.fc-time-area .fc-event-container{padding-bottom:8px;top:-1px}.fc-time-area tr:first-child .fc-event-container{top:0}.fc-no-overlap .fc-time-area .fc-event-container{padding-bottom:0;top:0}.fc-timeline-event{position:absolute;border-radius:0;padding:2px 0;margin-bottom:1px}.fc-no-overlap .fc-timeline-event{padding:5px 0;margin-bottom:0}.fc-ltr .fc-timeline-event{margin-right:1px}.fc-rtl .fc-timeline-event{margin-left:1px}.fc-timeline-event .fc-content{padding:0 1px;white-space:nowrap;overflow:hidden}.fc-timeline-event .fc-time{font-weight:700;padding:0 1px}.fc-rtl .fc-timeline-event .fc-time{display:inline-block}.fc-timeline-event .fc-title{padding:0 1px}.fc-timeline-event .fc-resizer:after{width:1px}.fc-ltr .fc-timeline-event .fc-title{padding-left:10px;margin-left:-8px}.fc-rtl .fc-timeline-event .fc-title{padding-right:10px;margin-right:-8px}.fc-ltr .fc-timeline-event.fc-not-start .fc-title{margin-left:-2px}.fc-rtl .fc-timeline-event.fc-not-start .fc-title{margin-right:-2px}.fc-body .fc-time-area .fc-following,.fc-timeline-event.fc-not-start .fc-title{position:relative}.fc-body .fc-time-area .fc-following:before,.fc-timeline-event.fc-not-start .fc-title:before{content:"";position:absolute;top:50%;margin-top:-5px;border:5px solid #000;border-top-color:transparent;border-bottom-color:transparent;opacity:.5}.fc-ltr .fc-body .fc-time-area .fc-following:before,.fc-ltr .fc-timeline-event.fc-not-start .fc-title:before{border-left:0;left:2px}.fc-rtl .fc-body .fc-time-area .fc-following:before,.fc-rtl .fc-timeline-event.fc-not-start .fc-title:before{border-right:0;right:2px}.fc-license-message{position:absolute;z-index:99999;bottom:1px;left:1px;background:#eee;border-color:#ddd;border-style:solid;border-width:1px 1px 0 0;padding:2px 4px;font-size:12px;border-top-right-radius:3px} \ No newline at end of file diff --git a/dist/scheduler.min.js b/dist/scheduler.min.js new file mode 100644 index 000000000..474507a83 --- /dev/null +++ b/dist/scheduler.min.js @@ -0,0 +1,8 @@ +/*! +FullCalendar Scheduler v1.0.2 +Docs & License: http://fullcalendar.io/scheduler/ +(c) 2015 Adam Shaw + */ +!function(t){"function"==typeof define&&define.amd?define(["jquery","moment"],t):t(jQuery,moment)}(function(t,e){var r,o,n,i,s,l,h,u,a,p,c,d,f,g,y,v,w,m,R,S,b,E,C,_,T,H,D,F,x,I,W,G,M,k,L,z,B,O,P,A,V,q,N,j,Y,U,X,Z,$,K,Q,J,tt,et,rt,ot,nt,it,st,lt,ht,ut,at,pt,ct,dt,ft,gt,yt,vt,wt,mt,Rt,St,bt,Et,Ct,_t,Tt=[].slice,Ht=function(t,e){function r(){this.constructor=t}for(var o in e)Dt.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},Dt={}.hasOwnProperty;a=t.fullCalendar,o=a.Calendar,i=a.Class,B=a.View,p=a.Grid,ht=a.intersectionToSeg,U=a.debounce,at=a.isInt,ot=a.getScrollbarWidths,l=a.DragListener,st=a.htmlEscape,V=a.computeIntervalUnit,vt=a.proxy,P=a.capitaliseFirstLetter,O=a.applyAll,h=a.Emitter,K=a.durationHasTime,$=a.divideRangeByDuration,Z=a.divideDurationByDuration,dt=a.multiplyDuration,gt=a.parseFieldSpecs,A=a.compareByFieldSpecs,Q=a.flexibleCompare,lt=a.intersectRects,J=function(e){return e.map(function(e,r){var o,n,i,s;for(i=t(r).find("> td"),o=0,n=i.length;n>o;o++)if(s=i[o],s.rowSpan<=1)return s})},mt=null,ft=function(t,e){var r,o;if(r=t.css("direction"),o=t[0],null!=e){if("rtl"===r)switch(mt){case"positive":e=e-o.clientWidth+o.scrollWidth;break;case"reverse":e=-e}return o.scrollLeft=e,t}if(e=o.scrollLeft,"rtl"===r)switch(mt){case"positive":e=e+o.clientWidth-o.scrollWidth;break;case"reverse":e=-e}return e},rt=function(t){var e,r,o;if(e=t.css("direction"),r=t[0],o=r.scrollLeft,"rtl"===e)switch(mt){case"negative":o=o-r.clientWidth+r.scrollWidth;break;case"reverse":o=-o-r.clientWidth+r.scrollWidth}return o},X=function(){var e,r,o;return e=t('
A
').appendTo("body"),r=e[0],o=r.scrollLeft>0?"positive":(r.scrollLeft=1,e.scrollLeft>0?"reverse":"negative"),e.remove(),o},t(function(){return mt=X()}),W=function(){function e(e,r){this.overflowX=null!=e?e:"auto",this.overflowY=null!=r?r:"auto",this.el=t('
'),this.scrollEl=this.el.children(),this.innerEl=this.scrollEl.children(),this.contentEl=this.innerEl.find(".fc-content"),this.bgEl=this.innerEl.find(".fc-bg"),this.scrollEl.on("scroll",vt(this,"handleScroll")).on("scroll",U(vt(this,"handleScrollStop"),100)),this.handlers={},this.gutters={}}return e.prototype.el=null,e.prototype.innerEl=null,e.prototype.contentEl=null,e.prototype.bgEl=null,e.prototype.overflowX=null,e.prototype.overflowY=null,e.prototype.isScrolling=!1,e.prototype.handlers=null,e.prototype.height=null,e.prototype.contentWidth=null,e.prototype.contentMinWidth=null,e.prototype.gutters=null,e.prototype.update=function(){var t,e,r,o,n,i,s;return i=this.scrollEl,o=this.overflowX,n=this.overflowY,e="invisible-scroll"===o,r="invisible-scroll"===n,i.toggleClass("fc-no-scrollbars",(e||"hidden"===o)&&(r||"hidden"===n)&&!it(i)),i.css({overflowX:e?"scroll":o,overflowY:r?"scroll":n}),t={marginLeft:0,marginRight:0,marginTop:0,marginBottom:0},(e||r)&&(s=ot(i),e&&(t.marginTop=-s.top,t.marginBottom=-s.bottom),r&&(t.marginLeft=-s.left,t.marginRight=-s.right)),i.css(t)},e.prototype.getScrollbarWidths=function(){var t;return t=ot(this.scrollEl),"invisible-scroll"===this.overflowX&&(t.top=0,t.bottom=0),"invisible-scroll"===this.overflowY&&(t.left=0,t.right=0),t},e.prototype.handleScroll=function(){return this.isScrolling||(this.isScrolling=!0,this.trigger("scrollStart")),this.trigger("scroll",this.scrollEl.scrollTop(),this.scrollEl.scrollLeft())},e.prototype.handleScrollStop=function(){return this.isScrolling=!1,this.trigger("scrollStop")},e.prototype.setHeight=function(t){return this.height=t,this.updateCss()},e.prototype.getHeight=function(){var t;return null!=(t=this.height)?t:this.scrollEl.height()},e.prototype.setContentWidth=function(t){return this.contentWidth=t,this.updateCss()},e.prototype.setContentMinWidth=function(t){return this.contentMinWidth=t,this.updateCss()},e.prototype.setGutters=function(e){return e?t.extend(this.gutters,e):this.gutters={},this.updateCss()},e.prototype.updateCss=function(){var t;return this.scrollEl.height(this.height),t=this.gutters,this.innerEl.css({width:this.contentWidth?this.contentWidth+(t.left||0)+(t.right||0):"",minWidth:this.contentMinWidth?this.contentMinWidth+(t.left||0)+(t.right||0):void 0,paddingLeft:t.left||"",paddingRight:t.right||"",paddingTop:t.top||"",paddingBottom:t.bottom||""}),this.bgEl.css({left:t.left||"",right:t.right||"",top:t.top||"",bottom:t.bottom||""})},e.prototype.append=function(t){return this.contentEl.append(t)},e.prototype.scrollTop=function(t){return this.scrollEl.scrollTop(t)},e.prototype.scrollLeft=function(t){return this.scrollEl.scrollLeft(t)},e.prototype.on=function(t,e){var r;return((r=this.handlers)[t]||(r[t]=[])).push(e),this},e.prototype.trigger=function(){var t,e,r,o,n,i;for(r=arguments[0],t=2<=arguments.length?Tt.call(arguments,1):[],i=this.handlers[r]||[],o=0,n=i.length;n>o;o++)e=i[o],e.apply(this,t)},e}(),it=function(t){var e;return e=ot(t),e.left||e.right||e.top||e.bottom},I=function(){function t(t,e){var r,o,n,i;for(this.axis=t,this.scrollers=e,n=this.scrollers,r=0,o=n.length;o>r;r++)i=n[r],this.initScroller(i)}return t.prototype.axis=null,t.prototype.scrollers=null,t.prototype.masterScroller=null,t.prototype.enabled=!0,t.prototype.enable=function(){return this.enabled=!0},t.prototype.disable=function(){return this.enabled=!1},t.prototype.initScroller=function(t){return t.on("scrollStart",function(e){return function(){e.masterScroller||(e.masterScroller=t)}}(this)).on("scroll",function(e){return function(r,o){var n,i,s,l;if(t===e.masterScroller)for(l=e.scrollers,n=0,i=l.length;i>n;n++)if(s=l[n],s!==e.masterScroller)switch(e.axis){case"horizontal":s.scrollLeft(o);break;case"vertical":s.scrollTop(r)}}}(this)).on("scrollStop",function(e){return function(){t===e.masterScroller&&(e.masterScroller=null)}}(this))},t.prototype.update=function(){var t,e,r,o,n,i,s,l,h,u,a,p,c;for(t=function(){var t,e,r,o;for(r=this.scrollers,o=[],t=0,e=r.length;e>t;t++)p=r[t],o.push(p.getScrollbarWidths());return o}.call(this),l=h=u=s=0,r=0,n=t.length;n>r;r++)c=t[r],l=Math.max(l,c.left),h=Math.max(h,c.right),u=Math.max(u,c.top),s=Math.max(s,c.bottom);for(a=this.scrollers,e=o=0,i=a.length;i>o;e=++o)p=a[e],c=t[e],p.setGutters("horizontal"===this.axis?{left:l-c.left,right:h-c.right}:{top:u-c.top,bottom:s-c.bottom})},t}(),F=function(){function e(t){this.scroller=t,this.sprites=[],this.scroller.on("scrollStart",function(t){return function(){return t.shouldRequeryDimensions?t.cacheDimensions():void 0}}(this)),this.scroller.on("scroll",function(t){return function(e,r){var o,n,i;return n=t.scroller.scrollEl,o=rt(n),i=n.scrollTop(),t.viewportRect={left:o,right:o+n[0].clientWidth,top:i,bottom:i+n[0].clientHeight},t.updatePositions()}}(this))}return e.prototype.scroller=null,e.prototype.scrollbarWidths=null,e.prototype.sprites=null,e.prototype.viewportRect=null,e.prototype.contentOffset=null,e.prototype.isHFollowing=!0,e.prototype.isVFollowing=!1,e.prototype.containOnNaturalLeft=!1,e.prototype.containOnNaturalRight=!1,e.prototype.shouldRequeryDimensions=!1,e.prototype.minTravel=0,e.prototype.isForcedAbsolute=!1,e.prototype.isForcedRelative=!1,e.prototype.setSprites=function(e){var r,o,n;if(this.clearSprites(),e instanceof t)return this.sprites=function(){var r,o,i;for(i=[],r=0,o=e.length;o>r;r++)n=e[r],i.push(new x(t(n),this));return i}.call(this);for(r=0,o=e.length;o>r;r++)n=e[r],n.follower=this;return this.sprites=e},e.prototype.clearSprites=function(){var t,e,r,o;for(r=this.sprites,t=0,e=r.length;e>t;t++)o=r[t],o.clear();return this.sprites=[]},e.prototype.cacheDimensions=function(){var t,e,r,o,n,i,s;for(n=this.scroller.scrollEl,e=rt(n),s=n.scrollTop(),this.viewportRect={left:e,right:e+n[0].clientWidth,top:s,bottom:s+n[0].clientHeight},this.scrollbarWidths=this.scroller.getScrollbarWidths(),this.contentOffset=this.scroller.innerEl.offset(),o=this.sprites,t=0,r=o.length;r>t;t++)i=o[t],i.cacheDimensions()},e.prototype.forceAbsolute=function(){var t,e,r,o,n;for(this.isForcedAbsolute=!0,r=this.sprites,o=[],t=0,e=r.length;e>t;t++)n=r[t],o.push(n.doAbsolute?void 0:n.assignPosition());return o},e.prototype.forceRelative=function(){var t,e,r,o,n;for(this.isForcedRelative=!0,r=this.sprites,o=[],t=0,e=r.length;e>t;t++)n=r[t],o.push(n.doAbsolute?n.assignPosition():void 0);return o},e.prototype.clearForce=function(){var t,e,r,o,n;for(this.isForcedRelative=!1,this.isForcedAbsolute=!1,r=this.sprites,o=[],t=0,e=r.length;e>t;t++)n=r[t],o.push(n.assignPosition());return o},e.prototype.update=function(){return this.cacheDimensions(),this.updatePositions()},e.prototype.updatePositions=function(){var t,e,r,o;for(r=this.sprites,t=0,e=r.length;e>t;t++)o=r[t],o.updatePosition()},e.prototype.getContentRect=function(t){var e,r,o;return r=t.offset(),e=r.left+parseFloat(t.css("border-left-width"))+parseFloat(t.css("padding-left"))-this.contentOffset.left,o=r.top+parseFloat(t.css("border-left-width"))+parseFloat(t.css("padding-left"))-this.contentOffset.top,{left:e,right:e+t.width(),top:o,bottom:o+t.height()}},e.prototype.getBoundingRect=function(t){var e,r,o;return r=t.offset(),e=r.left-this.contentOffset.left,o=r.top-this.contentOffset.top,{left:e,right:e+t.outerWidth(),top:o,bottom:o+t.outerHeight()}},e}(),x=function(){function t(t,e){this.el=t,this.follower=null!=e?e:null,this.isBlock="block"===this.el.css("display"),this.el.css("position","relative")}return t.prototype.follower=null,t.prototype.el=null,t.prototype.absoluteEl=null,t.prototype.naturalRect=null,t.prototype.parentRect=null,t.prototype.containerRect=null,t.prototype.isEnabled=!0,t.prototype.isHFollowing=!1,t.prototype.isVFollowing=!1,t.prototype.doAbsolute=!1,t.prototype.isAbsolute=!1,t.prototype.isCentered=!1,t.prototype.rect=null,t.prototype.isBlock=!1,t.prototype.naturalWidth=null,t.prototype.disable=function(){return this.isEnabled?(this.isEnabled=!1,this.resetPosition(),this.unabsolutize()):void 0},t.prototype.enable=function(){return this.isEnabled?void 0:(this.isEnabled=!0,this.assignPosition())},t.prototype.clear=function(){return this.disable(),this.follower=null,this.absoluteEl=null},t.prototype.cacheDimensions=function(){var t,e,r,o,n,i,s,l;return o=!1,n=!1,r=!1,this.naturalWidth=this.el.width(),this.resetPosition(),e=this.follower,s=this.naturalRect=e.getBoundingRect(this.el),l=this.el.parent(),this.parentRect=e.getBoundingRect(l),t=this.containerRect=ct(e.getContentRect(l),s),i=e.minTravel,e.containOnNaturalLeft&&(t.left=s.left),e.containOnNaturalRight&&(t.right=s.right),e.isHFollowing&&et(t)-et(s)>=i&&(r="center"===this.el.css("text-align"),o=!0),e.isVFollowing&&tt(t)-tt(s)>=i&&(n=!0),this.isHFollowing=o,this.isVFollowing=n,this.isCentered=r},t.prototype.updatePosition=function(){return this.computePosition(),this.assignPosition()},t.prototype.resetPosition=function(){return this.el.css({top:"",left:""})},t.prototype.computePosition=function(){var t,e,r,o,n,i,s,l;return s=this.follower.viewportRect,r=this.parentRect,t=this.containerRect,l=lt(s,r),o=null,e=!1,l&&(o=j(this.naturalRect),i=lt(o,r),(this.isCentered&&!St(s,r)||i&&!St(s,i))&&(e=!0,this.isHFollowing&&(this.isCentered?(n=et(o),o.left=(l.left+l.right)/2-n/2,o.right=o.left+n):nt(o,s)||(e=!1),nt(o,t)&&(e=!1)),this.isVFollowing&&(_t(o,s)||(e=!1),_t(o,t)&&(e=!1)),St(s,o)||(e=!1))),this.rect=o,this.doAbsolute=e},t.prototype.assignPosition=function(){var t,e;return this.isEnabled?this.rect?!this.doAbsolute&&!this.follower.isForcedAbsolute||this.follower.isForcedRelative?(e=this.rect.top-this.naturalRect.top,t=this.rect.left-this.naturalRect.left,this.unabsolutize(),this.el.toggleClass("fc-following",Boolean(e||t)).css({top:e,left:t})):(this.absolutize(),this.absoluteEl.css({top:this.rect.top-this.follower.viewportRect.top+this.follower.scrollbarWidths.top,left:this.rect.left-this.follower.viewportRect.left+this.follower.scrollbarWidths.left,width:this.isBlock?this.naturalWidth:""})):this.unabsolutize():void 0},t.prototype.absolutize=function(){return this.isAbsolute?void 0:(this.absoluteEl||(this.absoluteEl=this.buildAbsoluteEl()),this.absoluteEl.appendTo(this.follower.scroller.el),this.el.css("visibility","hidden"),this.isAbsolute=!0)},t.prototype.unabsolutize=function(){return this.isAbsolute?(this.absoluteEl.detach(),this.el.css("visibility",""),this.isAbsolute=!1):void 0},t.prototype.buildAbsoluteEl=function(){return this.el.clone().addClass("fc-following").css({position:"absolute","z-index":1e3,"font-weight":this.el.css("font-weight"),"font-size":this.el.css("font-size"),"font-family":this.el.css("font-family"),color:this.el.css("color"),"padding-top":this.el.css("padding-top"),"padding-bottom":this.el.css("padding-bottom"),"padding-left":this.el.css("padding-left"),"padding-right":this.el.css("padding-right"),"pointer-events":"none"})},t}(),j=function(t){return{left:t.left,right:t.right,top:t.top,bottom:t.bottom}},et=function(t){return t.right-t.left},tt=function(t){return t.bottom-t.top},St=function(t,e){return bt(t,e)&&Et(t,e)},bt=function(t,e){return e.left>=t.left&&e.right<=t.right},Et=function(t,e){return e.top>=t.top&&e.bottom<=t.bottom},nt=function(t,e){return t.lefte.right?(t.left=e.right-et(t),t.right=e.right,!0):!1},_t=function(t,e){return t.tope.bottom?(t.top=e.bottom-tt(t),t.bottom=e.bottom,!0):!1},ct=function(t,e){return{left:Math.min(t.left,e.left),right:Math.max(t.right,e.right),top:Math.min(t.top,e.top),bottom:Math.max(t.bottom,e.bottom)}},n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return Ht(e,t),e.prototype.resourceManager=null,e.prototype.initialize=function(){return this.resourceManager=new S(this)},e.prototype.instantiateView=function(t){var e,r;return e=this.getViewSpec(t),r=e["class"],this.options.resources&&e.options.resources!==!1&&e.resourceClass&&(r=e.resourceClass),new r(this,t,e.options,e.duration)},e.prototype.getResources=function(){return this.resourceManager.topLevelResources},e.prototype.addResource=function(t,e){var r;null==e&&(e=!1),r=this.resourceManager.addResource(t),e&&this.view.scrollToResource&&r.done(function(t){return function(e){return t.view.scrollToResource(e)}}(this))},e.prototype.removeResource=function(t){return this.resourceManager.removeResource(t)},e.prototype.refetchResources=function(){this.resourceManager.fetchResources()},e.prototype.rerenderResources=function(){var t;"function"==typeof(t=this.view).redisplayResources&&t.redisplayResources()},e.prototype.getEventResourceId=function(t){return this.resourceManager.getEventResourceId(t)},e.prototype.getPeerEvents=function(t,r){var o,n,i,s,l,h,u;for(l=e.__super__.getPeerEvents.apply(this,arguments),u=r.resourceId||"",o=[],n=0,i=l.length;i>n;n++)s=l[n],h=this.getEventResourceId(s)||"",h&&h!==u||o.push(s);return o},e.prototype.buildSelectRange=function(t,r,o){var n;return n=e.__super__.buildSelectRange.apply(this,arguments),o&&(n.resourceId=o),n},e.prototype.getResourceById=function(t){return this.resourceManager.getResourceById(t)},e.prototype.getResourceEvents=function(t){var e,r;return r="object"==typeof t?t:this.getResourceById(t),r?(e=this.resourceManager.getEventResourceField(),this.clientEvents(function(t){return t[e]===r.id})):[]},e.prototype.getEventResource=function(t){var e,r;return e="object"==typeof t?t:this.clientEvents(t)[0],e?(r=this.resourceManager.getEventResourceId(e),this.getResourceById(r)):null},e}(o),o.prototype=n.prototype,Rt=B.prototype.displayEvents,B.prototype.displayEvents=function(t){return this.listenToResources(),yt(this.calendar.options.schedulerLicenseKey,this.el),this.calendar.resourceManager.getResources().then(function(e){return function(){return Rt.call(e,t)}}(this))},B.prototype.isListeningToResources=!1,B.prototype.listenToResources=function(){return this.isListeningToResources?void 0:(this.calendar.resourceManager.on("add",vt(this,"addResource")).on("remove",vt(this,"removeResource")).on("reset",vt(this,"resetResources")),this.isListeningToResources=!0)},B.prototype.addResource=function(t){return this.calendar.rerenderEvents()},B.prototype.removeResource=function(t){return this.calendar.rerenderEvents()},B.prototype.resetResources=function(t){return this.calendar.rerenderEvents()},p.prototype.getEventSkinCss=function(t){var e,r,o,n,i,s,l,h,u;return u=this.view,l=t.source||{},e=t.color,h=l.color,i=u.opt("eventColor"),s=u.calendar.getEventResource(t),r=function(){var t,e;for(e=null,t=s;t&&!e;)e=t.eventBackgroundColor||t.eventColor,t=t._parent;return e},o=function(){var t,e;for(e=null,t=s;t&&!e;)e=t.eventBorderColor||t.eventColor,t=t._parent;return e},n=function(){var t,e;for(e=null,t=s;t&&!e;)e=t.eventTextColor,t=t._parent;return e},{"background-color":t.backgroundColor||e||r()||l.backgroundColor||h||u.opt("eventBackgroundColor")||i,"border-color":t.borderColor||e||o()||l.borderColor||h||u.opt("eventBorderColor")||i,color:t.textColor||n()||l.textColor||u.opt("eventTextColor")}},S=function(e){function r(t){this.calendar=t,this.unsetResources()}return Ht(r,e),r.mixin(h),r.resourceGuid=1,r.ajaxDefaults={dataType:"json",cache:!1},r.prototype.calendar=null,r.prototype.topLevelResources=null,r.prototype.resourcesById=null,r.prototype.fetching=null,r.prototype.getResources=function(){var e;return this.fetching?t.Deferred().resolve(this.topLevelResources).promise():(e=t.Deferred(),this.fetchResources().done(function(t){return e.resolve(t)}).fail(function(){return e.resolve([])}),e)},r.prototype.fetchResources=function(){var e;return e=this.fetching,t.when(e).then(function(t){return function(){return t.fetching=t.fetchResourceInputs().then(function(r){return t.setResources(r),e&&t.trigger("reset",t.topLevelResources),t.topLevelResources})}}(this))},r.prototype.fetchResourceInputs=function(){var e,o,n;switch(e=t.Deferred(),n=this.calendar.options.resources,"string"===t.type(n)&&(n={url:n}),t.type(n)){case"function":n(function(t){return function(t){return e.resolve(t)}}(this));break;case"object":o=t.ajax(t.extend({},r.ajaxDefaults,n));break;case"array":e.resolve(n);break;default:e.resolve([])}return o||(o=e.promise()),"pending"===!o.state()&&(this.calendar.pushLoading(),o.always(function(){return this.calendar.popLoading()})),o},r.prototype.getResourceById=function(t){return this.resourcesById[t]},r.prototype.unsetResources=function(){return this.topLevelResources=[],this.resourcesById={}},r.prototype.setResources=function(t){var e,r,o,n,i,s;for(this.unsetResources(),i=function(){var e,r,o;for(o=[],e=0,r=t.length;r>e;e++)n=t[e],o.push(this.buildResource(n));return o}.call(this),s=function(){var t,e,r;for(r=[],t=0,e=i.length;e>t;t++)o=i[t],this.addResourceToIndex(o)&&r.push(o);return r}.call(this),e=0,r=s.length;r>e;e++)o=s[e],this.addResourceToTree(o);return this.calendar.trigger("resourcesSet",null,this.topLevelResources)},r.prototype.addResource=function(e){return t.when(this.fetching).then(function(t){return function(){var r;return r=t.buildResource(e),t.addResourceToIndex(r)?(t.addResourceToTree(r),t.trigger("add",r),r):!1}}(this))},r.prototype.addResourceToIndex=function(t){var e,r,o,n;if(this.resourcesById[t.id])return!1;for(this.resourcesById[t.id]=t,n=t.children,r=0,o=n.length;o>r;r++)e=n[r],this.addResourceToIndex(e);return!0},r.prototype.addResourceToTree=function(t){var e,r,o;if(!t.parent){if(r=String(t[this.getResourceParentField()]||"")){if(e=this.resourcesById[r],!e)return!1;t.parent=e,o=e.children}else o=this.topLevelResources;o.push(t)}return!0},r.prototype.removeResource=function(e){var r;return r="object"==typeof e?e.id:e,t.when(this.fetching).then(function(t){return function(){var e;return e=t.removeResourceFromIndex(r),e&&(t.removeResourceFromTree(e),t.trigger("remove",e)),e}}(this))},r.prototype.removeResourceFromIndex=function(t){var e,r,o,n,i;if(i=this.resourcesById[t]){for(delete this.resourcesById[t],n=i.children,r=0,o=n.length;o>r;r++)e=n[r],this.removeResourceFromIndex(e.id);return i}return!1},r.prototype.removeResourceFromTree=function(t,e){var r,o,n,i;for(null==e&&(e=this.topLevelResources),r=o=0,n=e.length;n>o;r=++o){if(i=e[r],i===t)return t.parent=null,e.splice(r,1),!0;if(this.removeResourceFromTree(t,i.children))return!0}return!1},r.prototype.buildResource=function(e){var o,n,i,s,l;return l=t.extend({},e),l.id=String((null!=(s=e.id)?s:"_fc"+r.resourceGuid++)||""),i=e.eventClassName,l.eventClassName=function(){switch(t.type(i)){case"string":return i.split(/\s+/);case"array":return i;default:return[]}}(),l.children=function(){var t,r,i,s,h;for(s=null!=(i=e.children)?i:[],h=[],t=0,r=s.length;r>t;t++)n=s[t],o=this.buildResource(n),o.parent=l,h.push(o);return h}.call(this),l},r.prototype.getResourceParentField=function(){return this.calendar.options.resourceParentField||"parentId"},r.prototype.getEventResourceId=function(t){return String(t[this.getEventResourceField()]||"")},r.prototype.setEventResourceId=function(t,e){return t[this.getEventResourceField()]=String(e||"")},r.prototype.getEventResourceField=function(){return this.calendar.options.eventResourceField||"resourceId"},r}(i),_=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return Ht(r,e),r.prototype.displayingResources=null,r.prototype.assigningResources=null,r.prototype.displayView=function(){return t.when(r.__super__.displayView.apply(this,arguments)).then(function(t){return function(){return t.displayResources()}}(this))},r.prototype.displayEvents=function(e){return t.when(this.displayResources()).then(function(t){return function(){return r.__super__.displayEvents.call(t,e)}}(this))},r.prototype.unrenderSkeleton=function(){return this.clearResources()},r.prototype.displayResources=function(){return this.listenToResources(),t.when(this.displayingResources).then(function(t){return function(){return t.displayingResources||(t.displayingResources=t.assignResources().then(function(){return t.renderStoredResources()}))}}(this))},r.prototype.clearResources=function(){var e;return e=this.displayingResources,e?e.then(function(t){return function(){return t.clearEvents(),t.unrenderStoredResources(),t.displayingResources=null}}(this)):t.when()},r.prototype.redisplayResources=function(){var t;return t=this.queryScroll(),this.clearResources().then(function(t){return function(){return t.displayResources()}}(this)).then(function(e){return function(){return e.setScroll(t),e.calendar.rerenderEvents()}}(this))},r.prototype.resetResources=function(t){var e;return this.displayingResources?(e=this.queryScroll(),this.clearResources().then(function(t){return function(){return t.unassignResources()}}(this)).then(function(e){return function(){return e.assignResources(t)}}(this)).then(function(t){return function(){return t.displayResources()}}(this)).then(function(t){return function(){return t.setScroll(e),t.calendar.rerenderEvents()}}(this))):this.unassignResources().then(function(e){return function(){return e.assignResources(t)}}(this))},r.prototype.assignResources=function(e){return this.assigningResources||(this.assigningResources=t.when(e||this.calendar.resourceManager.getResources()).then(function(t){return function(e){return t.setResources(e)}}(this)))},r.prototype.unassignResources=function(){var e;return e=this.assigningResources,e?e.then(function(t){return function(){return t.unsetResources(),t.assigningResources=null}}(this)):t.when()},r.prototype.setResources=function(t){},r.prototype.unsetResources=function(){},r.prototype.renderStoredResources=function(){},r.prototype.unrenderStoredResources=function(){},r.prototype.triggerDayClick=function(t,e,r){var o;return o=this.calendar.resourceManager,this.trigger("dayClick",e,t.start,r,this,o.getResourceById(t.resourceId))},r.prototype.triggerSelect=function(t,e){var r;return r=this.calendar.resourceManager,this.trigger("select",null,t.start,t.end,e,this,r.getResourceById(t.resourceId))},r.prototype.reportEventDrop=function(){var t,e,o;return e=arguments[0],t=arguments[1],o=3<=arguments.length?Tt.call(arguments,2):[],r.__super__.reportEventDrop.apply(this,[e,this.normalizeDropLocation(t)].concat(Tt.call(o)))},r.prototype.reportExternalDrop=function(){var t,e,o;return e=arguments[0],t=arguments[1],o=3<=arguments.length?Tt.call(arguments,2):[],r.__super__.reportExternalDrop.apply(this,[e,this.normalizeDropLocation(t)].concat(Tt.call(o)))},r.prototype.normalizeDropLocation=function(e){var r;return r=t.extend({},e),delete r.resourceId,this.calendar.resourceManager.setEventResourceId(r,e.resourceId),r},r}(B),R=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return Ht(e,t),e.prototype.eventsToRanges=function(t){var r,o,n,i;for(o=e.__super__.eventsToRanges.apply(this,arguments),n=0,i=o.length;i>n;n++)r=o[n],r.resourceId=this.view.calendar.getEventResourceId(r.event);return o},e.prototype.eventRangeToSegs=function(t){var r,o,n,i,s;if(s=e.__super__.eventRangeToSegs.apply(this,arguments),n=t.resourceId)for(r=0,o=s.length;o>r;r++)i=s[r],i.resourceId=n;return s},e.prototype.selectionRangeToSegs=function(t){var r,o,n,i,s;if(s=e.__super__.selectionRangeToSegs.apply(this,arguments),n=t.resourceId)for(r=0,o=s.length;o>r;r++)i=s[r],i.resourceId=n;return s},e.prototype.fabricateHelperEvent=function(t,r){var o;return o=e.__super__.fabricateHelperEvent.apply(this,arguments),this.view.calendar.resourceManager.setEventResourceId(o,t.resourceId),o},e.prototype.computeEventDrop=function(t,r,o){var n,i;return r.resourceId?(n=!0,n||t.resourceId===r.resourceId?(i=e.__super__.computeEventDrop.apply(this,arguments),i&&(i.resourceId=r.resourceId),i):null):null},e.prototype.computeExternalDrop=function(t,r){var o;return t.resourceId?(o=e.__super__.computeExternalDrop.apply(this,arguments),o&&(o.resourceId=t.resourceId),o):null},e.prototype.computeEventResize=function(t,r,o,n){var i;return i=e.__super__.computeEventResize.apply(this,arguments),i&&(i.resourceId=r.resourceId),i},e.prototype.computeSelection=function(t,r){var o;return o=e.__super__.computeSelection.apply(this,arguments),o&&(o.resourceId=t.resourceId),o},e}(p),k=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return Ht(e,t),e.prototype.timeGrid=null,e.prototype.isScrolled=!1,e.prototype.initialize=function(){return this.timeGrid=this.instantiateGrid(),this.intervalDuration=this.timeGrid.duration,this.coordMap=this.timeGrid.coordMap},e.prototype.instantiateGrid=function(){return new M(this)},e.prototype.setRange=function(t){return e.__super__.setRange.apply(this,arguments),this.timeGrid.setRange(t)},e.prototype.renderSkeleton=function(){return this.el.addClass("fc-timeline"),this.opt("eventOverlap")===!1&&this.el.addClass("fc-no-overlap"),this.el.html(this.renderSkeletonHtml()),this.renderTimeGridSkeleton()},e.prototype.renderSkeletonHtml=function(){return'
'},e.prototype.renderTimeGridSkeleton=function(){return this.timeGrid.setElement(this.el.find("tbody .fc-time-area")),this.timeGrid.headEl=this.el.find("thead .fc-time-area"),this.timeGrid.renderSkeleton(),this.isScrolled=!1,this.timeGrid.bodyScroller.on("scroll",vt(this,"handleBodyScroll"))},e.prototype.handleBodyScroll=function(t,e){if(t){if(!this.isScrolled)return this.isScrolled=!0,this.el.addClass("fc-scrolled")}else if(this.isScrolled)return this.isScrolled=!1,this.el.removeClass("fc-scrolled")},e.prototype.unrenderSkeleton=function(){return this.timeGrid.removeElement(),this.handleBodyScroll(0),e.__super__.unrenderSkeleton.apply(this,arguments)},e.prototype.renderDates=function(){return this.timeGrid.renderDates()},e.prototype.unrenderDates=function(){return this.timeGrid.unrenderDates()},e.prototype.renderBusinessHours=function(){return this.timeGrid.renderBusinessHours()},e.prototype.unrenderBusinessHours=function(){return this.timeGrid.unrenderBusinessHours()},e.prototype.updateWidth=function(){return this.timeGrid.updateWidth()},e.prototype.setHeight=function(t,e){var r;return r=e?"auto":t-this.timeGrid.headHeight()-this.queryMiscHeight(),this.timeGrid.bodyScroller.setHeight(r)},e.prototype.queryMiscHeight=function(){return this.el.outerHeight()-this.timeGrid.headScroller.el.outerHeight()-this.timeGrid.bodyScroller.el.outerHeight()},e.prototype.computeInitialScroll=function(t){return this.timeGrid.computeInitialScroll(t)},e.prototype.queryScroll=function(){return this.timeGrid.queryScroll()},e.prototype.setScroll=function(t){return this.timeGrid.setScroll(t)},e.prototype.renderEvents=function(t){return this.timeGrid.renderEvents(t),this.updateWidth()},e.prototype.unrenderEvents=function(){return this.timeGrid.unrenderEvents(),this.updateWidth()},e.prototype.renderDrag=function(t,e){return this.timeGrid.renderDrag(t,e)},e.prototype.unrenderDrag=function(){return this.timeGrid.unrenderDrag()},e.prototype.getEventSegs=function(){return this.timeGrid.getEventSegs()},e.prototype.renderSelection=function(t){return this.timeGrid.renderSelection(t)},e.prototype.unrenderSelection=function(){return this.timeGrid.unrenderSelection()},e}(B),Y=a.cssToStr,M=function(r){function o(){var t;o.__super__.constructor.apply(this,arguments),this.initScaleProps(),this.minTime=e.duration(this.opt("minTime")||"00:00"),this.maxTime=e.duration(this.opt("maxTime")||"24:00"),this.snapDuration=(t=this.opt("snapDuration"))?e.duration(t):this.slotDuration,this.cellDuration=this.snapDuration,this.colsPerSlot=Z(this.slotDuration,this.snapDuration),this.slotWidth=this.opt("slotWidth")}return Ht(o,r),o.prototype.slotDates=null,o.prototype.headEl=null,o.prototype.slatContainerEl=null,o.prototype.slatEls=null,o.prototype.slatElCoords=null,o.prototype.headScroller=null,o.prototype.bodyScroller=null,o.prototype.joiner=null,o.prototype.follower=null,o.prototype.eventTitleFollower=null,o.prototype.minTime=null,o.prototype.maxTime=null,o.prototype.slotDuration=null,o.prototype.snapDuration=null,o.prototype.slotCnt=null,o.prototype.snapDiffToCol=null,o.prototype.colToSnapDiff=null,o.prototype.colsPerSlot=null,o.prototype.duration=null,o.prototype.labelInterval=null,o.prototype.headerFormats=null,o.prototype.isTimeScale=null,o.prototype.largeUnit=null,o.prototype.emphasizeWeeks=!1,o.prototype.titleFollower=null,o.prototype.segContainerEl=null,o.prototype.segContainerHeight=null,o.prototype.bgSegContainerEl=null,o.prototype.helperEls=null,o.prototype.innerEl=null,o.prototype.opt=function(t){return this.view.opt(t)},o.prototype.isValidDate=function(t){var e;return this.view.isHiddenDay(t)?!1:this.isTimeScale?(e=t.time(),e>=this.minTime&&e').appendTo(this.bodyScroller.bgEl),this.segContainerEl=t('
').appendTo(this.bodyScroller.contentEl),this.bgSegContainerEl=this.bodyScroller.bgEl,this.coordMap.containerEl=this.bodyScroller.scrollEl,this.joiner=new I("horizontal",[this.headScroller,this.bodyScroller]),this.follower=new F(this.headScroller),this.eventTitleFollower=new F(this.bodyScroller),this.eventTitleFollower.minTravel=50,this.isRTL?this.eventTitleFollower.containOnNaturalRight=!0:this.eventTitleFollower.containOnNaturalLeft=!0,o.__super__.renderSkeleton.apply(this,arguments)},o.prototype.headColEls=null,o.prototype.slatColEls=null,o.prototype.renderDates=function(){var t,e,r,o,n;for(this.headScroller.contentEl.html(this.renderHeadHtml()),this.headColEls=this.headScroller.contentEl.find("col"),this.slatContainerEl.html(this.renderSlatHtml()),this.slatColEls=this.slatContainerEl.find("col"),this.slatEls=this.slatContainerEl.find("td"),n=this.slotDates,e=r=0,o=n.length;o>r;e=++r)t=n[e],this.view.trigger("dayRender",null,t,this.slatEls.eq(e));return this.follower?this.follower.setSprites(this.headEl.find("tr:not(:last-child) span")):void 0},o.prototype.unrenderDates=function(){return this.follower&&this.follower.clearSprites(),this.headScroller.contentEl.empty(),this.slatContainerEl.empty(),this.headScroller.contentEl.add(this.bodyScroller.contentEl).css({minWidth:"",width:""})},o.prototype.renderHeadHtml=function(){var t,e,r,o,n,i,s,l,h,u,a,p,c,d,f,g,y,v,w,m,R,S,b,E,C,_,T,H,D,F,x,I,W,G,M,k;for(f=this.labelInterval,n=this.headerFormats,e=function(){var t,e,r;for(r=[],t=0,e=n.length;e>t;t++)o=n[t],r.push([]);return r}(),g=null,H=null,G=this.slotDates,W=[],p=0,y=G.length;y>p;p++){for(r=G[p],k=r.week(),a=this.emphasizeWeeks&&null!==H&&H!==k,F=c=0,v=n.length;v>c;F=++c)o=n[F],x=e[F],g=x[x.length-1],u=n.length>1&&Fthis.slotDuration,i="",i+="",d=0,w=G.length;w>d;d++)r=G[d],i+="";for(i+="",i+="",s=E=0,m=e.length;m>E;s=++E){for(x=e[s],h=s===e.length-1,i+="",C=0,R=x.length;R>C;C++)t=x[C],i+='";i+=""}for(i+="
1?' colspan="'+t.colspan+'"':"")+'>
'+st(t.text)+"
",I="",I+="",T=0,S=W.length;S>T;T++)t=W[T],I+="";for(I+="",I+="",s=D=0,b=W.length;b>D;s=++D)t=W[s],r=G[s],I+=this.slatCellHtml(r,t.weekStart);return I+="
",this._slatHtml=I,i},o.prototype.renderSlatHtml=function(){return this._slatHtml},o.prototype.slatCellHtml=function(t,e){var r;return this.isTimeScale?(r=[],r.push(at($(this.start,t,this.labelInterval))?"fc-major":"fc-minor")):(r=this.getDayClasses(t),r.push("fc-day")),r.unshift(this.view.widgetContentClass),e&&r.push("fc-em-cell"),'
'},o.prototype.businessHourSegs=null,o.prototype.renderBusinessHours=function(){var t,e;return this.largeUnit?void 0:(t=this.view.calendar.getBusinessHoursEvents(!this.isTimeScale),e=this.businessHourSegs=this.eventsToSegs(t),this.renderFill("businessHours",e,"bgevent"))},o.prototype.unrenderBusinessHours=function(){return this.unrenderFill("businessHours")},o.prototype.explicitSlotWidth=null,o.prototype.defaultSlotWidth=null,o.prototype.updateWidth=function(){var t,e,r,o,n;return n=Math.round(this.slotWidth||(this.slotWidth=this.computeSlotWidth())),r=n*this.slotDates.length,e="",o=n,t=this.bodyScroller.scrollEl[0].clientWidth,t>r&&(e=t,r="",o=Math.floor(t/this.slotDates.length)),this.headScroller.setContentWidth(r),this.headScroller.setContentMinWidth(e),this.bodyScroller.setContentWidth(r),this.bodyScroller.setContentMinWidth(e),this.headColEls.slice(0,-1).add(this.slatColEls.slice(0,-1)).width(o),this.headScroller.update(),this.bodyScroller.update(),this.joiner.update(),this.updateSlatElCoords(),this.updateSegPositions(),this.follower&&this.follower.update(),this.eventTitleFollower?this.eventTitleFollower.update():void 0},o.prototype.computeSlotWidth=function(){var e,r,o,n,i,s;return o=0,r=this.headEl.find("tr:last-child th span"),r.each(function(e,r){var n;return n=t(r).outerWidth(),o=Math.max(o,n)}),e=o+1,s=Z(this.labelInterval,this.slotDuration),i=Math.ceil(e/s),n=this.headColEls.eq(0).css("min-width"),n&&(n=parseInt(n,10),n&&(i=Math.max(i,n))),i},o.prototype.updateSlatElCoords=function(){var e,r,o,n,i,s;return r=this.slatEls.find("> div"),i=this.bodyScroller.innerEl,this.isRTL?(n=i.offset().left+i.outerWidth(),e=function(){var e,i,l;for(l=[],o=e=0,i=r.length;i>e;o=++e)s=r[o],l.push(t(s).offset().left+t(s).outerWidth()-n);return l}(),e[o]=t(s).offset().left-n):(n=i.offset().left,e=function(){var e,i,l;for(l=[],o=e=0,i=r.length;i>e;o=++e)s=r[o],l.push(t(s).offset().left-n);return l}(),e[o]=t(s).offset().left+t(s).outerWidth()-n),this.slatElCoords=e},o.prototype.dateToCol=function(t){var e,r,o,n;return t=t.clone().stripZone(),r=$(this.start,t,this.snapDuration),0>r?0:r>=this.snapDiffToCol.length?this.colCnt:(o=Math.floor(r),n=r-o,e=this.snapDiffToCol[o],at(e)&&n&&(e+=n),e)},o.prototype.dateToCoord=function(t){var e,r,o,n,i,s,l,h;return t=t.clone().stripZone(),e=this.dateToCol(t),h=e/this.colsPerSlot,h=Math.max(h,0),h=Math.min(h,this.slotDates.length),at(h)?this.slatElCoords[h]:(n=Math.floor(h),i=+this.slotDates[n],s=+this.slotDates[n].clone().add(this.slotDuration),l=(t-i)/(s-i),l=Math.min(l,1),r=this.slatElCoords[n],o=this.slatElCoords[n+1],r+(o-r)*l)},o.prototype.rangeToCoords=function(t){return this.isRTL?{right:this.dateToCoord(t.start),left:this.dateToCoord(t.end)}:{left:this.dateToCoord(t.start),right:this.dateToCoord(t.end)}},o.prototype.rangeToOffsets=function(t){var e,r;return e=this.rangeToCoords(t),r=this.isRTL?this.slatContainerEl.offset().left+this.slatContainerEl.outerWidth():this.slatContainerEl.offset().left,e.left+=r,e.right+=r,e},o.prototype.headHeight=function(){var t;return t=this.headScroller.contentEl.find("table"),t.height.apply(t,arguments)},o.prototype.updateSegPositions=function(){var t,e,r,o,n;for(n=(this.segs||[]).concat(this.businessHourSegs||[]),e=0,r=n.length;r>e;e++)o=n[e],t=this.rangeToCoords(o,-1),o.el.css({left:o.left=t.left,right:-(o.right=t.right)})},o.prototype.computeInitialScroll=function(t){var r,o;return r=0,this.isTimeScale&&(o=this.opt("scrollTime"),o&&(o=e.duration(o),r=this.dateToCoord(this.start.clone().time(o)))),{left:r,top:0}},o.prototype.queryScroll=function(){return{left:ft(this.bodyScroller.scrollEl),top:this.bodyScroller.scrollEl.scrollTop()}},o.prototype.setScroll=function(t){return ft(this.headScroller.scrollEl,t.left),ft(this.bodyScroller.scrollEl,t.left),this.bodyScroller.scrollEl.scrollTop(t.top)},o.prototype.renderFgSegs=function(t){return t=this.renderFgSegEls(t),this.renderFgSegsInContainers([[this,t]]),this.updateSegFollowers(t),t},o.prototype.unrenderFgSegs=function(){return this.clearSegFollowers(),this.unrenderFgContainers([this])},o.prototype.renderFgSegsInContainers=function(t){var e,r,o,n,i,s,l,h,u,a,p,c,d,f,g,y,v,w,m,R,S,b,E,C,_;for(o=0,s=t.length;s>o;o++)for(m=t[o],e=m[0],_=m[1],n=0,l=_.length;l>n;n++)C=_[n],r=this.rangeToCoords(C,-1),C.el.css({left:C.left=r.left,right:-(C.right=r.right)});for(i=0,h=t.length;h>i;i++)for(R=t[i],e=R[0],_=R[1],f=0,u=_.length;u>f;f++)C=_[f],C.el.appendTo(e.segContainerEl);for(g=0,a=t.length;a>g;g++){for(S=t[g],e=S[0],_=S[1],y=0,p=_.length;p>y;y++)C=_[y],C.height=C.el.outerHeight(!0);this.buildSegLevels(_),e.segContainerHeight=N(_)}for(E=[],v=0,c=t.length;c>v;v++){for(b=t[v],e=b[0],_=b[1],w=0,d=_.length;d>w;w++)C=_[w],C.el.css("top",C.top);E.push(e.segContainerEl.height(e.segContainerHeight))}return E},o.prototype.buildSegLevels=function(t){var e,r,o,n,i,s,l,h,u,a,p,c,d,f;for(d=[],this.sortSegs(t),o=0,s=t.length;s>o;o++){for(f=t[o],f.above=[],u=0;un;n++)a=p[n],Ct(f,a)&&(f.above.push(a),r=!0);if(!r)break;u+=1}for((d[u]||(d[u]=[])).push(f),u+=1;ui;i++)e=c[i],Ct(f,e)&&e.above.push(f);u+=1}}return d},o.prototype.unrenderFgContainers=function(t){var e,r,o,n;for(n=[],r=0,o=t.length;o>r;r++)e=t[r],e.segContainerEl.empty(),e.segContainerEl.height(""),n.push(e.segContainerHeight=null);return n},o.prototype.fgSegHtml=function(t,e){var r,o,n,i,s,l;return o=t.event,n=this.view.isEventDraggable(o),s=t.isStart&&this.view.isEventResizableFromStart(o),i=t.isEnd&&this.view.isEventResizableFromEnd(o),r=this.getSegClasses(t,n,s||i),r.unshift("fc-timeline-event","fc-h-event"),l=this.getEventTimeText(o),'
'+(l?''+st(l)+"":"")+''+(o.title?st(o.title):" ")+'
'+(s?'
':"")+(i?'
':"")+"
"},o.prototype.updateSegFollowers=function(t){var e,r,o,n,i;if(this.eventTitleFollower){for(n=[],e=0,r=t.length;r>e;e++)o=t[e],i=o.el.find(".fc-title"),i.length&&n.push(new x(i));return this.eventTitleFollower.setSprites(n)}},o.prototype.clearSegFollowers=function(){return this.eventTitleFollower?this.eventTitleFollower.clearSprites():void 0},o.prototype.segDragStart=function(){return o.__super__.segDragStart.apply(this,arguments),this.eventTitleFollower?this.eventTitleFollower.forceRelative():void 0},o.prototype.segDragEnd=function(){return o.__super__.segDragEnd.apply(this,arguments),this.eventTitleFollower?this.eventTitleFollower.clearForce():void 0},o.prototype.segResizeStart=function(){return o.__super__.segResizeStart.apply(this,arguments),this.eventTitleFollower?this.eventTitleFollower.forceRelative():void 0},o.prototype.segResizeEnd=function(){return o.__super__.segResizeEnd.apply(this,arguments),this.eventTitleFollower?this.eventTitleFollower.clearForce():void 0},o.prototype.renderHelper=function(t,e){var r;return r=this.eventsToSegs([t]),r=this.renderFgSegEls(r),this.renderHelperSegsInContainers([[this,r]],e)},o.prototype.renderHelperSegsInContainers=function(e,r){var o,n,i,s,l,h,u,a,p,c,d,f,g,y,v,w,m;for(s=[],l=0,a=e.length;a>l;l++)for(g=e[l],o=g[0],m=g[1],h=0,p=m.length;p>h;h++)w=m[h],n=this.rangeToCoords(w,-1),w.el.css({left:w.left=n.left,right:-(w.right=n.right)}),r&&r.resourceId===(null!=(y=o.resource)?y.id:void 0)?w.el.css("top",r.el.css("top")):w.el.css("top",0);for(u=0,c=e.length;c>u;u++)for(v=e[u],o=v[0],m=v[1],i=t('
').appendTo(o.innerEl),s.push(i[0]),f=0,d=m.length;d>f;f++)w=m[f],i.append(w.el);return this.helperEls=this.helperEls?this.helperEls.add(t(s)):t(s)},o.prototype.unrenderHelper=function(){return this.helperEls?(this.helperEls.remove(),this.helperEls=null):void 0},o.prototype.renderEventResize=function(t,e){return this.renderHighlight(this.eventRangeToSegs(t)),this.renderRangeHelper(t,e)},o.prototype.unrenderEventResize=function(){return this.unrenderHighlight(),this.unrenderHelper()},o.prototype.renderFill=function(t,e,r){return e=this.renderFillSegEls(t,e),this.renderFillInContainers(t,[[this,e]],r),e},o.prototype.renderFillInContainers=function(t,e,r){var o,n,i,s,l,h;for(l=[],n=0,i=e.length;i>n;n++)s=e[n],o=s[0],h=s[1],l.push(this.renderFillInContainer(t,o,h,r));return l},o.prototype.renderFillInContainer=function(e,r,o,n){var i,s,l,h,u;if(o.length){for(n||(n=e.toLowerCase()),i=t('
').appendTo(r.bgSegContainerEl),l=0,h=o.length;h>l;l++)u=o[l],s=this.rangeToCoords(u,-1),u.el.css({left:u.left=s.left,right:-(u.right=s.right)}),u.el.appendTo(i);return this.elsByFill[e]=this.elsByFill[e]?this.elsByFill[e].add(i):i}},o.prototype.renderDrag=function(t,e){return e?(this.renderRangeHelper(t,e),this.applyDragOpacity(this.helperEls),!0):(this.renderHighlight(this.eventRangeToSegs(t)),!1)},o.prototype.unrenderDrag=function(){return this.unrenderHelper(),this.unrenderHighlight()},o}(p),N=function(t){var e,r,o,n;for(o=0,e=0,r=t.length;r>e;e++)n=t[e],o=Math.max(o,q(n));return o},q=function(t){return null==t.top&&(t.top=N(t.above)),t.top+t.height},Ct=function(t,e){return t.lefte.left},v=18,g=6,f=200,y=1e3,s={months:1},D=[{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}],M.prototype.initScaleProps=function(){var e,r,o;return this.labelInterval=this.queryDurationOption("slotLabelInterval"),this.slotDuration=this.queryDurationOption("slotDuration"),this.ensureGridDuration(),this.validateLabelAndSlot(),this.ensureLabelInterval(),this.ensureSlotDuration(),e=this.opt("slotLabelFormat"),o=t.type(e),this.headerFormats="array"===o?e:"string"===o?[e]:this.computeHeaderFormats(),this.isTimeScale=K(this.slotDuration),this.largeUnit=this.isTimeScale?void 0:(r=V(this.slotDuration),/year|month|week/.test(r)?r:void 0),this.emphasizeWeeks=1===this.slotDuration.as("days")&&this.duration.as("weeks")>=2&&!this.opt("businessHours")},M.prototype.queryDurationOption=function(t){var r,o;return o=this.opt(t),null!=o&&(r=e.duration(o),+r)?r:void 0},M.prototype.validateLabelAndSlot=function(){var t,e,r;return this.labelInterval&&(t=Z(this.duration,this.labelInterval),t>y&&(a.warn("slotLabelInterval results in too many cells"),this.labelInterval=null)),this.slotDuration&&(e=Z(this.duration,this.slotDuration),e>y&&(a.warn("slotDuration results in too many cells"),this.slotDuration=null)),this.labelInterval&&this.slotDuration&&(r=Z(this.labelInterval,this.slotDuration),!at(r)||1>r)?(a.warn("slotLabelInterval must be a multiple of slotDuration"),this.slotDuration=null):void 0},M.prototype.ensureGridDuration=function(){var t,r,o,n,i;if(t=this.duration,!t){if(t=this.view.intervalDuration,!t)if(this.labelInterval||this.slotDuration)for(i=this.ensureLabelInterval(),o=D.length-1;o>=0&&(r=D[o],t=e.duration(r),n=Z(t,i),!(n>=v));o+=-1);else t=e.duration(s);this.duration=t}return t},M.prototype.ensureLabelInterval=function(){var t,r,o,n,i,s,l,h,u;if(i=this.labelInterval,!i){if(this.duration||this.slotDuration||this.ensureGridDuration(),this.slotDuration){for(r=0,s=D.length;s>r;r++)if(t=D[r],u=e.duration(t),h=Z(u,this.slotDuration),at(h)&&g>=h){i=u;break}i||(i=this.slotDuration)}else for(o=0,l=D.length;l>o&&(t=D[o],i=e.duration(t),n=Z(this.duration,i),!(n>=v));o++);this.labelInterval=i}return i},M.prototype.ensureSlotDuration=function(){var t,r,o,n,i,s,l,h;if(s=this.slotDuration,!s){for(o=this.ensureLabelInterval(),r=0,n=D.length;n>r;r++)if(t=D[r],h=e.duration(t),l=Z(o,h),at(l)&&l>1&&g>=l){s=h;break}s&&this.duration&&(i=Z(this.duration,s),i>f&&(s=null)),s||(s=o),this.slotDuration=s}return s},M.prototype.computeHeaderFormats=function(){var t,e,r,o,n,i,s,l;switch(s=this.view,o=this.duration,n=this.labelInterval,i=V(n),l=this.opt("weekNumbers"),t=e=r=null,"week"!==i||l||(i="day"),i){case"year":t="YYYY";break;case"month":o.asYears()>1&&(t="YYYY"),e="MMM";break;case"week":o.asYears()>1&&(t="YYYY"),e=this.opt("shortWeekFormat");break;case"day":o.asYears()>1?t=this.opt("monthYearFormat"):o.asMonths()>1&&(t="MMMM"),l&&(e=this.opt("weekFormat")),r="dd D";break;case"hour":l&&(t=this.opt("weekFormat")),o.asDays()>1&&(e=this.opt("dayOfMonthFormat")),r=this.opt("smallTimeFormat");break;case"minute":n.asMinutes()/60>=g?(t=this.opt("hourFormat"),e="[:]mm"):t=this.opt("mediumTimeFormat");break;case"second":n.asSeconds()/60>=g?(t="LT",e="[:]ss"):t="LTS";break;case"millisecond":t="LTS",e="[.]SSS"}return[].concat(t||[],e||[],r||[])},a.views.timeline={"class":k,defaults:{eventResizableFromStart:!0}},a.views.timelineDay={type:"timeline",duration:{days:1}},a.views.timelineWeek={type:"timeline",duration:{weeks:1}},a.views.timelineMonth={type:"timeline",duration:{months:1}},a.views.timelineYear={type:"timeline",duration:{years:1}},C=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return Ht(r,e),r.mixin(_),r.prototype.resourceGrid=null,r.prototype.joiner=null,r.prototype.dividerEls=null,r.prototype.superHeaderText=null,r.prototype.isVGrouping=null,r.prototype.isHGrouping=null,r.prototype.groupSpecs=null,r.prototype.colSpecs=null,r.prototype.orderSpecs=null,r.prototype.rowHierarchy=null,r.prototype.resourceRowHash=null,r.prototype.nestingCnt=0,r.prototype.isNesting=null,r.prototype.dividerWidth=null,r.prototype.initialize=function(){return r.__super__.initialize.apply(this,arguments),this.processResourceOptions(),this.resourceGrid=new G(this),this.rowHierarchy=new H(this),this.resourceRowHash={}},r.prototype.instantiateGrid=function(){return new E(this)},r.prototype.processResourceOptions=function(){var t,e,r,o,n,i,s,l,h,u,a,p,c,d,f,g,y,v,w,m,R,S,b;for(t=this.opt("resourceColumns")||[],f=this.opt("resourceLabelText"),o="Resources",S=null,t.length?S=f:(b=this.opt("resourceText"),b||(b=function(t){return t.title||t.id}),t.push({labelText:f||o,text:b})),m=[],n=[],s=[],a=!1,u=!1,p=0,g=t.length;g>p;p++)r=t[p],r.group?n.push(r):m.push(r);for(m[0].isMain=!0,n.length?(s=n,a=!0):(l=this.opt("resourceGroupField"),l&&(u=!0,s.push({field:l,text:this.opt("resourceGroupText"),render:this.opt("resourceGroupRender")}))),e=gt(this.opt("resourceOrder")),R=[],c=0,y=e.length;y>c;c++){for(w=e[c],h=!1,d=0,v=s.length;v>d;d++)if(i=s[d],i.field===w.field){i.order=w.order,h=!0;break}h||R.push(w)}return this.superHeaderText=S,this.isVGrouping=a,this.isHGrouping=u,this.groupSpecs=s,this.colSpecs=n.concat(m),this.orderSpecs=R},r.prototype.renderSkeleton=function(){return r.__super__.renderSkeleton.apply(this,arguments),this.renderResourceGridSkeleton(),this.joiner=new I("vertical",[this.resourceGrid.bodyScroller,this.timeGrid.bodyScroller]),this.initDividerMoving()},r.prototype.renderSkeletonHtml=function(){return'
'},r.prototype.renderResourceGridSkeleton=function(){return this.resourceGrid.el=this.el.find("tbody .fc-resource-area"),this.resourceGrid.headEl=this.el.find("thead .fc-resource-area"),this.resourceGrid.renderSkeleton()},r.prototype.initDividerMoving=function(){var t;return this.dividerEls=this.el.find(".fc-divider"),this.dividerWidth=null!=(t=this.opt("resourceAreaWidth"))?t:this.resourceGrid.tableWidth,null!=this.dividerWidth&&this.positionDivider(this.dividerWidth),this.dividerEls.on("mousedown",function(t){return function(e){return t.dividerMousedown(e)}}(this))},r.prototype.dividerMousedown=function(t){var e,r,o,n,i;return r=this.opt("isRTL"),n=30,o=this.el.width()-30,i=this.getNaturalDividerWidth(),e=new l({dragStart:function(t){return function(){return t.dividerEls.addClass("fc-active")}}(this),drag:function(t){return function(e,s){var l;return l=r?i-e:i+e,l=Math.max(l,n),l=Math.min(l,o),t.dividerWidth=l,t.positionDivider(l),t.updateWidth()}}(this),dragStop:function(t){return function(){return t.dividerEls.removeClass("fc-active")}}(this)}),e.mousedown(t)},r.prototype.getNaturalDividerWidth=function(){return this.el.find(".fc-resource-area").width()},r.prototype.positionDivider=function(t){return this.el.find(".fc-resource-area").width(t)},r.prototype.renderEvents=function(t){return this.timeGrid.renderEvents(t),this.syncRowHeights(),this.updateWidth()},r.prototype.unrenderEvents=function(){return this.timeGrid.unrenderEvents(),this.syncRowHeights(),this.updateWidth()},r.prototype.updateWidth=function(){return r.__super__.updateWidth.apply(this,arguments),this.resourceGrid.updateWidth(),this.joiner.update(),this.cellFollower?this.cellFollower.update():void 0},r.prototype.updateHeight=function(t){return r.__super__.updateHeight.apply(this,arguments),t?this.syncRowHeights():void 0},r.prototype.setHeight=function(t,e){var r,o;return o=this.syncHeadHeights(),r=e?"auto":t-o-this.queryMiscHeight(),this.timeGrid.bodyScroller.setHeight(r),this.resourceGrid.bodyScroller.setHeight(r)},r.prototype.queryMiscHeight=function(){return this.el.outerHeight()-Math.max(this.resourceGrid.headScroller.el.outerHeight(),this.timeGrid.headScroller.el.outerHeight())-Math.max(this.resourceGrid.bodyScroller.el.outerHeight(),this.timeGrid.bodyScroller.el.outerHeight())},r.prototype.syncHeadHeights=function(){var t;return this.resourceGrid.headHeight("auto"),this.timeGrid.headHeight("auto"),t=Math.max(this.resourceGrid.headHeight(),this.timeGrid.headHeight()),this.resourceGrid.headHeight(t),this.timeGrid.headHeight(t),t},r.prototype.scrollToResource=function(t){return this.timeGrid.scrollToResource(t)},r.prototype.setResources=function(t){var e,r,o;for(this.batchRows(),e=0,r=t.length;r>e;e++)o=t[e],this.insertResource(o);return this.unbatchRows(),this.reinitializeCellFollowers()},r.prototype.unsetResources=function(){return this.batchRows(),this.rowHierarchy.removeChildren(),this.unbatchRows(),this.reinitializeCellFollowers()},r.prototype.addResource=function(t){return this.insertResource(t),this.reinitializeCellFollowers()},r.prototype.removeResource=function(t){var e;return e=this.getResourceRow(t.id),e?(this.batchRows(),e.remove(),this.unbatchRows(),this.reinitializeCellFollowers()):void 0},r.prototype.cellFollower=null,r.prototype.reinitializeCellFollowers=function(){var e,r,o,n,i,s;for(this.cellFollower&&this.cellFollower.clearSprites(),this.cellFollower=new F(this.resourceGrid.bodyScroller),this.cellFollower.isHFollowing=!1,this.cellFollower.isVFollowing=!0,n=[],i=this.rowHierarchy.getNodes(),r=0,o=i.length;o>r;r++)s=i[r],s instanceof z&&s.groupTd&&(e=s.groupTd.find(".fc-cell-content"),e.length&&n.push(e[0]));return this.cellFollower.setSprites(t(n))},r.prototype.insertResource=function(t,e){var r,o,n,i,s,l,h;for(h=new b(this,t),null==e&&(i=t.parentId,i&&(e=this.getResourceRow(i))),e?this.insertRowAsChild(h,e):this.insertRow(h),s=t.children,l=[],o=0,n=s.length;n>o;o++)r=s[o],l.push(this.insertResource(r,h));return l},r.prototype.insertRow=function(t,e,r){var o;return null==e&&(e=this.rowHierarchy),null==r&&(r=this.groupSpecs),r.length?(o=this.ensureResourceGroup(t,e,r[0]),o instanceof c?this.insertRowAsChild(t,o):this.insertRow(t,o,r.slice(1))):this.insertRowAsChild(t,e)},r.prototype.insertRowAsChild=function(t,e){return e.addChild(t,this.computeChildRowPosition(t,e))},r.prototype.computeChildRowPosition=function(t,e){var r,o,n,i,s,l;if(this.orderSpecs.length)for(s=e.children,o=n=0,i=s.length;i>n;o=++n)if(l=s[o],r=this.compareResources(l.resource||{},t.resource||{}),r>0)return o;return null},r.prototype.compareResources=function(t,e){return A(t,e,this.orderSpecs)},r.prototype.ensureResourceGroup=function(t,e,r){var o,n,i,s,l,h,u,a,p,d,f;if(i=(t.resource||{})[r.field],n=null,r.order)for(p=e.children,s=l=0,u=p.length;u>l;s=++l){if(f=p[s],o=Q(f.groupValue,i)*r.order,0===o){n=f;break}if(o>0)break}else for(d=e.children,s=h=0,a=d.length;a>h;s=++h)if(f=d[s],f.groupValue===i){n=f;break}return n||(n=this.isVGrouping?new z(this,r,i):new c(this,r,i),e.addChild(n,s)),n},r.prototype.pairSegsWithRows=function(t){var e,r,o,n,i,s,l,h;for(n=[],i={},e=0,r=t.length;r>e;e++)h=t[e],s=h.resourceId||"",l=this.getResourceRow(s),l&&(o=i[s],o||(o=[l,[]],n.push(o),i[s]=o),o[1].push(h));return n},r.prototype.rowAdded=function(t){var e,r;return t instanceof b&&(this.resourceRowHash[t.resource.id]=t),r=this.isNesting,e=Boolean(this.nestingCnt+=t.depth?1:0),r!==e&&(this.el.toggleClass("fc-nested",e),this.el.toggleClass("fc-flat",!e)),this.isNesting=e},r.prototype.rowRemoved=function(t){var e,r;return t instanceof b&&delete this.resourceRowHash[t.resource.id],r=this.isNesting,e=Boolean(this.nestingCnt-=t.depth?1:0),r!==e&&(this.el.toggleClass("fc-nested",e),this.el.toggleClass("fc-flat",!e)),this.isNesting=e},r.prototype.batchRowDepth=0,r.prototype.shownRowBatch=null,r.prototype.hiddenRowBatch=null,r.prototype.batchRows=function(){return this.batchRowDepth++?void 0:(this.shownRowBatch=[],this.hiddenRowBatch=[])},r.prototype.unbatchRows=function(){return--this.batchRowDepth?void 0:(this.hiddenRowBatch.length&&this.rowsHidden(this.hiddenRowBatch),this.shownRowBatch.length&&this.rowsShown(this.shownRowBatch),this.hiddenRowBatch=null,this.shownRowBatch=null)},r.prototype.rowShown=function(t){return this.shownRowBatch?this.shownRowBatch.push(t):this.rowsShown([t])},r.prototype.rowHidden=function(t){return this.hiddenRowBatch?this.hiddenRowBatch.push(t):this.rowsHidden([t])},r.prototype.rowsShown=function(t){return this.syncRowHeights(t),this.updateWidth()},r.prototype.rowsHidden=function(t){return this.updateWidth()},r.prototype.tbodyHash=null,r.prototype.renderStoredResources=function(){return this.tbodyHash={spreadsheet:this.resourceGrid.tbodyEl,event:this.timeGrid.tbodyEl},this.batchRows(),this.rowHierarchy.show(),this.unbatchRows(),this.reinitializeCellFollowers()},r.prototype.unrenderStoredResources=function(){return this.batchRows(),this.rowHierarchy.recursivelyUnrender(),this.unbatchRows(),this.reinitializeCellFollowers()},r.prototype.syncRowHeights=function(t,e){var r,o,n,i,s,l,h,u,a,p;for(null==e&&(e=!1),null==t&&(t=this.getVisibleRows()),l=0,u=t.length;u>l;l++)p=t[l],p.setTrInnerHeight("");for(s=function(){var o,n,i;for(i=[],o=0,n=t.length;n>o;o++)p=t[o],r=p.getMaxTrInnerHeight(),e&&(r+=r%2),i.push(r);return i}(),i=h=0,a=t.length;a>h;i=++h)p=t[i],p.setTrInnerHeight(s[i]);return!e&&(o=this.resourceGrid.tbodyEl.height(),n=this.timeGrid.tbodyEl.height(),Math.abs(o-n)>1)?this.syncRowHeights(t,!0):void 0},r.prototype.getVisibleRows=function(){var t,e,r,o,n;for(r=this.rowHierarchy.getRows(),o=[],t=0,e=r.length;e>t;t++)n=r[t],n.isShown&&o.push(n);return o},r.prototype.getEventRows=function(){var t,e,r,o,n;for(r=this.rowHierarchy.getRows(),o=[],t=0,e=r.length;e>t;t++)n=r[t],n instanceof u&&o.push(n);return o},r.prototype.getResourceRow=function(t){return this.resourceRowHash[t]},r.prototype.setScroll=function(t){return r.__super__.setScroll.apply(this,arguments),this.resourceGrid.bodyScroller.scrollTop(t.top)},r}(k),E=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return Ht(r,e),r.mixin(R),r.prototype.eventRows=null,r.prototype.shownEventRows=null,r.prototype.tbodyEl=null,r.prototype.build=function(){var t;return this.eventRows=this.view.getEventRows(),this.shownEventRows=function(){var e,r,o,n;for(o=this.eventRows,n=[],e=0,r=o.length;r>e;e++)t=o[e],t.isShown&&n.push(t);return n}.call(this),this.rowCnt=this.shownEventRows.length},r.prototype.clear=function(){return this.eventRows=null,this.shownEventRows=null},r.prototype.getRowData=function(t){return{resourceId:this.shownEventRows[t].resource.id}},r.prototype.getRowEl=function(t){return this.shownEventRows[t].getTr("event")},r.prototype.renderSkeleton=function(){var e;return r.__super__.renderSkeleton.apply(this,arguments),this.segContainerEl.remove(),this.segContainerEl=null,e=t('
').appendTo(this.bodyScroller.contentEl),this.tbodyEl=e.find("tbody")},r.prototype.renderFgSegs=function(t){var e,r,o,n,i,s,l;for(t=this.renderFgSegEls(t),s=this.view.pairSegsWithRows(t),l=[],o=0,n=s.length;n>o;o++)i=s[o],e=i[0],r=i[1],e.fgSegs=r,e.isShown&&(e.isSegsRendered=!0,l.push(i));return this.renderFgSegsInContainers(l),this.updateSegFollowers(t),t},r.prototype.unrenderFgSegs=function(){var t,e,r,o;for(this.clearSegFollowers(),e=this.view.getEventRows(),r=0,o=e.length;o>r;r++)t=e[r],t.fgSegs=null,t.isSegsRendered=!1;return this.unrenderFgContainers(e)},r.prototype.renderFill=function(t,e,r){var o,n,i,s,l,h,u,a,p,c,d,f;for(e=this.renderFillSegEls(t,e),a=[],l=[],o=0,i=e.length;i>o;o++)d=e[o],d.resourceId?a.push(d):l.push(d);for(u=this.view.pairSegsWithRows(a),f=[],n=0,s=u.length;s>n;n++)h=u[n],p=h[0],c=h[1],"bgEvent"===t&&(p.bgSegs=c),p.isShown&&f.push(h);return l.length&&f.unshift([this,l]),this.renderFillInContainers(t,f,r),e},r.prototype.renderHelper=function(t,e){var r,o;return o=this.eventsToSegs([t]),o=this.renderFgSegEls(o),r=this.view.pairSegsWithRows(o),this.renderHelperSegsInContainers(r,e)},r.prototype.computeInitialScroll=function(t){var e;return e=r.__super__.computeInitialScroll.apply(this,arguments),t&&(e.resourceId=t.resourceId,e.bottom=t.bottom),e},r.prototype.queryScroll=function(){var t,e,o,n,i,s,l,h;for(h=r.__super__.queryScroll.apply(this,arguments),l=this.bodyScroller.scrollEl.offset().top,i=this.view.getVisibleRows(),o=0,n=i.length;n>o;o++)if(s=i[o],s.resource&&(t=s.getTr("event"),e=t.offset().top+t.outerHeight(),e>l)){h.resourceId=s.resource.id,h.bottom=e-l;break}return h},r.prototype.setScroll=function(t){var e,o,n,i;return t.resourceId&&(i=this.view.getResourceRow(t.resourceId),i&&(e=i.getTr("event"),e&&(n=this.bodyScroller.innerEl.offset().top,o=e.offset().top+e.outerHeight(),t.top=o-t.bottom-n))),r.__super__.setScroll.call(this,t)},r.prototype.scrollToResource=function(t){var e,r,o,n;return o=this.view.getResourceRow(t.id),o&&(e=o.getTr("event"))?(r=this.bodyScroller.innerEl.offset().top,n=e.offset().top-r,this.bodyScroller.scrollEl.scrollTop(n)):void 0},r}(M),r=30,G=function(){function e(t){var e;this.view=t,this.isRTL=this.view.opt("isRTL"),this.givenColWidths=this.colWidths=function(){var t,r,o,n;for(o=this.view.colSpecs,n=[],t=0,r=o.length;r>t;t++)e=o[t],n.push(e.width);return n}.call(this)}return e.prototype.view=null,e.prototype.headEl=null,e.prototype.el=null,e.prototype.tbodyEl=null,e.prototype.headScroller=null,e.prototype.bodyScroller=null,e.prototype.joiner=null,e.prototype.colGroupHtml="",e.prototype.headTable=null,e.prototype.headColEls=null,e.prototype.headCellEls=null,e.prototype.bodyColEls=null,e.prototype.bodyTable=null,e.prototype.renderSkeleton=function(){return this.headScroller=new W("invisible-scroll","hidden"),this.headScroller.contentEl.html(this.renderHeadHtml()),this.headEl.append(this.headScroller.el),this.bodyScroller=new W("auto","invisible-scroll"),this.bodyScroller.contentEl.html(""+this.colGroupHtml+"
"),this.tbodyEl=this.bodyScroller.contentEl.find("tbody"), +this.el.append(this.bodyScroller.el),this.joiner=new I("horizontal",[this.headScroller,this.bodyScroller]),this.headTable=this.headEl.find("table"),this.headColEls=this.headEl.find("col"),this.headCellEls=this.headScroller.contentEl.find("tr:last-child th"),this.bodyColEls=this.el.find("col"),this.bodyTable=this.el.find("table"),this.colMinWidths=this.computeColMinWidths(),this.applyColWidths(),this.initColResizing()},e.prototype.renderHeadHtml=function(){var t,e,r,o,n,i,s,l,h,u,a;for(e=this.view.colSpecs,r="",t="",s=0,h=e.length;h>s;s++)a=e[s],t+=a.isMain?'':"";for(t+="",this.colGroupHtml=t,r+=t,r+="",this.view.superHeaderText&&(r+='"),r+="",i=!0,o=l=0,u=e.length;u>l;o=++l)a=e[o],n=o===e.length-1,r+='";return r+="",r+="
'+st(this.view.superHeaderText)+"
'+(a.isMain?'
':"")+''+st(a.labelText||"")+"
"+(n?"":'
')+"
"},e.prototype.givenColWidths=null,e.prototype.colWidths=null,e.prototype.colMinWidths=null,e.prototype.tableWidth=null,e.prototype.tableMinWidth=null,e.prototype.initColResizing=function(){return this.headEl.find("th .fc-col-resizer").each(function(e){return function(r,o){return o=t(o),o.on("mousedown",function(t){return e.colResizeMousedown(r,t,o)})}}(this))},e.prototype.colResizeMousedown=function(t,e,o){var n,i,s,h;return n=this.colWidths=this.queryColWidths(),n.pop(),n.push("auto"),h=n[t],s=Math.min(this.colMinWidths[t],r),i=new l({dragStart:function(t){return function(){return o.addClass("fc-active")}}(this),drag:function(e){return function(r,o){var i;return i=h+(e.isRTL?-r:r),i=Math.max(i,s),n[t]=i,e.applyColWidths()}}(this),dragStop:function(t){return function(){return o.removeClass("fc-active")}}(this)}),i.mousedown(e)},e.prototype.applyColWidths=function(){var t,e,r,o,n,i,s,l,h,u,a,p,c,d,f,g,y;for(r=this.colMinWidths,n=this.colWidths,t=!0,e=!1,y=0,u=0,c=n.length;c>u;u++)o=n[u],"number"==typeof o?y+=o:(t=!1,o&&(e=!0));for(l=e?"auto":"",s=function(){var t,e,r;for(r=[],h=t=0,e=n.length;e>t;h=++t)o=n[h],r.push(null!=o?o:l);return r}(),g=0,h=a=0,d=s.length;d>a;h=++a)i=s[h],g+="number"==typeof i?i:r[h];for(h=p=0,f=s.length;f>p;h=++p)i=s[h],this.headColEls.eq(h).width(i),this.bodyColEls.eq(h).width(i);return this.headScroller.setContentMinWidth(g),this.bodyScroller.setContentMinWidth(g),this.tableMinWidth=g,this.tableWidth=t?y:void 0},e.prototype.computeColMinWidths=function(){var t,e,o,n,i,s;for(n=this.givenColWidths,i=[],t=e=0,o=n.length;o>e;t=++e)s=n[t],i.push("number"==typeof s?s:parseInt(this.headColEls.eq(t).css("min-width"))||r);return i},e.prototype.queryColWidths=function(){var e,r,o,n,i;for(n=this.headCellEls,i=[],e=0,r=n.length;r>e;e++)o=n[e],i.push(t(o).outerWidth());return i},e.prototype.updateWidth=function(){return this.headScroller.update(),this.bodyScroller.update(),this.joiner.update(),this.follower?this.follower.update():void 0},e.prototype.headHeight=function(){var t;return t=this.headScroller.contentEl.find("table"),t.height.apply(t,arguments)},e}(),H=function(){function e(e){this.view=e,this.children=[],this.trHash={},this.trs=t()}return e.prototype.view=null,e.prototype.parent=null,e.prototype.prevSibling=null,e.prototype.children=null,e.prototype.depth=0,e.prototype.hasOwnRow=!1,e.prototype.trHash=null,e.prototype.trs=null,e.prototype.isRendered=!1,e.prototype.isExpanded=!0,e.prototype.isShown=!1,e.prototype.addChild=function(t,e){var r,o,n,i,s;for(t.remove(),r=this.children,null!=e?r.splice(e,0,t):(e=r.length,r.push(t)),t.prevSibling=e>0?r[e-1]:null,eo;o++)i=s[o],i.added();return this.isShown&&this.isExpanded?t.show():void 0},e.prototype.removeChild=function(t){var e,r,o,n,i,s,l,h,u,a;for(e=this.children,o=!1,r=n=0,s=e.length;s>n;r=++n)if(a=e[r],a===t){o=!0;break}if(o){for(ri;i++)u=h[i],u.removed();return t.parent=null,t.prevSibling=null,t}return!1},e.prototype.removeChildren=function(){var t,e,r,o,n,i,s;for(i=this.children,e=0,o=i.length;o>e;e++)t=i[e],t.recursivelyUnrender();for(s=this.getDescendants(),r=0,n=s.length;n>r;r++)t=s[r],t.removed();return this.children=[]},e.prototype.remove=function(){return this.parent?this.parent.removeChild(this):void 0},e.prototype.getLastChild=function(){var t;return t=this.children,t[t.length-1]},e.prototype.getPrevRow=function(){var t,e;for(e=this;e;){if(e.prevSibling)for(e=e.prevSibling;t=e.getLastChild();)e=t;else e=e.parent;if(e&&e.hasOwnRow&&e.isShown)return e}return null},e.prototype.getLeadingRow=function(){return this.hasOwnRow?this:this.isExpanded&&this.children.length?this.children[0].getLeadingRow():void 0},e.prototype.getRows=function(t){var e,r,o,n;for(null==t&&(t=[]),this.hasOwnRow&&t.push(this),n=this.children,r=0,o=n.length;o>r;r++)e=n[r],e.getRows(t);return t},e.prototype.getNodes=function(t){var e,r,o,n;for(null==t&&(t=[]),t.push(this),n=this.children,r=0,o=n.length;o>r;r++)e=n[r],e.getNodes(t);return t},e.prototype.getDescendants=function(){var t,e,r,o,n;for(t=[],n=this.children,r=0,o=n.length;o>r;r++)e=n[r],e.getNodes(t);return t},e.prototype.render=function(){var e,r,o,n,i,s,l;if(this.trHash={},s=[],this.hasOwnRow){e=this.getPrevRow(),r=this.view.tbodyHash;for(l in r)n=r[l],i=t(""),this.trHash[l]=i,s.push(i[0]),o="render"+P(l)+"Content",this[o]&&this[o](i),e?e.trHash[l].after(i):n.prepend(i)}return this.trs=t(s).on("click",".fc-expander",vt(this,"toggleExpanded")),this.isRendered=!0},e.prototype.unrender=function(){var e,r,o,n;if(this.isRendered){e=this.trHash;for(o in e)r=e[o],n="unrender"+P(o)+"Content",this[n]&&this[n](r);return this.trHash={},this.trs.remove(),this.trs=t(),this.isRendered=!1,this.isShown=!1,this.hidden()}},e.prototype.recursivelyUnrender=function(){var t,e,r,o,n;for(this.unrender(),o=this.children,n=[],e=0,r=o.length;r>e;e++)t=o[e],n.push(t.recursivelyUnrender());return n},e.prototype.getTr=function(t){return this.trHash[t]},e.prototype.show=function(){var t,e,r,o,n;if(!this.isShown&&(this.isRendered?this.trs.css("display",""):this.render(),this.ensureSegsRendered&&this.ensureSegsRendered(),this.isExpanded?this.indicateExpanded():this.indicateCollapsed(),this.isShown=!0,this.shown(),this.isExpanded)){for(o=this.children,n=[],e=0,r=o.length;r>e;e++)t=o[e],n.push(t.show());return n}},e.prototype.hide=function(){var t,e,r,o,n;if(this.isShown&&(this.isRendered&&this.trs.hide(),this.isShown=!1,this.hidden(),this.isExpanded)){for(o=this.children,n=[],e=0,r=o.length;r>e;e++)t=o[e],n.push(t.hide());return n}},e.prototype.expand=function(){var t,e,r,o;if(!this.isExpanded){for(this.isExpanded=!0,this.indicateExpanded(),this.view.batchRows(),o=this.children,e=0,r=o.length;r>e;e++)t=o[e],t.show();return this.view.unbatchRows(),this.animateExpand()}},e.prototype.collapse=function(){var t,e,r,o;if(this.isExpanded){for(this.isExpanded=!1,this.indicateCollapsed(),this.view.batchRows(),o=this.children,e=0,r=o.length;r>e;e++)t=o[e],t.hide();return this.view.unbatchRows()}},e.prototype.toggleExpanded=function(){return this.isExpanded?this.collapse():this.expand()},e.prototype.indicateExpanded=function(){return this.trs.find(".fc-expander").removeClass(this.getCollapsedIcon()).addClass(this.getExpandedIcon())},e.prototype.indicateCollapsed=function(){return this.trs.find(".fc-expander").removeClass(this.getExpandedIcon()).addClass(this.getCollapsedIcon())},e.prototype.enableExpanding=function(){return this.trs.find(".fc-expander-space").addClass("fc-expander")},e.prototype.disableExpanding=function(){return this.trs.find(".fc-expander-space").removeClass("fc-expander").removeClass(this.getExpandedIcon()).removeClass(this.getCollapsedIcon())},e.prototype.getExpandedIcon=function(){return"fc-icon-down-triangle"},e.prototype.getCollapsedIcon=function(){var t;return t=this.view.isRTL?"left":"right","fc-icon-"+t+"-triangle"},e.prototype.animateExpand=function(){var t,e,r;return r=null!=(t=this.children[0])&&null!=(e=t.getLeadingRow())?e.trs:void 0,r?(r.addClass("fc-collapsed"),setTimeout(function(){return r.addClass("fc-transitioning"),r.removeClass("fc-collapsed")}),r.one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){return r.removeClass("fc-transitioning")})):void 0},e.prototype.getMaxTrInnerHeight=function(){var e;return e=0,t.each(this.trHash,function(t){return function(t,r){var o;return o=J(r).find("> div"),e=Math.max(o.height(),e)}}(this)),e},e.prototype.setTrInnerHeight=function(t){return J(this.trs).find("> div").height(t)},e.prototype.shown=function(){return this.hasOwnRow?this.rowShown(this):void 0},e.prototype.hidden=function(){return this.hasOwnRow?this.rowHidden(this):void 0},e.prototype.rowShown=function(t){return(this.parent||this.view).rowShown(t)},e.prototype.rowHidden=function(t){return(this.parent||this.view).rowHidden(t)},e.prototype.added=function(){return this.hasOwnRow?this.rowAdded(this):void 0},e.prototype.removed=function(){return this.hasOwnRow?this.rowRemoved(this):void 0},e.prototype.rowAdded=function(t){return(this.parent||this.view).rowAdded(t)},e.prototype.rowRemoved=function(t){return(this.parent||this.view).rowRemoved(t)},e}(),T=function(e){function r(t,e,o){this.groupSpec=e,this.groupValue=o,r.__super__.constructor.apply(this,arguments)}return Ht(r,e),r.prototype.groupSpec=null,r.prototype.groupValue=null,r.prototype.rowRemoved=function(t){return r.__super__.rowRemoved.apply(this,arguments),t===this||this.children.length?void 0:this.remove()},r.prototype.renderGroupContentEl=function(){var e,r;return e=t('
').append(this.renderGroupTextEl()),r=this.groupSpec.render,"function"==typeof r&&(e=r(e,this.groupValue)||e),e},r.prototype.renderGroupTextEl=function(){var e,r;return r=this.groupValue||"",e=this.groupSpec.text,"function"==typeof e&&(r=e(r)||r),t('').text(r)},r}(H),c=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return Ht(r,e),r.prototype.hasOwnRow=!0,r.prototype.renderSpreadsheetContent=function(e){var r;return r=this.renderGroupContentEl(),r.prepend(''),t('').attr("colspan",this.view.colSpecs.length).append(t("
").append(r)).appendTo(e)},r.prototype.renderEventContent=function(t){return t.append('
')},r}(T),z=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return Ht(r,e),r.prototype.rowspan=0,r.prototype.leadingTr=null,r.prototype.groupTd=null,r.prototype.rowShown=function(t){return this.rowspan+=1,this.renderRowspan(),r.__super__.rowShown.apply(this,arguments)},r.prototype.rowHidden=function(t){return this.rowspan-=1,this.renderRowspan(),r.__super__.rowHidden.apply(this,arguments)},r.prototype.renderRowspan=function(){var e;return this.rowspan?(this.groupTd||(this.groupTd=t('').append(this.renderGroupContentEl())),this.groupTd.attr("rowspan",this.rowspan),e=this.getLeadingRow().getTr("spreadsheet"),e!==this.leadingTr?(e&&e.prepend(this.groupTd),this.leadingTr=e):void 0):(this.groupTd&&(this.groupTd.remove(),this.groupTd=null),this.leadingTr=null)},r}(T),u=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return Ht(e,t),e.prototype.hasOwnRow=!0,e.prototype.segContainerEl=null,e.prototype.segContainerHeight=null,e.prototype.innerEl=null,e.prototype.bgSegContainerEl=null,e.prototype.isSegsRendered=!1,e.prototype.bgSegs=null,e.prototype.fgSegs=null,e.prototype.renderEventContent=function(t){return t.html('
'),this.segContainerEl=t.find(".fc-event-container"),this.innerEl=this.bgSegContainerEl=t.find("td > div"),this.ensureSegsRendered()},e.prototype.ensureSegsRendered=function(){return this.isSegsRendered?void 0:(this.bgSegs&&this.view.timeGrid.renderFillInContainer("bgEvent",this,this.bgSegs),this.fgSegs&&this.view.timeGrid.renderFgSegsInContainers([[this,this.fgSegs]]),this.isSegsRendered=!0)},e.prototype.unrenderEventContent=function(){return this.bgSegs=null,this.fgSegs=null,this.isSegsRendered=!1},e}(H),b=function(e){function r(t,e){this.resource=e,r.__super__.constructor.apply(this,arguments)}return Ht(r,e),r.prototype.resource=null,r.prototype.rowAdded=function(t){return r.__super__.rowAdded.apply(this,arguments),t!==this&&this.isRendered&&1===this.children.length?(this.enableExpanding(),this.isExpanded?this.indicateExpanded():this.indicateCollapsed()):void 0},r.prototype.rowRemoved=function(t){return r.__super__.rowRemoved.apply(this,arguments),t!==this&&this.isRendered&&!this.children.length?this.disableExpanding():void 0},r.prototype.render=function(){return r.__super__.render.apply(this,arguments),this.children.length>0?this.enableExpanding():this.disableExpanding(),this.view.trigger("resourceRender",this.resource,this.resource,this.getTr("spreadsheet").find("> td"),this.getTr("event").find("> td"))},r.prototype.renderSpreadsheetContent=function(e){var r,o,n,i,s,l,h,u,a,p;for(h=this.resource,l=this.view.colSpecs,u=[],i=0,s=l.length;s>i;i++)r=l[i],r.group||(n=r.field?h[r.field]||null:h,p="function"==typeof r.text?r.text(h,n):n,o=t('
'+(r.isMain?this.renderGutterHtml():"")+''+(p?st(p):" ")+"
"),"function"==typeof r.render&&(o=r.render(h,o,n)||o),a=t('').append(o),r.isMain&&a.wrapInner("
"),u.push(e.append(a)));return u},r.prototype.renderGutterHtml=function(){var t,e,r,o;for(t="",e=r=0,o=this.depth;o>r;e=r+=1)t+='';return t+=''},r}(u),a.views.timeline.resourceClass=C,m="2015-10-18",L={years:1,weeks:1},d="http://fullcalendar.io/scheduler/license/",w=["GPL-My-Project-Is-Open-Source","CC-Attribution-NonCommercial-NoDerivatives"],yt=function(t,e){return ut(window.location.href)||pt(t)?void 0:wt('Please use a valid license key. More Info',e)},pt=function(r){var o,n,i,s;return-1!==t.inArray(r,w)?!0:(n=(r||"").match(/^(\d+)\-fcs\-(\d+)$/),n&&10===n[1].length&&(i=e.utc(1e3*parseInt(n[2])),s=e.utc(a.mockSchedulerReleaseDate||m),s.isValid()&&(o=s.clone().subtract(L),i.isAfter(o)))?!0:!1)},ut=function(t){return Boolean(t.match(/\w+\:\/\/fullcalendar\.io\/|\/demos\/[\w-]+\.html$/))},wt=function(e,r){return r.append(t('
').html(e))}}); \ No newline at end of file