@syncfusion/ej2-gantt
Version:
Essential JS 2 Gantt Component
10 lines • 1.32 MB
JavaScript
/*!
* filename: ej2-gantt.umd.min.js
* version : 34.1.30
* Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-popups"),require("@syncfusion/ej2-data"),require("@syncfusion/ej2-grids"),require("@syncfusion/ej2-treegrid"),require("@syncfusion/ej2-dropdowns"),require("@syncfusion/ej2-svg-base"),require("@syncfusion/ej2-layouts"),require("@syncfusion/ej2-navigations"),require("@syncfusion/ej2-richtexteditor"),require("@syncfusion/ej2-inputs"),require("@syncfusion/ej2-buttons"),require("@syncfusion/ej2-calendars"),require("@syncfusion/ej2-pdf-export")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-popups","@syncfusion/ej2-data","@syncfusion/ej2-grids","@syncfusion/ej2-treegrid","@syncfusion/ej2-dropdowns","@syncfusion/ej2-svg-base","@syncfusion/ej2-layouts","@syncfusion/ej2-navigations","@syncfusion/ej2-richtexteditor","@syncfusion/ej2-inputs","@syncfusion/ej2-buttons","@syncfusion/ej2-calendars","@syncfusion/ej2-pdf-export"],t):t((e=e||self).ej={},e.ej2Base,e.ej2Popups,e.ej2Data,e.ej2Grids,e.ej2Treegrid,e.ej2Dropdowns,e.ej2SvgBase,e.ej2Layouts,e.ej2Navigations,e.ej2Richtexteditor,e.ej2Inputs,e.ej2Buttons,e.ej2Calendars,e.ej2PdfExport)}(this,function(k,ae,E,U,T,b,F,N,L,V,h,B,A,W,re){"use strict";function S(e,t,i){for(var n=e;n&&(i?n.id!==t:!n.classList.contains(t));)n=n.parentElement;return n}function j(e){return ae.isNullOrUndefined(e.startDate)&&ae.isNullOrUndefined(e.endDate)&&ae.isNullOrUndefined(e.duration)?null:!(ae.isNullOrUndefined(e.startDate)||ae.isNullOrUndefined(e.endDate)||ae.isNullOrUndefined(e.duration))}function H(e){return!(!e.dataSource||e.dataSource instanceof U.DataManager||!("result"in e.dataSource))}function G(e){for(var t={},i=0,n=Object.keys(e);i<n.length;i++){var a=n[i];t[e[a]]=a}return t}function z(e){return!ae.isNullOrUndefined(e)&&"object"==typeof e&&0===Object.keys(e).length}function q(e){var t=e.getFullYear(),i=e.getMonth(),n=e.getDate(),a=e.getHours(),r=e.getMinutes(),s=e.getSeconds(),e=e.getMilliseconds();return Date.UTC(t,i,n,a,r,s,e)}function _(e){return e instanceof U.DataManager&&((e=e.adaptor)instanceof U.ODataAdaptor||e instanceof U.ODataV4Adaptor||e instanceof U.WebApiAdaptor||e instanceof U.WebMethodAdaptor||e instanceof U.CacheAdaptor||e instanceof U.RemoteSaveAdaptor||e instanceof U.UrlAdaptor)}function Z(e,t,i,n,a){if(i)for(var r=void 0,s=0;s<e.length;s++)r=o=t?e[parseInt(s.toString(),10)].taskData:ae.extend({},e[parseInt(s.toString(),10)].taskData,{},!0);else for(r=[],s=0;s<e.length;s++){ae.isNullOrUndefined(n)||!n.timezone||a||X(e[s],n);var o=t?e[parseInt(s.toString(),10)].taskData:ae.extend({},e[parseInt(s.toString(),10)].taskData,{},!0);r.push(o)}return r}function X(e,t){var i,n;return e&&!ae.isNullOrUndefined(e.ganttProperties)&&(i=e.taskData,n=e.ganttProperties,i[t.taskFields.startDate]=t.dateValidationModule.remove(n.startDate,t.timezone),null!==t.taskFields.endDate&&(i[t.taskFields.endDate]=t.dateValidationModule.remove(n.endDate,t.timezone)),(t.taskFields.baselineStartDate||t.taskFields.baselineEndDate)&&(i[t.taskFields.baselineStartDate]=t.dateValidationModule.remove(n.baselineStartDate,t.timezone),i[t.taskFields.baselineEndDate]=t.dateValidationModule.remove(n.baselineEndDate,t.timezone)),t.editModule.processCustomDateColumns(e,i,t,"remove")),null}function Y(e,t){for(var i,n=0;n<t.length;n++)i=new RegExp("\\{"+n+"\\}","gm"),e=e.replace(i,t[n].toString());return e}function Q(e,t,i,n){for(var a=-1,r=0;r<i.length;r++)if(ae.getValue(t,i[r])===ae.getValue(t,e)&&ae.isNullOrUndefined(n)||!ae.isNullOrUndefined(n)&&ae.getValue(t,i[r])===ae.getValue(t,e)&&ae.getValue(n,i[r])===ae.getValue(n,e)){a=r;break}return a}function se(e){return 76*e/92}function oe(e){return 92*e/76}var K=0;function $(){return K++}(s=k.ConstraintType||(k.ConstraintType={}))[s.AsSoonAsPossible=0]="AsSoonAsPossible",s[s.AsLateAsPossible=1]="AsLateAsPossible",s[s.MustStartOn=2]="MustStartOn",s[s.MustFinishOn=3]="MustFinishOn",s[s.StartNoEarlierThan=4]="StartNoEarlierThan",s[s.StartNoLaterThan=5]="StartNoLaterThan",s[s.FinishNoEarlierThan=6]="FinishNoEarlierThan",s[s.FinishNoLaterThan=7]="FinishNoLaterThan";e.prototype.isValidateNonWorkDays=function(e){return!ae.isNullOrUndefined(e)&&e.isAutoSchedule&&(!this.parent.includeWeekend||0<e.calendarContext.defaultHolidays.length)||ae.isNullOrUndefined(e)&&(!this.parent.includeWeekend||0<this.parent.defaultCalendarContext.defaultHolidays.length)},e.prototype.checkStartDate=function(e,t,i,n,a,r){if(ae.isNullOrUndefined(e))return null;var s,o=new Date(e.getTime()),l=this.parent.getCurrentDayStartTime(o),d=this.parent.getCurrentDayEndTime(o),h=new Date(e.getTime()),p=this.getSecondsInDecimal(h);if(i=ae.isNullOrUndefined(i)?!ae.isNullOrUndefined(t)&&t.isMilestone:i,p<l&&(!i||n))this.setTime(l,h);else if(p<l&&i)this.setTime(l,h);else if(p===d&&(!t||!i)||d<p)h.setDate(h.getDate()+1),l=this.parent.getCurrentDayStartTime(h),this.setTime(l,h);else if(l<p&&p<d){var u=this.parent.workingTimeRanges;0<this.parent.weekWorkingTime.length&&(u=this.parent.getWorkingRange(h));for(var c=0;c<u.length;c++){var g=u[c];if(p>=g.to&&u[c+1]&&p<u[c+1].from){(p!==g.to||t&&i)&&p===g.to||this.setTime(u[c+1].from,h);break}}}if(!(!this.parent.autoCalculateDateScheduling||r||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping))do{s=new Date(h.getTime()),t&&!t.calendarContext&&(t.calendarContext=this.parent.defaultCalendarContext);var f=t?t.calendarContext:this.parent.defaultCalendarContext,m=f.defaultHolidays.length;if(this.isValidateNonWorkDays(t)){l=this.parent.getCurrentDayStartTime(s),t&&(d=a?this.parent.getCurrentDayEndTime(t.baselineEndDate||s):this.parent.getCurrentDayEndTime(t.endDate?t.isAutoSchedule?t.endDate:t.autoEndDate:s));var y,D=!i||n?l:d;if(this.parent.includeWeekend||a||(y=new Date(h.getTime()),h=this.getNextWorkingDay(h,f),D=this.parent.getCurrentDayStartTime(h),y.getTime()===h.getTime())||i||this.setTime(D,h),!a)for(var k=0;k<m;k++){var T=this.getDateFromFormat(new Date(f.defaultHolidays[k])),b=new Date(T.getTime());T.setHours(0,0,0,0),b.setHours(23,59,59,59),h.getTime()>=T.getTime()&&h.getTime()<b.getTime()&&(h.setDate(h.getDate()+1),D=this.parent.getCurrentDayStartTime(h),this.setTime(D,h))}}}while(s.getTime()!==h.getTime());return new Date(h.getTime())},e.prototype.getAdjustedStartDate=function(e,t){e=new Date(e),e.setDate(e.getDate()+1),e=this.parent.dateValidationModule.checkEndDate(e);return this.parent.dateValidationModule.getStartDate(e,t.duration,t.durationUnit,t)},e.prototype.getDateByConstraint=function(e,t,i){var n=e.ganttProperties||e,a=new Date(n.constraintDate),r=this.parent.isLoad;if((i=ae.isNullOrUndefined(i)?!0:i)&&(!a||!t))return null;switch(a=this.parent.editModule&&this.parent.editModule.dialogModule&&this.parent.editModule.dialogModule.dialogConstraintDate?new Date(this.parent.editModule.dialogModule.dialogConstraintDate):this.parent.assignTimeToDate(a,this.parent.getCurrentDayStartTime(a)),n.constraintType){case k.ConstraintType.AsSoonAsPossible:return r?t:(o=n.constraintDate=null,(l=this.parent.getRecordByID(n.taskId))&&l.parentItem&&(o=l.parentItem),n.predecessor&&0<n.predecessor.length?this.parent.assignTimeToDate(t,this.parent.getCurrentDayStartTime(t)):this.updateSoonAsPossibleParent(o));case k.ConstraintType.AsLateAsPossible:return r?t:(l=(o=this.parent.getRecordByID(n.taskId))&&o.parentItem?this.parent.dateValidationModule.checkEndDate(this.parent.getRecordByID(o.parentItem.taskId).ganttProperties.endDate):this.parent.dateValidationModule.checkEndDate(new Date(this.parent.projectEndDate)),this.parent.dateValidationModule.getStartDate(l,n.duration,n.durationUnit,n));case k.ConstraintType.MustStartOn:var s=a.getTime()!==n.startDate.getTime(),o=void 0,l=(this.parent.editModule&&this.parent.editModule.dialogModule&&(o=this.parent.editModule.dialogModule.dialogConstraintValue),ae.isNullOrUndefined(o)||2===o||3===o);return s&&!r&&l&&(this.parent.constraintViolationType="MustStartOn"),o=null,r?this.parent.dateValidationModule.checkStartDate(new Date(a)):this.parent.assignTimeToDate(t,this.parent.getCurrentDayStartTime(t));case k.ConstraintType.MustFinishOn:return(s=a.getTime()!==n.endDate.getTime())&&!r&&(this.parent.constraintViolationType="MustFinishOn"),this.getAdjustedStartDate(a,n);case k.ConstraintType.StartNoEarlierThan:return a.getTime()<t.getTime()||!r?this.parent.assignTimeToDate(t,this.parent.getCurrentDayStartTime(t)):this.parent.dateValidationModule.checkStartDate(new Date(a));case k.ConstraintType.StartNoLaterThan:return((s=a.getTime()<t.getTime())&&!r&&(this.parent.constraintViolationType="StartNoLaterThan"),r)?r&&s?this.parent.dateValidationModule.checkStartDate(new Date(a)):t:(l=this.parent.editModule&&this.parent.editModule.cellEditModule,o=this.parent.taskFields&&this.parent.taskFields.constraintDate,l&&l.isCellEdit&&l.editedColumn&&s&&l.editedColumn.field===o||this.parent.editModule&&this.parent.editModule.dialogModule&&s&&this.parent.editModule.dialogModule.dialogConstraintDate?a:this.parent.assignTimeToDate(t,this.parent.getCurrentDayStartTime(t)));case k.ConstraintType.FinishNoEarlierThan:return(d=this.getEndDate(t,n.duration,n.durationUnit,n,!1,!1)).getTime()<a.getTime()?this.getAdjustedStartDate(a,n):t;case k.ConstraintType.FinishNoLaterThan:var d=this.getEndDate(t,n.duration,n.durationUnit,n,!1,!1);return((s=a.getTime()<d.getTime())&&!r&&(this.parent.constraintViolationType="FinishNoLaterThan"),r)?s?this.getAdjustedStartDate(a,n):t:s?this.getAdjustedStartDate(a,n):this.parent.assignTimeToDate(t,this.parent.getCurrentDayEndTime(t));default:return t}},e.prototype.updateSoonAsPossibleParent=function(e){return e?this.parent.getRecordByID(e.taskId).ganttProperties.startDate:this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate))},e.prototype.checkEndDate=function(e,t,i,n,a){if(ae.isNullOrUndefined(e))return null;t&&!t.calendarContext&&(t.calendarContext=this.parent.defaultCalendarContext);var r,s=t?t.calendarContext:this.parent.defaultCalendarContext,o=(u=0<this.parent.weekWorkingTime.length?(d=new Date(e.getTime()),(!this.parent.includeWeekend&&t&&t.isAutoSchedule||this.parent.editModule&&this.parent.editModule.taskbarEditModule&&this.parent.editModule.taskbarEditModule.taskBarEditRecord&&!this.parent.editModule.taskbarEditModule.taskBarEditRecord.ganttProperties.isAutoSchedule)&&(d=this.getNextWorkingDay(d,s)),r=this.parent.getStartTime(d),this.parent.getEndTime(d)):(r=this.parent.defaultStartTime,this.parent.defaultEndTime),new Date(e.getTime())),l=this.getSecondsInDecimal(o);if(u<l)this.setTime(u,o);else if(l<=r&&86400!==u&&!i){var d=this.parent.taskFields;this.parent.editModule&&this.parent.editModule.editedRecord&&!this.parent.editModule.editedRecord[d.startDate]&&this.parent.editModule.editedRecord[d.endDate]?o.setDate(o.getDate()):o.setDate(o.getDate()-1),u=this.parent.getCurrentDayEndTime(o),this.setTime(u,o)}else if(r<l&&l<u)for(var h=0;h<this.parent.workingTimeRanges.length;h++)if(l>this.parent.workingTimeRanges[h].to&&this.parent.workingTimeRanges[h+1]&&l<=this.parent.workingTimeRanges[h+1].from){this.setTime(this.parent.workingTimeRanges[h].to,o);break}if(!this.parent.autoCalculateDateScheduling||a||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)ae.isNullOrUndefined(o)||86400===this.parent.defaultEndTime||(u=this.parent.getCurrentDayEndTime(e),this.setTime(u,o));else do{var p,u,c=new Date(o.getTime()),g=s.defaultHolidays.length;if(this.isValidateNonWorkDays(t)&&!n){this.parent.includeWeekend||(p=new Date(o.getTime()),o=this.getPreviousWorkingDay(o,s),u=this.parent.getCurrentDayEndTime(o),p.getTime()!==o.getTime()&&this.setTime(u,o));for(var f=0;f<g;f++){var m=this.getDateFromFormat(new Date(s.defaultHolidays[f])),y=new Date(m.getTime()),D=new Date(o.getTime());D.setMinutes(o.getMilliseconds()-2),m.setHours(0,0,0,0),y.setHours(23,59,59,59),(o.getTime()>=m.getTime()&&o.getTime()<y.getTime()||D.getTime()>=m.getTime()&&D.getTime()<y.getTime())&&(o.setDate(o.getDate()-1),u=this.parent.getCurrentDayEndTime(o),o.getTime()===m.getTime()&&86400===u&&0===this.getSecondsInDecimal(o)||this.setTime(u,o))}}}while(c.getTime()!==o.getTime());return new Date(o.getTime())},e.prototype.checkBaselineStartDate=function(e,t){if(ae.isNullOrUndefined(e))return null;var i=this.parent.getCurrentDayStartTime(e),t=this.parent.getCurrentDayEndTime(t&&t.endDate?t.isAutoSchedule?t.endDate:t.autoEndDate:e),n=new Date(e.getTime()),a=this.getSecondsInDecimal(n);if(a<i)this.setTime(i,n);else if(t<a)n.setDate(n.getDate()+1),i=0<this.parent.weekWorkingTime.length?this.parent.getStartTime(n):this.parent.defaultStartTime,this.setTime(i,n);else if(i<a&&a<t)for(var r=0;r<this.parent.workingTimeRanges.length;r++)if(a>this.parent.workingTimeRanges[r].to&&this.parent.workingTimeRanges[r+1]&&a<this.parent.workingTimeRanges[r+1].from){this.setTime(this.parent.workingTimeRanges[r+1].from,n);break}return n},e.prototype.checkBaselineEndDate=function(e,t){if(ae.isNullOrUndefined(e))return null;var i=this.parent.getCurrentDayEndTime(e),n=this.parent.getCurrentDayStartTime(t&&t.startDate?t.isAutoSchedule?t.startDate:t.autoStartDate:e),a=new Date(e.getTime()),r=this.getSecondsInDecimal(a);if(i<r)this.setTime(i,a);else if(r<n&&!ae.isNullOrUndefined(t)&&!t.isMilestone)a.setDate(a.getDate()-1),i=this.parent.getCurrentDayEndTime(a),this.setTime(i,a);else if(n<r&&r<i)for(var s=0;s<this.parent.workingTimeRanges.length;s++)if(r>this.parent.workingTimeRanges[s].to&&this.parent.workingTimeRanges[s+1]&&r<=this.parent.workingTimeRanges[s+1].from){this.setTime(this.parent.workingTimeRanges[s].to,a);break}return t&&t.baselineStartDate&&a&&t.baselineStartDate.getTime()>a.getTime()&&a.setDate(a.getDate()+1),a},e.prototype.calculateStartDate=function(e,t){var i=e.ganttProperties,n=null;t?(ae.isNullOrUndefined(i.baselineEndDate)||ae.isNullOrUndefined(i.baselineDuration)||(n=this.getStartDate(i.baselineEndDate,i.baselineDuration,i.durationUnit,i,void 0,!0)),this.parent.setRecordValue("baselineStartDate",n,i,!0),this.parent.taskFields.baselineStartDate&&this.parent.dataOperation.updateMappingData(e,"baselineStartDate")):(ae.isNullOrUndefined(i.endDate)||ae.isNullOrUndefined(i.duration)||(n=this.getStartDate(i.endDate,i.duration,i.durationUnit,i)),this.parent.setRecordValue("startDate",n,i,!0),this.parent.taskFields.startDate&&this.parent.dataOperation.updateMappingData(e,"startDate"))},e.prototype.getFieldMappings=function(e){return{startdateField:e?"baselineStartDate":"startDate",enddateField:e?"baselineEndDate":"endDate",durationField:e?"baselineDuration":"duration"}},e.prototype.calculateEndDate=function(e,t){var i,n,a=e.ganttProperties,r=null,s=this.getFieldMappings(t),o=s.startdateField,l=s.enddateField,s=s.durationField;ae.isNullOrUndefined(a[o])?(r=e[this.parent.taskFields[l]],ae.isNullOrUndefined(r)||(n=this.parent.getCurrentDayEndTime(r),this.setTime(n,r))):(!ae.isNullOrUndefined(a[l])&&ae.isNullOrUndefined(a[s])&&(1===this.compareDates(a[o],a[l])&&(this.parent.setRecordValue(o,new Date(a[l].getTime()),a,!0),i=this.parent.getCurrentDayStartTime(a.isAutoSchedule&&!t?a.autoStartDate:a[o]),n=this.parent.getCurrentDayEndTime(a.isAutoSchedule&&!t?a.autoEndDate:a[l]),this.setTime(i,a[o])),this.calculateDuration(e,t)),ae.isNullOrUndefined(a[s])||(n=!t&&!ae.isNullOrUndefined(a.segments)&&1<a.segments.length?this.totalDuration(a.segments):a[s],r=this.getEndDate(a[o],n,a.durationUnit,a,!1,t,e))),this.parent.setRecordValue(l,r,a,!0),this.parent.taskFields[l]&&this.parent.dataOperation.updateMappingData(e,l)},e.prototype.totalDuration=function(e){var t,i=0;ae.isNullOrUndefined(this.parent.timelineSettings.bottomTier)||(t=this.parent.timelineSettings.bottomTier.unit);for(var n=0;n<e.length;n++){var a=e[n].offsetDuration;"Hour"===t?a/=24:"Minutes"===t&&(a/=1440),i+=e[n].duration+a}return i=Math.ceil(i)},e.prototype.calculateDuration=function(e,t){var i,n,a,r=e.ganttProperties,s=r.calendarContext,o=(i=!t&&!ae.isNullOrUndefined(r.segments)&&0<r.segments.length&&!ae.isNullOrUndefined(this.parent.editModule.taskbarEditModule)?this.parent.editModule.taskbarEditModule.sumOfDuration(r.segments):t||ae.isNullOrUndefined(this.parent.taskFields.milestone)||ae.isNullOrUndefined(r.startDate)||ae.isNullOrUndefined(r.endDate)||r.startDate.getTime()!==r.endDate.getTime()||!1!==e.taskData[this.parent.taskFields.milestone]?(i=t?r.baselineStartDate:r.startDate,o=t?r.baselineEndDate:r.endDate,l=r.durationUnit,n=!t&&r.isAutoSchedule,a=!t&&r.isMilestone,this.getDuration(i,o,l,n,a,void 0,s)):1,t?"baselineDuration":"duration"),l=(this.parent.setRecordValue(o,i,r,!0),t?this.parent.columnByField[this.parent.columnMapping.baselineDuration]:this.parent.columnByField[this.parent.columnMapping.duration]);ae.isNullOrUndefined(this.parent.editModule)||ae.isNullOrUndefined(this.parent.editModule.cellEditModule)||this.parent.editModule.cellEditModule.isCellEdit||ae.isNullOrUndefined(l)||(ae.isNullOrUndefined(l.edit)||ae.isNullOrUndefined(l.edit.read)||(n=this.parent.editModule.dialogModule.dialog,ae.isNullOrUndefined(n))||(a=t?n.querySelector("#"+this.parent.element.id+"BaselineDuration"):n.querySelector("#"+this.parent.element.id+"Duration"),ae.isNullOrUndefined(a))||(s=a.ej2_instances[0],ae.isNullOrUndefined(s))||s.value===i.toString()||(s.value=i.toString(),s.dataBind()),(this.parent.taskFields.duration||this.parent.taskFields.baselineDuration)&&(this.parent.dataOperation.updateMappingData(e,o),this.parent.taskFields.durationUnit)&&this.parent.dataOperation.updateMappingData(e,"durationUnit"))},e.prototype.getNonworkingTime=function(e,t,i,n,a,r,s){var o=this.parent;n=!!ae.isNullOrUndefined(n)||n;var l=!r&&!o.includeWeekend&&o.autoCalculateDateScheduling&&!(o.isLoad&&o.treeGrid.loadChildOnDemand&&o.taskFields.hasChildMapping)&&i&&!s?this.getWeekendCount(e,t,a):0,n=this.getNumberOfSeconds(e,t,n),d=i&&o.autoCalculateDateScheduling&&!(o.isLoad&&o.treeGrid.loadChildOnDemand&&o.taskFields.hasChildMapping)&&!r&&!s?this.getHolidaysCount(e,t,a):0,n=(n-86400*l-86400*d)/86400,r=this.getNonWorkingSecondsOnDate(e,t,i,r,a,s);return(0<o.weekWorkingTime.length?this.nonWorkingSeconds(e,t,i,n,a,!1,s):n*(86400-o.secondsPerDay))+86400*l+86400*d+r},e.prototype.nonWorkingSeconds=function(e,t,i,n,a,r,s){var o=e.getTime()>t.getTime()?new Date(t.getTime()):new Date(e.getTime()),l=e.getTime()>t.getTime()?new Date(e.getTime()):new Date(t.getTime()),d=0,h=0;if(r?(e=this.parent.getCurrentDayStartTime(o),t=this.parent.getCurrentDayEndTime(o),o.getHours()<t/3600&&o.getHours()>=e/3600||o.setDate(o.getDate()+1)):(o.setDate(o.getDate()+1),o.setHours(0,0,0,0),l.setHours(0,0,0,0)),!(0<n||ae.isNullOrUndefined(n)))return 0;for(;r&&o.getTime()<=l.getTime()||!r&&o.getTime()<l.getTime();){if(i&&!s){if(this.isOnHolidayOrWeekEnd(o,!0,a))for(;o.setDate(o.getDate()+1),this.isOnHolidayOrWeekEnd(o,!0,a););this.parent.includeWeekend||this.getNextWorkingDay(o,a)}if(o.getTime()<=l.getTime()){h++;var p=this.parent.getSecondsPerDay(o);if(d+=r?p:86400-p,o.setDate(o.getDate()+1),i&&!s){if(this.isOnHolidayOrWeekEnd(o,!0,a))for(;o.setDate(o.getDate()+1),this.isOnHolidayOrWeekEnd(o,!0,a););this.parent.includeWeekend||this.getNextWorkingDay(o,a)}}}return r&&(0<d?d/=h:d=this.parent.secondsPerDay),d},e.prototype.getDuration=function(e,t,i,n,a,r,s){if(void 0===r&&(r=!0),!e||!t)return null;var o=0,l=this.parent.getFormatedDate(e)===this.parent.getFormatedDate(t);if(0<this.parent.weekWorkingTime.length){for(var d=new Date(e),h=this.nonWorkingSeconds(e,t,n,void 0,s,!0),p=0;d<=t;){var u=this.parent.getFormatedDate(d),c=this.parent.getSecondsPerDay(d),g=new Date(d),f=new Date(d),u=(g.setHours(0,0,0,0),f.setHours(0,0,0,0),g.setSeconds(this.parent.getCurrentDayStartTime(d)),f.setSeconds(this.parent.getCurrentDayEndTime(d)),u===this.parent.getFormatedDate(e)&&g.setTime(e.getTime()),u===this.parent.getFormatedDate(t)&&f.setTime(t.getTime()),this.getTimeDifference(g,f,r)/1e3),g=this.getNonworkingTime(g,f,n,r,s);p+=Math.max(0,u-g)/c,d.setDate(d.getDate()+1)}a&&l||(o=this.calculateDurationValue(i,p,h))}else{h=this.parent.secondsPerDay;var m=this.getTimeDifference(e,t,r)/1e3,y=this.getNonworkingTime(e,t,n,r,s);l&&a||(o=this.calculateDurationValue(i,(m-y)/h,h))}return parseFloat(o.toString())},e.prototype.calculateDurationValue=function(e,t,i){return e&&"day"!==e?"minute"===e?t*(i/60):t*(i/3600):t},e.prototype.getDurationAsSeconds=function(e,t,i){i=0<this.parent.weekWorkingTime.length?this.parent.getSecondsPerDay(i):this.parent.secondsPerDay;return t&&"day"!==t.toLocaleLowerCase()?"hour"===t.toLocaleLowerCase()?3600*e:60*e:i*e},e.prototype.getEndDate=function(e,t,i,n,a,r,s){var o,l=new Date(e.getTime()),l=(n.calendarContext||(n.calendarContext=this.parent.defaultCalendarContext),o=0<this.parent.weekWorkingTime.length&&(!i||"day"===i.toLocaleLowerCase())?this.calculateSecondDuration(t,l,o,e,!0,n.calendarContext):this.getDurationAsSeconds(t,i,e),this.calculateEndDateFromDuration(e,o,n,a,n.calendarContext,r,!1));return this.parent.autoCalculateDateScheduling&&this.parent.isLoad&&!ae.isNullOrUndefined(s)&&ae.isNullOrUndefined(s[this.parent.taskFields.endDate])&&!ae.isNullOrUndefined(s[this.parent.taskFields.startDate])&&!s.hasChildRecords&&(e=this.getDateFromFormat(s[this.parent.taskFields.startDate]),this.parent.dataOperation.resolveAndApplyWorkingTimes(e),o=this.checkStartDate(e,n,a,this.parent.isLoad,!1,!0),r=this.getDurationAsSeconds(t,i,e),t=this.calculateEndDateFromDuration(o,r,n,a,n.calendarContext,!1,n.isAutoSchedule),l.getTime()===t.getTime()&&e.getTime()===o.getTime()||this.parent.dataOperation.validatedGanttData.set(s.ganttProperties.taskId,s)),l},e.prototype.calculateEndDateFromDuration=function(e,t,i,n,a,r,s){for(var o=new Date(e.getTime()),l=new Date(e.getTime()),d=t;0<d;)l.setSeconds(l.getSeconds()+d),0<(d-=d-this.getNonworkingTime(o,l,i.isAutoSchedule,!0,a,r,s))&&(l=this.checkStartDate(l,i,n,void 0,r,s)),o=new Date(l.getTime());return l},e.prototype.getStartDate=function(e,t,i,n,a,r){var s,o=new Date(e.getTime()),l=new Date(e.getTime()),e=new Date(o.getTime());for(n.calendarContext||(n.calendarContext=this.parent.defaultCalendarContext),s=0<this.parent.weekWorkingTime.length?this.calculateSecondDuration(t,e,s,o,!1,n.calendarContext):this.getDurationAsSeconds(t,i,o);0<s;)l.setSeconds(l.getSeconds()-s),0<(s-=s-this.getNonworkingTime(l,o,n.isAutoSchedule,!0,n.calendarContext,r))&&(o=this.checkEndDate(l,n,r)),o=new Date(l.getTime());return a&&n.isMilestone&&(l.setDate(l.getDate()-1),e=this.parent.getCurrentDayEndTime(n.endDate?n.isAutoSchedule?n.endDate:n.autoEndDate:l),this.parent.dateValidationModule.setTime(e,l),l=this.parent.dateValidationModule.checkStartDate(l,n,!0)),l},e.prototype.calculateSecondDuration=function(e,t,i,n,a,r){if(e<1)i=this.parent.getSecondsPerDay(t)*e;else{i=0;var s=e,o=this.parent.getCurrentDayStartTime(t),l=this.parent.getCurrentDayEndTime(t);for(t.getHours()<l/3600&&t.getHours()>o/3600||!this.fromSegments||(a?t.setDate(t.getDate()+1):t.setDate(t.getDate()-1));0<s;){if(this.isOnHolidayOrWeekEnd(t,!0,r))for(;a?t.setDate(t.getDate()+1):t.setDate(t.getDate()-1),this.isOnHolidayOrWeekEnd(t,!0,r););this.parent.includeWeekend||(t=a?this.getNextWorkingDay(t,r):this.getPreviousWorkingDay(t,r));var d,h=this.parent.getSecondsPerDay(t),p=0;this.getSecondsInDecimal(n)===this.parent.getStartTime(n)||Number.isInteger(s)||(d=e.toString().split("."),h*=p=parseFloat("."+d[1]),s-=p),s<1&&(h*=s),i+=h,a?t.setDate(t.getDate()+1):t.setDate(t.getDate()-1),p||s--}}return i},e.prototype.getProjectStartDate=function(e,t){if(!ae.isNullOrUndefined(this.parent.cloneProjectStartDate))return"string"==typeof this.parent.cloneProjectStartDate&&(this.parent.cloneProjectStartDate=this.getDateFromFormat(this.parent.cloneProjectStartDate)),s=this.checkStartDate(this.parent.cloneProjectStartDate),this.parent.cloneProjectStartDate=s,new Date(s.getTime());if(ae.isNullOrUndefined(this.parent.projectStartDate)){if(ae.isNullOrUndefined(t))return null;var i=this.parent.flatData,n=void 0;0<i.length?n=i[0].ganttProperties.startDate:(n=new Date).setHours(0,0,0,0);for(var a=1;a<i.length;a++){var r=i[a].ganttProperties.startDate;ae.isNullOrUndefined(r)||-1!==this.compareDates(r,n)||(n=r)}this.parent.cloneProjectStartDate=this.checkStartDate(n,e)}else{var s=this.getDateFromFormat(this.parent.projectStartDate);this.parent.cloneProjectStartDate=this.checkStartDate(s)}return new Date(this.parent.cloneProjectStartDate.getTime())},e.prototype.getValidStartDate=function(e,t,i){var n=null,a=i?e.baselineStartDate:t?e.autoStartDate:e.startDate,i=i?e.baselineEndDate:t?e.autoEndDate:e.endDate,t=!e.isAutoSchedule&&e.autoDuration?e.autoDuration:e.duration;if(ae.isNullOrUndefined(a))if(ae.isNullOrUndefined(i)){if(!ae.isNullOrUndefined(t)){t=this.parent.getTaskByUniqueID(e.uniqueID);if(this.parent.allowUnscheduledTasks&&t&&t.parentItem&&ae.isNullOrUndefined(a)&&ae.isNullOrUndefined(i)){for(var r=this.parent.getParentTask(t.parentItem);r&&!r.ganttProperties.startDate;)r=this.parent.getParentTask(r.parentItem);n=r&&r.ganttProperties.startDate?r.ganttProperties.startDate:this.parent.cloneProjectStartDate}else n=this.getProjectStartDate(e)}}else{n=new Date(i.getTime()),t=this.parent.getCurrentDayStartTime(n);this.setTime(t,n)}else n=new Date(a.getTime());return n},e.prototype.getValidEndDate=function(e,t,i){var n,a=null,r=i?e.baselineStartDate:t?e.autoStartDate:e.startDate,i=i?e.baselineEndDate:t?e.autoEndDate:e.endDate,t=t?e.autoDuration:e.duration;return ae.isNullOrUndefined(i)?ae.isNullOrUndefined(r)?ae.isNullOrUndefined(t)||(n=this.getValidStartDate(e))&&(a=this.getEndDate(n,t,e.durationUnit,e,!1)):e.isMilestone?a=this.checkStartDate(r):(a=new Date(r.getTime()),n=this.parent.getCurrentDayEndTime(i||a),this.setTime(n,a)):a=new Date(i.getTime()),a},e.prototype.getWorkingTime=function(e,t,i,n,a,r,s,o){var l;return ae.isNullOrUndefined(t.from)||ae.isNullOrUndefined(t.to)||(i.setHours(0,0,0,0),l=new Date(i.getTime()),i.setTime(i.getTime()+36e5*t.from),i=new Date(i.getTime()),24===t.to?l.setTime(l.getTime()+864e5):l.setTime(l.getTime()+36e5*t.to),l=(t=new Date(l.getTime())).getTime()-i.getTime(),i=this.getSecondsInDecimal(i),0===(t=this.getSecondsInDecimal(t))&&(t=86400),n+=l/1e3,0===a&&(this.parent.defaultStartTime=i,0<this.parent.weekWorkingTime.length)&&this.assignStartTime(e,i),a!==this[e.toLowerCase()+"TimeRangeLength"]-1&&""!==e||(this.parent.defaultEndTime=t,0<this.parent.weekWorkingTime.length&&this.assignEndTime(e,t)),0<a?""===e?(r.push(r[r.length-1]+i-s[a-1].to),s[a-1].to<i&&o.push({from:s[a-1].to,to:i,isWorking:!1,interval:i-s[a-1].to})):(this.parent[e.toLowerCase()+"NonWorkingHours"].push(this.parent[e.toLowerCase()+"NonWorkingHours"][this.parent[e.toLowerCase()+"NonWorkingHours"].length-1]+i-this.parent[e.toLowerCase()+"NonWorkingTimeRanges"][a-1].to),this.parent[e.toLowerCase()+"WorkingTimeRanges"][a-1].to<i&&this.parent[e.toLowerCase()+"NonWorkingTimeRanges"].push({from:this.parent[e.toLowerCase()+"WorkingTimeRanges"][a-1].to,to:i,isWorking:!1,interval:i-this.parent[e.toLowerCase()+"WorkingTimeRanges"][a-1].to})):(""===e?(r.push(0),o):(this.parent[e.toLowerCase()+"NonWorkingHours"].push(0),this.parent[e.toLowerCase()+"NonWorkingTimeRanges"])).push({from:0,to:i,isWorking:!1,interval:i}),(""===e?(s.push({from:i,to:t}),o):(this.parent[e.toLowerCase()+"WorkingTimeRanges"].push({from:i,to:t}),this.parent[e.toLowerCase()+"NonWorkingTimeRanges"])).push({from:i,to:t,isWorking:!0,interval:t-i})),n},e.prototype.assignStartTime=function(e,t){switch(e){case"Monday":this.parent.mondayDefaultStartTime=t;break;case"Tuesday":this.parent.tuesdayDefaultStartTime=t;break;case"Wednesday":this.parent.wednesdayDefaultStartTime=t;break;case"Thursday":this.parent.thursdayDefaultStartTime=t;break;case"Friday":this.parent.fridayDefaultStartTime=t;break;case"Saturday":this.parent.saturdayDefaultStartTime=t;break;case"Sunday":this.parent.sundayDefaultStartTime=t}},e.prototype.assignEndTime=function(e,t){switch(e){case"Monday":this.parent.mondayDefaultEndTime=t;break;case"Tuesday":this.parent.tuesdayDefaultEndTime=t;break;case"Wednesday":this.parent.wednesdayDefaultEndTime=t;break;case"Thursday":this.parent.thursdayDefaultEndTime=t;break;case"Friday":this.parent.fridayDefaultEndTime=t;break;case"Saturday":this.parent.saturdayDefaultEndTime=t;break;case"Sunday":this.parent.sundayDefaultEndTime=t}},e.prototype.calculateWeekWorkTime=function(e,t,i,n,a,r,s){for(var o=0,l=0;l<t.length;l++){var d=t[l];o+=this.getWorkingTime(e,d,i,n,l,a,r,s)}return this.parent[e.toLowerCase()+"DefaultStartTime"]/3600!=24&&this.parent[e.toLowerCase()+"NonWorkingTimeRanges"].push({from:this.parent[e.toLowerCase()+"DefaultEndTime"],to:86400,isWorking:!1,interval:86400-this.parent[e.toLowerCase()+"DefaultEndTime"]}),o},e.prototype.getSecondsPerDay=function(){for(var e=0,t=new Date("10/11/2018"),i=(this.parent.nonWorkingHours=[],this.parent.nonWorkingHours),n=(this.parent.workingTimeRanges=[],this.parent.workingTimeRanges),a=(this.parent.nonWorkingTimeRanges=[],this.parent.nonWorkingTimeRanges),r=this.parent.calendarModule.workingTime,s=0,o=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];s<o.length;s++)this[(f=o[s]).toLowerCase()+"TimeRangeLength"]=r.length;if(0<this.parent.weekWorkingTime.length){for(var l=0;l<this.parent.weekWorkingTime.length;l++)this[this.parent.weekWorkingTime[l].dayOfWeek.toLowerCase()+"TimeRangeLength"]=this.parent.weekWorkingTime[l].timeRange.length;for(var d=0,h=this.parent.weekWorkingTime;d<h.length;d++){var p,u=h[d];u.timeRange&&0<u.timeRange.length&&(this.parent[u.dayOfWeek.toLowerCase()+"NonWorkingHours"]=[],this.parent[u.dayOfWeek.toLowerCase()+"NonWorkingTimeRanges"]=[],this.parent[u.dayOfWeek.toLowerCase()+"WorkingTimeRanges"]=[],p=this.calculateWeekWorkTime(u.dayOfWeek,u.timeRange,t,e,i,n,a),this.parent[u.dayOfWeek.toLowerCase()+"Seconds"]=p)}for(var c=0,g=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];c<g.length;c++){var f=g[c],m=this.parent[f.toLowerCase()+"DefaultStartTime"];ae.isNullOrUndefined(m)&&(m=this.calculateWeekWorkTime(f,r,t,e,i,n,a),this.parent[f.toLowerCase()+"Seconds"]=m)}}for(var y=r.length,D=0,k=0;k<y;k++){var T=r[k];D+=this.getWorkingTime("",T,t,e,k,i,n,a)}return this.parent.defaultEndTime/3600!=24&&a.push({from:this.parent.defaultEndTime,to:86400,isWorking:!1,interval:86400-this.parent.defaultEndTime}),e=D},e.prototype.getDurationValue=function(e){var t,i=null,n=null;return"string"==typeof e?(t=e.match(/(\d*\.*\d+|.+$)/g))&&t.length<=2&&(n=parseFloat(t[0].toString().trim()),t=t[1]?t[1].toString().trim().toLowerCase():null,-1!==ae.getValue("minute",this.parent.durationUnitEditText).indexOf(t)?i="minute":-1!==ae.getValue("hour",this.parent.durationUnitEditText).indexOf(t)?i="hour":-1!==ae.getValue("day",this.parent.durationUnitEditText).indexOf(t)&&(i="day")):(n=e,i=null),{duration:n,durationUnit:i}},e.prototype.getNextWorkingDay=function(e,t){if(t&&t.getExceptionForDate(e))return e;var i=e.getDay();return this.parent.includeWeekend||-1===this.parent.nonWorkingDayIndex.indexOf(i)?e:(e.setDate(e.getDate()+1),this.getNextWorkingDay(e,t))},e.prototype.getWeekendCount=function(e,t,i){var n=0,a=new Date(e.getTime()),r=new Date(t.getTime());for(a.setHours(0,0,0,0),a.setDate(a.getDate()+1),r.setHours(0,0,0,0);a.getTime()<r.getTime();)-1===this.parent.nonWorkingDayIndex.indexOf(a.getDay())||i.getExceptionForDate(a)||(n+=1),a.setDate(a.getDate()+1);return n},e.prototype.getNumberOfSeconds=function(e,t,i){var e=new Date(e.getTime()),t=new Date(t.getTime()),n=0;return e.setDate(e.getDate()+1),e.setHours(0,0,0,0),t.setHours(0,0,0,0),n=(n=e.getTime()<t.getTime()?this.getTimeDifference(e,t,i)/1e3:n)%86400!=0?n-n%86400+86400:n},e.prototype.getHolidaysCount=function(e,t,i){var n=0,a=i.sortedDefaultHolidays;if(!a||0===a.length)return 0;e=new Date(e.getTime()),t=new Date(t.getTime());if(e.setDate(e.getDate()+1),e.setHours(0,0,0,0),t.setHours(0,0,0,0),e.getTime()<t.getTime()&&0<a.length)for(var e=e.getTime(),t=t.getTime(),e=this.getBinaryBound(a,e),r=this.getBinaryBound(a,t),s=e;s<r;s++){var o=a[s],o=this.getDateFromFormat(new Date(o));i.getExceptionForDate(o)||(!this.parent.includeWeekend&&-1===this.parent.nonWorkingDayIndex.indexOf(o.getDay())||this.parent.includeWeekend)&&(n+=1)}return n},e.prototype.getHolidayDates=function(e){"holidays"===e?this.parent.calendarModule.holidays=this.parent.holidays:"calendarSettings"===e&&(this.parent.calendarModule.holidays=this.parent.calendarSettings.projectCalendar.holidays);for(var t=this.parent.calendarModule.holidays,i=[],n=0;n<t.length;n++){var a=this.getDateFromFormat(t[n].from),r=this.getDateFromFormat(t[n].to);if(!ae.isNullOrUndefined(a)||!ae.isNullOrUndefined(r))if(ae.isNullOrUndefined(a)||ae.isNullOrUndefined(r)){var s=a||r;s.setHours(0,0,0,0),-1===i.indexOf(s.getTime())&&i.push(s.getTime())}else for(;a<=r;)a.setHours(0,0,0,0),-1===i.indexOf(a.getTime())&&i.push(a.getTime()),a.setDate(a.getDate()+1)}return i},e.prototype.isOnHolidayOrWeekEnd=function(e,t,i){var n=this.parent;if(t=ae.isNullOrUndefined(t)?n.includeWeekend:t,n.autoCalculateDateScheduling||n.isLoad&&n.treeGrid.loadChildOnDemand&&n.taskFields.hasChildMapping||(t=!0),!i.getExceptionForDate(e)){if(!t&&-1!==this.parent.nonWorkingDayIndex.indexOf(e.getDay()))return!0;var a=i.sortedDefaultHolidays;if(a&&0!==a.length)for(var r=new Date(e.getTime()).setHours(0,0,0,0),s=0,o=a.length-1;s<=o;){var l=Math.floor((s+o)/2),d=a[l];if(d===r)return!0;d<r?s=l+1:o=l-1}}return!1},e.prototype.getNonWorkingSecondsOnDate=function(e,t,i,n,a,r){var s=this.getSecondsInDecimal(e),o=this.getSecondsInDecimal(t),l=-1,d=-1,h=0,p=!(!i||!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||n)&&this.isOnHolidayOrWeekEnd(e,null,a),i=!(!i||!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||n)&&this.isOnHolidayOrWeekEnd(t,null,a);if(0<this.parent.weekWorkingTime.length){for(var u=this.parent.getNonWorkingRange(e),c=0;c<u.length;c++)s>=(f=u[c]).from&&s<=f.to&&(l=c);for(var g=this.parent.getNonWorkingRange(t),c=0;c<g.length;c++)o>=(f=g[c]).from&&o<=f.to&&(d=c)}else{u=this.parent.nonWorkingTimeRanges,g=this.parent.nonWorkingTimeRanges;for(var f,c=0;c<u.length;c++)s>=(f=u[c]).from&&s<=f.to&&(l=c),o>=f.from&&o<=f.to&&(d=c)}if(e.getDate()!==t.getDate()||e.getMonth()!==t.getMonth()||e.getFullYear()!==t.getFullYear()){if(!p||r)for(c=l;c<u.length;c++)ae.isNullOrUndefined(u[c])||u[c].isWorking||(h+=c===l?u[c].to-s:u[c].interval);else h+=86400-s;if(!i||r)for(c=0;c<=d;c++)g[c].isWorking||(h+=c===d?o-g[c].from:g[c].interval);else h+=o}else if(l!==d)if(!i||r)for(c=l;c<=d;c++)ae.isNullOrUndefined(u[c])||u[c].isWorking||(h+=c===l?u[c].to-s:c===d?o-u[c].from:u[c].interval);else h+=o-s;else!i||r?u[l].isWorking||(h=o-s):h+=o-s;return h},e.prototype.getPreviousWorkingDay=function(e,t){if(t&&t.getExceptionForDate(e))return e;var i=e.getDay(),n=0===i?6:i-1,a=this.parent.getCurrentDayEndTime(e);return(-1!==this.parent.nonWorkingDayIndex.indexOf(i)||-1!==this.parent.nonWorkingDayIndex.indexOf(n)&&86400!==a&&0===this.getSecondsInDecimal(e))&&(e.setDate(e.getDate()-1),-1!==this.parent.nonWorkingDayIndex.indexOf(e.getDay()))?this.getPreviousWorkingDay(e,t):e},e.prototype.getNonWorkingDayIndex=function(){for(var e=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],t=e.length,i=(0===this.parent.workWeek.length&&(this.parent.workWeek=["Monday","Tuesday","Wednesday","Thursday","Friday"]),this.parent.workWeek.slice()),n=i.length,a=0;a<n;a++)i[a]=i[a].toLowerCase();this.parent.nonWorkingDayIndex=[];for(a=0;a<t;a++)-1===i.indexOf(e[a])&&this.parent.nonWorkingDayIndex.push(a)},e.prototype.setTime=function(e,t){var i=e/3600,n=(e-3600*(i=parseInt(i,10)))/60,n=parseInt(n,10);t.setHours(i,n,e-3600*i-60*n)},e.prototype.getTimeDifference=function(e,t,i){e=new Date(e.getTime()),t=new Date(t.getTime());return i&&this.updateDateWithTimeZone(e,t),t.getTime()-e.getTime()},e.prototype.updateDateWithTimeZone=function(e,t){var i,n,a,r,s=e.getTimezoneOffset(),o=t.getTimezoneOffset();s!==o&&((a=new Date((new Date).getFullYear(),0,1).getTimezoneOffset())!==s?(n=e,i=s):a!==o&&(n=t,i=o),a<0?(r=a-i,n.setTime(n.getTime()+60*r*1e3)):0<=a&&(r=i-a,n.setTime(n.getTime()-60*r*1e3)))},e.prototype.getSecondsInDecimal=function(e){return 60*e.getHours()*60+60*e.getMinutes()+e.getSeconds()+e.getMilliseconds()/1e3},e.prototype.offset=function(e,t){var i=e.getTimezoneOffset();try{var n=new Date(e.toLocaleString("en-US",{timeZone:t}));return isNaN(n.getTime())?0:(e.getTime()-n.getTime())/6e4+i}catch(e){return 0}},e.prototype.remove=function(e,t){return e=ae.isNullOrUndefined(e)?e:this.reverse(e,t,e.getTimezoneOffset())},e.prototype.reverse=function(e,t,i){"string"==typeof t&&(t=this.offset(e,t)),"string"==typeof i&&(i=this.offset(e,i));var n=e.getTimezoneOffset(),t=(e=new Date(e.getTime()+6e4*(t-i))).getTimezoneOffset();return new Date(e.getTime()+6e4*(t-n))},e.prototype.convert=function(e,t){var i=e.getTimezoneOffset(),t=this.offset(e,t),n=("string"==typeof i&&(i=this.offset(e,i)),"string"==typeof t&&(t=this.offset(e,t)),e.getTimezoneOffset()),i=(e=new Date(e.getTime()+6e4*(i-t))).getTimezoneOffset();return new Date(e.getTime()+6e4*(i-n))},e.prototype.getDateFromFormat=function(e,t){if(ae.isNullOrUndefined(e))return null;e=e instanceof Date?new Date(e.getTime()):(i=this.parent.globalize.parseDate(e,{format:this.parent.getDateFormat(),type:"dateTime"}),ae.isNullOrUndefined(i)&&!isNaN(new Date(e).getTime())?new Date(e):i);var i=!this.parent.isOnAdded;return!ae.isNullOrUndefined(this.parent.timezone)&&t&&(i&&this.parent.timezone||this.parent.isLoad)?this.convert(e,this.parent.timezone):e},e.prototype.compareDates=function(e,t){return ae.isNullOrUndefined(e)||ae.isNullOrUndefined(t)?!ae.isNullOrUndefined(e)&&ae.isNullOrUndefined(t)?1:ae.isNullOrUndefined(e)&&!ae.isNullOrUndefined(t)?-1:null:e.getTime()>t.getTime()?1:e.getTime()<t.getTime()?-1:0},e.prototype.getDurationString=function(e,t){var i="";return ae.isNullOrUndefined(e)||(i+=parseFloat(e.toFixed(2))+" ",ae.isNullOrUndefined(t))||(e=1!==e,"day"===t?i+=e?this.parent.localeObj.getConstant("days"):this.parent.localeObj.getConstant("day"):"hour"===t?i+=e?this.parent.localeObj.getConstant("hours"):this.parent.localeObj.getConstant("hour"):"minute"===t&&(i+=e?this.parent.localeObj.getConstant("minutes"):this.parent.localeObj.getConstant("minute"))),i},e.prototype.getWorkString=function(e,t){var i="";return ae.isNullOrUndefined(e)||(i+=parseFloat(e).toFixed(2)+" ",ae.isNullOrUndefined(t))||(e=1!==e,"day"===t?i+=e?this.parent.localeObj.getConstant("days"):this.parent.localeObj.getConstant("day"):"hour"===t?i+=e?this.parent.localeObj.getConstant("hours"):this.parent.localeObj.getConstant("hour"):"minute"===t&&(i+=e?this.parent.localeObj.getConstant("minutes"):this.parent.localeObj.getConstant("minute"))),i},e.prototype.calculateProjectDatesForValidatedTasks=function(e){var t,i=this,n="string"==typeof this.parent.projectStartDate?new Date(this.parent.projectStartDate):this.parent.projectStartDate,a="string"==typeof this.parent.projectEndDate?new Date(this.parent.projectEndDate):this.parent.projectEndDate,r=null,s=null,o=ae.getValue("dataOperation.dataArray",this.parent);!o||0!==o.length||n&&a?0<o.length&&(t=o.slice().sort(function(e,t){return new Date(e[i.parent.taskFields.startDate]).getTime()-new Date(t[i.parent.taskFields.startDate]).getTime()}),o=o.slice().sort(function(e,t){return new Date(t[i.parent.taskFields.endDate]).getTime()-new Date(e[i.parent.taskFields.endDate]).getTime()}),r=t[0][this.parent.taskFields.startDate],s=o[o.length-1][this.parent.taskFields.endDate]):(r=this.getDateFromFormat(new Date),s=this.getDateFromFormat(new Date(r.getTime()))),this.parent.cloneProjectStartDate=n?new Date(n.getTime()):"string"==typeof r?new Date(r):r,this.parent.cloneProjectEndDate=a?new Date(a.getTime()):"string"==typeof s?new Date(s):s,this.calculateTimelineDates()},e.prototype.calculateProjectDates=function(e){var t,i,n,a,r,s,o,l,d=this;this.parent.isLoad&&this.parent.enablePersistence&&this.parent.cloneProjectStartDate&&this.parent.cloneProjectEndDate?(this.parent.cloneProjectStartDate=this.getDateFromFormat(this.parent.cloneProjectStartDate),this.parent.cloneProjectEndDate=this.getDateFromFormat(this.parent.cloneProjectEndDate)):(t="string"==typeof this.parent.projectStartDate?new Date(this.parent.projectStartDate):this.parent.projectStartDate,i="string"==typeof this.parent.projectEndDate?new Date(this.parent.projectEndDate):this.parent.projectEndDate,t=this.getDateFromFormat(t),i=this.getDateFromFormat(i),a=n=null,r=this.parent.flatData,this.parent.currentViewData,s=[],o=function(e){ae.isNullOrUndefined(e)||s.push(e)},l=function(e){0<e.length&&(e.sort(function(e,t){return e.getTime()-t.getTime()}),n=new Date(e[0].getTime()),a=1<e.length?new Date(e[e.length-1].getTime()):null)},(!t||!i)&&0<r.length||e?(r.forEach(function(e){s=[];var t,i=e.ganttProperties;"ResourceView"===d.parent.viewType&&0===e.level||(e=ae.isNullOrUndefined(i.startDate)&&ae.isNullOrUndefined(i.endDate)?t=null:(t=d.getValidStartDate(i),d.getValidEndDate(i)),o(n),o(a),o(t),o(e),d.parent.renderBaseline&&(o(i.baselineStartDate),o(i.baselineEndDate)),i.indicators&&0<i.indicators.length&&i.indicators.forEach(function(e){o(d.getDateFromFormat(e.date))}),l(s))}),s=[],o(n),o(a),0<this.parent.eventMarkers.length&&this.parent.eventMarkers.forEach(function(e,t){o(d.getDateFromFormat(e.day))}),0<this.parent.defaultCalendarContext.defaultHolidays.length&&this.parent.defaultCalendarContext.defaultHolidays.forEach(function(e,t){o(new Date(e))}),l(s),n&&a||(n?n=ae.isNullOrUndefined(n)?this.getDateFromFormat(new Date):n:(n=ae.isNullOrUndefined(n)?this.getDateFromFormat(new Date):n).setHours(0,0,0,0),(a=this.getDateFromFormat(new Date(n.getTime()))).setDate(a.getDate()+20))):t&&i||0!==r.length||(n=this.getDateFromFormat(new Date),a=this.getDateFromFormat(new Date(n.getTime()))),e?(ae.setValue("minStartDate",n,e),ae.setValue("maxEndDate",a,e)):(this.prevProjectStartDate=this.parent.cloneProjectStartDate,this.parent.cloneProjectStartDate=t?new Date(t.getTime()):"string"==typeof n?new Date(n):n,this.parent.cloneProjectEndDate=i?new Date(i.getTime()):"string"==typeof a?new Date(a):a),this.parent.isProjectDateUpdated=!0),this.calculateTimelineDates()},e.prototype.calculateTimelineDates=function(){var e,t,i,n;this.parent.isLoad&&this.parent.enablePersistence&&this.parent.cloneTimelineStartDate&&this.parent.cloneTimelineEndDate?(this.parent.cloneTimelineStartDate=this.getDateFromFormat(this.parent.cloneTimelineStartDate),this.parent.cloneTimelineEndDate=this.getDateFromFormat(this.parent.cloneTimelineEndDate)):(n=function(e){return null==e||"string"==typeof e&&"auto"===e.toLowerCase()?null:new Date(e)},e="string"==typeof this.parent.projectStartDate?new Date(this.parent.projectStartDate):this.parent.projectStartDate,t="string"==typeof this.parent.projectEndDate?new Date(this.parent.projectEndDate):this.parent.projectEndDate,i=n(this.parent.timelineSettings.viewStartDate),n=n(this.parent.timelineSettings.viewEndDate),this.parent.cloneTimelineStartDate=!e&&i||new Date(this.parent.cloneProjectStartDate),this.parent.cloneTimelineEndDate=!t&&n||new Date(this.parent.cloneProjectEndDate),n||this.parent.timelineModule.adjustEndDateToFillChart(!1))},e.prototype.splitTasksDuration=function(e){var t=0,i=e[0].startDate,e=e[e.length-1].endDate;return"Hour"===this.parent.timelineModule.bottomTier?t+=Math.ceil(this.getTimeDifference(i,e)/36e5):"Minutes"===this.parent.timelineModule.bottomTier?t+=Math.ceil(this.getTimeDifference(i,e)/6e4):t+=Math.ceil(this.getTimeDifference(i,e)/864e5),t},e.prototype.getBinaryBound=function(e,t){for(var i=0,n=e.length;i<n;){var a=Math.floor((i+n)/2);e[a]<t?i=a+1:n=a}return i};var J=e;function e(e){this.fromSegments=!1,this.mondayTimeRangeLength=0,this.tuesdayTimeRangeLength=0,this.wednesdayTimeRangeLength=0,this.thursdayTimeRangeLength=0,this.fridayTimeRangeLength=0,this.saturdayTimeRangeLength=0,this.sundayTimeRangeLength=0,this.parent=e}te.prototype.initialize=function(){this.buildDefaultHolidays(),this.buildExceptionsCollection()},te.prototype.buildDefaultHolidays=function(){for(var e=("projectCalendar"===this.calendar.propName?this.parent.calendarModule:this.calendar).holidays,t=this.calendar.exceptions,i=0;i<e.length;i++)for(var n=e[i],a=n.from?new Date(n.from):new Date(n.to),r=n.to?new Date(n.to):new Date(n.from),s=new Date(a);s<=r;s.setDate(s.getDate()+1)){for(var o=new Date(s).setHours(0,0,0,0),l=!1,d=0;d<t.length;d++)if(new Date(t[d].from).setHours(0,0,0,0)===o){l=!0;break}l||this.defaultHolidays.push(o)}this.sortedDefaultHolidays=this.defaultHolidays.slice().sort(function(e,t){return e-t})},te.prototype.buildExceptionsCollection=function(){for(var e=this.calendar.exceptions,t=0;t<e.length;t++){var i=e[t],n=new Date(i.from),a=new Date(i.to);this.exceptionsRanges.push({id:"exception_"+t,from:n,to:a});for(var r=new Date(n);r<=a;r.setDate(r.getDate()+1))this.exceptionDateSet.add(new Date(r).setHours(0,0,0,0))}},te.prototype.getExceptionForDate=function(e){e=new Date(e.getTime()).setHours(0,0,0,0);return this.exceptionDateSet.has(e)};var ee=te;function te(e,t){this.defaultHolidays=[],this.sortedDefaultHolidays=[],this.exceptionDateSet=new Set,this.exceptionsRanges=[],this.parent=e,this.calendar=t,this.initialize()}ie=function(e,t){return(ie=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};(function(e,t){function i(){this.constructor=e}ie(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)})(t,ne=J),t.prototype.addEventListener=function(){this.parent.on("beforeDataManipulate",this.checkDataBinding.bind(this))},t.prototype.checkDataBinding=function(e){var t,i=this;e&&(this.parent.flatData=[],this.parent.currentViewData=[],this.parent.updatedRecords=[],this.dataArray=[],this.taskIds={},this.parent.ids=[],this.recordIndex=0,this.hierarchyData=[],this.parent.predecessorsCollection=[],this.parent.treeGrid.parentData=[],this.parent.taskIds=[]),ae.isNullOrUndefined(this.parent.dataSource)?(this.parent.dataSource=[],this.parent.processTimeline(),this.parent.renderGantt(e)):this.parent.dataSource instanceof U.DataManager?this.initDataSource(e):(this.parent.dataSource instanceof Object&&H(this.parent)?(t=ae.getValue("result",this.parent.dataSource),this.dataArray=t):this.dataArray=this.parent.dataSource,this.processTimeline(),this.cloneDataSource(),this.parent.renderGantt(e),this.parent.flatData.map(function(e){i.parent.chartRowsModule.updateSegment(e.ganttProperties.segments,e.ganttProperties.taskId)})),this.parent.flatData.map(function(e){i.parent.chartRowsModule.updateSegment(e.ganttProperties.segments,e.ganttProperties.taskId)})},t.prototype.processTimeline=function(){this.parent.processTimeline(),this.parent.enableValidation||(this.parent.dataOperation.calculateProjectDatesForValidatedTasks(),this.parent.timelineModule.validateTimelineProp())},t.prototype.initDataSource=function(t){var i=this,e=this.parent.query instanceof U.Query?this.parent.query:new U.Query,n=(e.requiresCount(),this.parent.dataSource);this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?(this.processTimeline(),this.parent.renderGantt(t)):n.executeQuery(e).then(function(e){i.dataArray=e.result,i.processTimeline(),i.parent.loadChildOnDemand&&(!i.parent.loadChildOnDemand||i.parent.taskFields.hasChildMapping)||i.cloneDataSource(),i.parent.renderGantt(t)}).catch(function(e){i.parent.processTimeline(),i.parent.renderGantt(t),i.parent.trigger("actionFailure",{error:e})})},t.prototype.constructDataSource=function(e){for(var t=new U.DataManager(e).executeLocal((new U.Query).group(this.parent.taskFields.parentID)),i=[],n=0;n<t.length;n++){var a=t[n];if(!ae.isNullOrUndefined(a.key)){var r=a.key.toString(),r=void 0!==this.taskIds[r]?this.taskIds[r]:-1;if(-1<r&&!ae.isNullOrUndefined(a.key)){e[r][this.parent.taskFields.child]=a.items;continue}}(-1!==r||this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)&&i.push.apply(i,a.items)}this.hierarchyData=this.dataReorder(e,i)},t.prototype.cloneDataSource=function(){var e,t,i,n=this.parent.taskFields.id,a=this.parent.taskFields.parentID,r=[];if(ae.isNullOrUndefined(n)||ae.isNullOrUndefined(a))r=this.dataArray;else{var s=[],a=void 0;this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping&&!this.parent.enableVirtualization&&(a=JSON.parse(JSON.stringify(this.dataArray)));for(var o=0;o<this.dataArray.length;o++){var l=this.dataArray[o];l.parentItem&&delete l.parentItem,s.push(ae.extend({},{},l,!0)),ae.isNullOrUndefined(l[n])||(l=l[n].toString(),this.taskIds[l]=o)}this.parent.taskFields.child||this.parent.setProperties({taskFields:{child:"Children"}},!0),ae.isNullOrUndefined(a)?this.constructDataSource(s):(this.constructDataSource(this.dataArray),this.dataArray=a),r=this.hierarchyData}this.parent.taskFields.segmentId&&(this.segmentCollection=new U.DataManager(this.parent.segmentData).executeLocal((new U.Query).group(this.parent.taskFields.segmentId)),this.parent.taskFields.segments||(this.parent.taskFields.segments="Segments")),"ProjectView"!==this.parent.viewType&&(a=ae.extend([],[],this.parent.resources,!0),this.constructResourceViewDataSource(a,r,e=[]),0<e.length&&(i=this.parent.resourceFields.name||"resourceName",(t={})[this.parent.resourceFields.id]=0,t[i]=this.parent.localeObj