@syncfusion/ej2-gantt
Version:
Essential JS 2 Gantt Component
12 lines • 1.25 MB
JavaScript
/*!
* filename: ej2-gantt.min.js
* version : 30.2.5
* Copyright Syncfusion Inc. 2001 - 2024. 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.
*/
this.ej=this.ej||{},this.ej.gantt=function(e,t,i,a,r,n,s,o,l,d,h,p,u,c,g){"use strict";function f(e,t,i){for(var a=e;a&&(i?a.id!==t:!a.classList.contains(t));)a=a.parentElement;return a}function m(e){return t.isNullOrUndefined(e.startDate)&&t.isNullOrUndefined(e.endDate)&&t.isNullOrUndefined(e.duration)?null:!(t.isNullOrUndefined(e.startDate)||t.isNullOrUndefined(e.endDate)||t.isNullOrUndefined(e.duration))}function y(e){return!(!e.dataSource||e.dataSource instanceof a.DataManager||!("result"in e.dataSource))}function D(e){for(var t={},i=0,a=Object.keys(e);i<a.length;i++){var r=a[i];t[e[r]]=r}return t}function v(e){return!t.isNullOrUndefined(e)&&"object"==typeof e&&0===Object.keys(e).length}function k(e){var t=e.getFullYear(),i=e.getMonth(),a=e.getDate(),r=e.getHours(),n=e.getMinutes(),s=e.getSeconds(),o=e.getMilliseconds();return Date.UTC(t,i,a,r,n,s,o)}function b(e){if(e instanceof a.DataManager){var t=e.adaptor;return t instanceof a.ODataAdaptor||t instanceof a.ODataV4Adaptor||t instanceof a.WebApiAdaptor||t instanceof a.WebMethodAdaptor||t instanceof a.CacheAdaptor||t instanceof a.RemoteSaveAdaptor||t instanceof a.UrlAdaptor}return!1}function w(e,i,a,r){if(a){for(var n=void 0,s=0;s<e.length;s++)n=o=i?e[parseInt(s.toString(),10)].taskData:t.extend({},e[parseInt(s.toString(),10)].taskData,{},!0);return n}for(var n=[],s=0;s<e.length;s++){!t.isNullOrUndefined(r)&&r.timezone&&T(e[s],r);var o=i?e[parseInt(s.toString(),10)].taskData:t.extend({},e[parseInt(s.toString(),10)].taskData,{},!0);n.push(o)}return n}function T(e,i){return e&&!t.isNullOrUndefined(e.ganttProperties)&&(e.taskData[i.taskFields.startDate]=i.dateValidationModule.remove(e.ganttProperties.startDate,i.timezone),null!==i.taskFields.endDate&&(e.taskData[i.taskFields.endDate]=i.dateValidationModule.remove(e.ganttProperties.endDate,i.timezone)),(i.taskFields.baselineEndDate||i.taskFields.baselineStartDate)&&(e.taskData[i.taskFields.baselineStartDate]=i.dateValidationModule.remove(e.ganttProperties.baselineStartDate,i.timezone),e.taskData[i.taskFields.baselineEndDate]=i.dateValidationModule.remove(e.ganttProperties.baselineEndDate,i.timezone))),null}function S(e,t){for(var i,a=0;a<t.length;a++)i=new RegExp("\\{"+a+"\\}","gm"),e=e.replace(i,t[a].toString());return e}function P(e,i,a,r){for(var n=-1,s=0;s<a.length;s++)if(t.getValue(i,a[s])===t.getValue(i,e)&&t.isNullOrUndefined(r)||!t.isNullOrUndefined(r)&&t.getValue(i,a[s])===t.getValue(i,e)&&t.getValue(r,a[s])===t.getValue(r,e)){n=s;break}return n}function C(e){return 76*e/92}function R(e){return 92*e/76}function M(){return x++}var x=0;!function(e){e[e.AsSoonAsPossible=0]="AsSoonAsPossible",e[e.AsLateAsPossible=1]="AsLateAsPossible",e[e.MustStartOn=2]="MustStartOn",e[e.MustFinishOn=3]="MustFinishOn",e[e.StartNoEarlierThan=4]="StartNoEarlierThan",e[e.StartNoLaterThan=5]="StartNoLaterThan",e[e.FinishNoEarlierThan=6]="FinishNoEarlierThan",e[e.FinishNoLaterThan=7]="FinishNoLaterThan"}(e.ConstraintType||(e.ConstraintType={}));var O=function(){function i(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}return i.prototype.isValidateNonWorkDays=function(e){return!t.isNullOrUndefined(e)&&e.isAutoSchedule&&(!this.parent.includeWeekend||this.parent.totalHolidayDates.length>0)||t.isNullOrUndefined(e)&&(!this.parent.includeWeekend||this.parent.totalHolidayDates.length>0)},i.prototype.checkStartDate=function(e,i,a,r,n){if(t.isNullOrUndefined(e))return null;var s=new Date(e.getTime()),o=this.parent.getCurrentDayStartTime(s),l=this.parent.getCurrentDayEndTime(s),d=new Date(e.getTime()),h=this.getSecondsInDecimal(d);if(a=t.isNullOrUndefined(a)?!t.isNullOrUndefined(i)&&i.isMilestone:a,h<o&&(!a||r))this.setTime(o,d);else if(h<o&&a)this.setTime(o,d);else if(h===l&&(!i||!a)||h>l)d.setDate(d.getDate()+1),o=this.parent.getCurrentDayStartTime(d),this.setTime(o,d);else if(h>o&&h<l){var p=this.parent.workingTimeRanges;this.parent.weekWorkingTime.length>0&&(p=this.parent.getWorkingRange(d));for(var u=0;u<p.length;u++){var c=p[u];if(h>=c.to&&p[u+1]&&h<p[u+1].from){(h!==c.to||i&&a)&&h===c.to||this.setTime(p[u+1].from,d);break}}}var g;if(!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)return new Date(d.getTime());do{g=new Date(d.getTime());var f=this.parent.totalHolidayDates.length;if(this.isValidateNonWorkDays(i)){o=this.parent.getCurrentDayStartTime(g),i&&(l=n?this.parent.getCurrentDayEndTime(i.baselineEndDate?i.baselineEndDate:g):this.parent.getCurrentDayEndTime(i.endDate?i.isAutoSchedule?i.endDate:i.autoEndDate:g));var m=!a||r?o:l;if(!this.parent.includeWeekend&&!n){var y=new Date(d.getTime());d=this.getNextWorkingDay(d),m=this.parent.getCurrentDayStartTime(d),y.getTime()===d.getTime()||a||this.setTime(m,d)}if(!n)for(var D=0;D<f;D++){var v=this.getDateFromFormat(new Date(this.parent.totalHolidayDates[D])),k=new Date(v.getTime());v.setHours(0,0,0,0),k.setHours(23,59,59,59),d.getTime()>=v.getTime()&&d.getTime()<k.getTime()&&(d.setDate(d.getDate()+1),m=this.parent.getCurrentDayStartTime(d),this.setTime(m,d))}}}while(g.getTime()!==d.getTime());return new Date(d.getTime())},i.prototype.getDateByConstraint=function(i,a,r,n){var s=i.ganttProperties?i.ganttProperties:i,o=new Date(s.constraintDate),l=this.parent.isLoad;if(t.isNullOrUndefined(n)&&(n=!0),(!o||!a)&&n)return null;switch(o=this.parent.assignTimeToDate(o,this.parent.getCurrentDayStartTime(o)),s.constraintType){case e.ConstraintType.AsSoonAsPossible:if(l)return a;s.constraintDate=null;var d=this.parent.getRecordByID(s.taskId).parentItem;return s.predecessor&&s.predecessor.length>0?this.parent.assignTimeToDate(a,this.parent.getCurrentDayStartTime(a)):d?this.parent.getRecordByID(d.taskId).ganttProperties.startDate:this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate));case e.ConstraintType.AsLateAsPossible:if(l)return a;if(d=this.parent.getRecordByID(s.taskId).parentItem){g=this.parent.dateValidationModule.checkEndDate(this.parent.getRecordByID(d.taskId).ganttProperties.endDate);return f=this.parent.dateValidationModule.getStartDate(g,s.duration,s.durationUnit,s)}g=this.parent.dateValidationModule.checkEndDate(new Date(this.parent.projectEndDate));return f=this.parent.dateValidationModule.getStartDate(g,s.duration,s.durationUnit,s);case e.ConstraintType.MustStartOn:var h=o.getTime()!==s.startDate.getTime(),p=void 0;this.parent.editModule&&this.parent.editModule.dialogModule&&(p=this.parent.editModule.dialogModule.dialogConstraintValue);var u=t.isNullOrUndefined(p)||2===p||3===p;return h&&!l&&u&&(this.parent.constraintViolationType="MustStartOn"),p=null,l?this.parent.dateValidationModule.checkStartDate(new Date(o)):this.parent.assignTimeToDate(a,this.parent.getCurrentDayStartTime(a));case e.ConstraintType.MustFinishOn:var h=o.getTime()!==s.endDate.getTime(),c=new Date(o);c.setDate(c.getDate()+1);var g=this.parent.dateValidationModule.checkEndDate(c),f=this.parent.dateValidationModule.getStartDate(g,s.duration,s.durationUnit,s);return h&&!l&&(this.parent.constraintViolationType="MustFinishOn"),r?a:f;case e.ConstraintType.StartNoEarlierThan:return o.getTime()<a.getTime()||!l?this.parent.assignTimeToDate(a,this.parent.getCurrentDayStartTime(a)):this.parent.dateValidationModule.checkStartDate(new Date(o));case e.ConstraintType.StartNoLaterThan:return(h=o.getTime()!==s.startDate.getTime())&&!l&&(this.parent.constraintViolationType="StartNoLaterThan"),l?s.predecessor&&s.predecessor.length>0?a:this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate)):this.parent.assignTimeToDate(a,this.parent.getCurrentDayStartTime(a));case e.ConstraintType.FinishNoEarlierThan:if(o.getTime()<a.getTime())return this.parent.assignTimeToDate(a,this.parent.getCurrentDayEndTime(a));var m=new Date(o);m.setDate(m.getDate()+1);g=this.parent.dateValidationModule.checkEndDate(m);return this.parent.dateValidationModule.getStartDate(g,s.duration,s.durationUnit,s);case e.ConstraintType.FinishNoLaterThan:return(h=o.getTime()!==s.endDate.getTime())&&!l&&(this.parent.constraintViolationType="FinishNoLaterThan"),l?s.predecessor&&s.predecessor.length>0?a:this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate)):this.parent.assignTimeToDate(a,this.parent.getCurrentDayEndTime(a));default:return a}},i.prototype.checkEndDate=function(e,i,a,r){if(t.isNullOrUndefined(e))return null;var n,s;if(this.parent.weekWorkingTime.length>0){var o=e;(!this.parent.includeWeekend&&i&&i.isAutoSchedule||this.parent.editModule&&this.parent.editModule.taskbarEditModule&&this.parent.editModule.taskbarEditModule.taskBarEditRecord&&!this.parent.editModule.taskbarEditModule.taskBarEditRecord.ganttProperties.isAutoSchedule)&&(o=this.getNextWorkingDay(e)),n=this.parent.getStartTime(o),s=this.parent.getEndTime(o)}else n=this.parent.defaultStartTime,s=this.parent.defaultEndTime;var l=new Date(e.getTime()),d=this.getSecondsInDecimal(l);if(d>s)this.setTime(s,l);else if(d<=n&&86400!==s&&!a){var h=this.parent.taskFields;this.parent.editModule&&this.parent.editModule.editedRecord&&!this.parent.editModule.editedRecord[h.startDate]&&this.parent.editModule.editedRecord[h.endDate]?l.setDate(l.getDate()):l.setDate(l.getDate()-1),s=this.parent.getCurrentDayEndTime(l),this.setTime(s,l)}else if(d>n&&d<s)for(var p=0;p<this.parent.workingTimeRanges.length;p++)if(d>this.parent.workingTimeRanges[p].to&&this.parent.workingTimeRanges[p+1]&&d<=this.parent.workingTimeRanges[p+1].from){this.setTime(this.parent.workingTimeRanges[p].to,l);break}var u;if(!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)return t.isNullOrUndefined(l)||86400===this.parent.defaultEndTime||(s=this.parent.getCurrentDayEndTime(e),this.setTime(s,l)),new Date(l.getTime());do{u=new Date(l.getTime());var c=this.parent.totalHolidayDates.length;if(this.isValidateNonWorkDays(i)&&!r){if(!this.parent.includeWeekend){var g=new Date(l.getTime());l=this.getPreviousWorkingDay(l),s=this.parent.getCurrentDayEndTime(l),g.getTime()!==l.getTime()&&this.setTime(s,l)}for(var f=0;f<c;f++){var m=this.getDateFromFormat(new Date(this.parent.totalHolidayDates[f])),y=new Date(m.getTime()),D=new Date(l.getTime());D.setMinutes(l.getMilliseconds()-2),m.setHours(0,0,0,0),y.setHours(23,59,59,59),(l.getTime()>=m.getTime()&&l.getTime()<y.getTime()||D.getTime()>=m.getTime()&&D.getTime()<y.getTime())&&(l.setDate(l.getDate()-1),s=this.parent.getCurrentDayEndTime(l),l.getTime()===m.getTime()&&86400===s&&0===this.getSecondsInDecimal(l)||this.setTime(s,l))}}}while(u.getTime()!==l.getTime());return new Date(l.getTime())},i.prototype.checkBaselineStartDate=function(e,i){if(t.isNullOrUndefined(e))return null;var a=this.parent.getCurrentDayStartTime(e),r=this.parent.getCurrentDayEndTime(i&&i.endDate?i.isAutoSchedule?i.endDate:i.autoEndDate:e),n=new Date(e.getTime()),s=this.getSecondsInDecimal(n);if(s<a)this.setTime(a,n);else if(s>r)n.setDate(n.getDate()+1),a=this.parent.weekWorkingTime.length>0?this.parent.getStartTime(n):this.parent.defaultStartTime,this.setTime(a,n);else if(s>a&&s<r)for(var o=0;o<this.parent.workingTimeRanges.length;o++)if(s>this.parent.workingTimeRanges[o].to&&this.parent.workingTimeRanges[o+1]&&s<this.parent.workingTimeRanges[o+1].from){this.setTime(this.parent.workingTimeRanges[o+1].from,n);break}return n},i.prototype.checkBaselineEndDate=function(e,i){if(t.isNullOrUndefined(e))return null;var a=this.parent.getCurrentDayEndTime(e),r=this.parent.getCurrentDayStartTime(i&&i.startDate?i.isAutoSchedule?i.startDate:i.autoStartDate:e),n=new Date(e.getTime()),s=this.getSecondsInDecimal(n);if(s>a)this.setTime(a,n);else if(s<r&&!t.isNullOrUndefined(i)&&!i.isMilestone)n.setDate(n.getDate()-1),a=this.parent.getCurrentDayEndTime(n),this.setTime(a,n);else if(s>r&&s<a)for(var o=0;o<this.parent.workingTimeRanges.length;o++)if(s>this.parent.workingTimeRanges[o].to&&this.parent.workingTimeRanges[o+1]&&s<=this.parent.workingTimeRanges[o+1].from){this.setTime(this.parent.workingTimeRanges[o].to,n);break}return i&&i.baselineStartDate&&n&&i.baselineStartDate.getTime()>n.getTime()&&n.setDate(n.getDate()+1),n},i.prototype.calculateStartDate=function(e,i){var a=e.ganttProperties,r=null;i?(t.isNullOrUndefined(a.baselineEndDate)||t.isNullOrUndefined(a.baselineDuration)||(r=this.getStartDate(a.baselineEndDate,a.baselineDuration,a.durationUnit,a,void 0,!0)),this.parent.setRecordValue("baselineStartDate",r,a,!0),this.parent.taskFields.baselineStartDate&&this.parent.dataOperation.updateMappingData(e,"baselineStartDate")):(t.isNullOrUndefined(a.endDate)||t.isNullOrUndefined(a.duration)||(r=this.getStartDate(a.endDate,a.duration,a.durationUnit,a)),this.parent.setRecordValue("startDate",r,a,!0),this.parent.taskFields.startDate&&this.parent.dataOperation.updateMappingData(e,"startDate"))},i.prototype.getFieldMappings=function(e){return{startdateField:e?"baselineStartDate":"startDate",enddateField:e?"baselineEndDate":"endDate",durationField:e?"baselineDuration":"duration"}},i.prototype.calculateEndDate=function(e,i){var a,r,n=e.ganttProperties,s=null,o=this.getFieldMappings(i),l=o.startdateField,d=o.enddateField,h=o.durationField;if(t.isNullOrUndefined(n[l]))s=e[this.parent.taskFields[d]],t.isNullOrUndefined(s)||(r=this.parent.getCurrentDayEndTime(s),this.setTime(r,s)),this.parent.setRecordValue(d,s,n,!0);else{if(!t.isNullOrUndefined(n[d])&&t.isNullOrUndefined(n[h])&&(1===this.compareDates(n[l],n[d])&&(this.parent.setRecordValue(l,new Date(n[d].getTime()),n,!0),a=this.parent.getCurrentDayStartTime(n.isAutoSchedule&&!i?n.autoStartDate:n[l]),r=this.parent.getCurrentDayEndTime(n.isAutoSchedule&&!i?n.autoEndDate:n[d]),this.setTime(a,n[l])),this.calculateDuration(e,i)),!t.isNullOrUndefined(n[h])){var p=!i&&!t.isNullOrUndefined(n.segments)&&n.segments.length>1?this.totalDuration(n.segments):n[h];s=this.getEndDate(n[l],p,n.durationUnit,n,!1,i)}this.parent.setRecordValue(d,s,n,!0)}this.parent.taskFields[d]&&this.parent.dataOperation.updateMappingData(e,d)},i.prototype.totalDuration=function(e){for(var t=0,i=0;i<e.length;i++)t+=e[i].duration+e[i].offsetDuration;return t},i.prototype.calculateDuration=function(e,i){var a,r=e.ganttProperties;if(!i&&!t.isNullOrUndefined(r.segments)&&r.segments.length>0&&!t.isNullOrUndefined(this.parent.editModule.taskbarEditModule))a=this.parent.editModule.taskbarEditModule.sumOfDuration(r.segments);else if(i||t.isNullOrUndefined(this.parent.taskFields.milestone)||t.isNullOrUndefined(r.startDate)||t.isNullOrUndefined(r.endDate)||r.startDate.getTime()!==r.endDate.getTime()||!1!==e.taskData[this.parent.taskFields.milestone]){var n=i?r.baselineStartDate:r.startDate,s=i?r.baselineEndDate:r.endDate,o=r.durationUnit,l=!i&&r.isAutoSchedule,d=!i&&r.isMilestone;a=this.getDuration(n,s,o,l,d)}else a=1;var h=i?"baselineDuration":"duration";this.parent.setRecordValue(h,a,r,!0);var p=i?this.parent.columnByField[this.parent.columnMapping.baselineDuration]:this.parent.columnByField[this.parent.columnMapping.duration];if(!(t.isNullOrUndefined(this.parent.editModule)||t.isNullOrUndefined(this.parent.editModule.cellEditModule)||this.parent.editModule.cellEditModule.isCellEdit||t.isNullOrUndefined(p))){if(!t.isNullOrUndefined(p.edit)&&!t.isNullOrUndefined(p.edit.read)){var u=this.parent.editModule.dialogModule.dialog;if(!t.isNullOrUndefined(u)){var c=i?u.querySelector("#"+this.parent.element.id+"BaselineDuration").ej2_instances[0]:u.querySelector("#"+this.parent.element.id+"Duration").ej2_instances[0];t.isNullOrUndefined(c)||c.value===a.toString()||(c.value=a.toString(),c.dataBind())}}(this.parent.taskFields.duration||this.parent.taskFields.baselineDuration)&&(this.parent.dataOperation.updateMappingData(e,h),this.parent.taskFields.durationUnit&&this.parent.dataOperation.updateMappingData(e,"durationUnit"))}},i.prototype.getNonworkingTime=function(e,i,a,r,n){r=!!t.isNullOrUndefined(r)||r;var s=n||this.parent.includeWeekend||!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||!a?0:this.getWeekendCount(e,i),o=this.getNumberOfSeconds(e,i,r),l=!a||!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||n?0:this.getHolidaysCount(e,i),d=(o-86400*s-86400*l)/86400,h=this.getNonWorkingSecondsOnDate(e,i,a,n);return(this.parent.weekWorkingTime.length>0?this.nonWorkingSeconds(e,i,a,d):d*(86400-this.parent.secondsPerDay))+86400*s+86400*l+h},i.prototype.nonWorkingSeconds=function(e,i,a,r,n){var s=e.getTime()>i.getTime()?new Date(i.getTime()):new Date(e.getTime()),o=e.getTime()>i.getTime()?new Date(e.getTime()):new Date(i.getTime()),l=0,d=0;if(n){var h=this.parent.getCurrentDayStartTime(s),p=this.parent.getCurrentDayEndTime(s);s.getHours()<p/3600&&s.getHours()>=h/3600||s.setDate(s.getDate()+1)}else s.setDate(s.getDate()+1),s.setHours(0,0,0,0),o.setHours(0,0,0,0);if(!(r>0||t.isNullOrUndefined(r)))return 0;for(;n&&s.getTime()<=o.getTime()||!n&&s.getTime()<o.getTime();){if(a){if(this.isOnHolidayOrWeekEnd(s,!0))do{s.setDate(s.getDate()+1)}while(this.isOnHolidayOrWeekEnd(s,!0));this.parent.includeWeekend||this.getNextWorkingDay(s)}if(s.getTime()<=o.getTime()){d++;var u=this.parent.getSecondsPerDay(s);if(l+=n?u:86400-u,s.setDate(s.getDate()+1),a){if(this.isOnHolidayOrWeekEnd(s,!0))do{s.setDate(s.getDate()+1)}while(this.isOnHolidayOrWeekEnd(s,!0));this.parent.includeWeekend||this.getNextWorkingDay(s)}}}return n&&(l>0?l/=d:l=this.parent.secondsPerDay),l},i.prototype.getDuration=function(e,t,i,a,r,n){if(void 0===n&&(n=!0),!e||!t)return null;var s,o=0,l=this.parent.getFormatedDate(e)===this.parent.getFormatedDate(t);if(this.parent.weekWorkingTime.length>0){var d=new Date(e);s=this.nonWorkingSeconds(e,t,a,void 0,!0);for(var h=0;d<=t;){var p=this.parent.getFormatedDate(d),u=this.parent.getSecondsPerDay(d),c=new Date(d),g=new Date(d);c.setHours(0,0,0,0),g.setHours(0,0,0,0),c.setSeconds(this.parent.getCurrentDayStartTime(d)),g.setSeconds(this.parent.getCurrentDayEndTime(d)),p===this.parent.getFormatedDate(e)&&c.setTime(e.getTime()),p===this.parent.getFormatedDate(t)&&g.setTime(t.getTime());var f=this.getTimeDifference(c,g,n)/1e3,m=this.getNonworkingTime(c,g,a,n);h+=Math.max(0,f-m)/u,d.setDate(d.getDate()+1)}r&&l||(o=this.calculateDurationValue(i,h,s))}else{s=this.parent.secondsPerDay;var y=this.getTimeDifference(e,t,n)/1e3-this.getNonworkingTime(e,t,a,n);r&&l||(o=this.calculateDurationValue(i,y/s,s))}return parseFloat(o.toString())},i.prototype.calculateDurationValue=function(e,t,i){return e&&"day"!==e?"minute"===e?t*(i/60):t*(i/3600):t},i.prototype.getDurationAsSeconds=function(e,t,i){var a;return a=this.parent.weekWorkingTime.length>0?this.parent.getSecondsPerDay(i):this.parent.secondsPerDay,t&&"day"!==t.toLocaleLowerCase()?"hour"===t.toLocaleLowerCase()?3600*e:60*e:a*e},i.prototype.getEndDate=function(e,t,i,a,r,n){var s,o=new Date(e.getTime()),l=new Date(e.getTime()),d=new Date(e.getTime());s=this.parent.weekWorkingTime.length>0&&(!i||"day"===i.toLocaleLowerCase())?this.calculateSecondDuration(t,d,s,e,!0):this.getDurationAsSeconds(t,i,e);for(;s>0;)l.setSeconds(l.getSeconds()+s),(s-=s-this.getNonworkingTime(o,l,a.isAutoSchedule,!0,n))>0&&(l=this.checkStartDate(l,a,r,void 0,n)),o=new Date(l.getTime());return l},i.prototype.getStartDate=function(e,t,i,a,r,n){var s,o=new Date(e.getTime()),l=new Date(e.getTime()),d=new Date(o.getTime());s=this.parent.weekWorkingTime.length>0?this.calculateSecondDuration(t,d,s,o,!1):this.getDurationAsSeconds(t,i,o);for(;s>0;)l.setSeconds(l.getSeconds()-s),(s-=s-this.getNonworkingTime(l,o,a.isAutoSchedule,!0,n))>0&&(o=this.checkEndDate(l,a,n)),o=new Date(l.getTime());if(r&&a.isMilestone){l.setDate(l.getDate()-1);var h=this.parent.getCurrentDayEndTime(a.endDate?a.isAutoSchedule?a.endDate:a.autoEndDate:l);this.parent.dateValidationModule.setTime(h,l),l=this.parent.dateValidationModule.checkStartDate(l,a,!0)}return l},i.prototype.calculateSecondDuration=function(e,t,i,a,r){if(e<1)i=this.parent.getSecondsPerDay(t)*e;else{i=0;var n=e,s=this.parent.getCurrentDayStartTime(t),o=this.parent.getCurrentDayEndTime(t);for(t.getHours()<o/3600&&t.getHours()>s/3600||!this.fromSegments||(r?t.setDate(t.getDate()+1):t.setDate(t.getDate()-1));n>0;){if(this.isOnHolidayOrWeekEnd(t,!0))do{r?t.setDate(t.getDate()+1):t.setDate(t.getDate()-1)}while(this.isOnHolidayOrWeekEnd(t,!0));this.parent.includeWeekend||(t=r?this.getNextWorkingDay(t):this.getPreviousWorkingDay(t));var l=this.parent.getSecondsPerDay(t),d=0;if(this.getSecondsInDecimal(a)!==this.parent.getStartTime(a)&&!Number.isInteger(n)){var h=e.toString().split(".");l*=d=parseFloat("."+h[1]),n-=d}n<1&&(l*=n),i+=l,r?t.setDate(t.getDate()+1):t.setDate(t.getDate()-1),d||n--}}return i},i.prototype.getProjectStartDate=function(e,i){if(!t.isNullOrUndefined(this.parent.cloneProjectStartDate)){"string"==typeof this.parent.cloneProjectStartDate&&(this.parent.cloneProjectStartDate=this.getDateFromFormat(this.parent.cloneProjectStartDate));o=this.checkStartDate(this.parent.cloneProjectStartDate);return this.parent.cloneProjectStartDate=o,new Date(o.getTime())}if(t.isNullOrUndefined(this.parent.projectStartDate)){if(t.isNullOrUndefined(i))return null;var a=this.parent.flatData,r=void 0;a.length>0?r=a[0].ganttProperties.startDate:(r=new Date).setHours(0,0,0,0);for(var n=1;n<a.length;n++){var s=a[n].ganttProperties.startDate;t.isNullOrUndefined(s)||-1!==this.compareDates(s,r)||(r=s)}this.parent.cloneProjectStartDate=this.checkStartDate(r,e)}else{var o=this.getDateFromFormat(this.parent.projectStartDate);this.parent.cloneProjectStartDate=this.checkStartDate(o)}return new Date(this.parent.cloneProjectStartDate.getTime())},i.prototype.getValidStartDate=function(e,i,a){var r=null,n=a?e.baselineStartDate:i?e.autoStartDate:e.startDate,s=a?e.baselineEndDate:i?e.autoEndDate:e.endDate,o=!e.isAutoSchedule&&e.autoDuration?e.autoDuration:e.duration;if(t.isNullOrUndefined(n))if(t.isNullOrUndefined(s)){if(!t.isNullOrUndefined(o)){var l=this.parent.getTaskByUniqueID(e.uniqueID);if(this.parent.allowUnscheduledTasks&&l&&l.parentItem&&t.isNullOrUndefined(n)&&t.isNullOrUndefined(s)){for(var d=this.parent.getParentTask(l.parentItem);d&&!d.ganttProperties.startDate;)d=this.parent.getParentTask(d.parentItem);r=d&&d.ganttProperties.startDate?d.ganttProperties.startDate:this.parent.cloneProjectStartDate}else r=this.getProjectStartDate(e)}}else{r=new Date(s.getTime());var h=this.parent.getCurrentDayStartTime(r);this.setTime(h,r)}else r=new Date(n.getTime());return r},i.prototype.getValidEndDate=function(e,i,a){var r=null,n=a?e.baselineStartDate:i?e.autoStartDate:e.startDate,s=a?e.baselineEndDate:i?e.autoEndDate:e.endDate,o=i?e.autoDuration:e.duration;if(t.isNullOrUndefined(s))if(t.isNullOrUndefined(n)){if(!t.isNullOrUndefined(o)){var l=this.getValidStartDate(e);l&&(r=this.getEndDate(l,o,e.durationUnit,e,!1))}}else if(e.isMilestone)r=this.checkStartDate(n);else{r=new Date(n.getTime());var d=this.parent.getCurrentDayEndTime(s||r);this.setTime(d,r)}else r=new Date(s.getTime());return r},i.prototype.getWorkingTime=function(e,i,a,r,n,s,o,l){if(!t.isNullOrUndefined(i.from)&&!t.isNullOrUndefined(i.to)){a.setHours(0,0,0,0);var d=new Date(a.getTime());a.setTime(a.getTime()+36e5*i.from);var h=new Date(a.getTime());if(24===i.to){d.setTime(d.getTime()+864e5)}else d.setTime(d.getTime()+36e5*i.to);var p=new Date(d.getTime()),u=p.getTime()-h.getTime(),c=this.getSecondsInDecimal(h),g=this.getSecondsInDecimal(p);0===g&&(g=86400),r+=u/1e3,0===n&&(this.parent.defaultStartTime=c,this.parent.weekWorkingTime.length>0&&this.assignStartTime(e,c)),n!==this[e.toLowerCase()+"TimeRangeLength"]-1&&""!==e||(this.parent.defaultEndTime=g,this.parent.weekWorkingTime.length>0&&this.assignEndTime(e,g)),n>0?""===e?(s.push(s[s.length-1]+c-o[n-1].to),o[n-1].to<c&&l.push({from:o[n-1].to,to:c,isWorking:!1,interval:c-o[n-1].to})):(this.parent[e.toLowerCase()+"NonWorkingHours"].push(this.parent[e.toLowerCase()+"NonWorkingHours"][this.parent[e.toLowerCase()+"NonWorkingHours"].length-1]+c-this.parent[e.toLowerCase()+"NonWorkingTimeRanges"][n-1].to),this.parent[e.toLowerCase()+"WorkingTimeRanges"][n-1].to<c&&this.parent[e.toLowerCase()+"NonWorkingTimeRanges"].push({from:this.parent[e.toLowerCase()+"WorkingTimeRanges"][n-1].to,to:c,isWorking:!1,interval:c-this.parent[e.toLowerCase()+"WorkingTimeRanges"][n-1].to})):""===e?(s.push(0),l.push({from:0,to:c,isWorking:!1,interval:c})):(this.parent[e.toLowerCase()+"NonWorkingHours"].push(0),this.parent[e.toLowerCase()+"NonWorkingTimeRanges"].push({from:0,to:c,isWorking:!1,interval:c})),""===e?(o.push({from:c,to:g}),l.push({from:c,to:g,isWorking:!0,interval:g-c})):(this.parent[e.toLowerCase()+"WorkingTimeRanges"].push({from:c,to:g}),this.parent[e.toLowerCase()+"NonWorkingTimeRanges"].push({from:c,to:g,isWorking:!0,interval:g-c}))}return r},i.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}},i.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}},i.prototype.calculateWeekWorkTime=function(e,t,i,a,r,n,s){for(var o=0,l=0;l<t.length;l++){var d=t[l];o+=this.getWorkingTime(e,d,i,a,l,r,n,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},i.prototype.getSecondsPerDay=function(){var e=0,i=new Date("10/11/2018");this.parent.nonWorkingHours=[];var a=this.parent.nonWorkingHours;this.parent.workingTimeRanges=[],this.parent.workingTimeRanges=[];var r=this.parent.workingTimeRanges;this.parent.nonWorkingTimeRanges=[];for(var n=this.parent.nonWorkingTimeRanges,s=0,o=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];s<o.length;s++)this[(y=o[s]).toLowerCase()+"TimeRangeLength"]=this.parent.dayWorkingTime.length;if(this.parent.weekWorkingTime.length>0){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=this.parent.weekWorkingTime,h=this.parent.dayWorkingTime,p=0,u=d;p<u.length;p++){var c=u[p];if(c.timeRange&&c.timeRange.length>0){var g=this.calculateWeekWorkTime(c.dayOfWeek,c.timeRange,i,e,a,r,n);this.parent[c.dayOfWeek.toLowerCase()+"Seconds"]=g}}for(var f=0,m=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];f<m.length;f++){var y=m[f],D=this.parent[y.toLowerCase()+"DefaultStartTime"];if(t.isNullOrUndefined(D)){var v=this.calculateWeekWorkTime(y,h,i,e,a,r,n);this.parent[y.toLowerCase()+"Seconds"]=v}}}for(var k=this.parent.dayWorkingTime,b=k.length,w=0,T=0;T<b;T++){var S=k[T];w+=this.getWorkingTime("",S,i,e,T,a,r,n)}return this.parent.defaultEndTime/3600!=24&&n.push({from:this.parent.defaultEndTime,to:86400,isWorking:!1,interval:86400-this.parent.defaultEndTime}),e=w},i.prototype.getDurationValue=function(e){var i=null,a=null;if("string"==typeof e){var r=e.match(/(\d*\.*\d+|.+$)/g);if(r&&r.length<=2){a=parseFloat(r[0].toString().trim());var n=r[1]?r[1].toString().trim().toLowerCase():null;-1!==t.getValue("minute",this.parent.durationUnitEditText).indexOf(n)?i="minute":-1!==t.getValue("hour",this.parent.durationUnitEditText).indexOf(n)?i="hour":-1!==t.getValue("day",this.parent.durationUnitEditText).indexOf(n)&&(i="day")}}else a=e,i=null;return{duration:a,durationUnit:i}},i.prototype.getNextWorkingDay=function(e){var t=e.getDay();return-1!==this.parent.nonWorkingDayIndex.indexOf(t)?(e.setDate(e.getDate()+1),e=this.getNextWorkingDay(e)):e},i.prototype.getWeekendCount=function(e,t){var i=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+=1),a.setDate(a.getDate()+1);return i},i.prototype.getNumberOfSeconds=function(e,t,i){var a=new Date(e.getTime()),r=new Date(t.getTime()),n=0;return a.setDate(a.getDate()+1),a.setHours(0,0,0,0),r.setHours(0,0,0,0),a.getTime()<r.getTime()&&(n=this.getTimeDifference(a,r,i)/1e3),n%86400!=0&&(n=n-n%86400+86400),n},i.prototype.getHolidaysCount=function(e,t){var i=0,a=this.parent.totalHolidayDates,r=new Date(e.getTime()),n=new Date(t.getTime());if(r.setDate(r.getDate()+1),r.setHours(0,0,0,0),n.setHours(0,0,0,0),r.getTime()<n.getTime())for(var s=0;s<a.length;s++){var o=this.getDateFromFormat(new Date(a[s]));r.getTime()<=o.getTime()&&n.getTime()>o.getTime()&&(!this.parent.includeWeekend&&-1===this.parent.nonWorkingDayIndex.indexOf(o.getDay())||this.parent.includeWeekend)&&(i+=1)}return i},i.prototype.getHolidayDates=function(){for(var e=this.parent.holidays,i=[],a=0;a<e.length;a++){var r=this.getDateFromFormat(e[a].from),n=this.getDateFromFormat(e[a].to);if(!t.isNullOrUndefined(r)||!t.isNullOrUndefined(n))if(t.isNullOrUndefined(r)||t.isNullOrUndefined(n)){var s=r||n;s.setHours(0,0,0,0),-1===i.indexOf(s.getTime())&&i.push(s.getTime())}else for(;r<=n;)r.setHours(0,0,0,0),-1===i.indexOf(r.getTime())&&i.push(r.getTime()),r.setDate(r.getDate()+1)}return i},i.prototype.isOnHolidayOrWeekEnd=function(e,i){if(i=t.isNullOrUndefined(i)?this.parent.includeWeekend:i,this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||(i=!0),!i&&-1!==this.parent.nonWorkingDayIndex.indexOf(e.getDay()))return!0;for(var a=this.parent.totalHolidayDates,r=0;r<a.length;r++){var n=this.getDateFromFormat(new Date(a[r])),s=new Date(n.getTime());if(n.setHours(0,0,0,0),s.setHours(23,59,59,59),e.getTime()>=n.getTime()&&e.getTime()<s.getTime())return!0}return!1},i.prototype.getNonWorkingSecondsOnDate=function(e,i,a,r){var n,s,o=this.getSecondsInDecimal(e),l=this.getSecondsInDecimal(i),d=-1,h=-1,p=0,u=!(!a||!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||r)&&this.isOnHolidayOrWeekEnd(e,null),c=!(!a||!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||r)&&this.isOnHolidayOrWeekEnd(i,null);if(this.parent.weekWorkingTime.length>0){n=this.parent.getNonWorkingRange(e);for(f=0;f<n.length;f++)o>=(g=n[f]).from&&o<=g.to&&(d=f);s=this.parent.getNonWorkingRange(i);for(f=0;f<s.length;f++)l>=(g=s[f]).from&&l<=g.to&&(h=f)}else{n=this.parent.nonWorkingTimeRanges,s=this.parent.nonWorkingTimeRanges;for(f=0;f<n.length;f++){var g=n[f];o>=g.from&&o<=g.to&&(d=f),l>=g.from&&l<=g.to&&(h=f)}}if(e.getDate()!==i.getDate()||e.getMonth()!==i.getMonth()||e.getFullYear()!==i.getFullYear()){if(u)p+=86400-o;else for(f=d;f<n.length;f++)t.isNullOrUndefined(n[f])||n[f].isWorking||(p+=f===d?n[f].to-o:n[f].interval);if(c)p+=l;else for(f=0;f<=h;f++)s[f].isWorking||(p+=f===h?l-s[f].from:s[f].interval)}else if(d!==h)if(c)p+=l-o;else for(var f=d;f<=h;f++)t.isNullOrUndefined(n[f])||n[f].isWorking||(p+=f===d?n[f].to-o:f===h?l-n[f].from:n[f].interval);else c?p+=l-o:n[d].isWorking||(p=l-o);return p},i.prototype.getPreviousWorkingDay=function(e){var t=e.getDay(),i=0===t?6:t-1,a=this.parent.getCurrentDayEndTime(e);return-1!==this.parent.nonWorkingDayIndex.indexOf(t)||-1!==this.parent.nonWorkingDayIndex.indexOf(i)&&86400!==a&&0===this.getSecondsInDecimal(e)?(e.setDate(e.getDate()-1),-1!==this.parent.nonWorkingDayIndex.indexOf(e.getDay())&&(e=this.getPreviousWorkingDay(e)),e):e},i.prototype.getNonWorkingDayIndex=function(){var e=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],t=e.length;0===this.parent.workWeek.length&&(this.parent.workWeek=["Monday","Tuesday","Wednesday","Thursday","Friday"]);for(var i=this.parent.workWeek.slice(),a=i.length,r=0;r<a;r++)i[r]=i[r].toLowerCase();this.parent.nonWorkingDayIndex=[];for(r=0;r<t;r++)-1===i.indexOf(e[r])&&this.parent.nonWorkingDayIndex.push(r)},i.prototype.setTime=function(e,t){var i=e/3600,a=(e-3600*(i=parseInt(i,10)))/60,r=e-3600*i-60*(a=parseInt(a,10));t.setHours(i,a,r)},i.prototype.getTimeDifference=function(e,t,i){var a=new Date(e.getTime()),r=new Date(t.getTime());return i&&this.updateDateWithTimeZone(a,r),r.getTime()-a.getTime()},i.prototype.updateDateWithTimeZone=function(e,t){var i,a,r=e.getTimezoneOffset(),n=t.getTimezoneOffset();if(r!==n){var s=new Date((new Date).getFullYear(),0,1).getTimezoneOffset();if(s!==r?(a=e,i=r):s!==n&&(a=t,i=n),s<0){o=s-i;a.setTime(a.getTime()+60*o*1e3)}else if(s>=0){var o=i-s;a.setTime(a.getTime()-60*o*1e3)}}},i.prototype.getSecondsInDecimal=function(e){return 60*e.getHours()*60+60*e.getMinutes()+e.getSeconds()+e.getMilliseconds()/1e3},i.prototype.offset=function(e,t){var i=e.getTimezoneOffset();try{var a=new Date(e.toLocaleString("en-US",{timeZone:t}));return isNaN(a.getTime())?0:(e.getTime()-a.getTime())/6e4+i}catch(e){return 0}},i.prototype.remove=function(e,i){return t.isNullOrUndefined(e)||(e=this.reverse(e,i,e.getTimezoneOffset())),e},i.prototype.reverse=function(e,t,i){"string"==typeof t&&(t=this.offset(e,t)),"string"==typeof i&&(i=this.offset(e,i));var a=e.getTimezoneOffset(),r=(e=new Date(e.getTime()+6e4*(t-i))).getTimezoneOffset();return new Date(e.getTime()+6e4*(r-a))},i.prototype.convert=function(e,t){var i=e.getTimezoneOffset(),a=this.offset(e,t);"string"==typeof i&&(i=this.offset(e,i)),"string"==typeof a&&(a=this.offset(e,a));var r=e.getTimezoneOffset(),n=(e=new Date(e.getTime()+6e4*(i-a))).getTimezoneOffset();return new Date(e.getTime()+6e4*(n-r))},i.prototype.getDateFromFormat=function(e,i){var a;if(t.isNullOrUndefined(e))return null;if(e instanceof Date)a=new Date(e.getTime());else{var r=this.parent.globalize.parseDate(e,{format:this.parent.getDateFormat(),type:"dateTime"});a=t.isNullOrUndefined(r)&&!isNaN(new Date(e).getTime())?new Date(e):r}return!t.isNullOrUndefined(this.parent.timezone)&&i?this.convert(a,this.parent.timezone):a},i.prototype.compareDates=function(e,i){return t.isNullOrUndefined(e)||t.isNullOrUndefined(i)?!t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)?1:t.isNullOrUndefined(e)&&!t.isNullOrUndefined(i)?-1:null:e.getTime()>i.getTime()?1:e.getTime()<i.getTime()?-1:0},i.prototype.getDurationString=function(e,i){var a="";if(!t.isNullOrUndefined(e)&&(a+=parseFloat(e.toFixed(2))+" ",!t.isNullOrUndefined(i))){var r=1!==e;"day"===i?a+=r?this.parent.localeObj.getConstant("days"):this.parent.localeObj.getConstant("day"):"hour"===i?a+=r?this.parent.localeObj.getConstant("hours"):this.parent.localeObj.getConstant("hour"):"minute"===i&&(a+=r?this.parent.localeObj.getConstant("minutes"):this.parent.localeObj.getConstant("minute"))}return a},i.prototype.getWorkString=function(e,i){var a="";if(!t.isNullOrUndefined(e)&&(a+=parseFloat(e).toFixed(2)+" ",!t.isNullOrUndefined(i))){var r=1!==e;"day"===i?a+=r?this.parent.localeObj.getConstant("days"):this.parent.localeObj.getConstant("day"):"hour"===i?a+=r?this.parent.localeObj.getConstant("hours"):this.parent.localeObj.getConstant("hour"):"minute"===i&&(a+=r?this.parent.localeObj.getConstant("minutes"):this.parent.localeObj.getConstant("minute"))}return a},i.prototype.calculateProjectDatesForValidatedTasks=function(e){var i=this,a="string"==typeof this.parent.projectStartDate?new Date(this.parent.projectStartDate):this.parent.projectStartDate,r="string"==typeof this.parent.projectEndDate?new Date(this.parent.projectEndDate):this.parent.projectEndDate,n=null,s=null,o=t.getValue("dataOperation.dataArray",this.parent);if(a&&r||!o||0!==o.length){if(o.length>0){var l=o.slice().sort(function(e,t){return new Date(e[i.parent.taskFields.startDate]).getTime()-new Date(t[i.parent.taskFields.startDate]).getTime()}),d=o.slice().sort(function(e,t){return new Date(t[i.parent.taskFields.endDate]).getTime()-new Date(e[i.parent.taskFields.endDate]).getTime()});n=l[0][this.parent.taskFields.startDate],s=d[d.length-1][this.parent.taskFields.endDate]}}else n=this.getDateFromFormat(new Date),s=this.getDateFromFormat(new Date(n.getTime()));this.parent.cloneProjectStartDate=a?new Date(a.getTime()):"string"==typeof n?new Date(n):n,this.parent.cloneProjectEndDate=r?new Date(r.getTime()):"string"==typeof s?new Date(s):s},i.prototype.calculateProjectDates=function(e){var i=this;if(this.parent.isLoad&&this.parent.enablePersistence&&this.parent.cloneProjectStartDate&&this.parent.cloneProjectEndDate)return this.parent.cloneProjectStartDate=this.getDateFromFormat(this.parent.cloneProjectStartDate),void(this.parent.cloneProjectEndDate=this.getDateFromFormat(this.parent.cloneProjectEndDate));var a="string"==typeof this.parent.projectStartDate?new Date(this.parent.projectStartDate):this.parent.projectStartDate,r="string"==typeof this.parent.projectEndDate?new Date(this.parent.projectEndDate):this.parent.projectEndDate,n=this.parent.timelineModule.isZooming&&this.parent.cloneProjectStartDate?this.getDateFromFormat(this.parent.cloneProjectStartDate):this.getDateFromFormat(a),s=this.parent.timelineModule.isZooming&&this.parent.cloneProjectEndDate?this.getDateFromFormat(this.parent.cloneProjectEndDate):this.getDateFromFormat(r),o=null,l=null,d=this.parent.flatData,h=this.parent.currentViewData,p=[],u=function(e){t.isNullOrUndefined(e)||p.push(e)},c=function(e){e.length>0&&(e.sort(function(e,t){return e.getTime()-t.getTime()}),o=new Date(e[0].getTime()),l=e.length>1?new Date(e[e.length-1].getTime()):null)};if((!n||!s)&&d.length>0||e||this.parent.timelineModule.isZoomToFit){(h.length>0&&this.parent.timelineModule.isZoomToFit&&this.parent.treeGrid.filterModule&&this.parent.treeGrid.filterModule.filteredResult.length>0?h:d).forEach(function(e){p=[];var a,r,n=e.ganttProperties;t.isNullOrUndefined(n.startDate)&&t.isNullOrUndefined(n.endDate)?(a=null,r=null):(a=i.getValidStartDate(n),r=i.getValidEndDate(n)),u(o),u(l),u(a),u(r),i.parent.renderBaseline&&!i.parent.timelineModule.isZoomToFit&&(u(n.baselineStartDate),u(n.baselineEndDate)),n.indicators&&n.indicators.length>0&&!i.parent.timelineModule.isZoomToFit&&n.indicators.forEach(function(e){u(i.getDateFromFormat(e.date))}),c(p)}),p=[],u(o),u(l),this.parent.eventMarkers.length>0&&!this.parent.timelineModule.isZoomToFit&&this.parent.eventMarkers.forEach(function(e,t){u(i.getDateFromFormat(e.day))}),this.parent.totalHolidayDates.length>0&&!this.parent.timelineModule.isZoomToFit&&this.parent.totalHolidayDates.forEach(function(e,t){u(new Date(e))}),c(p),o&&l||(o?o=t.isNullOrUndefined(o)?this.getDateFromFormat(new Date):o:(o=t.isNullOrUndefined(o)?this.getDateFromFormat(new Date):o).setHours(0,0,0,0),(l=this.getDateFromFormat(new Date(o.getTime()))).setDate(l.getDate()+20))}else n&&s||0!==d.length||(o=this.getDateFromFormat(new Date),l=this.getDateFromFormat(new Date(o.getTime())));e?(t.setValue("minStartDate",o,e),t.setValue("maxEndDate",l,e)):(this.prevProjectStartDate=this.parent.cloneProjectStartDate,this.parent.cloneProjectStartDate=o?this.parent.timelineModule.isZoomToFit?o:t.isNullOrUndefined(n)?o:new Date(n.getTime()):new Date(n.getTime()),this.parent.cloneProjectEndDate=l?this.parent.timelineModule.isZoomToFit?l:t.isNullOrUndefined(s)?l:new Date(s.getTime()):new Date(s.getTime())),this.parent.isProjectDateUpdated=!0},i.prototype.splitTasksDuration=function(e){var t=0,i=e[0].startDate,a=e[e.length-1].endDate;return"Hour"===this.parent.timelineModule.bottomTier?t+=Math.ceil(this.getTimeDifference(i,a)/36e5):"Minutes"===this.parent.timelineModule.bottomTier?t+=Math.ceil(this.getTimeDifference(i,a)/6e4):t+=Math.ceil(this.getTimeDifference(i,a)/864e5),t},i}(),I=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),E=function(e){function i(t){var i=e.call(this,t)||this;return i.customSegmentProperties=[],i.isBaseline=!1,i.uid=0,i.isTaskIDInteger=!0,i.recordIndex=0,i.taskIds=[],i.hierarchyData=[],i.addEventListener(),i}return I(i,e),i.prototype.addEventListener=function(){this.parent.on("beforeDataManipulate",this.checkDataBinding.bind(this))},i.prototype.checkDataBinding=function(e){var i=this;if(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=[]),t.isNullOrUndefined(this.parent.dataSource))this.parent.dataSource=[],this.parent.processTimeline(),this.parent.renderGantt(e);else if(this.parent.dataSource instanceof a.DataManager)this.initDataSource(e);else{if(this.parent.dataSource instanceof Object&&y(this.parent)){var r=t.getValue("result",this.parent.dataSource);this.dataArray=r}else 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)})},i.prototype.processTimeline=function(){this.parent.processTimeline(),this.parent.enableValidation||(this.parent.dataOperation.calculateProjectDatesForValidatedTasks(),this.parent.timelineModule.validateTimelineProp())},i.prototype.initDataSource=function(e){var t=this,i=this.parent.query instanceof a.Query?this.parent.query:new a.Query;i.requiresCount();var r=this.parent.dataSource;this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?(this.processTimeline(),this.parent.renderGantt(e)):r.executeQuery(i).then(function(i){t.dataArray=i.result,t.processTimeline(),(!t.parent.loadChildOnDemand||t.parent.loadChildOnDemand&&!t.parent.taskFields.hasChildMapping)&&t.cloneDataSource(),t.parent.renderGantt(e)}).catch(function(i){t.parent.processTimeline(),t.parent.renderGantt(e),t.parent.trigger("actionFailure",{error:i})})},i.prototype.constructDataSource=function(e){for(var i,r=new a.DataManager(e).executeLocal((new a.Query).group(this.parent.taskFields.parentID)),n=[],s=0;s<r.length;s++){var o=r[s];!t.isNullOrUndefined(o.key)&&(i=this.taskIds.indexOf(o.key.toString()))>-1&&!t.isNullOrUndefined(o.key)?e[i][this.parent.taskFields.child]=o.items:(-1!==i||this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)&&n.push.apply(n,o.items)}this.hierarchyData=this.dataReorder(e,n)},i.prototype.cloneDataSource=function(){var e=this.parent.taskFields.id,i=this.parent.taskFields.parentID,r=[];if(t.isNullOrUndefined(e)||t.isNullOrUndefined(i))r=this.dataArray;else{var n=[],s=void 0;this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping&&!this.parent.enableVirtualization&&(s=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,n.push(t.extend({},{},l,!0)),t.isNullOrUndefined(l[e])||this.taskIds.push(l[e].toString())}this.parent.taskFields.child||this.parent.setProperties({taskFields:{child:"Children"}},!0),t.isNullOrUndefined(s)?this.constructDataSource(n):(this.constructDataSource(this.dataArray),this.dataArray=s),r=this.hierarchyData}if(this.parent.taskFields.segmentId&&(this.segmentCollection=new a.DataManager(this.parent.segmentData).executeLocal((new a.Query).group(this.parent.taskFields.segmentId)),this.parent.taskFields.segments||(this.parent.taskFields.segments="Segments")),"ProjectView"!==this.parent.viewType){var d=t.extend([],[],this.parent.resources,!0),h=[];if(this.constructResourceViewDataSource(d,r,h),h.length>0){var p={},u=this.parent.resourceFields.name||"resourceName";p[this.parent.resourceFields.id]=0,p[u]=this.parent.localeObj.getConstant("unassignedTask"),p[this.parent.taskFields.child]=h,d.push(p)}r=d}this.prepareDataSource(r)},i.prototype.constructResourceViewDataSource=function(e,t,i){for(var a=this,r=0;r<t.length;r++)!function(r){var n=t[r],s=null!==a.parent.taskFields.child?a.parent.taskFields.child:a.parent.taskFields.child="Children",o=n&&n[a.parent.taskFields.resourceInfo],l=a.parent.resourceFields.id;if(n[s]&&0!==n[s].length||!o||!o.length)(!n[s]||n[s]&&0===n[s].length)&&i.push(n);else if("string"==typeof o){a.isResourceString=!0;for(var d=o,h=0;h<e.length;h++)if(e[h][a.parent.resourceFields.name].toString()===d.toString()){e[h][s]?e[h][s].push(n):e[h][s]=[n];break}}else o.forEach(function(t){for(var i="object"==typeof t?t[l]:t,a=0;a<e.length;a++)if(e[a][l].toString()===i.toString()){e[a][s]?e[a][s].push(n):e[a][s]=[n];break}});n[a.parent.taskFields.child]&&n[a.parent.taskFields.child].length&&a.constructResourceViewDataSource(e,n[a.parent.taskFields.child],i)}(r)},i.prototype.prepareDataSource=function(e){this.prepareRecordCollection(e,0),this.parent.initialLoadData=t.extend({},{},this.parent.flatData,!0),(!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)&&(this.parent.dataMap=this.parent.flatData.reduce(function(e,t){return e.set(t.uniqueID,t),e},new Map)),"ResourceView"===this.parent.viewType&&this.calculateSharedTaskUniqueIds(),this.parent.taskFields.dependency&&this.parent.predecessorModule&&this.parent.predecessorModule.ensurePredecessorCollection()},i.prototype.calculateSharedTaskUniqueIds=function(){for(var e=this,t=0;t<this.parent.getTaskIds().length;t++)!function(t){var i=[];if(i[0]=e.parent.getTaskIds()[t][0],i[1]=e.parent.getTaskIds()[t].slice(1),"R"!==i[0]){var a=[],r=[];e.parent.flatData.filter(function(e){e.ganttProperties.taskId.toString()===i[1]&&0!==e.level&&(r.push(e.ganttProperties.rowUniqueID),a.push(e))});for(var n=0;n<a.length;n++)a[n].ganttProperties.sharedTaskUniqueIds=r}}(t)},i.prototype.prepareRecordCollection=function(e,i,a){for(var r=this,n=e.length,s=this,o=0;o<n;o++)!function(n){var o=e[n];if(!t.isNullOrUndefined(s.parent.taskFields.segmentId)){var l=s.segmentCollection.filter(function(e){return e.key===o[r.parent.taskFields.id]});l.length>0&&(o[s.parent.taskFields.segments]=l[0].items)}s.parent.taskFields.hasChildMapping&&o.parentUniqueID&&(a=s.parent.getTaskByUniqueID(o.parentUniqueID)),!t.isNullOrUndefined(s.parent.taskFields.constraintDate)&&!t.isNullOrUndefined(s.parent.taskFields.constraintType)&&t.isNullOrUndefined(o[s.parent.taskFields.constraintDate])&&t.isNullOrUndefined(o[s.parent.taskFields.constraintType])&&(o[s.parent.taskFields.constraintType]=0,o[s.parent.taskFields.constraintDate]=t.isNullOrUndefined(o[s.parent.taskFields.startDate])?o[s.parent.taskFields.endDate]:o[s.parent.taskFields.startDate]);var d=s.createRecord(o,i,a,!0);(!s.parent.enableValidation||!s.parent.autoCalculateDateScheduling||s.parent.isLoad&&s.parent.treeGrid.loadChildOnDemand&&s.parent.taskFields.hasChildMapping)&&s.updateTaskLeftWidth(d),d.index=s.recordIndex++,s.parent.ids[d.index]=d.ganttProperties.rowUniqueID,s.parent.flatData.push(d),s.parent.setTaskIds(d);var h=o[s.parent.taskFields.child]||o.taskData&&o.taskData[s.parent.taskFields.child];if("ResourceView"===s.parent.viewType&&t.isNullOrUndefined(h)&&t.isNullOrUndefined(d.parentItem)&&0===d.level){var p=d.ganttProperties,u=d;s.parent.setRecordValue(p.isAutoSchedule?"startDate":"autoStartDate",null,u.ganttProperties,!0),s.parent.setRecordValue(p.isAutoSchedule?"endDate":"autoEndDate",null,u.ganttProperties,!0);var c=u.ganttProperties;s.parent.setRecordValue("isMilestone",!1,c,!0),c.isAutoSchedule&&s.calculateDuration(u),s.updateWorkWithDuration(u);var g=c.work;s.parent.setRecordValue("work",g,c,!0),s.parent.setRecordValue("taskType","FixedDuration",c,!0),t.isNullOrUndefined(s.parent.taskFields.type)||s.updateMappingData(u,"type"),s.parent.setRecordValue("progress",Math.floor(0),c,!0),s.parent.setRecordValue("totalProgress",0,c,!0),s.parent.setRecordValue("totalDuration",0,c,!0),c.isAutoSchedule||(s.parent.setRecordValue("autoDuration",s.calculateAutoDuration(c),c,!0),s.updateAutoWidthLeft(u)),s.parent.allowParentDependency||s.resetDependency(u),s.updateWidthLeft(u),s.updateTaskData(u)}s.parent.taskFields.hasChildMapping&&(a=null),!t.isNullOrUndefined(h)&&h.length>0&&s.prepareRecordCollection(h,d.level+1,d)}(o)},i.prototype.addCustomFieldValue=function(e,t){var i=this.parent.ganttColumns,a=i.length;if(a)for(var r=0;r<a;r++)void 0===t[i[r].field]&&this.parent.setRecordValue(i[r].field,e[i[r].field],t)},i.prototype.getGanttUid=function(e){return e+this.uid++},i.prototype.createRecord=function(e,i,a,r){var n=this.parent.taskFields,s=this.parent.resourceFields,o=e[n.progress],l=null,d=null,h=e[n.notes];o=100<(o=o&&parseFloat(o.toString())?parseFloat(o.toString()):0)?100:o;var p,u,c=e[n.dependency],g=this.getDateFromFormat(e[n.baselineStartDate],!0),f=this.getDateFromFormat(e[n.baselineEndDate],!0);this.parent.loadChildOnDemand&&n.hasChildMapping&&!this.parent.enableVirtualization?(p=e,u=JSON.parse(JSON.stringify(e))):p={};var m={},D="Auto"===this.parent.taskMode||"Manual"!==this.parent.taskMode&&!0!==e[n.manual];this.parent.setRecordValue("ganttProperties",m,p),e.ganttProperties&&e.ganttProperties.predecessor&&e.ganttProperties.predecessor.length>0&&this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.setRecordValue("predecessor",e.ganttProperties.predecessor,m,!0),t.isNullOrUndefined(e[n.id])?t.isNullOrUndefined(e[s.id])||(l=e[s.id],d=t.isNullOrUndefined(e[s.name])&&"Unassigned Task"===e.resourceName?e.resourceName:e[s.name],this.addTaskData(p,e,!1)):("number"==typeof(l=e[n.id])||/^-?\d+$/.test(l)||(this.isTaskIDInteger=!1),d=e[n.name],!!(this.parent.loadChildOnDemand&&n.hasChildMapping&&e.taskData)?p.taskData=e.taskData:e.taskData&&e.ganttProperties?this.addTaskData(p,e.taskData,r):this.addTaskData(p,e,r)),this.parent.setRecordValue("taskId",l,m,!0),this.parent.setRecordValue("taskName",d,m,!0),this.parent&&n.parentID&&this.parent.setRecordValue("parentId",e[n.parentID],m,!0),this.addCustomFieldValue(e,p),this.parent.setRecordValue("isAutoSchedule",D,m,!0),!this.parent.undoRedoModule||this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed?this.parent.setRecordValue("resourceInfo",this.setResourceInfo(e),m,!0):e.ganttProperties&&this.parent.setRecordValue("resourceInfo",e.ganttProperties.resourceInfo,m,!0),this.parent.setRecordValue("isMilestone",!1,m,!0),this.parent.setRecordValue("indicators",e[n.indicators],m,!0),this.updateResourceName(p),!t.isNullOrUndefined(e[n.child])&&e[n.child].length>0||e.taskData&&e.taskData[n.child]&&e.taskData[n.child].length>0?(this.parent.setRecordValue("hasChildRecords",!0,p),this.parent.setRecordValue("isMilestone",!1,m,!0),this.parent.allowParentDependency||this.resetDependency(p)):this.parent.loadChildOnDemand&&n.hasChildMapping&&p.taskData[n.hasChildMapping]?this.parent.setRecordValue("hasChildRecords",!0,p):this.parent.setRecordValue("hasChildRecords",!1,p);var v=e[n.constraintType];p.hasChildRecords?v&&0!==v&&4!==v&&7!==v&&(e[n.constraintType]=0):v&&(v<0||v>7)&&(e[n.constraintType]=0),this.parent.setRecordValue("constraintType",e[n.constraintType],m,!0),this.parent.setRecordValue("constraintDate",e[n.constraintDate],m,!0),r||(this.parent.setRecordValue("baselineStartDate",this.checkBaselineStartDate(g,m),m,!0),e[n.baselineEndDate]?this.parent.setRecordValue("baselineEndDate",e[n.baselineEndDate],m,!0):this.parent.setRecordValue("baselineEndDate",this.checkBaselineEndDate(f,m),m,!0)),this.calculateScheduledValues(p,e,r),this.calculateScheduledValuesforBaseline(p,e,r),this.parent.setRecordValue("progress",o,m,!0),this.parent.setRecordValue("totalProgress",o,m,!0),e.ganttProperties&&e.ganttProperties.predecessorsName&&this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed?this.parent.setRecordValue("predecessorsName",e.ganttProperties.predecessorsName,m,!0):this.parent.setRecordValue("predecessorsName",c,m,!0),this.parent.setRecordValue("notes",h,m,!0),this.parent.setRecordValue("cssClass",e[n.cssClass],m,!0),this.parent.setRecordValue("parentItem",this.getCloneParent(a),p),this.parent.loadChildOnDemand&&n.hasChildMapping&&this.parent.currentViewData.length>0&&this.parent.setRecordValue("parentItem",p.parentItem,this.parent.currentViewData[this.taskIds.indexOf(e[n.id].toString())]);var k=p.parentItem?p.parentItem.uniqueID:null;if(this.parent.setRecordValue("parentUniqueID",k,p),"ResourceView"!==this.parent.viewType||t.isNullOrUndefined(n.parentID)||t.isNullOrUndefined(p.parentItem)||this.parent.setRecordValue("parentId",p.parentItem.taskId,m,!0),this.parent.setRecordValue("level",i,p),e.ganttProperties&&this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed?this.parent.setRecordValue("uniqueID",e.uniqueID,p):this.parent.loadChildOnDemand&&n.hasChildMapping&&e.uniqueID?this.parent.setRecordValue("uniqueID",e.uniqueID,p):this.parent.setRecordValue("uniqueID",this.getGanttUid(this.parent.element.id+"_data_"),p),this.parent.setRecordValue("uniqueID",p.uniqueID,m,!0),this.parent.setRecordValue("childRecords",[],p),this.parent.dataSource instanceof Object&&y(this.parent)&&!t.isNullOrUndefined(n.child)&&this.parent.setRecordValue(n.child,[],p),p.hasChildRecords&&(this.parent.setRecordValue("autoStartDate",p.ganttProperties.startDate,m),this.parent.setRecordValue("autoEndDate",p.ganttProperties.endDate,m),this.parent.setRecordValue("autoDuration",p.ganttProperties.duration,m)),this.parent.setRecordValue("expanded",!p.hasChildRecords||!this.parent.collapseAllParentTasks,p),t.isNullOrUndefined(u)?this.updateExpandStateMappingValue(p,e):this.updateExpandStateMappingValue(p,u),r||(this.parent.setRecordValue("width",this.calculateWidth(p),m,!0),this.parent.setRecordValue("left",this.calculateLeft(m,p),m,!0),this.parent.setRecordValue("progressWidth",this.getProgressWidth(m.width,o),m,!0),m.baselineEndDate&&m.baselineStartDate&&(this.parent.setRecordValue("baselineLeft",this.calculateBaselineLeft(m),m,!0),this.parent.setRecordValue("baselineWidth",this.calculateBaselineWidth(m),m,!0))),t.isNullOrUndefined(n.work)&&this.updateWorkWithDuration(p),t.isNullOrUndefined(n.manual)||this.parent.dataOperation.updateMappingData(p,"manual"),this.updateTaskData(p),c&&this.parent.predecessorsCollection.push(p),t.isNullOrUndefined(a)||(a.childRecords.push(p),this.parent.dataSource instanceof Object&&y(this.parent)&&!t.isNullOrUndefined(this.parent.taskFields.child)&&a[this.parent.taskFields.child].push(p.taskData)),"ProjectView"===this.parent.viewType)this.parent.setRecordValue("rowUniqueID",m.taskId.toString(),m,!0);else{var b=p.uniqueID.replace(this.parent.element.id+"_data_","");this.parent.setRecordValue("rowUniqueID",b,p),this.parent.setRecordValue("rowUniqueID",b,m,!0),this.parent.setRecordValue("sharedTaskUniqueIds",[],m,!0)}return this.parent.allowUnscheduledTasks&&p.ganttProperties.startDate&&(p.ganttProperties.endDate||p.ganttProperties.duration)&&(this.parent.setRecordValue("segments",this.setSegmentsInfo(p,!0),m,!0),this.parent.dataOperation.updateMappingData(p,"segments"),r||this.updateWidthLeft(p)),this.parent.chartRowsModule.updateSegment(p.ganttProperties.segments,p.ganttProperties.taskId),p},i.prototype.sortSegmentsData=function(e,t,i){var a=this;return t?e.sort(function(e,t){var i=a.parent.taskFields.startDate;return a.getDateFromFormat(e[i]).getTime()-a.getDateFromFormat(t[i]).getTime()}):e.sort(function(e,t){return e.startDate.getTime()-t.startDate.getTime()}),e},i.prototype.setSegmentsInfo=function(e,i){var a,r=this,n=this.parent.taskFields,s=[],o=0,l=0,d=0,h=[this.parent.taskFields.duration,this.parent.taskFields.endDate,this.parent.taskFields.startDate,this.parent.taskFields.id],p=[];if(!t.isNullOrUndefined(this.parent.taskFields.segments)&&(a=i?e.taskData[this.parent.taskFields.segments]:e.ganttProperties.segments,i||e.taskData[this.parent.taskFields.segments]&&e.taskData[this.parent.taskFields.segments].length>0&&e.taskData[this.parent.taskFields.segments].forEach(function(e){var t={},i={};for(var a in e)-1!==h.indexOf(a)?t[a]=e[a]:i[a]=e[a];r.customSegmentProperties.push(i)}),!t.isNullOrUndefined(a)&&a.length>1)){this.sortSegmentsData(a,i,e.ganttProperties);for(var u=0;u<a.length;u++){var c=a[u],g=i?c[n.startDate]:c.startDate,f=i?c[n.endDate]:c.endDate,m=i?c[n.duration]:c.duration;if(g=this.getDateFromFormat(g),g=this.checkStartDate(g,e.ganttProperties,!1),t.isNullOrUndefined(m)){if((f=this.getDateFromFormat(f))&&(t.isNullOrUndefined(m)||""===String(m))){k=void 0;k=this.parent.weekWorkingTime.length>0?this.parent.getEndTime(f):this.parent.defaultEndTime,0===f.getHours()&&86400!==k&&this.setTime(k,f)}if(f=this.checkEndDate(f,e.ganttProperties,!1),m=this.getDuration(g,f,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone),t.isNullOrUndefined(s[u-1])||(d=(d+=this.getDuration(s[u-1].endDate,g,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone))<1?1:d),n.duration){if((l=e.ganttProperties.duration-o-d)<=0)continue;m=u===a.length-1?l:l>0&&m>l?l:m,f=this.getEndDate(g,m,e.ganttProperties.durationUnit,e.ganttProperties,!1)}else if(!n.duration&&n.endDate&&f&&(m=this.getDuration(g,f,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone),s.length>0&&f.getTime()<g.getTime()&&f.getTime()<=e.ganttProperties.endDate.getTime())){s[u-1].duration=this.getDuration(s[u-1].startDate,e.ganttProperties.endDate,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone);continue}}else if(f=this.getEndDate(g,m,e.ganttProperties.durationUnit,e.ganttProperties,!1),n.duration){if((l=e.ganttProperties.duration-o)<=0)continue;m=u===a.length-1?l:l>0&&m>l?l:m,f=this.getEndDate(g,m,e.ganttProperties.durationUnit,e.ganttProperties,!1)}else if(!n.duration&&n.endDate&&f&&(f=!t.isNullOrUndefined(e.ganttProperties.endDate)&&f.getTime()>=e.ganttProperties.endDate.getTime()&&u===a.length-1?e.ganttProperties.endDate:f,m=this.getDuration(g,f,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone),s.length>0&&f.getTime()<g.getTime()&&f.getTime()<=e.ganttProperties.endDate.getTime())){s[u-1].duration=this.getDuration(s[u-1].startDate,e.ganttProperties.endDate,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone);continue}if(c={},!g||!f||!g||t.isNullOrUndefined(m))break;if(o+=Number(m),c.startDate=g,c.endDate=f,c.duration=Number(m),c.width=0,c.left=0,c.segmentIndex=u,s.push(c),t.isNullOrUndefined(s[u-1]))c.offsetDuration=0;else{var y=void 0;y=t.isNullOrUndefined(this.parent.timelineSettings.bottomTier)?e.ganttProperties.durationUnit:"Minutes"===this.parent.timelineSettings.bottomTier.unit?"minute":"Hour"===this.parent.timelineSettings.bottomTier.unit?"hour":e.ganttProperties.durationUnit;var D=this.getDuration(s[u-1].endDate,s[u].startDate,y,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone);if(c.offsetDuration=D,D<1){if(0===this.parent.weekWorkingTime.length)c.startDate=this.getEndDate(s[u-1].endDate,1,e.ganttProperties.durationUnit,e.ganttProperties,!1);else{var v=new Date(s[u-1].endDate.getTime());if(c.startDate=new Date(v.setHours(v.getHours()+24)),this.isOnHolidayOrWeekEnd(c.startDate,!0))do{c.startDate.setDate(c.startDate.getDate()+1)}while(this.isOnHolidayOrWeekEnd(c.startDate,!0));this.parent.includeWeekend||(c.startDate=this.getNextWorkingDay(c.startDate));var k=this.parent.getEndTime(s[u-1].endDate);this.getSecondsInDecimal(s[u-1].endDate)===k&&this.setTime(this.parent.getEndTime(c.startDate),c.startDate)}c.startDate=this.checkStartDate(c.startDate,e.ganttProperties,!1),c.endDate=this.getEndDate(c.startDate,c.duration,e.ganttProperties.durationUnit,e.ganttProperties,!1),c.endDate=!n.duration&&n.endDate&&c.endDate>e.ganttProperties.endDate?e.ganttProperties.endDate:c.endDate,c.offsetDuration=1}}var b=e[this.parent.taskFields.segments]?e[this.parent.taskFields.segments]:a;p.push(this.setSegmentTaskData(c,b[u]))}this.parent.setRecordValue("duration",o,e.ganttProperties,!0),t.isNullOrUndefined(s[s.length-1])||this.parent.setRecordValue("endDate",s[s.length-1].endDate,e.ganttProperties,!0),t.isNullOrUndefined(n.endDate)||t.isNullOrUndefined(s[s.length-1])||this.parent.setRecordValue(this.parent.taskFields.endDate,s[s.length-1].endDate,e,!0),!i&&p&&p.length>0&&p.forEach(function(e,t){var i=Object.assign({},e,r.customSegmentProperties[t]);p[t]=i}),this.parent.setRecordValue("taskData."+this.parent.taskFields.segments,p,e)}return s.length>1?(this.parent.setRecordValue("segments",s,e.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.segments,e.taskData[this.parent.taskFields.segments],e,!0)):s=null,s},i.prototype.setSegmentTaskData=function(e,i){var a=this.parent.taskFields,r=t.extend({},{},i,!0);return t.isNullOrUndefined(a.startDate)||(r[this.parent.taskFields.startDate]=e.startDate),t.isNullOrUndefined(a.endDate)||(r[this.parent.taskFields.endDate]=e.endDate),t.isNullOrUndefined(a.duration)||(r[this.parent.taskFields.duration]=Number(e.duration)),r},i.prototype.fetchResources=function(e){return this.parent.editModule&&this.parent.editModule.dialogModule&&(this.parent.editModule.dialogModule.isFromAddDialog||this.parent.editModule.dialogModule.isFromEditDialog)?this.parent.editModule.dialogModule.ganttResources:e.ganttProperties.resourceInfo},i.prototype.updateWorkWithDuration=function(e){if(this.parent.triggeredColumnName!==this.parent.taskFields.work||0===e.ganttProperties.duration||!t.isNullOrUndefined(e.ganttProperties.resourceInfo)&&0===e.ganttProperties.resourceInfo.length||e.hasChildRecords){var i,a=this.fetchResources(e),r=0;if(!t.isNullOrUndefined(a)&&a.length>0&&!e.hasChildRecords){var n=a.length,s=void 0,o=void 0,l=void 0,d=(l=this.parent.weekWorkingTime.length>0?this.parent.getSecondsPerDay(e.ganttProperties.startDate?e.ganttProperties.startDate:e.ganttProperties.endDate):this.parent.secondsPerDay)/3600,h=this.getDurationInDay(e.ganttProperties.duration,e.ganttProperties.durationUnit);for(s=0;s<n;s++)r+=(i=(o=a[s][this.parent.resourceFields.unit])>0?d*o/100:0)*h;"minute"===e.ganttProperties.workUnit&&(r*=60),"day"===e.ganttProperties.workUnit&&(r/=d),r%1!=0&&(r=parseFloat(r.toFixed(2)))}else!e.hasChildRecords&&!t.isNullOrUndefined(e.ganttProperties.work)&&!t.isNullOrUndefined(e.ganttProperties.duration)&&e.ganttProperties.duration>0&&(r=e.ganttProperties.work);if(e.childRecords&&e.childRecords.length>0&&this.parent.isOnEdit){for(var p=0,u=0;u<e.childRecords.length;u++)p+=e.childRecords[u].ganttProperties.work;r+=p}"FixedUnit"===e.ganttProperties.taskType&&0===i&&(r=0,this.parent.setRecordValue("duration",0,e.ganttProperties,!0),t.isNullOrUndefined(this.parent.taskFields.duration)||this.parent.setRecordValue(this.parent.taskFields.duration,0,e,!0)),this.parent.setRecordValue("work",r,e.ganttProperties,!0),t.isNullOrUndefined(this.parent.taskFields.work)||this.parent.isLoad||this.parent.dataOperation.updateMappingData(e,"work")}},i.prototype.getCloneParent=function(e){if(t.isNullOrUndefined(e))return null;var i={};return i.uniqueID=e.uniqueID,i.expanded=e.expanded,i.level=e.level,i.index=e.index,i.taskId=e.ganttProperties.rowUniqueID,i},i.prototype.reUpdateResources=function(){if(this.parent.flatData.length>0)for(var e=void 0,t=void 0,i=void 0,a=0;a<this.parent.flatData.length;a++)e=this.parent.flatData[a].taskData,t=this.parent.flatData[a].ganttProperties,i=this.parent.flatData[a],this.parent.setRecordValue("resourceInfo",this.setResourceInfo(e),t,!0),this.updateResourceName(i)},i.prototype.addTaskData=function(e,i,r){var n=this,s=this.parent.taskFields,o=this.parent.dataSource;if(r)if(s.parentID||o instanceof a.DataManager&&o.dataSource.json&&o.dataSource.offline)if(s.parentID){var l=i[s.id],d=this.taskIds.indexOf(l.toString()),h=d>-1?this.dataArray[d]:{};if(!t.isNullOrUndefined(this.parent.taskFields.segmentId)){var p=this.segmentCollection.filter(function(e){return e.key===h[n.parent.taskFields.id]});p.length>0&&(h[this.parent.taskFields.segments]=p[0].items)}this.parent.setRecordValue("taskData",h,e)}else this.parent.setRecordValue("taskData",i,e);else this.parent.setRecordValue("taskData",i,e);else this.parent.setRecordValue("taskData",i,e)},i.prototype.updateExpandStateMappingValue=function(e,i){var a,r=this.parent.taskFields.expandState,n=i[r];r&&e.hasChildRecords&&(t.isNullOrUndefined(n)?t.isNullOrUndefined(n)&&!this.parent.collapseAllParentTasks?a=!0:t.isNullOrUndefined(n)&&this.parent.collapseAllParentTasks&&(a=!1):(a="true"===n.toString(),this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping&&!this.parent.enableVirtualization&&i.expanded&&(a=!0)),this.parent.setRecordValue("taskData."+r,a,e),this.parent.setRecordValue(r,a,e),this.parent.setRecordValue("expanded",a,e))},i.prototype.setValidatedDates=function(e,i){var a=e.ganttProperties,r=this.parent.taskFields,n=i[r.duration],s=this.getDateFromFormat(i[r.startDate],!0),o=this.getDateFromFormat(i[r.endDate],!0);n=t.isNullOrUndefined(n)||""===n?null:n,this.parent.setRecordValue("startDate",new Date(s.getTime()),a,!0),t.isNullOrUndefined(n)||""===n?this.calculateDuration(e):this.updateDurationValue(n,a),this.parent.setRecordValue("endDate",new Date(o.getTime()),a,!0)},i.prototype.calculateScheduledValues=function(e,i,a){var r=this.parent.taskFields,n=e.ganttProperties,s=i[r.duration];s=t.isNullOrUndefined(s)||""===s?null:s;var o,l;n.startDate&&n.endDate?(o=this.getDateFromFormat(n.startDate,!0),l=this.getDateFromFormat(n.endDate,!0)):(o=this.getDateFromFormat(i[r.startDate],!0),l=this.getDateFromFormat(i[r.endDate],!0));var d=r.segments?i[r.segments]||e.taskData[r.segments]:null,h=!!r.milestone&&!!i[r.milestone],p=i[r.durationUnit]?i[r.durationUnit]:"";this.parent.setRecordValue("durationUnit",this.validateDurationUnitMapping(p),n,!0);var u=t.isNullOrUndefined(i[r.work])?0:parseFloat(i[r.work]);this.parent.setRecordValue("workUnit",this.validateWorkUnitMapping(this.parent.workUnit),n,!0);var c=i[r.type]?i[r.type]:"",g=this.validateTaskTypeMapping(c);if(this.parent.setRecordValue("taskType",g,n,!0),i[this.parent.resourceFields.name]===this.parent.localeObj.getConstant("unassignedTask")&&this.parent.setRecordValue("taskType","FixedDuration",n,!0),a&&!this.parent.enableValidation&&o&&l)this.setValidatedDates(e,i);else{if(l||o||!t.isNullOrUndefined(s)&&""!==s){if(o)this.calculateDateFromStartDate(o,l,s,e,a);else if(l)this.calculateDateFromEndDate(l,s,e);else if(!t.isNullOrUndefined(s)&&""!==s){this.updateDurationValue(s,n);var f=this.parent.allowUnscheduledTasks?null:this.getProjectStartDate(n,a);this.parent.setRecordValue("startDate",f,n,!0),this.parent.allowUnscheduledTasks?this.parent.setRecordValue("endDate",null,n,!0):this.calculateEndDate(e)}}else{if(this.parent.allowUnscheduledTasks)return;this.parent.setRecordValue("duration",1,n,!0),this.parent.setRecordValue("startDate",this.getProjectStartDate(n,a),n,!0),this.calculateEndDate(e)}if(this.parent.taskFields.constraintDate&&this.parent.taskFields.constraintType&&!e[this.parent.taskFields.dependency]){this.parent.setRecordValue("startDate",this.getDateByConstraint(n,n.startDate),n,!0),this.calculateEndDate(e);var m=n.constraintType,y=n.startDate,D=n.endDate,v=this.parent.predecessorModule.getConstraintDate(m,y,D);this.parent.setRecordValue("constraintDate",v,n,!0)}}if((!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)&&(t.isNullOrUndefined(e.ganttProperties.startDate)||t.isNullOrUndefined(this.parent.taskFields.startDate)||(e[this.parent.taskFields.startDate]=e.ganttProperties.startDate,e.taskData[this.parent.taskFields.startDate]=e.ganttProperties.startDate),t.isNullOrUndefined(e.ganttProperties.endDate)||t.isNullOrUndefined(this.parent.taskFields.endDate)||(e[this.parent.taskFields.endDate]=e.ganttProperties.endDate,e.taskData[this.parent.taskFields.endDate]=e.ganttProperties.endDate)),t.isNullOrUndefined(r.work))r.type&&n.taskType&&this.parent.dataOperation.updateMappingData(e,"type");else{var k=this.parent.taskFields.durationUnit&&i[r.durationUnit]?i[r.durationUnit]:this.parent.durationUnit;if(n.durationUnit=this.validateDurationUnitMapping(k),isNaN(u)||t.isNullOrUndefined(u))this.parent.setRecordValue("work",0,n,!0),this.parent.setRecordValue("duration",0,n,!0),this.parent.setRecordValue("isMilestone",!0,n,!0),t.isNullOrUndefined(this.parent.taskFields)||t.isNullOrUndefined(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!0,e,!0),this.parent.setRecordValue("endDate",n.startDate,n,!0);else{if(this.parent.setRecordValue("work",u,n,!0),!this.parent.undoRedoModule||this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed)switch(g){case"FixedDuration":(t.isNullOrUndefined(e[this.parent.taskFields.resourceInfo])||t.isNullOrUndefined(e.ganttProperties.resourceInfo)||0===e.ganttProperties.resourceInfo.length)&&0!==n.duration||this.updateWorkWithDuration(e);break;case"FixedWork":(t.isNullOrUndefined(e[this.parent.taskFields.resourceInfo])||t.isNullOrUndefined(e.ganttProperties.resourceInfo)||0===e.ganttProperties.resourceInfo.length)&&0!==n.work||this.updateDurationWithWork(e);break;case"FixedUnit":e.hasChildRecords||this.updateDurationWithWork(e)}t.isNullOrUndefined(r.type)||this.parent.dataOperation.updateMappingData(e,"type"),0===n.duration?(this.parent.setRecordValue("isMilestone",!0,n,!0),t.isNullOrUndefined(this.parent.taskFields)||t.isNullOrUndefined(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!0,e,!0),this.parent.setRecordValue("endDate",n.startDate,n,!0)):t.isNullOrUndefined(n.startDate)||t.isNullOrUndefined(n.duration)||(this.parent.setRecordValue("isMilestone",!1,n,!0),t.isNullOrUndefined(this.parent.taskFields)||t.isNullOrUndefined(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!1,e,!0),this.calculateEndDate(e))}this.parent.dataOperation.updateMappingData(e,"work")}t.isNullOrUndefined(d)||this.parent.setRecordValue("segments",this.setSegmentsInfo(e,!0),n,!0),0===n.duration&&(this.parent.setRecordValue("isMilestone",!0,n,!0),t.isNullOrUndefined(this.parent.taskFields)||t.isNullOrUndefined(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!0,e,!0),this.parent.setRecordValue("endDate",n.startDate,n,!0)),!t.isNullOrUndefined(h)&&h&&(this.parent.setRecordValue("duration",0,n,!0),this.parent.setRecordValue("isMilestone",!0,n,!0),t.isNullOrUndefined(this.parent.taskFields)||t.isNullOrUndefined(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!0,e,!0),this.parent.setRecordValue("endDate",n.startDate,n,!0))},i.prototype.calculateScheduledValuesforBaseline=function(e,i,a){var r=this.parent.taskFields,n=e.ganttProperties,s=i[r.baselineDuration];s=t.isNullOrUndefined(s)||""===s?null:s;var o=this.getDateFromFormat(i[r.baselineStartDate],!0),l=this.getDateFromFormat(i[r.baselineEndDate],!0);if(o)this.calculateDateFromStartDateforBaseline(o,l,s,e,a);else if(l)this.calculateDateFromEndDateforBaseline(l,s,e,!0);else if(!t.isNullOrUndefined(s)&&""!==s){this.updateDurationValue(s,n,!0);var d=this.getProjectStartDate(n,a);this.parent.setRecordValue("baselineStartDate",d,n,!0),this.calculateEndDate(e,!0)}},i.prototype.calculateDateFromStartDateforBaseline=function(e,i,a,r,n){var s=r.ganttProperties,o=!!(0===parseInt(a,10)||e&&i&&new Date(e.getTime())===new Date(i.getTime()))||null;if(this.parent.setRecordValue("baselineStartDate",this.checkStartDate(e,s,o,n,!0),s,!0),i||!t.isNullOrUndefined(a)&&""!==a)if(t.isNullOrUndefined(a)||i)if(t.isNullOrUndefined(i)||!t.isNullOrUndefined(a)&&""!==a)this.updateDurationValue(a,s,!0),!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?this.parent.setRecordValue("baselineEndDate",i,s,!0):this.calculateEndDate(r,!0);else{var l=void 0;l=this.parent.weekWorkingTime.length>0&&i?this.parent.getEndTime(i):this.parent.defaultEndTime,i&&0===i.getHours()&&86400!==l&&this.setTime(l,i),(s.baselineStartDate&&i&&s.baselineStartDate.getTime()>i.getTime()||!t.isNullOrUndefined(s.baselineStartDate)&&!t.isNullOrUndefined(s.startDate)&&s.baselineStartDate.getTime()===s.startDate.getTime()&&!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(s.endDate)&&i.toLocaleDateString()===s.endDate.toLocaleDateString()&&s.isMilestone)&&(i=s.baselineStartDate),this.parent.setRecordValue("baselineEndDate",this.checkBaselineEndDate(i,s),s,!0),1===this.compareDates(s.baselineStartDate,s.baselineEndDate)?(this.parent.setRecordValue("baselineEndDate",s.baselineStartDate,s,!0),this.parent.setRecordValue("baselineDuration",0,s,!0)):this.calculateDuration(r,!0)}else this.updateDurationValue(a,s,!0),this.calculateEndDate(r,!0);else this.parent.setRecordValue("baselineDuration",1,s,!0),this.calculateEndDate(r,!0)},i.prototype.calculateDateFromEndDateforBaseline=function(e,i,a,r){var n,s=a.ganttProperties;n=this.parent.weekWorkingTime.length>0?this.parent.getEndTime(e):this.parent.defaultEndTime,0===e.getHours()&&86400!==n&&this.setTime(n,e);var o=0===parseInt(i,10)||null;this.parent.setRecordValue("baselineEndDate",this.checkEndDate(e,a.ganttProperties,o,!0),s,!0),t.isNullOrUndefined(i)||""===i?(this.parent.setRecordValue("baselineDuration",1,s,!0),this.parent.setRecordValue("baselineStartDate",this.getStartDate(s.baselineEndDate,s.duration,s.durationUnit,s),s,!0)):t.isNullOrUndefined(i)||""===i||(this.updateDurationValue(i,s,r),this.parent.setRecordValue("baselineStartDate",this.getStartDate(s.endDate,s.duration,s.durationUnit,s,!0),s,!0))},i.prototype.updateDurationWithWork=function(e){var i=e.ganttProperties,a=this.fetchResources(e);if(!t.isNullOrUndefined(a)&&a.length>0){var r=t.isNullOrUndefined(a)?0:a.length,n=0,s=void 0,o=(s=this.parent.weekWorkingTime.length>0?this.parent.getSecondsPerDay(e.ganttProperties.startDate?e.ganttProperties.startDate:e.ganttProperties.endDate):this.parent.secondsPerDay)/3600,l=0,d=void 0,h=void 0;for(h=0;h<r;h++)n+=(d=a[h][this.parent.resourceFields.unit])>0?o*d/100:"FixedUnit"!==e.ganttProperties.taskType&&"FixedWork"!==i.taskType&&0!==i.duration?o:0;var p=this.getWorkInHour(i.work,i.workUnit);r>0&&n>0&&(l+=p/n),"FixedUnit"===i.taskType&&0===n&&(this.parent.setRecordValue("work",0,i,!0),this.parent.setRecordValue(this.parent.taskFields.work,0,e,!0)),"minute"===i.durationUnit&&(l=l*o*60),"hour"===i.durationUnit&&(l*=o),l%1!=0&&(l=parseFloat(l.toFixed(2))),t.isNullOrUndefined(i.duration)||this.parent.setRecordValue("duration",l,i,!0),this.parent.dataOperation.updateMappingData(e,"duration")}},i.prototype.updateUnitWithWork=function(e){var i,a=e.ganttProperties,r=this.fetchResources(e),n=t.isNullOrUndefined(r)?0:r.length,s=(i=this.parent.weekWorkingTime.length>0?this.parent.getSecondsPerDay(e.ganttProperties.startDate?e.ganttProperties.startDate:e.ganttProperties.endDate):this.parent.secondsPerDay)/3600;if(0!==n){var o=this.getDurationInDay(e.ganttProperties.duration,e.ganttProperties.durationUnit),l=this.getWorkInHour(a.work,a.workUnit),d=o>0?l/(o*s)*100:0,h=0===d?0:d>0?d/n:100;h%1!=0&&(h=parseFloat(h.toFixed(2)));for(var p=0;p<n;p++)r[p][this.parent.resourceFields.unit]=h,this.parent.isLoad||t.isNullOrUndefined(this.parent.editModule)||t.isNullOrUndefined(this.parent.editModule.dialogModule)||this.parent.editModule.dialogModule.isEdit||t.isNullOrUndefined(this.parent.editModule.cellEditModule)||this.parent.editModule.cellEditModule.isCellEdit||a.resourceInfo&&(a.resourceInfo[p][this.parent.resourceFields.unit]=h),this.parent.editModule&&this.parent.editModule.dialogModule&&!t.isNullOrUndefined(this.parent.editModule.dialogModule.ganttResources[p])&&(this.parent.editModule.dialogModule.ganttResources[p][this.parent.resourceFields.unit]=h);this.updateResourceName(e)}},i.prototype.calculateDateFromEndDate=function(e,i,a){var r,n=a.ganttProperties;r=this.parent.weekWorkingTime.length>0?this.parent.getEndTime(e):this.parent.defaultEndTime,0===e.getHours()&&86400!==r&&this.setTime(r,e);var s=0===parseInt(i,10)||null;this.parent.setRecordValue("endDate",this.checkEndDate(e,a.ganttProperties,s),n,!0),t.isNullOrUndefined(i)||""===i?this.parent.allowUnscheduledTasks?(this.parent.setRecordValue("startDate",null,n,!0),this.parent.setRecordValue("duration",null,n,!0)):(this.parent.setRecordValue("duration",1,n,!0),this.parent.setRecordValue("startDate",this.getStartDate(n.endDate,n.duration,n.durationUnit,n),n,!0)):t.isNullOrUndefined(i)||""===i||(this.updateDurationValue(i,n),this.parent.setRecordValue("startDate",this.getStartDate(n.endDate,n.duration,n.durationUnit,n),n,!0))},i.prototype.calculateDateFromStartDate=function(e,i,a,r,n){var s=r.ganttProperties,o=!!(0===parseInt(a,10)||e&&i&&new Date(e.getTime())===new Date(i.getTime()))||null;if(this.parent.setRecordValue("startDate",this.checkStartDate(e,s,o,n),s,!0),this.parent.isTreeGridRendered&&r&&this.updateTaskData(r),i||!t.isNullOrUndefined(a)&&""!==a)if(t.isNullOrUndefined(a)||i)if(i&&(t.isNullOrUndefined(a)||""===a)){var l=void 0;l=this.parent.weekWorkingTime.length>0?this.parent.getEndTime(i):this.parent.defaultEndTime,0===i.getHours()&&86400!==l&&this.setTime(l,i),this.parent.setRecordValue("endDate",this.checkEndDate(i,r.ganttProperties),s,!0),1===this.compareDates(s.startDate,s.endDate)?(this.parent.setRecordValue("endDate",s.startDate,s,!0),this.parent.setRecordValue("isMilestone",!0,s,!0),this.parent.setRecordValue("duration",0,s,!0)):this.calculateDuration(r)}else this.updateDurationValue(a,s),!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?(this.setTime(this.parent.getCurrentDayEndTime(i),i),this.parent.setRecordValue("endDate",i,s,!0)):this.calculateEndDate(r);else this.updateDurationValue(a,s),this.calculateEndDate(r);else this.parent.allowUnscheduledTasks?(this.parent.setRecordValue("endDate",null,s,!0),this.parent.setRecordValue("duration",null,s,!0)):(this.parent.setRecordValue("duration",1,s,!0),this.calculateEndDate(r))},i.prototype.getProgressWidth=function(e,t){return e*t/100},i.prototype.calculateWidth=function(e,i){var a=e.ganttProperties,r=i?a.autoStartDate:a.startDate,n=i?a.autoEndDate:a.endDate;return t.isNullOrUndefined(r)&&t.isNullOrUndefined(n)&&(r=this.getValidStartDate(a,i),n=this.getValidEndDate(a,i)),t.isNullOrUndefined(r)||t.isNullOrUndefined(n)?3:!a.isMilestone||e.hasChildRecords&&!a.isAutoSchedule?this.getTaskWidth(r,n,a):0},i.prototype.getTaskbarHeight=function(){var e=this.parent.rowHeight,t=this.parent.taskbarHeight;return t<e?t:e},i.prototype.calculateLeft=function(e,i,a){var r=null,n=-300,s=a?e.autoStartDate:e.startDate,o=a?e.autoEndDate:e.endDate,l=a?e.autoDuration:e.duration,d=e.isMilestone;if(i&&this.parent.allowUnscheduledTasks&&t.isNullOrUndefined(s)&&t.isNullOrUndefined(o)&&!t.isNullOrUndefined(l)&&!i.hasChildRecords&&i.parentItem&&("Manual"===this.parent.taskMode||"Custom"===this.parent.taskMode&&i[this.parent.taskFields.manual])){var h=this.parent.getParentTask(i.parentItem);h.ganttProperties.startDate&&(s=h.ganttProperties.startDate)}return s?r=new Date(s.getTime()):o?(r=new Date(o.getTime()),d=!t.isNullOrUndefined(s)||!this.parent.allowUnscheduledTasks):r=this.getValidStartDate(e),t.isNullOrUndefined(r)||(n=this.getTaskLeft(r,d)),n},i.prototype.calculateAutoLeft=function(e){return this.getTaskLeft(e.autoStartDate,e.isMilestone)},i.prototype.calculateAutoDuration=function(e){return this.getDuration(e.autoStartDate,e.autoEndDate,e.durationUnit,!1,e.isMilestone)},i.prototype.calculateAutoWidth=function(e){return this.getTaskWidth(e.autoStartDate,e.autoEndDate)},i.prototype.calculateBaselineLeft=function(e){var t=this.getDateFromFormat(e.baselineStartDate),i=this.getDateFromFormat(e.baselineEndDate);return t&&i?(t.getTime()>i.getTime()&&(i=t),this.getTaskLeft(t,e.isMilestone)):0},i.prototype.calculateBaselineWidth=function(e){var t=this.getDateFromFormat(e.baselineStartDate),i=this.getDateFromFormat(e.baselineEndDate);return t&&i&&t.getTime()!==i.getTime()?(this.isBaseline=!0,t.getTime()>i.getTime()&&(e.baselineEndDate=t,i=t),this.getTaskWidth(t,i)):0},i.prototype.getTaskWidth=function(e,i,a){var r=new Date(e.getTime()),n=new Date(i.getTime()),s="None"!==this.parent.timelineModule.customTimelineSettings.bottomTier.unit?this.parent.timelineModule.customTimelineSettings.bottomTier.unit:this.parent.timelineModule.customTimelineSettings.topTier.unit,o=(this.parent.timelineModule.customTimelineSettings,!1),l=new Date(e.getTime()),d=0;if(t.isNullOrUndefined(a)||"hour"!==a.durationUnit||(l=new Date(l.getTime()+60*a.duration*60*1e3)),(!t.isNullOrUndefined(a)&&"minute"===a.durationUnit||!t.isNullOrUndefined(a)&&"day"===a.durationUnit&&a.duration<1)&&(l=new Date(l.getTime()+60*a.duration*1e3)),this.isBaseline&&"Day"===s){var h=this.getDuration(r,n,"day",!0,!1);if(this.isBaseline=!1,h>0&&h<1)return h*this.parent.perDayWidth}if(this.parent.weekWorkingTime.length>0)for(var p=new Date(e.getTime()),u=e.getDate();u<=i.getDate();u++){var c=p.getDay(),g=void 0,f=this.parent.weekWorkingTime;switch(c){case 0:g="Sunday";break;case 1:g="Monday";break;case 2:g="Tuesday";break;case 3:g="Wednesday";break;case 4:g="Thursday";break;case 5:g="Friday";break;case 6:g="Saturday";break;default:g=""}for(var m=!0,y=0;y<f.length;y++)if(f[y][g]&&f[y][g].length>0){m=!1;for(var D=0;D<f[y][g].length;D++)d=d+f[y][g][D].to-f[y][g][D].from}if(m)for(var v=0;v<this.parent.dayWorkingTime.length;v++)d=d+this.parent.dayWorkingTime[v].to-this.parent.dayWorkingTime[v].from;p=new Date(p.setDate(p.getDate()+1)),this.parent.includeWeekend||(p=this.parent.dataOperation.getNextWorkingDay(p))}else for(y=0;y<this.parent.dayWorkingTime.length;y++)d=d+this.parent.dayWorkingTime[y].to-this.parent.dayWorkingTime[y].from;var b,w,T=l.getTime()-r.getTime();if(!t.isNullOrUndefined(a)&&"minute"===a.durationUnit&&a.duration<60*d||!t.isNullOrUndefined(a)&&"day"===a.durationUnit&&!t.isNullOrUndefined(a.duration)&&/^\d+\.\d+$/.test(a.duration.toString())){if("Day"===s?(this.parent.weekWorkingTime.length>0?(b=this.parent.getStartTime(r),w=this.parent.getEndTime(n)):(b=this.parent.defaultStartTime,w=this.parent.defaultEndTime),(Math.floor(T/36e5%24)>=d||0===T)&&(o=!0),this.getSecondsInDecimal(r)===b&&o&&r.setHours(0,0,0,0),this.getSecondsInDecimal(n)===w&&o&&n.setHours(24),this.getSecondsInDecimal(n)===b&&n.setHours(0,0,0,0)):o=!0,r.getTime()===n.getTime())return this.parent.perDayWidth;if(o){if(this.parent.taskFields.duration&&"day"===a.durationUnit&&/^\d+\.\d+$/.test(a.duration.toString())&&"Day"===this.parent.timelineModule.bottomTier&&t.isNullOrUndefined(a.segments)){var S=this.parent.holidays&&this.parent.holidays.length>0?this.getHolidaysCount(r,n):0,P=this.parent.includeWeekend?0:this.getWeekendCount(r,n);return this.hasDSTTransition(r.getFullYear())?this.getTimeDifference(r,n,!0)/864e5*this.parent.perDayWidth:this.parent.timelineSettings.showWeekend?(S+P+a.duration)*this.parent.perDayWidth:(S+a.duration)*this.parent.perDayWidth}return this.getTimeDifference(r,n,!0)/864e5*this.parent.perDayWidth}var C=!1;return C=function(e,t,i,a){var r=new Date(e),n=new Date(t);if(isNaN(r.getTime())||isNaN(n.getTime())||i<=0||a<=0)return!1;var s=new Date(r),o=i*a,l=Math.floor(o/a),d=o%a;return s.setDate(s.getDate()+l),s.setHours(s.getHours()+d),s.getTime()!==n.getTime()&&Math.abs((s.getTime()-n.getTime())/864e5)>1}(r,n,a.duration,d),"day"===a.durationUnit&&a.duration<1&&!C?a.duration*this.parent.perDayWidth:this.hasDSTTransition(r.getFullYear())||-180===r.getTimezoneOffset()?this.getTimeDifference(r,n,!0)/864e5*this.parent.perDayWidth:this.getTimeDifference(r,n)/(36e5*d)*this.parent.perDayWidth}if("Day"===s&&(this.parent.weekWorkingTime.length>0?(b=this.parent.getStartTime(r),w=this.parent.getEndTime(n)):(b=this.parent.defaultStartTime,w=this.parent.defaultEndTime),this.getSecondsInDecimal(r)===b&&r.setHours(0,0,0,0),this.getSecondsInDecimal(n)===w&&(n.setHours(24),n.setHours(0,0,0,0)),this.getSecondsInDecimal(n)===b&&n.setHours(0,0,0,0)),r.getTime()===n.getTime())return this.parent.perDayWidth;if(this.hasDSTTransition(r.getFullYear())){var R=0,M=0;return this.parent.timelineSettings.showWeekend||(R=this.parent.timelineModule.calculateNonWorkingDaysBetweenDates(r,n))>0&&(M=864e5*R),(k(n)-k(r)-M)/6e4*(this.parent.perDayWidth/24)/60}var x=this.getTimeDifference(r,n)/864e5;if(this.parent.timelineSettings.showWeekend)return x*this.parent.perDayWidth;var O=new Date(r.getTime());return(x-this.parent.timelineModule.calculateNonWorkingDaysBetweenDates(O,n))*this.parent.perDayWidth},i.prototype.getDSTTransitions=function(e,t){function i(e,t){var i=new Date(Date.UTC(e,t+1,0));return new Date(Date.UTC(e,t,i.getUTCDate()-i.getUTCDay()))}function a(e,t){var i=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(e).match(/\d+/g).map(Number),a=i[0],r=i[1],n=i[2],s=i[3],o=i[4],l=i[5];return new Date(n,a-1,r,s,o,l)}var r=i(e,2),n=i(e,9);return{dstStart:a(r,t),dstEnd:a(n,t)}},i.prototype.hasDSTTransition=function(e){for(var t=0,i=11,a=new Date(e,t,1).getTimezoneOffset();t<=i;){var r=Math.floor((t+i)/2),n=new Date(e,r,1).getTimezoneOffset();if(n!==a)return!0;n>a?i=r-1:t=r+1}return!1},i.prototype.getTaskLeft=function(e,i,a){var r=!1,n=new Date(e.getTime());if("Day"===("None"!==this.parent.timelineModule.customTimelineSettings.bottomTier.unit?this.parent.timelineModule.customTimelineSettings.bottomTier.unit:this.parent.timelineModule.customTimelineSettings.topTier.unit)){var s=void 0,o=void 0;this.parent.weekWorkingTime.length>0?(s=this.parent.getStartTime(n),o=this.parent.getEndTime(n)):(s=this.parent.defaultStartTime,o=this.parent.defaultEndTime),this.getSecondsInDecimal(n)===s?n.setHours(0,0,0,0):i&&this.getSecondsInDecimal(n)===o?(n.setHours(24),r=!0):this.getSecondsInDecimal(n)===o&&this.parent.allowUnscheduledTasks&&(n.setHours(22),r=!0)}var l;this.parent.enableTimelineVirtualization&&(this.parent.isLoad||a)&&!this.parent.timelineModule.performedTimeSpanAction&&(l=this.parent.enableTimelineVirtualization&&0!==this.parent.ganttChartModule.scrollObject.element.scrollLeft?this.parent.ganttChartModule.scrollObject.getTimelineLeft():null);var d=t.isNullOrUndefined(l)?new Date(this.parent.timelineModule.timelineStartDate):new Date(this.parent.timelineModule.dateByLeftValue(l).toString());if(d){var h=void 0;this.hasDSTTransition(e.getFullYear());if(this.hasDSTTransition(n.getFullYear()))return h=this.parent.timelineSettings.showWeekend?(k(n)-k(d))/6e4*(this.parent.perDayWidth/24)/60:this.calculateLeftValue(d,n);var p=void 0;if("Day"!==this.parent.timelineModule.bottomTier||this.getSecondsInDecimal(n)===this.parent.defaultStartTime||0===this.getSecondsInDecimal(n)||r||this.parent.isFromEventMarker)h=this.parent.timelineSettings.showWeekend?(n.getTime()-d.getTime())/864e5*this.parent.perDayWidth:this.calculateLeftValue(d,n);else{var u=new Date(e.getTime()),c=new Date(u.setHours(0,0,0,0));p=this.getDuration(c,e,"day",!0,!1)*this.parent.perDayWidth,n.setHours(0,0,0,0),h=this.parent.timelineSettings.showWeekend?(n.getTime()-d.getTime())/864e5*this.parent.perDayWidth:this.calculateLeftValue(d,n),this.getSecondsInDecimal(e)!==this.parent.defaultStartTime&&"Day"===this.parent.timelineModule.bottomTier&&(h+=p)}return h}return 0},i.prototype.calculateLeftValue=function(e,t){var i=new Date(this.parent.timelineModule.timelineStartDate.getTime());t.setHours(0,0,0,0);var a=this.parent.timelineModule.calculateNonWorkingDaysBetweenDates(i,t);return((this.hasDSTTransition(t.getFullYear())?k(t)-k(e):t.getTime()-e.getTime())-24*a*60*60*1e3)/864e5*this.parent.perDayWidth},i.prototype.getSplitTaskWidth=function(e,t,i){var a=new Date(e.getTime()),r=new Date(this.getEndDate(a,t,i.ganttProperties.durationUnit,i.ganttProperties,!1).getTime());if("Day"===("None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier)){var n=void 0,s=void 0;this.parent.weekWorkingTime.length>0?(n=this.parent.getStartTime(a),s=this.parent.getEndTime(r)):(n=this.parent.defaultStartTime,s=this.parent.defaultEndTime),this.getSecondsInDecimal(a)===n&&a.setHours(0,0,0,0),this.getSecondsInDecimal(r)===s&&r.setHours(24),this.getSecondsInDecimal(r)===n&&r.setHours(0,0,0,0)}if(this.parent.timelineSettings.showWeekend)return this.getTimeDifference(a,r)/864e5*this.parent.perDayWidth;var o=new Date(a.getTime()),l=this.parent.timelineModule.calculateNonWorkingDaysBetweenDates(o,r);return(r.getTime()-a.getTime()-24*l*60*60*1e3)/864e5*this.parent.perDayWidth},i.prototype.getSplitTaskLeft=function(e,t){var i=new Date(e.getTime());if("Day"===("None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier)){var a=void 0,r=void 0;this.parent.weekWorkingTime.length>0?(a=this.parent.getStartTime(i),r=this.parent.getStartTime(t)):r=a=this.parent.defaultStartTime,this.getSecondsInDecimal(i)===a&&i.setHours(0,0,0,0),this.getSecondsInDecimal(t)===r&&t.setHours(0,0,0,0)}if(t){var n=0,s=0;if(!this.parent.timelineSettings.showWeekend){var o=new Date(t.getTime()),l=new Date(i.getTime());(n=this.parent.timelineModule.calculateNonWorkingDaysBetweenDates(o,l))>0&&(s=864e5*n)}return(i.getTime()-t.getTime()-s)/864e5*this.parent.perDayWidth}return 0},i.prototype.updateMappingData=function(e,i){var a=this.parent.columnMapping,r=e.ganttProperties;if(!t.isNullOrUndefined(a[i])||"taskType"===i||"segments"===i)if("predecessorName"===i);else if("resourceInfo"===i){var n=r.resourceInfo,s=this.parent.resourceFields,o=[],l=[];if(!t.isNullOrUndefined(n))for(var d=0;d<n.length;d++){o.push(n[d][s.id]);var h=n[d][s.name],p=n[d][s.unit];100!==p&&(h+="["+p+"%]"),h&&l.push(h)}this.parent.setRecordValue("resourceNames",l.join(","),r,!0),this.isResourceString?(e.taskData[this.parent.taskFields.resourceInfo]&&e.taskData[this.parent.taskFields.resourceInfo][0]&&(e.taskData[this.parent.taskFields.resourceInfo]=e.taskData[this.parent.taskFields.resourceInfo][0][s.name]),this.updateTaskDataResource(e)):this.updateTaskDataResource(e),this.parent.setRecordValue(a[i],l.join(","),e)}else"startDate"===i||"endDate"===i?this.setRecordDate(e,r[i],a[i]):"duration"===i?this.setRecordDuration(e,a[i]):"baselineStartDate"===i||"baselineEndDate"===i?this.setRecordDate(e,r[i],a[i]):"baselineDuration"===i?this.setRecordDuration(e,a[i],!0):"work"===i?(this.parent.setRecordValue("taskData."+a[i],r.work,e),this.parent.setRecordValue(a[i],r[i],e)):"type"===i?(this.parent.setRecordValue("taskData."+a[i],r.taskType,e),this.parent.setRecordValue(a[i],r.taskType,e)):"manual"===i?(this.parent.setRecordValue("taskData."+a[i],!r.isAutoSchedule,e),this.parent.setRecordValue(a[i],!r.isAutoSchedule,e)):"segments"===i?this.parent.setRecordValue("taskData."+this.parent.taskFields.segments,this.segmentTaskData(e),e):(this.parent.setRecordValue("taskData."+a[i],r[i],e),this.parent.setRecordValue(a[i],r[i],e))},i.prototype.segmentTaskData=function(e){var i=this,a=e.ganttProperties.segments,r=this.parent.taskFields;if(t.isNullOrUndefined(a))return null;for(var n=t.extend([],[],e.taskData[r.segments],!0),s=0;s<a.length;s++)(this.parent.isEdit||this.parent.editModule&&this.parent.editModule.dialogModule&&t.getValue("isEdit",this.parent.editModule.dialogModule)||this.parent.contextMenuModule&&t.getValue("isEdit",this.parent.contextMenuModule))&&(n[s]={}),t.isNullOrUndefined(r.startDate)||(n[s][this.parent.taskFields.startDate]=a[s].startDate),t.isNullOrUndefined(r.endDate)||(n[s][this.parent.taskFields.endDate]=a[s].endDate),t.isNullOrUndefined(r.duration)||(n[s][this.parent.taskFields.duration]=Number(a[s].duration));return this.customSegmentProperties.length>0&&n&&n.length>0&&n.forEach(function(e,t){var a=Object.assign({},e,i.customSegmentProperties[t]);n[t]=a}),n},i.prototype.updateTaskDataResource=function(e){var i=e.ganttProperties.resourceInfo,a=e.taskData[this.parent.taskFields.resourceInfo],r=this.parent.resourceFields;if(t.isNullOrUndefined(a))e.taskData[this.parent.taskFields.resourceInfo]=i;else if(i&&i.length){for(var n=0;n<i.length;n++){var s=!1;if("string"==typeof a){if("string"==typeof a&&a===i[n][r.name]){a=i[n][r.name],s=!0;break}}else for(var o=0;o<a.length;o++)if("number"==typeof a[o]||"string"==typeof a[o]){if(parseInt(a[o],10)===parseInt(i[n][r.id],10)){a[o]=i[n],s=!0;break}}else if(a[o][r.id]===i[n][r.id]&&"number"!=typeof a[o]){a[o]=t.extend({},a[o],i[n],!0),s=!0;break}s||("string"==typeof a?a=i[n][r.name]:a.push(i[n]))}var l=[];if(!t.isNullOrUndefined(a))if("string"!=typeof a){for(var d=0;d<a.length;d++)!function(e){i.filter(function(t){t[r.id]===a[e][r.id]&&-1===l.indexOf(a[e])&&l.push(a[e])})}(d);this.parent.setRecordValue("taskData."+this.parent.taskFields.resourceInfo,l,e)}else this.parent.setRecordValue("taskData."+this.parent.taskFields.resourceInfo,a,e)}else this.parent.setRecordValue("taskData."+this.parent.taskFields.resourceInfo,[],e)},i.prototype.setRecordDate=function(e,i,a){var r="string"==typeof i?new Date(i):i;t.isNullOrUndefined(i)||(i=new Date(r.getTime())),this.parent.setRecordValue(a,i,e),t.isNullOrUndefined(i)||(i=new Date(r.getTime())),this.parent.isLoad||this.parent.isDynamicData||this.parent.setRecordValue("taskData."+a,i,e),this.parent.isDynamicData=!1},i.prototype.getDurationInDay=function(e,t){return"day"===t?e:"hour"===t?e/(this.parent.secondsPerDay/3600):e/(this.parent.secondsPerDay/60)},i.prototype.setRecordDuration=function(e,i,a){var r=a?e.ganttProperties.baselineDuration:e.ganttProperties.duration,n=e.ganttProperties.durationUnit;if(t.isNullOrUndefined(r))this.parent.setRecordValue(i,r,e),this.parent.setRecordValue("taskData."+i,r,e);else{this.parent.setRecordValue(i,r,e);var s=t.getValue(i,e.taskData);isNaN(s)&&t.isNullOrUndefined(this.parent.taskFields.durationUnit)&&!t.isNullOrUndefined(s)?this.parent.setRecordValue("taskData."+i,this.getDurationString(r,n),e):"string"==typeof s?this.parent.setRecordValue("taskData."+i,r.toString(),e):this.parent.setRecordValue("taskData."+i,r,e)}this.parent.taskFields.durationUnit&&(e.taskData[this.parent.taskFields.durationUnit]=e.ganttProperties.durationUnit)},i.prototype.setDataSource=function(e){var i,a=[];Array.isArray(e)&&(i=e);for(var r=i.length,n=0;n<r;n++){var s=e[n];a.push(s),t.isNullOrUndefined(e[n][this.parent.taskFields.child])||this.setDataSource(e[n][this.parent.taskFields.child])}return a},i.prototype.setStartDate=function(e){var i=this;(t.isNullOrUndefined(this.parent.taskFields.parentID)||t.isNullOrUndefined(this.parent.taskFields.id)?this.parent.dataSource:this.setDataSource(this.parent.dataSource)).map(function(a){e.ganttProperties.taskId===a[i.parent.taskFields.id]&&(t.isNullOrUndefined(i.parent.taskFields.startDate)||(e[i.parent.taskFields.startDate]=a[i.parent.taskFields.startDate]),t.isNullOrUndefined(i.parent.taskFields.endDate)||(e[i.parent.taskFields.endDate]=a[i.parent.taskFields.endDate]))})},i.prototype.getWorkInHour=function(e,t){return"day"===t?e*(this.parent.secondsPerDay/3600):"minute"===t?e/60:e},i.prototype.updateTaskData=function(e){var i=this.parent.taskFields,a=e.ganttProperties;if(!t.isNullOrUndefined(e.taskData)){var r=e.taskData;if(i.id&&(this.parent.setRecordValue("taskData."+i.id,a.taskId,e),this.parent.setRecordValue(i.id,a.taskId,e)),i.name&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.name,a.taskName,e),this.parent.setRecordValue(i.name,a.taskName,e)),i.startDate&&this.setRecordDate(e,a.startDate,i.startDate),i.endDate&&this.setRecordDate(e,a.endDate,i.endDate),i.duration&&(t.isNullOrUndefined(i.milestone)||!t.isNullOrUndefined(i.milestone)&&!e.taskData[i.milestone])&&this.setRecordDuration(e,i.duration),i.durationUnit&&(r[i.durationUnit]=a.durationUnit),i.progress&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.progress,a.progress,e),this.parent.setRecordValue(i.progress,a.progress,e)),i.baselineStartDate&&this.setRecordDate(e,a.baselineStartDate,i.baselineStartDate),i.baselineEndDate&&this.setRecordDate(e,a.baselineEndDate,i.baselineEndDate),i.baselineDuration&&this.setRecordDuration(e,i.baselineDuration,!0),i.notes&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.notes,a.notes,e),this.parent.setRecordValue(i.notes,a.notes,e)),i.cssClass&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.cssClass,a.cssClass,e),this.parent.setRecordValue(i.cssClass,a.cssClass,e)),i.indicators&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.indicators,a.indicators,e),this.parent.setRecordValue(i.indicators,a.indicators,e)),i.parentID){var n="ProjectView"===this.parent.viewType?a.parentId:r[i.parentID];this.parent.setRecordValue("taskData."+i.parentID,n,e),this.parent.setRecordValue(i.parentID,a.parentId,e)}i.work&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.work,a.work,e),this.parent.setRecordValue(i.work,a.work,e)),i.type&&(this.parent.setRecordValue("taskData."+i.type,a.taskType,e),this.parent.setRecordValue(i.type,a.taskType,e)),i.constraintDate&&this.setRecordDate(e,a.constraintDate,i.constraintDate),i.constraintType&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.constraintType,a.constraintType,e),this.parent.setRecordValue(i.constraintType,a.constraintType,e))}},i.prototype.setResourceInfo=function(e){var i,a=this;if(t.isNullOrUndefined(e[this.parent.taskFields.resourceInfo]))return i;i=this.parent.isLoad?e[this.parent.taskFields.resourceInfo]:e.taskData&&this.parent.taskFields.resourceInfo in e.taskData?e.taskData[this.parent.taskFields.resourceInfo]:e[this.parent.taskFields.resourceInfo];var r;r=t.isNullOrUndefined(this.parent.editModule)||t.isNullOrUndefined(this.parent.editModule.dialogModule)||!this.parent.editModule.dialogModule.isAddNewResource?this.parent.resources:this.parent.editModule.dialogModule.ganttResources;var n=this.parent.resourceFields.id,s=this.parent.resourceFields.unit,o=this.parent.resourceFields.group,l=[];if("string"==typeof i&&""!==i){var d=[],h=e[this.parent.taskFields.resourceInfo].split(",");if(h){r.forEach(function(e){h.includes(e[a.parent.resourceFields.name])&&d.push(e)});var p=t.extend({},d[0]);l.push(p),t.isNullOrUndefined(s)||t.isNullOrUndefined(i[s])||(p[s]=i[s]),t.isNullOrUndefined(o)||t.isNullOrUndefined(i[o])||(p[o]=i[o])}}else for(var u=0;u<i.length;u++)!function(e){var a=r.filter(function(t){return"object"==typeof i[e]&&i[e][n]===t[n]||i[e]===t[n]}),d=t.extend({},a[0]);l.push(d),t.isNullOrUndefined(s)||t.isNullOrUndefined(i[e][s])||(d[s]=i[e][s]),t.isNullOrUndefined(o)||t.isNullOrUndefined(i[e][o])||(d[o]=i[e][o])}(u);return this.updateResourceUnit(l),l},i.prototype.updateResourceUnit=function(e){var i=this.parent.resourceFields.unit;if(!t.isNullOrUndefined(i)){var a=e.length,r=void 0;for(r=0;r<a;r++)t.isNullOrUndefined(e[r][i])&&(e[r][i]=100)}},i.prototype.updateResourceName=function(e){var i=e.ganttProperties.resourceInfo,a=[],r=this.parent.taskFields;if(i&&i.length>0){var n=i.length;if("string"==typeof e.taskData[this.parent.taskFields.resourceInfo]){var s=o=e.taskData[this.parent.taskFields.resourceInfo];this.parent.setRecordValue("resourceNames",s,e.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.resourceInfo,s,e,!0),this.updateTaskDataResource(e)}else{var o=t.extend([],[],e.taskData[this.parent.taskFields.resourceInfo],!0);this.parent.setRecordValue("taskData."+this.parent.taskFields.resourceInfo,[],e);for(var l=0;l<n;l++){var d=i[l],h=d[this.parent.resourceFields.name],p=d[this.parent.resourceFields.unit];if(100!==p&&(h+="["+p+"%]"),t.isNullOrUndefined(h)||a.push(h),e.taskData){var u=r.resourceInfo;o[l]&&(o[parseInt(l.toString(),10)],!0)?e.taskData[u].push(o[l]):e.taskData[u].push(d[this.parent.resourceFields.id])}}this.parent.setRecordValue("resourceNames",a.join(","),e.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.resourceInfo,a.join(","),e,!0),this.updateTaskDataResource(e)}}},i.prototype.dataReorder=function(e,t){for(var i=[];e.length>0&&t.length>0;){var a=t.indexOf(e[0]);-1===a?e.shift():(i.push(e.shift()),t.splice(a,1))}return i},i.prototype.validateDurationUnitMapping=function(e){var i=e;return"minute"===i||"minutes"===i||"m"===i||"min"===i?i="minute":"hour"===i||"hours"===i||"h"===i||"hr"===i?i="hour":"day"===i||"days"===i||"d"===i?i="day":t.isNullOrUndefined(this.parent.durationUnit)||(i=this.parent.durationUnit.toLocaleLowerCase()),i},i.prototype.validateTaskTypeMapping=function(e){var t=e;return t="FixedDuration"===t?"FixedDuration":"FixedUnit"===t?"FixedUnit":"FixedWork"===t?"FixedWork":this.parent.taskType},i.prototype.validateWorkUnitMapping=function(e){var t=e;return t="minute"===t?"minute":"hour"===t?"hour":"day"===t?"day":this.parent.workUnit.toLocaleLowerCase()},i.prototype.updateDurationValue=function(e,i,a){var r=this.getDurationValue(e);a&&!isNaN(t.getValue("duration",r))?this.parent.setRecordValue("baselineDuration",t.getValue("duration",r),i,!0):isNaN(t.getValue("duration",r))||this.parent.setRecordValue("duration",t.getValue("duration",r),i,!0),t.isNullOrUndefined(t.getValue("durationUnit",r))||this.parent.setRecordValue("durationUnit",t.getValue("durationUnit",r),i,!0)},i.prototype.reUpdateGanttData=function(){if(this.parent.flatData.length>0){var e=void 0,i=void 0;this.parent.secondsPerDay=this.getSecondsPerDay();for(var a=0;a<this.parent.flatData.length;a++)e=this.parent.flatData[a].taskData,i=this.parent.flatData[a],t.isNullOrUndefined(this.parent.taskFields.duration)||this.setRecordDuration(i,this.parent.taskFields.duration),this.parent.isLoad&&this.setStartDate(i),this.calculateScheduledValues(i,e,!1);this.updateGanttData()}},i.prototype._isInStartDateRange=function(e,t,i){var a=!1;return e.getTime()>=t.getTime()&&e.getTime()<i.getTime()&&(a=!0),a},i.prototype._isInEndDateRange=function(e,t,i){var a=!1;return e.getTime()>t.getTime()&&e.getTime()<=i.getTime()&&(a=!0),a},i.prototype.updateOverlappingValues=function(e){var t,i=this,a=e.childRecords,r=[];if(a.length<=1)return void(e.ganttProperties.workTimelineRanges=[]);a=this.setSortedChildTasks(e),this.updateOverlappingIndex(a);for(var n=this,s=1;s<a.length;s++)!function(e){var s=[];((t=a[e]).ganttProperties.segments||[{startDate:t.ganttProperties.startDate,endDate:t.ganttProperties.endDate}]).map(function(e){var t=e.startDate,i=e.endDate;return{startDate:new Date(t),endDate:new Date(i)}}).forEach(function(t){for(var r=new Date(t.startDate.getTime()),n=new Date(t.endDate.getTime()),o=0;o<e;o++){var l=a[o];(l.ganttProperties.segments||[{startDate:l.ganttProperties.startDate,endDate:l.ganttProperties.endDate}]).map(function(e){var t=e.startDate,i=e.endDate;return{startDate:new Date(t),endDate:new Date(i)}}).forEach(function(e){var t=e.startDate,a=e.endDate,o={};r&&n&&a&&(i._isInStartDateRange(r,t,a)||i._isInEndDateRange(n,t,a)||t.getTime()>=r.getTime()&&a.getTime()<=n.getTime())&&(t.getTime()>r.getTime()&&t.getTime()<n.getTime()&&a.getTime()>r.getTime()&&a.getTime()>=n.getTime()||r.getTime()===t.getTime()&&n.getTime()<=a.getTime()?(o.from=t,o.to=n):r.getTime()===t.getTime()&&n.getTime()>a.getTime()?(o.from=t,o.to=a):r.getTime()>t.getTime()&&n.getTime()>=a.getTime()?(o.from=r,o.to=a):r.getTime()>t.getTime()&&n.getTime()<a.getTime()?(o.from=r,o.to=n):t.getTime()>=r.getTime()&&a.getTime()<=n.getTime()&&(o.from=t,o.to=a),o.from&&o.to&&s.push(o))})}}),r.push.apply(r,n.mergeRangeCollections(s))}(s);this.parent.setRecordValue("workTimelineRanges",this.mergeRangeCollections(r,!0),e.ganttProperties,!0),this.calculateRangeLeftWidth(e.ganttProperties.workTimelineRanges)},i.prototype.updateOverlappingIndex=function(e){for(var t=0;t<e.length;t++)e[t].ganttProperties.eOverlapIndex=t},i.prototype.calculateRangeLeftWidth=function(e){for(var t=0;t<e.length;t++)e[t].left=this.getTaskLeft(e[t].from,!1),e[t].width=this.getTaskWidth(e[t].from,e[t].to)},i.prototype.mergeRangeCollections=function(e,t){for(var i,r,n,s,o=[],l={},d={},h=new a.DataManager(e).executeLocal((new a.Query).sortBy(this.parent.taskFields.startDate,"Ascending")),p=0;p<h.length;p++)0!==o.length||0!==p?(i=(l=o[o.length-1]).from,r=l.to,n=(d=h[p]).from,s=d.to,i.getTime()===n.getTime()&&r.getTime()>=s.getTime()||i.getTime()<n.getTime()&&r.getTime()>=s.getTime()||(i.getTime()<=n.getTime()&&r.getTime()>=n.getTime()&&r.getTime()<s.getTime()||r.getTime()<n.getTime()&&this.checkStartDate(r).getTime()===n.getTime()?l.to=s:r.getTime()<n.getTime()&&this.checkStartDate(r).getTime()!==n.getTime()&&o.push(h[p]))):o.push(h[p]);return t&&(o=this.splitRangeCollection(o)),o},i.prototype.setSortedChildTasks=function(e){return new a.DataManager(e.childRecords).executeLocal((new a.Query).sortBy(this.parent.taskFields.startDate,"Ascending"))},i.prototype.splitRangeCollection=function(e,t,i){var a;return a=this.parent.timelineModule.isSingleTier?"None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier:this.parent.timelineModule.bottomTier,"Week"===a||"Month"===a||"Year"===a?e:"Day"===a?this.getRangeWithWeek(e,t,i):0===this.parent.workingTimeRanges[0].from&&86400===this.parent.workingTimeRanges[0].to?this.getRangeWithWeek(e,t,i):this.getRangeWithDay(e,t,i)},i.prototype.getRangeWithDay=function(e,t,i){for(var a=[],r=0;r<e.length;r++)a.push.apply(a,this.splitRangeForDayMode(e[parseInt(r.toString(),10)],t,i));return a},i.prototype.splitRangeForDayMode=function(e,i,a){var r=i||"from",n=a||"to",s=new Date(e[r]),o=new Date(e[n]),l=[],d={};if(s.getTime()<o.getTime())do{for(var h=new Date(s.getTime()),p=new Date(s.getTime()),u=0,c=this.parent.dataOperation.getSecondsInDecimal(s),g=-1,f=0;f<this.parent.workingTimeRanges.length;f++){var m=this.parent.workingTimeRanges[f];if(c>=m.from&&c<=m.to){g=f;break}}-1!==g&&(u=Math.round(this.parent.workingTimeRanges[g].to-c),p.setSeconds(p.getSeconds()+u));p.getTime()<o.getTime()?(d={},e.task&&(d.task=t.extend([],e.task)),d[r]=h,d[n]=p,d.isSplit=!0,l.push(d)):(d={},e.task&&(d.task=t.extend([],e.task)),d[r]=h,d[n]=o,d.isSplit=!0,l.push(d)),s=this.checkStartDate(p)}while(s.getTime()<o.getTime());else l.push(e);return l},i.prototype.getRangeWithWeek=function(e,t,i){for(var a=[],r=0;r<e.length;r++)a.push.apply(a,this.splitRangeForWeekMode(e[r],t,i));return a},i.prototype.splitRangeForWeekMode=function(e,i,a){var r=i||"from",n=a||"to",s=new Date(e[r]),o=new Date(e[r]),l=new Date(e[n]),d=!1,h=[],p={};if(o.setDate(o.getDate()+1),o.getTime()<l.getTime()){do{if(this.parent.dataOperation.isOnHolidayOrWeekEnd(o,null)){var u=new Date(o.getTime());u.setDate(o.getDate()-1);var c=void 0;c=this.parent.weekWorkingTime.length>0?this.parent.getEndTime(u):this.parent.defaultEndTime,this.setTime(c,u),(p={})[r]=s,p.isSplit=!0,p[n]=new Date(u),e.task&&(p.task=t.extend([],e.task,!0));var g=!this.parent.dataOperation.isOnHolidayOrWeekEnd(s,null),f=!this.parent.dataOperation.isOnHolidayOrWeekEnd(u,null),m=s.getTime()!==u.getTime();g&&f&&m&&h.push(p),u.setDate(u.getDate()+1),s=this.checkStartDate(u),o=new Date(s.getTime()),d=!0}else o.setDate(o.getDate()+1)}while(o.getTime()<l.getTime());d?s.getTime()!==l.getTime()&&(p={},e.task&&(p.task=t.extend([],e.task,!0)),p[r]=s,p[n]=l,p.isSplit=!0,h.push(p)):h.push(e)}else h.push(e);return h},i.prototype.updateGanttData=function(){this.systemTimeZone=Intl.DateTimeFormat().resolvedOptions().timeZone;var e=this.parent.flatData;if(e.length){for(var t=new Map,i=0,a=e;i<a.length;i++){var r=a[i];t.set(r.uniqueID,r)}for(var n=0,s=e.length;n<s;n++)this.updateTaskLeftWidth(e[n],t)}},i.prototype.shouldProcessUpdateWidth=function(){return!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&Boolean(this.parent.taskFields.hasChildMapping)},i.prototype.updateTaskLeftWidth=function(e,t){void 0===t&&(t=null);var i=e.ganttProperties;e.hasChildRecords&&!this.shouldProcessUpdateWidth()||this.updateWidthLeft(e),this.parent.setRecordValue("baselineLeft",this.calculateBaselineLeft(i),i,!0),this.parent.setRecordValue("baselineWidth",this.calculateBaselineWidth(i),i,!0);var a=e.parentItem?null!=t?t.get(e.parentItem.uniqueID):this.parent.getParentTask(e.parentItem):null,r=a&&a.childRecords.slice(-1)[0]===e;a&&(r&&!e.hasChildRecords&&this.parent.enableValidation?((!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)&&"ResourceView"!==this.parent.viewType||this.updateParentItems(a),this.shouldProcessUpdateWidth()&&this.updateWidthLeft(a)):a&&!this.parent.enableValidation&&this.updateWidthLeft(a))},i.prototype.reUpdateGanttDataPosition=function(){for(var e,t=(e=this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth?this.parent.pdfExportModule.helper.beforeSinglePageExport.cloneFlatData:this.parent.flatData).length,i=0;i<t;i++){var a=e[i],r=a.ganttProperties;this.updateWidthLeft(a),"Auto"!==this.parent.taskMode&&a.hasChildRecords&&this.updateAutoWidthLeft(a),this.parent.setRecordValue("baselineLeft",this.calculateBaselineLeft(r),r,!0),this.parent.setRecordValue("baselineWidth",this.calculateBaselineWidth(r),r,!0),this.parent.dataOperation.updateTaskData(a)}},i.prototype.updateWidthLeft=function(e){var i=e.ganttProperties,a=0,r=0;if(!t.isNullOrUndefined(i.segments)&&i.segments.length>0){for(var n=i.segments,s=0;s<n.length;s++){var o=n[s];if(0===s&&!t.isNullOrUndefined(i.startDate)&&!t.isNullOrUndefined(o.startDate)&&!t.isNullOrUndefined(o.startDate.getTime())&&o.startDate.getTime()!==i.startDate.getTime()){o.startDate=i.startDate;var l=this.parent.dataOperation.getEndDate(o.startDate,o.duration,i.durationUnit,i,!1);o.endDate=this.parent.dataOperation.checkEndDate(l,i,!1),this.parent.chartRowsModule.incrementSegments(n,0,e)}if(o.width=this.getSplitTaskWidth(o.startDate,o.duration,e),a+=o.width,o.showProgress=!1,o.progressWidth=-1,0!==s){var d=new Date(i.startDate.getTime());o.left=this.getSplitTaskLeft(o.startDate,d)}}for(var h=this.parent.dataOperation.getProgressWidth(a,i.progress),p=!0,s=0;s<n.length;s++)p&&(h<=n[s].width?(n[s].progressWidth=h,n[s].showProgress=!0,p=!1):(n[s].progressWidth=n[s].width,h-=n[s].progressWidth),n[s].showProgress&&(r=r+n[s].left+n[s].progressWidth));this.parent.setRecordValue("segments",i.segments,i,!0),this.parent.dataOperation.updateMappingData(e,"segments")}this.parent.setRecordValue("width",this.parent.dataOperation.calculateWidth(e),i,!0),this.parent.setRecordValue("left",this.parent.dataOperation.calculateLeft(i,e),i,!0),!t.isNullOrUndefined(i.segments)&&i.segments.length>0?this.parent.setRecordValue("progressWidth",r,i,!0):this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(i.isAutoSchedule||!e.hasChildRecords?i.width:i.autoWidth,i.progress),i,!0)},i.prototype.updateAutoWidthLeft=function(e){var t=e.ganttProperties;this.parent.setRecordValue("autoWidth",this.calculateWidth(e,!0),t,!0),this.parent.setRecordValue("autoLeft",this.calculateLeft(t,e,!0),t,!0),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(t.isAutoSchedule||!e.hasChildRecords?t.width:t.autoWidth,t.progress),t,!0)},i.prototype.getParentProgress=function(e){var i,a=0,r={};switch(i=this.parent.weekWorkingTime.length>0?this.parent.getSecondsPerDay(e.ganttProperties.startDate?e.ganttProperties.startDate:e.ganttProperties.endDate):this.parent.secondsPerDay,e.ganttProperties.durationUnit){case"hour":a=e.ganttProperties.duration/(i/3600);break;case"minute":a=e.ganttProperties.duration/(i/60);break;default:a=e.ganttProperties.duration}return e.hasChildRecords?(t.setValue("totalProgress",e.ganttProperties.totalProgress,r),t.setValue("totalDuration",e.ganttProperties.totalDuration?e.ganttProperties.totalDuration:0,r)):(t.setValue("totalProgress",e.ganttProperties.progress*a,r),t.setValue("totalDuration",a,r)),r},i.prototype.resetDependency=function(e){var i=this.parent.taskFields.dependency;if(!t.isNullOrUndefined(i)){var a=e.ganttProperties;this.parent.setRecordValue("predecessor",[],a,!0),this.parent.setRecordValue("predecessorsName",null,a,!0),this.parent.setRecordValue("taskData."+i,null,e),this.parent.setRecordValue(i,null,e)}},i.prototype.isUnscheduledTask=function(e,i){for(var a=0,r=null,n=0,s=["startDate","endDate","duration"];n<s.length;n++){var o=s[n];e&&e[o]&&(a++,r=o)}return 1===a||0===a&&!t.isNullOrUndefined(i)&&i.hasChildRecords?[!0,r]:[!1,null]},i.prototype.isFromManual=function(e){return!!(this.parent.allowUnscheduledTasks&&this.parent.editModule&&this.parent.oldRecords&&this.parent.oldRecords.length>0&&t.isNullOrUndefined(e.ganttProperties.startDate)&&t.isNullOrUndefined(e.ganttProperties.endDate)&&!t.isNullOrUndefined(e.ganttProperties.duration)&&!e.hasChildRecords&&e.parentItem&&("Manual"===this.parent.taskMode||"Custom"===this.parent.taskMode&&e[this.parent.taskFields.manual]))},i.prototype.updateParentItems=function(e,i){var a=this,r=i?e:this.parent.getParentTask(e);r=r||e;var n=!1,s=t.isNullOrUndefined(r)?null:r.ganttProperties,o=this.isUnscheduledTask(s,r),l=o[0];o[1];if(this.parent.autoCalculateDateScheduling&&!(this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)||"ResourceView"===this.parent.viewType){if(r&&r.childRecords&&r.childRecords.length>0){var d,h=s.isAutoSchedule?s.startDate:s.autoStartDate,p=s.isAutoSchedule?s.endDate:s.autoEndDate,u=r.childRecords,c=u.length,g=0,f=null,y=null,D=0,v=0,k=0,b=0,w=0;u.some(function(e){var t=a.isUnscheduledTask(e.ganttProperties),i=t[0],r=t[1];return i&&"duration"===r?++w:i||++b,b>0&&w>0});for(var T=b>0&&w>0||void 0,S=this,P=0;P<c;P++)!function(e){if(d=S.parent.loadChildOnDemand&&S.parent.taskFields.hasChildMapping?S.parent.currentViewData.filter(function(t){return t.ganttProperties.taskId===u[e][a.parent.taskFields.id]})[0]:u[e],S.parent.isOnDelete&&d.isDelete)return 1===c&&"ProjectView"===S.parent.viewType&&(n=!0),"continue";var i=void 0,o=void 0,h=S.isUnscheduledTask(d.ganttProperties),p=h[0],b=h[1],w=void 0;if(S.isFromManual(d)){var P=S.parent.oldRecords.filter(function(e){return e.ganttProperties.uniqueID===d.ganttProperties.uniqueID})[0];P&&(w=S.parent.getParentTask(P.parentItem))}var C=w||d,R=w?w.ganttProperties:s;if(i=p&&"startDate"!==b&&"endDate"!==b&&!l?s.startDate:S.getValidStartDate(C.ganttProperties),!r.hasChildRecords||R.isAutoSchedule||t.isNullOrUndefined(C.ganttProperties.autoStartDate)||(i=C.ganttProperties.autoStartDate),o=p&&"startDate"!==b&&"endDate"!==b&&!l?S.getEndDate(s.startDate,C.ganttProperties.duration,C.ganttProperties.durationUnit,C.ganttProperties,!1):S.getValidEndDate(C.ganttProperties),!r.hasChildRecords||R.isAutoSchedule||t.isNullOrUndefined(C.ganttProperties.autoEndDate)||(o=C.ganttProperties.autoEndDate),p&&"startDate"!==b&&"endDate"!==b){var M=S.getDateFromFormat(o),x=S.getDateFromFormat(i);M>y&&(y=M),x<f&&(f=x)}var O=T&&!p||t.isNullOrUndefined(T);if(t.isNullOrUndefined(f)&&O&&(f=S.getDateFromFormat(i)),t.isNullOrUndefined(y)&&O&&(y=S.getDateFromFormat(o)),!t.isNullOrUndefined(o)&&y&&1===S.compareDates(o,y)&&(y=S.getDateFromFormat(o)),!t.isNullOrUndefined(i)&&f&&-1===S.compareDates(i,f)&&(f=S.getDateFromFormat(i)),!d.ganttProperties.isMilestone&&m(d.ganttProperties)){var I=S.getParentProgress(d);v+=t.getValue("totalProgress",I),g+=t.getValue("totalDuration",I),d[S.parent.taskFields.duration]<1&&(g=Number(g.toFixed(4)))}else D++;var E=d.ganttProperties.work;if("string"==typeof E){var F=parseFloat(E);isNaN(F)||(k+=F)}else"number"==typeof E&&(k+=E)}(P);if(!n){var C=this.parent.isOnDelete&&d.isDelete?c-D-1:c-D,R=C>0&&g>0?Number((v/g).toFixed(2)):0,M=r.ganttProperties,x=!(0!==C||!f||!y||f.getTime()!==y.getTime());0!==this.compareDates(h,f)&&(this.parent.setRecordValue(s.isAutoSchedule?"startDate":"autoStartDate",f,r.ganttProperties,!0),(t.isNullOrUndefined(s.autoDuration)?0===s.duration:0===s.autoDuration)&&r.isManual&&x&&r.hasChildRecords&&r.ganttProperties.isAutoSchedule&&"TaskbarEditing"!==this.parent.editModule.taskbarEditModule.taskbarEditedArgs.action&&this.parent.setRecordValue("startDate",f,r.ganttProperties,!0)),0!==this.compareDates(p,y)&&(this.parent.setRecordValue(s.isAutoSchedule?"endDate":"autoEndDate",y,r.ganttProperties,!0),(t.isNullOrUndefined(s.autoDuration)?0===s.duration:0===s.autoDuration)&&r.isManual&&x&&r.hasChildRecords&&r.ganttProperties.isAutoSchedule&&"TaskbarEditing"!==this.parent.editModule.taskbarEditModule.taskbarEditedArgs.action&&this.parent.setRecordValue("endDate",y,r.ganttProperties,!0)),this.parent.setRecordValue("isMilestone",x,M,!0),t.isNullOrUndefined(this.parent.taskFields.milestone)||(this.updateMappingData(r,"milestone"),this.parent.setRecordValue(this.parent.taskFields.milestone,x,r,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.milestone,x,r,!0)),M.isAutoSchedule&&(this.isFromManual(d)?(1===r.childRecords.length&&(r.ganttProperties.duration=d.ganttProperties.duration),this.calculateEndDate(r)):this.calculateDuration(r)),this.updateWorkWithDuration(r);var O=M.work;O=this.parent.isOnEdit?O:O+k,this.parent.setRecordValue("work",O,M,!0),this.parent.setRecordValue("taskType","FixedDuration",M,!0),t.isNullOrUndefined(this.parent.taskFields.type)||this.updateMappingData(r,"type"),this.parent.setRecordValue("progress",Math.floor(R),M,!0),this.parent.setRecordValue("totalProgress",v,M,!0),this.parent.setRecordValue("totalDuration",g,M,!0),this.parent.setRecordValue("autoDuration",M.duration,M,!0),M.isAutoSchedule||(this.parent.setRecordValue("autoDuration",this.calculateAutoDuration(M),M,!0),this.updateAutoWidthLeft(r)),this.parent.allowParentDependency||this.resetDependency(r),this.updateWidthLeft(r),this.updateTaskData(r)}}}else this.parent.setRecordValue("endDate",r.taskData[this.parent.taskFields.endDate],r.ganttProperties,!0);n&&1===r.childRecords.length&&0===r.ganttProperties.duration&&(this.parent.setRecordValue("isMilestone",!0,r.ganttProperties,!0),this.updateWidthLeft(r),this.updateTaskData(r));var I=t.isNullOrUndefined(r)?null:this.parent.getParentTask(r.parentItem);I&&((!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)&&"ResourceView"!==this.parent.viewType||this.updateParentItems(I)),n=!1},i}(O),F="e-left-label-container",U="e-right-label-container",N="e-taskbar-main-container",L="e-task-label",V="e-gantt-child-progressbar-inner-div",B="e-baseline-bar",A="e-chart-row",W="e-child-progress-resizer",H="e-gantt-child-taskbar",j="e-gantt-manualparenttaskbar",z="e-label",G="e-template-padding",q="e-gantt-dependency-view-container",_="e-connectorpoint-left",Z=".e-content",X="e-rangecontainer",Y=function(){function e(e){this.previousCount=-1,this.isSetScrollLeft=!1,this.previousScroll={top:0,left:0},this.parent=e,this.element=this.parent.ganttChartModule.scrollElement,this.addEventListeners()}return e.prototype.addEventListeners=function(){this.parent.on("grid-scroll",this.gridScrollHandler,this),t.EventHandler.add(this.element,"scroll",this.onScroll,this),this.parent.treeGrid.grid.on("showGanttShimmer",this.updateShimmer,this),this.parent.treeGrid.grid.on("removeGanttShimmer",this.removeShimmer,this),this.parent.treeGrid.grid.on("virtualTransform",this.transformChange,this)},e.prototype.removeEventListeners=function(){t.EventHandler.remove(this.element,"scroll",this.onScroll),this.parent.off("grid-scroll",this.gridScrollHandler),this.parent.treeGrid.grid.off("showGanttShimmer",this.updateShimmer),this.parent.treeGrid.grid.off("removeGanttShimmer",this.removeShimmer),this.parent.treeGrid.grid.off("virtualTransform",this.transformChange)},e.prototype.gridScrollHandler=function(e){this.element.scrollTop=t.getValue("top",e),this.isFromTreeGrid=!0},e.prototype.updateContent=function(){var e=this.parent.element,t=Math.round(this.element.scrollLeft/e.offsetWidth);(this.previousCount!==t||this.parent.timelineModule.performedTimeSpanAction||this.parent.timelineModule.isZoomingAction)&&(this.parent.timelineModule.isZoomingAction=!1,this.deleteTableElements(),this.parent.timelineModule.createTimelineSeries(),"Vertical"!==this.parent.gridLines&&"Both"!==this.parent.gridLines||this.parent.renderChartVerticalLines(),this.parent.dayMarkersModule&&this.parent.dayMarkersModule.eventMarkerRender.renderEventMarkers(),this.parent.timelineModule.performedTimeSpanAction=!1,this.parent.dayMarkersModule&&(this.parent.dayMarkersModule.nonworkingDayRender.renderWeekends(),this.parent.dayMarkersModule.nonworkingDayRender.renderHolidays()),this.updateChartElementStyles(),this.previousCount=t,this.isSetScrollLeft&&(this.parent.ganttChartModule.chartTimelineContainer.scrollLeft=this.element.scrollLeft))},e.prototype.getTimelineLeft=function(){var e,t=this.parent.element,i=this.parent.timelineModule.wholeTimelineWidth>3*t.offsetWidth?this.parent.timelineModule.wholeTimelineWidth-3*t.offsetWidth:0;if(this.element.scrollLeft===(this.parent.enableRtl?-i:i))e=this.element.scrollLeft;else{var a=this.parent.enableRtl?-this.element.scrollLeft:this.element.scrollLeft;e=a>t.offsetWidth?a-t.offsetWidth:0}return e>=i&&(e=i),e<=t.offsetWidth&&this.isBackwardScrolled&&(e=0),(this.parent.timelineModule.isZoomToFit||this.parent.timelineModule.isZooming)&&(e=0),e},e.prototype.deleteTableElements=function(){var e=this.parent.element.getElementsByClassName("e-timeline-header-table-container");do{e[0].remove()}while(e.length>0);this.parent.element.querySelector("#ganttContainerline-container")&&(this.parent.element.querySelector("#ganttContainerline-container").innerHTML=""),this.parent.element.querySelector(".e-nonworking-day-container")&&(this.parent.element.querySelector(".e-nonworking-day-container").outerHTML=null)},e.prototype.updateChartElementStyles=function(){var e=this.getTimelineLeft();if(this.parent.enableTimelineVirtualization){var t=this.parent.connectorLineModule.dependencyViewContainer,i=this.parent.chartRowsModule.taskTable;this.parent.enableRtl?(t.style.left=e+"px",i.style.right=-e+"px"):(t.style.left=-e+"px",i.style.left=-e+"px"),i.style.width=this.parent.timelineModule.wholeTimelineWidth+"px"}},e.prototype.updateTopPosition=function(){var e,i=this.parent.treeGrid.element.querySelector(".e-content").scrollTop;if(e=this.parent.virtualScrollModule&&this.parent.enableVirtualization?i-this.parent.virtualScrollModule.getTopPosition():i,!t.isNullOrUndefined(this.parent.dayMarkersModule)){var a=t.getValue("nonworkingDayRender.holidayContainer",this.parent.dayMarkersModule),r=t.getValue("nonworkingDayRender.weekendContainer",this.parent.dayMarkersModule),n=t.getValue("eventMarkerRender.eventMarkersContainer",this.parent.dayMarkersModule);a&&(a.style.top=t.formatUnit(e)),r&&(r.style.top=t.formatUnit(e)),n&&(n.style.top=t.formatUnit(e))}this.parent.chartVerticalLineContainer&&(this.parent.chartVerticalLineContainer.style.top=t.formatUnit(e))},e.prototype.removeShimmer=function(){var e=this.parent;setTimeout(function(){if(e.hideMaskRow(),!e.allowTaskbarOverlap&&e.showOverAllocation){for(var t=0;t<e.currentViewData.length;t++){var i=e.chartRowsModule.ganttChartTableBody.childNodes[t];"none"!==i.style.display&&e.currentViewData[t].hasChildRecords&&!e.currentViewData[t].expanded&&(e.ganttChartModule.isExpandAll||e.ganttChartModule.isCollapseAll?e.treeGrid.getRowByIndex(t).style.height=i.style.height:e.treeGrid.getRows()[t].style.height=i.style.height)}e.contentHeight=e.enableRtl?e.element.getElementsByClassName("e-content")[2].children[0].offsetHeight:e.element.getElementsByClassName("e-content")[0].children[0].offsetHeight,e.element.getElementsByClassName("e-chart-rows-container")[0].style.height=e.contentHeight+"px"}},0)},e.prototype.transformChange=function(){this.parent.ganttChartModule.virtualRender.adjustTable(),this.parent.ganttChartModule.scrollObject.updateTopPosition()},e.prototype.updateShimmer=function(){var e=this.parent;setTimeout(function(){e.showMaskRow()},0)},e.prototype.updateSpinner=function(){var e=this.parent;this.parent.showSpinner(),window.clearTimeout(this.isScrolling),this.isScrolling=setTimeout(function(){e.hideSpinner()},200)},e.prototype.onScroll=function(){var e=this,i={};this.element.scrollTop!==this.previousScroll.top&&(this.isFromTreeGrid?this.isFromTreeGrid=!1:this.parent.notify("chartScroll",{top:this.element.scrollTop}),i.previousScrollTop=this.previousScroll.top,this.previousScroll.top=this.element.scrollTop,i.scrollTop=this.element.scrollTop,i.scrollDirection="Vertical",i.action="VerticalScroll",this.updateTopPosition()),this.element.scrollLeft!==this.previousScroll.left&&(this.isBackwardScrolled=this.element.scrollLeft<this.previousScroll.left&&!this.parent.enableRtl,this.parent.ganttChartModule.chartTimelineContainer.scrollLeft=this.element.scrollLeft,i.previousScrollLeft=this.previousScroll.left,this.previousScroll.left=this.element.scrollLeft,i.scrollLeft=this.element.scrollLeft,i.scrollDirection="Horizontal",i.action="HorizontalScroll",this.parent.enableTimelineVirtualization&&this.parent.timelineModule.wholeTimelineWidth>3*this.parent.element.offsetWidth?(this.isSetScrollLeft=!0,this.parent.timelineModule.totalTimelineWidth>3*this.parent.element.offsetWidth&&this.updateContent(),this.parent.ganttChartModule.updateWidthAndHeight(),this.parent.element.getElementsByClassName("e-weekend-container")[0]&&(this.parent.element.getElementsByClassName("e-weekend-container")[0].style.height="100%"),this.parent.element.getElementsByClassName("e-holiday-container")[0]&&(this.parent.element.getElementsByClassName("e-holiday-container")[0].style.height="100%")):this.parent.enableTimelineVirtualization&&this.parent.timelineModule.wholeTimelineWidth<3*this.parent.element.offsetWidth&&this.parent.connectorLineModule.svgObject.setAttribute("width","100%")),this.parent.timelineModule.performedTimeSpanAction=!1,t.isNullOrUndefined(i.scrollDirection)||!0!==this.parent.enableVirtualization&&!0!==this.parent.enableTimelineVirtualization||!this.parent.isToolBarClick&&!t.isNullOrUndefined(this.parent.isToolBarClick)||(this.parent.isVirtualScroll=!0,(this.parent.showIndicator||t.isNullOrUndefined(this.parent.showIndicator))&&(!this.parent.enableVirtualMaskRow&&this.parent.enableVirtualization&&"Spinner"===this.parent.loadingIndicator.indicatorType?this.updateSpinner():this.parent.enableTimelineVirtualization&&!this.parent.isRowSelected&&Math.abs(this.element.scrollLeft-i.previousScrollLeft)>1e3&&(this.parent.enableVirtualMaskRow||"Spinner"!==this.parent.loadingIndicator.indicatorType?(this.parent.showMaskRow(),setTimeout(function(){e.removeShimmer()},0)):this.updateSpinner()),this.parent.isRowSelected=!1)),this.isSetScrollLeft=!1,this.parent.isToolBarClick=!0,i.requestType="scroll",this.parent.trigger("actionComplete",i)},e.prototype.setHeight=function(e){this.element.style.height=t.formatUnit(e)},e.prototype.setWidth=function(e){this.element.style.width=t.formatUnit(e)},e.prototype.setScrollTop=function(e){this.element.scrollTop=e,this.parent.treeGrid.element.querySelector(".e-content").scrollTop=e},e.prototype.setScrollLeft=function(e,t){e=-1===t&&this.parent.enableRtl?-e:e,this.isSetScrollLeft=!0,this.element.scrollLeft=e,this.parent.ganttChartModule.chartTimelineContainer.scrollLeft=this.element.scrollLeft,this.parent.enableTimelineVirtualization||(this.previousScroll.left=this.element.scrollLeft)},e.prototype.destroy=function(){this.removeEventListeners()},e}(),K=function(){function e(e){this.parent=e}return e.prototype.renderWrapper=function(){this.wrapper=t.createElement("div",{className:"e-virtualtable",styles:"position: absolute; transform: translate(0px, 0px);"}),this.parent.ganttChartModule.scrollElement.appendChild(this.wrapper),this.virtualTrack=t.createElement("div",{className:"e-virtualtrack",styles:"position: relative; pointer-events: none; width: 100%;"}),this.parent.ganttChartModule.scrollElement.appendChild(this.virtualTrack),this.wrapper.appendChild(this.parent.ganttChartModule.chartBodyContent)},e.prototype.appendChildElements=function(e){this.wrapper.appendChild(e)},e.prototype.adjustTable=function(){var e=this.parent.treeGrid.getContent().querySelector(".e-content").querySelector(".e-virtualtable");if(this.parent.enableTimelineVirtualization){var t=document.getElementsByClassName("e-virtualtable")[1].style.transform,i=this.parent.treeGrid.element.getElementsByClassName("e-virtualtable")[0].style.transform,a=void 0;a=""!==t?t.match(/translate.*\((.+)\)/)[1].split(", ")[0]:this.parent.ganttChartModule.scrollElement.getElementsByClassName("e-virtualtable")[0].style.transform.match(/translate.*\((.+)\)/)[1].split(", ")[0];var r=i.match(/translate.*\((.+)\)/)[1].split(", ")[1];this.parent.ganttChartModule.virtualRender.wrapper.style.transform="translate("+a+", "+r+")"}else this.parent.ganttChartModule.virtualRender.wrapper.style.transform=e.style.transform},e}(),Q=function(){function e(e){this.isExpandCollapseFromChart=!1,this.isExpandAll=!1,this.isCollapseAll=!1,this.debounceTimeoutNext=0,this.debounceTimeout=0,this.isGanttElement=!1,this.previousPinchDistance=0,this.currentToolbarIndex=-1,this.isPinching=!1,this.preventScrollIntoView=!1,this.parent=e,this.chartTimelineContainer=null,this.rangeViewContainer=t.createElement("div",{className:X}),this.rangeViewContainer.setAttribute("role","button"),this.rangeViewContainer.setAttribute("aria-label","RangeContainer"),this.virtualRender=new K(this.parent),this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on("renderPanels",this.renderChartContainer,this),this.parent.on("recordsUpdated",this.renderChartElements,this),this.parent.on("dataReady",this.renderInitialContents,this),this.parent.on("tree-grid-created",this.renderChartContents,this),this.parent.on("destroy",this.destroy,this)},e.prototype.renderChartContents=function(){this.parent.notify("refreshDayMarkers",{}),this.wireEvents()},e.prototype.renderChartContainer=function(){this.chartElement=t.createElement("div",{id:this.parent.element.id+"GanttChart",className:"e-gantt-chart"}),this.parent.chartPane.appendChild(this.chartElement),this.renderTimelineContainer(),this.renderBodyContainers()},e.prototype.renderInitialContents=function(){this.parent.timelineModule.createTimelineSeries()},e.prototype.renderOverAllocationContainer=function(){for(var e=0;e<this.parent.flatData.length;e++){var t=this.parent.flatData[e];t.childRecords.length>0&&this.parent.dataOperation.updateOverlappingValues(t)}var i=this.parent.element.querySelector("."+X);i&&(i.innerHTML=""),0===this.parent.treeGrid.grid.filterSettings.columns.length&&this.renderRangeContainer(this.parent.currentViewData)},e.prototype.renderChartElements=function(){if(this.parent.isFromOnPropertyChange)this.rangeViewContainer.innerHTML="",this.parent.updateProjectDates(this.parent.cloneProjectStartDate,this.parent.cloneProjectEndDate,this.parent.isTimelineRoundOff),this.parent.isFromOnPropertyChange=!1;else{this.parent.chartRowsModule.renderChartRows(),this.parent.predecessorModule&&this.parent.taskFields.dependency&&(this.parent.connectorLineIds=[],this.parent.updatedConnectorLineCollection=[],this.parent.predecessorModule.createConnectorLinesCollection()),this.parent.connectorLineModule.renderConnectorLines(this.parent.updatedConnectorLineCollection);for(var e=0;e<this.parent.chartRowsModule.ganttChartTableBody.children.length;e++)if(this.parent.chartRowsModule.ganttChartTableBody.children[e].children[0].children[1].children[4])this.parent.chartRowsModule.ganttChartTableBody.children[e].children[0].children[1].children[1].setAttribute("tabindex","-1"),this.parent.chartRowsModule.ganttChartTableBody.children[e].children[0].children[1].children[2].setAttribute("tabindex","-1"),this.parent.chartRowsModule.ganttChartTableBody.children[e].children[0].children[1].children[4].setAttribute("tabindex","-1");else if("ProjectView"===this.parent.viewType){var i=this.parent.chartRowsModule.ganttChartTableBody.children[parseInt(e.toString(),10)].children[0].children[1].children[1];t.isNullOrUndefined(i)||this.parent.chartRowsModule.ganttChartTableBody.children[e].children[0].children[1].children[1].setAttribute("tabindex","-1")}else this.parent.chartRowsModule.ganttChartTableBody.children[parseInt(e.toString(),10)].children[0].children[1].children[0]&&this.parent.chartRowsModule.ganttChartTableBody.children[e].children[0].children[1].children[0].setAttribute("tabindex","-1");var a=this.parent.criticalPathModule;this.parent.enableCriticalPath&&a&&a.criticalPathCollection&&this.parent.criticalPathModule.criticalConnectorLine(a.criticalPathCollection,a.detailPredecessorCollection,this.parent.enableCriticalPath,a.predecessorCollectionTaskIds),this.parent.showOverAllocation&&this.renderOverAllocationContainer()}this.updateWidthAndHeight();var r=this.parent.loadChildOnDemand&&(this.parent.isExpandPerformed||!t.isNullOrUndefined(this.parent.isVirtualScroll)&&this.parent.isVirtualScroll);this.parent.isLoad&&!r&&this.parent.notify("selectRowByIndex",{}),this.parent.timelineModule.isZoomedToFit&&this.parent.timelineModule.processZoomToFit()},e.prototype.renderRangeContainer=function(e){var t,i,a,r=e.length;if(0===this.parent.treeGrid.grid.filterSettings.columns.length)for(t=0;t<r;t++)(a=(i=e[t]).ganttProperties.workTimelineRanges)&&this.renderRange(a,i)},e.prototype.getTopValue=function(e){var t=this.parent.getExpandedRecords(this.parent.currentViewData),i=t.indexOf(e);if(e.parentItem&&-1===i){var a=this.parent.getRecordByID(e.parentItem.taskId);i=t.indexOf(a)}return e.expanded?(i+1)*this.parent.rowHeight:i*this.parent.rowHeight},e.prototype.getHierarchyChildRecords=function(e){for(var t=[],i=0,a=e;i<a.length;i++){var r=a[i];r.childRecords&&r.childRecords.length>0&&(t.push(r),this.collectHierarchyChildren(r.childRecords,t))}return t},e.prototype.collectHierarchyChildren=function(e,t){for(var i=0,a=e;i<a.length;i++){var r=a[i];r.childRecords&&r.childRecords.length>0&&(t.push(r),this.collectHierarchyChildren(r.childRecords,t))}},e.prototype.getRangeHeight=function(e){var t=Math.floor(this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight);if(!e.expanded&&e.hasChildRecords)return this.calculateCollapsedRowHeight(t);var i=this.calculateHierarchyChildLength(e);return this.calculateExpandedRowHeight(e.childRecords.length,i,t)},e.prototype.calculateCollapsedRowHeight=function(e){return this.parent.rowHeight-e},e.prototype.calculateHierarchyChildLength=function(e){if(!e.childRecords||0===e.childRecords.length)return 0;for(var t=0,i=0,a=this.getHierarchyChildRecords(e.childRecords);i<a.length;i++){var r=a[i];0!==r.childRecords.length&&r.expanded&&(t+=r.childRecords.length)}return t},e.prototype.calculateExpandedRowHeight=function(e,t,i){return(e+t)*this.parent.rowHeight-i},e.prototype.renderRange=function(e,i){var a=0,r=this.parent.currentViewData.indexOf(i);if(!this.parent.allowTaskbarOverlap&&this.parent.enableMultiTaskbar){var n=i.parentItem?this.parent.getParentTask(i.parentItem):null;if(i.parentItem&&n&&!n.expanded&&i.hasChildRecords&&!i.expanded)a=this.parent.getRowByIndex(this.parent.getRootParent(i,0).index).offsetTop;else{var s=this.parent.getRowByIndex(r).offsetTop;a=i.expanded?s+this.parent.rowHeight:s}}else a=this.getTopValue(i);var o=this.rangeViewContainer.querySelector(".rangeContainer"+i.ganttProperties.rowUniqueID);o&&o.remove();var l=t.createElement("div",{className:"rangeContainer"+i.ganttProperties.rowUniqueID,styles:"top:"+a+"px; position: absolute;"});if((0!==i.level||i.expanded||!t.isNullOrUndefined(i.parentItem)||this.parent.enableMultiTaskbar)&&(!(i.level>0&&i.expanded)||this.parent.getRecordByID(i.parentItem.taskId).expanded)){for(var d=0;d<e.length;d++){var h=void 0,p=this.parent.chartRowsModule.ganttChartTableBody.childNodes;this.parent.allowTaskbarOverlap||i.expanded||!this.parent.enableMultiTaskbar?h=this.getRangeHeight(i):(r=(n=this.parent.getRootParent(i,0)).expanded?r:this.parent.currentViewData.indexOf(n),h=parseInt(p[r].style.height,10)-(this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight));var u=t.createElement("div",{className:"e-rg-rangdiv e-leftarc",styles:(this.parent.enableRtl?"right:":"left:")+(this.parent.enableRtl?e[d].left+e[d].width-5:e[d].left)+"px;\n top: "+Math.floor((this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight)/2)+"px;\n height: "+(h+1)+"px; border-right: 0px;\n z-index: "+("ProjectView"===this.parent.viewType?i.childRecords.length>1?i.childRecords.length+1:i.childRecords.length:6)}),c=t.createElement("div",{className:"e-rg-rangdiv e-rightarc",styles:(this.parent.enableRtl?"right:":"left:")+(this.parent.enableRtl?e[d].left:e[d].left+e[d].width-5)+"px;\n top: "+Math.floor((this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight)/2)+"px; height: "+(h+1)+"px;\n border-left: 0px;\n z-index: "+("ProjectView"===this.parent.viewType?i.childRecords.length>1?i.childRecords.length+1:i.childRecords.length:6)});l.appendChild(u),l.appendChild(c),this.rangeViewContainer.appendChild(l)}this.parent.ganttChartModule.chartBodyContent.appendChild(this.rangeViewContainer)}},e.prototype.renderTimelineContainer=function(){this.chartTimelineContainer=t.createElement("div",{className:"e-timeline-header-container"}),this.parent.enableRtl&&(this.chartTimelineContainer.style.borderLeftWidth="1px",this.chartTimelineContainer.style.borderRightWidth="0px"),this.chartTimelineContainer.setAttribute("role","presentation"),this.chartElement.appendChild(this.chartTimelineContainer)},e.prototype.renderBodyContainers=function(){this.chartBodyContainer=t.createElement("div",{className:"e-chart-root-container"}),this.chartElement.appendChild(this.chartBodyContainer),this.scrollElement=t.createElement("div",{className:"e-chart-scroll-container e-content",styles:"position:relative;"}),this.chartBodyContainer.appendChild(this.scrollElement),this.chartBodyContent=t.createElement("div",{className:"e-chart-rows-container",styles:"position:relative; overflow:hidden "}),this.parent.virtualScrollModule&&this.parent.enableVirtualization||this.parent.enableTimelineVirtualization?this.parent.ganttChartModule.virtualRender.renderWrapper():this.scrollElement.appendChild(this.chartBodyContent),this.scrollObject=new Y(this.parent);var e=0;t.isNullOrUndefined(this.parent.toolbarModule)||t.isNullOrUndefined(this.parent.toolbarModule.element)||(e=this.parent.toolbarModule.element.offsetHeight),this.scrollObject.setHeight(this.parent.ganttHeight-this.chartTimelineContainer.offsetHeight-e)},e.prototype.updateWidthAndHeight=function(){var e=0===this.parent.contentHeight?this.parent.flatData.length>1?36:0:this.parent.contentHeight,i=this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0];if(e>=i.offsetHeight||"auto"===this.parent.height||i.offsetHeight-e<36)this.chartBodyContent.style.height=t.formatUnit(e);else{var a=this.parent.element.getElementsByClassName("e-chart-rows-container")[0].offsetHeight;i.offsetHeight>=a?this.chartBodyContent.style.height=i.offsetHeight-17+"px":this.chartBodyContent.style.height=i.offsetHeight+"px"}if(this.parent.timelineModule.isZoomToFit&&this.parent.enableTimelineVirtualization?this.chartBodyContent.style.width=this.parent.enableTimelineVirtualization&&this.parent.timelineModule.totalTimelineWidth>3*this.parent.element.offsetWidth?t.formatUnit(3*this.parent.element.offsetWidth):t.formatUnit(this.parent.timelineModule.totalTimelineWidth-this.parent.timelineModule.clientWidthDifference):this.chartBodyContent.style.width=this.parent.enableTimelineVirtualization&&this.parent.timelineModule.totalTimelineWidth>3*this.parent.element.offsetWidth?t.formatUnit(3*this.parent.element.offsetWidth):t.formatUnit(this.parent.timelineModule.totalTimelineWidth),this.parent.timelineModule.isZoomedToFit&&this.parent.enableVirtualization){var r=Math.abs(this.parent.timelineModule.totalTimelineWidth-this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0].clientWidth);this.parent.ganttChartModule.chartBodyContent.style.width=t.formatUnit(this.parent.timelineModule.totalTimelineWidth-r)}this.setVirtualHeight(),this.parent.notify("updateHeight",{}),this.parent.updateGridLineContainerHeight(),this.updateLastRowBottomWidth()},e.prototype.setVirtualHeight=function(){if(this.parent.virtualScrollModule&&this.parent.enableVirtualization){t.getValue("virtualTrack",this.parent.ganttChartModule.virtualRender).style.height=this.parent.treeGrid.element.getElementsByClassName("e-virtualtrack")[0].style.height;var e=t.getValue("wrapper",this.parent.ganttChartModule.virtualRender),i=this.parent.treeGrid.element.getElementsByClassName("e-virtualtable")[0].style.transform,a=document.getElementsByClassName("e-virtualtable")[1].style.transform;if(this.parent.enableTimelineVirtualization){var r=void 0;"translate(0px)"===i&&navigator.userAgent.includes("Firefox")&&(i="translate(0px, 0px)"),r=""!==a?a.match(/translate.*\((.+)\)/)[1].split(", ")[0]:this.parent.ganttChartModule.scrollElement.getElementsByClassName("e-virtualtable")[0].style.transform.match(/translate.*\((.+)\)/)[1].split(", ")[0];var n=i.match(/translate.*\((.+)\)/)[1].split(", ")[1];e.style.transform="translate("+r+", "+n+")"}else e.style.transform=i}},e.prototype.updateLastRowBottomWidth=function(){if(this.parent.currentViewData.length>0&&"auto"!==this.parent.height){var e=this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.currentViewData:this.parent.expandedRecords,i=e[e.length-1],a=this.parent.currentViewData.indexOf(i),r=this.parent.getRowByIndex(a),n=this.parent.chartRowsModule.ganttChartTableBody;if(n.querySelectorAll(".e-chart-row-cell.e-chart-row-border.e-lastrow")&&t.removeClass(n.querySelectorAll(".e-chart-row-cell.e-chart-row-border.e-lastrow"),"e-lastrow"),this.chartBodyContent.clientHeight<this.chartBodyContainer.clientHeight&&r){t.addClass(r.querySelectorAll("td"),"e-lastrow");var s=0===this.parent.contentHeight?this.parent.flatData.length>1?36:0:this.parent.contentHeight,o=this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0];if(s>=o.offsetHeight||o.offsetHeight-s<36)this.chartBodyContent.style.height=t.formatUnit(s);else{var l=this.parent.element.getElementsByClassName("e-chart-rows-container")[0].offsetHeight;o.offsetHeight>=l?this.chartBodyContent.style.height=o.offsetHeight-17+"px":this.chartBodyContent.style.height=o.offsetHeight+"px"}}}},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("renderPanels",this.renderChartContainer),this.parent.off("recordsUpdated",this.renderChartElements),this.parent.off("dataReady",this.renderInitialContents),this.parent.off("tree-grid-created",this.renderChartContents),this.parent.off("destroy",this.destroy))},e.prototype.ganttChartMouseDown=function(e){var i=!1;if("touchstart"===e.type&&e instanceof TouchEvent&&e.touches&&2===e.touches.length&&(this.initPinchDistance=this.calculatePinchDistance(e.touches[0],e.touches[1]),this.isPinching=!0),this.parent.allowTaskbarDragAndDrop&&this.parent.editModule&&this.parent.editSettings.allowTaskbarEditing&&!this.isPinching){var a=this.parent.editModule.taskbarEditModule.getTaskBarAction(e);if("ChildDrag"===a||"ParentDrag"===a||"MilestoneDrag"===a||"ManualParentDrag"===a){var r={cancel:i,data:this.getRecordByTaskBar(e.target),target:e.target,chartRow:t.closest(e.target,"tr")};this.parent.trigger("rowDragStartHelper",r),i=r.cancel}}if(!i&&!this.isPinching){3!==e.which&&this.parent.editSettings.allowTaskbarEditing&&(this.parent.notify("chartMouseDown",e),this.parent.element.tabIndex=0);var n=!1;this.parent.editSettings.allowTaskbarEditing&&(this.parent.element.querySelector(".e-left-resize-gripper")||this.parent.element.querySelector(".e-left-connectorpoint-outer-div"))&&(n=!0),n&&2!==e.button||this.parent.editSettings.allowEditing&&this.parent.treeGrid.element.getElementsByClassName("e-editedbatchcell").length>0&&this.parent.treeGrid.endEdit()}},e.prototype.calculatePinchDistance=function(e,t){var i=t.clientX-e.clientX,a=t.clientY-e.clientY;return Math.sqrt(i*i+a*a)},e.prototype.ganttChartMouseClick=function(e){this.parent.autoFocusTasks&&this.scrollToTarget(e),this.parent.notify("chartMouseClick",e)},e.prototype.ganttChartMouseUp=function(e){if("touchend"===e.type){this.initPinchDistance=null,this.isPinching=!1;var i=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-taskbar-resize-div");t.isNullOrUndefined(i)||i.remove();var a=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-clone-taskbar")||this.parent.chartPane.querySelector(".e-clone-taskbar");t.isNullOrUndefined(a)||a.parentElement.parentElement.remove();var r=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-gantt-false-line");t.isNullOrUndefined(r)||this.parent.editModule.taskbarEditModule.removeFalseLine(!0)}if(this.parent.editSettings.allowTaskbarEditing&&this.parent.notify("chartMouseUp",e),!this.parent.editSettings.allowEditing){var n=!1;if(this.parent.editSettings.allowTaskbarEditing&&t.getValue("editModule.taskbarEditModule.isMouseDragged",this.parent)&&t.getValue("editModule.taskbarEditModule.taskBarEditAction",this.parent)&&(n=!0),!n){var s=e.target,o=e.target.classList.contains(N)||t.closest(e.target,"."+N);!t.closest(s,".e-gantt-parent-taskbar")||this.parent.editSettings.allowEditing||this.parent.isAdaptive?!o&&this.parent.autoFocusTasks&&this.scrollToTarget(e):this.chartExpandCollapseRequest(e)}}},e.prototype.scrollToTarget=function(e){var i=t.closest(e.target,"tr");if(i&&this.parent.element.contains(i)&&(this.parent.element.querySelectorAll(".e-chart-rows-container")[0].contains(e.target)||this.parent.element.querySelectorAll(".e-gridcontent")[0].contains(e.target))&&this.parent.currentViewData.length>0){var a=t.getValue("rowIndex",t.closest(e.target,"tr")),r=this.parent.currentViewData[a].ganttProperties.startDate,n=this.parent.currentViewData[a].ganttProperties.left;if(!t.isNullOrUndefined(r)){var s=this.parent.enableTimelineVirtualization?{}:this.parent.dataOperation.getTaskLeft(r,!1);this.parent.autoFocusTasks&&(this.parent.enableTimelineVirtualization?this.updateScrollLeft(n):this.updateScrollLeft(s))}}},e.prototype.updateScrollLeft=function(e){e=e>0?e:0,e=this.scrollElement.scrollWidth<=e?this.scrollElement.scrollWidth:e,(this.scrollElement.offsetWidth+this.parent.ganttChartModule.scrollElement.scrollLeft<e||this.scrollElement.scrollLeft>e)&&this.scrollObject.setScrollLeft(e-50,this.parent.enableRtl?-1:0)},e.prototype.mouseUp=function(e){"touchend"===e.type&&(this.initPinchDistance=null,this.isPinching=!1),t.isNullOrUndefined(this.parent.editModule)||t.isNullOrUndefined(this.parent.editModule.taskbarEditModule)||this.parent.editModule.taskbarEditModule.removeFalseLine(!1);var i=this.parent.element.querySelector(".e-taskbar-resize-div");if(t.isNullOrUndefined(i)||i.remove(),this.parent.allowTaskbarDragAndDrop&&this.parent.editModule&&this.parent.editModule.taskbarEditModule&&(this.parent.editModule.taskbarEditModule.previousLeftValue=0),this.parent.allowRowDragAndDrop){var a=this.parent.element.querySelector(".e-ganttdrag");a&&a.remove()}this.isGanttElement||this.parent.notify("chartMouseUp",e),this.isGanttElement=!1},e.prototype.documentMouseUp=function(e){if("touchend"===e.type&&(this.initPinchDistance=null,this.isPinching=!1,this.previousPinchDistance=0),this.isGanttElement=!0,(e.target.classList.contains("e-treegridexpand")||e.target.classList.contains("e-treegridcollapse"))&&!0===t.getValue("isEditCollapse",this.parent.treeGrid)&&t.setValue("isEditCollapse",!1,this.parent.treeGrid),this.parent.allowRowDragAndDrop){var i=this.parent.element.querySelector(".e-ganttdrag");i&&i.remove()}if(!this.parent.isDestroyed&&3!==e.which){var a=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-taskbar-resize-div");t.isNullOrUndefined(a)||a.remove();var r=this.parent.element.getElementsByClassName("e-clone-taskbar")[0];t.isNullOrUndefined(r)||r.parentElement.parentElement.remove();var n=!1;if(this.parent.editSettings.allowTaskbarEditing&&t.getValue("editModule.taskbarEditModule.isMouseDragged",this.parent)&&t.getValue("editModule.taskbarEditModule.taskBarEditAction",this.parent)&&(n=!0),this.parent.notify("chartMouseUp",e),this.parent.showActiveElement&&(this.parent.showIndicator=!0,this.focusedElement&&!e.target.classList.contains("e-split-bar")&&(this.focusedElement.tabIndex=0===this.focusedElement.tabIndex?-1:this.focusedElement.tabIndex,t.removeClass([this.focusedElement],"e-active-container"))),!n){var s=e.target,o=e.target.classList.contains(N)||t.closest(e.target,"."+N);t.closest(s,".e-gantt-parent-taskbar")&&!this.parent.editSettings.allowEditing?this.chartExpandCollapseRequest(e):!o&&this.parent.autoFocusTasks&&this.scrollToTarget(e)}if(this.parent.editModule&&this.parent.editModule.taskbarEditModule&&this.parent.editModule.taskbarEditModule.removeFalseLine(!0),!t.isNullOrUndefined(this.parent.onTaskbarClick)&&!n){var s=e.target,l=t.closest(s,".e-gantt-parent-taskbar,.e-gantt-child-taskbar,.e-gantt-milestone");l&&this.onTaskbarClick(e,s,l)}}},e.prototype.onTaskbarClick=function(e,i,a){var r,n=t.closest(i,"tr");t.isNullOrUndefined(n)||(r=t.getValue("rowIndex",n));var s={data:this.getRecordByTarget(e),taskbarElement:a,rowIndex:r,target:i};this.parent.trigger("onTaskbarClick",s)},e.prototype.ganttChartLeave=function(e){this.parent.editSettings.allowTaskbarEditing&&this.parent.notify("chartMouseLeave",e)},e.prototype.ganttChartMove=function(e){if("touchmove"===e.type&&!0===this.isPinching&&e instanceof TouchEvent&&e.touches&&2===e.touches.length){var i=this.calculatePinchDistance(e.touches[0],e.touches[1]);Math.abs(this.previousPinchDistance-i)>15&&(i>this.previousPinchDistance?this.parent.timelineModule.processZooming(!0):i<this.previousPinchDistance&&this.parent.timelineModule.processZooming(!1),this.previousPinchDistance=i)}if(this.parent.editSettings.allowTaskbarEditing&&!1===this.isPinching){if(this.parent.element.getElementsByClassName("e-clone-taskbar").length>0&&!this.parent.enableRtl){if(("touchmove"===e.type||"touchstart"===e.type||"touchend"===e.type?e.changedTouches[0].pageX:e.pageX)<=this.parent.getOffsetRect(this.parent.ganttChartModule.chartElement).left)return}this.parent.notify("chartMouseMove",e),!t.isNullOrUndefined(this.parent.taskFields.dependency)&&this.parent.connectorLineEditModule&&this.parent.connectorLineEditModule.updateConnectorLineEditElement(e)}},e.prototype.contextClick=function(e){if(this.parent.allowFiltering&&this.parent.filterModule&&this.parent.filterModule.closeFilterOnContextClick(e.srcElement),this.parent.allowTaskbarDragAndDrop){var i=this.parent.chartPane.querySelector(".e-clone-taskbar");t.isNullOrUndefined(i)||i.parentElement.parentElement.remove()}},e.prototype.mouseMoveHandler=function(e){if(!t.isNullOrUndefined(this.parent.onMouseMove)&&(this.parent.flatData.length||e.target.classList.contains("e-header-cell-label")||e.target.classList.contains("e-headercell"))){var i=e.target,a={originalEvent:e},r=t.closest(i,".e-chart-row-cell,.e-connector-line-container,.e-event-markers,.e-header-cell-label,.e-rowcell,.e-headercell,.e-indicator-span");if(r){var n=void 0,s=t.closest(i,".e-rowcell,.e-chart-row-cell"),o=t.closest(i,".e-rowcell,.e-headercell");if(s&&(n=this.parent.ganttChartModule.getRecordByTarget(e),a.data=n),o){var l=t.getValue("cellIndex",o);a.column=this.parent.treeGrid.columns[l]}if(t.closest(i,".e-indicator-span")){var d=0,h=n.ganttProperties.indicators;if(h.length>1)for(d=0;d<h.length&&h[d].name!==r.innerText.trim();d++);a.indicator=h[d]}if(t.closest(i,".e-connector-line-container")&&((p={}).target=r,a.predecessor=this.parent.tooltipModule.getPredecessorTooltipData(p)),t.closest(i,".e-event-markers")){var p={};p.target=r,a.eventMarkers=this.parent.tooltipModule.getMarkerTooltipData(p)}i.classList.contains("e-header-cell-label")&&(a.date=new Date(i.dataset.content))}this.parent.trigger("onMouseMove",a)}},e.prototype.doubleClickHandler=function(e){var i=e.target,a=t.closest(i,"tr"),r=t.getValue("rowIndex",a),n=this.parent.ganttChartModule.getRecordByTarget(e);this.parent.editSettings.allowEditing&&this.parent.treeGrid.element.getElementsByClassName("e-editedbatchcell").length>0&&this.parent.treeGrid.endEdit(),this.parent.notify("chartDblClick",e);var s={row:a,rowData:n,rowIndex:r,target:i};this.recordDoubleClick(s)},e.prototype.recordDoubleClick=function(e){this.parent.trigger("recordDoubleClick",e)},e.prototype.getRecordByTarget=function(e){var i,a=t.closest(e.target,"div."+N);if(t.isNullOrUndefined(a)){if(a=t.closest(e.target,"tr")){var r=t.getValue("rowIndex",t.closest(e.target,"tr"));i=this.parent.currentViewData[r]}}else{var n=a.getAttribute("rowUniqueId");i=this.parent.getRecordByID(n)}return i},e.prototype.getChartRows=function(){return null!==document.getElementById(this.parent.element.id+"GanttTaskTableBody")?document.getElementById(this.parent.element.id+"GanttTaskTableBody").querySelectorAll(".e-chart-row"):null},e.prototype.chartExpandCollapseRequest=function(e){if(!this.parent.enableMultiTaskbar){var i=e.target,a=t.closest(i,".e-gantt-parent-taskbar"),r=this.getRecordByTarget(e),n=t.closest(i,"tr"),s=t.getValue("rowIndex",n),o={data:r,gridRow:this.parent.treeGrid.getRows()[s],chartRow:n,cancel:!1};this.isExpandCollapseFromChart=!0,a.classList.contains("e-row-expand")?this.collapseGanttRow(o):a.classList.contains("e-row-collapse")&&this.expandGanttRow(o)}},e.prototype.reRenderConnectorLines=function(){this.parent.connectorLineModule.dependencyViewContainer.innerHTML="",this.parent.connectorLineIds=[],this.parent.updatedConnectorLineCollection=[],this.parent.predecessorModule.createConnectorLinesCollection(),this.parent.connectorLineModule.renderConnectorLines(this.parent.updatedConnectorLineCollection);var e=this.parent.criticalPathModule;this.parent.enableCriticalPath&&e&&e.criticalPathCollection&&e.criticalConnectorLine(e.criticalPathCollection,e.detailPredecessorCollection,!0,e.predecessorCollectionTaskIds)},e.prototype.collapseGanttRow=function(e){var i=this;this.parent.trigger("collapsing",e,function(e){i.isExpandCollapseFromChart&&!t.getValue("cancel",e)&&i.collapsedGanttRow(e),i.isExpandCollapseFromChart=!1})},e.prototype.collapsedGanttRow=function(e){var i,a=this;if(i=this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?this.parent.currentViewData.filter(function(t){return t.ganttProperties[a.parent.taskFields.id]===e.data[a.parent.taskFields.id]})[0]:t.getValue("data",e),t.isNullOrUndefined(e.gridRow)&&this.parent.enableVirtualization||t.isNullOrUndefined(e.chartRow))return void(i&&(i.expanded=!1));if(this.isExpandCollapseFromChart){this.expandCollapseChartRows("collapse",t.getValue("chartRow",e),i,null);var r=this.parent.taskFields.id;if(this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping){var n=this.parent.treeGrid.getCurrentViewRecords().filter(function(t){return t[r]===e.data[r]})[0];this.parent.treeGrid.collapseRow(t.getValue("gridRow",e),n)}else this.parent.treeGrid.collapseRow(t.getValue("gridRow",e),i);this.isExpandCollapseFromChart=!1}else this.expandCollapseChartRows("collapse",t.getValue("chartRow",e),i,null);"ResourceView"!==this.parent.viewType&&"ProjectView"!==this.parent.viewType||this.renderMultiTaskbar(i),this.parent.enableVirtualization||this.parent.updateContentHeight(),this.updateWidthAndHeight(),this.reRenderConnectorLines(),t.getValue("chartRow",e).setAttribute("aria-expanded","false")},e.prototype.expandGanttRow=function(e){var i=this;this.parent.trigger("expanding",e,function(e){i.isExpandCollapseFromChart&&!t.getValue("cancel",e)&&i.expandedGanttRow(e),i.isExpandCollapseFromChart=!1})},e.prototype.expandedGanttRow=function(e){var i,a=this;if(i=this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?this.parent.currentViewData.filter(function(t){return t.ganttProperties.taskId===e.data[a.parent.taskFields.id]})[0]:t.getValue("data",e),t.isNullOrUndefined(e.gridRow)&&this.parent.enableVirtualization||t.isNullOrUndefined(e.chartRow))return void(i&&(i.expanded=!0));if(this.isExpandCollapseFromChart){this.expandCollapseChartRows("expand",t.getValue("chartRow",e),i,null);var r=this.parent.taskFields.id;if(this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping){var n=this.parent.treeGrid.getCurrentViewRecords().filter(function(t){return t[r]===e.data[r]})[0];this.parent.treeGrid.expandRow(t.getValue("gridRow",e),n)}else this.parent.treeGrid.expandRow(t.getValue("gridRow",e),i);this.isExpandCollapseFromChart=!1}else this.parent.isExpandCollapseLevelMethod||this.expandCollapseChartRows("expand",t.getValue("chartRow",e),i,null),this.parent.isExpandCollapseLevelMethod=!1;"ResourceView"!==this.parent.viewType&&"ProjectView"!==this.parent.viewType||this.renderMultiTaskbar(i),this.parent.enableVirtualization||this.parent.updateContentHeight(),this.updateWidthAndHeight(),this.reRenderConnectorLines(),t.getValue("chartRow",e).setAttribute("aria-expanded","true")},e.prototype.renderMultiTaskbar=function(e){this.parent.enableMultiTaskbar?this.parent.chartRowsModule.refreshRecords([e],!0):this.parent.showOverAllocation&&this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData)},e.prototype.expandCollapseChartRows=function(e,i,a,r){var n;if("expand"===e){n="table-row",r||(a.expanded=!0);for(var s=i.querySelectorAll(".e-row-collapse"),o=0;o<s.length;o++)t.addClass([s[o]],"e-row-expand"),t.removeClass([s[o]],"e-row-collapse")}else if("collapse"===e){n="none",r||(a.expanded=!1);for(var s=i.querySelectorAll(".e-row-expand"),o=0;o<s.length;o++)t.addClass([s[o]],"e-row-collapse"),t.removeClass([s[o]],"e-row-expand")}if(!this.parent.enableVirtualization){for(var l=a.childRecords,d=this.getChartRows(),h=[],p=0;p<d.length;p++)d[p].classList.contains("gridrowtaskId"+a.ganttProperties.rowUniqueID+"level"+(a.level+1))&&h.push(d[p]);for(p=0;p<h.length;p++)h[p].style.display=n,l[p].childRecords&&l[p].childRecords.length&&("collapse"===e||l[p].expanded||this.isExpandAll)&&this.expandCollapseChartRows(e,h[p],l[p],!0)}},e.prototype.expandCollapseAll=function(e){if("expand"===e)this.isExpandAll=!0,this.parent.treeGrid.expandAll();else if(this.isCollapseAll=!0,this.parent.treeGrid.collapseAll(),this.isCollapseAll&&!this.parent.allowTaskbarOverlap){var t=this.parent.enableRtl?this.parent.element.getElementsByClassName("e-content")[2].children[0].offsetHeight:this.parent.element.getElementsByClassName("e-content")[0].children[0].offsetHeight;this.parent.contentHeight=t,document.getElementsByClassName("e-chart-rows-container")[0].style.height=this.parent.contentHeight+"px"}this.isExpandAll=!1,this.isCollapseAll=!1},e.prototype.expandAtLevel=function(e){this.parent.treeGrid.expandAtLevel(e)},e.prototype.collapseAtLevel=function(e){this.parent.enableVirtualization&&(this.parent.isExpandCollapseLevelMethod=!0),this.parent.treeGrid.collapseAtLevel(e)},e.prototype.wireEvents=function(){var e=this,i=t.Browser.isPointer,a=t.Browser.touchStartEvent,n=t.Browser.touchEndEvent,s=t.Browser.touchMoveEvent,o=i?"pointerleave":"mouseleave";if(t.EventHandler.add(this.parent.chartPane,a,this.ganttChartMouseDown,this),t.EventHandler.add(this.parent.chartPane,o,this.ganttChartLeave,this),t.EventHandler.add(this.parent.chartPane,s,this.ganttChartMove,this),t.EventHandler.add(this.parent.chartPane,"wheel",this.onWheelZoom,this),this.parent.isAdaptive){var l;t.EventHandler.add(this.parent.chartRowsModule.ganttChartTableBody,"pointerdown",function(t){l?(clearTimeout(l),l=null,e.doubleClickHandler(t)):l=setTimeout(function(){l=null},200)},this),t.EventHandler.add(this.parent.chartPane,r.click,this.ganttChartMouseClick,this),t.EventHandler.add(this.parent.chartPane,n,this.ganttChartMouseUp,this)}this.parent.isAdaptive||(t.EventHandler.add(this.parent.chartRowsModule.ganttChartTableBody,"dblclick",this.doubleClickHandler,this),t.EventHandler.add(this.parent.element,n,this.documentMouseUp,this),t.EventHandler.add(document,n,this.mouseUp,this)),t.EventHandler.add(this.parent.element,"mousemove",this.mouseMoveHandler,this),t.EventHandler.add(document.body,"contextmenu",this.contextClick,this),t.EventHandler.add(document,"mouseup",this.contextClick,this)},e.prototype.unWireEvents=function(){var e=t.Browser.isPointer,i=t.Browser.touchStartEvent,a=t.Browser.touchEndEvent,n=t.Browser.touchMoveEvent,s=e?"pointerleave":"mouseleave";t.isNullOrUndefined(this.parent.chartRowsModule.ganttChartTableBody)||t.EventHandler.remove(this.parent.chartRowsModule.ganttChartTableBody,i,this.ganttChartMouseDown),t.isNullOrUndefined(this.parent.chartPane)||(t.EventHandler.remove(this.parent.chartPane,s,this.ganttChartLeave),t.EventHandler.remove(this.parent.chartPane,n,this.ganttChartMove),t.EventHandler.remove(this.parent.chartPane,"wheel",this.onWheelZoom),t.EventHandler.remove(this.parent.chartPane,i,this.ganttChartMouseDown)),this.parent.isAdaptive&&(t.isNullOrUndefined(this.parent.chartPane)||(t.EventHandler.remove(this.parent.chartPane,r.click,this.ganttChartMouseClick),t.EventHandler.remove(this.parent.chartPane,a,this.ganttChartMouseUp))),this.parent.isAdaptive||(t.isNullOrUndefined(this.parent.element)||t.EventHandler.remove(this.parent.element,a,this.documentMouseUp),t.isNullOrUndefined(document)||t.EventHandler.remove(document,a,this.mouseUp)),t.isNullOrUndefined(this.parent.element)||t.EventHandler.remove(this.parent.element,"mousemove",this.mouseMoveHandler),t.isNullOrUndefined(document)||(t.EventHandler.remove(document,"mouseup",this.contextClick),t.isNullOrUndefined(document.body)||t.EventHandler.remove(document.body,"contextmenu",this.contextClick)),t.isNullOrUndefined(this.parent.chartRowsModule.ganttChartTableBody)||t.EventHandler.remove(this.parent.chartRowsModule.ganttChartTableBody,"dblclick",this.doubleClickHandler)},e.prototype.onWheelZoom=function(e){if(e.ctrlKey){e.preventDefault();var t=e.deltaY<0,i=!1;Math.abs(e.deltaY)<75&&(i=!0),this.debounceTimeout&&(this.debounceTimeoutNext+20>this.debounceTimeout&&clearTimeout(this.debounceTimeout),(this.debounceTimeoutNext+20<=this.debounceTimeout||!this.debounceTimeoutNext)&&(this.debounceTimeoutNext=this.debounceTimeout)),this.debounceTimeout=setTimeout(function(){var a=Math.abs(e.deltaY);(i?a>.5&&a<15:a>5&&a<=200)&&this.parent.timelineModule.processZooming(t)}.bind(this),100)}},e.prototype.getRecordByTaskBar=function(e){return this.parent.flatData[this.getIndexByTaskBar(e)]},e.prototype.updateElement=function(e,t,i,a,r){if(this.parent.ganttColumns[parseInt(e.getAttribute("aria-colindex"),10)-1].field===this.parent.taskFields.progress){var n=r.index;do{r.hasChildRecords&&(e=this.getNextElement(e,i,a)),t=this.parent.ganttColumns[parseInt(e.getAttribute("aria-colindex"),10)-1],n=this.parent.treeGrid.getRows().indexOf(e.parentElement)}while(!t.allowEditing);this.parent.treeGrid.saveCell(),this.parent.treeGrid.editCell(n,this.parent.ganttColumns[parseInt(e.getAttribute("aria-colindex"),10)-1].field)}return e},e.prototype.onTabAction=function(e){this.parent.treeGrid.grid.enableHeaderFocus=this.parent.enableHeaderFocus;var i=document.getElementsByClassName("e-toolbar-item"),a=this.parent.editModule&&this.parent.editModule.cellEditModule&&this.parent.editModule.cellEditModule.isCellEdit;if(this.parent.showActiveElement||a){var r=a?e.target.closest(".e-rowcell"):e.target;this.parent.element.querySelectorAll(".e-focused").length>0&&(r=this.parent.element.querySelectorAll(".e-focused")[0]),r&&!(r.classList.contains("e-toolbar-item")||r.classList.contains("e-input")||r.classList.contains("e-btn"))&&(this.currentToolbarIndex=-1),(r.closest(".e-rowcell")||r.closest(".e-chart-row"))&&this.parent.focusModule.setActiveElement(r),this.focusedRowIndex=r.closest(".e-rowcell")?r.parentElement.rowIndex:r.closest(".e-chart-row")?r.closest(".e-chart-row").rowIndex:-1;var n="tab"===e.action,s=this.getNextElement(r,n,a);if(s&&("noNextRow"===s||s.classList.contains("e-rowdragheader"))&&("noNextRow"===s&&this.parent.treeGrid.element.getElementsByClassName("e-editedbatchcell").length>0&&this.parent.treeGrid.saveCell(),s=null),s&&r.classList.contains("e-headercell")){var o=parseInt(s.getAttribute("aria-colindex"),10)-1;if("shiftTab"===e.action){for(;-1!==o&&!this.parent.treeGrid.columns[o].visible;)o-=1;if(-1!==o)o=this.parent.allowRowDragAndDrop?o+1:o,s=document.getElementsByClassName("e-columnheader")[0].childNodes[o];else for(h=document.getElementsByClassName("e-toolbar-item").length-1;h>0;h--)if(!document.getElementsByClassName("e-toolbar-item")[h].classList.contains("e-hidden")){s=document.getElementsByClassName("e-toolbar-item")[h],this.currentToolbarIndex=h;break}}else{for(;!this.parent.treeGrid.columns[o].visible;)o+=1;o=this.parent.allowRowDragAndDrop?o+1:o,s=document.getElementsByClassName("e-columnheader")[0].childNodes[o]}}if(!s&&r.classList.contains("e-headercell")&&"tab"===e.action&&(s=document.getElementsByClassName("e-timeline-header-container")[0]),!s&&(r.classList.contains("e-headercell")||r.classList.contains("e-toolbar-item")||r.classList.contains("e-treegrid")||r.classList.contains("e-input")||r.classList.contains("e-btn"))&&this.parent.toolbarModule&&this.parent.toolbar.length>0){var l=-1!==this.currentToolbarIndex?"tab"===e.action?this.currentToolbarIndex+1:this.currentToolbarIndex-1:"shiftTab"===e.action?i.length-1:1,d=!1;if(-1!==l&&("shiftTab"===e.action||"tab"===e.action&&l<i.length))do{i[l].classList.contains("e-hidden")?"tab"===e.action?l++:l--:((s=i[l]).setAttribute("tabindex","-1"),s.querySelector(".e-btn")===r&&("tab"===e.action?l++:l--,s=i[l]),s.querySelector(".e-btn")&&s.querySelector(".e-btn").setAttribute("tabindex","0"),d=!0,this.currentToolbarIndex=l)}while(!d)}if("tab"===e.action&&!s&&this.currentToolbarIndex===i.length-1&&(r.classList.contains("e-toolbar-item")||r.classList.contains("e-input")||r.classList.contains("e-btn")))for(h=0;h<this.parent.treeGrid.columns.length;h++)if(this.parent.treeGrid.columns[h].visible){s=document.getElementsByClassName("e-columnheader")[0].childNodes[h];break}if("shiftTab"!==e.action||s||r.classList.contains("e-headercell")||(s=document.getElementsByClassName("e-timeline-header-container")[0]),"shiftTab"===e.action&&r.classList.contains("e-timeline-header-container"))for(var h=this.parent.treeGrid.columns.length;h>0;h--)if(this.parent.treeGrid.columns[h-1].visible){s=document.getElementsByClassName("e-columnheader")[0].childNodes[h-1];break}if(this.tempNextElement=s,t.isNullOrUndefined(s)||t.isNullOrUndefined(s.cellIndex)||(this.parent.allowRowDragAndDrop?(this.childrenIndex=s.cellIndex,this.nextElementIndex=s.cellIndex-1):(this.childrenIndex=s.cellIndex,this.nextElementIndex=s.cellIndex),-1===this.nextElementIndex||this.parent.ganttColumns[this.nextElementIndex].allowEditing||this.parent.ganttColumns[this.nextElementIndex].field===this.parent.taskFields.id?this.isEditableElement=!1:this.isEditableElement=!0),"noNextRow"===s)return void this.manageFocus(r,"remove",!0);if("string"!=typeof s){if(r.closest(".e-chart-row-cell")&&s.closest(".e-rowcell")&&(this.preventScrollIntoView=!0),(r.classList.contains("e-rowcell")||r.closest(".e-chart-row-cell")||r.classList.contains("e-headercell")||r.closest(".e-segmented-taskbar")||r.classList.contains("e-timeline-header-container"))&&e.preventDefault(),n&&r.classList.contains("e-rowdragdrop"))return void this.parent.treeGrid.grid.notify("key-pressed",e);if(r.classList.contains("e-rowcell")&&s&&s.classList.contains("e-rowcell")||r.classList.contains("e-headercell"))if(n){if(this.parent.editSettings.allowNextRowEdit){var p=this.parent.currentViewData[this.focusedRowIndex],u=this.parent.ganttColumns[parseInt(s.getAttribute("aria-colindex"),10)-1].field;p.hasChildRecords?u===this.parent.taskFields.endDate||u===this.parent.taskFields.duration||u===this.parent.taskFields.dependency||u===this.parent.taskFields.progress||u===this.parent.taskFields.work||u===this.parent.taskFields.type||"taskType"===u?(this.parent.treeGrid.grid.endEdit(),this.parent.treeGrid.grid.notify("key-pressed",e)):u===this.parent.taskFields.name||u===this.parent.taskFields.startDate?this.parent.treeGrid.grid.notify("key-pressed",e):(this.parent.treeGrid.grid.notify("key-pressed",e),a&&this.parent.treeGrid.editCell(this.focusedRowIndex,u)):this.parent.treeGrid.grid.notify("key-pressed",e)}else if(!s||s&&!s.classList.contains("e-headercell")&&!s.classList.contains("e-timeline-header-container")){r.classList.contains("e-headercell")&&this.manageFocus(r,"remove",!1);g=s;if(!(c=this.parent.currentViewData[r.parentElement.rowIndex]).hasChildRecords||this.parent.ganttColumns[parseInt(g.getAttribute("aria-colindex"),10)-1].field!==this.parent.taskFields.progress&&this.parent.ganttColumns[parseInt(g.getAttribute("aria-colindex"),10)-1].allowEditing||this.parent.ganttColumns[parseInt(g.getAttribute("aria-colindex"),10)-1].field===this.parent.taskFields.id||!r.classList.contains("e-editedbatchcell"))s&&!r.classList.contains("e-editedbatchcell")||this.parent.treeGrid.grid.notify("key-pressed",e);else{y=void 0;for(g=this.updateElement(g,y,n,a,c);!this.parent.ganttColumns[parseInt(g.getAttribute("aria-colindex"),10)-1].allowEditing;)g=this.getNextElement(g,n,a);g=this.updateElement(g,y,n,a,c)}}}else if(s&&!s.classList.contains("e-headercell")&&s.classList.contains("e-rowcell")&&!s.classList.contains("e-toolbar-item")){var c=this.parent.currentViewData[r.parentElement.rowIndex],g=s;if(!c.hasChildRecords||this.parent.ganttColumns[parseInt(g.getAttribute("aria-colindex"),10)-1].field!==this.parent.taskFields.progress&&this.parent.ganttColumns[parseInt(g.getAttribute("aria-colindex"),10)-1].allowEditing||this.parent.ganttColumns[parseInt(g.getAttribute("aria-colindex"),10)-1].field===this.parent.taskFields.id||!r.classList.contains("e-editedbatchcell"))if(parseInt(g.parentElement.getAttribute("aria-rowindex"),10)-1!=0&&parseInt(g.getAttribute("aria-colindex"),10)-1==0&&this.parent.ganttColumns[parseInt(g.getAttribute("aria-colindex"),10)-1].field===this.parent.taskFields.id&&r.classList.contains("e-editedbatchcell")){var f=r.parentElement.rowIndex,m=this.getNextRowElement(f,n,!0);if(g=this.getChildElement(m,n),!(p=this.parent.flatData[parseInt(m.getAttribute("aria-rowindex"),10)-1]).hasChildRecords||this.parent.ganttColumns[parseInt(g.getAttribute("aria-colindex"),10)-1].allowEditing&&this.parent.ganttColumns[parseInt(g.getAttribute("aria-colindex"),10)-1].field!==this.parent.taskFields.progress)this.parent.treeGrid.grid.notify("key-pressed",e);else{y=void 0;for(g=this.updateElement(g,y,n,a,p);!this.parent.ganttColumns[parseInt(g.getAttribute("aria-colindex"),10)-1].allowEditing;)g=this.getNextElement(g,n,a);g=this.updateElement(g,y,n,a,p)}}else this.parent.treeGrid.grid.notify("key-pressed",e);else{var y=void 0;for(g=this.updateElement(g,y,n,a,c);!this.parent.ganttColumns[parseInt(g.getAttribute("aria-colindex"),10)-1].allowEditing;)g=this.getNextElement(g,n,a);g=this.updateElement(g,y,n,a,c)}}if(this.parent.element.querySelectorAll(".e-focused").length>0&&this.manageFocus(this.parent.element.querySelectorAll(".e-focused")[0],"remove",!1),(!this.parent.editModule||!this.parent.editModule.cellEditModule||t.isNullOrUndefined(this.parent.editModule.cellEditModule.editedColumn))&&s){if(r.classList.contains("e-rowcell")?this.manageFocus(r,"remove",!1):this.manageFocus(r,"remove",!0),s.classList.contains("e-rowcell")&&r.nextElementSibling&&!r.classList.contains("e-timeline-header-container")||r.classList.contains("e-right-label-container")){if(!r.classList.contains("e-rowcell")){this.parent.treeGrid.grid.notify("key-pressed",e);var D=t.getValue("focusModule",this.parent.treeGrid.grid);if(D.currentInfo.element=s,D.currentInfo.elementToFocus=s,D.content.matrix.current=[s.parentElement.rowIndex,s.cellIndex],this.parent.selectionModule){f=this.parent.enableVirtualization?this.parent.currentViewData[s.parentElement.rowIndex].index:s.parentElement.rowIndex;if(this.parent.selectionModule.selectRow(f),"Cell"!==this.parent.selectionSettings.mode){var v=this.parent.selectionModule.getSelectedRows();if(v.length>0){var k=v[0].querySelectorAll(".e-focus, .e-focused");k.length>0&&t.removeClass([k[0]],["e-focus","e-focused"])}}}}this.manageFocus(s,"add",!1)}else s&&(s.classList.contains("e-toolbar-item")||s.classList.contains("e-headercell")||s.classList.contains("e-rowcell"))?(this.manageFocus(r,"remove",!1),s.classList.contains("e-toolbar-item")||this.manageFocus(s,"add",!1),r.classList.contains("e-treegrid")&&e.preventDefault()):this.manageFocus(s,"add",!0);this.parent.focusModule.setActiveElement(s)}}}},e.prototype.getNextElement=function(e,i,a){if(e.classList.contains("e-timeline-header-container")&&i){o=this.getNextRowElement(-1,i,!0);return this.getChildElement(o,i)}var r=i?e.nextElementSibling:e.previousElementSibling;if(e.parentElement.classList.contains("e-taskbar-main-container")){if(this.parent.labelSettings.rightLabel&&i)return e.parentElement.nextElementSibling;if(!i&&this.parent.labelSettings.leftLabel)return e.parentElement.previousElementSibling}for(;r&&r.parentElement.classList.contains("e-row");){if(!r.matches(".e-hide")&&!r.matches(".e-rowdragdrop"))return r;r=i?r.nextElementSibling:r.previousElementSibling}if(!t.isNullOrUndefined(r)&&(r.classList.contains("e-taskbar-main-container")||r.classList.contains("e-right-connectorpoint-outer-div"))){var n=this.parent.currentViewData[this.focusedRowIndex];!t.isNullOrUndefined(n.ganttProperties.segments)&&n.ganttProperties.segments.length>0&&(r=r.classList.contains("e-right-connectorpoint-outer-div")?r.parentElement.nextElementSibling:r.getElementsByClassName("e-gantt-child-taskbar-inner-div")[0])}if(this.validateNextElement(r))return r;var s=-1,o=null;if(e.classList.contains("e-rowcell")&&a&&this.parent.editSettings.allowNextRowEdit)return s=e.parentElement.rowIndex,o=this.getNextRowElement(s,i,!0),this.getChildElement(o,i);if(e.classList.contains("e-rowcell"))if(s=e.parentElement.rowIndex,i){if(o=this.parent.getRowByIndex(s),this.parent.treeGrid.element.getElementsByClassName("e-editedbatchcell").length>0)return o=this.getNextRowElement(s,i,!0),this.getChildElement(o,i);if(this.validateNextElement(o,"e-left-label-container"))return o.getElementsByClassName("e-left-label-container")[0];if(this.validateNextElement(o,"e-taskbar-main-container"))return o.getElementsByClassName("e-taskbar-main-container")[0];if(this.validateNextElement(o,"e-right-label-container"))return o.getElementsByClassName("e-right-label-container")[0]}else{if(o=this.getNextRowElement(s,i,!1),this.validateNextElement(o,"e-right-label-container"))return o.getElementsByClassName("e-right-label-container")[0];if(this.validateNextElement(o,"e-taskbar-main-container"))return o.getElementsByClassName("e-taskbar-main-container")[0];if(this.validateNextElement(o,"e-left-label-container"))return o.getElementsByClassName("e-left-label-container")[0]}else if(e.parentElement.classList.contains("e-chart-row-cell")||e.parentElement.parentElement.classList.contains("e-chart-row-cell")){if(s=t.closest(e,".e-chart-row").rowIndex,i){if(!i&&this.parent.virtualScrollModule&&this.parent.enableVirtualization){var l=this.parent.currentViewData[s];s=this.parent.flatData.indexOf(l)}o=this.getNextRowElement(s,i,!0)}else o=this.parent.treeGrid.getRows()[s];return this.getChildElement(o,i)}return r=e,null},e.prototype.getNextRowElement=function(e,t,i){var a=this.parent.getExpandedRecords(this.parent.currentViewData),r=this.parent.currentViewData[e],n=a.indexOf(r),s=t?a[n+1]:a[n-1],o=this.parent.currentViewData.indexOf(s);return s?i?this.parent.treeGrid.getRows()[o]:this.parent.getRowByIndex(o):null},e.prototype.validateNextElement=function(e,i){if(e&&e.classList.contains("e-rowcell"))return!0;if(e&&i){var a=e.getElementsByClassName(i)[0];return!(!a||!a.hasChildNodes())}return!!e&&!(t.isNullOrUndefined(e)||!e.hasChildNodes())},e.prototype.getChildElement=function(e,t){var i;if(!e)return"noNextRow";for(i=t?e.children[0]:e.children[e.children.length-1];i;){if(!i.matches(".e-hide")&&!i.matches(".e-rowdragdrop"))return i;i=t?i.nextElementSibling:i.previousElementSibling}return i},e.prototype.manageFocus=function(e,i,a,r){if(a){var n=null;if(e.classList.contains("e-left-label-container")||e.classList.contains("e-right-label-container"))n=e.getElementsByTagName("span")[0];else if(e.classList.contains("e-taskbar-main-container")||e.classList.contains("e-gantt-child-taskbar-inner-div")){var s=t.closest(e,".e-chart-row").rowIndex,o=this.parent.currentViewData[s],l=o.hasChildRecords?o.ganttProperties.isAutoSchedule?"e-gantt-parent-taskbar":"e-manualparent-main-container":o.ganttProperties.isMilestone?"e-gantt-milestone":!t.isNullOrUndefined(o.ganttProperties.segments)&&o.ganttProperties.segments.length>0?"e-segmented-taskbar":"e-gantt-child-taskbar";n=e.getElementsByClassName(l)[0],t.isNullOrUndefined(n)&&(n=e)}(e.classList.contains("e-right-label-temp-container")||e.classList.contains("e-left-label-temp-container")||e.classList.contains("e-indicator-span")||e.classList.contains("e-timeline-header-container"))&&("add"===i?(e.setAttribute("tabIndex","0"),t.addClass([e],"e-active-container"),e.focus()):"downArrow"!==r&&"upArrow"!==r&&(t.removeClass([e],"e-active-container"),e.setAttribute("tabIndex","-1"),e.blur())),"add"!==i||t.isNullOrUndefined(n)?t.isNullOrUndefined(n)||"downArrow"===r||"upArrow"===r||(t.removeClass([n],"e-active-container"),e.setAttribute("tabIndex","-1"),e.blur()):(e.setAttribute("tabIndex","0"),t.addClass([n],"e-active-container"),e.focus(),this.focusedElement=n)}else"add"===i?(e.setAttribute("tabIndex","0"),t.addClass([e],["e-focused","e-focus"]),this.preventScrollIntoView||e.scrollIntoView({block:"nearest",inline:"nearest"}),this.preventScrollIntoView=!1,e.focus()):(e.setAttribute("tabIndex","-1"),t.removeClass([e],["e-focused","e-focus"]),e.blur())},e.prototype.getIndexByTaskBar=function(e){var i,a;if(i=e.classList.contains(N)?e:t.closest(e,"div."+N),t.isNullOrUndefined(i))i=t.closest(e,"tr."+A),a=[].slice.call(this.parent.chartRowsModule.ganttChartTableBody.childNodes).indexOf(i);else{var r=i.getAttribute("rowUniqueId"),n=this.parent.getRecordByID(r);a=this.parent.enableVirtualization&&this.parent.enableMultiTaskbar?this.parent.flatData.indexOf(n):this.parent.pdfExportModule&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth&&this.parent.pdfExportModule.isPdfExport?this.parent.ids.indexOf(n.ganttProperties.taskId.toString()):this.parent.flatData.indexOf(n)}return a},e.prototype.destroy=function(){this.removeEventListener(),this.unWireEvents(),this.chartElement=null,this.rangeViewContainer=null,this.chartBodyContent=null,this.scrollElement=null,this.chartTimelineContainer=null,this.chartBodyContainer=null,t.isNullOrUndefined(this.scrollObject)||(this.scrollObject.destroy(),this.scrollObject=null)},e}(),$=function(){return($=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)},J=function(){function e(e){this.isZoomIn=!1,this.isZooming=!1,this.isZoomToFit=!1,this.topTierCollection=[],this.bottomTierCollection=[],this.pdfExportTopTierCollection=[],this.pdfExportBottomTierCollection=[],this.restrictRender=!0,this.applyDstHour=!1,this.performedTimeSpanAction=!1,this.dstIncreaseHour=!1,this.fromDummyDate=!1,this.isZoomedToFit=!1,this.isZoomingAction=!1,this.increaseIteration=!1,this.isFirstLoop=!1,this.inconsistenceDstApplied=!1,this.parent=e,this.initProperties()}return e.prototype.initProperties=function(){this.timelineStartDate=null,this.timelineEndDate=null,this.totalTimelineWidth=0,this.customTimelineSettings=null,this.parent.isTimelineRoundOff=!this.isZoomToFit&&!!t.isNullOrUndefined(this.parent.projectStartDate),this.parent.enablePersistence&&this.parent.isLoad&&(this.parent.timelineSettings=this.parent.currentZoomingLevel)},e.prototype.validateTimelineProp=function(){this.roundOffDays(),this.processTimelineProperty(),this.timelineWidthCalculation()},e.prototype.refreshTimeline=function(){this.initProperties(),this.processTimelineUnit(),(!this.parent.undoRedoModule||this.parent.undoRedoModule&&!this.parent.undoRedoModule.isZoomingUndoRedoProgress)&&this.parent.dataOperation.calculateProjectDates(),this.parent.isFromOnPropertyChange||this.parent.updateProjectDates(this.parent.cloneProjectStartDate,this.parent.cloneProjectEndDate,this.parent.isTimelineRoundOff);var e=this.parent.element.getElementsByClassName("e-timeline-header-container")[0].offsetHeight;this.parent.element.getElementsByClassName("e-gridcontent")[0].style.height="calc(100% - "+e+"px)",this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0].style.height="calc(100% - "+e+"px)"},e.prototype.refreshTimelineByTimeSpan=function(){this.validateTimelineProp(),(!this.parent.pdfExportModule||this.parent.pdfExportModule&&!this.parent.pdfExportModule.isPdfExport||this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.pdfExportModule.helper.exportProps&&!this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth)&&(this.parent.ganttChartModule.chartTimelineContainer.innerHTML=""),this.createTimelineSeries()},e.prototype.updateChartByNewTimeline=function(){this.parent.chartRowsModule.refreshChartByTimeline();var e=this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0].scrollLeft;this.parent.element.getElementsByClassName("e-timeline-header-container")[0].scrollLeft=e,this.parent.notify("refreshDayMarkers",{})},e.prototype.processZooming=function(e){this.parent.isReact&&this.parent.clearTemplate(["TaskbarTemplate","ParentTaskbarTemplate","MilestoneTemplate","TaskLabelTemplate","RightLabelTemplate","LeftLabelTemplate"]),this.isZoomToFit=this.isZoomedToFit=!1,this.updateUndoRedo(e),this.parent.isProjectDateUpdated||this.parent.dateValidationModule.calculateProjectDates(),this.parent.zoomingProjectStartDate&&(this.parent.cloneProjectStartDate=this.parent.zoomingProjectStartDate,this.parent.cloneProjectEndDate=this.parent.zoomingProjectEndDate),this.parent.zoomingProjectStartDate=this.parent.zoomingProjectEndDate=null;var t=this.checkCurrentZoomingLevel();this.isZoomIn=e,this.isZooming=!0;var i=this.getZoomLevel(t,e);this.updateToolbar(i,e),i=this.parent.zoomingLevels.findIndex(function(e){return e.level===i});var a=this.parent.zoomingLevels[i],r={requestType:e?"beforeZoomIn":"beforeZoomOut",timeline:a,cancel:!1};this.parent.trigger("actionBegin",r),r.cancel||(this.parent.showLoadingIndicator(),a=r.timeline,this.changeTimelineSettings(a)),this.isZooming=!1},e.prototype.updateUndoRedo=function(e){var i=e?"ZoomIn":"ZoomOut";if(this.parent.undoRedoModule&&this.parent.isUndoRedoItemPresent(i)){this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection();var a={action:i,previousZoomingLevel:t.extend({},{},this.parent.currentZoomingLevel,!0)};a.previousZoomingLevel.bottomTier.format=this.customTimelineSettings.bottomTier.format,a.previousZoomingLevel.topTier.format=this.customTimelineSettings.topTier.format,this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=a}},e.prototype.getZoomLevel=function(e,t){var i=e+(t?1:-1);return this.parent.zoomingLevels.find(function(e){return e.level===i})?i:e},e.prototype.updateToolbar=function(e,t){this.parent.toolbarModule&&(t?e===this.parent.zoomingLevels[this.parent.zoomingLevels.length-1].level?(this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin"],!1),this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomout"],!0)):this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomout"],!0):e===this.parent.zoomingLevels[0].level?(this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomout"],!1),this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin"],!0)):this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin"],!0))},e.prototype.changeTimelineSettings=function(e){var i=this;this.isZoomToFit?this.isSingleTier="None"===this.customTimelineSettings.topTier.unit||"None"===this.customTimelineSettings.bottomTier.unit:this.isZoomIn||(this.isSingleTier="None"===e.topTier.unit||"None"===e.bottomTier.unit);var a=this.isSingleTier?"None"===this.customTimelineSettings.topTier.unit?"topTier":"bottomTier":null;Object.keys(this.customTimelineSettings).forEach(function(r){if(r!==a)i.customTimelineSettings[r]="object"!=typeof e[r]||t.isNullOrUndefined(e[r])?e[r]:$({},e[r]);else{var n="topTier"===r?"bottomTier":"topTier";"None"!==e.bottomTier.unit&&(i.customTimelineSettings[n]=$({},e.bottomTier))}}),this.parent.isTimelineRoundOff=!this.isZoomToFit&&!!t.isNullOrUndefined(this.parent.projectStartDate),this.processTimelineUnit(),this.parent.updateProjectDates(this.parent.cloneProjectStartDate,this.parent.cloneProjectEndDate,this.parent.isTimelineRoundOff);var r=this.parent.criticalPathModule;if(this.parent.enableCriticalPath&&r&&r.criticalPathCollection&&r.criticalConnectorLine(r.criticalPathCollection,r.detailPredecessorCollection,!0,r.predecessorCollectionTaskIds),this.isZooming||this.isZoomToFit){var n={requestType:this.isZoomIn?"AfterZoomIn":this.isZoomToFit?"AfterZoomToProject":"AfterZoomOut",timeline:this.parent.currentZoomingLevel};this.parent.trigger("actionComplete",n),this.parent.hideLoadingIndicator()}var s="None"===this.topTier?"bottomTier":"topTier";this.parent.enableTimelineVirtualization&&(!this.parent.pdfExportModule||this.parent.pdfExportModule&&!this.parent.pdfExportModule.isPdfExport)&&(this.wholeTimelineWidth=this.calculateWidthBetweenTwoDate(s,this.parent.timelineModule.timelineStartDate,this.parent.timelineModule.timelineEndDate),this.wholeTimelineWidth<=this.totalTimelineWidth&&(this.wholeTimelineWidth=this.totalTimelineWidth),this.isZoomToFit?(this.clientWidthDifference=Math.abs(this.wholeTimelineWidth-this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0].clientWidth)+1,this.parent.element.querySelectorAll(".e-chart-scroll-container")[0].querySelector(".e-virtualtrack").style.width=this.wholeTimelineWidth-this.clientWidthDifference+"px",t.isNullOrUndefined(this.parent.element.querySelectorAll(".e-timeline-header-container")[0].querySelector(".e-virtualtrack"))||(this.parent.element.querySelectorAll(".e-timeline-header-container")[0].querySelector(".e-virtualtrack").style.width=this.wholeTimelineWidth-this.clientWidthDifference+"px")):(this.parent.element.querySelectorAll(".e-chart-scroll-container")[0].querySelector(".e-virtualtrack").style.width=this.wholeTimelineWidth+"px",t.isNullOrUndefined(this.parent.element.querySelectorAll(".e-timeline-header-container")[0].querySelector(".e-virtualtrack"))||(this.parent.element.querySelectorAll(".e-timeline-header-container")[0].querySelector(".e-virtualtrack").style.width=this.wholeTimelineWidth+"px")),this.parent.ganttChartModule.updateWidthAndHeight())},e.prototype.processZoomToFit=function(){this.parent.isReact&&this.parent.clearTemplate(["TaskbarTemplate","ParentTaskbarTemplate","MilestoneTemplate","TaskLabelTemplate","RightLabelTemplate","LeftLabelTemplate"]),this.isZoomToFit=!0,this.isZooming=!1,this.isZoomedToFit=!0;var e={};this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.isUndoRedoItemPresent("ZoomToFit")&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),e.action="ZoomToFit",e.previousTimelineStartDate=t.extend([],[],[this.parent.cloneProjectStartDate],!0)[0],e.previousTimelineEndDate=t.extend([],[],[this.parent.cloneProjectEndDate],!0)[0],e.previousZoomingLevel=t.extend({},{},this.parent.currentZoomingLevel,!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=e),this.parent.zoomingProjectStartDate||(this.parent.zoomingProjectStartDate=this.parent.cloneProjectStartDate,this.parent.zoomingProjectEndDate=this.parent.cloneProjectEndDate),this.parent.zoomingProjectStartDate>this.parent.cloneProjectStartDate&&(this.parent.cloneProjectStartDate=new Date(this.parent.allowUnscheduledTasks?this.parent.zoomingProjectStartDate:this.parent.cloneProjectStartDate)),t.isNullOrUndefined(this.parent.projectStartDate)&&t.isNullOrUndefined(this.parent.projectEndDate)&&this.parent.dataOperation.calculateProjectDates();var i,a=0;this.parent.timelineSettings.showWeekend||(a=this.calculateNonWorkingDaysBetweenDates(this.parent.cloneProjectStartDate,this.parent.cloneProjectEndDate)),i=(this.parent.cloneProjectEndDate.getTime()-this.parent.cloneProjectStartDate.getTime())/864e5,i-=a;var r,n,s,o=this.parent.ganttChartModule.chartElement.offsetWidth,l=o/i,d=this.parent.zoomingLevels.slice().sort(function(e,t){return e.perDayWidth||t.perDayWidth?e.perDayWidth<t.perDayWidth?1:-1:0});if(0!==l){for(var h=0;h<d.length;h++){if(n=d[h],h===d.length-1){r=d[h];break}if(s=d[h+1],l>=n.perDayWidth){r=d[h];break}if(l<n.perDayWidth&&l>s.perDayWidth){r=d[h+1];break}}var p=t.extend({},{},r,!0);t.isNullOrUndefined(this.parent.projectStartDate)&&this.roundOffDateToZoom(this.parent.cloneProjectStartDate,!0,l,p.bottomTier.unit,r),t.isNullOrUndefined(this.parent.projectEndDate)&&this.roundOffDateToZoom(this.parent.cloneProjectEndDate,!1,l,p.bottomTier.unit,r);var u=this.calculateNumberOfTimelineCells(p),c=this.parent.ganttChartModule.scrollElement.offsetHeight-17,g=this.parent.ganttChartModule.chartBodyContent.offsetHeight<=c?0:17;p.timelineUnitSize=Math.abs(o-g)/u;var f={requestType:"beforeZoomToProject",timeline:p};this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin",this.parent.controlId+"_zoomout"],!0),this.parent.trigger("actionBegin",f),f.cancel||(this.parent.showLoadingIndicator(),this.changeTimelineSettings(p),this.parent.isTimelineRoundOff=!!t.isNullOrUndefined(this.parent.projectStartDate)),this.isZoomToFit=!1}},e.prototype.bottomTierCellWidthCalc=function(e,t,i){var a;switch(e){case"Minutes":a=6e4*t.bottomTier.count;break;case"Hour":a=36e5*t.bottomTier.count;break;case"Week":a=6048e5*t.bottomTier.count;break;case"Day":a=864e5*t.bottomTier.count;break;case"Month":var r=new Date(i.getFullYear(),i.getMonth()+1,0).getDate();a=t.bottomTier.count*(86400*r*1e3);break;case"Year":var n=i.getFullYear()%400==0||i.getFullYear()%100!=0&&i.getFullYear()%4==0?366:365;a=t.bottomTier.count*(86400*n*1e3)}return a},e.prototype.roundOffDateToZoom=function(e,t,i,a,r){var n=this.bottomTierCellWidthCalc(a,r,e);t?e.setTime(e.getTime()-n):e.setTime(e.getTime()+n)},e.prototype.calculateNumberOfTimelineCells=function(e){var t=new Date(this.parent.cloneProjectStartDate.getTime()),i=new Date(this.parent.cloneProjectEndDate.getTime());this.parent.dateValidationModule.updateDateWithTimeZone(t,i);var a,r=0;this.parent.timelineSettings.showWeekend||(r=this.calculateNonWorkingDaysBetweenDates(this.parent.cloneProjectStartDate,this.parent.cloneProjectEndDate)),a=Math.abs((i.getTime()-t.getTime())/864e5),a-=r;var n=e.bottomTier.count,s=e.bottomTier.unit;return"Day"===s?a/n:"Week"===s?a/n/7:"Month"===s?a/n/28:"Year"===s?a/n/336:"Hour"===s?a*(24/n):a*(1440/n)},e.prototype.processTimelineUnit=function(){var e=["timelineViewMode","timelineUnitSize","weekStartDay","weekendBackground"],t={topTier:["unit","format","count","formatter"],bottomTier:["unit","format","count","formatter"]},i=["Year","Month","Week","Day","Hour","Minutes"];this.customTimelineSettings=this.customTimelineSettings?this.customTimelineSettings:this.extendFunction(this.parent.timelineSettings,e,t),-1===i.indexOf(this.customTimelineSettings.topTier.unit)&&-1===i.indexOf(this.customTimelineSettings.bottomTier.unit)?(this.customTimelineSettings.topTier.unit=-1!==i.indexOf(this.customTimelineSettings.timelineViewMode)?this.customTimelineSettings.timelineViewMode:"Week",this.customTimelineSettings.bottomTier.unit=5!==i.indexOf(this.customTimelineSettings.topTier.unit)?i[i.indexOf(this.customTimelineSettings.topTier.unit)+1]:"None"):-1!==i.indexOf(this.customTimelineSettings.topTier.unit)&&-1!==i.indexOf(this.customTimelineSettings.bottomTier.unit)&&i.indexOf(this.customTimelineSettings.topTier.unit)>i.indexOf(this.customTimelineSettings.bottomTier.unit)?this.customTimelineSettings.bottomTier.unit=this.customTimelineSettings.topTier.unit:(this.customTimelineSettings.topTier.unit=-1===i.indexOf(this.customTimelineSettings.topTier.unit)?"None":this.customTimelineSettings.topTier.unit,this.customTimelineSettings.bottomTier.unit=-1===i.indexOf(this.customTimelineSettings.bottomTier.unit)?"None":this.customTimelineSettings.bottomTier.unit),this.topTier=this.customTimelineSettings.topTier.unit,this.bottomTier=this.customTimelineSettings.bottomTier.unit,this.previousIsSingleTier=this.isSingleTier,this.isSingleTier="None"===this.topTier||"None"===this.bottomTier},e.prototype.processTimelineProperty=function(){this.customTimelineSettings.topTier.count="None"===this.topTier?1:this.validateCount(this.customTimelineSettings.topTier.unit,this.customTimelineSettings.topTier.count,"topTier"),this.customTimelineSettings.bottomTier.count="None"===this.customTimelineSettings.bottomTier.unit?1:this.validateCount(this.customTimelineSettings.bottomTier.unit,this.customTimelineSettings.bottomTier.count,"bottomTier"),this.customTimelineSettings.bottomTier.format=this.validateFormat(this.customTimelineSettings.bottomTier.unit,this.customTimelineSettings.bottomTier.format),this.customTimelineSettings.topTier.format=this.validateFormat(this.topTier,this.customTimelineSettings.topTier.format),this.customTimelineSettings.weekStartDay=this.customTimelineSettings.weekStartDay>=0&&this.customTimelineSettings.weekStartDay<=6?this.customTimelineSettings.weekStartDay:0,this.parent.pdfExportModule&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.isPdfExport&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth||this.checkCurrentZoomingLevel()},e.prototype.calculateZoomingLevelsPerDayWidth=function(){for(var e=this.parent.zoomingLevels,t=0;t<e.length;t++){var i=this.getPerDayWidth(e[t].timelineUnitSize,e[t].bottomTier.count,e[t].bottomTier.unit);e[t].perDayWidth=i}},e.prototype.checkCurrentZoomingLevel=function(){var e="None"!==this.customTimelineSettings.bottomTier.unit?this.customTimelineSettings.bottomTier.count:this.customTimelineSettings.topTier.count,t="None"!==this.customTimelineSettings.bottomTier.unit?this.customTimelineSettings.bottomTier.unit:this.customTimelineSettings.topTier.unit,i="None"!==this.customTimelineSettings.bottomTier.unit?"bottomTier":"topTier",a=this.getCurrentZoomingLevel(t,e,i);return this.parent.toolbarModule&&(a===this.parent.zoomingLevels[this.parent.zoomingLevels.length-1].level?this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin"],!1):a===this.parent.zoomingLevels[0].level&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomout"],!1)),this.parent.currentZoomingLevel=this.parent.zoomingLevels[a],a},e.prototype.getCurrentZoomingLevel=function(e,t,i){var a,r,n,s,o;this.parent.zoomingLevels.length||(this.parent.zoomingLevels=this.parent.getZoomingLevels());var l=this.parent.zoomingLevels.filter(function(t){return"bottomTier"===i?t.bottomTier.unit===e:t.topTier.unit===e});if(0===l.length){var d=this.getClosestUnit(e,"",!1);l=this.parent.zoomingLevels.filter(function(e){return"bottomTier"===i?e.bottomTier.unit===d:e.topTier.unit===d})}for(var h=l.sort(function(e,t){return"bottomTier"===i?e.bottomTier.count&&t.bottomTier.count?e.bottomTier.count<t.bottomTier.count?1:-1:0:e.topTier.count&&t.topTier.count?e.topTier.count<t.topTier.count?1:-1:0}),p=0;p<h.length;p++){if(o=h[p],p===h.length-1){a=h[p].level;break}if(s=h[p+1],t>=o[""+i].count){r=h[p],a=(n=h.filter(function(e){return"bottomTier"===i?e.bottomTier.count===r.bottomTier.count:e.topTier.count===r.topTier.count})).length>1?this.checkCollectionsWidth(n):n[0].level;break}if(t<o[""+i].count&&t>s[""+i].count){r=h[p+1],a=(n=h.filter(function(e){return"bottomTier"===i?e.bottomTier.count===r.bottomTier.count:e.topTier.count===r.topTier.count})).length>1?this.checkCollectionsWidth(n):n[0].level;break}}return a},e.prototype.getClosestUnit=function(e,t,i){var a=["Year","Month","Week","Day","Hour","Minutes"],r=a.indexOf(e);return 0===r&&(i=!0),e=this.isZoomIn||i?a[r+1]:a[r-1],0===this.parent.zoomingLevels.filter(function(t){return t.bottomTier.unit===e}).length?("Year"===e&&(i=!0),t=e,this.getClosestUnit(e,t,i)):e},e.prototype.checkCollectionsWidth=function(e){for(var t,i,a,r=e,n=this.customTimelineSettings.timelineUnitSize,s=r.sort(function(e,t){return e.timelineUnitSize<t.timelineUnitSize?1:-1}),o=0;o<s.length;o++){if(a=s[o],o===s.length-1){t=s[o].level;break}if(i=s[o+1],n>=a.timelineUnitSize){t=s[o].level;break}if(n<a.timelineUnitSize&&n>i.timelineUnitSize){t=s[o+1].level;break}}return t},e.prototype.updateTimelineHeaderHeight=function(){if(this.parent.timelineModule.isSingleTier?this.parent.element.classList.add("e-gantt-single-timeline"):this.parent.element.classList.remove("e-gantt-single-timeline"),this.previousIsSingleTier!==this.isSingleTier){var e=0;t.isNullOrUndefined(this.parent.toolbarModule)||t.isNullOrUndefined(this.parent.toolbarModule.element)||(e=this.parent.toolbarModule.element.offsetHeight),this.parent.ganttChartModule.scrollObject.setHeight(this.parent.ganttHeight-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight-e),this.parent.treeGrid.height=this.parent.ganttHeight-e-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight}},e.prototype.dateByLeftValue=function(e,i,a){var r=new Date(this.parent.timelineModule.timelineStartDate.toString()),n=864e5/this.parent.perDayWidth;if(this.parent.timelineSettings.showWeekend?r.setTime(r.getTime()+e*n):r=this.calculateDateExcludingNonWorkingDays(e,r),i&&!t.isNullOrUndefined(a.predecessorsName)&&""!==a.predecessorsName){r.setDate(r.getDate()-1);var s=this.parent.getCurrentDayEndTime(a.isAutoSchedule?a.autoEndDate:a.endDate);this.parent.dateValidationModule.setTime(s,r),r=this.parent.dateValidationModule.checkStartDate(r,a,!0)}var o="None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.topTier:this.parent.timelineModule.bottomTier;return"Hour"!==o&&"Minutes"!==o&&(this.parent.isInDst(new Date(this.parent.timelineModule.timelineStartDate.toString()))&&!this.parent.isInDst(r)?r.setTime(r.getTime()+36e5):!this.parent.isInDst(new Date(this.parent.timelineModule.timelineStartDate.toString()))&&this.parent.isInDst(r)&&r.setTime(r.getTime()-36e5)),r},e.prototype.calculateDateExcludingNonWorkingDays=function(e,t){var i=864e5/this.parent.perDayWidth,a=this.parent.nonWorkingDayIndex,r=Math.ceil(e*i/864e5),n=7-a.length,s=Math.floor(r/n),o=r%n,l=new Date(t);l.setDate(l.getDate()+7*s);for(var d=0;d<o;)l.setDate(l.getDate()+1),-1===a.indexOf(l.getDay())&&d++;return l},e.prototype.createTimelineSeries=function(){var e,i,a,r,n,s,o,l=this.isSingleTier?1:2,d="None"===this.topTier?"bottomTier":"topTier";if(this.topTierCollection=[],this.bottomTierCollection=[],!0===this.restrictRender&&(this.updateTimelineHeaderHeight(),this.wholeTimelineWidth=this.calculateWidthBetweenTwoDate(d,this.parent.timelineModule.timelineStartDate,this.parent.timelineModule.timelineEndDate)),this.parent.enableTimelineVirtualization&&this.wholeTimelineWidth>3*this.parent.element.offsetWidth){for(h=0;h<l;h++){(r=t.createElement("table",{className:"e-timeline-header-table-container",styles:"display: block;"})).setAttribute("role","none"),n=t.createElement("thead",{className:"e-timeline-header-table-body",styles:"display:block; border-collapse:collapse"});p=this.createTimelineTemplate(d);e=t.createElement("tr"),Array.from(p.childNodes).forEach(function(t){e.appendChild(t)}),i=t.createElement("td"),a=t.createElement("div",{styles:"width: 20px"}),s=t.createElement("div",{className:"e-virtualtable"}),o=t.createElement("div",{className:"e-virtualtrack"}),i.appendChild(a),e.appendChild(i),s.appendChild(e),n.appendChild(s),n.appendChild(o),r.appendChild(n),this.parent.ganttChartModule.chartTimelineContainer.appendChild(r),d="bottomTier",e=null,this.restrictRender=!1}this.timelineVirtualizationStyles()}else{for(var h=0;h<l;h++){(r=t.createElement("table",{className:"e-timeline-header-table-container",styles:"display: block;"})).setAttribute("role","none"),n=t.createElement("thead",{className:"e-timeline-header-table-body",styles:"display:block; border-collapse:collapse"});var p=this.createTimelineTemplate(d);e=t.createElement("tr"),Array.from(p.childNodes).forEach(function(t){e.appendChild(t)}),i=t.createElement("td"),a=t.createElement("div",{styles:"width: 20px"}),i.appendChild(a),e.appendChild(i),n.appendChild(e),r.appendChild(n),this.parent.ganttChartModule.chartTimelineContainer.appendChild(r),d="bottomTier",e=null}this.wholeTimelineWidth=this.totalTimelineWidth}},e.prototype.timelineVirtualizationStyles=function(){var e=0,i=this.wholeTimelineWidth;if(this.parent.enableTimelineVirtualization){e=this.parent.enableTimelineVirtualization&&!t.isNullOrUndefined(this.parent.ganttChartModule.scrollObject.element.scrollLeft)&&0!==this.parent.ganttChartModule.scrollObject.element.scrollLeft?this.parent.ganttChartModule.scrollObject.getTimelineLeft():0,this.parent.enableRtl&&(e=-e);var a=this.parent.element.querySelectorAll(".e-chart-scroll-container")[0].querySelector(".e-virtualtable");(!this.parent.undoRedoModule||this.parent.undoRedoModule&&!this.parent.undoRedoModule.isZoomingUndoRedoProgress)&&(a.style.transform="translate("+e+"px, 0px)");var r=this.parent.element.querySelectorAll(".e-chart-scroll-container")[0].querySelector(".e-virtualtrack");if(r.style.position="relative",r.style.width=i+"px",this.parent.ganttChartModule.scrollObject.isSetScrollLeft){var n=this.parent.element.querySelectorAll(".e-timeline-header-table-container")[0].querySelector(".e-virtualtable"),s=void 0;t.isNullOrUndefined(this.parent.element.querySelectorAll(".e-timeline-header-table-container")[1])||(s=this.parent.element.querySelectorAll(".e-timeline-header-table-container")[1].querySelector(".e-virtualtable")),n.style.transform="translate("+e+"px, 0px)",t.isNullOrUndefined(s)||(s.style.transform="translate("+e+"px, 0px)")}var o=this.parent.element.querySelectorAll(".e-timeline-header-table-container")[0].querySelector(".e-virtualtrack"),l=void 0;t.isNullOrUndefined(this.parent.element.querySelectorAll(".e-timeline-header-table-container")[1])||(l=this.parent.element.querySelectorAll(".e-timeline-header-table-container")[1].querySelector(".e-virtualtrack")),t.isNullOrUndefined(l)||(l.style.position="relative",l.style.width=i+"px"),o.style.position="relative",o.style.width=i+"px",this.parent.connectorLineModule.svgObject.style.width=i+"px",this.parent.element.querySelector(".e-timeline-header-container").style.width="calc(100% - 17px)",(this.parent.timelineModule.isZooming||this.parent.timelineModule.isZoomToFit)&&(this.parent.ganttChartModule.scrollElement.scrollLeft=0,this.isZoomingAction=!0,this.parent.ganttChartModule.scrollObject.updateChartElementStyles())}},e.prototype.validateCount=function(e,i,a){var r,n=!t.isNullOrUndefined(i)&&parseInt(i.toString(),10)>0?parseInt(i.toString(),10):1,s=Math.abs(this.timelineRoundOffEndDate.getTime()-this.timelineStartDate.getTime());switch(e){case"Year":n=n<=(r=Math.round(s/864e5/336))?n:r>0?r:1,"None"!==this.topTier&&"bottomTier"===a&&(n=this.validateBottomTierCount(e,n));break;case"Month":n=n<=(r=Math.round(s/864e5/28))?n:r>0?r+1:1,"None"!==this.topTier&&"bottomTier"===a&&(n=this.validateBottomTierCount(e,n));break;case"Week":n=n<=(r=Math.round(s/864e5/7))?n:r>0?r:1,"None"!==this.topTier&&"bottomTier"===a&&(n=this.validateBottomTierCount(e,n));break;case"Day":n=n<=(r=Math.round(s/864e5))?n:r>0?r:1,"None"!==this.topTier&&"bottomTier"===a&&(n=this.validateBottomTierCount(e,n));break;case"Hour":n=n<=(r=Math.round(s/36e5))?n:r>0?r:1,"None"!==this.topTier&&"bottomTier"===a&&(n=this.validateBottomTierCount(e,n));break;case"Minutes":n=n<=(r=Math.round(s/6e4))?n:r>0?r:1,"None"!==this.topTier&&"bottomTier"===a&&(n=this.validateBottomTierCount(e,n))}return i!==n&&this.isZooming&&this.parent.toolbarModule&&("bottomTier"===a||this.isSingleTier)&&(this.isZoomIn?this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin"],!1):this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomout"],!1)),n},e.prototype.validateBottomTierCount=function(e,t){var i;switch(e){case"Year":i=t<=this.customTimelineSettings.topTier.count?t:this.customTimelineSettings.topTier.count;break;case"Month":i="Year"===this.topTier?t<=12*this.customTimelineSettings.topTier.count?t:12*this.customTimelineSettings.topTier.count:t<=this.customTimelineSettings.topTier.count?t:this.customTimelineSettings.topTier.count;break;case"Week":i="Year"===this.topTier?t<=48*this.customTimelineSettings.topTier.count?t:48*this.customTimelineSettings.topTier.count:"Month"===this.topTier?t<=4*this.customTimelineSettings.topTier.count?t:4*this.customTimelineSettings.topTier.count:t<=this.customTimelineSettings.topTier.count?t:this.customTimelineSettings.topTier.count;break;case"Day":i="Year"===this.topTier?t<=336*this.customTimelineSettings.topTier.count?t:336*this.customTimelineSettings.topTier.count:"Month"===this.topTier?t<=28*this.customTimelineSettings.topTier.count?t:28*this.customTimelineSettings.topTier.count:"Week"===this.topTier?t<=7*this.customTimelineSettings.topTier.count?t:7*this.customTimelineSettings.topTier.count:t<=this.customTimelineSettings.topTier.count?t:this.customTimelineSettings.topTier.count;break;case"Hour":i="Year"===this.topTier?t<=8064*this.customTimelineSettings.topTier.count?t:8064*this.customTimelineSettings.topTier.count:"Month"===this.topTier?t<=672*this.customTimelineSettings.topTier.count?t:672*this.customTimelineSettings.topTier.count:"Week"===this.topTier?t<=7*this.customTimelineSettings.topTier.count*24?t:7*this.customTimelineSettings.topTier.count*24:"Day"===this.topTier?t<=24*this.customTimelineSettings.topTier.count?t:24*this.customTimelineSettings.topTier.count:t<=this.customTimelineSettings.topTier.count?t:this.customTimelineSettings.topTier.count;break;case"Minutes":i="Year"===this.topTier?t<=483840*this.customTimelineSettings.topTier.count?t:483840*this.customTimelineSettings.topTier.count:"Month"===this.topTier?t<=40320*this.customTimelineSettings.topTier.count?t:40320*this.customTimelineSettings.topTier.count:"Week"===this.topTier?t<=7*this.customTimelineSettings.topTier.count*24*60?t:7*this.customTimelineSettings.topTier.count*24*60:"Day"===this.topTier?t<=24*this.customTimelineSettings.topTier.count*60?t:24*this.customTimelineSettings.topTier.count*60:"Hour"===this.topTier?t<=60*this.customTimelineSettings.topTier.count?t:60*this.customTimelineSettings.topTier.count:t<=this.customTimelineSettings.topTier.count?t:this.customTimelineSettings.topTier.count}return i},e.prototype.validateFormat=function(e,t){var i;switch(e){case"Week":i=t||"MMM dd, yyyy";break;case"Day":case"None":i=t||"";break;case"Hour":i=t||"H";break;case"Month":i=t||"MMM yyyy";break;case"Year":i=t||"yyyy";break;case"Minutes":i=t||"m"}return i},e.prototype.extendFunction=function(e,t,i){for(var a=this,r={},n=0;n<t.length;n++)r[t[n]]=e[t[n]];return i&&Object.keys(i).forEach(function(t){r[t]=a.extendFunction(e[t],i[t],null)}),r},e.prototype.formatDateHeader=function(e,t,i){var a,r=new Date(t.getTime());return""===e?(a=this.parent.globalize.formatDate(r,{format:"E"}),a="zh"===this.parent.locale?a.slice(1):"ar"===this.parent.locale?a:a.slice(0,1)):(a=this.parent.globalize.formatDate(r,{format:e}),i&&(a=this.updateHourInFormat(e,a,i.getHours()).updatedFormat)),a},e.prototype.isDateAffectedByDST=function(e){for(var t=new Date(e),i=t.getTimezoneOffset(),a=1;a<=3;a++)if(new Date(t.getTime()-60*a*60*1e3).getTimezoneOffset()!==i)return!0;return!1},e.prototype.calculateIteration=function(e,t,i,a){e.setHours(t.getHours()),this.isFirstLoop&&this.parent.isInDst(t)&&this.isDateAffectedByDST(t)&&(e.setHours(e.getHours()-1),this.increaseIteration=!0),this.isFirstLoop=!1,e.setMinutes(t.getMinutes()),e.setSeconds(t.getSeconds()),e.setMilliseconds(t.getMilliseconds());var r;if("Hour"===i){n=t.getHours();r=Math.ceil((24-n)/a)}else if("Minutes"===i){var n=t.getHours(),s=t.getMinutes();r=Math.ceil((1440-(60*n+s))/a)}return this.increaseIteration&&(r+=1,this.increaseIteration=!1),{iterations:r,dummystartDate:e}},e.prototype.updateHourInFormat=function(e,t,i){var a=e.match(/(h{1,2})/)||e.match(/(H{1,2})/);if(!a)return{hasHour:!1,updatedFormat:t};var r=a[0],n=e.split(/[\s,:]+/),s=t.split(/[\s,:]+/),o=n.findIndex(function(e){return e.includes("h")||e.includes("H")});if(-1===o||o>=s.length)return{hasHour:!1,updatedFormat:t};var l=function(e,t){for(var i=String(e);i.length<t;)i="0"+i;return i}(i,r.length);return s[o]=l,{hasHour:!0,hourIndex:o,updatedFormat:s.join(" ")}},e.prototype.customFormat=function(e,i,a,r,n){return(n="string"==typeof n?t.getValue(n,window):n)(e,i,a,r)},e.prototype.createTimelineTemplate=function(e){var i,a,r,n=!1,s=this.parent,o=t.createElement("th"),l="topTier"===e?s.timelineModule.customTimelineSettings.topTier.unit:s.timelineModule.customTimelineSettings.bottomTier.unit,d="topTier"===e?s.timelineModule.customTimelineSettings.topTier.count:s.timelineModule.customTimelineSettings.bottomTier.count,h=s.timelineModule.customTimelineSettings.topTier,p=s.timelineModule.customTimelineSettings.bottomTier,u=this.parent.enableTimelineVirtualization&&0!==this.parent.ganttChartModule.scrollObject.element.scrollLeft?this.parent.ganttChartModule.scrollObject.getTimelineLeft():null,c=this.parent.enableTimelineVirtualization&&!t.isNullOrUndefined(u)?new Date(this.dateByLeftValue(u).toString()):new Date(this.parent.timelineModule.timelineStartDate.toString()),g=new Date(this.timelineRoundOffEndDate.toString()),f=[],m=new Set,y=0,D=3*this.parent.element.offsetWidth,v=this.parent.dataOperation.hasDSTTransition(c.getFullYear()),k=new Date(2e3,0,1,0,0,0,0),b=!1;this.isFirstLoop=!0;do{if(this.parent.timelineSettings.showWeekend||!this.isNonWorkingDayHeader(l,e,c)){var w={};w.startDate=new Date(c.getTime());var T={};if("Month"!==l&&"Hour"!==l||"bottomTier"!==e||1===d||0!==f.length||(n=!0),("Hour"===l||"Minutes"===l&&60===d||"Hour"===h.unit&&"Minutes"===p.unit)&&v){var S=this.calculateIteration(k,c,l,d),P=S.iterations;k.setTime(S.dummystartDate.getTime());for(var C=0;C<P;C++){(w={}).startDate=new Date(c.getTime()),c.getHours()!==k.getHours()&&(this.applyDstHour=!0),i=this.getHeaterTemplateString(new Date(c.toString()),l,e,!1,d,w,n,k);var R=new Date(c.toString()),M=R.getTime();m.has(M)||(m.add(M),f.push(R));var x=this.getIncrement(c,d,l,n,!0),O=x;"Minutes"!==l&&"Hour"!==l||(this.dstIncreaseHour&&(this.fromDummyDate=!0,O=this.getIncrement(k,d,l,n,!0),this.dstIncreaseHour=!1,this.fromDummyDate=!1),k.setTime(k.getTime()+O),this.inconsistenceDstApplied?(c.setTime(c.getTime()+x-18e5),this.inconsistenceDstApplied=!1):c.setTime(c.getTime()+x)),n=!1,C===P-1&&0!==c.getHours()&&c.setHours(0),23===c.getHours()&&c.getHours()!==k.getHours()&&c.setHours(c.getHours()-1),c>=g&&(i=this.getHeaterTemplateString(f[f.length-1],l,e,!0,d,w),b=!0),o.appendChild(i);F="topTier"===e?this.topTierCollection:this.bottomTierCollection;if(w.endDate=new Date(c.getTime()),this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.enableTimelineVirtualization?"topTier"===e?this.pdfExportTopTierCollection.push(w):this.pdfExportBottomTierCollection.push(w):F.push(w),y+=w.width,this.weekendEndDate=w.endDate>=g?g:w.endDate,b){b=!1;break}}this.applyDstHour=!1,"Hour"===l?T.day=Math.floor(P*d/24):"Minutes"===l&&(T.day=Math.floor(P*d/1440)),k=new Date(2e3,0,1,0,0,0,0)}else{if(i=this.getHeaterTemplateString(new Date(c.toString()),l,e,!1,d,w,n),f.push(new Date(c.toString())),n&&"Month"===l?r=this.calculateQuarterEndDate(c,d).getTime():(a=Math.abs(this.getIncrement(c,d,l,n,!0)),r=c.getTime()+a),n=!1,!this.parent.timelineSettings.showWeekend&&"Day"===l){for(var I=0,E=new Date(c);I<d;)E.setHours(0,0,0,0),E.setDate(E.getDate()+1),-1===this.parent.nonWorkingDayIndex.indexOf(E.getDay())&&I++;r=E.getTime()}c.setTime(r),!v||"Day"!==l&&"Month"!==l&&"Week"!==l||c.setHours(0,0,0,0),c>=g&&(i=this.getHeaterTemplateString(f[f.length-1],l,e,!0,d,w)),o.appendChild(i);var F="topTier"===e?this.topTierCollection:this.bottomTierCollection;w.endDate=new Date(c.getTime()),this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.enableTimelineVirtualization?"topTier"===e?this.pdfExportTopTierCollection.push(w):this.pdfExportBottomTierCollection.push(w):F.push(w),y+=w.width,this.weekendEndDate=w.endDate>=g?g:w.endDate}}else a=Math.abs(this.getIncrement(c,d,l,n,!0)),r=c.getTime()+a,c.setTime(r)}while(this.parent.enableTimelineVirtualization&&(!this.parent.pdfExportModule||this.parent.pdfExportModule&&!this.parent.pdfExportModule.isPdfExport)?y<D&&c<g:c<g);return o},e.prototype.isNonWorkingDayHeader=function(e,t,i){return("Day"===e||"Hour"===e||"Minutes"===e)&&-1!==this.parent.nonWorkingDayIndex.indexOf(i.getDay())},e.prototype.updateTimelineAfterZooming=function(e,i){var a,r,n,s,o=document.getElementsByClassName("e-chart-scroll-container e-content")[0];if(!t.isNullOrUndefined(o)){s=!this.parent.isLoad&&this.parent.splitterModule&&this.parent.splitterModule.splitterObject&&"Chart"===this.parent.splitterSettings.view?o.offsetWidth+this.parent.splitterModule.splitterObject.allPanes[0].offsetWidth:o.offsetWidth;var l=o.offsetHeight,d=document.getElementsByClassName("e-chart-rows-container")[0].offsetHeight;if(a=Math.abs(this.timelineStartDate.getTime()-e.getTime()),a/=864e5,r="None"===this.bottomTier?this.getPerDayWidth(this.customTimelineSettings.timelineUnitSize,this.customTimelineSettings.topTier.count,this.topTier):this.getPerDayWidth(this.customTimelineSettings.timelineUnitSize,this.customTimelineSettings.bottomTier.count,this.bottomTier),n=l<d?r*a+17:r*a,s>=n){var h=s-n;if(this.parent.timelineSettings.showWeekend)h=Math.round(h/r),e.setDate(e.getDate()+h);else{for(var p=864e5/r,u=Math.floor(s*p/864e5),c=7-this.parent.nonWorkingDayIndex.length,g=u%c,f=7*Math.floor(u/c)+g,m=e.getDay();g>0;)m=(m+1)%7,-1===this.parent.nonWorkingDayIndex.indexOf(m)&&g--,f++;e.setDate(e.getDate()+f)}this.parent.timelineModule.timelineEndDate=e,i&&this.parent.updateProjectDates(this.timelineStartDate,this.timelineEndDate,this.parent.isTimelineRoundOff)}}},e.prototype.getTimelineRoundOffEndDate=function(e){var i="None"===this.topTier?this.bottomTier:this.topTier,a=new Date(e.toString());return this.parent.isTimelineRoundOff&&("Hour"===i?a.setMinutes(60):"Minutes"===i?a.setSeconds(60):a.setHours(24,0,0,0)),t.isNullOrUndefined(this.parent.projectEndDate)&&this.updateTimelineAfterZooming(a,!1),a},e.prototype.getIncrement=function(e,t,i,a,r){var n,s=new Date(e.getTime()),o=new Date(e.getTime()),l=!1,d=new Date(s);switch(i){case"Year":s=e,o=new Date(e.getFullYear()+(t-1),11,31);var h=k(e),p=(b=this.resetToNextYear(e,t))-h;n=this.adjustForDST(s,o,p,o.getTime()-s.getTime()+864e5,r,!0);break;case"Month":s=e,o=new Date(e.getFullYear(),e.getMonth()+t,1);var h=k(e),u=(b=this.resetToNextMonth(e,t))-h;n=this.adjustForDST(s,o,u,o.getTime()-s.getTime(),r,!0);break;case"Week":var c=this.parent.timelineModule.customTimelineSettings.weekStartDay,g=e.getDay()<c?c-e.getDay():6-e.getDay()+c;t=g>0?t-1:0,o.setHours(24,0,0,0),g=e.getDay()<c&&g>0?g-1:g,o.setDate(o.getDate()+(g+7*t));var f=(b=(m=this.resetToNextDay(e))+24*(g+7*t)*60*60*1e3)-(h=k(e));n=this.adjustForDST(s,o,f,o.getTime()-s.getTime(),r,!0);break;case"Day":o.setHours(24,0,0,0);var m=this.resetToNextDay(s),y=(b=m+24*(t-1)*60*60*1e3)-(h=k(s));n=o.getTime()-s.getTime()+864e5*(t-1),(T=new Date(s)).setTime(T.getTime()+n),n=this.adjustForDST(s,T,y,T.getTime()-s.getTime(),r,!0);break;case"Hour":o.setMinutes(60),o.setSeconds(0);var D=(b=this.resetToNextHour(s)+60*(t-1)*60*1e3)-(h=k(s));n=o.getTime()-s.getTime()+36e5*(t-1),(T=new Date(s)).setTime(T.getTime()+n),a&&12===t&&0!==s.getHours()&&T.setHours(0,0,0,0);var v=new Date(s);v.setHours(v.getHours()-t),-30===s.getTimezoneOffset()-v.getTimezoneOffset()&&(T.setMinutes(T.getMinutes()+30),this.inconsistenceDstApplied=!0),T.getHours()<d.getHours()+t&&(l=!0),n=this.adjustForDST(s,T,D,T.getTime()-s.getTime(),r,l);break;case"Minutes":o.setSeconds(60);var b=this.resetToNextMinute(s)+60*(t-1)*1e3,w=b-(h=k(s));n=o.getTime()-s.getTime()+6e4*(t-1);var T=new Date(s);T.setTime(T.getTime()+n),T.getMinutes()<=d.getMinutes()&&(l=!0),n=this.adjustForDST(s,T,w,T.getTime()-s.getTime(),r,l)}return n},e.prototype.resetToNextYear=function(e,t){var i=e.getFullYear()+t;return Date.UTC(i,0,1,0,0,0,0)},e.prototype.resetToNextMonth=function(e,t){var i=e.getFullYear(),a=e.getMonth();return Date.UTC(i,a+t,1,0,0,0,0)},e.prototype.resetToNextDay=function(e){var t=e.getFullYear(),i=e.getMonth(),a=e.getDate();return Date.UTC(t,i,a+1,0,0,0,0)},e.prototype.resetToNextHour=function(e){var t=e.getFullYear(),i=e.getMonth(),a=e.getDate(),r=e.getHours();return Date.UTC(t,i,a,r+1,0,0,0)},e.prototype.resetToNextMinute=function(e){var t=e.getFullYear(),i=e.getMonth(),a=e.getDate(),r=e.getHours(),n=e.getMinutes();return Date.UTC(t,i,a,r,n+1,0,0)},e.prototype.adjustForDST=function(e,t,i,a,r,n){if(!this.parent.dataOperation.hasDSTTransition(e.getFullYear()))return a;if(this.inconsistenceDstApplied)return a;var s=a-i;return t.getTimezoneOffset()>e.getTimezoneOffset()&&r?(this.dstIncreaseHour=!0,this.fromDummyDate?i:n?a+36e5:a):(s>0?a-=s:s<0&&(a+=Math.abs(s)),a)},e.prototype.isWeekendHeaderCell=function(e,t,i){return!("Day"!==e&&"Hour"!==e&&"Minutes"!==e||1!==this.customTimelineSettings[t].count&&"Hour"!==e&&"Minutes"!==e||-1===this.parent.nonWorkingDayIndex.indexOf(i.getDay()))},e.prototype.calculateQuarterEndDate=function(e,t){var i=e.getMonth();return 3===t?i>=0&&i<=2?new Date(e.getFullYear(),3,1):i>=3&&i<=5?new Date(e.getFullYear(),6,1):i>=6&&i<=8?new Date(e.getFullYear(),9,1):new Date(e.getFullYear()+1,0,1):i>=0&&i<=5?new Date(e.getFullYear(),6,1):new Date(e.getFullYear()+1,0,1)},e.prototype.calculateTotalHours=function(e,t){var i=0;switch(e){case"Hour":i=1*t;break;case"Day":i=24*t;break;case"Week":i=168*t;break;case"Minutes":i=t/60}return i},e.prototype.getHeaterTemplateString=function(e,i,a,r,n,s,o,l){var d,h="",p=null;t.isNullOrUndefined(this.parent.timelineTemplate)||(p=this.parent.chartRowsModule.templateCompiler(this.parent.timelineTemplate));var u,c="topTier"===a?this.parent.timelineModule.customTimelineSettings.topTier.format:this.parent.timelineModule.customTimelineSettings.bottomTier.format,g="topTier"===a?this.parent.timelineModule.customTimelineSettings.topTier.formatter:this.parent.timelineModule.customTimelineSettings.bottomTier.formatter,f=this.getIncrement(e,n,i,o);if(!this.parent.timelineSettings.showWeekend&&(("Week"===i||"Month"===i||"Year"===i)&&"topTier"===a&&"Day"===this.parent.currentZoomingLevel.bottomTier.unit||"Hour"===this.parent.currentZoomingLevel.bottomTier.unit||this.isZoomToFit)){var m=new Date(e),y=new Date(e),D=new Date(y.getTime()+f);D.setHours(0,0,0,0),f-=24*this.calculateNonWorkingDaysBetweenDates(m,D)*60*60*1e3}var v=u=Math.abs(f/864e5*this.parent.perDayWidth);u=r?this.calculateWidthBetweenTwoDate(i,e,this.timelineRoundOffEndDate,s,r):o&&"Hour"!==i?this.calculateWidthBetweenTwoDate(i,e,this.calculateQuarterEndDate(e,n)):u,this.isFirstLoop&&this.parent.isInDst(e)&&1===e.getHours()&&this.isDateAffectedByDST(e)&&(u+=this.parent.perDayWidth/24),this.isFirstLoop=!1;var k=this.isWeekendHeaderCell(i,a,e),b="topTier"===a?" e-gantt-top-cell-text":"";o&&20===e.getHours()&&12===n&&"bottomTier"===a&&"Hour"===this.parent.timelineModule.customTimelineSettings.bottomTier.unit&&e.setTime(e.getTime()-72e6);var w=new Date(e);if(this.parent.timelineSettings.showWeekend)w=new Date(e);else if(this.isWeekend(w))for(;-1!==this.parent.nonWorkingDayIndex.indexOf(w.getDay());)w.setDate(w.getDate()+1);var T,S=t.isNullOrUndefined(g)?this.parent.globalize.formatDate(w,{format:this.parent.getDateFormat()}):this.customFormat(w,c,a,i,g);if(T=this.applyDstHour?t.isNullOrUndefined(g)?this.formatDateHeader(c,w,l):this.customFormat(w,c,a,i,g):t.isNullOrUndefined(g)?this.formatDateHeader(c,w):this.customFormat(w,c,a,i,g),!t.isNullOrUndefined(p)){var P={date:S,tier:a,value:T},C=(d=p(t.extend({},P),this.parent,"TimelineTemplate",this.parent.chartRowsModule.getTemplateID("TimelineTemplate"),!1,void 0,null,this.parent.root))[0];C instanceof HTMLElement&&(C.setAttribute("data-tier",a),C.setAttribute("date",S),C.setAttribute("value",T))}var R=this.parent.timelineModule.isSingleTier?"e-timeline-single-header-cell":"e-timeline-top-header-cell",M=k?" e-weekend-header-cell":"",x=t.createElement("th",{className:""+R+M,styles:"width:"+u+"px;"+(k&&this.customTimelineSettings.weekendBackground?"background-color:"+this.customTimelineSettings.weekendBackground+";":"")});x.tabIndex=-1,x.setAttribute("aria-label",this.parent.localeObj.getConstant("timelineCell")+" "+S);var O=t.createElement("div",{className:"e-header-cell-label"+b,styles:"width:"+(u-1)+"px;"});return O.title=this.parent.timelineSettings.showTooltip?S:"",O.textContent=T,O.setAttribute("data-tier",a),this.parent.isReact&&!t.isNullOrUndefined(d)&&d.length>0&&(d[0].style.width="100%",d[0].style.height="100%"),!t.isNullOrUndefined(p)&&!t.isNullOrUndefined(d)&&d.length>0?t.append(d,x):x.append(O),h+=x.outerHTML,!this.isSingleTier&&"topTier"!==a||r?(this.isSingleTier||"topTier"===a)&&r&&(this.totalTimelineWidth=this.totalTimelineWidth-v+u):this.totalTimelineWidth=this.totalTimelineWidth+u,s.value=T,s.isWeekend=k,s.width=u,x},e.prototype.calculateNonWorkingDaysBetweenDates=function(e,t){for(var i=Math.ceil((t.getTime()-e.getTime())/864e5),a=i%7,r=Math.floor(i/7)*this.parent.nonWorkingDayIndex.length,n=e.getDay(),s=0;s<a;s++){var o=(n+s)%7;-1!==this.parent.nonWorkingDayIndex.indexOf(o)&&r++}return r},e.prototype.isWeekend=function(e){var t=e.getDay();return-1!==this.parent.nonWorkingDayIndex.indexOf(t)},e.prototype.calculateWidthBetweenTwoDate=function(e,t,i,a,r){var n=new Date(t.getTime()),s=new Date(i.getTime());this.parent.dateValidationModule.updateDateWithTimeZone(n,s);var o=(s.getTime()-n.getTime())/864e5;if(this.parent.timelineSettings.showWeekend||"Day"!==this.parent.currentZoomingLevel.bottomTier.unit&&"Hour"!==this.parent.currentZoomingLevel.bottomTier.unit&&!this.isZoomToFit)return o*this.parent.perDayWidth;var l=Math.floor(o/7)*(7-this.parent.nonWorkingDayIndex.length),d=o%7;if(d>1||l>1){for(var h=0,p=new Date(n),u=0;u<d;u++){var c=p.getDay();-1===this.parent.nonWorkingDayIndex.indexOf(c)&&h++,p.setDate(p.getDate()+1)}return(l+h)*this.parent.perDayWidth}return this.isZoomToFit&&r?a.width:o*this.parent.perDayWidth},e.prototype.timelineWidthCalculation=function(){var e=this.customTimelineSettings.timelineUnitSize,t=this.customTimelineSettings.bottomTier.count,i=this.customTimelineSettings.topTier.count;this.bottomTierCellWidth=e,"None"===this.bottomTier?this.parent.perDayWidth=this.getPerDayWidth(e,i,this.topTier):this.parent.perDayWidth=this.getPerDayWidth(e,t,this.bottomTier),this.topTierCellWidth="None"!==this.bottomTier?"Week"===this.topTier?7*this.parent.perDayWidth:"Hour"===this.topTier?this.parent.perDayWidth/24:"Minutes"===this.topTier?this.parent.perDayWidth/1440:this.parent.perDayWidth:e,this.topTierCellWidth=this.isSingleTier?this.topTierCellWidth:this.topTierCellWidth*i},e.prototype.getPerDayWidth=function(e,t,i){var a;switch(i){case"Year":a=e/t/336;break;case"Month":a=e/t/28;break;case"Week":a=e/t/7;break;case"Day":a=e/t;break;case"Hour":a=24/t*e;break;case"Minutes":a=1440/t*e}return a},e.prototype.roundOffDays=function(){var e=this.parent.cloneProjectStartDate,i=this.parent.cloneProjectEndDate,a="None"===this.topTier?this.bottomTier:this.topTier;if(this.parent.isTimelineRoundOff){if("Year"===a)e=new Date(e.getFullYear(),0,1),i=new Date(i.getFullYear(),11,31);else if("Month"===a)e=new Date(e.getFullYear(),e.getMonth(),1),i=new Date(i.getFullYear(),i.getMonth()+1,0);else if("Week"===a){var r=t.isNullOrUndefined(this.customTimelineSettings.weekStartDay)?0:this.parent.timelineModule.customTimelineSettings.weekStartDay,n=e.getDay()<r?e.getDate()-(7-r+e.getDay()):e.getDate()-e.getDay()+r;if(!this.parent.timelineSettings.showWeekend)for(;this.isWeekend(new Date(e.getFullYear(),e.getMonth(),n));)n++;e.setDate(n);var s=i.getDate()-i.getDay()+6+r;i.setDate(s)}"Hour"===a?e.setMinutes(0):"Minutes"===a?e.setSeconds(0):e.setHours(0,0,0,0)}this.timelineStartDate=e,this.timelineEndDate=i,this.timelineRoundOffEndDate=this.getTimelineRoundOffEndDate(this.timelineEndDate)},e.prototype.updateScheduleDatesByToolBar=function(e,t,i,a){var r=this;if("Year"===e&&("prevTimeSpan"===t?i=0===i.getMonth()?new Date(i.getFullYear()-1,0,1):new Date(i.getFullYear(),0,1):a=11===a.getMonth()?new Date(a.getFullYear()+1,0,1):new Date(a.getFullYear(),12,1)),"Month"===e&&("prevTimeSpan"===t?i=1===i.getDate()?new Date(i.getFullYear(),i.getMonth()-1,1):new Date(i.getFullYear(),i.getMonth(),1):a=new Date(a.getFullYear(),a.getMonth()+1,1)),"Week"===e){var n=this.parent.timelineModule.customTimelineSettings.weekStartDay,s=void 0;if("prevTimeSpan"===t)if(this.parent.timelineSettings.showWeekend)s=i.getDay()<n?7-(n-i.getDay()):i.getDay()-n,i.setHours(0,0,0,0),0===s?i.setDate(i.getDate()-7):i.setDate(i.getDate()-s);else{var o=Array.from({length:7},function(e,t){return t}).filter(function(e){return-1===r.parent.nonWorkingDayIndex.indexOf(e)});if(i.setHours(0,0,0,0),this.parent.timelineModule.customTimelineSettings.weekStartDay>1)for(;;){i.setDate(i.getDate()-1);var l=i.getDay();if(-1!==o.indexOf(l)&&l===this.parent.timelineModule.customTimelineSettings.weekStartDay)break}else for(var d=0;d<o.length;){i.setDate(i.getDate()-1);var h=i.getDay();-1!==o.indexOf(h)&&d++}}else s=a.getDay()<n?n-a.getDay():7-a.getDay()+n,a.setHours(0,0,0,0),0===s?a.setDate(a.getDate()+6):a.setDate(a.getDate()+s)}if("Day"===e)if("prevTimeSpan"===t)if(0===i.getHours()){if(i.setTime(i.getTime()-864e5),!this.parent.timelineSettings.showWeekend)for(;-1!==this.parent.nonWorkingDayIndex.indexOf(i.getDay());)i.setTime(i.getTime()-864e5)}else i.setHours(0);else if(0===a.getHours()){if(a.setTime(a.getTime()+864e5),!this.parent.timelineSettings.showWeekend)for(;-1!==this.parent.nonWorkingDayIndex.indexOf(a.getDay());)a.setTime(a.getTime()+864e5)}else a.setHours(24);"Hour"===e&&("prevTimeSpan"===t?0===i.getMinutes()?i.setTime(i.getTime()-36e5):i.setMinutes(0):0===a.getMinutes()?a.setTime(a.getTime()+36e5):a.setMinutes(60)),"Minutes"===e&&("prevTimeSpan"===t?0===i.getSeconds()?i.setTime(i.getTime()-6e4):i.setSeconds(0):0===a.getSeconds()?a.setTime(a.getTime()+6e4):a.setSeconds(60)),this.parent.cloneProjectStartDate=i,this.parent.cloneProjectEndDate=a},e.prototype.updateTimeLineOnEditing=function(e,i){if(e[0].length>=1)for(var r=0;r<e.length;r++){var n=e[parseInt(r.toString(),10)],s=n.filter(function(e){return!t.isNullOrUndefined(e.ganttProperties.startDate)}),o=n.filter(function(e){return!t.isNullOrUndefined(e.ganttProperties.endDate)}),l=s.length>0?new Date(a.DataUtil.aggregates.min(s,"ganttProperties.startDate")):null,d=s.length>0?new Date(a.DataUtil.aggregates.min(o,"ganttProperties.endDate")):null,h=o.length>0?new Date(a.DataUtil.aggregates.max(o,"ganttProperties.endDate")):null,p=new Date(this.parent.dataOperation.checkStartDate(this.timelineStartDate).getTime()),u=new Date(this.parent.dataOperation.checkEndDate(this.timelineEndDate).getTime()),c=t.isNullOrUndefined(l)?null:this.parent.dataOperation.getTaskLeft(l,!1),g=t.isNullOrUndefined(h)?null:this.parent.dataOperation.getTaskLeft(h,!1),f=this.parent.dataOperation.getTaskLeft(p,!1),m=this.parent.dataOperation.getTaskLeft(u,!1),y=void 0,D=this.parent.editModule.taskbarEditModule,v=s.length>0?new Date(a.DataUtil.aggregates.min(s,"ganttProperties.startDate")).setHours(0,0,0,0):null,k=new Date(this.timelineStartDate.getTime()).setHours(0,0,0,0);!t.isNullOrUndefined(c)&&!t.isNullOrUndefined(D)&&(D.taskBarEditAction&&"RightResizing"!==D.taskBarEditAction||t.isNullOrUndefined(D.taskBarEditAction))&&v<=k&&(c<this.bottomTierCellWidth||c<=f)?(y="prevTimeSpan",l=l>this.timelineStartDate?this.timelineStartDate:l):l=this.timelineStartDate,!t.isNullOrUndefined(g)&&g>=(this.parent.enableTimelineVirtualization?this.wholeTimelineWidth:this.totalTimelineWidth)-this.bottomTierCellWidth&&g>m?(y="prevTimeSpan"===y?"both":"nextTimeSpan",h=h<this.timelineEndDate?this.timelineEndDate:h):h=this.timelineEndDate,y?this.performTimeSpanAction(y,i,l,h):t.isNullOrUndefined(n[0].ganttProperties.segments)||this.parent.dataOperation.updateWidthLeft(n[0]),!t.isNullOrUndefined(l)&&!t.isNullOrUndefined(d)&&d<=l&&("CellEditing"===i||"DialogEditing"===i)&&this.parent.allowUnscheduledTasks?(l=new Date(Math.min(l.getTime(),d.getTime())),l=new Date(Math.min(l.getTime(),this.timelineStartDate.getTime())),this.performTimeSpanAction("prevTimeSpan",i,l,h)):t.isNullOrUndefined(d)&&d<=l&&("CellEditing"===i||"DialogEditing"===i)&&this.parent.allowUnscheduledTasks&&1===e[0].length&&!t.isNullOrUndefined(e[0][0].ganttProperties.endDate)&&t.isNullOrUndefined(n[0].ganttProperties.startDate)&&n[0].ganttProperties.endDate<=this.timelineStartDate&&(l=new Date(Math.min(e[0][0].ganttProperties.endDate.getTime(),l.getTime())),this.performTimeSpanAction("prevTimeSpan",i,l,h));break}},e.prototype.performTimeSpanAction=function(e,i,a,r,n){n=t.isNullOrUndefined(n)?"None"===this.parent.timelineModule.topTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier:n;var s=new Date(this.parent.cloneProjectStartDate.getTime()),o=new Date(this.parent.cloneProjectEndDate.getTime());"publicMethod"!==i&&"both"===e?(this.updateScheduleDatesByToolBar(n,"prevTimeSpan",a,r),this.updateScheduleDatesByToolBar(n,"nextTimeSpan",new Date(this.parent.cloneProjectStartDate.getTime()),r)):this.updateScheduleDatesByToolBar(n,e,a,r);var l=this.timeSpanActionEvent("actionBegin",e,i);if(l.cancel)this.parent.cloneProjectStartDate=s,this.parent.cloneProjectEndDate=o;else{this.restrictRender=!0,this.performedTimeSpanAction=!0;var d=this.parent.ganttChartModule.scrollElement.scrollLeft;if(this.parent.updateProjectDates(l.projectStartDate,l.ProjectEndDate,l.isTimelineRoundOff,i),"prevTimeSpan"===e&&"publicMethod"===i)this.parent.ganttChartModule.updateScrollLeft(0),this.parent.timelineModule.isZoomToFit=!1;else if("nextTimeSpan"===e&&"publicMethod"===i)this.parent.ganttChartModule.updateScrollLeft(this.parent.enableTimelineVirtualization?this.wholeTimelineWidth:this.totalTimelineWidth),this.parent.timelineModule.isZoomToFit=!1;else if("nextTimeSpan"===e&&"TaskbarEditing"===i){var h=document.getElementsByClassName("e-chart-scroll-container e-content")[0].scrollLeft;this.parent.element.querySelector(".e-timeline-header-container").scrollLeft=h,this.parent.timelineModule.isZoomToFit=!1}"TaskbarEditing"===i&&this.parent.enableTimelineVirtualization&&this.wholeTimelineWidth>3*this.parent.element.offsetWidth&&(this.parent.ganttChartModule.scrollObject.setScrollLeft(d),this.parent.ganttChartModule.scrollObject.updateContent()),this.parent.timelineModule.timeSpanActionEvent("actionComplete",e,i)}},e.prototype.timeSpanActionEvent=function(e,t,i){var a={};return a.projectStartDate=new Date(this.parent.cloneProjectStartDate.getTime()),a.ProjectEndDate=new Date(this.parent.cloneProjectEndDate.getTime()),a.requestType="publicMethod"===i?t:"beforeAdd"===i?"TimelineRefreshOnAdd":"TaskbarEditing"===i?"TimelineRefreshOnEdit":t,"actionBegin"===e&&(a.isTimelineRoundOff=this.parent.isTimelineRoundOff,a.cancel=!1),a.action="TimescaleUpdate",this.parent.trigger(e,a),a},e}(),ee=function(){function e(e){this.allowEditing=!0,this.allowReordering=!0,this.allowResizing=!0,this.allowSorting=!0,this.allowFiltering=!0,this.edit={},t.merge(this,e)}return e}(),te=function(){function i(e){var i=this;this.isPersist=!1,this.setCancelArgs=!1,this.previousScroll={top:0,left:0},this.queryCellInfo=function(e){i.parent.trigger("queryCellInfo",e)},this.headerCellInfo=function(e){i.parent.trigger("headerCellInfo",e)},this.rowDataBound=function(e){i.parent.trigger("rowDataBound",e)},this.columnMenuOpen=function(e){i.parent.notify("columnMenuOpen",e),i.parent.trigger("columnMenuOpen",e),document.querySelector(".e-colmenu").addEventListener("mousemove",function(){var e=document.querySelector(".e-filter-popup"),a=document.querySelector(".e-filter-item");t.isNullOrUndefined(e)||a.classList.contains("e-focused")||t.remove(i.parent.filterModule.filterMenuElement)})},this.columnMenuClick=function(e){i.parent.trigger("columnMenuClick",e)},this.objectEqualityChecker=function(e,t){if(e){for(var a=Object.keys(e),r=!0,n=["Children","childRecords","taskData","uniqueID","parentItem","parentUniqueID","ganttProperties"],s=0;s<a.length;s++)if((e[a[parseInt(s.toString(),10)]]instanceof Date?new Date(e[a[parseInt(s.toString(),10)]]).getTime():e[a[parseInt(s.toString(),10)]])!==(t[a[parseInt(s.toString(),10)]]instanceof Date?new Date(t[a[parseInt(s.toString(),10)]]).getTime():t[a[parseInt(s.toString(),10)]])&&-1===n.indexOf(a[s])){i.parent.modifiedRecords.push(t),r=!1;break}return r}return!1},this.parent=e,this.parent.treeGrid=new n.TreeGrid,this.parent.treeGrid.allowSelection=!1,this.parent.treeGrid.allowKeyboard=this.parent.allowKeyboard,this.parent.treeGrid["${enableHtmlSanitizer}"]=this.parent.enableHtmlSanitizer,this.parent.treeGrid.enableImmutableMode=this.parent.enableImmutableMode,this.treeGridColumns=[],!this.parent.isLocaleChanged&&this.parent.isLoad&&(this.parent.previousGanttColumns=t.extend([],[],this.parent.columns,!0)),this.validateGanttColumns(),this.parent.isLocaleChanged&&(this.parent.isLocaleChanged=!1),this.addEventListener()}return i.prototype.addEventListener=function(){this.parent.on("renderPanels",this.createContainer,this),this.parent.on("chartScroll",this.updateScrollTop,this),this.parent.on("destroy",this.destroy,this),this.parent.treeGrid.on("renderReactTemplate",this.renderReactTemplate,this)},i.prototype.renderReactTemplate=function(e){for(var t=0,i=e;t<i.length;t++){var a=i[t];-1===this.parent.portals.indexOf(a)&&this.parent.portals.push(a)}this.parent.renderTemplates()},i.prototype.createContainer=function(){this.treeGridElement=t.createElement("div",{id:"treeGrid"+this.parent.element.id,className:"e-gantt-tree-grid"});var e=t.createElement("div",{className:"e-gantt-temp-header"});this.parent.treeGridPane.appendChild(this.treeGridElement),this.treeGridElement.appendChild(e),this.parent.treeGridPane.classList.add("e-temp-content")},i.prototype.renderTreeGrid=function(){this.composeProperties(),this.bindEvents();this.parent.treeGrid.root=this.parent.root?this.parent.root:this.parent,t.setValue("registeredTemplate",this.registeredTemplate,this.parent.treeGrid);t.setValue("viewContainerRef",this.parent.viewContainerRef,this.parent.treeGrid),this.treeGridElement.contains(this.parent.treeGrid.element)||this.parent.treeGrid.appendTo(this.treeGridElement),this.parent.treeGrid.grid&&this.parent.toolbarModule&&this.parent.isReact&&(this.parent.treeGrid.grid.portals=this.parent.portals),this.wireEvents()},i.prototype.composeProperties=function(){if(this.parent.treeGrid.enableAdaptiveUI=this.parent.enableAdaptiveUI,this.parent.treeGrid.hasChildMapping=this.parent.taskFields.hasChildMapping,this.parent.treeGrid.query=this.parent.query,this.parent.treeGrid.locale=this.parent.locale,this.parent.treeGrid.loadChildOnDemand=this.parent.loadChildOnDemand,this.parent.treeGrid.isFromGantt=!0,this.parent.treeGrid.parentIdMapping=this.parent.taskFields.parentID,this.parent.taskFields.parentID&&(this.parent.treeGrid.idMapping=this.parent.taskFields.id),this.parent.treeGrid.showColumnMenu=this.parent.showColumnMenu,this.parent.treeGrid.enableCollapseAll=this.parent.collapseAllParentTasks,this.parent.treeGrid.columnMenuItems=this.parent.columnMenuItems,this.parent.treeGrid.enableRtl=this.parent.enableRtl,this.parent.treeGrid.childMapping=t.isNullOrUndefined(this.parent.taskFields.child)?"":this.parent.taskFields.child,this.parent.treeGrid.treeColumnIndex=this.parent.treeColumnIndex,this.parent.treeGrid.columns=this.treeGridColumns,this.parent.treeGrid.loadingIndicator=this.parent.loadingIndicator,this.parent.treeGrid.enableVirtualMaskRow=this.parent.enableVirtualMaskRow,this.parent.dataSource instanceof Object&&y(this.parent)){this.parent.treeGrid.hasChildMapping="isParent";var e=t.getValue("count",this.parent.dataSource);this.parent.treeGrid.dataSource={result:this.parent.flatData,count:e}}else this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?this.parent.treeGrid.dataSource=this.parent.dataSource:(this.parent.treeGrid.hasChildMapping=null,this.parent.treeGrid.dataSource=this.parent.flatData);this.parent.treeGrid.expandStateMapping=this.parent.taskFields.expandState;this.parent.treeGrid.isGantt=!0,this.parent.treeGrid.rowHeight=this.parent.rowHeight,this.parent.treeGrid.gridLines=this.parent.gridLines,0===this.parent.searchSettings.fields.length&&""===this.parent.searchSettings.key||(this.parent.treeGrid.searchSettings=this.parent.searchSettings);this.parent.treeGrid.isJsComponent=!0,this.parent.treeGrid.height=this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0].offsetHeight-(0===this.parent.flatData.length?0:19)},i.prototype.getContentDiv=function(){return this.treeGridElement.querySelector(".e-content")},i.prototype.getHeaderDiv=function(){return this.treeGridElement.querySelector(".e-headercontent")},i.prototype.getScrollbarWidth=function(){var e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",e.style.msOverflowStyle="scrollbar";var t=document.createElement("div");e.appendChild(t),this.parent.element.appendChild(e);var i=e.offsetWidth-t.offsetWidth;return e.parentNode.removeChild(e),i},i.prototype.ensureScrollBar=function(){var e=this.getContentDiv(),t=this.getHeaderDiv(),i=this.getScrollbarWidth(),a=/Android|Mac|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);0!==i||navigator.userAgent.includes("Firefox")?e.style.cssText+="width: calc(100% + "+(i+1)+"px);":e.classList.add("e-gantt-scroll-padding"),0===i&&a&&(t.style.cssText+="width: calc(100% + 17px);")},i.prototype.bindEvents=function(){this.parent.treeGrid.dataBound=this.dataBound.bind(this),this.parent.treeGrid.collapsing=this.collapsing.bind(this),this.parent.treeGrid.collapsed=this.collapsed.bind(this),this.parent.treeGrid.expanding=this.expanding.bind(this),this.parent.treeGrid.expanded=this.expanded.bind(this),this.parent.treeGrid.actionBegin=this.actionBegin.bind(this),this.parent.treeGrid.actionComplete=this.treeActionComplete.bind(this),this.parent.treeGrid.created=this.created.bind(this),this.parent.treeGrid.actionFailure=this.actionFailure.bind(this),this.parent.treeGrid.headerCellInfo=this.headerCellInfo.bind(this),this.parent.treeGrid.rowDataBound=this.rowDataBound.bind(this),this.parent.treeGrid.columnMenuOpen=this.columnMenuOpen.bind(this),this.parent.treeGrid.columnMenuClick=this.columnMenuClick.bind(this),this.parent.treeGrid.beforeDataBound=this.beforeDataBound.bind(this),this.parent.treeGrid.dataStateChange=this.dataStateChange.bind(this),null!=this.parent.queryCellInfo&&(this.parent.treeGrid.queryCellInfo=this.queryCellInfo.bind(this))},i.prototype.beforeDataBound=function(e){var i={result:e.result};this.parent.trigger("beforeDataBound",i),!t.isNullOrUndefined(this.parent.selectionModule)&&this.parent.selectionSettings&&this.parent.selectionSettings.persistSelection&&this.parent.selectionModule.getSelectedRowIndexes().length>0&&"sorting"===e.actionArgs.requestType&&(this.isPersist=!0),this.parent.updatedRecords=this.parent.virtualScrollModule&&this.parent.enableVirtualization?t.getValue("virtualScrollModule.visualData",this.parent.treeGrid):t.getValue("result",e);var a=e.actionArgs||null,r=!a||"sorting"!==a.requestType||"WBSCode"!==a.columnName,n=!a||"filtering"!==a.requestType;this.parent.enableWBS&&!this.parent.isVirtualScroll&&r&&n&&this.parent.generateWBSCodes(this.parent.updatedRecords),this.parent.virtualScrollModule&&this.parent.enableVirtualization&&this.parent.updateContentHeight(e),t.setValue("contentModule.objectEqualityChecker",this.objectEqualityChecker,this.parent.treeGrid.grid),this.parent.isExpandPerformed=!1},i.prototype.dataBound=function(e){this.parent.isReact&&this.parent.clearTemplate(["TaskbarTemplate","ParentTaskbarTemplate","MilestoneTemplate","TaskLabelTemplate","RightLabelTemplate","LeftLabelTemplate"]),this.ensureScrollBar(),this.parent.treeDataBound(e),this.parent.isVirtualScroll&&((this.parent.enableVirtualMaskRow&&this.parent.enableVirtualization||this.parent.enableVirtualization&&!this.parent.enableVirtualMaskRow&&"Shimmer"===this.parent.loadingIndicator.indicatorType||"Shimmer"===this.parent.loadingIndicator.indicatorType)&&this.parent.hideMaskRow(),this.parent.editModule&&this.parent.editModule.cellEditModule&&(this.parent.editModule.cellEditModule.isCellEdit=!1),this.parent.isVirtualScroll=!1,t.isNullOrUndefined(this.parent.selectionModule)||t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()),this.prevCurrentView=t.extend([],[],this.parent.currentViewData,!0)},i.prototype.dataStateChange=function(e){e.action&&"refresh"===e.action.requestType&&(this.parent.treeGrid.dataSource={result:t.getValue("result",this.parent.treeGrid.dataSource),count:t.getValue("count",this.parent.treeGrid.dataSource)}),this.parent.trigger("dataStateChange",e)},i.prototype.collapsing=function(e){var i,a=t.getValue("data",e),r=a.length;if(!this.parent.ganttChartModule.isExpandCollapseFromChart)if(t.isNullOrUndefined(r))i=this.createExpandCollapseArgs(e,null),this.parent.ganttChartModule.collapseGanttRow(i),t.setValue("cancel",t.getValue("cancel",i),e);else{for(var n=0;n<r;n++)i=this.createExpandCollapseArgs(e,a[n]),this.parent.ganttChartModule.collapseGanttRow(i);t.setValue("cancel",t.getValue("cancel",i),e)}},i.prototype.expanding=function(e){var i,a=t.getValue("data",e),r=a.length;if(!this.parent.ganttChartModule.isExpandCollapseFromChart)if(t.isNullOrUndefined(r))i=this.createExpandCollapseArgs(e,null),this.parent.ganttChartModule.expandGanttRow(i),t.setValue("cancel",t.getValue("cancel",i),e);else{for(var n=0;n<r;n++)i=this.createExpandCollapseArgs(e,a[n]),this.parent.ganttChartModule.expandGanttRow(i);t.setValue("cancel",t.getValue("cancel",i),e)}},i.prototype.collapsed=function(e){var i=e.data,a=i&&i.expanded;if(this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping&&!this.parent.enableVirtualization&&!a&&(e.data[this.parent.taskFields.expandState]=!1),!this.parent.ganttChartModule.isExpandCollapseFromChart&&!this.parent.isExpandCollapseLevelMethod){var r=void 0,n=t.getValue("data",e),s=n.length;if(t.isNullOrUndefined(s))r=this.createExpandCollapseArgs(e,null),this.parent.ganttChartModule.collapsedGanttRow(r);else for(var o=0;o<s;o++)r=this.createExpandCollapseArgs(e,n[o]),this.parent.ganttChartModule.collapsedGanttRow(r);this.parent.ganttChartModule.isCollapseAll||!r.gridRow||this.parent.allowTaskbarOverlap||(r.gridRow.style.height=r.chartRow.style.height,this.parent.contentHeight=this.parent.enableRtl?this.parent.element.getElementsByClassName("e-content")[2].children[0].offsetHeight:this.parent.element.getElementsByClassName("e-content")[0].children[0].offsetHeight,document.getElementsByClassName("e-chart-rows-container")[0].style.height=this.parent.contentHeight+"px")}this.parent.hideLoadingIndicator(),this.parent.trigger("collapsed",e)},i.prototype.expanded=function(e){if(!this.parent.ganttChartModule.isExpandCollapseFromChart&&!this.parent.isExpandCollapseLevelMethod){var i=void 0,a=t.getValue("data",e),r=a.length;if(t.isNullOrUndefined(r))i=this.createExpandCollapseArgs(e,null),this.parent.ganttChartModule.expandedGanttRow(i);else for(var n=0;n<r;n++)i=this.createExpandCollapseArgs(e,a[n]),this.parent.ganttChartModule.expandedGanttRow(i);this.parent.ganttChartModule.isExpandAll||!e.row||this.parent.allowTaskbarOverlap||(e.row.style.height=this.parent.rowHeight+"px",this.parent.contentHeight=this.parent.enableRtl?this.parent.element.getElementsByClassName("e-content")[2].children[0].offsetHeight:this.parent.element.getElementsByClassName("e-content")[0].children[0].offsetHeight,document.getElementsByClassName("e-chart-rows-container")[0].style.height=this.parent.contentHeight+"px")}this.parent.hideLoadingIndicator(),this.parent.isCollapseAll=!1,this.parent.trigger("expanded",e),this.parent.isExpandPerformed=!0},i.prototype.actionBegin=function(e){if(!this.parent.undoRedoModule||"filtering"!==e.requestType&&"searching"!==e.requestType&&"sorting"!==e.requestType&&"filterAfterOpen"!==e.requestType||(this.parent.undoRedoModule.canUpdateIndex=!1),"filterchoicerequest"===e.requestType){var i=t.getValue("filterModel.dlg",e);i&&(i.style.display="none")}e&&"save"===e.type&&e.rowData&&e.rowData.ganttProperties&&(this.perviousStartDate=e.rowData.ganttProperties.startDate,this.perviousEndDate=e.rowData.ganttProperties.endDate),this.parent.notify("actionBegin",e),null!==t.getValue("doubleClickTarget",this.parent.treeGrid.editModule)&&t.setValue("doubleClickTarget",null,this.parent.treeGrid.editModule),this.parent.trigger("actionBegin",e),this.parent.trigger("cellSave",e),"virtualscroll"===e.requestType||"edit"===e.type||"beginEdit"===e.requestType||e.cancel||this.parent.showLoadingIndicator()},i.prototype.created=function(e){this.updateKeyConfigSettings()},i.prototype.actionFailure=function(e){this.parent.trigger("actionFailure",e)},i.prototype.createExpandCollapseArgs=function(e,i){var a,r=t.getValue("data",e).length;if(t.isNullOrUndefined(r)){var n=t.getValue("data",e),s=t.getValue("row",e),o={data:n,gridRow:s,chartRow:a=this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(n)],cancel:!1};return o}return o={data:i,gridRow:s=t.getValue("row",e),chartRow:a=this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(i)],cancel:!1}},i.prototype.treeActionComplete=function(e){var i,a=this,r=null,n=!1,s=t.extend({},e);if("reorder"===t.getValue("requestType",e)&&this.parent.undoRedoModule&&!this.parent.undoRedoModule.isFromUndoRedo&&this.parent.isUndoRedoItemPresent("ColumnReorder")&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),(d={}).action="ColumnReorder",d.fromIndex=t.extend([],[],[e.fromIndex],!0)[0],d.toIndex=t.extend([],[],[e.toIndex],!0)[0],d.toColumn=t.extend([],[],[this.parent.treeGrid.columns[e.toIndex].field],!0)[0],d.fromColumn=t.extend([],[],[this.parent.treeGrid.columns[e.fromIndex].field],!0)[0],this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=d),"columnstate"===t.getValue("requestType",e)&&this.parent.undoRedoModule&&!this.parent.undoRedoModule.isFromUndoRedo&&this.parent.isUndoRedoItemPresent("ColumnState")&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),(d={action:"ColumnState"}).showhideColumns=t.extend([],[],e.columns,!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=d),"sorting"===t.getValue("requestType",e))this.parent.undoRedoModule&&this.parent.isUndoRedoItemPresent("Sorting")&&(this.parent.undoRedoModule.currentAction&&this.parent.undoRedoModule.currentAction.sortColumns&&this.parent.undoRedoModule.currentAction.sortColumns.length>1&&this.parent.undoRedoModule.sortedColumnsLength++,this.parent.undoRedoModule.currentAction&&(!this.parent.undoRedoModule.currentAction.sortColumns||this.parent.undoRedoModule.sortedColumnsLength===this.parent.undoRedoModule.currentAction.sortColumns.length)||this.parent.undoRedoModule.isFromUndoRedo||(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),(d={action:"Sorting"}).sortColumns=[],d.sortColumns=this.parent.undoRedoModule.previousSortedColumns,this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=d),this.parent.undoRedoModule.previousSortedColumns=this.parent.treeGrid.sortSettings.columns),this.parent.notify("updateModel",{}),t.deleteObject(s,"isFrozen");else if("filtering"===t.getValue("requestType",e))this.parent.undoRedoModule&&!this.parent.undoRedoModule.isFromUndoRedo&&this.parent.isUndoRedoItemPresent("Filtering")&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),(d={action:"Filtering"}).filteredColumns=t.extend([],[],e.columns,!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=d),this.parent.notify("updateModel",{});else if("save"===t.getValue("type",e)&&((r=t.isNullOrUndefined(e.column)?null:e.column.field)&&e.previousData===e.data[r]&&(n=!0),this.parent.editModule&&this.parent.editModule.cellEditModule)){var o=t.getValue("data",e);if(t.isNullOrUndefined(o)||t.isNullOrUndefined(this.parent.getTaskByUniqueID(o.uniqueID))||(this.parent.getTaskByUniqueID(o.uniqueID).taskData[this.parent.taskFields.duration]=o.taskData[this.parent.taskFields.duration],t.isNullOrUndefined(o.taskData[this.parent.taskFields.resourceInfo])||(this.parent.getTaskByUniqueID(o.uniqueID).taskData[this.parent.taskFields.resourceInfo]=o.taskData[this.parent.taskFields.resourceInfo])),v(this.currentEditRow)&&e.column&&e.column.edit&&e.column.field===this.parent.taskFields.resourceInfo){var l=this.parent.taskFields.resourceInfo;this.currentEditRow=(i={},i[l]=o.resources,i)}this.parent.editModule.cellEditModule.initiateCellEdit(e,this.currentEditRow),this.parent.editModule.cellEditModule.isCellEdit=!1,this.currentEditRow={}}if("filterAfterOpen"===t.getValue("requestType",e)&&this.parent.notify("actionComplete",e),"searching"===t.getValue("requestType",e)){if(this.parent.undoRedoModule&&this.parent.isUndoRedoItemPresent("Search")){if(!this.parent.undoRedoModule.isFromUndoRedo){this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection();var d={action:"Search"};d.searchString=this.parent.undoRedoModule.searchString,this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=d}this.parent.undoRedoModule.searchString=this.parent.treeGrid.searchSettings.key}this.parent.notify("actionComplete",e)}if(t.isNullOrUndefined(this.parent.toolbarModule)||t.isNullOrUndefined(t.getValue("batchChanges",e))||this.parent.toolbarModule.refreshToolbarItems(),this.parent.isCancelled&&(t.setValue("requestType","cancel",s),t.setValue("action","CellEditing",s),this.parent.isCancelled=!1),"refresh"===t.getValue("requestType",e)&&t.isNullOrUndefined(t.getValue("type",e))&&this.parent.addDeleteRecord){if(-1!==this.parent.selectedRowIndex)if(this.parent.editModule.isAdded&&!t.isNullOrUndefined(this.parent.selectionModule)&&this.parent.selectionSettings&&this.parent.selectionSettings.persistSelection){var h=this.parent.selectionModule.selectedRowIndexes;if(h.length>1&&this.parent.selectionSettings.persistSelection)for(g=0;g<h.length;g++){var p=this.parent.flatData[h[g].toString()];this.parent.selectRows(p)}}else this.parent.selectRow(this.parent.selectedRowIndex),this.parent.selectedRowIndex>this.parent.currentViewData.length-1&&(this.parent.selectedRowIndex=-1);else{if(!t.isNullOrUndefined(this.parent.selectionModule)&&this.parent.selectionSettings&&this.parent.selectionSettings.persistSelection&&this.parent.editModule&&!this.parent.editModule.isAdded)for(var u=this.parent.selectionModule.getSelectedRecords(),c=this,g=u.length-1;g>=0;g--)!function(e){var t=u[e][c.parent.taskFields.id];c.parent.editModule.deletedRecord.some(function(e){return e.ganttProperties.taskId===t})&&u.splice(e,1)}(g);var f=0;(this.parent.enableVirtualization?this.parent.flatData:this.parent.currentViewData).map(function(e,i){t.isNullOrUndefined(a.parent.currentSelection)||e.ganttProperties.taskId!==a.parent.currentSelection[a.parent.taskFields.id]||("ResourceView"!==a.parent.viewType||e.ganttProperties.rowUniqueID!==a.parent.currentSelection.rowUniqueID)&&"ResourceView"===a.parent.viewType||(f=i)}),this.addedRecord=!0,this.parent.selectRow(t.isNullOrUndefined(f)?0:f)}this.parent.isExpandPerformed||(this.parent.addDeleteRecord=!1),this.parent.isExpandPerformed=!1}if(this.parent.undoRedoModule&&(this.parent.undoRedoModule.isFromUndoRedo=!1),"refresh"===t.getValue("requestType",e)&&this.parent.initiateEditAction(!1),n||this.setCancelArgs||this.parent.trigger("actionComplete",s),this.parent.showOverAllocation&&!this.parent.allowTaskbarOverlap){for(g=0;g<this.parent.currentViewData.length;g++)this.parent.currentViewData[g].hasChildRecords&&!this.parent.currentViewData[g].expanded&&this.parent.chartRowsModule.updateDragDropRecords(this.parent.currentViewData[g]);this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData)}"save"!==e.type&&this.parent.hideLoadingIndicator()},i.prototype.updateKeyConfigSettings=function(){delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.delete,delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.insert,delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.upArrow,delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.downArrow,delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.ctrlHome,delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.ctrlEnd,delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.enter,delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.tab,delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.shiftTab,delete this.parent.treeGrid.keyboardModule.keyConfigs.enter,delete this.parent.treeGrid.keyboardModule.keyConfigs.upArrow,delete this.parent.treeGrid.keyboardModule.keyConfigs.downArrow,delete this.parent.treeGrid.keyboardModule.keyConfigs.ctrlShiftUpArrow,delete this.parent.treeGrid.keyboardModule.keyConfigs.ctrlShiftDownArrow,delete this.parent.treeGrid.keyboardModule.keyConfigs.ctrlUpArrow,delete this.parent.treeGrid.keyboardModule.keyConfigs.ctrlDownArrow,delete this.parent.treeGrid.keyboardModule.keyConfigs.tab,delete this.parent.treeGrid.keyboardModule.keyConfigs.shiftTab},i.prototype.wireEvents=function(){var e=this.parent.treeGrid.element.querySelector(".e-content");e&&t.EventHandler.add(e,"scroll",this.scrollHandler,this),this.parent.isAdaptive&&t.EventHandler.add(this.parent.treeGridPane,"click",this.treeGridClickHandler,this)},i.prototype.unWireEvents=function(){var e=this.parent.treeGrid.element&&this.parent.treeGrid.element.querySelector(".e-content");e&&t.EventHandler.remove(e,"scroll",this.scrollHandler),this.parent.isAdaptive&&t.EventHandler.remove(this.parent.treeGridPane,"click",this.treeGridClickHandler)},i.prototype.scrollHandler=function(e){var t=this.parent.treeGrid.element.querySelector(".e-content");t.scrollTop!==this.previousScroll.top&&this.parent.notify("grid-scroll",{top:t.scrollTop}),this.previousScroll.top=t.scrollTop,this.parent.contextMenuModule&&this.parent.contextMenuModule.isOpen&&this.parent.contextMenuModule.contextMenu.close()},i.prototype.validateGanttColumns=function(){var e=this.parent,i=e.columns.length,a=this.parent.taskFields;this.parent.columnMapping={},this.parent.columnByField={},this.parent.customColumns=[];for(var r=["id","name","startDate","endDate","duration","dependency","progress","baselineStartDate","baselineEndDate","baselineDuration","resourceInfo","notes","work","manual","type","milestone","segments","constraintType","constraintDate"],n=this,s=0;s<i;s++)!function(i){var s={};"string"==typeof e.columns[i]?s.field=e.columns[i]:s=e.columns[i];var o=[];if(r.length>0&&(o=r.filter(function(e){return s.field===a[e]})),0===o.length)return s.field===n.parent.resourceFields.group?"continue":("WBSCode"!==s.field&&"WBSPredecessor"!==s.field&&n.parent.customColumns.push(s.field),s.headerText=s.headerText?s.headerText:s.field,s.width=s.width?s.width:150,"WBSCode"===s.field?s.allowEditing=!1:s.allowEditing=!!t.isNullOrUndefined(s.allowEditing)||s.allowEditing,"WBSCode"!==s.field&&"WBSPredecessor"!==s.field||(s.clipMode="EllipsisWithTooltip"),s.editType=s.editType?s.editType:"stringedit",s.type=s.type?s.type:"string","checkbox"===s.type&&(n.parent.selectionSettings.type="Multiple"),n.bindTreeGridColumnProperties(s,!0),"continue");var l=r.indexOf(o[0]);r.splice(l,1),n.createTreeGridColumn(s,!0),n.parent.columnMapping[o[0]]=s.field}(s);for(var o=0;o<r.length;o++){l={};t.isNullOrUndefined(a[r[o]])||(l.field=a[r[o]],this.createTreeGridColumn(l,0===i),this.parent.columnMapping[r[o]]=l.field)}if("ProjectView"!==this.parent.viewType){var l={};this.composeUniqueIDColumn(l),this.createTreeGridColumn(l,!0)}},i.prototype.getLocalizedConstraintTypeText=function(e){return this.parent.localeObj.getConstant("constraintType"+e)},i.prototype.createTreeGridColumn=function(i,r){var n=this,o=this.parent.taskFields,l=this.parent.previousGanttColumns.filter(function(e){return i.field===e.field})[0];if(i.disableHtmlEncode=t.isNullOrUndefined(i.disableHtmlEncode)?this.parent.disableHtmlEncode:i.disableHtmlEncode,o.id!==i.field&&(i.clipMode=i.clipMode?i.clipMode:"EllipsisWithTooltip"),o.id===i.field)this.composeIDColumn(i);else if(o.name===i.field)this.parent.isLocaleChanged&&l?i.headerText=l.headerText?l.headerText:this.parent.localeObj.getConstant("name"):i.headerText=i.headerText?i.headerText:this.parent.localeObj.getConstant("name"),i.width=i.width?i.width:150,i.editType=i.editType?i.editType:"stringedit",i.type=i.type?i.type:"string";else if(o.startDate===i.field)this.parent.isLocaleChanged&&l?i.headerText=l.headerText?l.headerText:this.parent.localeObj.getConstant("startDate"):i.headerText=i.headerText?i.headerText:this.parent.localeObj.getConstant("startDate"),i.editType=i.editType?i.editType:-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit",i.format=i.format?i.format:{type:"date",format:this.parent.getDateFormat()},i.width=i.width?i.width:150,i.edit&&i.edit.params?i.edit.params.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent):i.edit?i.edit.params={renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}:i.edit={params:{renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}};else if(o.baselineStartDate===i.field||o.baselineEndDate===i.field){var d=o.baselineEndDate===i.field?"baselineEndDate":"baselineStartDate";i.width=i.width?i.width:150,this.parent.isLocaleChanged&&l?i.headerText=l.headerText?l.headerText:this.parent.localeObj.getConstant(d):i.headerText=i.headerText?i.headerText:this.parent.localeObj.getConstant(d),i.format=i.format?i.format:{type:"date",format:this.parent.getDateFormat()},i.editType=i.editType?i.editType:-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit"}else if(o.endDate===i.field)this.parent.isLocaleChanged&&l?i.headerText=l.headerText?l.headerText:this.parent.localeObj.getConstant("endDate"):i.headerText=i.headerText?i.headerText:this.parent.localeObj.getConstant("endDate"),i.format=i.format?i.format:{type:"date",format:this.parent.getDateFormat()},i.editType=i.editType?i.editType:-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit",i.width=i.width?i.width:150,i.edit&&i.edit.params?i.edit.params.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent):i.edit?i.edit.params={renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}:i.edit={params:{renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}};else if(o.constraintDate===i.field)this.parent.isLocaleChanged&&l?i.headerText=l.headerText?l.headerText:this.parent.localeObj.getConstant("constraintDate"):i.headerText=i.headerText?i.headerText:this.parent.localeObj.getConstant("constraintDate"),i.format=i.format?i.format:{type:"date",format:this.parent.getDateFormat()},i.editType=i.editType?i.editType:-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit",i.width=i.width?i.width:150,i.edit&&i.edit.params?i.edit.params.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent):i.edit?i.edit.params={renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}:i.edit={params:{renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}};else if(o.duration===i.field)i.width=i.width?i.width:150,this.parent.isLocaleChanged&&l?i.headerText=l.headerText?l.headerText:this.parent.localeObj.getConstant("duration"):i.headerText=i.headerText?i.headerText:this.parent.localeObj.getConstant("duration"),i.valueAccessor=i.valueAccessor?i.valueAccessor:t.isNullOrUndefined(i.edit)||t.isNullOrUndefined(i.edit.read)?this.durationValueAccessor.bind(this):null,i.editType=i.editType?i.editType:"stringedit",i.type=i.type?i.type:"string";else if(o.progress===i.field)this.composeProgressColumn(i);else if(o.dependency===i.field)this.parent.isLocaleChanged&&l?i.headerText=l.headerText?l.headerText:this.parent.localeObj.getConstant("dependency"):i.headerText=i.headerText?i.headerText:this.parent.localeObj.getConstant("dependency"),i.width=i.width?i.width:150,i.editType=i.editType?i.editType:"stringedit",i.type="string",i.allowFiltering=!1!==i.allowFiltering,i.valueAccessor=i.valueAccessor?i.valueAccessor:this.dependencyValueAccessor.bind(this),t.isNullOrUndefined(i.filter)&&"en-US"!==this.parent.locale&&(i.filter={ui:{create:function(e){var i=t.createElement("input",{className:"flm-input"});e.target.appendChild(i),n.dropInstance=new s.AutoComplete({dataSource:n.changeLocale(n.parent.treeGrid.grid.dataSource),fields:{text:n.parent.taskFields.dependency,value:n.parent.taskFields.dependency},placeholder:n.parent.localeObj.getConstant("enterValue"),popupHeight:"200px"}),n.dropInstance.appendTo(i)},write:function(e){n.dropInstance.value=e.filteredValue},read:function(e){e.fltrObj.filterByColumn(e.column.field,e.operator,n.changeDelocale(n.dropInstance.value))}}});else if(o.resourceInfo===i.field)this.composeResourceColumn(i);else if(o.notes===i.field){if(l&&this.parent.isLocaleChanged?i.headerText=l.headerText?l.headerText:this.parent.localeObj.getConstant("notes"):i.headerText=i.headerText?i.headerText:this.parent.localeObj.getConstant("notes"),i.width=i.width?i.width:150,i.editType=i.editType?i.editType:"stringedit",!this.parent.showInlineNotes&&!i.template){var h=function(){return'<div class="e-ganttnotes-info">\n <span class="e-icons e-notes-info"></span>\n </div>'};i.template=t.initializeCSPTemplate(h)}}else if(o.baselineDuration===i.field)i.width=i.width?i.width:150,this.parent.isLocaleChanged&&l?i.headerText=l.headerText?l.headerText:this.parent.localeObj.getConstant("baselineDuration"):i.headerText=i.headerText?i.headerText:this.parent.localeObj.getConstant("baselineDuration"),i.valueAccessor=i.valueAccessor?i.valueAccessor:t.isNullOrUndefined(i.edit)||t.isNullOrUndefined(i.edit.read)?this.baselineDurationValueAccessor.bind(this):null,i.editType=i.editType?i.editType:"stringedit",i.type=i.type?i.type:"string";else if(o.work===i.field)l&&this.parent.isLocaleChanged?i.headerText=l.headerText?l.headerText:this.parent.localeObj.getConstant("work"):i.headerText=i.headerText?i.headerText:this.parent.localeObj.getConstant("work"),i.width=i.width?i.width:150,i.valueAccessor=i.valueAccessor?i.valueAccessor:this.workValueAccessor.bind(this),i.editType=i.editType?i.editType:"numericedit";else if(o.type===i.field)l&&this.parent.isLocaleChanged?i.headerText=l.headerText?l.headerText:this.parent.localeObj.getConstant("taskType"):i.headerText=i.headerText?i.headerText:this.parent.localeObj.getConstant("taskType"),i.width=i.width?i.width:150,i.editType="dropdownedit",i.valueAccessor=i.valueAccessor?i.valueAccessor:this.taskTypeValueAccessor.bind(this);else if(o.manual===i.field&&"Custom"===this.parent.taskMode)l&&this.parent.isLocaleChanged?i.headerText=l.headerText?l.headerText:this.parent.localeObj.getConstant("taskMode"):i.headerText=i.headerText?i.headerText:this.parent.localeObj.getConstant("taskMode"),i.width=i.width?i.width:120,i.editType=i.editType?i.editType:"dropdownedit",i.valueAccessor=i.valueAccessor?i.valueAccessor:this.modeValueAccessor.bind(this),i.edit={params:{query:new a.Query,dataSource:[{id:1,text:this.parent.localeObj.getConstant("manual"),value:!0},{id:2,text:this.parent.localeObj.getConstant("auto"),value:!1}],fields:{text:"text",value:"value"}}};else if(o.constraintType===i.field){l&&this.parent.isLocaleChanged?i.headerText=l.headerText?l.headerText:this.parent.localeObj.getConstant("constraintType"):i.headerText=i.headerText?i.headerText:this.parent.localeObj.getConstant("constraintType"),i.width=i.width?i.width:160,i.editType=i.editType?i.editType:"dropdownedit";var p=Object.keys(e.ConstraintType).filter(function(t){return!isNaN(Number(e.ConstraintType[t]))}).map(function(t){return{text:n.getLocalizedConstraintTypeText(t),value:e.ConstraintType[t]}});i.valueAccessor=i.valueAccessor?i.valueAccessor:this.constraintTypeValueAccessor.bind(this),i.edit={params:{dataSource:p,fields:{text:"text",value:"value"},query:new a.Query}}}this.bindTreeGridColumnProperties(i,r)},i.prototype.changeLocale=function(e){var i=this,a=[];return e.map(function(e){return e.ganttProperties.predecessorsName}).map(function(e){if(!t.isNullOrUndefined(e)){var r="",n=e.split(",");n.map(function(e,t){e.includes("FS")?(r+=e.replace("FS",i.parent.localeObj.getConstant("FS")),r+=n.length!==t+1?",":""):e.includes("FF")?(r+=e.replace("FF",i.parent.localeObj.getConstant("FF")),r+=n.length!==t+1?",":""):e.includes("SS")?(r+=e.replace("SS",i.parent.localeObj.getConstant("SS")),r+=n.length!==t+1?",":""):e.includes("SF")&&(r+=e.replace("SF",i.parent.localeObj.getConstant("SF")),r+=n.length!==t+1?",":"")}),a.push(r)}}),a},i.prototype.changeDelocale=function(e){var i=this.parent.localeObj.getConstant("FF"),a=this.parent.localeObj.getConstant("FS"),r=this.parent.localeObj.getConstant("SS"),n=this.parent.localeObj.getConstant("SF");if(!t.isNullOrUndefined(e)){var s=e.split(","),o="";return s.map(function(e,t){e.includes(i)?(o+=e.replace(i,"FF"),o+=s.length!==t+1?",":""):e.includes(a)?(o+=e.replace(a,"FS"),o+=s.length!==t+1?",":""):e.includes(r)?(o+=e.replace(r,"SS"),o+=s.length!==t+1?",":""):e.includes(n)?(o+=e.replace(n,"SF"),o+=s.length!==t+1?",":""):(o+=e,o+=s.length!==t+1?",":"")}),o}return null},i.prototype.composeResourceColumn=function(e){var t=this.parent.previousGanttColumns.filter(function(t){return e.field===t.field})[0];t&&this.parent.isLocaleChanged?e.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("resourceName"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("resourceName"),e.width=e.width?e.width:150,e.type="string",e.valueAccessor=e.valueAccessor?e.valueAccessor:this.resourceValueAccessor.bind(this),e.allowFiltering=!1!==e.allowFiltering},i.prototype.getResourceIds=function(e){var i=t.getValue(this.parent.taskFields.resourceInfo,e.taskData),a=[];if(t.isNullOrUndefined(i))return i;for(var r=0;r<i.length;r++)a.push("object"==typeof i[r]?i[r][this.parent.resourceFields.id]:i[r]);return a},i.prototype.composeIDColumn=function(e){var i,a="ProjectView"===this.parent.viewType,r=this.parent.dataSource?this.parent.dataSource.length:0;if(e.isPrimaryKey=!!a,this.parent.isLocaleChanged){var n=this.parent.previousGanttColumns.filter(function(t){return e.field===t.field})[0];n&&(e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("id"))}else e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("id");e.width=e.width?e.width:100;for(var s=0;s<r;s++)if(!t.isNullOrUndefined(this.parent.dataSource[s][this.parent.taskFields.id])){i=this.parent.dataSource[s][this.parent.taskFields.id];break}"string"==typeof i||t.isNullOrUndefined(i)?("ResourceView"===this.parent.viewType?e.allowEditing=!!e.allowEditing&&e.allowEditing:e.allowEditing=!e.allowEditing||e.allowEditing,e.editType=e.editType?e.editType:"stringedit"):(e.allowEditing=!!e.allowEditing&&e.allowEditing,e.editType=e.editType?e.editType:"numericedit"),e.valueAccessor=a?null:this.idValueAccessor.bind(this)},i.prototype.composeUniqueIDColumn=function(e){e.field="rowUniqueID",e.isPrimaryKey=!0,e.headerText="UniqueID",e.allowEditing=!1,e.visible=!1},i.prototype.composeProgressColumn=function(e){var t=this.parent.previousGanttColumns.filter(function(t){return e.field===t.field})[0];this.parent.isLocaleChanged&&t?e.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("progress"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("progress"),e.width=e.width?e.width:150,e.editType=e.editType?e.editType:"numericedit"},i.prototype.bindTreeGridColumnProperties=function(e,t){for(var i={},a={},r=0,n=Object.keys(e);r<n.length;r++){var s=n[r];i[s]=a[s]=e[s]}a.field===this.parent.taskFields.constraintDate&&("type"in a||("datepickeredit"===a.editType?a.type="date":"datetimepickeredit"===a.editType&&(a.type="datetime"),i.type=a.type)),this.parent.columnByField[a.field]=a,this.parent.ganttColumns.push(new ee(a)),t&&this.treeGridColumns.push(i)},i.prototype.durationValueAccessor=function(e,i,a){if(!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(i.ganttProperties)){var r=i.ganttProperties;return this.parent.dataOperation.getDurationString(r.duration,r.durationUnit)}return this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?this.parent.dataOperation.getDurationString(parseInt(i[this.parent.taskFields.duration],10),this.parent.durationUnit):""},i.prototype.dependencyValueAccessor=function(e,i,a){var r=this;if(i&&i.ganttProperties&&!t.isNullOrUndefined(i.ganttProperties.predecessorsName)){var n="",s=i.ganttProperties.predecessorsName.split(",");return s.map(function(e,t){e.includes("FS")?(n+=e.replace("FS",r.parent.localeObj.getConstant("FS")),n+=s.length!==t+1?",":""):e.includes("FF")?(n+=e.replace("FF",r.parent.localeObj.getConstant("FF")),n+=s.length!==t+1?",":""):e.includes("SS")?(n+=e.replace("SS",r.parent.localeObj.getConstant("SS")),n+=s.length!==t+1?",":""):e.includes("SF")&&(n+=e.replace("SF",r.parent.localeObj.getConstant("SF")),n+=s.length!==t+1?",":"")}),n}return""},i.prototype.resourceValueAccessor=function(e,i,a){var r=i.ganttProperties;return t.isNullOrUndefined(r)?"":r.resourceNames},i.prototype.workValueAccessor=function(e,i,a){var r=i.ganttProperties;return t.isNullOrUndefined(r)?"":this.parent.dataOperation.getWorkString(r.work,r.workUnit)},i.prototype.taskTypeValueAccessor=function(e,i,a){var r=i.ganttProperties;return t.isNullOrUndefined(r)?"":r.taskType},i.prototype.modeValueAccessor=function(e,t,i){return t[e]?"Manual":"Auto"},i.prototype.constraintTypeValueAccessor=function(t,i,a){var r=Object.keys(e.ConstraintType).find(function(a){return e.ConstraintType[a]===i[t]});return this.getLocalizedConstraintTypeText(r)},i.prototype.baselineDurationValueAccessor=function(e,i,a){if(!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(i.ganttProperties)){var r=i.ganttProperties;return this.parent.dataOperation.getDurationString(r.baselineDuration,r.durationUnit)}return this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?this.parent.dataOperation.getDurationString(parseInt(i[this.parent.taskFields.baselineDuration],10),this.parent.durationUnit):""},i.prototype.idValueAccessor=function(e,t,i){return 0===t.level?"R-"+t.ganttProperties.taskId:"T-"+t.ganttProperties.taskId},i.prototype.updateScrollTop=function(e){var i=t.getValue("top",e);this.treeGridElement.querySelector(".e-content").scrollTop=i,this.previousScroll.top=this.treeGridElement.querySelector(".e-content").scrollTop},i.prototype.treeGridClickHandler=function(e){this.parent.notify("treeGridClick",e)},i.prototype.removeEventListener=function(){this.parent.off("renderPanels",this.createContainer),this.parent.off("chartScroll",this.updateScrollTop),this.parent.off("destroy",this.destroy),this.parent.treeGrid.off("reactTemplateRender",this.renderReactTemplate)},i.prototype.destroy=function(){this.removeEventListener(),this.unWireEvents(),this.parent.treeGrid.element&&this.parent.treeGrid.destroy()},i}(),ie=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),ae=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},re=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ie(i,e),ae([t.Property(null)],i.prototype,"from",void 0),ae([t.Property(null)],i.prototype,"to",void 0),i}(t.ChildProperty),ne=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),se=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},oe=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ne(i,e),se([t.Property(null)],i.prototype,"type",void 0),se([t.Property(null)],i.prototype,"headerText",void 0),se([t.Property([])],i.prototype,"fields",void 0),se([t.Property({})],i.prototype,"additionalParams",void 0),i}(t.ChildProperty),le=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),de=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},he=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return le(i,e),de([t.Property(null)],i.prototype,"type",void 0),de([t.Property(null)],i.prototype,"headerText",void 0),de([t.Property([])],i.prototype,"fields",void 0),de([t.Property({})],i.prototype,"additionalParams",void 0),i}(t.ChildProperty),pe=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),ue=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},ce=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return pe(i,e),ue([t.Property(!1)],i.prototype,"allowEditing",void 0),ue([t.Property(!1)],i.prototype,"allowAdding",void 0),ue([t.Property(!1)],i.prototype,"allowDeleting",void 0),ue([t.Property("Auto")],i.prototype,"mode",void 0),ue([t.Property("Top")],i.prototype,"newRowPosition",void 0),ue([t.Property(!1)],i.prototype,"showDeleteConfirmDialog",void 0),ue([t.Property(!1)],i.prototype,"allowTaskbarEditing",void 0),ue([t.Property(!1)],i.prototype,"allowNextRowEdit",void 0),i}(t.ChildProperty),ge=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),fe=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},me=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ge(i,e),fe([t.Property(null)],i.prototype,"day",void 0),fe([t.Property(null)],i.prototype,"label",void 0),fe([t.Property(null)],i.prototype,"cssClass",void 0),i}(t.ChildProperty),ye=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),De=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},ve=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ye(i,e),De([t.Collection([],r.Predicate)],i.prototype,"columns",void 0),De([t.Property("Menu")],i.prototype,"type",void 0),De([t.Property()],i.prototype,"operators",void 0),De([t.Property(!1)],i.prototype,"ignoreAccent",void 0),De([t.Property("Parent")],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),ke=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),be=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},we=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ke(i,e),be([t.Property([])],i.prototype,"fields",void 0),be([t.Property(!1)],i.prototype,"ignoreCase",void 0),be([t.Property("contains")],i.prototype,"operator",void 0),be([t.Property("")],i.prototype,"key",void 0),be([t.Property("Parent")],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),Te=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),Se=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Pe=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Te(i,e),Se([t.Property(null)],i.prototype,"from",void 0),Se([t.Property(null)],i.prototype,"to",void 0),Se([t.Property(null)],i.prototype,"label",void 0),Se([t.Property(null)],i.prototype,"cssClass",void 0),i}(t.ChildProperty),Ce=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),Re=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Me=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ce(i,e),Re([t.Property(null)],i.prototype,"rightLabel",void 0),Re([t.Property(null)],i.prototype,"leftLabel",void 0),Re([t.Property(null)],i.prototype,"taskLabel",void 0),i}(t.ChildProperty),xe=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),Oe=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Ie=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return xe(i,e),Oe([t.Property("Row")],i.prototype,"mode",void 0),Oe([t.Property("Flow")],i.prototype,"cellSelectionMode",void 0),Oe([t.Property("Single")],i.prototype,"type",void 0),Oe([t.Property(!1)],i.prototype,"persistSelection",void 0),Oe([t.Property(!1)],i.prototype,"enableToggle",void 0),i}(t.ChildProperty),Ee=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),Fe=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Ue=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ee(i,e),Fe([t.Property(null)],i.prototype,"position",void 0),Fe([t.Property(-1)],i.prototype,"columnIndex",void 0),Fe([t.Property(4)],i.prototype,"separatorSize",void 0),Fe([t.Property(null)],i.prototype,"minimum",void 0),Fe([t.Property("Default")],i.prototype,"view",void 0),i}(t.ChildProperty),Ne=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),Le=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Ve=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ne(i,e),Le([t.Property(null)],i.prototype,"id",void 0),Le([t.Property(null)],i.prototype,"name",void 0),Le([t.Property(null)],i.prototype,"parentID",void 0),Le([t.Property(null)],i.prototype,"hasChildMapping",void 0),Le([t.Property(null)],i.prototype,"startDate",void 0),Le([t.Property(null)],i.prototype,"endDate",void 0),Le([t.Property(null)],i.prototype,"dependency",void 0),Le([t.Property(null)],i.prototype,"progress",void 0),Le([t.Property(null)],i.prototype,"child",void 0),Le([t.Property(null)],i.prototype,"milestone",void 0),Le([t.Property(null)],i.prototype,"duration",void 0),Le([t.Property(null)],i.prototype,"durationUnit",void 0),Le([t.Property(null)],i.prototype,"cssClass",void 0),Le([t.Property(null)],i.prototype,"baselineStartDate",void 0),Le([t.Property(null)],i.prototype,"baselineEndDate",void 0),Le([t.Property(null)],i.prototype,"baselineDuration",void 0),Le([t.Property(null)],i.prototype,"resourceInfo",void 0),Le([t.Property(null)],i.prototype,"expandState",void 0),Le([t.Property(null)],i.prototype,"indicators",void 0),Le([t.Property(null)],i.prototype,"notes",void 0),Le([t.Property(null)],i.prototype,"work",void 0),Le([t.Property(null)],i.prototype,"manual",void 0),Le([t.Property(null)],i.prototype,"type",void 0),Le([t.Property(null)],i.prototype,"segments",void 0),Le([t.Property(null)],i.prototype,"segmentId",void 0),Le([t.Property(null)],i.prototype,"constraintType",void 0),Le([t.Property(null)],i.prototype,"constraintDate",void 0),i}(t.ChildProperty),Be=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),Ae=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},We=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Be(i,e),Ae([t.Property("")],i.prototype,"format",void 0),Ae([t.Property("None")],i.prototype,"unit",void 0),Ae([t.Property(1)],i.prototype,"count",void 0),Ae([t.Property(null)],i.prototype,"formatter",void 0),i}(t.ChildProperty),He=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Be(i,e),Ae([t.Property("Week")],i.prototype,"timelineViewMode",void 0),Ae([t.Complex({},We)],i.prototype,"topTier",void 0),Ae([t.Complex({},We)],i.prototype,"bottomTier",void 0),Ae([t.Property(33)],i.prototype,"timelineUnitSize",void 0),Ae([t.Property(0)],i.prototype,"weekStartDay",void 0),Ae([t.Property(null)],i.prototype,"weekendBackground",void 0),Ae([t.Property(!0)],i.prototype,"showTooltip",void 0),Ae([t.Property(!0)],i.prototype,"updateTimescaleView",void 0),Ae([t.Property(!0)],i.prototype,"showWeekend",void 0),i}(t.ChildProperty),je=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),ze=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Ge=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return je(i,e),ze([t.Property(!0)],i.prototype,"showTooltip",void 0),ze([t.Property()],i.prototype,"taskbar",void 0),ze([t.Property()],i.prototype,"baseline",void 0),ze([t.Property()],i.prototype,"connectorLine",void 0),ze([t.Property()],i.prototype,"editing",void 0),ze([t.Property()],i.prototype,"timeline",void 0),i}(t.ChildProperty),qe=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),_e=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Ze=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return qe(i,e),_e([t.Property()],i.prototype,"field",void 0),_e([t.Property()],i.prototype,"direction",void 0),i}(t.ChildProperty),Xe=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return qe(i,e),_e([t.Collection([],Ze)],i.prototype,"columns",void 0),_e([t.Property(!0)],i.prototype,"allowUnsort",void 0),i}(t.ChildProperty),Ye=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),Ke=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Qe=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ye(i,e),Ke([t.Property(null)],i.prototype,"id",void 0),Ke([t.Property(null)],i.prototype,"name",void 0),Ke([t.Property(null)],i.prototype,"unit",void 0),Ke([t.Property(null)],i.prototype,"group",void 0),i}(t.ChildProperty),$e=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),Je=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},et=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return $e(i,e),Je([t.Property("Spinner")],i.prototype,"indicatorType",void 0),i}(t.ChildProperty),tt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),it=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},at=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return tt(i,e),it([t.Property()],i.prototype,"dayOfWeek",void 0),it([t.Collection([],re)],i.prototype,"timeRange",void 0),i}(t.ChildProperty),rt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),nt=function(e){function i(t){var i=e.call(this,t)||this;return i.taskBarHeight=0,i.milestoneHeight=0,i.milesStoneRadius=0,i.baselineTop=0,i.baselineHeight=8,i.touchLeftConnectorpoint="",i.touchRightConnectorpoint="",i.dropSplit=!1,i.refreshedTr=[],i.refreshedData=[],i.isUpdated=!0,i.tagRegex=/<\/?(\w+)([^>]*?)(\/?)>/g,i.attributeRegex=/([\w-]+)\s*=\s*"([^"]*)"/g,i.taskBaselineTemplateNode=null,i.handleTouchMove=function(e){i.parent.ganttChartModule.ganttChartMove(e)},i.handleTouchEnd=function(e){i.parent.ganttChartModule.documentMouseUp(e)},i.parent=t,i.initPublicProp(),i.addEventListener(),i}return rt(i,e),i.prototype.initPublicProp=function(){this.ganttChartTableBody=null},i.prototype.addEventListener=function(){this.parent.on("renderPanels",this.createChartTable,this),this.parent.on("dataReady",this.initiateTemplates,this),this.parent.on("destroy",this.destroy,this)},i.prototype.refreshChartByTimeline=function(){this.taskTable.style.width=t.formatUnit(this.parent.enableTimelineVirtualization?this.parent.timelineModule.wholeTimelineWidth:this.parent.timelineModule.totalTimelineWidth);var e=t.getValue("prevProjectStartDate",this.parent.dataOperation),i=!1;e&&(i=e.getTime()===this.parent.cloneProjectStartDate.getTime()),this.isUpdated=!!(this.parent.isFromOnPropertyChange&&i&&t.getValue("mutableData",this.parent.treeGrid.grid.contentModule)),this.refreshGanttRows(),this.isUpdated=!0},i.prototype.createChartTable=function(){this.taskTable=t.createElement("table",{className:"e-task-table e-zero-spacing",id:"GanttTaskTable"+this.parent.element.id,styles:"position: absolute;width:"+(this.parent.enableTimelineVirtualization?this.parent.timelineModule.wholeTimelineWidth:this.parent.timelineModule.totalTimelineWidth)+"px;",attrs:{cellspacing:"0.25px"}});var e=t.createElement("colgroup"),i=t.createElement("col",{styles:"width:"+this.parent.timelineModule.totalTimelineWidth+"px;"});e.appendChild(i),this.taskTable.appendChild(e),this.ganttChartTableBody=t.createElement("tbody",{id:this.parent.element.id+"GanttTaskTableBody"}),this.taskTable.appendChild(this.ganttChartTableBody),this.parent.ganttChartModule.chartBodyContent.appendChild(this.taskTable)},i.prototype.initiateTemplates=function(){this.taskTable.style.width=t.formatUnit(this.parent.enableTimelineVirtualization?this.parent.timelineModule.wholeTimelineWidth:this.parent.timelineModule.totalTimelineWidth),this.initChartHelperPrivateVariable(),this.initializeChartTemplate()},i.prototype.renderChartRows=function(){this.createTaskbarTemplate(),this.parent.isGanttChartRendered=!0},i.prototype.getIndicatorNode=function(e){var t='<label class="e-label e-indicator-span" style="display: inline-flex; align-items: center; margin-top: 0; line-height:'+this.parent.rowHeight+"px;"+(this.parent.enableRtl?"right:":"left:")+this.getIndicatorleft(e.date)+'px;"><i class="'+e.iconClass+'" style="margin-right: 3px;"></i> </label>';return this.createDivElement(t)},i.prototype.getIndicatorleft=function(e){return e=this.parent.dateValidationModule.getDateFromFormat(e),this.parent.dataOperation.getTaskLeft(e,!1)},i.prototype.getChildTaskbarNode=function(e,i){var a,r=null,n=this.templateData;if(a=this.parent.enableRtl?"right:":"left:",this.childTaskbarTemplateFunction)r=this.childTaskbarTemplateFunction(t.extend({index:e},n),this.parent,"TaskbarTemplate",this.getTemplateID("TaskbarTemplate"),!1,void 0,i[0],this.parent.treeGrid.root);else{var s="",o="",l=void 0,d=void 0;n.ganttProperties.startDate&&n.ganttProperties.endDate&&n.ganttProperties.duration&&(l=this.createDivElement('<div class="e-gantt-child-taskbar-inner-div e-gantt-child-taskbar '+(n.ganttProperties.isAutoSchedule?"":"e-gantt-child-manualtaskbar")+'"style="width:'+n.ganttProperties.width+"px;height:"+this.taskBarHeight+'px; margin-top :-1px"></div>'),d=this.createDivElement('<div class="'+V+" e-gantt-child-progressbar "+(n.ganttProperties.isAutoSchedule?"":"e-gantt-child-manualprogressbar")+'" style="border-style:'+(n.ganttProperties.progressWidth?"solid;":"none;")+"width:"+n.ganttProperties.progressWidth+"px;height:100%;border-top-right-radius:"+this.getBorderRadius(n.ganttProperties)+"px;border-bottom-right-radius:"+this.getBorderRadius(n.ganttProperties)+'px;"></div>'));var h=t.createElement("div");if(this.taskLabelTemplateFunction&&!t.isNullOrUndefined(d)&&d.length>0){var p=this.taskLabelTemplateFunction(t.extend({index:e},n),this.parent,"TaskLabelTemplate",this.getTemplateID("TaskLabelTemplate"),!1,void 0,d[0]);p&&p.length>0&&(t.append(p,h),s=h.innerHTML,s="isCustomTemplate"===(s=this.getTaskLabel(this.parent.labelSettings.taskLabel))?h.innerHTML:s,this.parent.enableHtmlSanitizer&&"string"==typeof s&&(s=t.SanitizeHtmlHelper.sanitize(s)))}else{var u=this.parent.labelSettings.taskLabel;s="isCustomTemplate"===(s=this.getTaskLabel(u))?this.parent.labelSettings.taskLabel:s,this.parent.enableHtmlSanitizer&&"string"==typeof s&&(s=t.SanitizeHtmlHelper.sanitize(s))}-1===s.indexOf("null")&&("isCustomTemplate"!==this.getTaskLabel(this.parent.labelSettings.taskLabel)||this.isTemplate(this.parent.labelSettings.taskLabel)||(s=""),o=isNaN(parseInt(s,10))?'<span class="e-task-label" style="line-height:'+(this.taskBarHeight-1)+"px; text-align:"+(this.parent.enableRtl?"right;":"left;")+"display:inline-block;width:"+(n.ganttProperties.width-10)+"px; height:"+this.taskBarHeight+'px;"></span>':'<span class="e-task-label" style="line-height:'+(this.taskBarHeight-1)+"px;"+("ResourceView"===this.parent.viewType?"text-align:"+(this.parent.enableRtl?"right;":"left;"):"")+ +("ResourceView"===this.parent.viewType?"display:inline-flex;":"")+ +("ResourceView"===this.parent.viewType?n.ganttProperties.width-10:"")+"px; height:"+this.taskBarHeight+'px;"></span>');var c=!t.isNullOrUndefined(n.ganttProperties.segments)&&n.ganttProperties.segments.length>0?this.splitTaskbar(n,s):n.ganttProperties.startDate&&n.ganttProperties.endDate&&n.ganttProperties.duration?o:!n.ganttProperties.startDate||n.ganttProperties.endDate||n.ganttProperties.duration?!n.ganttProperties.endDate||n.ganttProperties.startDate||n.ganttProperties.duration?!n.ganttProperties.duration||n.ganttProperties.startDate||n.ganttProperties.endDate?"":'<div class="'+V+" "+H+" e-gantt-unscheduled-taskbar "+(n.ganttProperties.isAutoSchedule?"":"e-gantt-child-manualtaskbar")+'"style="'+a+n.ganttProperties.left+"px; width:"+n.ganttProperties.width+"px; height:"+this.taskBarHeight+'px;"></div>':'<div class="'+V+" "+H+" e-gantt-unscheduled-taskbar-right "+(n.ganttProperties.isAutoSchedule?"":"e-gantt-child-manualtaskbar")+'"style="'+a+n.ganttProperties.left+"px; height:"+this.taskBarHeight+'px;"></div>':'<div class="'+V+" "+H+" e-gantt-unscheduled-taskbar-left "+(n.ganttProperties.isAutoSchedule?"":"e-gantt-child-manualtaskbar")+'"style="'+a+n.ganttProperties.left+"px; height:"+this.taskBarHeight+'px;"></div>';if(n.ganttProperties.segments&&n.ganttProperties.segments.length>0&&(c+=this.getSplitProgressResizerNode()),n.ganttProperties.startDate&&n.ganttProperties.endDate&&n.ganttProperties.duration&&(t.isNullOrUndefined(n.ganttProperties.segments)||!t.isNullOrUndefined(n.ganttProperties.segments)&&0===n.ganttProperties.segments.length)){if(""!==c&&!t.isNullOrUndefined(d)&&d.length>0){var g=this.createDivElement(c)[0];this.parent.disableHtmlEncode?g.innerText=s:g.innerHTML=s;var f=this.parent.labelSettings.taskLabel;f&&f.elementRef&&g.appendChild(h),d[0].appendChild(g),""!==d[0].querySelectorAll(".e-task-label")[0].textContent&&!this.isTemplate(f)&&d[0].querySelectorAll(".e-task-label")[0].children[0]&&this.parent.disableHtmlEncode&&d[0].querySelectorAll(".e-task-label")[0].children[0].remove(),""===d[0].querySelectorAll(".e-task-label")[0].textContent&&f&&!f.elementRef&&""!==h.innerHTML&&(d[0].querySelectorAll(".e-task-label")[0].textContent=f)}!t.isNullOrUndefined(l)&&l.length>0&&l[0].appendChild([].slice.call(d)[0]),r=l}else r=this.createDivElement(c)}return this.parent.enableRtl&&!t.isNullOrUndefined(r)&&r[0]&&r[0].querySelector(".e-task-label")&&(r[0].querySelector(".e-task-label").style.marginLeft="15px",r[0].querySelector(".e-task-label").style.marginRight="8px",r[0].querySelector(".e-gantt-child-progressbar")&&(r[0].querySelector(".e-gantt-child-progressbar").style.textAlign="left")),r},i.prototype.splitTaskbar=function(e,t){for(var i="",a=0;a<e.ganttProperties.segments.length;a++){var r=e.ganttProperties.segments[a],n=void 0;n=r.showProgress?"initial":"hidden",i+='<div class="e-gantt-child-taskbar-inner-div '+(0===a?"e-segment-first":a===e.ganttProperties.segments.length-1?"e-segment-last":"e-segment-inprogress")+" "+H+' e-segmented-taskbar"style="width:'+r.width+"px;position: absolute;"+(this.parent.enableRtl?"right:":"left:")+r.left+"px;height:"+this.taskBarHeight+"px; overflow:"+n+';" data-segment-index = "'+a+'" aria-label = "'+this.generateSpiltTaskAriaLabel(r,e.ganttProperties)+'"> '+this.getSplitTaskbarLeftResizerNode()+'<div class="'+V+' e-gantt-child-progressbar " style="border-style:'+(r.progressWidth?"solid;":"none;")+"display:"+(r.progressWidth>=0?"block;":"none;")+"width:"+r.progressWidth+"px;height:100%;text-align:"+(this.parent.enableRtl?"left;":"right;")+"border-top-right-radius:"+this.getSplitTaskBorderRadius(r)+"px;border-bottom-right-radius:"+this.getSplitTaskBorderRadius(r)+'px;"><span class="'+L+'" style="line-height:'+(this.taskBarHeight-1)+"px;display:"+(r.showProgress?"inline;":"none;")+"height:"+this.taskBarHeight+'px;">'+t+"</span></div>"+this.getSplitTaskbarRightResizerNode(r)+"</div></div>"}return i},i.prototype.getSplitTaskbarLeftResizerNode=function(){var e=!t.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?5:-2;return'<div class="e-taskbar-left-resizer e-icon" style="'+(this.parent.enableRtl?"right:":"left:")+e+"px;height:"+this.taskBarHeight+'px;z-index:1"></div>'},i.prototype.getSplitTaskbarRightResizerNode=function(e){var i=!t.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?-17:-10;return'<div class="e-taskbar-right-resizer e-icon" style="'+(this.parent.enableRtl?"right:":"left:")+(e.width+i)+"px;height:"+this.taskBarHeight+'px;z-index:1"></div>'},i.prototype.getSplitProgressResizerNode=function(){var e=this.parent.enableRtl?this.templateData.ganttProperties.progressWidth+8:this.templateData.ganttProperties.progressWidth-6;return'<div class="e-child-progress-resizer" style="'+(this.parent.enableRtl?"right:":"left:")+e+"px;margin-top:"+(this.taskBarHeight-4)+'px;"><div class="e-progressbar-handler"><div class="e-progressbar-handler-element"></div><div class="e-progressbar-handler-after"></div></div>'},i.prototype.getSegmentIndex=function(e,i){var a=-1,r=i.ganttProperties,n=r.segments;if(!t.isNullOrUndefined(n)){n.sort(function(e,t){return e.startDate.getTime()-t.startDate.getTime()});for(var s=n.length,o=0;o<s;o++){var l=n[o];if(e.getTime()===r.startDate.getTime())this.dropSplit=!0,a=0;else if(e.getTime()===l.startDate.getTime()){this.dropSplit=!0;var d=l.startDate;d.setDate(d.getDate()+1),d=l.startDate=this.parent.dataOperation.checkStartDate(d,r,!1),l.startDate=d;var h=l.endDate;h=this.parent.dataOperation.getEndDate(d,l.duration,r.durationUnit,r,!1),l.endDate=h,o===n.length-1&&this.parent.setRecordValue("endDate",h,r,!0),this.incrementSegments(n,o,i),a=l.segmentIndex}else l.endDate=this.parent.dataOperation.getEndDate(l.startDate,l.duration,r.durationUnit,r,!1),e.getTime()>=l.startDate.getTime()&&e.getTime()<=l.endDate.getTime()&&(a=l.segmentIndex);this.parent.setRecordValue("segments",r.segments,r,!0)}}return-1===a&&(this.dropSplit=!0),a},i.prototype.mergeTask=function(e,i){var a=i.length,r=this.parent.taskFields,n=this.parent.flatData.filter(function(t){return t[r.id]===e?t:null})[0];if(this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed){var s={};if(s.action="MergeTaskbar",this.parent.isUndoRedoItemPresent("Edit")){this.parent.editModule&&this.parent.editModule.taskbarEditModule.isDragged&&this.parent.getUndoActions().length>0&&this.parent.undoRedoModule.getUndoCollection.splice(this.parent.undoRedoModule.getUndoCollection.length-1,1),this.parent.undoRedoModule.createUndoCollection();var o=this.parent.previousFlatData[n.index];s.modifiedRecords=t.extend([],[o],[],!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=s}}var l=n.ganttProperties.segments;i=i.sort(function(e,t){return t.firstSegmentIndex-e.firstSegmentIndex});for(var d=0;d<a;d++){var h=l[i[d].firstSegmentIndex],p=l[i[d].secondSegmentIndex],u=h.duration+p.duration,c=this.parent.dataOperation.getEndDate(h.startDate,u,n.ganttProperties.durationUnit,n.ganttProperties,!1),g={startDate:h.startDate,endDate:c,duration:u},f=i[d].firstSegmentIndex;l.splice(f,2,g),this.parent.setRecordValue("segments",l,n.ganttProperties,!0),this.parent.dataOperation.updateMappingData(n,"segments"),1===l.length?(this.parent.setRecordValue("endDate",c,n.ganttProperties,!0),this.parent.setRecordValue("EndDate",c,n,!0),this.parent.setRecordValue("segments",null,n.ganttProperties,!0),this.parent.dataOperation.updateMappingData(n,"segments")):n.ganttProperties.endDate!==l[l.length-1].endDate&&this.parent.setRecordValue("endDate",l[l.length-1].endDate,n.ganttProperties,!0)}var m;t.isNullOrUndefined(n[r.segments])||t.isNullOrUndefined(n[r.segments][0])||(m=Object.keys(n[r.segments][0]));for(var y=[],D=0;D<l.length;D++)t.isNullOrUndefined(m)||y[D]||(y[D]={}),t.isNullOrUndefined(m)||-1===m.indexOf("StartDate")||(y[D][r.startDate]=l[D].startDate),t.isNullOrUndefined(m)||-1===m.indexOf("EndDate")||(y[D][r.endDate]=l[D].endDate),t.isNullOrUndefined(m)||-1===m.indexOf("Duration")||(y[D][r.duration]=l[D].duration);n[r.segments]=y,this.updateSegment(n.ganttProperties.segments,e),this.refreshChartAfterSegment(n,"mergeSegment")},i.prototype.updateSegment=function(e,i){var a=this;if(!t.isNullOrUndefined(this.parent.taskFields.segmentId)&&this.parent.segmentData.length>0)if(t.isNullOrUndefined(e)){l=this.parent.segmentData.filter(function(e){return!(i===e[a.parent.taskFields.segmentId])});this.parent.segmentData=l}else{for(var r=[],n=0;n<e.length;n++){var s={},o=e[n];s[this.parent.taskFields.segmentId]=i,t.isNullOrUndefined(this.parent.taskFields.startDate)||(s[this.parent.taskFields.startDate]=o.startDate),t.isNullOrUndefined(this.parent.taskFields.duration)||(s[this.parent.taskFields.duration]=o.duration),t.isNullOrUndefined(this.parent.taskFields.endDate)||(s[this.parent.taskFields.endDate]=o.endDate),r.push(s)}for(var l=this.parent.segmentData.filter(function(e){return!(i===e[a.parent.taskFields.segmentId])}),n=0;n<r.length;n++)l.push(r[n]);this.parent.segmentData=l}},i.prototype.refreshChartAfterSegment=function(e,i){this.parent.setRecordValue("segments",this.parent.dataOperation.setSegmentsInfo(e,!1),e.ganttProperties,!0),this.parent.dataOperation.updateMappingData(e,"segments"),this.parent.dataOperation.updateWidthLeft(e),this.parent.dataOperation.updateParentItems(e),e.ganttProperties.sharedTaskUniqueIds&&e.ganttProperties.sharedTaskUniqueIds.length>1&&this.parent.editModule.updateSharedTask(e),this.parent.predecessorModule&&this.parent.taskFields.dependency?(this.parent.predecessorModule.updatedRecordsDateByPredecessor(),this.parent.connectorLineModule.removePreviousConnectorLines(this.parent.flatData),this.parent.connectorLineEditModule.refreshEditedRecordConnectorLine(this.parent.flatData),e.parentItem&&this.parent.getParentTask(e.parentItem).ganttProperties.isAutoSchedule&&this.parent.isInPredecessorValidation&&this.parent.dataOperation.updateParentItems(e.parentItem),this.refreshRecords(this.parent.currentViewData)):this.refreshRecords(this.parent.currentViewData);var a=this.ganttChartTableBody.querySelectorAll("tr")[this.parent.currentViewData.indexOf(e)],r={requestType:i,rowData:e,modifiedRecords:this.parent.editedRecords,modifiedTaskData:w(this.parent.editedRecords,!0)};this.triggerQueryTaskbarInfoByIndex(a,e),this.parent.selectionModule&&this.parent.selectionModule.clearSelection();var n=r.rowData.taskData[this.parent.taskFields.segments];if(this.parent.timezone&&null!=n)for(var s=0;s<n.length;s++)n[s][this.parent.taskFields.startDate]=this.parent.dateValidationModule.remove(r.rowData.ganttProperties.segments[s].startDate,this.parent.timezone),this.parent.taskFields.endDate&&(n[s][this.parent.taskFields.endDate]=this.parent.dateValidationModule.remove(r.rowData.ganttProperties.segments[s].endDate,this.parent.timezone));this.parent.trigger("actionComplete",r),this.parent.hideLoadingIndicator(),t.setValue("isEdit",!1,this.parent.contextMenuModule),t.setValue("isEdit",!1,this.parent)},i.prototype.splitTask=function(e,i){var a=this.parent.taskFields,r=i,n=this.parent.flatData.filter(function(t){return t[a.id]===e?t:null})[0];if(this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed){var s={};s.action="MergeTaskbar",this.parent.isUndoRedoItemPresent("Edit")&&(this.parent.undoRedoModule.createUndoCollection(),s.modifiedRecords=t.extend([],[n],[],!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=s)}var o=n.ganttProperties;this.dropSplit=!1;var l=-1,d=o.segments;if(t.isNullOrUndefined(i.length)||i.length<0){var h=this.parent.dataOperation.checkStartDate(r,o,!1);if(h.getTime()!==o.startDate.getTime()&&o.isAutoSchedule){if(!t.isNullOrUndefined(d)&&d.length>0&&(l=this.getSegmentIndex(h,n)),!1===this.dropSplit&&r.getTime()>o.startDate.getTime()&&r.getTime()<o.endDate.getTime()){d=-1!==l?d:[];var p=-1!==l?d[l].startDate:new Date(o.startDate.getTime()),u=-1!==l?d[l].endDate:new Date(o.endDate.getTime()),c=this.parent.dataOperation.getDuration(p,u,o.durationUnit,o.isAutoSchedule,o.isMilestone);this.parent.setRecordValue("segments",this.splitSegmentedTaskbar(p,u,r,l,d,n,c),o,!0);for(var g=[],f=0;f<d.length;f++)g[f]||(g[f]={}),g[f][a.startDate]=d[f].startDate,g[f][a.endDate]=d[f].endDate,g[f][a.duration]=d[f].duration;n[a.segments]=g,-1!==l&&this.incrementSegments(d,l+1,n),this.parent.setRecordValue("endDate",d[d.length-1].endDate,o,!0),this.parent.taskFields.endDate&&this.parent.dataOperation.updateMappingData(n,"endDate")}this.updateSegment(n.ganttProperties.segments,e),this.refreshChartAfterSegment(n,"splitTaskbar")}}else i.sort(function(e,t){return e.getTime()-t.getTime()}),this.parent.setRecordValue("segments",this.constructSegments(i,n.ganttProperties),n.ganttProperties,!0),this.updateSegment(n.ganttProperties.segments,e),this.refreshChartAfterSegment(n,"splitTask")},i.prototype.constructSegments=function(e,t){for(var i,a,r,n=[],s=new Date,o=0;o<e.length+1&&(s=0===o?t.startDate:s,s=this.parent.dataOperation.checkStartDate(s,t,!1),a=o!==e.length?new Date(e[o].getTime())>t.endDate?t.endDate:new Date(e[o].getTime()):t.endDate,a=this.parent.dataOperation.checkEndDate(a,t,!1),r=this.parent.dataOperation.getDuration(s,a,t.durationUnit,t.isAutoSchedule,t.isMilestone),a.getTime()>=s.getTime()&&(i={startDate:s,endDate:a,duration:r},n.push(i)),o!==e.length);o++)(s=new Date(e[o].getTime())).setDate(e[o].getDate()+1);return n},i.prototype.splitSegmentedTaskbar=function(e,t,i,a,r,n,s){var o,l,d=n.ganttProperties,h=-1===(o=this.parent.includeWeekend?-1:this.parent.nonWorkingDayIndex.indexOf(i.getDay()))?0:0===o?1:1===o?1:2;e=this.parent.dataOperation.checkStartDate(e,d,!1);var p=new Date(i.getTime());p=this.parent.dataOperation.checkEndDate(p,d,!1);for(var u=0;u<2;u++){if(this.parent.weekWorkingTime.length>0){var c=this.parent.getCurrentDayEndTime(p);this.setTime(c,p)}var g={startDate:e,endDate:p,duration:this.parent.dataOperation.getDuration(e,p,d.durationUnit,d.isAutoSchedule,d.isMilestone),offsetDuration:1};l=this.parent.includeWeekend?-1:this.parent.nonWorkingDayIndex.indexOf(p.getDay()),-1!==a&&(r.splice(a,1),a=-1),r.push(g);var f=this.parent.timelineModule.customTimelineSettings.bottomTier.unit;if("Hour"===f||"Minutes"===f){e=new Date(i.getTime()),e=this.parent.dataOperation.checkStartDate(e,d,!1);var m=this.parent.timelineModule.customTimelineSettings.bottomTier.count,y=this.parent.timelineModule.customTimelineSettings.bottomTier.unit,D=this.parent.timelineModule.getIncrement(e,m,y),v=e.getTime()+D;e.setTime(v+h),p=new Date(t.getTime()),D=this.parent.timelineModule.getIncrement(p,m,y),v=p.getTime()+D,p.setTime(v+h)}else{(e=new Date(i.getTime())).setDate(e.getDate()+1+h);var k=this.parent.getCurrentDayStartTime(e);if(this.setTime(k,e),e=this.parent.dataOperation.checkStartDate(e,d,!1),!this.parent.taskFields.duration&&h<=0&&e.setDate(e.getDate()+1),(p=new Date(t.getTime()))<e&&p.setDate(p.getDate()+1),this.isOnHolidayOrWeekEnd(p,!0))do{p.setDate(p.getDate()+1)}while(this.isOnHolidayOrWeekEnd(p,!0));this.parent.includeWeekend||(p=this.getNextWorkingDay(p))}if(-1!==l){var b=s-g.duration;p=this.parent.dataOperation.getEndDate(e,b,d.durationUnit,d,!1)}else p=this.parent.dataOperation.checkEndDate(p,d,!1)}return r.sort(function(e,t){return e.startDate.getTime()-t.startDate.getTime()}),r},i.prototype.incrementSegments=function(e,t,i){for(var a=i.ganttProperties,r=t+1;r<e.length;r++){var n=e[r],s=0!==r?new Date(e[r-1].endDate.getTime()):new Date(n.startDate.getTime());this.parent.dataOperation.fromSegments=!0,s=this.parent.dataOperation.getEndDate(s,n.offsetDuration,a.durationUnit,a,!1),this.parent.dataOperation.fromSegments=!1,s=this.parent.dataOperation.checkStartDate(s,a,!1),n.startDate=s;var o=n.endDate=this.parent.dataOperation.getEndDate(s,n.duration,a.durationUnit,a,!1);n.endDate=o,r===e.length-1&&(this.parent.setRecordValue("endDate",o,a,!0),this.parent.taskFields.endDate&&this.parent.dataOperation.updateMappingData(i,"endDate"))}e.sort(function(e,t){return e.startDate.getTime()-t.startDate.getTime()}),this.parent.setRecordValue("segments",e,a,!0),this.parent.dataOperation.updateMappingData(i,"segments")},i.prototype.calculateLeftValue=function(e){var i=this.parent.renderBaseline?.45:!t.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?.7:.62,a=Math.floor(this.parent.rowHeight*i);return!t.isNullOrUndefined(this.parent.taskbarHeight)&&this.parent.taskbarHeight<=a||t.isNullOrUndefined(this.parent.taskbarHeight)&&e<=36?1:e<=36?1:-1/12*(e-36)+1},i.prototype.getMilestoneNode=function(e,i){var a=null,r=this.templateData,n=this.parent.rowHeight,s=this.calculateLeftValue(n);if(this.milestoneTemplateFunction)a=this.milestoneTemplateFunction(t.extend({index:e},r),this.parent,"MilestoneTemplate",this.getTemplateID("MilestoneTemplate"),!1,void 0,i[0],this.parent.treeGrid.root);else{var o='<div class="e-gantt-milestone" style="width:'+(this.parent.renderBaseline?this.taskBarHeight:this.taskBarHeight-6)+"px;height:"+(this.parent.renderBaseline?this.taskBarHeight:this.taskBarHeight-6)+"px;position:absolute;transform: rotate(45deg);left:"+s+'px;"> </div>';a=this.createDivElement(o)}return a},i.prototype.getTaskBaselineNode=function(){var e=this.templateData,t='<div class="e-baseline-bar " role="term" style="margin-top:'+this.baselineTop+"px;"+(this.parent.enableRtl?"right:":"left:")+e.ganttProperties.baselineLeft+"px;width:"+e.ganttProperties.baselineWidth+"px;height:"+this.baselineHeight+"px;"+(this.baselineColor?"background-color: "+this.baselineColor+";":"")+'"></div>';return this.createDivElement(t)},i.prototype.updateTaskBaselineNode=function(e){var t='<div class="e-baseline-bar " role="term" style="margin-top:'+this.baselineTop+"px;"+(this.parent.enableRtl?"right:":"left:")+e.ganttProperties.baselineLeft+"px;width:"+e.ganttProperties.baselineWidth+"px;height:"+this.baselineHeight+"px;"+(this.baselineColor?"background-color: "+this.baselineColor+";":"")+'"></div>';return this.createDivElement(t)},i.prototype.getMilestoneBaselineNode=function(){var e=this.templateData,t=this.parent.renderBaseline?5:2,i='<div class="e-baseline-gantt-milestone-container" style="width:'+(this.parent.renderBaseline?this.taskBarHeight:this.taskBarHeight-10)+"px;height:"+(this.parent.renderBaseline?this.taskBarHeight:this.taskBarHeight-10)+"px;position:absolute;transform:rotate(45deg);"+(this.parent.enableRtl?"right:":"left:")+(this.parent.enableRtl?e.ganttProperties.left-this.milestoneHeight/2+3:e.ganttProperties.baselineLeft-this.milestoneHeight/2+1)+"px;"+(this.baselineColor?"background-color: "+this.baselineColor+";":"")+"margin-top:"+(-Math.floor(this.parent.rowHeight-this.milestoneMarginTop)+t+2)+'px"> </div>';return this.createDivElement(i)},i.prototype.getLeftLabelNode=function(e){var i=this.leftLabelContainer();""!==this.generateTaskLabelAriaLabel("left")&&i[0].setAttribute("aria-label",this.generateTaskLabelAriaLabel("left"));var a=null;if(this.leftTaskLabelTemplateFunction)a=this.leftTaskLabelTemplateFunction(t.extend({index:e},this.templateData),this.parent,"LeftLabelTemplate",this.getTemplateID("LeftLabelTemplate"),!1,void 0,i[0],this.parent.treeGrid.root);else{var r=this.parent.labelSettings.leftLabel,n=this.getTaskLabel(r);n&&(n="isCustomTemplate"===n?r:n,a=this.getLableText(n,"e-left-label-inner-div"),this.parent.enableHtmlSanitizer&&"string"==typeof n&&(n="isCustomTemplate"===(n=t.SanitizeHtmlHelper.sanitize(n))?r:n,a=this.getLableText(n,"e-left-label-inner-div")))}return a&&a.length>0&&("null"===a[0].data&&(a[0].data=""),t.append(a,i[0])),this.parent.enableRtl&&(i[0].style.paddingLeft="25px",i[0].style.paddingRight="0px"),i},i.prototype.getLableText=function(e,i){var a=this.parent.renderBaseline?(this.parent.rowHeight-this.taskBarHeight)/2:this.taskBarMarginTop,r=t.createElement("div",{className:i,styles:"height:"+this.taskBarHeight+"px;margin-top:"+a+"px;"}),n=t.createElement("span",{className:z});n[this.parent.disableHtmlEncode?"textContent":"innerHTML"]=e,r.appendChild(n);var s=t.createElement("div");return s.appendChild(r),s.childNodes},i.prototype.getRightLabelNode=function(e){var i=this.rightLabelContainer();""!==this.generateTaskLabelAriaLabel("right")&&i[0].setAttribute("aria-label",this.generateTaskLabelAriaLabel("right"));var a=null;if(this.rightTaskLabelTemplateFunction)a=this.rightTaskLabelTemplateFunction(t.extend({index:e},this.templateData),this.parent,"RightLabelTemplate",this.getTemplateID("RightLabelTemplate"),!1,void 0,i[0],this.parent.treeGrid.root);else{var r=this.parent.labelSettings.rightLabel,n=this.getTaskLabel(r);n&&(n="isCustomTemplate"===n?r:n,a=this.getLableText(n,"e-right-label-inner-div"),this.parent.enableHtmlSanitizer&&"string"==typeof n&&(n="isCustomTemplate"===(n=t.SanitizeHtmlHelper.sanitize(n))?r:n,a=this.getLableText(n,"e-right-label-inner-div")))}return a&&a.length>0&&("null"===a[0].data&&(a[0].data=""),t.append(a,i[0])),this.parent.enableRtl&&(i[0].style.marginLeft="0px",i[0].style.paddingRight="25px"),i},i.prototype.getManualTaskbar=function(){var e=this.templateData,t=this.taskBarHeight/2-1,i=(e.ganttProperties.startDate&&e.ganttProperties.endDate&&(e.ganttProperties.duration||e.hasChildRecords)?'<div class="'+j+'" style="width:'+e.ganttProperties.width+"px;height:"+t/5+"px;border-left-width:"+t/5+"px; border-bottom:"+t/5+'px solid transparent;"></div>':e.ganttProperties.startDate||e.ganttProperties.endDate||!e.ganttProperties.duration?'<div class="'+j+" "+(e.ganttProperties.startDate?"e-gantt-unscheduled-taskbar-left":"e-gantt-unscheduled-taskbar-right")+'" style="width:'+e.ganttProperties.width+"px;height:"+2*t+"px;border-left-width:"+t/5+"px; border-bottom:"+t/5+'px solid transparent;"></div>':'<div class="'+j+' e-gantt-unscheduled-manualtask" style="width:'+e.ganttProperties.width+"px;height:"+(t/5+1)+"px;border-left-width:"+t/5+"px; border-bottom:"+t/5+'px solid transparent;"></div>')+(e.ganttProperties.startDate&&e.ganttProperties.endDate&&(e.ganttProperties.duration||e.hasChildRecords)||e.ganttProperties.duration?'<div class="e-gantt-manualparenttaskbar-left" style='+(this.parent.enableRtl?"margin-right:0px;":"")+'"height:'+(t/5+8)+"px;border-left-width:"+t/5+"px; border-bottom:"+t/5+'px solid transparent;"></div><div class="e-gantt-manualparenttaskbar-right" style="'+(this.parent.enableRtl?"margin-right:-8px;":"")+(this.parent.enableRtl?"right:":"left:")+(e.ganttProperties.width-Math.floor((t/5+8)/5))+"px;height:"+(t/5+8)+"px;border-right-width:"+t/5+"px;border-bottom:"+t/5+'px solid transparent;"></div></div>':""),a='<div class="e-manualparent-main-container"style='+(this.parent.enableRtl?"right:":"left:")+(e.ganttProperties.left-e.ganttProperties.autoLeft)+"px;width:"+e.ganttProperties.width+"px;height:"+t+"px;cursor:"+(this.parent.editSettings.allowTaskbarEditing?"move;":"default;")+"</div>",r='<div class="e-gantt-manualparent-milestone" style="width:'+(this.parent.renderBaseline?this.taskBarHeight-3:this.taskBarHeight-7)+"px;height:"+(this.parent.renderBaseline?this.taskBarHeight-3:this.taskBarHeight-7)+"px;position:absolute;transform: rotate(45deg);top:"+(this.parent.rowHeight>40?0:2)+"px;left:"+(this.parent.renderBaseline?2:1)+'px;"> </div>';return this.createDivElement(0===e.ganttProperties.duration&&e.hasChildRecords&&!e.ganttProperties.isAutoSchedule?r+i:a+i)},i.prototype.getParentTaskbarNode=function(e,i){var a=null,r=this.templateData;if(this.parentTaskbarTemplateFunction&&0!==r.ganttProperties.autoDuration&&!r.ganttProperties.isMilestone)a=this.parentTaskbarTemplateFunction(t.extend({index:e},r),this.parent,"ParentTaskbarTemplate",this.getTemplateID("ParentTaskbarTemplate"),!1,void 0,i[0],this.parent.treeGrid.root);else{var n="",s=void 0,o=this.taskBarHeight/5,l=this.createDivElement('<div class="e-gantt-parent-taskbar-inner-div '+this.getExpandClass(r)+' e-gantt-parent-taskbar" style="width:'+(r.ganttProperties.isAutoSchedule?r.ganttProperties.width:r.ganttProperties.autoWidth)+"px;height:"+(r.ganttProperties.isAutoSchedule?this.taskBarHeight:3*o)+"px;margin-top:"+(r.ganttProperties.isAutoSchedule?-1:2*o)+'px; "></div>'),d=this.createDivElement('<div class="e-gantt-parent-progressbar-inner-div '+this.getExpandClass(r)+' e-gantt-parent-progressbar" style="border-style:'+(r.ganttProperties.progressWidth?"solid;":"none;")+"width:"+r.ganttProperties.progressWidth+"px;border-top-right-radius:"+this.getBorderRadius(r)+"px;border-bottom-right-radius:"+this.getBorderRadius(r)+'px;height:100%;"></div>'),h=t.createElement("div");if(this.taskLabelTemplateFunction){var p=this.taskLabelTemplateFunction(t.extend({index:e},r),this.parent,"TaskLabelTemplate",this.getTemplateID("TaskLabelTemplate"),!1,void 0,d[0]);p&&p.length>0&&(t.append(p,h),n=h.innerHTML,n="isCustomTemplate"===(n=this.getTaskLabel(this.parent.labelSettings.taskLabel))?h.innerHTML:n,this.parent.enableHtmlSanitizer&&"string"==typeof n&&(n=t.SanitizeHtmlHelper.sanitize(n)))}else n="isCustomTemplate"===(n=this.getTaskLabel(this.parent.labelSettings.taskLabel))?this.parent.labelSettings.taskLabel:n,this.parent.enableHtmlSanitizer&&"string"==typeof n&&(n=t.SanitizeHtmlHelper.sanitize(n));if(-1===n.indexOf("null")){"isCustomTemplate"!==this.getTaskLabel(this.parent.labelSettings.taskLabel)||this.isTemplate(this.parent.labelSettings.taskLabel)||(n=""),s=isNaN(parseInt(n,10))?'<span class="e-task-label" style="line-height:'+(r[this.parent.taskFields.manual]&&r.hasChildRecords?Math.floor(.6*this.taskBarHeight):this.taskBarHeight-1)+"px; text-align:"+(this.parent.enableRtl?"right;":"left;")+"display:inline-block;width:"+(r.ganttProperties.width-10)+"px; height:"+this.taskBarHeight+'px;"></span>':'<span class="e-task-label" style="line-height:'+(r[this.parent.taskFields.manual]&&r.hasChildRecords?Math.floor(.6*this.taskBarHeight):this.taskBarHeight-1)+"px;"+("ResourceView"===this.parent.viewType?"display:inline-flex;":"")+("ResourceView"===this.parent.viewType?"width:"+(r.ganttProperties.width-10):"")+"px; height:"+(this.taskBarHeight-1)+"px;"+("ResourceView"===this.parent.viewType?"display: inline-flex;":"")+("ResourceView"===this.parent.viewType?"width:"+(r.ganttProperties.width-10):"")+"px; height:"+this.taskBarHeight+'px;"></span>';var u=this.createDivElement(s)[0];this.parent.disableHtmlEncode?u.innerText=n:u.innerHTML=n;var c=this.parent.labelSettings.taskLabel;c&&c.elementRef&&u.appendChild(h),d[0].appendChild(u),""!==d[0].querySelectorAll(".e-task-label")[0].textContent&&!this.isTemplate(c)&&d[0].querySelectorAll(".e-task-label")[0].children[0]&&this.parent.disableHtmlEncode&&d[0].querySelectorAll(".e-task-label")[0].children[0].remove(),""===d[0].querySelectorAll(".e-task-label")[0].textContent&&c&&!c.elementRef&&""!==h.innerHTML&&(d[0].querySelectorAll(".e-task-label")[0].textContent=c)}var g='<div class="e-gantt-parent-milestone" style="width:'+(this.parent.renderBaseline?this.taskBarHeight-3:this.taskBarHeight-7)+"px;height:"+(this.parent.renderBaseline?this.taskBarHeight-3:this.taskBarHeight-7)+"px;position:absolute;transform: rotate(45deg);top:"+(this.parent.rowHeight>40?0:2)+"px;left:"+(this.parent.renderBaseline?2:1)+'px;"> </div>';l[0].appendChild([].slice.call(d)[0]),a=r.ganttProperties.isMilestone?this.createDivElement(r.ganttProperties.isAutoSchedule?g:""):l}return this.parent.enableRtl&&a[0]&&a[0].querySelector(".e-task-label")&&(a[0].querySelector(".e-task-label").style.marginLeft="15px",a[0].querySelector(".e-task-label").style.marginRight="8px",a[0].querySelector(".e-gantt-parent-progressbar")&&(a[0].querySelector(".e-gantt-parent-progressbar").style.textAlign="left")),a},i.prototype.getTableTrNode=function(e){var i,a,r=this,n=t.createElement("table"),s="Horizontal"===this.parent.gridLines||"Both"===this.parent.gridLines?"e-chart-row-border":"";this.parent.treeGridModule.isPersist?setTimeout(function(){t.isNullOrUndefined(r.parent.treeGrid.grid)||t.isNullOrUndefined(r.parent.treeGrid.grid.contentModule)||t.isNullOrUndefined(r.parent.treeGrid.grid.contentModule.getRows())||(a=r.parent.treeGrid.grid.contentModule.getRows()[e],i=a&&a.isSelected?"e-active":"")},0):(a=this.parent.treeGrid.grid.contentModule.getRows()[e],i=a&&a.isSelected?"e-active":"");var o=n.querySelector("tbody");o||(o=document.createElement("tbody"),n.appendChild(o));var l=document.createElement("tr");l.classList.add(this.getRowClassName(this.templateData),A),i&&l.classList.add(i),l.style.display=this.getExpandDisplayProp(this.templateData),l.style.height=this.parent.rowHeight+"px";var d=document.createElement("td");return s?d.classList.add("e-chart-row-cell",s):d.classList.add("e-chart-row-cell"),d.style.width=this.parent.timelineModule.totalTimelineWidth+"px",l.appendChild(d),o.appendChild(l),n.childNodes},i.prototype.initializeChartTemplate=function(){t.isNullOrUndefined(this.parent.parentTaskbarTemplate)||(this.parentTaskbarTemplateFunction=this.templateCompiler(this.parent.parentTaskbarTemplate)),!t.isNullOrUndefined(this.parent.labelSettings.leftLabel)&&this.isTemplate(this.parent.labelSettings.leftLabel)&&(this.leftTaskLabelTemplateFunction=this.templateCompiler(this.parent.labelSettings.leftLabel)),!t.isNullOrUndefined(this.parent.labelSettings.rightLabel)&&this.isTemplate(this.parent.labelSettings.rightLabel)&&(this.rightTaskLabelTemplateFunction=this.templateCompiler(this.parent.labelSettings.rightLabel)),!t.isNullOrUndefined(this.parent.labelSettings.taskLabel)&&this.isTemplate(this.parent.labelSettings.taskLabel)&&(this.taskLabelTemplateFunction=this.templateCompiler(this.parent.labelSettings.taskLabel)),t.isNullOrUndefined(this.parent.taskbarTemplate)||(this.childTaskbarTemplateFunction=this.templateCompiler(this.parent.taskbarTemplate)),t.isNullOrUndefined(this.parent.milestoneTemplate)||(this.milestoneTemplateFunction=this.templateCompiler(this.parent.milestoneTemplate))},i.prototype.createDivElement=function(e){var t=document.createElement("div");return this.parseTemplate(e).forEach(function(e){return t.appendChild(e)}),t.childNodes},i.prototype.parseTemplate=function(e){var t=this;return this.parseHtmlStringToElementTree(e).map(function(e){return t.constructElementFromNode(e)})},i.prototype.parseHtmlStringToElementTree=function(e){for(var t,i=[],a=[],r=0;null!==(t=this.tagRegex.exec(e));){var n=t[0],s=t[1],o=t[2],l=void 0===o?"":o,d=e.substring(r,t.index).trim();r=this.tagRegex.lastIndex;var h={tagName:s,attributes:l,children:[]};n.startsWith("</")?(a.length>0&&d&&(a[a.length-1].value=d),a.pop()):n.endsWith("/>")||(a.length>0?a[a.length-1].children.push(h):i.push(h),a.push(h))}return i},i.prototype.constructElementFromNode=function(e){var t=this,i=document.createElement(e.tagName);return e.value&&(i.textContent=e.value),this.setAttributes(i,e.attributes),e.children.forEach(function(e){var a=t.constructElementFromNode(e);i.appendChild(a)}),i},i.prototype.setAttributes=function(e,t){var i;for(t=function(e){return e.replace(/style=([^"'\s][^ >]*)/g,'style="$1"')}(t);null!==(i=this.attributeRegex.exec(t));){var a=i[1],r=i[2];"class"===a?e.className=r:"style"===a?e.style.cssText=this.cleanStyleString(r):e.setAttribute(a,r)}},i.prototype.cleanStyleString=function(e){return e.split(";").map(function(e){return e.trim()}).filter(Boolean).join("; ")},i.prototype.isTemplate=function(e){for(var t=!1,i=0;i<this.parent.ganttColumns.length;i++)if(e===this.parent.ganttColumns[i].field){t=!0;break}return t="string"!=typeof e||0===e.indexOf("#")||e.indexOf("<")>-1||e.indexOf("$")>-1||!t},i.prototype.getTemplateID=function(e){return this.parent.element.id+e},i.prototype.leftLabelContainer=function(){var e='<div class="'+(this.leftTaskLabelTemplateFunction?"e-left-label-container e-left-label-temp-container":F)+' " tabindex="-1" role="term" style="height:'+(this.parent.rowHeight-2)+"px;width:"+this.taskNameWidth(this.templateData)+'"></div>';return this.createDivElement(e)},i.prototype.taskbarContainer=function(){var e=this.templateData,t=!(!this.parent.editModule||!this.parent.editSettings.allowTaskbarEditing||"ParentResizing"!==this.parent.editModule.taskbarEditModule.taskBarEditAction),i='<div class="e-taskbar-main-container '+this.parent.getUnscheduledTaskClass(e.ganttProperties)+" "+(e.ganttProperties.cssClass?e.ganttProperties.cssClass:"")+'" tabindex="-1" role="term" style="'+(!e.ganttProperties.isMilestone||t||e.hasChildRecords&&!e.ganttProperties.isAutoSchedule?"width:"+e.ganttProperties.width+"px;margin-top:"+this.taskBarMarginTop+"px;"+(this.parent.enableRtl?"right:":"left:")+(!e.hasChildRecords||e.ganttProperties.isAutoSchedule?e.ganttProperties.left:e.ganttProperties.autoLeft)+"px;height:"+this.taskBarHeight+"px;cursor:"+(this.parent.editSettings.allowTaskbarEditing?"move;":"default;"):"width:"+this.milestoneHeight+"px;height:"+this.milestoneHeight+"px;margin-top:"+this.milestoneMarginTop+"px;"+(this.parent.enableRtl?"right:":"left:")+(e.ganttProperties.left-this.milestoneHeight/2)+"px;cursor:"+(this.parent.editSettings.allowTaskbarEditing?"move;":"default;"))+'"></div>';return this.createDivElement(i)},i.prototype.rightLabelContainer=function(){var e='<div class="'+(this.rightTaskLabelTemplateFunction?"e-right-label-container e-right-label-temp-container":U)+'" tabindex="-1" role="term" style="'+(this.parent.enableRtl?"right:":"left:")+this.getRightLabelLeft(this.templateData)+"px; height:"+(this.parent.rowHeight-2)+'px;"></div>';return this.createDivElement(e)},i.prototype.childTaskbarLeftResizer=function(){var e=!t.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?5:-2,i='<div class="e-taskbar-left-resizer e-icon"style="'+(this.parent.enableRtl?"right:":"left:")+e+"px;height:"+this.taskBarHeight+'px;z-index:1"></div>';return this.createDivElement(i)},i.prototype.childTaskbarRightResizer=function(){var e=!t.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?-17:-11,i='<div class="e-taskbar-right-resizer e-icon"style="'+(this.parent.enableRtl?"right:":"left:")+(this.templateData.ganttProperties.width+e)+"px;height:"+this.taskBarHeight+'px;z-index:1"></div>';return this.createDivElement(i)},i.prototype.childTaskbarProgressResizer=function(){var e=this.parent.enableRtl?this.templateData.ganttProperties.progressWidth+8:this.templateData.ganttProperties.progressWidth-6,t='<div class="e-child-progress-resizer"style="'+(this.parent.enableRtl?"right:":"left:")+e+"px;margin-top:"+(this.taskBarHeight-4)+'px;"><div class="e-progressbar-handler"><div class="e-progressbar-handler-element"></div><div class="e-progressbar-handler-after"></div></div>';return this.createDivElement(t)},i.prototype.getLeftPointNode=function(){var e,i=this.templateData,a=!t.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?12:0,r=!t.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?6:3,n=-(2+this.connectorPointWidth+a),s=-(this.connectorPointWidth+r),o=Math.floor(this.milesStoneRadius-this.connectorPointWidth/2);e=!this.templateData.ganttProperties.isAutoSchedule&&this.templateData.hasChildRecords&&this.parent.allowParentDependency?"":"margin-top:"+this.connectorPointMargin+"px";var l=!0;i.hasChildRecords&&!this.parent.allowParentDependency&&(l=!1);var d='<div class="e-left-connectorpoint-outer-div" style="'+(i.ganttProperties.isMilestone?"margin-top:"+o+"px;left:"+s+"px;":e+";left:"+n+"px;")+'"><div class="'+(l?_:"")+" "+this.parent.getUnscheduledTaskClass(i.ganttProperties)+'" style="width: '+this.connectorPointWidth+"px;"+(this.parent.enableRtl?"margin-right:2px;":"")+"height: "+this.connectorPointWidth+'px;">'+this.touchLeftConnectorpoint+"</div></div>";return this.createDivElement(d)},i.prototype.getRightPointNode=function(){var e,i=this.templateData,a=-(3+(!t.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?-12:0)),r=Math.floor(this.milesStoneRadius-this.connectorPointWidth/2);e=!this.templateData.ganttProperties.isAutoSchedule&&this.templateData.hasChildRecords&&this.parent.allowParentDependency?"":"margin-top:"+this.connectorPointMargin+"px";var n=!0;i.hasChildRecords&&!this.parent.allowParentDependency&&(n=!1);var s='<div class="e-right-connectorpoint-outer-div" style="'+(i.ganttProperties.isMilestone?"left:"+(!t.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?this.milestoneHeight+5:this.milestoneHeight-2)+"px;margin-top:"+r+"px;":"left:"+(i.ganttProperties.width+a)+"px;"+e+";")+'"><div class="'+(n?"e-connectorpoint-right":"")+" "+this.parent.getUnscheduledTaskClass(i.ganttProperties)+'" style="width:'+this.connectorPointWidth+"px;height:"+this.connectorPointWidth+'px;">'+this.touchRightConnectorpoint+"</div></div>";return this.createDivElement(s)},i.prototype.getTaskLabel=function(e){var i=this.parent.ganttColumns.length,a=null;if(t.isNullOrUndefined(e)||""===e)a="";else if(e===this.parent.taskFields.resourceInfo)a=this.getResourceName(this.templateData);else{for(var r=0;r<i;r++)if(e===this.parent.ganttColumns[r].field){a=this.getFieldValue(this.templateData[e]).toString();break}if(t.isNullOrUndefined(a))return"isCustomTemplate"}return a},i.prototype.getExpandDisplayProp=function(e){return e=this.templateData,this.parent.getExpandStatus(e)?"table-row":"none"},i.prototype.getRowClassName=function(e){var t="gridrowtaskId",i=(e=this.templateData).parentItem;return i&&(t+=i.taskId.toString()),t+="level",t+=e.level.toString()},i.prototype.getBorderRadius=function(e){var t=(e=this.templateData).ganttProperties.width-e.ganttProperties.progressWidth;return t<=4?4-t:0},i.prototype.getSplitTaskBorderRadius=function(e){var t=e.width-e.progressWidth;return t<=4?4-t:0},i.prototype.taskNameWidth=function(e){var t,i=(e=this.templateData).ganttProperties;return(t=e.ganttProperties.isMilestone?e.ganttProperties.left-this.parent.getTaskbarHeight()/2:e.hasChildRecords&&!i.isAutoSchedule?this.parent.allowUnscheduledTasks?i.left<i.autoLeft?i.left:i.autoLeft:i.autoStartDate.getTime()<i.startDate.getTime()?i.autoLeft:i.left:e.ganttProperties.left)<0&&(t=0),t+"px"},i.prototype.getRightLabelLeft=function(e){var t,i,a=(e=this.templateData).ganttProperties;return e.ganttProperties.isMilestone?e.ganttProperties.left+this.parent.getTaskbarHeight()/2:e.hasChildRecords&&!a.isAutoSchedule?(this.parent.allowUnscheduledTasks?(t=a.left<a.autoLeft?a.autoLeft:a.left,i=a.autoWidth):(t=a.autoStartDate.getTime()<a.startDate.getTime()?a.autoLeft:a.left,i=(a.autoEndDate.getTime()<a.endDate.getTime()?this.parent.dataOperation.getTaskLeft(a.endDate,a.isMilestone):this.parent.dataOperation.getTaskLeft(a.autoEndDate,a.isMilestone))-t),t+i):e.ganttProperties.left+e.ganttProperties.width},i.prototype.getExpandClass=function(e){return e=this.templateData,e.expanded?"e-row-expand":!e.expanded&&e.hasChildRecords?"e-row-collapse":""},i.prototype.getFieldValue=function(e){return t.isNullOrUndefined(e)?"":e},i.prototype.getResourceName=function(e){e=this.templateData;var i=null;if(!t.isNullOrUndefined(e.ganttProperties.resourceInfo)){var a=e.ganttProperties.resourceInfo.length;if(a>0){for(var r=0;r<a;r++){var n=e.ganttProperties.resourceInfo[r][this.parent.resourceFields.name],s=e.ganttProperties.resourceInfo[r][this.parent.resourceFields.unit];100!==s&&(n+="["+s+"%]"),t.isNullOrUndefined(i)?i=n:i+=" , "+n}return i}return""}return""},i.prototype.initChartHelperPrivateVariable=function(){var e=this.parent.renderBaseline?.45:!t.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?.7:.62,i=this.parent.renderBaseline?4:2,a=this.parent.renderBaseline?1.13:.82;if(this.parent.rowHeight=t.isNullOrUndefined(this.parent.rowHeight)?36:this.parent.rowHeight,this.baselineColor=t.isNullOrUndefined(this.parent.baselineColor)||""===this.parent.baselineColor?null:this.parent.baselineColor,this.taskBarHeight=t.isNullOrUndefined(this.parent.taskbarHeight)||this.parent.taskbarHeight>=this.parent.rowHeight?Math.floor(this.parent.rowHeight*e):this.parent.taskbarHeight,this.parent.renderBaseline){var r=void 0;r=this.taskBarHeight+this.baselineHeight<=this.parent.rowHeight?this.taskBarHeight:this.taskBarHeight-(this.baselineHeight+1),this.taskBarHeight=r}this.milestoneHeight=Math.floor(this.taskBarHeight*a),this.taskBarMarginTop=Math.floor((this.parent.rowHeight-this.taskBarHeight)/i),this.milestoneMarginTop=Math.floor((this.parent.rowHeight-this.milestoneHeight)/2),this.milesStoneRadius=Math.floor(this.milestoneHeight/2),this.baselineTop=-(Math.floor(this.parent.rowHeight-(this.taskBarHeight+this.taskBarMarginTop))-4),this.connectorPointWidth=this.parent.isAdaptive?Math.round(this.taskBarHeight/2):9,this.connectorPointMargin=Math.floor(this.taskBarHeight/2-this.connectorPointWidth/1.5)},i.prototype.refreshGanttRows=function(){if(this.parent.currentViewData=this.parent.treeGrid.getCurrentViewRecords().slice(),this.createTaskbarTemplate(),this.parent.showOverAllocation){for(var e=0;e<this.parent.currentViewData.length;e++){var t=this.parent.currentViewData[e];t.childRecords.length>0&&(this.parent.setRecordValue("workTimelineRanges",this.parent.dataOperation.mergeRangeCollections(t.ganttProperties.workTimelineRanges,!0),t.ganttProperties,!0),this.parent.dataOperation.calculateRangeLeftWidth(t.ganttProperties.workTimelineRanges))}this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData)}this.parent.ganttChartModule.updateLastRowBottomWidth()},i.prototype.createTaskbarTemplate=function(){var e,i=this,a=[].slice.call(this.ganttChartTableBody.querySelectorAll("tr"));this.ganttChartTableBody.innerHTML="";var r=[],n=this.parent.treeGridModule.prevCurrentView;if(this.refreshedTr=[],this.refreshedData=[],this.parent.enableImmutableMode&&n&&n.length>0&&this.isUpdated){for(var s={},o=[],l=this.parent.treeGrid.getPrimaryKeyFieldNames()[0],d=0;d<n.length;d++)o[d]=a[d],s[n[d][l]]=d;for(var h=0;h<this.parent.currentViewData.length;h++){var p=s[this.parent.currentViewData[h][l]],u=this.parent.modifiedRecords.indexOf(this.parent.currentViewData[h]);if(t.isNullOrUndefined(p)||-1!==u||this.parent.isFromRenderBaseline){f=this.getGanttChartRow(h,this.parent.currentViewData[h]);this.ganttChartTableBody.appendChild(f),this.refreshedTr.push(this.ganttChartTableBody.querySelectorAll("tr")[h]),this.refreshedData.push(this.parent.currentViewData[h])}else this.ganttChartTableBody.appendChild(o[p]);this.ganttChartTableBody.querySelectorAll("tr")[h].setAttribute("aria-rowindex",(h+1).toString())}}else{for(var c=t.createElement("tbody",{id:this.parent.element.id+"GanttTaskTableBody"}),d=0;d<this.parent.currentViewData.length;d++){var g=this.parent.currentViewData[d];!g.expanded&&this.parent.enableMultiTaskbar&&r.push(g);var f=this.getGanttChartRow(d,g);g.hasChildRecords&&!g.expanded&&this.parent.enableMultiTaskbar&&!this.parent.allowTaskbarOverlap&&this.updateDragDropRecords(g,f),c.appendChild(f),this.parent.enableImmutableMode&&(this.refreshedTr.push(c.querySelectorAll("tr")[d]),this.refreshedData.push(this.parent.currentViewData[d])),this.parent.selectionModule&&this.parent.allowSelection&&this.parent.selectionModule.maintainSelectedRecords(parseInt(f.getAttribute("aria-rowindex"),10)-1)}(e=this.ganttChartTableBody).replaceChildren.apply(e,c.childNodes),this.ganttChartTableBody.childNodes.forEach(function(e){e instanceof Element&&(e.addEventListener("touchmove",i.handleTouchMove),e.addEventListener("touchend",i.handleTouchEnd))}),this.parent.initialChartRowElements=this.parent.ganttChartModule.getChartRows()}if(this.parent.enableCriticalPath&&this.parent.criticalPathModule){var m=this.parent.criticalPathModule;m.criticalPathCollection&&this.parent.criticalPathModule.criticalConnectorLine(m.criticalPathCollection,m.detailPredecessorCollection,!0,m.predecessorCollectionTaskIds)}if(this.parent.renderTemplates(),this.triggerQueryTaskbarInfo(),this.parent.modifiedRecords=[],this.parent.showOverAllocation&&this.updateOverlapped(),r.length)for(var y=0;y<r.length;y++)r[y].hasChildRecords&&(this.parent.isGanttChartRendered=!0,this.parent.chartRowsModule.refreshRecords([r[y]]));this.parent.isGanttChartRendered=!0,this.parent.renderTemplates()},i.prototype.getGanttChartRow=function(e,i){this.templateData=i;var a=this.getTableTrNode(e),r=this.getLeftLabelNode(e),n=this.taskbarContainer();n[0].setAttribute("aria-label",this.generateAriaLabel(this.templateData)),n[0].setAttribute("rowUniqueId",this.templateData.ganttProperties.rowUniqueID);var s,o;if(s=this.getLeftPointNode(),(this.templateData.ganttProperties.isAutoSchedule&&"ProjectView"===this.parent.viewType||!this.templateData.hasChildRecords)&&n[0].appendChild([].slice.call(s)[0]),this.templateData.hasChildRecords){var l=void 0;if(!this.parent.enableMultiTaskbar||this.parent.enableMultiTaskbar&&this.templateData.expanded)l=this.getParentTaskbarNode(e,n);else{n=[];for(f=0;f<this.templateData.childRecords.length;f++){this.templateData=this.templateData.childRecords[f];var d=this.taskbarContainer();d[0].setAttribute("aria-label",this.generateAriaLabel(this.templateData)),d[0].setAttribute("rowUniqueId",this.templateData.ganttProperties.rowUniqueID),this.parent.allowParentDependency?(s=this.getLeftPointNode(),!this.templateData.ganttProperties.isAutoSchedule&&this.templateData.hasChildRecords||d[0].appendChild([].slice.call(s)[0])):(s=this.getLeftPointNode(),d[0].appendChild([].slice.call(s)[0])),this.appendChildTaskbars(i,e,d,o,n)}}if(!this.templateData.ganttProperties.isAutoSchedule){var h=this.getManualTaskbar();if(!t.isNullOrUndefined(h[0])){if(this.parent.allowParentDependency){s=this.getLeftPointNode(),h[0].appendChild([].slice.call(s)[0]);var p=this.getRightPointNode();h[0].appendChild([].slice.call(p)[0])}n[0].appendChild([].slice.call(h)[0])}}if(0!==this.templateData.ganttProperties.autoDuration&&!this.templateData.ganttProperties.isMilestone&&l&&l.length>0)t.append(l,n[0]);else if(0===this.templateData.ganttProperties.duration&&this.templateData.ganttProperties.isMilestone&&this.templateData.ganttProperties.isAutoSchedule){var u=this.getMilestoneNode(e,n);u&&u.length>0&&t.append(u,n[0])}this.parent.renderBaseline&&this.templateData.ganttProperties.baselineStartDate&&this.templateData.ganttProperties.baselineEndDate&&(this.taskBaselineTemplateNode=this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.baselineEndDate.getTime()&&(t.isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate)||t.isNullOrUndefined(this.templateData.ganttProperties.startDate)||this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.startDate.getTime()||t.isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate)||t.isNullOrUndefined(this.templateData.ganttProperties.endDate)||this.templateData.ganttProperties.baselineEndDate.getTime()!==this.templateData.ganttProperties.endDate.getTime()||!this.templateData.ganttProperties.isMilestone)?this.getTaskBaselineNode():this.getMilestoneBaselineNode()),(!this.parent.enableMultiTaskbar||this.parent.enableMultiTaskbar&&this.templateData.expanded)&&(this.parent.allowParentDependency&&(this.templateData.ganttProperties.isAutoSchedule&&"ProjectView"===this.parent.viewType||!this.templateData.hasChildRecords)?(o=this.getRightPointNode(),n[0].appendChild([].slice.call(o)[0])):this.parent.allowParentDependency||(o=this.getRightPointNode(),n[0].appendChild([].slice.call(o)[0])))}else this.appendChildTaskbars(i,e,n,o);var c=this.getRightLabelNode(e);if(this.parent.enableMultiTaskbar&&this.templateData.hasChildRecords&&!this.templateData.expanded){var g=t.createElement("div",{className:"e-collapse-parent"});a[0].childNodes[0].childNodes[0].appendChild(g);for(var f=0;f<n.length;f++)t.addClass([n[f]],"collpse-parent-border"),a[0].childNodes[0].childNodes[0].childNodes[0].appendChild([].slice.call(n)[f]);a[0].childNodes[0].childNodes[0].appendChild([].slice.call(r)[0]),this.templateData.ganttProperties.indicators&&this.templateData.ganttProperties.indicators.length>0&&this.appendIndicators(e,a)}else a[0].childNodes[0].childNodes[0].appendChild([].slice.call(r)[0]),a[0].childNodes[0].childNodes[0].appendChild([].slice.call(n)[0]),this.templateData.ganttProperties.indicators&&this.templateData.ganttProperties.indicators.length>0&&this.appendIndicators(e,a),c&&c.length>0&&a[0].childNodes[0].childNodes[0].appendChild([].slice.call(c)[0]);t.isNullOrUndefined(this.taskBaselineTemplateNode)||a[0].childNodes[0].childNodes[0].appendChild([].slice.call(this.taskBaselineTemplateNode)[0]),this.taskBaselineTemplateNode=null;var m=a[0].childNodes[0];return this.setAriaRowIndex(i,m),m},i.prototype.setAriaRowIndex=function(e,i){var a,r=this,n=this.parent.treeGrid.getCurrentViewRecords(),s=this.parent.virtualScrollModule&&this.parent.enableVirtualization?t.getValue("virtualScrollModule.visualData",this.parent.treeGrid):n;if(this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping){var o=this.parent.treeGrid.grid.contentModule.rows.filter(function(t){if(t.data[r.parent.taskFields.id]===e.ganttProperties.taskId)return t})[0];i.setAttribute("data-rowindex",o.index.toString()),i.setAttribute("aria-rowindex",(o.index+1).toString())}else a=s.indexOf(e),i.setAttribute("aria-rowindex",(a+1).toString())},i.prototype.triggerQueryTaskbarInfo=function(){if(this.parent.queryTaskbarInfo)for(var e,i,a=this.parent.enableImmutableMode?this.refreshedTr.length:this.ganttChartTableBody.querySelectorAll("tr").length,r=0;r<a;r++){e=this.parent.enableImmutableMode?this.refreshedTr[r]:this.ganttChartTableBody.querySelectorAll("tr")[r],i=this.refreshedData.length>0?this.refreshedData[r]:this.parent.currentViewData[r];var n=!t.isNullOrUndefined(i.ganttProperties.segments)&&i.ganttProperties.segments.length;if(n>0)for(var s=0;s<n;s++){var o=e.getElementsByClassName("e-segmented-taskbar")[s];this.triggerQueryTaskbarInfoByIndex(o,i)}else e&&this.triggerQueryTaskbarInfoByIndex(e,i)}},i.prototype.appendIndicators=function(e,i){for(var a,r,n=this.templateData.ganttProperties.indicators,s=0;s<n.length;s++){if((a=this.getIndicatorNode(n[s]))[0].setAttribute("aria-label",n[s].name),n[s].name.indexOf("$")>-1||n[s].name.indexOf("#")>-1)r=this.templateCompiler(n[s].name)(t.extend({index:e},this.templateData),this.parent,"indicatorLabelText");else{var o=t.createElement("Text");o.innerHTML=n[s].name,this.parent.enableHtmlSanitizer&&"string"==typeof n[s].name&&(n[s].name=t.SanitizeHtmlHelper.sanitize(n[s].name)),r=o.childNodes}a[0].appendChild([].slice.call(r)[0]),a[0].title=t.isNullOrUndefined(n[s].tooltip)?"":n[s].tooltip,i[0].childNodes[0].childNodes[0].appendChild([].slice.call(a)[0])}},i.prototype.appendChildTaskbars=function(e,i,a,r,n){if(this.templateData.ganttProperties.isMilestone){var s=this.getMilestoneNode(i,a);s&&s.length>0&&t.append(s,a[0]),this.parent.renderBaseline&&this.templateData.ganttProperties.baselineStartDate&&this.templateData.ganttProperties.baselineEndDate&&(this.taskBaselineTemplateNode=this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.baselineEndDate.getTime()&&(t.isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate)||t.isNullOrUndefined(this.templateData.ganttProperties.startDate)||this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.startDate.getTime()||t.isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate)||t.isNullOrUndefined(this.templateData.ganttProperties.endDate)||this.templateData.ganttProperties.baselineEndDate.getTime()!==this.templateData.ganttProperties.endDate.getTime()||!this.templateData.ganttProperties.isMilestone)?this.getTaskBaselineNode():this.getMilestoneBaselineNode()),n&&(n.push(a[0]),this.templateData=e)}else{var o=m(this.templateData.ganttProperties),l=null,d=null,h=null;if(!t.isNullOrUndefined(o)){(o||this.templateData.ganttProperties.duration)&&o&&(t.isNullOrUndefined(this.templateData.ganttProperties.segments)||this.templateData.ganttProperties.segments.length<=0)&&(l=this.childTaskbarProgressResizer(),h=this.childTaskbarLeftResizer(),d=this.childTaskbarRightResizer());var p=this.getChildTaskbarNode(i,a);if(h&&a[0].appendChild([].slice.call(h)[0]),p&&p.length>0)if(this.templateData.ganttProperties.segments&&this.templateData.ganttProperties.segments.length>0){var u=this.templateData.ganttProperties.segments.length,c=null;c=this.createDivElement('<div class="e-gantt-split-container-line"></div>'),a[0].appendChild([].slice.call(c)[0]);for(var g=0;g<u;g++)t.append(p,a[0])}else t.append(p,a[0]);l&&a[0].appendChild([].slice.call(l)[0]),d&&a[0].appendChild([].slice.call(d)[0])}this.parent.renderBaseline&&this.templateData.ganttProperties.baselineStartDate&&this.templateData.ganttProperties.baselineEndDate&&(this.taskBaselineTemplateNode=this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.baselineEndDate.getTime()&&(t.isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate)||t.isNullOrUndefined(this.templateData.ganttProperties.startDate)||this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.startDate.getTime()||t.isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate)||t.isNullOrUndefined(this.templateData.ganttProperties.endDate)||this.templateData.ganttProperties.baselineEndDate.getTime()!==this.templateData.ganttProperties.endDate.getTime()||!this.templateData.ganttProperties.isMilestone)?this.getTaskBaselineNode():this.getMilestoneBaselineNode())}this.parent.allowParentDependency&&(this.templateData.ganttProperties.isAutoSchedule&&"ProjectView"===this.parent.viewType||!this.templateData.hasChildRecords)?(r=this.getRightPointNode(),a[0].appendChild([].slice.call(r)[0])):this.parent.allowParentDependency||(r=this.getRightPointNode(),a[0].appendChild([].slice.call(r)[0])),n&&(n.push(a[0]),this.templateData=e)},i.prototype.customizeTaskbars=function(e,i,a){var r,n=this;e.ganttProperties.segments&&e.ganttProperties.segments.length>0&&i&&i.parentElement&&i.parentElement.parentElement&&i.parentElement.parentElement.parentElement&&(r=i.parentElement.parentElement.parentElement);var s={data:e,rowElement:i,taskbarElement:a,taskbarType:e.hasChildRecords?"ParentTask":e.ganttProperties.isMilestone?"Milestone":"ChildTask"},o=this.getClassName(s);if("Milestone"===s.taskbarType)s.milestoneColor=a.querySelector(o[0])?getComputedStyle(a.querySelector(o[0])).backgroundColor:null,s.baselineColor=i.querySelector(o[1])?getComputedStyle(i.querySelector(o[1])).backgroundColor:i.querySelector("."+B)?getComputedStyle(i.querySelector("."+B)).backgroundColor:null;else if(a){var l=a.querySelector(o[0]),d=a.querySelector(o[1]);s.taskbarBgColor=t.isNullOrUndefined(l)?null:a.classList.contains(H)?getComputedStyle(a).backgroundColor:getComputedStyle(a.querySelector(o[0])).backgroundColor,s.taskbarBorderColor=t.isNullOrUndefined(l)?null:a.classList.contains(H)?getComputedStyle(a).backgroundColor:getComputedStyle(a.querySelector(o[0])).outlineColor,s.progressBarBgColor=t.isNullOrUndefined(d)?null:a.classList.contains("e-gantt-child-progressbar")?getComputedStyle(a).backgroundColor:getComputedStyle(a.querySelector(o[1])).backgroundColor,s.baselineColor=r?r.querySelector("."+B)?getComputedStyle(r.querySelector("."+B)).backgroundColor:null:i.querySelector("."+B)?getComputedStyle(i.querySelector("."+B)).backgroundColor:null,s.taskLabelColor=a.querySelector("."+L)?getComputedStyle(a.querySelector("."+L)).color:null}r?(s.rightLabelColor=r.querySelector("."+U)&&r.querySelector("."+U).querySelector("."+z)?getComputedStyle(r.querySelector("."+U).querySelector("."+z)).color:null,s.leftLabelColor=r.querySelector("."+F)&&r.querySelector("."+F).querySelector("."+z)?getComputedStyle(r.querySelector("."+F).querySelector("."+z)).color:null):(s.rightLabelColor=i.querySelector("."+U)&&i.querySelector("."+U).querySelector("."+z)?getComputedStyle(i.querySelector("."+U).querySelector("."+z)).color:null,s.leftLabelColor=i.querySelector("."+F)&&i.querySelector("."+F).querySelector("."+z)?getComputedStyle(i.querySelector("."+F).querySelector("."+z)).color:null),this.parent.trigger("queryTaskbarInfo",s,function(e){n.updateQueryTaskbarInfoArgs(e,void 0,void 0)})},i.prototype.triggerQueryTaskbarInfoByIndex=function(e,i){if(!t.isNullOrUndefined(e)){var a,r=i;if(!t.isNullOrUndefined(i.ganttProperties.segments)&&i.ganttProperties.segments.length>0)a=e,e&&this.customizeTaskbars(i,e,a);else if(this.parent.enableMultiTaskbar)for(var n=e.querySelectorAll("."+N),s=0;s<n.length;s++){a=n[s],r=!i.expanded&&i.hasChildRecords?i.childRecords[s]:r;var o="ResourceView"===this.parent.viewType?a.getAttribute("rowUniqueId"):r.ganttProperties.taskId.toString();if(r.ganttProperties.segments&&r.ganttProperties.segments.length>0&&r.parentItem&&!i.expanded&&(o="ResourceView"===this.parent.viewType?i.ganttProperties.rowUniqueID:i.ganttProperties.taskId.toString()),e=this.parent.getRowByID(o),e=e||a.querySelector(".e-gantt-child-taskbar"),t.isNullOrUndefined(e)&&r.ganttProperties.isMilestone&&(e=a),e){var l=e.querySelectorAll(".e-segmented-taskbar");if(l&&l.length>0)for(var d=(e.querySelector('.e-taskbar-main-container[rowuniqueid="'+r.ganttProperties.rowUniqueID+'"]')||e).querySelectorAll(".e-segmented-taskbar"),h=0;h<d.length;h++)a=d[h],this.customizeTaskbars(r,d[h],a);else this.customizeTaskbars(r,e,a)}}else{var p=e.querySelector("."+N);e&&this.customizeTaskbars(r,e,p)}}},i.prototype.updateQueryTaskbarInfoArgs=function(e,t,i){var a,r=e.rowElement,n=this.parent.enableVirtualization?e.rowElement:e.taskbarElement,s=this.getClassName(e);e.data.ganttProperties.segments&&e.data.ganttProperties.segments.length>0&&(a=r.parentElement.parentElement.parentElement),"Milestone"===e.taskbarType?(n.querySelector(s[0])&&getComputedStyle(n.querySelector(s[0])).backgroundColor!==e.milestoneColor&&(n.querySelector(s[0]).style.backgroundColor=e.milestoneColor),r.querySelector(s[1])&&getComputedStyle(r.querySelector(s[1])).backgroundColor!==e.baselineColor&&(r.querySelector(s[1]).style.backgroundColor=e.baselineColor),r.querySelector("."+B)&&getComputedStyle(r.querySelector("."+B)).borderTopColor!==e.baselineColor&&(r.querySelector("."+B).style.backgroundColor=e.baselineColor)):n&&(n.querySelector(s[0])&&getComputedStyle(n.querySelector(s[0])).backgroundColor!==e.taskbarBgColor&&(n.querySelector(s[0]).style.backgroundColor=e.taskbarBgColor),n.querySelector(s[0])&&getComputedStyle(n.querySelector(s[0])).outlineColor!==e.taskbarBorderColor&&(n.querySelector(s[0]).style.outlineColor=e.taskbarBorderColor),n.querySelector(s[1])&&getComputedStyle(n.querySelector(s[1])).backgroundColor!==e.progressBarBgColor&&(n.querySelector(s[1]).style.backgroundColor=e.progressBarBgColor),n.classList.contains(H)&&getComputedStyle(n).backgroundColor!==e.taskbarBgColor&&(n.style.backgroundColor=e.taskbarBgColor),n.classList.contains(H)&&getComputedStyle(n).outlineColor!==e.taskbarBorderColor&&(n.style.outlineColor=e.taskbarBorderColor),n.classList.contains("e-gantt-child-progressbar")&&getComputedStyle(n).backgroundColor!==e.progressBarBgColor&&(n.style.backgroundColor=e.progressBarBgColor),n.querySelector("."+L)&&getComputedStyle(n.querySelector("."+L)).color!==e.taskLabelColor&&(n.querySelector("."+L).style.color=e.taskLabelColor),a?a.querySelector("."+B)&&getComputedStyle(a.querySelector("."+B)).backgroundColor!==e.baselineColor&&(a.querySelector("."+B).style.backgroundColor=e.baselineColor):r.querySelector("."+B)&&getComputedStyle(r.querySelector("."+B)).backgroundColor!==e.baselineColor&&(r.querySelector("."+B).style.backgroundColor=e.baselineColor)),a?(a.querySelector("."+F)&&a.querySelector("."+F).querySelector("."+z)&&getComputedStyle(a.querySelector("."+F).querySelector("."+z)).color!==e.leftLabelColor&&(a.querySelector("."+F).querySelector("."+z).style.color=e.leftLabelColor),a.querySelector("."+U)&&a.querySelector("."+U).querySelector("."+z)&&getComputedStyle(a.querySelector("."+U).querySelector("."+z)).color!==e.rightLabelColor&&(a.querySelector("."+U).querySelector("."+z).style.color=e.rightLabelColor)):(r.querySelector("."+F)&&r.querySelector("."+F).querySelector("."+z)&&getComputedStyle(r.querySelector("."+F).querySelector("."+z)).color!==e.leftLabelColor&&(r.querySelector("."+F).querySelector("."+z).style.color=e.leftLabelColor),r.querySelector("."+U)&&r.querySelector("."+U).querySelector("."+z)&&getComputedStyle(r.querySelector("."+U).querySelector("."+z)).color!==e.rightLabelColor&&(r.querySelector("."+U).querySelector("."+z).style.color=e.rightLabelColor))},i.prototype.getClassName=function(e){var t=[];return t.push("."+("ParentTask"===e.taskbarType?"e-gantt-parent-taskbar":"ChildTask"===e.taskbarType?H:"e-gantt-milestone")),t.push("."+("ParentTask"===e.taskbarType?"e-gantt-parent-progressbar":"ChildTask"===e.taskbarType?"e-gantt-child-progressbar":"e-baseline-gantt-milestone-container")),t},i.prototype.templateCompiler=function(e){if(!t.isNullOrUndefined(e)&&""!==e)try{return"function"!=typeof e&&document.querySelectorAll(e).length?t.compile(document.querySelector(e).innerHTML.trim(),this.parent):t.compile(e,this.parent)}catch(i){return t.compile(e,this.parent)}return null},i.prototype.updateOverlapped=function(){for(var e=0;e<this.parent.treeGrid.parentData.length;e++)for(var i=this.parent.treeGrid.parentData[e].childRecords,a=0;a<i.length;a++){i[a+1]&&(i[a].ganttProperties.eOverlapped=void 0);for(var r=a+1;r<i.length;r++)i[r].ganttProperties.eOverlapped=void 0,i[a].ganttProperties.startDate.getTime()<i[r].ganttProperties.endDate.getTime()&&i[a].ganttProperties.endDate.getTime()>i[r].ganttProperties.startDate.getTime()?(i[r].ganttProperties.eOverlapped=!0,i[a].ganttProperties.eOverlapped=!0):(t.isNullOrUndefined(i[r].ganttProperties.eOverlapped)&&(i[r].ganttProperties.eOverlapped=!1),t.isNullOrUndefined(i[a].ganttProperties.eOverlapped)&&(i[a].ganttProperties.eOverlapped=!1))}},i.prototype.updateDragDropRecords=function(e,t){var i=e.childRecords,a=this.parent.currentViewData.indexOf(e),r=this.parent.enableRtl?this.parent.element.getElementsByClassName("e-content")[2].children[0].offsetHeight:this.parent.element.getElementsByClassName("e-content")[0].children[0].offsetHeight;t||(t=this.ganttChartTableBody.childNodes[a]),this.parent.ganttChartModule.isExpandAll||this.parent.ganttChartModule.isCollapseAll?t.style.height=this.parent.treeGrid.getRowByIndex(a).style.height=this.parent.rowHeight+"px":t.style.height=this.parent.treeGrid.getRows()[a].style.height=this.parent.rowHeight+"px",this.parent.contentHeight=r;var n=[],s=0;if(e){for(var o=0;o<i.length;o++)for(var l=o+1;l<i.length;l++)for(var d=t.getElementsByClassName("e-taskbar-main-container"),h=0;h<d.length;h++){var p="ResourceView"===this.parent.viewType?i[l].rowUniqueID:i[l].ganttProperties.rowUniqueID;i[o].ganttProperties.startDate.getTime()<i[l].ganttProperties.endDate.getTime()&&i[o].ganttProperties.endDate.getTime()>i[l].ganttProperties.startDate.getTime()?d[h].getAttribute("rowuniqueid")===p&&-1===n.indexOf(p)&&(n.push(p),s++,t.children[0].style.verticalAlign="baseline",t.getElementsByClassName("e-taskbar-main-container")[h].style.marginTop=s*this.parent.rowHeight+this.taskBarMarginTop+"px",this.parent.ganttChartModule.isExpandAll||this.parent.ganttChartModule.isCollapseAll?t.style.height=this.parent.treeGrid.getRowByIndex(a).style.height=parseInt(t.style.height,10)+this.parent.rowHeight+"px":t.style.height=this.parent.treeGrid.getRows()[a].style.height=parseInt(t.style.height,10)+this.parent.rowHeight+"px"):d[h].getAttribute("rowuniqueid")===p&&-1===n.indexOf(p)&&this.parent.rowDragAndDropModule&&this.parent.rowDragAndDropModule.draggedRecord&&d[h].getAttribute("rowuniqueid")===this.parent.rowDragAndDropModule.draggedRecord.rowUniqueID&&this.parent.rowDragAndDropModule.draggedRecord.rowUniqueID===i[l].rowUniqueID&&(t.getElementsByClassName("e-taskbar-main-container")[h].style.marginTop=this.parent.editModule.taskbarEditModule.draggedRecordMarginTop)}this.parent.contentHeight=this.parent.enableRtl?this.parent.element.getElementsByClassName("e-content")[2].children[0].offsetHeight:this.parent.element.getElementsByClassName("e-content")[0].children[0].offsetHeight,document.getElementsByClassName("e-chart-rows-container")[0].style.height=this.parent.contentHeight+"px"}},i.prototype.refreshRow=function(e,i,a){var r,n=this,s=this.ganttChartTableBody.childNodes[e];if(r=a?this.parent.previousFlatData[e]:this.parent.currentViewData[e],-1!==e&&r){var o=r;if(!this.parent.allowTaskbarOverlap&&o.expanded&&(this.parent.ganttChartModule.isExpandAll||this.parent.ganttChartModule.isCollapseAll?s.style.height=this.parent.treeGrid.getRowByIndex(e).style.height=this.parent.rowHeight+"px":s.style.height=this.parent.treeGrid.getRows()[e].style.height=this.parent.rowHeight+"px"),o.hasChildRecords&&!o.expanded&&this.parent.enableMultiTaskbar)s.replaceChild(this.getGanttChartRow(e,o).childNodes[0],s.childNodes[0]),this.parent.renderBaseline&&o.childRecords.forEach(function(e){t.isNullOrUndefined(e.ganttProperties.baselineStartDate&&e.ganttProperties.baselineEndDate)||s.childNodes[0].appendChild(n.updateTaskBaselineNode(e)[0])});else if(this.parent.allowTaskbarDragAndDrop&&!o.expanded)s.replaceWith(this.getGanttChartRow(e,o));else if(s.replaceChild(this.getGanttChartRow(e,o).childNodes[0],s.childNodes[0]),this.parent.enableMultiTaskbar&&o.parentItem){var l=o.parentItem.taskId,d=this.parent.getRecordByID(l);if(!d.expanded){var h=this.parent.getRowByID(l);h.replaceChild(this.getGanttChartRow(Number(l),d).childNodes[0],h.childNodes[0])}}if(this.parent.renderTemplates(),this.parent.showOverAllocation&&this.parent.allowTaskbarOverlap&&(o.hasChildRecords||o.parentItem&&this.parent.editedRecords.every(function(e){return e.ganttProperties.taskId.toString()!==o.parentItem.taskId.toString()})))if(i)this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData);else{var p=o.hasChildRecords?o:this.parent.getRecordByID(o.parentItem.taskId);this.parent.dataOperation.updateOverlappingValues(p),this.parent.ganttChartModule.renderRangeContainer([p])}var u=!t.isNullOrUndefined(o.ganttProperties.segments)&&o.ganttProperties.segments.length;if(u>0)for(var c=0;c<u;c++){var g=s.getElementsByClassName("e-segmented-taskbar")[c];this.triggerQueryTaskbarInfoByIndex(g,o)}else if(this.triggerQueryTaskbarInfoByIndex(s,o),this.parent.enableMultiTaskbar&&o.parentItem&&this.parent.queryTaskbarInfo&&!this.parent.getParentTask(o.parentItem).expanded){var f=o.parentItem.index,m=void 0;m=a?this.parent.previousFlatData[f]:this.parent.currentViewData[f],this.triggerQueryTaskbarInfoByIndex(this.ganttChartTableBody.querySelectorAll("tr")[f],m)}var y="ProjectView"===this.parent.viewType?o.ganttProperties.taskId:o.ganttProperties.rowUniqueID;this.parent.ganttChartModule.isExpandAll||this.parent.ganttChartModule.isCollapseAll||this.parent.treeGrid.grid.setRowData(y,o),o.hasChildRecords&&!o.expanded&&this.parent.enableMultiTaskbar&&!this.parent.allowTaskbarOverlap&&this.updateDragDropRecords(r,s),o.hasChildRecords&&this.parent.showOverAllocation&&!this.parent.allowTaskbarOverlap&&(this.parent.dataOperation.updateOverlappingValues(o),this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData));var D=this.parent.ganttChartModule.tempNextElement;this.parent.ganttChartModule.isEditableElement&&D&&(this.parent.treeGrid.grid.focusModule.focus(),t.addClass([this.parent.treeGrid.getRows()[parseInt(s.getAttribute("aria-rowindex"),10)-1].children[this.parent.ganttChartModule.childrenIndex]],"e-focused"),this.parent.ganttChartModule.tempNextElement=null);var v=this.parent.treeGrid.grid.getRowObjectFromUID(this.parent.treeGrid.grid.getDataRows()[e].getAttribute("data-uid"));t.isNullOrUndefined(v)||(v.data=o)}},i.prototype.updateResourceTaskbarElement=function(e,i){var a=e.querySelector(".e-taskbar-main-container");"ProjectView"===this.parent.viewType&&e.querySelector(".e-collapse-parent")&&(a=e.querySelector(".e-collapse-parent")),null===e.querySelector(".e-collapse-parent")&&t.addClass([a],"collpse-parent-border");var r=e.querySelector("."+N).getAttribute("rowUniqueId"),n=this.parent.getRecordByID(r);if(!t.isNullOrUndefined(n)&&n.ganttProperties.segments&&n.ganttProperties.segments.length>0)for(var s=a.getElementsByClassName("e-segmented-taskbar"),o=0;o<s.length;o++)this.triggerQueryTaskbarInfoByIndex(s[o],n);else if(this.parent.queryTaskbarInfo){var l=a.querySelector(".e-gantt-child-taskbar");t.isNullOrUndefined(l)||this.triggerQueryTaskbarInfoByIndex(l,n)}var d="";n&&!t.isNullOrUndefined(n.ganttProperties.eOverlapIndex)&&(d=n.ganttProperties.eOverlapIndex.toString());var h=a.cloneNode(!0);h.style.zIndex=d,i[0].childNodes[0].childNodes[0].childNodes[0].appendChild(h)},i.prototype.refreshRecords=function(e,t,i){if(this.parent.isGanttChartRendered){if(this.parent.renderTemplates(),this.parent.enableMultiTaskbar){e=new a.DataManager(e).executeLocal((new a.Query).sortBy("expanded","Descending"))}for(var r=0;r<e.length;r++){var n=void 0;n=i?this.parent.ids.indexOf(e[r].ganttProperties.taskId.toString()):this.parent.currentViewData.indexOf(e[r]),this.parent.enableMultiTaskbar&&(!this.parent.enableMultiTaskbar||!e[r].expanded&&this.parent.isLoad)||this.refreshRow(n,t,i)}this.parent.ganttChartModule.updateLastRowBottomWidth()}},i.prototype.removeEventListener=function(){var e=this;this.parent.isDestroyed||(this.ganttChartTableBody.childNodes.forEach(function(t){t instanceof Element&&(t.removeEventListener("touchmove",e.handleTouchMove),t.removeEventListener("touchend",e.handleTouchEnd))}),this.parent.off("renderPanels",this.createChartTable),this.parent.off("dataReady",this.initiateTemplates),this.parent.off("destroy",this.destroy))},i.prototype.destroy=function(){this.removeEventListener()},i.prototype.generateAriaLabel=function(e){e=this.templateData;var t="",i=this.parent.localeObj.getConstant("name"),a=this.parent.localeObj.getConstant("startDate"),r=this.parent.localeObj.getConstant("endDate"),n=this.parent.localeObj.getConstant("duration"),s=e.ganttProperties.taskName,o=e.ganttProperties.startDate,l=e.ganttProperties.endDate,d=e.ganttProperties.duration;return e.ganttProperties.isMilestone?t=i+" "+s+" "+a+" "+this.parent.getFormatedDate(o):(s&&(t+=i+" "+s+" "),o&&(t+=a+" "+this.parent.getFormatedDate(o)+" "),l&&(t+=r+" "+this.parent.getFormatedDate(l)+" "),d&&(t+=n+" "+this.parent.getDurationString(d,e.ganttProperties.durationUnit))),t},i.prototype.generateBaselineAriaLabel=function(e){e=this.templateData;var t="",i=this.parent.localeObj.getConstant("name"),a=this.parent.localeObj.getConstant("startDate"),r=this.parent.localeObj.getConstant("endDate"),n=e.ganttProperties.taskName,s=e.ganttProperties.baselineStartDate,o=e.ganttProperties.baselineEndDate;return t+="Baseline ",t+=i+" "+n+" ",t+=a+" "+this.parent.getFormatedDate(s)+" ",t+=r+" "+this.parent.getFormatedDate(o)+" "},i.prototype.generateSpiltTaskAriaLabel=function(e,t){var i="",a=this.parent.localeObj.getConstant("startDate"),r=this.parent.localeObj.getConstant("endDate"),n=this.parent.localeObj.getConstant("duration"),s=e.startDate,o=e.endDate,l=e.duration;return s&&(i+=a+" "+this.parent.getFormatedDate(s)+" "),o&&(i+=r+" "+this.parent.getFormatedDate(o)+" "),l&&(i+=n+" "+this.parent.getDurationString(l,t.durationUnit)),i},i.prototype.generateTaskLabelAriaLabel=function(e){var t="";return"left"===e&&this.parent.labelSettings.leftLabel&&!this.leftTaskLabelTemplateFunction?t+=this.parent.localeObj.getConstant("leftTaskLabel")+" "+this.getTaskLabel(this.parent.labelSettings.leftLabel):"right"===e&&this.parent.labelSettings.rightLabel&&!this.rightTaskLabelTemplateFunction&&(t+=this.parent.localeObj.getConstant("rightTaskLabel")+" "+this.getTaskLabel(this.parent.labelSettings.rightLabel)),t},i}(O),st=function(){function i(e){this.parentRecord=[],this.parentIds=[],this.parentPredecessors=[],this.validatedParentIds=[],this.storeId=null,this.isChildRecordValidated=[],this.parent=e,this.dateValidateModule=this.parent.dateValidationModule}return i.prototype.ensurePredecessorCollection=function(){var e=this.parent.predecessorsCollection,t=this.parent.flatData,i=new Map;if(null!=t)for(var a=0,r=t;a<r.length;a++){var n=r[a];i.set(n.ganttProperties.rowUniqueID.toString(),n)}for(var s=0,o=e;s<o.length;s++){var l=o[s];(!l.hasChildRecords&&!this.parent.allowParentDependency||this.parent.allowParentDependency)&&this.ensurePredecessorCollectionHelper(l,l.ganttProperties,i)}},i.prototype.ensurePredecessorCollectionHelper=function(e,i,a){void 0===a&&(a=null);var r=i.predecessorsName;if(!r||"string"!=typeof r&&"number"!=typeof r){if(r&&"object"==typeof r&&r.length){for(var n=[],s=0;s<r.length;s++){var o=r[s],l={};l.from=t.getValue("from",o)?t.getValue("from",o):r[s],l.to=t.getValue("to",o)?t.getValue("to",o):i.rowUniqueID,l.type=t.getValue("type",o)?t.getValue("type",o):"FS";var d=t.getValue("offset",o);if(t.isNullOrUndefined(d))l.offset=0,t.isNullOrUndefined(this.parent.durationUnit)||(l.offsetUnit=this.parent.durationUnit.toLocaleLowerCase());else if("string"==typeof d){var h=this.getOffsetDurationUnit(t.getValue("offset",o));l.offset=h.duration,l.offsetUnit=h.durationUnit}else l.offset=parseFloat(d.toString()),t.isNullOrUndefined(this.parent.durationUnit)||(l.offsetUnit=this.parent.durationUnit.toLocaleLowerCase());this.checkIsParent(l.from.toString())||n.push(l)}this.parent.setRecordValue("predecessor",n,i,!0)}}else this.parent.setRecordValue("predecessor",this.calculatePredecessor(r,e,a),i,!0);this.parent.setRecordValue("predecessorsName",this.getPredecessorStringValue(e),i,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,i.predecessorsName,e),this.parent.setRecordValue(this.parent.taskFields.dependency,i.predecessorsName,e)},i.prototype.updateUnscheduledDependency=function(e){for(var i=this.parent.taskFields,a=t.isNullOrUndefined(e[i.dependency])?[]:e[i.dependency].toString().split(","),r=0;r<a.length;r++){var n=parseInt(a[r],10);if(!isNaN(n)){var s=this.parent.connectorLineModule.getRecordByID(n.toString()),o=t.isNullOrUndefined(s)?null:t.extend({},{},s.taskData,!0);if(!t.isNullOrUndefined(o)&&t.isNullOrUndefined(o[i.startDate])&&t.isNullOrUndefined(o[i.duration])&&t.isNullOrUndefined(o[i.endDate])){o[i.duration]=1;var l=void 0;if(s.parentItem){for(var d=this.parent.getParentTask(s.parentItem);d&&!d.ganttProperties.startDate;)d=this.parent.getParentTask(d.parentItem);l=d?d.ganttProperties.startDate:this.parent.cloneProjectStartDate}else l=this.parent.cloneProjectStartDate;o[i.startDate]=l,this.parent.updateRecordByID(o)}}}},i.prototype.checkIsParent=function(e){var t=!1;return this.parent.connectorLineModule.getRecordByID(e).hasChildRecords&&(t=!0),t},i.prototype.getRootParent=function(e){var t=e;return e.parentItem?((t=this.parent.flatData.filter(function(t){return t.uniqueID===e.parentUniqueID})[0]).parentItem&&(t=this.getRootParent(t)),t):t},i.prototype.validateParentPredecessor=function(e,t){if(e&&t)if(t.hasChildRecords&&!e.hasChildRecords){if(e.parentUniqueID===t.uniqueID)return!1;do{if(e.parentItem&&(e=this.parent.flatData[this.parent.ids.indexOf(e.parentItem.taskId)]).uniqueID===t.uniqueID)return!1}while(e.parentItem)}else if(!t.hasChildRecords&&e.hasChildRecords){if(t.parentUniqueID===e.uniqueID)return!1;do{if(t.parentItem&&(t=this.parent.flatData[this.parent.ids.indexOf(t.parentItem.taskId)]).uniqueID===e.uniqueID)return!1}while(t.parentItem)}else if(t.hasChildRecords&&e.hasChildRecords)if(t.parentItem&&e.parentItem){if(e.parentUniqueID===t.uniqueID||e.uniqueID===t.parentUniqueID)return!1}else if(!t.parentItem&&e.parentItem){if(this.getRootParent(e).uniqueID===t.uniqueID)return!1}else if(t.parentItem&&!e.parentItem&&this.getRootParent(t).uniqueID===e.uniqueID)return!1;return!0},i.prototype.calculatePredecessor=function(e,i,a){var r=this;void 0===a&&(a=null);var n,s,o,l=[],d=[],h=[];e.toString().split(",").forEach(function(e){var p,u,c,g=!1,f=!1,m=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,y=e.split("-");if(6===y.length&&(y[4]=y[4]+"-"+y[5],y.pop()),5===y.length&&y[4].length>=12&&(c=e.substring(0,36),m.test(c)&&(g=!0)),e.includes("-")){var D=e.lastIndexOf("-"),v=e.substring(D+1),k=e.replace(v,"").trim().match(/(FS|SS|SF|FF)-$/),b=(k?k[0]:"")+v;if(!/^(FS|SS|SF|FF)/.test(b)){var w=b.match(/(FS|SS|SF|FF)/);b=w?w[0]+b.slice(b.indexOf(w[0])+w[0].length):e}if(u=b,e.includes("-")&&/[A-Za-z]/.test(u)){var T=e.indexOf(u);-1!==T&&(p=e.substring(0,T)).includes("-")&&(f=!0)}}if(g){var S=void 0,P=void 0;1===(S=y[4].split("+")).length?d[0]=e:(P=S[1].length,d[0]=e.slice(0,-(P+1)),d[1]=S[1]),s="+",y[4].indexOf("-")>=0&&(1===(S=y[4].split("-")).length?d[0]=e:(P=S[1].length,d[0]=e.slice(0,-(P+1)),d[1]=S[1]),s="-")}else f&&p.includes("-")?d[0]=p:(d=e.split("+"),s="+",e.indexOf("-")>=0&&(d=e.split("-"),s="-"));n=[];var C="ResourceView"===r.parent.viewType?r.parent.getTaskIds():r.parent.ids;-1!==("ResourceView"===r.parent.viewType?C.indexOf("T"+d[0]):C.indexOf(d[0]))?n[0]=d[0]:-1===C.indexOf(d[0])?1===(n=d[0].split(" ")).length&&(-1!==n[0].indexOf(" ")?n=d[0].match(/(\d+|[A-z]+)/g):(n[0]=d[0].slice(0,-2),n[1]=d[0].slice(-2))):n[0]=d[0];var R="ResourceView"===r.parent.viewType?C.indexOf("T"+n[0]):C.indexOf(n[0]);if(n[0]&&-1!==R){if(n.length>1)if("FS"===(x=n[1].toUpperCase())||"FF"===x||"SF"===x||"SS"===x)o=x;else{var M="The provided dependency type, "+x+", is invalid. Please ensure that the Dependency Type is FS or FF or SS or SF";r.parent.trigger("actionFailure",{error:M}),o="FS"}else if(e.includes("-")&&/[A-Za-z]/.test(u)&&p.includes("-")){var x=e.slice(-2).toString();x.toUpperCase(),o="FS"===x||"FF"===x||"SF"===x||"SS"===x?x:"FS"}else o="FS";var O=d.length>1?s+""+d[1]:"0",I=r.getOffsetDurationUnit(O),E={from:n[0],type:o,isDrawn:!1,to:"ResourceView"===r.parent.viewType?i.ganttProperties.taskId.toString():i.ganttProperties.rowUniqueID.toString(),offsetUnit:I.durationUnit,offset:I.duration},F=r.checkIsParent(n[0]);if(r.parent.allowParentDependency){var U=null,N=null;"ProjectView"===r.parent.viewType&&!t.isNullOrUndefined(a)&&a.size>0?(U=a.get(E.from),N=a.get(E.to)):(U=r.parent.connectorLineModule.getRecordByID(E.from),N=r.parent.connectorLineModule.getRecordByID(E.to));N&&U?r.validateParentPredecessor(U,N)&&(l.push(E),-1===h.indexOf(U)&&U.hasChildRecords&&r.parent.editModule&&r.parent.editModule.cellEditModule&&r.parent.editModule.cellEditModule.isCellEdit&&h.push(t.extend([],[],[U],!0)[0])):l.push(E),n.splice(0)}else F||l.push(E)}}),h.length>0&&this.parent.undoRedoModule&&this.parent.editModule&&this.parent.editModule.cellEditModule&&this.parent.editModule.cellEditModule.isCellEdit&&(this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1].connectedRecords=h);var p=[];return l.map(function(e){var t=e.from,i=e.to,a=[];a=l.filter(function(e){return e.from===t&&e.to===i}),-1===p.indexOf(a[a.length-1])&&p.push(a[a.length-1])}),p},i.prototype.getPredecessorStringValue=function(e){var t,i=e.ganttProperties.predecessor,a="",r=[];if(i)for(var n=i.length,s=0;s<n;s++){var o=i[s],l="",d="ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;if(o.from!==d.toString()){if(l=o.from+o.type,"string"==typeof e.ganttProperties.taskId?(r[0]=l.slice(0,-2),r[1]=l.slice(-2),t=r[0]+" "+r[1]):t=l,l=t,0!==o.offset){l+=o.offset>0?"+"+o.offset+" ":o.offset+" ";var h=1!==o.offset;"day"===o.offsetUnit?l+=h?this.parent.localeObj.getConstant("days"):this.parent.localeObj.getConstant("day"):"hour"===o.offsetUnit?l+=h?this.parent.localeObj.getConstant("hours"):this.parent.localeObj.getConstant("hour"):l+=h?this.parent.localeObj.getConstant("minutes"):this.parent.localeObj.getConstant("minute")}a=a.length>0?a+","+l:l}}return a},i.prototype.getOffsetDurationUnit=function(e){var i,a=0;t.isNullOrUndefined(this.parent.durationUnit)||(i=this.parent.durationUnit.toLocaleLowerCase());var r=this.parent.durationUnitEditText;if("string"==typeof e){for(var n=e.match(/[^0-9]+|[0-9]+/g),s=0;s<n.length;s++)n[s]=n[s].trim();"-"===n[0]&&n[1]?(n[1]=n[0]+n[1],n.shift()):"+"===n[0]&&n.shift(),"."!==n[1]||isNaN(parseInt(n[2],10))||(n[0]+=n[1]+n[2],n.splice(1,2)),n&&n.length<=2&&(a=parseFloat(n[0]),i=n[1]?n[1].toLowerCase().trim():"",-1!==t.getValue("minute",r).indexOf(i)?i="minute":-1!==t.getValue("hour",r).indexOf(i)?i="hour":-1!==t.getValue("day",r).indexOf(i)?i="day":t.isNullOrUndefined(this.parent.durationUnit)||(i=this.parent.durationUnit.toLocaleLowerCase()))}else a=e,t.isNullOrUndefined(this.parent.durationUnit)||(i=this.parent.durationUnit.toLocaleLowerCase());if(isNaN(a)){this.parent.trigger("actionFailure",{error:"The provided value for the offset field is invalid.Please ensure the offset field contains only valid numeric values"}),a=0,t.isNullOrUndefined(this.parent.durationUnit)||(i=this.parent.durationUnit.toLocaleLowerCase())}return{duration:a,durationUnit:i}},i.prototype.updatePredecessors=function(e){void 0===e&&(e=null);for(var t,i=this.parent.predecessorsCollection,a=i.length,r=0;r<a;r++)(!(t=i[r]).hasChildRecords&&!this.parent.allowParentDependency||this.parent.allowParentDependency)&&(this.updatePredecessorHelper(t,i,e),!t.ganttProperties.isAutoSchedule&&this.parent.editSettings.allowEditing&&(this.parent.connectorLineEditModule.validatedOffsetIds=[],this.parent.connectorLineEditModule.calculateOffset(t)))},i.prototype.updatePredecessorHelper=function(e,i,a){void 0===a&&(a=null);var r,n=e.ganttProperties.predecessor,s=n.length;i=t.isNullOrUndefined(i)?[]:i;for(var o=0;o<s;o++){var l=n[o];r="ProjectView"!==this.parent.viewType||t.isNullOrUndefined(a)?this.parent.connectorLineModule.getRecordByID(l.from):a.get(l.from);var d="ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;if(l.from!==d.toString()&&r){var h=void 0;r.ganttProperties.predecessor?((h=t.extend([],r.ganttProperties.predecessor,[],!0)).push(l),this.parent.setRecordValue("predecessor",h,r.ganttProperties,!0)):((h=[]).push(l),this.parent.setRecordValue("predecessor",h,r.ganttProperties,!0),i.push(r))}}},i.prototype.traverseParents=function(e,t){this.parent.dataOperation.updateParentItems(e,t)},i.prototype.updatedRecordsDateByPredecessor=function(e){if(void 0===e&&(e=null),this.parent.autoCalculateDateScheduling&&!(this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)){var i=this.parent.flatData,a=i.length;if(t.isNullOrUndefined(e)){e=new Map;for(var r=0,n=i;r<n.length;r++){var s=n[r];e.set(s.ganttProperties.rowUniqueID.toString(),s)}}for(var o=0;o<a;o++){var l=i[o],d=l.ganttProperties;if(d.predecessorsName){this.validatePredecessorDates(l,e),l.hasChildRecords&&d.startDate&&this.parent.allowParentDependency&&this.updateChildItems(l);var h=d.predecessor;if(h&&h.length>1)for(var p=0,u=h;p<u.length;p++){var c=u[p],g=void 0;(g="ProjectView"===this.parent.viewType?e.get(c.to):this.parent.connectorLineModule.getRecordByID(c.to))&&this.validatePredecessorDates(g,e)}if(l.parentItem){var f=l.parentItem.taskId,m=void 0;(m="ProjectView"===this.parent.viewType?e.get(f):this.parent.getRecordByID(f))&&this.traverseParents(m,!0)}}}}},i.prototype.updateParentPredecessor=function(e){if(void 0===e&&(e=null),this.parent.enablePredecessorValidation)for(var t=this.parentPredecessors.length-1;t>=0;t--){var i=this.parentPredecessors[t];this.validatePredecessorDates(i,e),i.ganttProperties.startDate&&this.updateChildItems(i)}},i.prototype.validatePredecessorDates=function(e,i){if(void 0===i&&(i=null),e.ganttProperties.predecessor){var a=e.ganttProperties.predecessor,r=void 0,n=void 0,s=null,o="ResourceView"===this.parent.viewType?e.ganttProperties.taskId.toString():e.ganttProperties.rowUniqueID.toString(),l=a.filter(function(e){return e.to===o?e:null});for(r=0;r<l.length;r++){var d=l[r];if("ProjectView"!==this.parent.viewType||t.isNullOrUndefined(i)?(n=this.parent.connectorLineModule.getRecordByID(d.from),s=this.parent.connectorLineModule.getRecordByID(d.to)):(n=i.get(d.from),s=i.get(d.to)),this.parent.allowParentDependency&&n.hasChildRecords&&this.parent.dataOperation.updateParentItems(n),"ProjectView"===this.parent.viewType&&this.parent.allowTaskbarDragAndDrop){var h=void 0;t.isNullOrUndefined(s)?(h=this.parent.editModule.taskbarEditModule.previousIds.indexOf(d.to),s=this.parent.editModule.taskbarEditModule.previousFlatData[h]):t.isNullOrUndefined(n)&&(h=this.parent.editModule.taskbarEditModule.previousIds.indexOf(d.from),n=this.parent.editModule.taskbarEditModule.previousFlatData[h])}this.parent.allowParentDependency&&this.parent.isLoad&&-1===this.parentPredecessors.indexOf(e)&&(e.hasChildRecords||s.hasChildRecords)&&this.parentPredecessors.push(e),(s.ganttProperties.isAutoSchedule||this.parent.validateManualTasksOnLinking)&&this.validateChildGanttRecord(n,s,i)}}},i.prototype.getConstraintDate=function(t,i,a){switch(t){case e.ConstraintType.AsSoonAsPossible:case e.ConstraintType.AsLateAsPossible:return null;case e.ConstraintType.MustStartOn:case e.ConstraintType.StartNoEarlierThan:return i;case e.ConstraintType.MustFinishOn:case e.ConstraintType.FinishNoEarlierThan:case e.ConstraintType.StartNoLaterThan:case e.ConstraintType.FinishNoLaterThan:return a;default:return null}},i.prototype.validateChildGanttRecord=function(e,i,a){if(void 0===a&&(a=null),!(-1!==this.parent.editedPredecessorRecords.indexOf(i)||e&&t.isNullOrUndefined(m(e.ganttProperties))||i&&t.isNullOrUndefined(m(i.ganttProperties)))&&this.parent.isInPredecessorValidation&&(i.ganttProperties.isAutoSchedule||this.parent.validateManualTasksOnLinking)){var r=i.ganttProperties,n="ResourceView"===this.parent.viewType?r.taskId.toString():r.rowUniqueID.toString(),s=r.predecessor.filter(function(e){return e.to===n?e:null}),o=this.getPredecessorDate(i,s,a,!0);this.parent.setRecordValue("startDate",o,r,!0),this.parent.dataOperation.updateMappingData(i,"startDate"),this.parent.taskFields.constraintDate&&this.parent.taskFields.constraintType&&this.parent.updateOffsetOnTaskbarEdit&&this.parent.connectorLineEditModule.calculateOffset(i);var l=i.ganttProperties.segments;if((t.isNullOrUndefined(l)||!t.isNullOrUndefined(l)&&0===l.length)&&this.dateValidateModule.calculateEndDate(i),this.parent.dataOperation.updateWidthLeft(i),!this.parent.isLoad&&!this.parent.isFromOnPropertyChange&&i.parentItem&&this.parent.isInPredecessorValidation&&this.parent.getParentTask(i.parentItem).ganttProperties.isAutoSchedule&&-1===this.parentIds.indexOf(i.parentItem.uniqueID)&&(this.parentIds.push(i.parentItem.uniqueID),this.parentRecord.push(i.parentItem)),this.parent.taskFields.constraintDate&&this.parent.taskFields.constraintType){var d=r.constraintType,h=r.startDate,p=r.endDate,u=this.getConstraintDate(d,h,p);this.parent.setRecordValue("constraintDate",u,r,!0),this.parent.dataOperation.updateMappingData(i,"constraintDate")}}},i.prototype.filterPredecessorsByTarget=function(e,t,i){if(!(e&&Array.isArray(e)&&t&&t.ganttProperties&&i))return[];var a="ResourceView"===i?t.ganttProperties.taskId:t.ganttProperties.rowUniqueID;return e.filter(function(e){return e.to===a.toString()})},i.prototype.getPredecessorDate=function(e,i,a,r){void 0===a&&(a=null);var n,s,o,l,d=this.filterPredecessorsByTarget(i,e,this.parent.viewType),h=!t.isNullOrUndefined(this.parent.taskFields.constraintDate)&&!t.isNullOrUndefined(this.parent.taskFields.constraintType);if(d)for(var p=d.length,u=0;u<p;u++){var c=d[u];if("ProjectView"!==this.parent.viewType||t.isNullOrUndefined(a)?(o=this.parent.connectorLineModule.getRecordByID(c.from),l=this.parent.connectorLineModule.getRecordByID(c.to)):(o=a.get(c.from),l=a.get(c.to)),"ProjectView"!==this.parent.viewType||!this.parent.allowTaskbarDragAndDrop||t.isNullOrUndefined(l)&&t.isNullOrUndefined(o)||(l=t.isNullOrUndefined(l)?this.getRecord(o,l,c):l,o=t.isNullOrUndefined(o)?this.getRecord(o,l,c):o),!h&&this.parent.editModule&&this.parent.editModule.cellEditModule&&!this.parent.editModule.cellEditModule.isCellEdit&&!this.parent.editModule.dialogModule.isFromEditDialog&&!this.parent.updateOffsetOnTaskbarEdit&&!this.parent.isLoad){var g=this.parent.connectorLineEditModule.getOffsetForPredecessor(c,this.parent.connectorLineModule.getRecordByID(c.from),l);if(c.offset!==g&&g>=0)return l.ganttProperties.startDate}l&&o&&(s=this.getValidatedStartDate(l.ganttProperties,o.ganttProperties,c)),null!==n&&1!==this.dateValidateModule.compareDates(s,n)||(n=s)}return h&&(n=this.dateValidateModule.getDateByConstraint(e.ganttProperties,n,r,d.length>0)),n},i.prototype.getValidatedStartDate=function(e,i,a){var r,n,s=a.type,o=a.offset;switch(s){case"FS":r=this.dateValidateModule.getValidEndDate(i),e.isMilestone&&0===o||(r=this.dateValidateModule.checkStartDate(r,e)),0!==o&&(r=this.updateDateByOffset(r,a,e)),n=e.isMilestone?r:this.dateValidateModule.checkStartDate(r,e);break;case"FF":case"SF":if(r="FF"===s?this.dateValidateModule.getValidEndDate(i):this.dateValidateModule.getValidStartDate(i),0!==o&&(r=this.updateDateByOffset(r,a,e)),!e.isMilestone){var l=new Date(r);l.setDate(l.getDate()-1),r=this.parent.allowUnscheduledTasks&&t.isNullOrUndefined(e.endDate)&&t.isNullOrUndefined(e.duration)?this.dateValidateModule.checkStartDate(r,e):this.dateValidateModule.checkEndDate(r,e)}if(e.segments&&0!==e.segments.length){var d=this.dateValidateModule.getDuration(e.startDate,e.endDate,e.durationUnit,e.isAutoSchedule,e.isMilestone);n=this.dateValidateModule.getStartDate(r,d,e.durationUnit,e)}else n=this.dateValidateModule.getStartDate(r,e.duration,e.durationUnit,e);break;case"SS":r=this.dateValidateModule.getValidStartDate(i),0!==o&&(r=this.updateDateByOffset(r,a,e)),n=e.isMilestone?r:this.dateValidateModule.checkStartDate(r,e)}return n},i.prototype.updateDateByOffset=function(e,i,a){var r,n=i.offset,s=i.offsetUnit;return n<0&&!t.isNullOrUndefined(e)?r=this.dateValidateModule.getStartDate(this.dateValidateModule.checkEndDate(e,a),-1*n,s,a,!0):(t.isNullOrUndefined(e)||(r=this.dateValidateModule.getEndDate(e,n,s,a,!1)),a.isMilestone||(r=this.dateValidateModule.checkStartDate(r,a))),r},i.prototype.createConnectorLinesCollection=function(e){var i=e||this.parent.currentViewData,a=this.parent.pdfExportModule,r=a&&a.isPdfExport;if(r){var n=a.helper&&a.helper.exportProps,s=n&&n.fitToWidthSettings;if(n&&s&&s.isFitToWidth){var o=n.exportType,l=a.helper.beforeSinglePageExport;i="CurrentViewData"===o?l.cloneCurrentViewData:l.cloneFlatData}}var d,h,p=i.length;this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth&&this.parent.pdfExportModule.isPdfExport?this.parent.connectorLineModule.expandedRecords=this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.pdfExportModule.helper.beforeSinglePageExport.cloneFlatData:this.parent.getExpandedRecords(this.parent.pdfExportModule.helper.beforeSinglePageExport.cloneFlatData):this.parent.connectorLineModule.expandedRecords=this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.updatedRecords:this.parent.getExpandedRecords(this.parent.updatedRecords);var u=this.parent.flatData,c=r?null:new Map;if(!r&&!t.isNullOrUndefined(u))for(var g=0,f=u;g<f.length;g++){var m=f[g];c.set(m.ganttProperties.rowUniqueID.toString(),m)}var y=this.parent.ganttChartModule.getChartRows(),D=!t.isNullOrUndefined(y)&&y[0]&&y[0].offsetHeight;for(d=0;d<p;d++){if(this.parent.editModule&&this.parent.editModule.deletedTaskDetails.length>0){var v=i[d].parentItem;if(v){var k=t.isNullOrUndefined(c)?this.parent.getRecordByID(v.taskId.toString()):c.get(v.taskId.toString());this.parent.setRecordValue("parentItem",this.parent.dataOperation.getCloneParent(k),i[d])}}this.parent.undoRedoModule&&this.parent.undoRedoModule.canUpdateIndex&&(i[d].index=d,i[d].parentItem&&this.parent.getParentTask(i[d].parentItem)&&(i[d].parentItem.index=this.parent.getParentTask(i[d].parentItem).index)),(h=i[d].ganttProperties.predecessor)&&this.addPredecessorsCollection(h,c,D)}},i.prototype.addPredecessorsCollection=function(e,i,a){void 0===i&&(i=null),void 0===a&&(a=0);var r,n,s,o,l;if(e)for(r=e.length,n=0;n<r;n++){if((s=e[n]).from===s.to)break;"ProjectView"!==this.parent.viewType||t.isNullOrUndefined(i)?(o=this.parent.connectorLineModule.getRecordByID(s.from),l=this.parent.connectorLineModule.getRecordByID(s.to)):(o=i.get(s.from),l=i.get(s.to));var d=!0;(o&&o.hasChildRecords&&!o.expanded||l&&l.hasChildRecords&&!l.expanded)&&!this.parent.allowTaskbarOverlap&&"ProjectView"===this.parent.viewType&&(d=!1),d&&this.parent.connectorLineModule.expandedRecords&&-1!==this.parent.connectorLineModule.expandedRecords.indexOf(o)&&-1!==this.parent.connectorLineModule.expandedRecords.indexOf(l)&&this.updateConnectorLineObject(o,l,s,a)}},i.prototype.updateConnectorLineObject=function(e,t,i,a){void 0===a&&(a=0);var r=this.parent.connectorLineModule.createConnectorLineObject(e,t,i,a);if(r){if(t.isCritical&&e.isCritical&&(r.isCritical=!0),this.parent.connectorLineIds.length>0&&-1===this.parent.connectorLineIds.indexOf(r.connectorLineId)||0===this.parent.connectorLineIds.length)this.parent.updatedConnectorLineCollection.push(r),this.parent.connectorLineIds.push(r.connectorLineId);else if(-1!==this.parent.connectorLineIds.indexOf(r.connectorLineId)){var n=this.parent.connectorLineIds.indexOf(r.connectorLineId);this.parent.updatedConnectorLineCollection[n]=r}i.isDrawn=!0}return r},i.prototype.shouldUpdatePredecessor=function(e,i,a,r,n){if(t.isNullOrUndefined(i)||t.isNullOrUndefined(i.ganttProperties)||t.isNullOrUndefined(i.ganttProperties.taskId)||t.isNullOrUndefined(e)||t.isNullOrUndefined(e.ganttProperties))return!1;if(!n&&t.isNullOrUndefined(a)&&t.isNullOrUndefined(r))return!0;var s=e.ganttProperties.predecessor;if(t.isNullOrUndefined(s)||!Array.isArray(s))return!1;var o=s.find(function(e){return e.to===i.ganttProperties.taskId.toString()});if(t.isNullOrUndefined(o))return!1;var l=o.type,d=e.ganttProperties,h=i.ganttProperties;if(t.isNullOrUndefined(d)||t.isNullOrUndefined(h))return!1;var p=d.startDate,u=d.endDate,c=h.startDate,g=h.endDate,f=o.offset,m=o.offsetUnit;switch(0!==f&&(f>0?(p&&(p=this.parent.dataOperation.getEndDate(p,Math.abs(f),m,d,!1)),u&&(u=this.parent.dataOperation.getEndDate(u,Math.abs(f),m,d,!1))):(c&&(c=this.parent.dataOperation.getEndDate(c,Math.abs(f),m,d,!1)),g&&(g=this.parent.dataOperation.getEndDate(g,Math.abs(f),m,d,!1)))),l){case"FS":return(null!=c?c:g)<(null!=u?u:p);case"SS":return(null!=c?c:g)<(null!=p?p:u);case"SF":return(null!=g?g:c)<(null!=p?p:u);case"FF":return(null!=g?g:c)<(null!=u?u:p);default:return!1}},i.prototype.handleTaskUpdate=function(e,t){var i,a,r,n=this.parent.previousRecords[e.uniqueID];n&&n.ganttProperties&&(r=n.ganttProperties,this.parent.editModule.isDialogEditing?(i=null,a=null,this.parent.editModule.isDialogEditing=!1):(i=r.startDate,a=r.endDate));var s=r&&"predecessor"in r,o=this.shouldUpdatePredecessor(e,t,i,a,s);(this.parent.updateOffsetOnTaskbarEdit||o)&&(this.validateChildGanttRecord(e,t),t.hasChildRecords&&t.ganttProperties.isAutoSchedule&&this.updateChildItems(t))},i.prototype.validatePredecessor=function(e,i,a){if(this.parent.isInPredecessorValidation&&e.ganttProperties.predecessor){var r=this.parent.editModule.taskbarEditModule,n=void 0;r&&(n=r.taskBarEditRecord);for(var s=e.ganttProperties.predecessor,o=void 0,l=null,d=void 0,h=void 0,p="ResourceView"===this.parent.viewType?e.ganttProperties.taskId.toString():e.ganttProperties.rowUniqueID.toString(),u=s.filter(function(e){return e.to===p?e:null}),c=s.filter(function(e){return e.from===p?e:null}),g=void 0,f=0;f<u.length;f++){d=u[f],o=this.parent.connectorLineModule.getRecordByID(d.from),(l=this.parent.connectorLineModule.getRecordByID(d.to)).parentItem&&(g=this.parent.getTaskByUniqueID(l.parentItem.uniqueID),-1===this.parent.editModule.updateParentRecords.indexOf(g)&&this.parent.editModule.updateParentRecords.push(g)),o.parentItem&&(g=this.parent.getTaskByUniqueID(o.parentItem.uniqueID),-1===this.parent.editModule.updateParentRecords.indexOf(g)&&this.parent.editModule.updateParentRecords.push(g)),"ProjectView"!==this.parent.viewType||!this.parent.allowTaskbarDragAndDrop||t.isNullOrUndefined(l)&&t.isNullOrUndefined(o)||(l=t.isNullOrUndefined(l)?this.getRecord(o,l,d):l,o=t.isNullOrUndefined(o)?this.getRecord(o,l,d):o),this.parent.isInPredecessorValidation&&l.ganttProperties.isAutoSchedule?this.parent.isValidationEnabled=!0:this.parent.isValidationEnabled=!1;var m="ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;m.toString()!==d.to&&m.toString()!==d.from||a&&"predecessor"!==a||(this.handleTaskUpdate(o,l),this.parent.editModule.editedRecord&&this.parent.editModule.editedRecord.hasChildRecords&&!this.parent.editModule.editedRecord.parentItem&&(this.isValidatedParentTaskID=l.ganttProperties.taskId))}for(f=0;f<c.length;f++){if(h=c[f],o=this.parent.connectorLineModule.getRecordByID(h.from),(l=this.parent.connectorLineModule.getRecordByID(h.to)).parentItem&&(g=this.parent.getTaskByUniqueID(l.parentItem.uniqueID),-1===this.parent.editModule.updateParentRecords.indexOf(g)&&this.parent.editModule.updateParentRecords.push(g)),o.parentItem&&(g=this.parent.getTaskByUniqueID(o.parentItem.uniqueID),-1===this.parent.editModule.updateParentRecords.indexOf(g)&&this.parent.editModule.updateParentRecords.push(g)),"ProjectView"!==this.parent.viewType||!this.parent.allowTaskbarDragAndDrop||t.isNullOrUndefined(l)&&t.isNullOrUndefined(o)||(l=t.isNullOrUndefined(l)?this.getRecord(o,l,h):l,o=t.isNullOrUndefined(o)?this.getRecord(o,l,h):o),this.parent.isInPredecessorValidation&&l.ganttProperties.isAutoSchedule?this.parent.isValidationEnabled=!0:this.parent.isValidationEnabled=!1,"predecessor"!==a&&this.parent.isValidationEnabled){if(this.handleTaskUpdate(o,l),this.parent.editModule.editedRecord&&l){var y=o.parentItem?this.getRootParent(o):null;if(l.hasChildRecords&&(!this.parent.editModule.editedRecord.hasChildRecords||!l.parentItem&&(!y||y&&y.ganttProperties.taskId===this.parent.editModule.editedRecord.ganttProperties.taskId))&&this.isValidatedParentTaskID!==l.ganttProperties.taskId){this.updateChildItems(l);for(R=0;R<l.childRecords.length;R++){var D=l.childRecords[R].ganttProperties;if(-1!==this.isChildRecordValidated.indexOf(D.taskId))return;if(this.isChildRecordValidated.push(D.taskId),D.predecessor&&D.predecessor.length>0)for(var v=0;v<D.predecessor.length;v++){var k=void 0;(k=D.predecessor[v].to!==l.ganttProperties.taskId.toString()?this.parent.flatData[this.parent.ids.indexOf(D.predecessor[v].to)]:this.parent.flatData[this.parent.ids.indexOf(D.predecessor[v].from)])&&(this.validatePredecessor(k,[],""),k.hasChildRecords&&this.parent.editModule.editedRecord.hasChildRecords&&this.updateChildItems(k),this.isValidatedParentTaskID=k.ganttProperties.taskId)}}this.isValidatedParentTaskID=l.ganttProperties.taskId}this.parent.editModule.editedRecord.hasChildRecords&&!this.parent.editModule.editedRecord.parentItem&&(this.isValidatedParentTaskID=l.ganttProperties.taskId)}}else!l.ganttProperties.isAutoSchedule&&this.parent.updateOffsetOnTaskbarEdit&&(this.parent.connectorLineEditModule.validatedOffsetIds=[],this.parent.connectorLineEditModule.calculateOffset(l));if(!1!==o.expanded&&!1!==l.expanded){if(l){if(this.parent.editModule.isFirstCall){var b="ResourceView"===this.parent.viewType?this.parent.getTaskIds():this.parent.ids;this.storeId=JSON.parse(JSON.stringify(b)),this.parent.editModule.isFirstCall=!1}if(this.storeId){var w=void 0,T=l[this.parent.taskFields.id].toString();if("ResourceView"===this.parent.viewType){var S="T"+T;w=this.storeId.includes(S)?this.storeId.indexOf(S):-1}else w=this.storeId.indexOf(T);-1!==w&&(this.storeId=this.storeId.slice(0,w).concat(this.storeId.slice(w+1)),this.validatePredecessor(l,void 0,"successor"))}else this.validatePredecessor(l,void 0,"successor")}}else l&&this.validatePredecessor(l,void 0,"successor")}l&&!l.hasChildRecords&&l.parentItem&&-1===this.validatedParentIds.indexOf(l.parentItem.taskId)&&this.validatedParentIds.push(l.parentItem.taskId);var P=!0;if(l&&l.hasChildRecords&&-1!==this.validatedParentIds.indexOf(l.ganttProperties.taskId.toString())&&(P=!1),P)if(l&&l.ganttProperties.taskId!==this.isValidatedParentTaskID&&n){if("ParentDrag"!==r.taskBarEditAction&&"ChildDrag"!==r.taskBarEditAction&&!n.hasChildRecords&&l.hasChildRecords&&(this.updateChildItems(l),this.isValidatedParentTaskID=l.ganttProperties.taskId),l.parentItem){this.parent.dataOperation.updateParentItems(l,!0);var C=this.parent.getParentTask(l.parentItem),w=this.storeId&&-1!==this.storeId.indexOf(C[this.parent.taskFields.id].toString())?this.storeId.indexOf(C[this.parent.taskFields.id].toString()):-1;if(C.ganttProperties.predecessor&&C.ganttProperties.predecessor.length>0&&-1!==w)for(var R=0;R<C.ganttProperties.predecessor.length;R++)C.ganttProperties.predecessor[R].to!==C.ganttProperties.taskId.toString()&&(k=this.parent.flatData[this.parent.ids.indexOf(C.ganttProperties.predecessor[R].to)])&&k.parentItem&&this.validateChildGanttRecord(l,k)}}else l&&l.hasChildRecords&&this.isValidatedParentTaskID!==l.ganttProperties.taskId&&!n&&(this.updateChildItems(l),this.isValidatedParentTaskID=l.ganttProperties.taskId)}},i.prototype.updateChildItems=function(e){var i=this;if(e.childRecords.length>0&&this.validatedChildItems&&this.validatedChildItems.length>0){if(!!e.childRecords.some(function(e){return i.validatedChildItems.includes(e)}))return}var a,r=this.parent.previousRecords[e.uniqueID];t.isNullOrUndefined(r)||t.isNullOrUndefined(r)&&!t.isNullOrUndefined(r.ganttProperties)?a=new Date(e.ganttProperties.startDate.getTime()):t.isNullOrUndefined(r.ganttProperties.startDate)||(a=new Date(r.ganttProperties.startDate.getTime()));var n,s,o,l,d,h=e.ganttProperties.startDate,p=[];if(this.getUpdatableChildRecords(e,p),0!==p.length){!t.isNullOrUndefined(a)&&!t.isNullOrUndefined(h)&&a.getTime()>h.getTime()?(n=this.parent.dateValidationModule.checkStartDate(h),s=this.parent.dateValidationModule.checkEndDate(a,e.ganttProperties),l=!1):(n=this.parent.dateValidationModule.checkStartDate(a),s=this.parent.dateValidationModule.checkEndDate(h,e.ganttProperties),l=!0),d=!t.isNullOrUndefined(n)&&!t.isNullOrUndefined(s)&&n.getTime()>=s.getTime()?0:this.parent.dateValidationModule.getDuration(n,s,"minute",!0,!1);for(var u=0;u<p.length;u++)if(p[u].ganttProperties.isAutoSchedule)if(d>0){var c=m(p[u].ganttProperties)?p[u].ganttProperties.startDate:p[u].ganttProperties.startDate?p[u].ganttProperties.startDate:p[u].ganttProperties.endDate?p[u].ganttProperties.endDate:new Date(a.toString());o=l?this.parent.dateValidationModule.getEndDate(this.parent.dateValidationModule.checkStartDate(c,p[u].ganttProperties,p[u].ganttProperties.isMilestone),d,"minute",p[u].ganttProperties,!1):this.parent.dateValidationModule.getStartDate(this.parent.dateValidationModule.checkEndDate(c,p[u].ganttProperties),d,"minute",p[u].ganttProperties),this.calculateDateByRoundOffDuration(p[u],o),this.parent.isOnEdit&&-1===this.validatedChildItems.indexOf(p[u])&&this.validatedChildItems.push(p[u])}else t.isNullOrUndefined(r)&&(o=a,p[u].ganttProperties.startDate.getTime()<=o.getTime()&&this.calculateDateByRoundOffDuration(p[u],o),this.parent.isOnEdit&&-1===this.validatedChildItems.indexOf(p[u])&&this.validatedChildItems.push(p[u]));p.length&&this.parent.dataOperation.updateParentItems(e,!0)}},i.prototype.getUpdatableChildRecords=function(e,t){for(var i=e.childRecords,a=0;a<i.length;a++)i[a].ganttProperties.isAutoSchedule&&(t.push(i[a]),i[a].hasChildRecords&&this.getUpdatableChildRecords(i[a],t))},i.prototype.calculateDateByRoundOffDuration=function(e,i){var a=e,r=a.ganttProperties,n=new Date(i.getTime());if(!t.isNullOrUndefined(r.endDate)&&t.isNullOrUndefined(r.startDate)){var s=this.parent.dateValidationModule.checkStartDate(n,r,null);this.parent.setRecordValue("endDate",this.parent.dateValidationModule.checkEndDate(s,a.ganttProperties),r,!0)}else this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(n,r,!1),r,!0),t.isNullOrUndefined(r.duration)||this.parent.dateValidationModule.calculateEndDate(a);this.parent.dataOperation.updateWidthLeft(e),this.parent.dataOperation.updateTaskData(a)},i.prototype.getRecord=function(e,i,a){var r,n;return t.isNullOrUndefined(i)?(r=this.parent.editModule.taskbarEditModule.previousIds.indexOf(a.to),n=this.parent.editModule.taskbarEditModule.previousFlatData[r]):t.isNullOrUndefined(e)&&(r=this.parent.editModule.taskbarEditModule.previousIds.indexOf(a.from),n=this.parent.editModule.taskbarEditModule.previousFlatData[r]),n},i.prototype.getValidPredecessor=function(e){var i=this,a=[];if(!t.isNullOrUndefined(e)){var r=e.ganttProperties.predecessor;r&&r.length>0&&(a=r.filter(function(t){var a="ResourceView"===i.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;return t.from!==a.toString()}))}return a},i}(),ot=function(){function e(e){this.transform="",this.connectorLinePath="",this.arrowPath="",this.taskLineValue=0,this.expandedRecords=[],this.parent=e,this.dependencyViewContainer=t.createElement("div",{className:q}),Object.assign(this.dependencyViewContainer.style,{width:"100%",height:"100%",zIndex:2,position:"absolute",pointerEvents:"none"}),this.renderer=new o.SvgRenderer(this.parent.element.id),this.initPublicProp(),this.svgObject=this.renderer.createSvg({id:this.parent.element.id+"_svg"}),this.svgObject.setAttribute("height","100%"),this.svgObject.setAttribute("width","100%")}return e.prototype.getconnectorLineGap=function(e){return e.milestoneChild?this.parent.chartRowsModule.milestoneMarginTop/2+this.parent.chartRowsModule.milestoneHeight/2:this.parent.chartRowsModule.taskBarMarginTop/2+this.parent.chartRowsModule.taskBarHeight/2},e.prototype.initPublicProp=function(){this.lineColor=this.parent.connectorLineBackground,this.lineStroke=this.parent.connectorLineWidth>4?4:this.parent.connectorLineWidth,this.createConnectorLineTooltipTable()},e.prototype.getTaskbarMidpoint=function(e){return Math.floor(e?this.parent.chartRowsModule.milestoneMarginTop+this.parent.chartRowsModule.milestoneHeight/2:this.parent.chartRowsModule.taskBarMarginTop+this.parent.chartRowsModule.taskBarHeight/2)+1},e.prototype.createConnectorLineObject=function(e,i,a,r){void 0===r&&(r=0);var n,s={};n=this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth?this.parent.pdfExportModule.helper.beforeSinglePageExport.cloneFlatData:this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport?this.parent.flatData:this.expandedRecords;var o,l;if(this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth){var d=this.parent.flatData.filter(function(t){return t.ganttProperties.taskId.toString()===e.ganttProperties.taskId.toString()})[0],h=this.parent.flatData.filter(function(e){return e.ganttProperties.taskId.toString()===i.ganttProperties.taskId.toString()})[0];o=d.index,l=h.index}else o=n.indexOf(e),l=n.indexOf(i);var p,u=e.ganttProperties,c=i.ganttProperties;if(p=this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth?this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.pdfExportModule.helper.beforeSinglePageExport.cloneFlatData:this.parent.getExpandedRecords(this.parent.pdfExportModule.helper.beforeSinglePageExport.cloneFlatData):this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.currentViewData:this.parent.expandedRecords,s.parentIndexInCurrentView=p.indexOf(e),s.childIndexInCurrentView=p.indexOf(i),!(this.parent.virtualScrollModule&&this.parent.enableVirtualization)&&(-1===s.parentIndexInCurrentView||-1===s.childIndexInCurrentView)||-1===s.parentIndexInCurrentView&&-1===s.childIndexInCurrentView)return null;if(s.parentLeft=u.isMilestone?u.left-this.parent.chartRowsModule.milestoneHeight/2:u.left,s.childLeft=c.isMilestone?c.left-this.parent.chartRowsModule.milestoneHeight/2:c.left,s.parentWidth=0===u.width||u.isMilestone?Math.floor(this.parent.chartRowsModule.milestoneHeight):u.width,s.childWidth=0===c.width||c.isMilestone?Math.floor(this.parent.chartRowsModule.milestoneHeight):c.width,s.parentIndex=o,s.childIndex=l,0===r){var g=this.parent.ganttChartModule.getChartRows();s.rowHeight=!t.isNullOrUndefined(g)&&g[0]&&g[0].offsetHeight}else s.rowHeight=r;s.type=a.type;var f="ResourceView"===this.parent.viewType?u.taskId:u.rowUniqueID,y="ResourceView"===this.parent.viewType?c.taskId:c.rowUniqueID;return s.connectorLineId="parent"+f+"child"+y,s.milestoneParent=!!u.isMilestone,s.milestoneChild=!!c.isMilestone,s.parentEndPoint=s.parentLeft+s.parentWidth,s.childEndPoint=s.childLeft+s.childWidth,t.isNullOrUndefined(m(u))||t.isNullOrUndefined(m(c))?null:s},e.prototype.renderConnectorLines=function(e){var t,i=[];this.svgObject.innerHTML="";for(var a=0;a<e.length;a++)t=this.getConnectorLineTemplate(e[a]),this.svgObject.appendChild(t),i.push(e[a]);for(var r=this.parent.connectorLineModule.svgObject.childNodes,n=0;n<r.length;n++)for(var s=r[n].childNodes,o=0;o<s.length;o++){var l="Connector Line "+this.parent.connectorLineModule.generateAriaLabel(i[n]);s[o].setAttribute("aria-label",l),s[o].setAttribute("role","img")}this.parent.ganttChartModule.chartBodyContent.insertBefore(this.dependencyViewContainer,this.parent.ganttChartModule.chartBodyContent.lastChild),this.dependencyViewContainer.appendChild(this.svgObject);for(n=0;n<this.svgObject.children.length;n++)this.svgObject.children[n].children[0].setAttribute("tabindex","-1")},e.prototype.getParentPosition=function(e){if(e.parentIndex<e.childIndex){if("FF"===e.type)return e.childLeft+e.childWidth>=e.parentLeft+e.parentWidth?"FFType2":"FFType1";if(e.parentLeft<e.childLeft&&e.childLeft>e.parentLeft+e.parentWidth+25){if("FS"===e.type)return"FSType1";if("SF"===e.type)return"SFType1";if("SS"===e.type)return"SSType2"}else if(e.parentLeft<e.childLeft&&e.childLeft<e.parentLeft+e.parentWidth||e.parentLeft===e.childLeft||e.parentLeft>e.childLeft){if(e.parentLeft>e.childLeft+e.childWidth+25&&"SF"===e.type)return"SFType2";if(e.parentLeft>e.childLeft){if("SS"===e.type)return"SSType1";if("SF"===e.type)return"SFType1"}if("FS"===e.type)return"FSType2";if("SS"===e.type)return"SSType2";if("SF"===e.type)return"SFType1"}else if(e.parentLeft<e.childLeft){if("FS"===e.type)return"FSType2";if("SS"===e.type)return"SSType2";if("SF"===e.type)return"SFType1"}}else if(e.parentIndex>e.childIndex)if(e.parentLeft<e.childLeft&&e.childLeft>e.parentLeft+e.parentWidth){if("FS"===e.type)return 30>=e.childLeft-(e.milestoneParent?e.parentLeft+e.parentWidth+4:e.parentLeft+e.parentWidth)?"FSType3":"FSType4";if(e.childLeft+e.childWidth>e.parentLeft+e.parentWidth){if("SS"===e.type)return"SSType4";if("FF"===e.type)return"FFType4";if("SF"===e.type)return"SFType4"}}else if(e.parentLeft<e.childLeft&&e.childLeft<e.parentLeft+e.parentWidth||e.parentLeft===e.childLeft||e.parentLeft>e.childLeft){if(e.childLeft+e.childWidth<=e.parentLeft+e.parentWidth){if("FF"===e.type)return"FFType3";if("SF"===e.type)return e.childLeft+e.childWidth+25<e.parentLeft?"SFType3":"SFType4";if("SS"===e.type)return e.childLeft<=e.parentLeft?"SSType3":"SSType4"}else if(e.childLeft+e.childWidth>e.parentLeft+e.parentWidth){if("FF"===e.type)return"FFType4";if("SF"===e.type)return"SFType4";if("SS"===e.type)return e.childLeft<=e.parentLeft?"SSType3":"SSType4"}if("FS"===e.type)return"FSType3"}else if(e.parentLeft<e.childLeft){if("FS"===e.type)return"FSType3";if("SS"===e.type)return"SSType4";if("FF"===e.type)return"FFType4";if("SF"===e.type)return"SFType4"}return null},e.prototype.getHeightValue=function(){return this.parent.showOverAllocation&&this.parent.allowTaskbarOverlap,this.parentRowIndexHeight>this.childRowIndexHeight?this.parentRowIndexHeight-this.childRowIndexHeight:this.childRowIndexHeight-this.parentRowIndexHeight},e.prototype.getInnerElementWidthSSType2=function(e){return e.parentLeft===e.childLeft?10:e.childLeft-e.parentLeft},e.prototype.getInnerElementLeftSSType2=function(e){return e.parentLeft===e.childLeft?e.parentLeft-20:e.parentLeft-10},e.prototype.getInnerChildWidthSSType2=function(e){return e.parentLeft+e.parentWidth<e.childLeft?10:e.parentLeft===e.childLeft?20:e.parentLeft+e.parentWidth>=e.childLeft?10:e.childLeft-e.parentLeft},e.prototype.calculateAdjustments=function(e,i,a){var r=this.parent.renderBaseline?.45:!t.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?.7:.62,n=Math.floor(this.parent.rowHeight*r);if(t.isNullOrUndefined(this.parent.taskbarHeight)&&e<=36||!t.isNullOrUndefined(this.parent.taskbarHeight)&&this.parent.taskbarHeight<=n||!i)return{adjustY1:0,adjustX:0,adjustY2:0,adjustZ:0};var s=(e-36)/("FSType2"===a||"FSType3"===a||"FSType4"===a||"SSType1"===a||"SSType2"===a||"SSType4"===a||"SFType2"===a?12:24),o=-(e-36)/4,l=-2*(e-36)/24;return e<=36?{adjustY1:0,adjustX:0,adjustY2:0,adjustZ:0}:{adjustY1:s,adjustX:o,adjustZ:l}},e.prototype.shouldAdjustForBaseline=function(e,t){if(!this.parent.renderBaseline||!e.milestoneParent&&!e.milestoneChild||e.milestoneParent&&e.milestoneChild)return 0;switch(t){case"FSType1":case"FSType2":return e.milestoneParent?-this.parent.chartRowsModule.milestoneMarginTop/2:this.parent.chartRowsModule.taskBarMarginTop;case"FSType3":case"FFType2":case"SFType2":case"SSType2":return e.milestoneParent?this.parent.chartRowsModule.milestoneMarginTop/2:-this.parent.chartRowsModule.taskBarMarginTop;case"FSType4":case"FFType3":case"SFType4":case"FFType4":case"SFType3":case"SFType1":return e.milestoneParent?-this.parent.chartRowsModule.milestoneMarginTop/2:this.parent.chartRowsModule.taskBarMarginTop;case"SSType3":case"SSType4":return e.milestoneParent?-this.parent.chartRowsModule.taskBarMarginTop:this.parent.chartRowsModule.taskBarMarginTop;case"SSType1":case"FFType1":return e.milestoneParent?this.parent.chartRowsModule.taskBarMarginTop:-this.parent.chartRowsModule.milestoneMarginTop/2;default:return 0}},e.prototype.updateParentChildRowsHeight=function(e){var t=this.parent.currentViewData.length-1,i=this.parent.ganttChartModule.getChartRows();this.parentRowIndexHeight=e.parentIndexInCurrentView*e.rowHeight,this.childRowIndexHeight=e.childIndexInCurrentView*e.rowHeight,this.lastRowIndexHeight=t*e.rowHeight;var a=0;if(!this.parent.allowTaskbarOverlap&&this.parent.enableMultiTaskbar){this.parentRowIndexHeight=this.childRowIndexHeight=this.lastRowIndexHeight=0;for(var r=0;r<t;r++){var n=i[r];n&&"none"!==n.style.display&&(a<e.parentIndexInCurrentView&&(this.parentRowIndexHeight+=i[r].offsetHeight),a<e.childIndexInCurrentView&&(this.childRowIndexHeight+=i[r].offsetHeight),this.lastRowIndexHeight+=i[r].offsetHeight,a++)}}},e.prototype.getConnectorLineTemplate=function(e){var t=this.getInnerChildWidthSSType2(e),i=this.getInnerElementWidthSSType2(e),a=this.getInnerElementLeftSSType2(e);this.updateParentChildRowsHeight(e);var r=this.getHeightValue(),n=!!e.milestoneChild,s=this.getPosition(e,this.getParentPosition(e),r),o=this.getPosition(e,this.getParentPosition(e),r).top;if(this.parent.renderBaseline){var l=this.parent.rowHeight/36*5;e.milestoneParent&&e.milestoneChild?0:e.milestoneParent?-l:e.milestoneChild?l:0}var d=s.height,h=0,p=0,u=0,c=0,g=0;if(this.parent.showOverAllocation&&!this.parent.allowTaskbarOverlap){for(var f=0;f<this.parent.currentViewData.length;f++)"none"!==this.parent.getRowByIndex(f).style.display&&g<e.parentIndex&&(g++,u+=this.parent.getRowByIndex(f).offsetHeight);g=0;for(var m=0;m<this.parent.currentViewData.length;m++)"none"!==this.parent.getRowByIndex(m).style.display&&g<e.childIndex&&(g++,c+=this.parent.getRowByIndex(m).offsetHeight)}var y=this.parent.connectorLineModule.expandedRecords;if(y[e.parentIndex]&&y[e.childIndex]&&this.parent.allowParentDependency){var D=y[e.parentIndex].hasChildRecords,v=y[e.childIndex].hasChildRecords,k=y[e.parentIndex].ganttProperties.isAutoSchedule,b=y[e.childIndex].ganttProperties.isAutoSchedule,w=!0;(D&&k&&!v||v&&b&&!D||D&&k&&b&&v||!D&&!v)&&(w=!1),w&&(D&&!k&&v&&!b?p=-11:D&&!k&&v&&!b||(e.childIndex>e.parentIndex?!D&&v?h=-11:(h=11,p=-11):D&&!v?h=-11:(h=11,p=-11)),this.parent.currentViewData[e.parentIndex].ganttProperties.isMilestone?e.parentIndex>e.childIndex?(p=-11,h=12):"SS"!==e.type&&"FF"!==e.type||(p=-5):this.parent.currentViewData[e.childIndex].ganttProperties.isMilestone?e.parentIndex>e.childIndex?(p=5,h=-10):e.parentIndex<e.childIndex&&("SS"!==e.type&&"FF"!==e.type||(p=-10)):e.parentIndex<e.childIndex&&k&&!b?(p=0,h=-11):e.childIndex<e.parentIndex&&!k&&b&&(p=0,h=-11),o+=p)}var T=this.getParentPosition(e);if(T){var S=this.getParentPosition(e),P=this.parent.rowHeight,C=this.calculateAdjustments(P,n,S);this.transform=this.parent.enableRtl?"translate("+(this.parent.enableTimelineVirtualization?this.parent.timelineModule.wholeTimelineWidth:this.parent.timelineModule.totalTimelineWidth)+", 0) scale(-1, 1)":"",this.connectorId="ConnectorLine"+e.connectorLineId,this.groupObject=this.renderer.createGroup({id:this.connectorId,transform:this.transform,style:"pointer-events: stroke",class:"e-connector-line-container"}),this.connectorPath=this.renderer.drawPath({class:"e-connector-line",d:this.connectorLinePath,fill:"transparent","stroke-width":this.lineStroke}),this.arrowlinePath=this.renderer.drawPath({d:this.arrowPath,class:"e-connector-line-arrow"});var R=this.lineColor&&!this.parent.enableCriticalPath?this.lineColor:"";this.connectorPath.style.stroke=R,this.arrowlinePath.style.fill=R,this.groupObject.appendChild(this.connectorPath),this.groupObject.appendChild(this.arrowlinePath);var M=this.shouldAdjustForBaseline(e,T);if("FSType1"===T&&(this.taskLineValue=e.milestoneChild?1:0,this.x1=e.parentEndPoint+(e.milestoneParent?-1:e.milestoneChild?-1:0),this.x2=e.milestoneParent?e.childLeft-(e.parentLeft+e.parentWidth+10)+this.lineStroke-10+1:e.childLeft-(e.parentLeft+e.parentWidth+10)+this.lineStroke-10,this.y1=o,this.y2=d+this.taskLineValue+h-this.lineStroke,this.connectorLinePath="M "+this.x1+" "+(this.y1-M)+" L "+(this.x1+this.x2+C.adjustZ)+" "+(this.y1-M)+" L "+(this.x1+this.x2+C.adjustZ)+" "+(this.y1+this.y2+C.adjustY1)+" L "+(this.x1+this.x2+12+C.adjustX)+" "+(this.y1+this.y2+C.adjustY1),this.arrowPath="M "+(this.x1+this.x2+20+C.adjustX)+" "+(this.y1+this.y2+C.adjustY1)+" L "+(this.x1+this.x2+12+C.adjustX)+" "+(this.y1+this.y2-(4+this.lineStroke)+C.adjustY1)+" L "+(this.x1+this.x2+12+C.adjustX)+" "+(this.y1+this.y2+4+C.adjustY1)+" Z"),"FSType2"===T&&(this.x1=e.parentLeft,this.x2=e.parentWidth+(e.milestoneParent?-1:0),this.x3=this.x2+(e.milestoneParent?11:10),this.x4=e.parentWidth-(e.parentEndPoint-e.childLeft+20),this.y1=o,this.y2=d+h-this.getconnectorLineGap(e)-this.lineStroke,this.y3=this.getconnectorLineGap(e),this.y4=this.parent.allowTaskbarOverlap?this.y1+this.y2-(this.y1+this.y2)%e.rowHeight:c,this.connectorLinePath="M "+(this.x1+this.x2)+" "+(this.y1-M)+" L "+(this.x1+this.x3)+" "+(this.y1-M)+" L "+(this.x1+this.x3)+" "+this.y4+" L "+(this.x1+this.x4+C.adjustZ)+" "+this.y4+" L "+(this.x1+this.x4+C.adjustZ)+" "+(this.y1+this.y2+this.y3+C.adjustY1)+" L "+(this.x1+this.x4+12+C.adjustX)+" "+(this.y1+this.y2+this.y3+C.adjustY1),this.arrowPath="M "+(this.x1+this.x4+20+C.adjustX)+" "+(this.y1+this.y2+this.y3+C.adjustY1)+" L "+(this.x1+this.x4+12+C.adjustX)+" "+(this.y1+this.y2+this.y3-(4+this.lineStroke)+C.adjustY1)+" L "+(this.x1+this.x4+12+C.adjustX)+" "+(this.y1+this.y2+this.y3+4+this.lineStroke+C.adjustY1)+" Z"),"FSType3"===T&&(this.taskLineValue=e.milestoneChild?1:0,this.point1=o,this.x1=e.childLeft+(e.milestoneChild?-1:0)+(e.milestoneParent?1:0)-20,this.x2=e.parentEndPoint-e.childLeft+30,this.y1=this.point1,this.y2=this.point1+d+h-this.getconnectorLineGap(e)-this.lineStroke+this.taskLineValue,this.y3=this.getconnectorLineGap(e),this.y4=this.y2-this.y2%e.rowHeight,this.connectorLinePath="M "+(this.x1+12)+" "+(this.y1-M+C.adjustY1)+" L "+this.x1+" "+(this.y1-M+C.adjustY1)+" L "+this.x1+" "+this.y4+" L "+(this.x1+this.x2)+" "+this.y4+" L "+(this.x1+this.x2)+" "+(this.y2+this.y3)+" L "+(this.x1+this.x2-12)+" "+(this.y2+this.y3),this.arrowPath="M "+(this.x1+20+C.adjustX)+" "+(this.y1-M+C.adjustY1)+" L "+(this.x1+12+C.adjustX)+" "+(this.y1-(4+this.lineStroke)-M+C.adjustY1)+" L "+(this.x1+12+C.adjustX)+" "+(this.y1+4+this.lineStroke-M+C.adjustY1)+" Z"),"FSType4"===T&&(this.point1=o,this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.x1=e.parentEndPoint+(e.milestoneChild?-1:0)+(e.milestoneParent?1:0),this.x2=e.childLeft-e.parentEndPoint-20,this.y1=this.point1+(e.milestoneChild?-1:0),this.y2=this.point1+d+h-this.lineStroke+1+this.taskLineValue,this.connectorLinePath="M "+(this.x1+this.x2+12)+" "+(this.y1+C.adjustY1)+" L "+(this.x1+this.x2)+" "+(this.y1+C.adjustY1)+" L "+(this.x1+this.x2)+" "+(this.y2-M)+" L "+this.x1+" "+(this.y2-M),this.arrowPath="M "+(this.x1+this.x2+20+C.adjustX)+" "+(this.y1+C.adjustY1)+" L "+(this.x1+this.x2+12+C.adjustX)+" "+(this.y1-(4+this.lineStroke)+C.adjustY1)+" L "+(this.x1+this.x2+12+C.adjustX)+" "+(this.y1+4+this.lineStroke+C.adjustY1)+" Z"),"SSType4"===T){O=0!==C.adjustX?C.adjustX+2:C.adjustX;this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.point1=d+this.taskLineValue+h,this.x1=e.parentLeft-10,this.x2=e.childLeft-e.parentLeft,this.y1=o,this.y2=this.y1+this.point1,this.connectorLinePath="M "+(this.x1+this.x2+O)+" "+this.y1+" L "+this.x1+" "+this.y1+" L "+this.x1+" "+(this.y2-M)+" L "+(this.x1+10)+" "+(this.y2-M),this.arrowPath="M "+(this.x1+this.x2+8+O)+" "+this.y1+" L "+(this.x1+this.x2+O)+" "+(this.y1-(4+this.lineStroke))+" L "+(this.x1+this.x2+O)+" "+(this.y1+4+this.lineStroke)+" Z"}if("SSType3"===T&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.point1=d+this.taskLineValue+h-(this.lineStroke-1),this.x1=e.childLeft-20,this.y1=o,this.x2=e.parentLeft-e.childLeft+21,this.y2=this.y1+this.point1,this.connectorLinePath="M "+(this.x1+12+C.adjustX)+" "+this.y1+" L "+this.x1+" "+this.y1+" L "+this.x1+" "+(this.y2-M)+" L "+(this.x1+this.x2)+" "+(this.y2-M),this.arrowPath="M "+(this.x1+20+C.adjustX)+" "+this.y1+" L "+(this.x1+12+C.adjustX)+" "+(this.y1-(4+this.lineStroke))+" L "+(this.x1+12+C.adjustX)+" "+(this.y1+4+this.lineStroke)+" Z"),"SSType2"===T){O=0!==C.adjustX?C.adjustX+2:C.adjustX;this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.point1=d+this.taskLineValue+h-this.lineStroke,this.x1=a,this.x2=t+1,this.y1=o,this.y2=this.y1+this.point1,this.connectorLinePath="M "+(this.x1+this.x2)+" "+this.y1+" L "+this.x1+" "+this.y1+" L "+this.x1+" "+(this.y2+C.adjustY1-M)+" L "+(this.x1+i+O)+" "+(this.y2+C.adjustY1-M),this.arrowPath="M "+(this.x1+i+8+O)+" "+(this.y2+C.adjustY1-M)+" L "+(this.x1+i+O)+" "+(this.y2-(4+this.lineStroke)+C.adjustY1-M)+" L "+(this.x1+i+O)+" "+(this.y2+4+this.lineStroke+C.adjustY1-M)+" Z"}if("SSType1"===T&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.point1=d+this.taskLineValue+h-this.lineStroke,this.x1=e.childLeft-20,this.x2=e.parentLeft-e.childLeft+21,this.y1=o,this.y2=this.y1+this.point1,this.connectorLinePath="M "+(this.x1+this.x2)+" "+this.y1+" L "+this.x1+" "+this.y1+" L "+this.x1+" "+(this.y2+C.adjustY1-M)+" L "+(this.x1+12+C.adjustX)+" "+(this.y2+C.adjustY1-M),this.arrowPath="M "+(this.x1+20+C.adjustX)+" "+(this.y2+C.adjustY1-M)+" L "+(this.x1+12+C.adjustX)+" "+(this.y2-(4+this.lineStroke)+C.adjustY1-M)+" L "+(this.x1+12+C.adjustX)+" "+(this.y2+4+this.lineStroke+C.adjustY1-M)+" Z"),"FFType1"===T){O=0!==C.adjustX?C.adjustX+11:C.adjustX;this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.x1=e.childEndPoint,this.x2=e.parentEndPoint+(e.milestoneParent?-1:0),this.x3=e.milestoneParent?22:21,this.x4=e.milestoneChild?4:8,this.y1=o,this.y2=d+this.taskLineValue+h-this.lineStroke+1,this.connectorLinePath="M "+this.x2+" "+this.y1+" L "+(this.x2+this.x3)+" "+this.y1+" L "+(this.x2+this.x3)+" "+(this.y1+this.y2+C.adjustY1-M)+" L "+(this.x1+this.x4)+" "+(this.y1+this.y2+C.adjustY1-M),this.arrowPath="M "+(this.x1+O)+" "+(this.y1+this.y2+C.adjustY1-M)+" L "+(this.x1+8+O)+" "+(this.y1+this.y2-(4+this.lineStroke)+C.adjustY1-M)+" L "+(this.x1+8+O)+" "+(this.y1+this.y2+4+this.lineStroke+C.adjustY1-M)+" Z"}if("FFType2"===T){O=0!==C.adjustX?C.adjustX+11:C.adjustX;this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.x1=e.parentEndPoint,this.x2=e.childEndPoint+(e.milestoneParent?22:21),this.x3=e.childEndPoint+(e.milestoneChild?9:8),this.y1=o,this.y2=d+this.taskLineValue+h-this.lineStroke+1;x=this.parent.renderBaseline?0:O;this.connectorLinePath="M "+this.x1+" "+this.y1+" L "+this.x2+" "+this.y1+" L "+this.x2+" "+(this.y1+this.y2+C.adjustY1-M)+" L "+this.x3+" "+(this.y1+this.y2+C.adjustY1-M),this.arrowPath="M "+(this.x3-8+x)+" "+(this.y1+this.y2+C.adjustY1-M)+" L "+(this.x3+x)+" "+(this.y1+this.y2-(4+this.lineStroke)+C.adjustY1-M)+" L "+(this.x3+x)+" "+(this.y1+this.y2+4+this.lineStroke+C.adjustY1-M)+" Z"}if("FFType3"===T){O=0!==C.adjustX?C.adjustX+11:C.adjustX;this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.x1=e.childEndPoint,this.x2=this.x1+(e.milestoneChild?4:8),this.x3=e.parentEndPoint-e.childEndPoint+(e.milestoneChild?16:10),this.x4=e.parentEndPoint+(e.milestoneParent?-1:0),this.y1=o,this.y2=d+this.taskLineValue+h-this.lineStroke+1,this.connectorLinePath="M "+this.x2+" "+this.y1+" L "+(this.x2+this.x3)+" "+this.y1+" L "+(this.x2+this.x3)+" "+(this.y1+this.y2-M)+" L "+this.x4+" "+(this.y1+this.y2-M),this.arrowPath="M "+(this.x1+O)+" "+this.y1+" L "+(this.x1+8+O)+" "+(this.y1-(4+this.lineStroke))+" L "+(this.x1+8+O)+" "+(this.y1+4+this.lineStroke)+" Z"}if("FFType4"===T){O=0!==C.adjustX?C.adjustX+11:C.adjustX;this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.x1=e.parentEndPoint,this.x2=e.childEndPoint+(e.milestoneChild?7:8),this.x3=this.x2+(e.milestoneChild?12:11),this.y1=o,this.y2=d+this.taskLineValue+h-this.lineStroke+1;x=this.parent.renderBaseline?0:O;this.connectorLinePath="M "+this.x2+" "+this.y1+" L "+this.x3+" "+this.y1+" L "+this.x3+" "+(this.y1+this.y2-M)+" L "+this.x1+" "+(this.y1+this.y2-M),this.arrowPath="M "+(this.x2-8+x)+" "+this.y1+" L "+(this.x2+x)+" "+(this.y1-(4+this.lineStroke))+" L "+(this.x2+x)+" "+(this.y1+4+this.lineStroke)+" Z"}if("SFType4"===T){O=0!==C.adjustX?C.adjustX+11:C.adjustX;this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?-1:0,this.point1=this.taskLineValue+d+h-this.getconnectorLineGap(e)-(this.lineStroke-1),this.point2=o,this.x1=e.parentLeft-10,this.x2=this.x1+(e.childEndPoint-e.parentLeft+18),this.x3=this.x2+(e.milestoneChild?16:11),this.y1=this.point2,this.y2=this.y1+this.point1,this.y3=this.getconnectorLineGap(e),this.y4=this.y2-this.y2%e.rowHeight;x=this.parent.renderBaseline?0:O;this.connectorLinePath="M "+this.x2+" "+(this.y1-C.adjustY1)+" L "+this.x3+" "+(this.y1-C.adjustY1)+" L "+this.x3+" "+this.y4+" L "+this.x1+" "+this.y4+" L "+this.x1+" "+(this.y2+this.y3-M)+" L "+(this.x1+11)+" "+(this.y2+this.y3-M),this.arrowPath="M "+(this.x2-8+x)+" "+(this.y1-C.adjustY1)+" L "+(this.x2+x)+" "+(this.y1-(4+this.lineStroke)-C.adjustY1)+" L "+(this.x2+x)+" "+(this.y1+4+this.lineStroke-C.adjustY1)+" Z"}if("SFType3"===T){O=0!==C.adjustX?C.adjustX+11:C.adjustX;this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.point1=e.parentLeft-(e.childEndPoint+(e.milestoneParent?23:20))+1,this.point2=o,this.x1=e.childEndPoint,this.x2=this.x1+(e.milestoneChild?9:8),this.x3=this.x2+(e.milestoneChild?17:11),this.y1=this.point2,this.y2=this.y1+d+h-(this.lineStroke-1)+this.taskLineValue,this.connectorLinePath="M "+this.x2+" "+this.y1+" L "+this.x3+" "+this.y1+" L "+this.x3+" "+(this.y2-M)+" L "+(this.x3+this.point1)+" "+(this.y2-M),this.arrowPath="M "+(this.x2-8+O)+" "+this.y1+" L "+(this.x2+O)+" "+(this.y1-(4+this.lineStroke))+" L "+(this.x2+O)+" "+(this.y1+4+this.lineStroke)+" Z"}if("SFType1"===T){O=0!==C.adjustX?C.adjustX+11:C.adjustX;this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.point1=d+h-this.getconnectorLineGap(e)+this.taskLineValue-this.lineStroke,this.point2=this.getconnectorLineGap(e),this.x1=e.parentLeft-10,this.y1=o,this.x2=e.childEndPoint-e.parentLeft+31,this.y2=this.y1+this.point1,this.x3=e.childEndPoint-e.parentLeft+18,this.y3=this.y2-this.y2%e.rowHeight;var x=this.parent.renderBaseline?0:O;this.connectorLinePath="M "+(this.x1+11)+" "+(this.y1-M)+" L "+this.x1+" "+(this.y1-M)+" L "+this.x1+" "+this.y3+" L "+(this.x1+this.x2)+" "+this.y3+" L "+(this.x1+this.x2)+" "+(this.y2+this.point2+C.adjustY1)+" L "+(this.x1+this.x3)+" "+(this.y2+this.point2+C.adjustY1),this.arrowPath="M "+(this.x1+this.x3-8+x)+" "+(this.y2+this.point2+C.adjustY1)+" L "+(this.x1+this.x3+x)+" "+(this.y2+this.point2-(4+this.lineStroke)+C.adjustY1)+" L "+(this.x1+this.x3+x)+" "+(this.y2+this.point2+4+this.lineStroke+C.adjustY1)+" Z"}if("SFType2"===T){var O=0!==C.adjustX?C.adjustX+11:C.adjustX;this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.x1=e.childEndPoint,this.y1=o,this.x2=e.parentLeft-e.childEndPoint,this.y2=this.y1+d+this.taskLineValue+h-this.lineStroke,this.connectorLinePath="M "+(this.x1+this.x2+1)+" "+this.y1+" L "+(this.x1+this.x2-10)+" "+this.y1+" L "+(this.x1+this.x2-10)+" "+(this.y2+C.adjustY1-M)+" L "+(this.x1+8)+" "+(this.y2+C.adjustY1-M),this.arrowPath="M "+(this.x1+O)+" "+(this.y2+C.adjustY1-M)+" L "+(this.x1+8+O)+" "+(this.y2-(4+this.lineStroke)+C.adjustY1-M)+" L "+(this.x1+8+O)+" "+(this.y2+4+this.lineStroke+C.adjustY1-M)+" Z"}this.connectorPath.setAttribute("d",this.connectorLinePath),this.arrowlinePath.setAttribute("d",this.arrowPath)}return this.groupObject},e.prototype.getPosition=function(e,t,i){var a=0,r=0,n=!!e.milestoneParent,s=!!e.milestoneChild,o=this.getTaskbarMidpoint(n)-(this.lineStroke-1),l=this.getTaskbarMidpoint(s)-(this.lineStroke-1),d=-1!==e.parentIndexInCurrentView,h=-1!==e.childIndexInCurrentView;return"SSType1"===t||"SSType2"===t||"FFType1"===t||"FFType2"===t||"SFType2"===t?(a=d?this.parentRowIndexHeight+o:0,r=d&&h?i:h?this.childRowIndexHeight+o:this.lastRowIndexHeight+o):"SSType3"===t||"SSType4"===t||"FSType4"===t||"FFType3"===t||"FFType4"===t||"SFType4"===t||"SFType3"===t?(a=h?this.childRowIndexHeight+l:0,r=d&&h?i:d?this.parentRowIndexHeight+l:this.lastRowIndexHeight+l):"FSType3"===t?(a=h?this.childRowIndexHeight+o:0,r=d&&h?i:d?this.parentRowIndexHeight+l:this.lastRowIndexHeight+o):"SFType1"!==t&&"FSType1"!==t&&"FSType2"!==t||(a=d?this.parentRowIndexHeight+l:0,r=d&&h?i:h?this.childRowIndexHeight+l:this.lastRowIndexHeight+l),{top:a,height:r}},e.prototype.createConnectorLineTooltipTable=function(){this.tooltipTable=t.createElement("table",{className:".e-tooltiptable",styles:"margin-top:0px",attrs:{cellspacing:"2px",cellpadding:"2px"}});var e=t.createElement("tbody");e.innerHTML="",this.tooltipTable.appendChild(e)},e.prototype.getConnectorLineTooltipInnerTd=function(e,t,i,a){var r=this,n=document.createElement("tbody"),s=function(e,t,i,a){var n=document.createElement("tr");n.id=e;var s=document.createElement("td");s.style.padding="2px",s.textContent=r.parent.localeObj.getConstant(t);var o=document.createElement("td");o.textContent=i;var l=document.createElement("td");return l.style.padding="2px",l.textContent=r.parent.localeObj.getConstant(a),n.append(s,o,l),n};return n.appendChild(s("fromPredecessor","from",e,t)),n.appendChild(s("toPredecessor","to",i||"",a||"")),n},e.prototype.generateAriaLabel=function(e){var t=e.type,i=this.expandedRecords,a=i[e.parentIndex].ganttProperties.taskName,r=i[e.childIndex].ganttProperties.taskName,n=this.parent.localeObj.getConstant("start"),s=this.parent.localeObj.getConstant("finish");return"FS"===t?a+" "+s+" to "+r+" "+n:"FF"===t?a+" "+s+" to "+r+" "+s:"SS"===t?a+" "+n+" to "+r+" "+n:a+" "+n+" to "+r+" "+s},e.prototype.getRecordByID=function(e){return t.isNullOrUndefined(e)?null:this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth?this.parent.pdfExportModule.helper.beforeSinglePageExport.cloneFlatData.filter(function(t){return t.ganttProperties.taskId.toString()===e.toString()})[0]:"ResourceView"===this.parent.viewType?this.parent.flatData[this.parent.getTaskIds().indexOf("T"+e.toString())]:this.parent.getRecordByID(e)},e.prototype.removePreviousConnectorLines=function(e){for(var i,a=(i=!0===t.isObject(e))?Object.keys(e).length:e.length,r=Object.keys(e),n=0;n<a;n++){var s=void 0,o=(s=i?e[r[n]]:e[n]).ganttProperties&&s.ganttProperties.predecessor;if(o&&o.length>0)for(var l=0;l<o.length;l++){var d="parent"+o[l].from+"child"+o[l].to;this.removeConnectorLineById(d)}}},e.prototype.removeConnectorLineById=function(e){var i=this.parent.connectorLineModule.dependencyViewContainer.querySelector("#ConnectorLine"+e.replace(/([.])/g,"\\$1"));t.isNullOrUndefined(i)||t.remove(i)},e}(),lt=function(){function e(e){this.isSplitterResized=!1,this.parent=e,this.parent.on("destroy",this.destroy,this)}return e.prototype.renderSplitter=function(){var e=this,i=this.calculateSplitterPosition(this.parent.splitterSettings);this.parent.splitterElement=t.createElement("div",{className:"e-gantt-splitter"}),this.parent.treeGridPane=t.createElement("div",{className:"e-gantt-tree-grid-pane"}),this.parent.chartPane=t.createElement("div",{className:"e-gantt-chart-pane"}),t.addClass([this.parent.chartPane],"e-droppable"),this.parent.enableRtl?(this.parent.splitterElement.appendChild(this.parent.chartPane),this.parent.splitterElement.appendChild(this.parent.treeGridPane)):(this.parent.splitterElement.appendChild(this.parent.treeGridPane),this.parent.splitterElement.appendChild(this.parent.chartPane)),this.splitterObject=new l.Splitter({height:null,width:this.parent.ganttWidth.toString(),enableRtl:this.parent.enableRtl,separatorSize:this.parent.splitterSettings.separatorSize,paneSettings:[{resizable:!0,size:i,min:this.getSpliterPositionInPercentage(this.parent.splitterSettings.minimum)},{resizable:!0}],orientation:"Horizontal",resizeStart:function(t){e.parent.contextMenuModule&&e.parent.contextMenuModule.isOpen&&e.parent.contextMenuModule.contextMenu.close();var i=t.pane[0],r=t.pane[1];e.splitterPreviousPositionGrid=i.scrollWidth+1+"px",e.splitterPreviousPositionChart=r.scrollWidth+1+"px";var n=new a.Deferred;return e.parent.trigger("splitterResizeStart",t,function(e){n.resolve(e)}),n},resizing:function(t){e.parent.trigger("splitterResizing",t),e.parent.timelineModule.isZoomToFit&&e.parent.timelineModule.updateTimelineAfterZooming(e.parent.timelineModule.timelineEndDate,!0)},resizeStop:function(i){e.parent.calculateDimensions(),e.isSplitterResized=!0;var r=i.pane[0];e.splitterPreviousPositionGrid=r.scrollWidth+1+"px",e.splitterObject.paneSettings[0].size=e.getSpliterPositionInPercentage(e.splitterPreviousPositionGrid),e.parent.splitterSettings.position=e.splitterObject.paneSettings[0].size;var n=new a.Deferred;return e.parent.trigger("splitterResized",i,function(i){!0===i.cancel&&(e.splitterObject.paneSettings[0].size=null,e.splitterObject.paneSettings[0].size=e.getSpliterPositionInPercentage(e.splitterPreviousPositionGrid),e.parent.splitterSettings.position=e.splitterObject.paneSettings[0].size,e.splitterObject.paneSettings[1].size=null,e.splitterObject.paneSettings[1].size=e.getSpliterPositionInPercentage(e.splitterPreviousPositionChart)),t.isNullOrUndefined(e.parent.projectEndDate)&&e.parent.timelineModule.updateTimelineAfterZooming(e.parent.timelineModule.timelineEndDate,!0),n.resolve(i)}),n}}),this.parent.element.appendChild(this.parent.splitterElement),this.splitterObject.appendTo(this.parent.splitterElement);var r=this.splitterObject.element.querySelector(".e-split-bar");if(r){var n=parseFloat(i.replace("%","")),s=Math.min(100,Math.max(0,n));r.setAttribute("aria-valuenow",s.toString())}},e.prototype.calculateSplitterPosition=function(e){if(!t.isNullOrUndefined(this.splitterObject)&&this.parent.enablePersistence)return this.splitterObject.paneSettings[0].size;if("Grid"===e.view)return this.parent.enableRtl?"0%":"100%";if("Chart"===e.view)return this.parent.enableRtl?"100%":"0%";if(t.isNullOrUndefined(e.position)||""===e.position){if(!t.isNullOrUndefined(e.columnIndex)&&e.columnIndex>=0)return 150*e.columnIndex<this.parent.ganttWidth||!this.parent.element.classList.contains("e-device")?this.getSpliterPositionInPercentage(this.getTotalColumnWidthByIndex(e.columnIndex).toString()+"px"):this.getSpliterPositionInPercentage(130*e.columnIndex+"px");var i=this.parent.ganttWidth-250+"px";return this.parent.enableRtl?this.getSpliterPositionInPercentage(i):this.getSpliterPositionInPercentage("250px")}return this.getSpliterPositionInPercentage(e.position)},e.prototype.getSpliterPositionInPercentage=function(e){var i=t.isNullOrUndefined(e)||""===e?null:e;if(!t.isNullOrUndefined(i))if(-1!==e.indexOf("px")){var a=parseInt(e,10);i=a/this.parent.ganttWidth*100<=100?a/this.parent.ganttWidth*100+"%":"25%"}else i=this.parent.enableRtl?100-parseFloat(e)+"%":-1===e.indexOf("%")?e+"%":e;return i},e.prototype.getTotalColumnWidthByIndex=function(e){var t=0,i=this.parent.ganttWidth,a=this.parent.ganttColumns.filter(function(e){return void 0===e.visible||!0===e.visible}).map(function(e){return Object.assign({},e)});if(e=a.length>e?e:a.length,this.parent.enableRtl){for(r=0;r<e;r++)t+=parseInt(a[r].width,10);t=i-t}else for(var r=0;r<e;r++)t+=parseInt(a[r].width,10);return t},e.prototype.updateSplitterPosition=function(){this.splitterObject.separatorSize=this.parent.splitterSettings.separatorSize;var e=this.calculateSplitterPosition(this.parent.splitterSettings);this.splitterObject.paneSettings[0].min=this.getSpliterPositionInPercentage(this.parent.splitterSettings.minimum),this.splitterObject.dataBind(),this.isSplitterResized||(this.splitterObject.paneSettings[0].size=e),this.isSplitterResized=!1,t.isNullOrUndefined(this.parent.projectEndDate)&&this.parent.timelineModule.updateTimelineAfterZooming(this.parent.timelineModule.timelineEndDate,!0)},e.prototype.triggerCustomResizedEvent=function(){var e=this.splitterObject.element.querySelectorAll(".e-pane")[0],t=this.splitterObject.element.querySelectorAll(".e-pane")[1],i={event:null,element:this.splitterObject.element,pane:[e,t],index:[0,1],separator:this.splitterObject.element.querySelector(".e-split-bar"),paneSize:[e.offsetWidth,t.offsetWidth]};this.parent.trigger("splitterResized",i),!0===i.cancel&&(this.splitterObject.paneSettings[0].size=this.getSpliterPositionInPercentage(this.splitterPreviousPositionGrid),this.splitterObject.paneSettings[1].size=this.getSpliterPositionInPercentage(this.splitterPreviousPositionChart))},e.prototype.destroy=function(){this.splitterObject.destroy(),this.parent.off("destroy",this.destroy)},e}(),dt=function(){function e(e){this.parent=e,this.createTooltip(),this.parent.on("destroy",this.destroy,this)}return e.prototype.createTooltip=function(){this.toolTipObj=new i.Tooltip,this.toolTipObj.target=".e-header-cell-label, .e-gantt-child-taskbar,.e-gantt-parent-taskbar, .e-gantt-milestone, .e-gantt-unscheduled-taskbar.e-event-markers, .e-baseline-bar, .e-event-markers,.e-connector-line-container, .e-indicator-span, .e-notes-info, .e-gantt-manualparent-milestone,.e-taskbar-left-resizer, .e-taskbar-right-resizer, .e-baseline-gantt-milestone-container, .e-gantt-manualparenttaskbar",this.toolTipObj.position="BottomCenter",this.toolTipObj.openDelay=700,this.toolTipObj.enableRtl=this.parent.enableRtl,this.toolTipObj.enableHtmlSanitizer=this.parent.enableHtmlSanitizer,this.toolTipObj.cssClass="e-gantt-tooltip",this.toolTipObj.animation={open:{effect:"None",delay:0},close:{effect:"None",delay:0}},this.toolTipObj.afterOpen=this.updateTooltipPosition.bind(this),this.toolTipObj.showTipPointer=!1,this.toolTipObj.beforeRender=this.tooltipBeforeRender.bind(this),this.toolTipObj.afterClose=this.tooltipCloseHandler.bind(this),this.toolTipObj.isStringTemplate=!0,this.toolTipObj.appendTo(this.parent.element)},e.prototype.tooltipBeforeRender=function(e){var i=this.parent;if(i.isOnEdit)return void(e.cancel=!0);var r,n=t.closest(e.target,"div."+N);r=t.isNullOrUndefined(n)?f(e.target,"e-chart-row-cell"):e.target;var s,o={data:{},args:e,cancel:!1,content:""};if(e.target.classList.contains("e-header-cell-label"))if(i.timelineSettings.showTooltip){var l=e.target.getAttribute("data-tier"),d={date:e.target.title,value:t.isNullOrUndefined(i.timelineTemplate)?e.target.textContent:e.target.getAttribute("value"),tier:l},h=i.tooltipSettings.timeline?i.tooltipModule.templateCompiler(i.tooltipSettings.timeline,i,t.extend({},d),"TooltipTaskbarTemplate"):null,p=document.createElement("div");h?(t.append(h,p),o.content=this.toolTipObj.content=p):o.content=this.toolTipObj.content=i.tooltipModule.getTooltipContent("timeline",s,i,e)}else e.cancel=!0;else if(i.tooltipSettings.showTooltip)if(r&&(o.data=i.ganttChartModule.getRecordByTaskBar(r),s=o.data),e.target.classList.contains("e-gantt-child-taskbar")||e.target.classList.contains("e-gantt-parent-taskbar")||e.target.classList.contains("e-gantt-milestone")||e.target.classList.contains("e-gantt-unscheduled-taskbar")||e.target.classList.contains("e-taskbar-left-resizer")||e.target.classList.contains("e-taskbar-right-resizer")||e.target.classList.contains("e-gantt-manualparenttaskbar")&&i.tooltipSettings.taskbar){var u=void 0;i.tooltipSettings.taskbar&&(u=i.tooltipModule.templateCompiler(i.tooltipSettings.taskbar,i,s,"TooltipTaskbarTemplate"));p=document.createElement("div");u&&t.append(u,p),o.content=this.toolTipObj.content=u?p:s?i.tooltipModule.getTooltipContent(s.ganttProperties.isMilestone?"milestone":"taskbar",s,i,e):""}else if(e.target.classList.contains("e-baseline-bar")||e.target.classList.contains("e-baseline-gantt-milestone-container")){var c=void 0;i.tooltipSettings.baseline&&(c=i.tooltipModule.templateCompiler(i.tooltipSettings.baseline,i,s,"TooltipBaselineTemplate"));var g=document.createElement("div");c&&t.append(c,g),o.content=this.toolTipObj.content=c?g:s?i.tooltipModule.getTooltipContent(s.ganttProperties.isMilestone?"milestone":"baseline",s,i,e):""}else if(e.target.classList.contains("e-event-markers"))o.content=this.toolTipObj.content=i.tooltipModule.getTooltipContent("marker",s,i,e);else if(e.target.classList.contains("e-connector-line-container")){var m=void 0;i.tooltipModule.predecessorTooltipData=i.tooltipModule.getPredecessorTooltipData(e),o.data=this.predecessorTooltipData,i.tooltipSettings.connectorLine&&(m=i.tooltipModule.templateCompiler(i.tooltipSettings.connectorLine,i,i.tooltipModule.predecessorTooltipData,"TooltipConnectorLineTemplate")),o.content=this.toolTipObj.content=m?m[0]:i.tooltipModule.getTooltipContent("connectorLine",s,i,e)}else if(e.target.classList.contains("e-indicator-span"))o.content=this.toolTipObj.content=i.tooltipModule.getTooltipContent("indicator",s,i,e),t.isNullOrUndefined(o.content)&&(e.cancel=!0);else if(e.target.classList.contains("e-notes-info")){var y=this.parent.ganttChartModule.getRecordByTarget(e.event);o.content=this.toolTipObj.content=y.ganttProperties.notes,t.isNullOrUndefined(o.content)&&(e.cancel=!0)}else e.target.classList.contains("e-gantt-manualparenttaskbar")?(o.content=this.toolTipObj.content=i.tooltipModule.getTooltipContent("manualtaskbar",s,i,e),t.isNullOrUndefined(o.content)&&(e.cancel=!0)):e.target.classList.contains("e-gantt-manualparent-milestone")&&(o.content=this.toolTipObj.content=i.tooltipModule.getTooltipContent("manualmilestone",s,i,e),t.isNullOrUndefined(o.content)&&(e.cancel=!0));else e.cancel=!0;if(!1===e.cancel){var D=new a.Deferred;return i.trigger("beforeTooltipRender",o,function(t){D.resolve(t),t.cancel&&(e.cancel=!0)}),this.toolTipObj.content=o.content,this.parent.isAdaptive||"mouseover"!==e.event.type||(this.currentTarget=e.target,t.EventHandler.add(this.currentTarget,"mousemove",this.mouseMoveHandler.bind(this))),this.parent.renderTemplates(),D}},e.prototype.tooltipCloseHandler=function(e){this.tooltipMouseEvent=null,this.parent.isAdaptive||t.isNullOrUndefined(this.currentTarget)||t.EventHandler.remove(this.currentTarget,"mousemove",this.mouseMoveHandler),this.currentTarget=null},e.prototype.mouseMoveHandler=function(e){this.tooltipMouseEvent=e},e.prototype.updateTooltipPosition=function(e){e.element.style.visibility="visible";var i=this.parent.element.closest('[style*="zoom"]');if(t.isNullOrUndefined(i)){if(t.isNullOrUndefined(this.tooltipMouseEvent)||e.target.classList.contains("e-notes-info"))return;var a=this.getPointorPosition(this.tooltipMouseEvent),r=this.parent.getOffsetRect(this.parent.chartPane),n=r.top+this.parent.chartPane.offsetHeight,s=r.left+this.parent.chartPane.offsetWidth,o=a.x,l=a.y;if(s<o+e.element.offsetWidth+10)for(;s<o+e.element.offsetWidth+10;)o=s-e.element.offsetWidth-10,e.element.style.left=o+"px";else o+=10,e.element.style.left=o+"px";e.event.clientY>e.element.offsetHeight?(window.innerHeight<e.element.offsetHeight+l&&(l=l-e.element.offsetHeight-10),n<l+e.element.offsetHeight+20?l=l-e.element.offsetHeight-10:l+=10):l+=10,e.element.style.top=l+"px"}},e.prototype.getPointorPosition=function(e){var i,a;return t.isNullOrUndefined(t.getValue("pageX",e))&&t.isNullOrUndefined(t.getValue("pageY",e))?t.isNullOrUndefined(t.getValue("clientX",e))&&t.isNullOrUndefined(t.getValue("clientY",e))||(i=t.getValue("clientX",e)+document.body.scrollLeft+document.documentElement.scrollLeft,a=t.getValue("clientY",e)+document.body.scrollTop+document.documentElement.scrollTop):(i=t.getValue("pageX",e),a=t.getValue("pageY",e)),{x:i,y:a}},e.prototype.getTooltipContent=function(e,i,a,r){var n,s,o;if(i){var l=(s=i.ganttProperties).taskName;this.parent.enableHtmlSanitizer&&"string"==typeof l&&(l=t.SanitizeHtmlHelper.sanitize(l)),o=t.isNullOrUndefined(l)?"":'<tr class = "e-gantt-tooltip-rowcell"><td colspan="3">'+(this.parent.disableHtmlEncode?l.replace(/</g,"<").replace(/>/g,">"):l)+"</td></tr>"}switch(e){case"milestone":var d=void 0;r.target.className.includes("e-baseline-gantt-milestone-container")&&!t.isNullOrUndefined(s.baselineStartDate)?d=s.baselineStartDate:t.isNullOrUndefined(s.startDate)||(d=s.startDate);var h=this.parent.getFormatedDate(d,this.parent.getDateFormat());this.parent.enableHtmlSanitizer&&"string"==typeof h&&(h=t.SanitizeHtmlHelper.sanitize(h));var p=t.isNullOrUndefined(d)?"":'<tr><td class = "e-gantt-tooltip-label"> Date</td><td>:</td><td class = "e-gantt-tooltip-value">'+h+"</td></tr>",u=function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+o+p+"</tbody></table>"};n=t.initializeCSPTemplate(u);break;case"taskbar":var c=!(i.hasChildRecords&&!s.isAutoSchedule),g=this.parent.getFormatedDate(c?s.startDate:s.autoStartDate,this.parent.getDateFormat()),f=this.parent.getFormatedDate(c?s.endDate:s.autoEndDate,this.parent.getDateFormat()),m=this.parent.getDurationString(c?s.duration:s.autoDuration,s.durationUnit),y=s.progress;this.parent.enableHtmlSanitizer&&(g="string"==typeof g?t.SanitizeHtmlHelper.sanitize(g):g,f="string"==typeof f?t.SanitizeHtmlHelper.sanitize(f):f,m=t.SanitizeHtmlHelper.sanitize(m));var D=s.startDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant(c?"startDate":"subTasksStartDate")+"</td><td class="+G+'>:</td><td class = "e-gantt-tooltip-value"> '+g+"</td></tr>":"",v=s.endDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant(c?"endDate":"subTasksEndDate")+"</td><td class="+G+'>:</td><td class = "e-gantt-tooltip-value">'+f+"</td></tr>":"",k=t.isNullOrUndefined(s.duration)?"":'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("duration")+"</td><td class="+G+'>:</td><td class = "e-gantt-tooltip-value"> '+m+"</td></tr>",b='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("progress")+"</td><td class="+G+">:</td><td>"+y+"</td></tr>",u=function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+o+D+v+k+b+"</tbody></table>"};n=t.initializeCSPTemplate(u);break;case"baseline":var w=this.parent.getFormatedDate(s.baselineStartDate,this.parent.getDateFormat()),T=this.parent.getFormatedDate(s.baselineEndDate,this.parent.getDateFormat()),S=this.parent.getDurationString(s.baselineDuration,s.durationUnit);this.parent.enableHtmlSanitizer&&(w=t.SanitizeHtmlHelper.sanitize(w),T=t.SanitizeHtmlHelper.sanitize(T),S=t.SanitizeHtmlHelper.sanitize(S));u=function(){var e=this.parent.taskFields,i=s.baselineStartDate&&!t.isNullOrUndefined(e.baselineStartDate)?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("baselineStartDate")+"</td><td class="+G+'>:</td><td class = "e-gantt-tooltip-value"> '+w+"</td></tr>":"",a=s.baselineEndDate&&!t.isNullOrUndefined(e.baselineEndDate)?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("baselineEndDate")+"</td><td class="+G+'>:</td><td class = "e-gantt-tooltip-value">'+T+"</td></tr>":"",r=t.isNullOrUndefined(s.baselineDuration)||t.isNullOrUndefined(e.baselineDuration)?"":'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("baselineDuration")+"</td><td class="+G+'>:</td><td class = "e-gantt-tooltip-value"> '+S+"</td></tr>";return'<table class = "e-gantt-tooltiptable"><tbody>'+o+i+a+r+"</tbody></table>"};n=t.initializeCSPTemplate(u,this);break;case"marker":var P=a.tooltipModule.getMarkerTooltipData(r),C=this.parent.getFormatedDate(this.parent.dateValidationModule.getDateFromFormat(P.day),this.parent.getDateFormat()),R=P.label?P.label:"";this.parent.enableHtmlSanitizer&&(R=t.SanitizeHtmlHelper.sanitize(R),C=t.SanitizeHtmlHelper.sanitize(C));u=function(){return'<table class = "e-gantt-tooltiptable"><tbody><tr><td>'+C+"</td></tr><tr><td>"+(this.parent.disableHtmlEncode?R.replace(/</g,"<").replace(/>/g,">"):R)+"</td></tr></tbody></table>"};n=t.initializeCSPTemplate(u,this);break;case"connectorLine":var M=a.tooltipModule.predecessorTooltipData.fromName,x=a.tooltipModule.predecessorTooltipData.fromId,O=a.tooltipModule.predecessorTooltipData.toName,I=a.tooltipModule.predecessorTooltipData.toId,E=a.tooltipModule.predecessorTooltipData.linkText,F=a.tooltipModule.predecessorTooltipData.offsetString;this.parent.enableHtmlSanitizer&&(M=t.SanitizeHtmlHelper.sanitize(M),x=t.SanitizeHtmlHelper.sanitize(x),O=t.SanitizeHtmlHelper.sanitize(O),I=t.SanitizeHtmlHelper.sanitize(I),E=t.SanitizeHtmlHelper.sanitize(E),F=t.SanitizeHtmlHelper.sanitize(F));u=function(){return'<table class = "e-gantt-tooltiptable"><tbody><tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("from")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+(this.parent.disableHtmlEncode?M.replace(/</g,"<").replace(/>/g,">"):M)+" ("+(this.parent.disableHtmlEncode&&"string"==typeof x?x.replace(/</g,"<").replace(/>/g,">"):x)+')</td></tr><tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("to")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+(this.parent.disableHtmlEncode?O.replace(/</g,"<").replace(/>/g,">"):O)+" ("+I+')</td></tr><tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("taskLink")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+E+'</td></tr><tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("lag")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+F+"</td></tr></tbody></table>"};n=t.initializeCSPTemplate(u,this);break;case"indicator":if(r.target.title.length){var U=r.target.title;this.parent.enableHtmlSanitizer&&"string"==typeof U&&(U=t.SanitizeHtmlHelper.sanitize(U));u=function(){return'<table class = "e-gantt-tooltiptable"><tbody><tr>'+U+"</tr></tbody></table>"};n=t.initializeCSPTemplate(u)}break;case"timeline":var N=r.target.title;this.parent.enableHtmlSanitizer&&"string"==typeof N&&(N=t.SanitizeHtmlHelper.sanitize(N));u=function(){return'<table class = "e-gantt-tooltiptable"><tbody><tr>'+N+"</tr></tbody></table>"};n=t.initializeCSPTemplate(u);break;case"manualtaskbar":var L=this.parent.getFormatedDate(s.autoStartDate,this.parent.getDateFormat()),V=this.parent.getFormatedDate(s.autoEndDate,this.parent.getDateFormat()),B=this.parent.getDurationString(s.duration,s.durationUnit),A=this.parent.getFormatedDate(s.startDate,this.parent.getDateFormat()),W=this.parent.getFormatedDate(s.endDate,this.parent.getDateFormat());this.parent.enableHtmlSanitizer&&(L=t.SanitizeHtmlHelper.sanitize(L),V=t.SanitizeHtmlHelper.sanitize(V),B=t.SanitizeHtmlHelper.sanitize(B),A=t.SanitizeHtmlHelper.sanitize(A),W=t.SanitizeHtmlHelper.sanitize(W));var H='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksStartDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+L+"</td></tr>",j='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksEndDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+V+"</td></tr>",z='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("duration")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+B+"</td></tr>",q='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("startDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+A+"</td></tr>",_='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("endDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+W+"</td></tr>",u=function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+o+q+H+_+j+z+"</tbody></table>"};n=t.initializeCSPTemplate(u);break;case"manualmilestone":var Z=this.parent.getFormatedDate(s.autoStartDate,this.parent.getDateFormat()),X=this.parent.getFormatedDate(s.autoEndDate,this.parent.getDateFormat()),Y=this.parent.getFormatedDate(s.startDate,this.parent.getDateFormat());this.parent.enableHtmlSanitizer&&(Z=t.SanitizeHtmlHelper.sanitize(Z),X=t.SanitizeHtmlHelper.sanitize(X),Y=t.SanitizeHtmlHelper.sanitize(Y));var K='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksStartDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+Z+"</td></tr>",Q='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksEndDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+X+"</td></tr>",$='<tr><td class = "e-gantt-tooltip-label"> Date</td><td>:</td><td class = "e-gantt-tooltip-value">'+Y+"</tr>",u=function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+o+$+K+Q+"</tbody></table>"};n=t.initializeCSPTemplate(u)}return n},e.prototype.getMarkerTooltipData=function(e){var t=e.target.id.match(/\d+/g);return this.parent.eventMarkers[Number(t)]},e.prototype.getPredecessorTooltipData=function(e){var i=e.target.id;this.parent.enableHtmlSanitizer&&"string"==typeof i&&(i=t.SanitizeHtmlHelper.sanitize(i));var a=i.match(/ConnectorLineparent(.*)child(.*)/);a.shift();var r,n;"ResourceView"===this.parent.viewType?(r=this.parent.flatData[this.parent.getTaskIds().indexOf("T"+a[0])],n=this.parent.flatData[this.parent.getTaskIds().indexOf("T"+a[1])]):(r=this.parent.flatData[this.parent.ids.indexOf(a[0])],n=this.parent.flatData[this.parent.ids.indexOf(a[1])]);var s=r.ganttProperties.predecessor.filter(function(e){return e.to===a[1]});return{fromId:"ResourceView"===this.parent.viewType?r.ganttProperties.taskId:r.ganttProperties.rowUniqueID,toId:"ResourceView"===this.parent.viewType?n.ganttProperties.taskId:n.ganttProperties.rowUniqueID,fromName:r.ganttProperties.taskName,toName:n.ganttProperties.taskName,linkType:s[0].type,linkText:this.parent.getPredecessorTextValue(s[0].type),offset:s[0].offset,offsetUnit:s[0].offsetUnit,offsetString:this.parent.getDurationString(s[0].offset,s[0].offsetUnit)}},e.prototype.templateCompiler=function(e,i,a,r){var n=i.chartRowsModule.templateCompiler(e),s=i.chartRowsModule.getTemplateID(r);return n(t.extend({index:0},a),i,r,s,!0)},e.prototype.destroy=function(){this.toolTipObj.destroy()},e}(),ht=function(){function e(e){this.isFromKeyboardAction=!1,this.parent=e,this.activeElement=null,this.previousActiveElement=null}return e.prototype.getActiveElement=function(e){return e?this.previousActiveElement:this.activeElement},e.prototype.setActiveElement=function(e){this.previousActiveElement=this.activeElement,this.activeElement=e},e.prototype.onKeyPress=function(e){var i=this.parent,a=e.target,r=i.getExpandedRecords(i.currentViewData);!t.isNullOrUndefined(this.parent.focusModule.getActiveElement())||"expandAll"!==e.action&&"collapseAll"!==e.action||(c=this.parent.element.querySelector(".e-treegrid")).focus(),!this.parent.isEdit&&!t.isNullOrUndefined(a)&&a.closest(".e-headercell")&&"Enter"===e.key&&this.parent.sortModule&&this.parent.allowSorting&&(e.action="enter",this.parent.treeGrid.grid.notify("key-pressed",e));var n=this.parent.focusModule.getActiveElement();if("home"!==e.action&&"end"!==e.action&&"downArrow"!==e.action&&"upArrow"!==e.action&&"delete"!==e.action&&"rightArrow"!==e.action&&"leftArrow"!==e.action&&"focusTask"!==e.action&&"focusSearch"!==e.action&&"expandAll"!==e.action&&"collapseAll"!==e.action&&"undo"!==e.action&&"redo"!==e.action&&"selectAll"!==e.action||t.isNullOrUndefined(i.editModule)||t.isNullOrUndefined(i.editModule.cellEditModule)||!0!==i.editModule.cellEditModule.isCellEdit)switch(i.isAdaptive&&("addRowDialog"!==e.action&&"editRowDialog"!==e.action&&"delete"!==e.action&&"addRow"!==e.action||i.selectionModule&&"Multiple"===i.selectionSettings.type&&(i.selectionModule.hidePopUp(),document.getElementsByClassName("e-gridpopup")[0].style.display="none")),e.action){case"home":if(i.selectionModule&&"Cell"!==i.selectionSettings.mode){if(0===i.selectedRowIndex)return;i.selectionModule&&0===i.selectionModule.getCellSelectedRecords().length&&i.selectionModule.selectRow(0,!1,!0)}break;case"end":if(i.selectionModule&&"Cell"!==i.selectionSettings.mode){var s=r[r.length-1];if(i.selectedRowIndex===i.flatData.indexOf(s))return;i.selectionModule&&0===i.selectionModule.getCellSelectedRecords().length&&i.selectionModule.selectRow(i.flatData.indexOf(s),!1,!0)}break;case"downArrow":case"upArrow":(y=i.element.querySelector("#"+i.element.id+"_searchbar"))&&y.parentElement.classList.contains("e-input-focus")&&i.selectionModule.clearSelection(),i.element.classList.contains("e-scroll-disabled")||(this.upDownKeyNavigate(e),t.isNullOrUndefined(n)||t.isNullOrUndefined(n.closest(".e-chart-row"))||i.ganttChartModule.manageFocus(this.getActiveElement(),"remove",!0,e.action),i.selectionSettings&&"Both"===i.selectionSettings.mode&&e.target instanceof HTMLElement&&e.target.classList.contains("e-cellselectionbackground")&&e.target.classList.remove("e-cellselectionbackground"));break;case"expandAll":i.ganttChartModule.expandCollapseAll("expand");break;case"collapseAll":i.ganttChartModule.expandCollapseAll("collapse");break;case"expandRow":case"collapseRow":this.expandCollapseKey(e);break;case"saveRequest":if(!t.isNullOrUndefined(i.editModule)&&!t.isNullOrUndefined(i.editModule.cellEditModule)&&i.editModule.cellEditModule.isCellEdit){var o=i.editModule.cellEditModule.editedColumn;if(o.field===i.columnMapping.duration&&!t.isNullOrUndefined(o.edit)&&!t.isNullOrUndefined(o.edit.read)){var l=e.target.ej2_instances[0],d=e.target.value,h=void 0;o.field===i.columnMapping.duration&&(t.isNullOrUndefined(o.edit)||t.isNullOrUndefined(o.edit.read)||(h=o.edit.read()),d!==h.toString()&&(l.value=d,l.dataBind()))}if(i.editModule.dialogModule.dialogObj&&t.getValue("dialogOpen",i.editModule.dialogModule.dialogObj))return;i.treeGrid.grid.saveCell(),(c=i.element.querySelector(".e-treegrid")).focus()}if(!t.isNullOrUndefined(n)&&!t.isNullOrUndefined(n.closest(".e-chart-row"))){var p=e.target,u=n.querySelector(".e-gantt-parent-taskbar,.e-gantt-child-taskbar,.e-gantt-milestone");u&&this.parent.ganttChartModule.onTaskbarClick(e,p,u)}break;case"escape":t.isNullOrUndefined(i.editModule)||t.isNullOrUndefined(i.editModule.cellEditModule)||(i.editModule.cellEditModule.isCellEdit=!1,t.isNullOrUndefined(i.toolbarModule)||i.toolbarModule.refreshToolbarItems());break;case"addRow":if(i.editModule&&i.editModule.cellEditModule&&i.editModule.cellEditModule.isCellEdit)e.stopPropagation();else if(t.isNullOrUndefined(document.getElementById(this.parent.element.id+"_dialog"))){e.preventDefault(),i.addRecord(void 0,this.parent.editSettings.newRowPosition,this.parent.selectedRowIndex);var c=i.element;c.focus()}break;case"addRowDialog":if(e.preventDefault(),i.editModule&&i.editModule.dialogModule&&i.editSettings.allowAdding){if(i.editModule.dialogModule.dialogObj&&t.getValue("dialogOpen",i.editModule.dialogModule.dialogObj))return;i.editModule.dialogModule.openAddDialog()}break;case"editRowDialog":if(e.preventDefault(),i.element.querySelector(".e-treegrid").focus(),i.editModule&&i.editModule.dialogModule&&i.editSettings.allowEditing){if(i.editModule.dialogModule.dialogObj&&t.getValue("dialogOpen",i.editModule.dialogModule.dialogObj))return;i.editModule.dialogModule.openToolbarEditDialog()}break;case"delete":i.selectionModule&&i.editModule&&i.editModule.dialogModule&&(!i.editModule.dialogModule.dialogObj||i.editModule.dialogModule.dialogObj&&!i.editModule.dialogModule.dialogObj.visible)&&(!i.editSettings.allowTaskbarEditing||i.editSettings.allowTaskbarEditing&&!i.editModule.taskbarEditModule.touchEdit)&&("Cell"!==i.selectionSettings.mode&&i.selectionModule.selectedRowIndexes.length||"Cell"===i.selectionSettings.mode&&i.selectionModule.getSelectedRowCellIndexes().length)&&(t.isNullOrUndefined(e.target)?i.editModule.startDeleteAction():"INPUT"!==e.target.tagName&&i.editModule.startDeleteAction());break;case"focusTask":e.preventDefault();var g=void 0;if(i.selectionModule){var f=i.currentViewData;if("Cell"===i.selectionSettings.mode||t.isNullOrUndefined(f[i.selectedRowIndex])){if("Cell"===i.selectionSettings.mode&&i.selectionModule.getSelectedRowCellIndexes().length>0){var m=i.selectionModule.getSelectedRowCellIndexes();g=f[m[m.length-1].rowIndex].ganttProperties.rowUniqueID}}else g=i.currentViewData[i.selectedRowIndex].ganttProperties.rowUniqueID}g&&i.scrollToTask(g.toString());break;case"focusSearch":if(i.element.querySelector("#"+i.element.id+"_searchbar")){var y=i.element.querySelector("#"+i.element.id+"_searchbar");y.setAttribute("tabIndex","-1"),y.focus()}break;case"tab":case"shiftTab":i.element.classList.contains("e-scroll-disabled")||i.ganttChartModule.onTabAction(e);break;case"contextMenu":var D=document.getElementById(this.parent.element.id+"_contextmenu").ej2_instances[0],v=this.parent.getOffsetRect(e.target),k=v.top+v.height/2,b=v.left+v.width/2;this.setActiveElement(e.target),D.open(k,b),e.preventDefault();break;case"undo":this.parent.undoRedoModule&&this.parent.undoRedoModule.getUndoCollection.length>0&&this.parent.undo();break;case"redo":this.parent.undoRedoModule&&this.parent.undoRedoModule.getRedoCollection.length>0&&this.parent.redo();break;case"selectAll":e.preventDefault();var w=[].slice.call(this.parent.ganttChartModule.chartBodyContent.querySelector("tbody").children);if(w.length>0){var T=parseInt(w[0].getAttribute("aria-rowindex"),10)-1,S=parseInt(w[w.length-1].getAttribute("aria-rowindex"),10)-1;t.isNullOrUndefined(T)||(T=Number(T)),t.isNullOrUndefined(S)||(S=Number(S)),t.isNullOrUndefined(T)||t.isNullOrUndefined(S)||this.parent.selectionModule.selectRowsByRange(T,S)}break;default:var P={requestType:"keyPressed",action:e.action,keyEvent:e};i.trigger("actionComplete",P)}},e.prototype.upDownKeyNavigate=function(e){e.preventDefault();var i,a=this.parent;if(i=("downArrow"===e.action||"upArrow"===e.action)&&this.parent.selectionModule&&this.parent.allowSelection&&this.parent.virtualScrollModule&&this.parent.enableVirtualization?a.getExpandedRecords(a.flatData):a.getExpandedRecords(a.currentViewData),a.selectionModule){if("Cell"!==a.selectionSettings.mode&&-1!==a.selectedRowIndex){p=void 0;p=("downArrow"===e.action||"upArrow"===e.action)&&this.parent.selectionModule&&this.parent.allowSelection&&this.parent.virtualScrollModule&&this.parent.enableVirtualization?a.flatData[a.selectedRowIndex]:a.currentViewData[a.selectedRowIndex];var r=a.element.querySelector(".e-focused");r&&t.removeClass([r],"e-focused");var n=i.indexOf(p),s="downArrow"===e.action?i[n+1]:i[n-1],o=this.parent.args;document.activeElement!==o&&(("downArrow"===e.action||"upArrow"===e.action)&&this.parent.selectionModule&&this.parent.allowSelection&&this.parent.virtualScrollModule&&this.parent.enableVirtualization?a.selectionModule.selectRow(a.flatData.indexOf(s),!1,!0):a.selectionModule.selectRow(a.currentViewData.indexOf(s),!1,!0))}else if("Cell"===a.selectionSettings.mode&&a.selectionModule.getSelectedRowCellIndexes().length>0){var l=a.selectionModule.getSelectedRowCellIndexes(),d=l[l.length-1],h=d.cellIndexes[d.cellIndexes.length-1],p=a.currentViewData[d.rowIndex],n=i.indexOf(p),s="downArrow"===e.action?i[n+1]:i[n-1],u={rowIndex:a.currentViewData.indexOf(s),cellIndex:h};a.selectionModule.selectCell(u)}this.parent.ganttChartModule.focusedRowIndex=this.parent.selectedRowIndex}},e.prototype.expandCollapseKey=function(e){var t=this.parent;if(t.selectionModule&&-1!==t.selectedRowIndex){var i;if("Cell"!==t.selectionSettings.mode)i=t.selectedRowIndex;else if("Cell"===t.selectionSettings.mode&&t.selectionModule.getSelectedRowCellIndexes().length>0){var a=t.selectionModule.getSelectedRowCellIndexes();i=a[a.length-1].rowIndex}this.parent.virtualScrollModule&&this.parent.enableVirtualization&&(i=this.parent.currentViewData.findIndex(function(e){return e.ganttProperties.rowUniqueID===i.toString()})+1),"expandRow"===e.action?(this.isFromKeyboardAction=!0,t.expandByIndex(i),this.isFromKeyboardAction=!1):(this.isFromKeyboardAction=!0,t.collapseByIndex(i),this.isFromKeyboardAction=!1)}},e}(),pt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),ut=function(e,t,i,a){var r,n=arguments.length,s=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(n<3?r(s):n>3?r(t,i,s):r(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},ct=function(e){function s(i,a){var r=e.call(this,i,a)||this;return r.isRowSelected=!1,r.showIndicator=!0,r.singleTier=0,r.expandedRecords=[],r.isLocaleChanged=!1,r.triggeredColumnName="",r.totalUndoAction=0,r.previousFlatData=[],r.isExpandPerformed=!1,r.oldRecords=[],r.updateDuration=!1,r.isConvertedMilestone=!1,r.isCancelled=!1,r.isCollapseAll=!1,r.previousRecords={},r.editedRecords=[],r.modifiedRecords=[],r.isOnEdit=!1,r.isOnDelete=!1,r.isOnAdded=!1,r.isExpandCollapseLevelMethod=!1,r.isFromEventMarker=!1,r.isDynamicData=!1,r.isConnectorLineUpdate=!1,r.staticSelectedRowIndex=-1,r.needsID=!0,r.showActiveElement=!0,r.addDeleteRecord=!1,r.enableHeaderFocus=!0,r.enableValidation=!0,r.isTreeGridRendered=!1,r.isFromOnPropertyChange=!1,r.isFromRenderBaseline=!1,r.isGanttChartRendered=!1,r.isEdit=!1,r.eventMarkerColloction=[],t.setValue("mergePersistData",r.mergePersistGanttData,r),r}return pt(s,e),s.prototype.getModuleName=function(){return"gantt"},s.prototype.preRender=function(){this.initProperties()},s.prototype.getCurrentDayStartTime=function(e){return this.weekWorkingTime.length>0?this.getStartTime(e):this.defaultStartTime},s.prototype.getCurrentDayEndTime=function(e){return this.weekWorkingTime.length>0?this.getEndTime(e):this.defaultEndTime},s.prototype.getStartTime=function(e){var t;switch(e.getDay()){case 0:t=this.sundayDefaultStartTime;break;case 1:t=this.mondayDefaultStartTime;break;case 2:t=this.tuesdayDefaultStartTime;break;case 3:t=this.wednesdayDefaultStartTime;break;case 4:t=this.thursdayDefaultStartTime;break;case 5:t=this.fridayDefaultStartTime;break;default:t=this.saturdayDefaultStartTime}return t},s.prototype.getEndTime=function(e){var t;switch(e.getDay()){case 0:t=this.sundayDefaultEndTime;break;case 1:t=this.mondayDefaultEndTime;break;case 2:t=this.tuesdayDefaultEndTime;break;case 3:t=this.wednesdayDefaultEndTime;break;case 4:t=this.thursdayDefaultEndTime;break;case 5:t=this.fridayDefaultEndTime;break;default:t=this.saturdayDefaultEndTime}return t},s.prototype.getNonWorkingRange=function(e){var t;switch(e.getDay()){case 0:t=this.sundayNonWorkingTimeRanges;break;case 1:t=this.mondayNonWorkingTimeRanges;break;case 2:t=this.tuesdayNonWorkingTimeRanges;break;case 3:t=this.wednesdayNonWorkingTimeRanges;break;case 4:t=this.thursdayNonWorkingTimeRanges;break;case 5:t=this.fridayNonWorkingTimeRanges;break;default:t=this.saturdayNonWorkingTimeRanges}return t},s.prototype.getWorkingRange=function(e){var t;switch(e.getDay()){case 0:t=this.sundayWorkingTimeRanges;break;case 1:t=this.mondayWorkingTimeRanges;break;case 2:t=this.tuesdayWorkingTimeRanges;break;case 3:t=this.wednesdayWorkingTimeRanges;break;case 4:t=this.thursdayWorkingTimeRanges;break;case 5:t=this.fridayWorkingTimeRanges;break;default:t=this.saturdayWorkingTimeRanges}return t},s.prototype.getSecondsPerDay=function(e){var t;switch(e.getDay()){case 0:t=this.sundaySeconds;break;case 1:t=this.mondaySeconds;break;case 2:t=this.tuesdaySeconds;break;case 3:t=this.wednesdaySeconds;break;case 4:t=this.thursdaySeconds;break;case 5:t=this.fridaySeconds;break;case 6:t=this.saturdaySeconds;break;default:t=this.secondsPerDay}return t},s.prototype.showLoadingIndicator=function(){t.isNullOrUndefined(this.loadingIndicator)||"Shimmer"!==this.loadingIndicator.indicatorType?this.showSpinner():this.showMaskRow()},s.prototype.hideLoadingIndicator=function(){t.isNullOrUndefined(this.loadingIndicator)||"Shimmer"!==this.loadingIndicator.indicatorType?this.hideSpinner():this.hideMaskRow()},s.prototype.initProperties=function(){this.globalize=new t.Internationalization(this.locale),this.isAdaptive=t.Browser.isDevice,this.flatData=[],this.currentViewData=[],this.updatedRecords=[],this.ids=[],this.ganttColumns=[],this.updateOffsetOnTaskbarEdit=!1===this.UpdateOffsetOnTaskbarEdit?this.UpdateOffsetOnTaskbarEdit:this.updateOffsetOnTaskbarEdit,this.localeObj=new t.L10n(this.getModuleName(),this.getDefaultLocale(),this.locale),this.dataOperation=new E(this),this.nonWorkingHours=[],this.mondayNonWorkingHours=[],this.tuesdayNonWorkingHours=[],this.wednesdayNonWorkingHours=[],this.thursdayNonWorkingHours=[],this.fridayNonWorkingHours=[],this.saturdayNonWorkingHours=[],this.sundayNonWorkingHours=[],this.nonWorkingTimeRanges=[],this.mondayNonWorkingTimeRanges=[],this.tuesdayNonWorkingTimeRanges=[],this.wednesdayNonWorkingTimeRanges=[],this.thursdayNonWorkingTimeRanges=[],this.fridayNonWorkingTimeRanges=[],this.saturdayNonWorkingTimeRanges=[],this.sundayNonWorkingTimeRanges=[],this.workingTimeRanges=[],this.mondayWorkingTimeRanges=[],this.tuesdayWorkingTimeRanges=[],this.wednesdayWorkingTimeRanges=[],this.thursdayWorkingTimeRanges=[],this.fridayWorkingTimeRanges=[],this.saturdayWorkingTimeRanges=[],this.sundayWorkingTimeRanges=[],this.defaultEndTime=null,this.defaultStartTime=null,this.mondayDefaultStartTime=null,this.mondayDefaultEndTime=null,this.tuesdayDefaultStartTime=null,this.tuesdayDefaultEndTime=null,this.wednesdayDefaultStartTime=null,this.wednesdayDefaultEndTime=null,this.thursdayDefaultStartTime=null,this.thursdayDefaultEndTime=null,this.fridayDefaultStartTime=null,this.fridayDefaultEndTime=null,this.saturdayDefaultStartTime=null,this.saturdayDefaultEndTime=null,this.sundayDefaultStartTime=null,this.sundayDefaultEndTime=null,this.durationUnitTexts={days:"days",hours:"hours",minutes:"minutes",day:"day",hour:"hour",minute:"minute"},this.durationUnitEditText={minute:["m","min","minute","minutes"],hour:["h","hr","hour","hours"],day:["d","dy","day","days"]},this.perDayWidth=null,this.isMileStoneEdited=!1,this.chartVerticalLineContainer=null,this.updatedConnectorLineCollection=[],this.connectorLineIds=[],this.predecessorsCollection=[],this.isInPredecessorValidation=this.enablePredecessorValidation,this.isValidationEnabled=!0,this.isLoad=!0,this.editedPredecessorRecords=[],this.validationDialogElement=null,this.currentEditedArgs={},this.dialogValidateMode={respectLink:!1,removeLink:!1,preserveLinkWithEditing:!0},this.taskFields.constraintType&&this.taskFields.constraintDate&&(this.dialogValidateMode.respectMustStartOn=!1,this.dialogValidateMode.respectMustFinishOn=!1,this.dialogValidateMode.respectStartNoLaterThan=!1,this.dialogValidateMode.respectFinishNoLaterThan=!1),this.secondsPerDay=this.dataOperation.getSecondsPerDay(),this.nonWorkingDayIndex=[],this.dataOperation.getNonWorkingDayIndex(),this.columnMapping={},this.controlId=this.element.id,this.cloneProjectStartDate=this.enablePersistence&&this.cloneProjectStartDate?this.cloneProjectStartDate:null,this.cloneProjectEndDate=this.enablePersistence&&this.cloneProjectEndDate?this.cloneProjectEndDate:null,this.totalHolidayDates=this.dataOperation.getHolidayDates(),this.ganttChartModule=new Q(this),this.timelineModule=new J(this),this.chartRowsModule=new nt(this),this.treeGridModule=new te(this),this.dateValidationModule=new O(this),this.predecessorModule=new st(this),this.connectorLineModule=new ot(this),this.splitterModule=new lt(this),this.tooltipModule=new dt(this),this.keyConfig={home:"home",end:"end",downArrow:"downarrow",upArrow:"uparrow",collapseAll:"ctrl+uparrow",expandAll:"ctrl+downarrow",collapseRow:"ctrl+shift+uparrow",expandRow:"ctrl+shift+downarrow",saveRequest:"13",escape:"27",addRow:"insert",addRowDialog:"ctrl+insert",editRowDialog:"ctrl+f2",delete:"delete",tab:"tab",shiftTab:"shift+tab",focusTask:"shift+f5",indentLevel:"shift+leftarrow",outdentLevel:"shift+rightarrow",focusSearch:"ctrl+shift+70",contextMenu:"shift+F10",undo:"ctrl+z",redo:"ctrl+y",selectAll:"ctrl+a"},this.focusModule=new ht(this),0===this.zoomingLevels.length&&this.setProperties({zoomingLevels:this.getZoomingLevels()},!0),this.resourceFieldsMapping(),t.isNullOrUndefined(this.resourceFields.unit)&&this.setProperties({resourceFields:{unit:"unit"}},!0),this.taskIds=[]},s.prototype.isUndoRedoItemPresent=function(e){return!(!this.undoRedoModule||!this.undoRedoActions||-1===this.undoRedoActions.indexOf(e))},s.prototype.getDateFormat=function(){return t.isNullOrUndefined(this.dateFormat)?this.globalize.getDatePattern({skeleton:"yMd"}):this.dateFormat},s.prototype.getDefaultTZOffset=function(){var e=new Date((new Date).getFullYear(),0,1),t=new Date((new Date).getFullYear(),6,1);return Math.max(e.getTimezoneOffset(),t.getTimezoneOffset())},s.prototype.isInDst=function(e){return e.getTimezoneOffset()<this.getDefaultTZOffset()},s.prototype.resourceFieldsMapping=function(){var e=this.resourceFields;e.id=t.isNullOrUndefined(e.id)?this.resourceIDMapping:e.id,e.name=t.isNullOrUndefined(e.name)?this.resourceNameMapping:e.name},s.prototype.validateDimentionValue=function(e){return t.isNullOrUndefined(e)?null:"string"==typeof e&&"auto"!==e&&-1===e.indexOf("%")?-1===e.indexOf("px")?e+"px":e:"number"==typeof e?e+"px":e.toString()},s.prototype.calculateDimensions=function(){var e=this.validateDimentionValue(this.height),i=this.validateDimentionValue(this.width);t.isNullOrUndefined(this.width)||"string"!=typeof this.width||-1===this.width.indexOf("%")||(i=this.width);var a=this.element.style.height,r=this.element.style.width;i&&(this.element.style.width=i),e&&(this.element.style.height=e),e||a||(this.element.style.height="auto"),i||r||(this.element.style.width="auto"),this.ganttHeight=this.element.offsetHeight,this.ganttWidth=this.element.offsetWidth},s.prototype.render=function(){this.isReact&&(this.treeGrid.isReact=!0,this.treeGrid.grid.isReact=!0),this.isVue&&(this.treeGrid.isVue=!0,this.treeGrid.grid.isVue=!0,this.treeGrid.vueInstance=this.vueInstance,this.treeGrid.grid.vueInstance=this.vueInstance),this.taskFields&&this.taskFields.constraintDate&&this.taskFields.constraintType&&!this.updateOffsetOnTaskbarEdit&&(this.updateOffsetOnTaskbarEdit=!1),this.element.setAttribute("role","application"),i.createSpinner({target:this.element},this.createElement),this.trigger("load",{}),this.element.classList.add("e-gantt"),this.isAdaptive?this.element.classList.add("e-device"):this.element.classList.remove("e-device"),this.calculateDimensions(),t.isNullOrUndefined(this.toolbarModule)||this.renderToolbar(),this.splitterModule.renderSplitter(),this.notify("renderPanels",null),this.actionFailures(),this.showLoadingIndicator(),this.dataMap&&this.dataMap.clear(),this.dataOperation.checkDataBinding()},s.prototype.actionFailures=function(){function e(e,i,a,r){var n;t.isNullOrUndefined(a)||(n=a.filter(function(t){return t.prototype.getModuleName()===e})),i&&!t.isNullOrUndefined(n)&&0===n.length&&r.push("Module "+e+" is not available in Gantt component! You either misspelled the module name or forgot to load it!")}var i=[],r=/^[a-zA-Z\s/]+$/,n=!0,s=this.taskFields.properties;Object.keys(s).forEach(function(e){null!==s[e]&&(n=!1)});for(var o=!0,l=0;l<this.columns.length;l++)if(this.columns[l].isPrimaryKey){o=!1;break}n&&i.push("Gantt Task Fields are not configured properly. The task fields are crucial for both the project and resource views to function properly. Please ensure that the gantt task fields are properly configured!"),"ResourceView"===this.viewType&&(this.resourceFields.id||i.push("Gantt Resource Fields are not properly configured, which is crucial for the Resource View. Please ensure that the resource fields are configured correctly!")),this.dataSource instanceof a.DataManager&&t.isNullOrUndefined(this.taskFields.hasChildMapping)&&i.push("hasChildMapping property is not configured for load-on-demand. Please ensure its properly configured in the Gantt Task Fields!"),t.isNullOrUndefined(this.timelineSettings.topTier.format)||""===this.timelineSettings.topTier.format||r.test(this.timelineSettings.topTier.format)||i.push("The provided top tier format is invalid. Please ensure that you provide a valid format for these tier. Make sure to use only letters and avoid numbers or special characters!"),t.isNullOrUndefined(this.timelineSettings.bottomTier.format)||""===this.timelineSettings.bottomTier.format||r.test(this.timelineSettings.bottomTier.format)||i.push("The provided bottom tier format is invalid. Please ensure that you provide a valid format for these tier. Make sure to use only letters and avoid numbers or special characters!"),o&&"ResourceView"!==this.viewType&&i.push("Primarykey is not configured properly. The primarykey is crucial for doing CRUD operations or map taskId in column field of gantt!"),this.eventMarkers.length>0&&this.eventMarkers.forEach(function(e){e.day||i.push("Day is not configured properly in event markers.Please ensure that the day in event markers is properly configured!")}),e("sort",this.allowSorting,this.injectedModules,i);var d;(this.editSettings.allowAdding||this.editSettings.allowDeleting||this.editSettings.allowEditing||this.editSettings.allowNextRowEdit||this.editSettings.allowTaskbarEditing||this.editSettings.mode||this.editSettings.newRowPosition||this.editSettings.showDeleteConfirmDialog)&&(d=!0),e("edit",d,this.injectedModules,i),e("reorder",this.allowReordering,this.injectedModules,i),e("excelExport",this.allowExcelExport,this.injectedModules,i);var h;(this.allowRowDragAndDrop||this.allowTaskbarDragAndDrop)&&(h=!0),e("rowDragAndDrop",h,this.injectedModules,i),e("criticalPath",this.enableCriticalPath,this.injectedModules,i),e("undoRedo",this.enableUndoRedo,this.injectedModules,i),e("resize",this.allowResizing,this.injectedModules,i);var p;this.toolbar&&this.toolbar.length>0&&(p=!0),e("toolbar",p,this.injectedModules,i);var u;(this.allowFiltering||this.toolbar&&-1!==this.toolbar.indexOf("Search"))&&(u=!0),e("filter",u,this.injectedModules,i),e("selection",this.allowSelection,this.injectedModules,i);var c;if((this.highlightWeekends||this.holidays&&this.holidays.length>0||this.eventMarkers&&this.eventMarkers.length>0)&&(c=!0),e("dayMarkers",c,this.injectedModules,i),e("contextMenu",this.enableContextMenu,this.injectedModules,i),e("columnMenu",this.showColumnMenu,this.injectedModules,i),e("pdfExport",this.allowPdfExport,this.injectedModules,i),e("virtualScroll",this.enableVirtualization,this.injectedModules,i),i.length>0){var g={error:{}};i.forEach(function(e,t){g.error[parseInt(t,10)]=e}),this.trigger("actionFailure",g)}},s.prototype.hideMaskRow=function(){var e=this.element.querySelectorAll(".e-masked-table").length;if(!t.isNullOrUndefined(this.contentMaskTable)&&(0!==e||this.contentMaskTable)){i=this.contentMaskTable;t.remove(i),this.contentMaskTable=null}if(e=this.element.querySelectorAll(".e-masked-table").length,!t.isNullOrUndefined(this.headerMaskTable)&&(0!==e||this.headerMaskTable)){var i=this.headerMaskTable;t.remove(i),this.headerMaskTable=null}for(;0!==this.element.querySelectorAll(".e-table-background").length;)this.element.querySelectorAll(".e-table-background")[0].remove();for(;0!==this.element.querySelectorAll(".e-temp-timeline").length;)this.element.querySelectorAll(".e-temp-timeline")[0].remove();if(0!==this.element.querySelectorAll(".e-timeline-header-table-container").length)for(var a=0;a<this.singleTier;a++)t.isNullOrUndefined(this.element.querySelectorAll(".e-timeline-header-table-container")[parseInt(a.toString(),10)])||(this.element.querySelectorAll(".e-timeline-header-table-container")[parseInt(a.toString(),10)].style.visibility="visible");t.isNullOrUndefined(this.element.querySelector(".e-timeline-header-container"))||(this.element.querySelector(".e-timeline-header-container").style.position="relative"),t.isNullOrUndefined(this.element.getElementsByClassName("e-chart-rows-container")[0])||(this.element.getElementsByClassName("e-chart-rows-container")[0].style.visibility="visible")},s.prototype.showMaskRow=function(){var e=this.chartPane.childNodes[0].childNodes[0];this.scrollLeftValue=this.chartPane.childNodes[0].childNodes[0].scrollLeft;var t=this.chartPane.childNodes[0].childNodes[1];if(this.treeGrid.element&&this.ganttChartModule.setVirtualHeight(),!this.contentMaskTable){if(t){a=t;if(this.renderBackGround(a),this.ganttChartModule.scrollObject.isSetScrollLeft){if(0!==this.element.querySelectorAll(".e-timeline-header-table-container").length){this.singleTier=this.timelineModule.isSingleTier?1:2;for(var i=0;i<this.singleTier;i++)this.element.querySelectorAll(".e-timeline-header-table-container")[parseInt(i.toString(),10)].style.visibility="hidden"}0===this.singleTier&&(this.singleTier=2)}this.element.getElementsByClassName("e-chart-rows-container")[0].style.visibility="hidden",this.contentMaskTable=this.contentMaskTable=this.createMaskTable(a)}if(e&&this.ganttChartModule.scrollObject.isSetScrollLeft){this.element.querySelector(".e-timeline-header-container").style.position="static";var a=e;this.renderHeaderBackground(a),this.headerMaskTable=this.headerMaskTable=this.createMaskTable(a)}}},s.prototype.convertToWBSPredecessor=function(e,t){var i=this;return e.split(",").map(function(e){var t=e.trim().match(/^(.*?)(FS|SS|FF|SF|\+|\s|$)(.*)/i);return t?i.getRecordByID(t[1]).ganttProperties.wbsCode+(t[2]+t[3]).trim():e.trim()}).join(",")},s.prototype.updateWBSPredecessor=function(e){var t=e[this.taskFields.dependency]&&""!==e[this.taskFields.dependency]?this.convertToWBSPredecessor(e[this.taskFields.dependency],e):null;e.WBSPredecessor=t,e.ganttProperties.wbsPredecessor=t},s.prototype.updateWBSCodes=function(e,t,i,a){var r=this.getParentTask(e.parentItem),n=(i.get(r)||0)+1;i.set(r,n);var s;return s=r?t.get(r)+"."+n:""+n,t.set(e,s),a||(e.WBSCode=s.toString(),e.ganttProperties.wbsCode=s.toString()),{wbsMap:t,siblingCountMap:i}},s.prototype.getMaxRootWBSCode=function(e,t){for(var i="",a=0,r=e;a<r.length;a++){var n=r[a].ganttProperties.wbsCode;if(n){for(var s=i.split(".").map(Number),o=n.split(".").map(Number),l=Math.max(s.length,o.length),d=!1,h=0;h<l;h++){var p=o[h]?o[h]:0,u=s[h]?s[h]:0;if(p>u){d=!0;break}if(p<u)break}!d&&i||(i=n)}}if(i){var c=i.split(".").map(Number);return c[c.length-1]++,c.join(".")}return t.ganttProperties.wbsCode+".1"},s.prototype.generateWBSCodes=function(e){for(var t=new Map,i=[],a=new Map,r=0,n=e;r<n.length;r++){p=n[r];if(this.enableAutoWbsUpdate||this.isLoad){var s=this.updateWBSCodes(p,t,a);t=s.wbsMap,a=s.siblingCountMap}else if(!p.ganttProperties.wbsCode){var o=void 0;if(p.parentItem){var l=this.getParentTask(p.parentItem);o=l.ganttProperties.wbsCode,o=this.getMaxRootWBSCode(l.childRecords,l)}else o=this.getMaxRootWBSCode(this.treeGrid.parentData);p.WBSCode=o,p.ganttProperties.wbsCode=o}p[this.taskFields.dependency]?i.push(p):(p.WBSPredecessor=null,p.ganttProperties.wbsPredecessor=null)}for(var d=0,h=i;d<h.length;d++){var p=h[d];this.updateWBSPredecessor(p)}},s.prototype.renderHeaderBackground=function(e){var i=e;if(!!t.closest(i,".e-timeline-header-container")){for(var a=this.createElement("div",{className:"e-table-background"}),r=0,n=Math.round(e.getBoundingClientRect().width),s=0;s<3;s++)this.enableRtl?a.appendChild(this.createElement("div",{className:"e-div-background",attrs:{style:"left: "+(n-=160)+"px; top:0px;"}})):a.appendChild(this.createElement("div",{className:"e-div-background",attrs:{style:"left: "+(r+=160)+"px; top:0px;"}}));i.insertBefore(a,i.firstChild)}},s.prototype.assignTimeToDate=function(e,t){var i=new Date(e),a=Math.floor(t/3600),r=Math.floor(t%3600/60),n=t%60;return i.setHours(a,r,n,0),i},s.prototype.renderBackGround=function(e){var i=e;if(!!t.closest(i,".e-chart-root-container")){for(var a=this.createElement("div",{className:"e-table-background"}),r=0,n=Math.round(e.getBoundingClientRect().width),s=0;s<3;s++)this.enableRtl?a.appendChild(this.createElement("div",{className:"e-div-background",attrs:{style:"left: "+(n-=160)+"px;z-index:1;"}})):a.appendChild(this.createElement("div",{className:"e-div-background",attrs:{style:"left: "+(r+=160)+"px;z-index:1;"}}));i.insertBefore(a,i.firstChild)}},s.prototype.createMaskTable=function(e){var i,a=e,r=e.getBoundingClientRect().height,n=!!t.closest(a,".e-timeline-header-container");if(n?((i=this.createEmptyTimeLineTable(r)).style.position="sticky",i.style.left="0px",this.enableRtl&&i.style.removeProperty("left")):((i=this.createEmptyMaskTable(r)).style.position="absolute",i.style.zIndex=1),n){i.style.height=e.getBoundingClientRect().height+"px";var s=this.createElement("div",{className:"e-temp-timeline"});s.style.width=this.element.getElementsByClassName("e-timeline-header-container")[0].offsetWidth+"px",s.style.position="sticky",this.enableRtl?s.style["margin-right"]=Math.abs(this.scrollLeftValue)+"px":s.style["margin-left"]=this.scrollLeftValue+"px",s.appendChild(i),a.insertBefore(s,a.firstChild)}else i.style.height=e.getBoundingClientRect().height+"px",a.insertBefore(i,a.firstChild);return i},s.prototype.createEmptyTimeLineTable=function(e){for(var t=this.createElement("table",{className:"e-table e-masked-table"}),i=this.createElement("tbody",{className:"e-masked-tbody"}),a=[],r=this.createElement("tr",{className:"e-masked-row e-row",attrs:{style:"height: "+e/2+"px;"}}),n=0;n<this.singleTier;n++)a.push(r.cloneNode(!0));this.topBottomHeader=0;for(n=0;n<a.length;n++)i.appendChild(this.applyTimelineMaskRow(a[parseInt(n.toString(),10)])),this.topBottomHeader=this.topBottomHeader+1;return t.appendChild(i),t.style.width="100%",t},s.prototype.applyTimelineMaskRow=function(e){var t=e,i=4;this.element.getElementsByClassName("e-timeline-header-container")[0].offsetWidth/166>4&&(i=this.element.getElementsByClassName("e-timeline-header-container")[0].offsetWidth/166);for(r=0;r<i;r++)t.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"}));for(r=0;r<t.childNodes.length-1;r++)t.childNodes[parseInt(r.toString(),10)].style.width="166px";for(var a=[].slice.call(t.childNodes),r=0;r<a.length;r++){var n=a[parseInt(r.toString(),10)];switch(this.topBottomHeader){case 0:this.enableRtl?(n.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-timelineHeader"></span>',n.children[0].style.left="-20px"):n.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-timelineHeader"></span>';break;case 1:n.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"})),n.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"})),n.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"}));for(var s=[].slice.call(n.childNodes),o=0;o<s.length;o++){var l=s[parseInt(o.toString(),10)];0===o?this.enableRtl?(l.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML"></span>',l.children[0].style.left="-14px"):l.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML"></span>':1===o?this.enableRtl?(l.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML1"></span>',l.children[0].style.left="-30px"):l.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML1"></span>':this.enableRtl?(l.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML2"></span>',l.children[0].style.left="-60px"):l.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML2"></span>'}}}return t},s.prototype.createEmptyMaskTable=function(e){var t=this.createElement("table",{className:"e-table e-masked-table"}),i=this.createElement("tbody",{className:"e-masked-tbody"}),a=[],r=this.createElement("tr",{className:"e-masked-row e-row",attrs:{style:"height: "+e/7+"px;"}});this.columnLoop=0;for(var n=0;n<6;n++)a.push(r.cloneNode(!0));for(var s=0;s<a.length;s++)this.columnLoop<4?this.columnLoop=this.columnLoop+1:4===this.columnLoop&&(this.columnLoop=1),i.appendChild(this.applyMaskRow(a[parseInt(s.toString(),10)]));t.appendChild(i),t.style.width="100%";var o=this.createElement("div",{className:"e-temp-container"});return o.style.width="calc(100% - 17px)",o.style.overflow="hidden",o.appendChild(t),o},s.prototype.applyMaskRow=function(e){var t=e;if(this.columnLoop<4){var i=2;this.element.getElementsByClassName("e-timeline-header-container")[0].offsetWidth/300>2&&(i=this.element.getElementsByClassName("e-timeline-header-container")[0].offsetWidth/300);for(r=0;r<i;r++)t.appendChild(this.createElement("td",{className:"e-masked-cell e-rowcell"}))}else t.appendChild(this.createElement("td",{className:"e-masked-cell e-rowcell"}));for(var a=[].slice.call(t.childNodes),r=0;r<a.length;r++){var n=a[parseInt(r.toString(),10)];switch(this.columnLoop){case 1:0===r?this.enableRtl?(n.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell01"></span>',n.children[0].style.left="-14px"):n.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell01"></span>':n.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell02"></span>';break;case 2:0===r?this.enableRtl?(n.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell03"></span>',n.children[0].style.left="-14px"):n.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell03"></span>':n.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell04"></span>';break;case 3:0===r?this.enableRtl?(n.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell05"></span>',n.children[0].style.left="-64px"):n.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell05"></span>':this.enableRtl?(n.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell06"></span>',n.children[0].style.left="-192px"):n.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell06"></span>';break;case 4:this.enableRtl?(n.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell07"></span>',n.children[0].style.left="-388px"):n.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell07"></span>'}}return t},s.prototype.showSpinner=function(){i.showSpinner(this.element)},s.prototype.hideSpinner=function(){i.hideSpinner(this.element)},s.prototype.processTimeline=function(){this.timelineModule.processTimelineUnit(),this.timelineModule.calculateZoomingLevelsPerDayWidth()},s.prototype.renderGantt=function(e){e&&(this.isFromOnPropertyChange=e),this.enableValidation&&(this.dataOperation.calculateProjectDates(),this.timelineModule.validateTimelineProp());var i=this.flatData,a=new Map;if(null!=i)for(var r=0,n=i;r<n.length;r++){var s=n[r];a.set(s.ganttProperties.rowUniqueID.toString(),s)}if(this.allowParentDependency&&this.predecessorModule.updateParentPredecessor(a),this.predecessorModule&&this.taskFields.dependency&&(this.predecessorModule.parentIds=[],this.predecessorModule.parentRecord=[],this.predecessorModule.updatePredecessors(a),this.isInPredecessorValidation&&this.enableValidation&&this.autoCalculateDateScheduling&&(!this.isLoad||this.treeGrid.loadChildOnDemand||!this.taskFields.hasChildMapping)&&this.predecessorModule.updatedRecordsDateByPredecessor(a)),this.enableValidation&&(this.dataOperation.calculateProjectDates(),this.timelineModule.validateTimelineProp(),this.dataOperation.updateGanttData()),e){if(this.dataSource instanceof Object&&y(this)){var o=t.getValue("count",this.dataSource);this.treeGrid.dataSource={result:this.flatData,count:o}}else this.treeGrid.setProperties({dataSource:this.flatData},!1);t.isNullOrUndefined(this.selectionModule)||this.treeGrid.setProperties({selectedRowIndex:this.selectedRowIndex},!1)}else{this.treeGridPane.classList.remove("e-temp-content"),t.isNullOrUndefined(this.treeGridPane.querySelector(".e-gantt-temp-header"))||t.remove(this.treeGridPane.querySelector(".e-gantt-temp-header")),this.notify("dataReady",{}),this.enableContextMenu&&this.notify("initiate-contextMenu",{});var l=!t.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")&&36===this.rowHeight?46:this.rowHeight;this.rowHeight=t.isNullOrUndefined(this.rowHeight)?36:l,this.renderTreeGrid(),this.wireEvents(),this.notify("initPredessorDialog",{})}this.isFromOnPropertyChange||this.splitterModule.updateSplitterPosition(),"Vertical"!==this.gridLines&&"Both"!==this.gridLines||this.dayMarkersModule||this.renderChartVerticalLines()},s.prototype.removeCriticalPathStyles=function(){var e=this.ganttChartModule.chartElement;t.removeClass(e.querySelectorAll(".e-gantt-child-taskbar-inner-div"),"e-gantt-child-critical-taskbar-inner-div"),t.removeClass(e.querySelectorAll(".e-gantt-child-progressbar-inner-div"),"e-gantt-child-critical-progressbar-inner-div"),t.removeClass(e.querySelectorAll(".e-critical-milestone"),"e-critical-milestone"),t.removeClass(this.element.querySelectorAll(".e-connector-line"),"e-critical-line"),t.removeClass(this.element.querySelectorAll(".e-connector-line-arrow"),"e-critical-line-arrow")},s.prototype.wireEvents=function(){this.allowKeyboard&&(this.keyboardModule=new t.KeyboardEvents(this.element,{keyAction:this.keyActionHandler.bind(this),keyConfigs:this.keyConfig,eventName:"keydown"})),t.EventHandler.add(window,"resize",this.windowResize,this),t.EventHandler.add(document.body,"keydown",this.keyDownHandler,this)},s.prototype.unwireEvents=function(){this.keyboardModule&&(this.keyboardModule.destroy(),this.keyboardModule=null),t.EventHandler.remove(window,"resize",this.windowResize),t.EventHandler.remove(document.body,"keydown",this.keyDownHandler)},s.prototype.keyDownHandler=function(e){e.altKey&&74===e.keyCode&&(this.ganttChartModule.manageFocus(this.treeGrid.element.childNodes[1],"remove",!1),this.ganttChartModule.manageFocus(this.element,"add",!1))},s.prototype.windowResize=function(){var e=this;if(!t.isNullOrUndefined(this.element)){this.updateContentHeight(),this.ganttChartModule.updateWidthAndHeight(),this.treeGridModule.ensureScrollBar(),this.predecessorModule&&this.taskFields.dependency&&(this.updateRowHeightInConnectorLine(this.updatedConnectorLineCollection),this.connectorLineModule.renderConnectorLines(this.updatedConnectorLineCollection));var i=this.criticalPathModule;this.enableCriticalPath&&i&&i.criticalPathCollection&&this.criticalPathModule.criticalConnectorLine(i.criticalPathCollection,i.detailPredecessorCollection,!0,i.predecessorCollectionTaskIds),this.calculateDimensions();var a=this.splitterModule.splitterObject.element.querySelectorAll(".e-pane")[0],r=this.splitterModule.splitterObject.element.querySelectorAll(".e-pane")[1];this.splitterModule.splitterPreviousPositionGrid=a.scrollWidth+1+"px",this.splitterModule.splitterPreviousPositionChart=r.scrollWidth+1+"px",this.timelineModule.isZoomedToFit&&setTimeout(function(){e.timelineModule.processZoomToFit()},0)}this.dayMarkersModule&&this.dayMarkersModule.eventMarkerRender&&this.dayMarkersModule.eventMarkerRender.updateContainerHeight(),this.enableTimelineVirtualization&&this.timelineModule.refreshTimeline()},s.prototype.keyActionHandler=function(e){if(this.enableContextMenu&&this.contextMenuModule&&("downArrow"===e.action||"upArrow"===e.action)&&document.getElementById(this.element.id+"_contextmenu")&&this.args){var i=this.args;t.isNullOrUndefined(i)||i.focus()}e.target&&("downArrow"===e.action||"upArrow"===e.action)&&e.target===this.element.querySelector(".e-rowcell")||e.target&&"escape"===e.action&&this.treeGrid.grid.columnMenuModule&&"block"===this.treeGrid.grid.columnMenuModule.columnMenu.element.style.display?this.treeGrid.grid.notify("key-pressed",e):this.focusModule.onKeyPress(e)},s.prototype.updateRowHeightInConnectorLine=function(e){if(e&&e.length){var i=!t.isNullOrUndefined(this.ganttChartModule)&&this.ganttChartModule.getChartRows()[0]&&this.ganttChartModule.getChartRows()[0].getBoundingClientRect().height;if(i&&!isNaN(i))for(var a=0;a<e.length;a++)e[a].rowHeight=i}},s.prototype.renderToolbar=function(){t.isNullOrUndefined(this.toolbarModule)||(this.toolbarModule.renderToolbar(),this.toolbarModule.refreshToolbarItems())},s.prototype.renderTreeGrid=function(){this.treeGridModule.renderTreeGrid()},s.prototype.updateCurrentViewData=function(){var e=this;if(this.currentViewData=this.treeGrid.getCurrentViewRecords().slice(),this.currentViewData.length>0&&this.loadChildOnDemand&&this.taskFields.hasChildMapping){this.isLoad=!0,this.flatData=[],this.dataOperation.taskIds=[],this.ids=[],this.dataOperation.recordIndex=0,this.dataOperation.dataArray=this.currentViewData,this.dataOperation.cloneDataSource(),this.predecessorModule&&this.taskFields.dependency&&(this.predecessorModule.parentIds=[],this.predecessorModule.parentRecord=[],this.predecessorModule.updatePredecessors());for(var i=this.treeGrid.grid.contentModule.rows.filter(function(t){if(t.data[e.taskFields.id]===e.flatData[0].ganttProperties.taskId)return t})[0].index,a=0;a<this.flatData.length;a++)this.flatData[a].index=i,i++;this.currentViewData=this.flatData,this.treeGrid.grid.currentViewData=this.flatData,t.isNullOrUndefined(this.treeGrid.virtualScrollModule)||(this.treeGrid.virtualScrollModule.visualData=this.flatData,this.updatedRecords=this.flatData)}},s.prototype.getRecordFromFlatdata=function(e){for(var t=[],i=0;i<e.length;i++)t.push(this.getTaskByUniqueID(e[i].uniqueID));return t},s.prototype.updateContentHeight=function(e){if(this.allowTaskbarOverlap||this.ganttChartModule.isCollapseAll||this.ganttChartModule.isExpandAll||this.isLoad)if(this.virtualScrollModule&&this.enableVirtualization&&!t.isNullOrUndefined(e)){var i=t.getValue("result.length",e);this.contentHeight=i*this.rowHeight}else{var a=this.virtualScrollModule&&this.enableVirtualization?this.currentViewData:this.getExpandedRecords(this.currentViewData);this.expandedRecords=a;var r=void 0,n=t.isNullOrUndefined(this.ganttChartModule)||t.isNullOrUndefined(this.ganttChartModule.getChartRows())?null:this.ganttChartModule.getChartRows()[0];r=!t.isNullOrUndefined(n)&&n.offsetHeight>0?n.offsetHeight:this.rowHeight,this.contentHeight=a.length*r}},s.prototype.getExpandStatus=function(e){var i=this.getParentTask(e.parentItem);return!!t.isNullOrUndefined(i)||!1!==i.expanded&&(!i.parentItem||!1!==this.getParentTask(i.parentItem).expanded&&this.getExpandStatus(this.getParentTask(i.parentItem)))},s.prototype.getExpandedRecords=function(e){var i=this;if(t.isNullOrUndefined(e))return[];var a=e.filter(function(e){return!0===i.getExpandStatus(e)});return this.expandedRecords=a,a},s.prototype.getZoomingLevels=function(){var e=this.timelineSettings.weekStartDay;return[{topTier:{unit:"Year",format:"yyyy",count:50},bottomTier:{unit:"Year",format:"yyyy",count:10},timelineUnitSize:99,level:0,timelineViewMode:"Year",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Year",format:"yyyy",count:20},bottomTier:{unit:"Year",format:"yyyy",count:5},timelineUnitSize:99,level:1,timelineViewMode:"Year",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Year",format:"yyyy",count:5},bottomTier:{unit:"Year",format:"yyyy",count:1},timelineUnitSize:99,level:2,timelineViewMode:"Year",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Year",format:"MMM, yy",count:1},bottomTier:{unit:"Month",formatter:this.displayHalfValue,count:6},timelineUnitSize:66,level:3,timelineViewMode:"Year",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Year",format:"MMM, yy",count:1},bottomTier:{unit:"Month",formatter:this.displayHalfValue,count:6},timelineUnitSize:99,level:4,timelineViewMode:"Year",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Year",format:"MMM, yy",count:1},bottomTier:{unit:"Month",formatter:this.displayQuarterValue,count:3},timelineUnitSize:66,level:5,timelineViewMode:"Year",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Year",format:"yyyy",count:1},bottomTier:{unit:"Month",formatter:this.displayQuarterValue,count:3},timelineUnitSize:99,level:6,timelineViewMode:"Year",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Year",format:"yyyy",count:1},bottomTier:{unit:"Month",format:"MMM yyyy",count:1},timelineUnitSize:99,level:7,timelineViewMode:"Year",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Month",format:"MMM, yy",count:1},bottomTier:{unit:"Week",format:"dd",count:1},timelineUnitSize:33,level:8,timelineViewMode:"Month",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Month",format:"MMM, yyyy",count:1},bottomTier:{unit:"Week",format:"dd MMM",count:1},timelineUnitSize:66,level:9,timelineViewMode:"Month",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Month",format:"MMM, yyyy",count:1},bottomTier:{unit:"Week",format:"dd MMM",count:1},timelineUnitSize:99,level:10,timelineViewMode:"Month",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Week",format:"MMM dd, yyyy",count:1},bottomTier:{unit:"Day",format:"d",count:1},timelineUnitSize:33,level:11,timelineViewMode:"Week",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Week",format:"MMM dd, yyyy",count:1},bottomTier:{unit:"Day",format:"d",count:1},timelineUnitSize:66,level:12,timelineViewMode:"Week",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Week",format:"MMM dd, yyyy",count:1},bottomTier:{unit:"Day",format:"d",count:1},timelineUnitSize:99,level:13,timelineViewMode:"Week",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Day",format:"E dd yyyy",count:1},bottomTier:{unit:"Hour",format:"hh a",count:12},timelineUnitSize:66,level:14,timelineViewMode:"Day",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Day",format:"E dd yyyy",count:1},bottomTier:{unit:"Hour",format:"hh a",count:12},timelineUnitSize:99,level:15,timelineViewMode:"Day",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Day",format:"E dd yyyy",count:1},bottomTier:{unit:"Hour",format:"hh a",count:6},timelineUnitSize:66,level:16,timelineViewMode:"Day",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Day",format:"E dd yyyy",count:1},bottomTier:{unit:"Hour",format:"hh a",count:6},timelineUnitSize:99,level:17,timelineViewMode:"Day",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Day",format:"E dd yyyy",count:1},bottomTier:{unit:"Hour",format:"hh a",count:2},timelineUnitSize:66,level:18,timelineViewMode:"Day",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Day",format:"E dd yyyy",count:1},bottomTier:{unit:"Hour",format:"hh a",count:2},timelineUnitSize:99,level:19,timelineViewMode:"Day",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Day",format:"E dd yyyy",count:1},bottomTier:{unit:"Hour",format:"hh a",count:1},timelineUnitSize:66,level:20,timelineViewMode:"Day",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Day",format:"E dd yyyy",count:1},bottomTier:{unit:"Hour",format:"hh a",count:1},timelineUnitSize:99,level:21,timelineViewMode:"Day",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Hour",format:"ddd MMM, h a",count:1},bottomTier:{unit:"Minutes",format:"mm",count:30},timelineUnitSize:66,level:22,timelineViewMode:"Hour",weekStartDay:0,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Hour",format:"ddd MMM, h a",count:1},bottomTier:{unit:"Minutes",format:"mm",count:15},timelineUnitSize:66,level:23,timelineViewMode:"Hour",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Hour",format:"ddd MMM, h a",count:1},bottomTier:{unit:"Minutes",format:"mm",count:1},timelineUnitSize:66,level:24,timelineViewMode:"Hour",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0}]},s.prototype.displayQuarterValue=function(e){var t=e.getMonth();return t>=0&&t<=2?"Q1":t>=3&&t<=5?"Q2":t>=6&&t<=8?"Q3":"Q4"},s.prototype.displayHalfValue=function(e){var t=e.getMonth();return t>=0&&t<=5?"H1":"H2"},s.prototype.getFormatedDate=function(e,i){return t.isNullOrUndefined(e)?null:(t.isNullOrUndefined(i)&&(i=this.getDateFormat()),this.globalize.formatDate(e,{format:i}))},s.prototype.getDurationString=function(e,t){return this.dateValidationModule.getDurationString(e,t)},s.prototype.getWorkString=function(e,t){return this.dateValidationModule.getWorkString(e,t)},s.prototype.updateTreeColumns=function(){var e,i=this.treeGrid.grid.getColumns();-1!==this.treeColumnIndex&&this.columns[this.treeColumnIndex]&&!t.isNullOrUndefined(this.columns[this.treeColumnIndex].template)&&(e=this.columns[this.treeColumnIndex].template);for(var a,r=0;r<i.length;r++){a={};for(var n=0;n<this.columns.length;n++)if(this.columns[n].field===i[r].field){for(var s=0,o=Object.keys(this.columns[n]);s<o.length;s++){var l=o[s];t.isUndefined(this.columns[n][l])||(a[l]=i[r][l]),a.visible=i[r].visible,a.width=i[r].width}this.columns[n]=a,"checkbox"===this.columns[n].type||t.isNullOrUndefined(e)||""===e||(this.columns[n].template=e)}}this.columns.length>0&&this.treeGrid.setProperties({columns:this.columns},!0)},s.prototype.treeDataBound=function(e){var i=this;this.isLoad&&this.undoRedoModule&&(this.sortSettings.columns.length>0?this.undoRedoModule.previousSortedColumns=this.sortSettings.columns:""!==this.searchSettings.key&&(this.undoRedoModule.searchString=this.searchSettings.key)),this.element.getElementsByClassName("e-chart-root-container")[0].style.height="100%",this.element.getElementsByClassName("e-gridcontent")[0].childNodes[0].setAttribute("tabindex","0"),this.element.getElementsByClassName("e-gridcontent")[0].childNodes[0].childNodes[0].setAttribute("role","treegrid");var a=this.element.getElementsByClassName("e-timeline-header-container")[0].offsetHeight,r=this.element.getElementsByClassName("e-chart-scroll-container e-content")[0];if(r.style.height="calc(100% - "+a+"px)",r.setAttribute("tabindex","0"),t.isNullOrUndefined(this.toolbarModule)||t.isNullOrUndefined(this.toolbarModule.element)?this.splitterElement.style.height="100%":this.splitterElement.style.height="calc(100% - "+this.toolbarModule.element.offsetHeight+"px)",this.filterSettings&&this.filterSettings.properties&&this.filterSettings.properties.columns&&this.filterSettings.properties.columns.forEach(function(e){for(var t=e.properties.field,a=null,r=0;r<i.treeGrid.columns.length;r++){var n=i.treeGrid.columns[r];if(n.field===t){a=n;break}}a&&e.properties.uid!==a.uid&&(e.properties.uid=a.uid)}),this.isLoad){if(this.enablePersistence&&this.updateTreeColumns(),this.updateCurrentViewData(),this.enableVirtualization?this.virtualScrollModule&&this.enableVirtualization&&(this.ganttChartModule.virtualRender.adjustTable(),this.ganttChartModule.scrollObject.updateTopPosition()):this.updateContentHeight(),!this.isTreeGridRendered){this.isTreeGridRendered=!0,this.timelineModule.isSingleTier?this.element.classList.add("e-gantt-single-timeline"):this.element.classList.remove("e-gantt-single-timeline");var n=this.element.getElementsByClassName("e-timeline-header-container")[0].offsetHeight;r.style.height="calc(100% - "+n+"px)",this.treeGrid.setProperties({height:"100%"},!1),this.notify("tree-grid-created",{}),this.createGanttPopUpElement(),this.hideLoadingIndicator(),t.setValue("isGanttCreated",!0,e),this.renderComplete()}}else this.getCurrentRecords(e);this.loadChildOnDemand&&this.taskFields.hasChildMapping&&this.updateContentHeight(),this.enableCriticalPath&&this.criticalPathModule&&this.criticalPathModule.showCriticalPath(this.enableCriticalPath),this.notify("recordsUpdated",{});for(var s=0;s<document.getElementsByClassName("e-timeline-header-table-container").length;s++)for(var o=0;o<document.getElementsByClassName("e-timeline-header-table-container")[s].children[0].children[0].children.length;o++){var l=document.getElementsByClassName("e-timeline-header-table-container")[s].children[0].children[0].children[o].children[0];l&&l.setAttribute("tabindex","-1")}var d=this.criticalPathModule;if(this.enableCriticalPath&&d&&d.criticalPathCollection&&this.criticalPathModule.criticalConnectorLine(d.criticalPathCollection,d.detailPredecessorCollection,!0,d.predecessorCollectionTaskIds),this.initialChartRowElements=this.ganttChartModule.getChartRows(),this.isLoad=!1,this.isExpandPerformed=!!this.enableVirtualization&&this.isExpandPerformed,this.isExpandPerformed||(this.previousFlatData=t.extend([],this.flatData,[],!0)),this.undoRedoModule&&0!==Object.keys(this.undoRedoModule.undoActionDetails).length){var h=this.undoRedoModule.undoActionDetails;"RowDragAndDrop"===h.action||"TaskbarDragAndDrop"===h.action?(h.beforeDrop.forEach(function(e){i.updateRecordByID(e.data)}),"child"===h.afterDrop.dropPosition&&this.updateRecordByID(h.afterDrop.dropRecord)):"Indent"!==h.action&&"Outdent"!==h.action||this.updateRecordByID(h.droppedRecord),this.undoRedoModule.undoActionDetails={}}this.undoRedoModule&&this.undoRedoModule.isUndoRedoPerformed&&(this.undoRedoModule.isUndoRedoPerformed=!1),this.trigger("dataBound",e)},s.prototype.getCurrentRecords=function(e){this.predecessorModule&&this.taskFields.dependency&&this.connectorLineModule.removePreviousConnectorLines(this.currentViewData),this.updateCurrentViewData(),this.enableVirtualization||this.updateContentHeight(),this.virtualScrollModule&&this.enableVirtualization&&(this.ganttChartModule.virtualRender.adjustTable(),this.ganttChartModule.scrollObject.updateTopPosition())},s.prototype.onPropertyChanged=function(e,i){for(var a=!1,n=0,s=Object.keys(e);n<s.length;n++){var o=s[n];switch(o){case"allowSelection":case"allowRowDragAndDrop":case"allowFiltering":case"showColumnMenu":case"allowResizing":case"allowReordering":case"allowSorting":case"enableImmutableMode":this.treeGrid[o]=this[o],this.treeGrid.dataBind();break;case"workWeek":this.dataOperation.getNonWorkingDayIndex(),this.dataOperation.reUpdateGanttData(),this.chartRowsModule.initiateTemplates(),this.taskFields.dependency&&this.predecessorModule.updatedRecordsDateByPredecessor(),this.chartRowsModule.refreshGanttRows(),this.treeGrid.refreshColumns(),this.timelineModule.refreshTimeline();break;case"toolbar":this.notify("ui-toolbarupdate",{module:"toolbar",properties:e});break;case"columnMenuItems":this.treeGrid.grid.columnMenuItems=r.getActualProperties(this.columnMenuItems);break;case"eventMarkers":case"highlightWeekends":this.notify("ui-update",{module:"day-markers",properties:e});break;case"sortSettings":this.treeGrid.sortSettings=r.getActualProperties(this.sortSettings),this.treeGrid.dataBind();break;case"timelineSettings":this.timelineModule.refreshTimeline(),this.enableTimelineVirtualization&&(!this.undoRedoModule||this.undoRedoModule&&!this.undoRedoModule.isZoomingUndoRedoProgress)&&(a=!0),this.undoRedoModule&&this.undoRedoModule.isZoomingUndoRedoProgress&&(this.undoRedoModule.isZoomingUndoRedoProgress=!1);break;case"rowHeight":case"taskbarHeight":this.treeGrid.rowHeight=this.rowHeight,this.treeGrid.dataBind(),this.chartRowsModule.initiateTemplates(),this.timelineModule.updateChartByNewTimeline(),this.taskFields.dependency&&this.ganttChartModule.reRenderConnectorLines();break;case"timezone":case"durationUnit":this.dataOperation.checkDataBinding(!0);break;case"enableCriticalPath":if(this.hideLoadingIndicator(),this.enableCriticalPath&&this.criticalPathModule){this.criticalPathModule.showCriticalPath(this.enableCriticalPath);var l=this.criticalPathModule;l.criticalPathCollection&&this.criticalPathModule.criticalConnectorLine(l.criticalPathCollection,l.detailPredecessorCollection,!0,l.predecessorCollectionTaskIds)}else this.removeCriticalPathStyles();break;case"filterSettings":t.isNullOrUndefined(e.filterSettings)&&(this.filterSettings.columns=[]),this.treeGrid.filterSettings=r.getActualProperties(this.filterSettings),this.treeGrid.dataBind();break;case"gridLines":this.treeGrid.gridLines=this.gridLines,this.treeGrid.dataBind(),this.renderChartGridLines();break;case"tooltipSettings":this.tooltipModule.toolTipObj&&this.tooltipModule.toolTipObj.destroy(),this.tooltipModule.createTooltip();break;case"splitterSettings":this.splitterModule.updateSplitterPosition();break;case"selectionSettings":this.treeGrid.selectionSettings=r.getActualProperties(this.selectionSettings),this.treeGrid.grid.selectionSettings.enableToggle=this.selectionSettings.enableToggle,this.treeGrid.dataBind();break;case"searchSettings":void 0!==e.searchSettings.key&&(this.treeGrid.grid.searchSettings=r.getActualProperties(this.searchSettings),this.treeGrid.grid.dataBind()),this.treeGrid.searchSettings=r.getActualProperties(this.searchSettings),this.treeGrid.dataBind(),this.toolbarModule&&this.toolbarModule.updateSearchTextBox();break;case"labelSettings":case"renderBaseline":case"baselineColor":this.isFromRenderBaseline=!0,this.chartRowsModule.initiateTemplates(),this.chartRowsModule.refreshGanttRows(),this.isFromRenderBaseline=!1;break;case"resourceIDMapping":case"resourceNameMapping":case"resources":this.dataOperation.reUpdateResources(),this.treeGrid.refreshColumns(),this.chartRowsModule.initiateTemplates(),this.chartRowsModule.refreshGanttRows();break;case"includeWeekend":case"allowUnscheduledTasks":case"holidays":this.isLoad=!0,"holidays"===o&&(this.totalHolidayDates=this.dataOperation.getHolidayDates(),this.notify("ui-update",{module:"day-markers",properties:e})),this.dataOperation.reUpdateGanttData(),this.treeGrid.refreshColumns(),this.chartRowsModule.initiateTemplates(),this.chartRowsModule.refreshGanttRows(),this.isLoad=!1,this.taskFields.dependency&&(this.predecessorModule.updatedRecordsDateByPredecessor(),this.treeGrid.refreshColumns(),this.chartRowsModule.refreshGanttRows());break;case"dayWorkingTime":case"weekWorkingTime":a=!0;break;case"addDialogFields":case"editDialogFields":this.editModule&&this.editModule.dialogModule&&this.editModule.dialogModule.processDialogFields();break;case"columns":this.treeGridModule.treeGridColumns=[],this.treeGridModule.validateGanttColumns(),this.treeGrid.columns=this.treeGridModule.treeGridColumns,this.treeGrid.refreshColumns(),this.chartRowsModule.initiateTemplates(),this.timelineModule.updateChartByNewTimeline();break;case"width":case"height":this.reUpdateDimention(o);break;case"editSettings":this.treeGrid.editSettings.allowAdding=this.editSettings.allowAdding,this.treeGrid.editSettings.allowDeleting=this.editSettings.allowDeleting,this.treeGrid.editSettings.showDeleteConfirmDialog=this.editSettings.showDeleteConfirmDialog,this.treeGrid.editSettings.allowEditing=this.editSettings.allowEditing,this.treeGrid.editSettings.allowNextRowEdit=this.editSettings.allowNextRowEdit,t.isNullOrUndefined(this.editModule)||this.editModule.reUpdateEditModules(),t.isNullOrUndefined(this.toolbarModule)||this.toolbarModule.refreshToolbarItems();break;case"connectorLineBackground":case"connectorLineWidth":this.taskFields.dependency&&(this.connectorLineModule.initPublicProp(),this.ganttChartModule.reRenderConnectorLines());break;case"treeColumnIndex":this.treeGrid.treeColumnIndex=this.treeColumnIndex;break;case"projectStartDate":case"projectEndDate":this.timelineModule.isZoomToFit=!1,this.dataOperation.calculateProjectDates(),this.updateProjectDates(this.cloneProjectStartDate,this.cloneProjectEndDate,this.isTimelineRoundOff);break;case"selectedRowIndex":t.isNullOrUndefined(this.selectionModule)||this.selectionModule.selectRowByIndex();break;case"dataSource":if(this.isLoad=!0,this.isReact&&this.clearTemplate(["TaskbarTemplate","ParentTaskbarTemplate","MilestoneTemplate","TaskLabelTemplate","RightLabelTemplate","LeftLabelTemplate"]),this.closeGanttActions(),this.dataSource instanceof Object&&y(this)){this.treeGrid.hasChildMapping="isParent";var d=t.getValue("count",this.dataSource);this.treeGrid.dataSource={result:this.flatData,count:d}}else this.treeGrid.hasChildMapping=null;this.dataOperation.checkDataBinding(!0),this.isLoad=!1;break;case"enableContextMenu":case"contextMenuItems":this.enableContextMenu||"contextMenuItems"===o?this.notify("reRender-contextMenu",{module:"contextMenu",enable:!0}):this.treeGrid.contextMenuItems=[],this.treeGrid.dataBind();break;case"currencyCode":case"locale":case"enableRtl":case"readOnly":case"viewType":case"taskFields":case"allowTaskbarDragAndDrop":case"allowTaskbarOverlap":case"allowParentDependency":case"enableMultiTaskbar":if("locale"===o&&(this.isLocaleChanged=!0),"taskFields"===o&&!t.isNullOrUndefined(e.taskFields.child))return;"allowTaskbarDragAndDrop"!==o&&(a=!0);break;case"validateManualTasksOnLinking":this.validateManualTasksOnLinking=e.validateManualTasksOnLinking;break;case"showOverAllocation":this.updateOverAllocationCotainer()}}a&&(this.isLoad&&this.contentMaskTable&&(this.contentMaskTable=null),this.refresh())},s.prototype.updateOverAllocationCotainer=function(){if(this.showOverAllocation)this.ganttChartModule.renderOverAllocationContainer();else{var e=this.element.querySelector("."+X);e&&(e.innerHTML="")}},s.prototype.getPersistData=function(){for(var e=["sortSettings","filterSettings","columns","searchSettings","selectedRowIndex","treeColumnIndex","currentZoomingLevel","cloneProjectStartDate","cloneProjectEndDate","splitterSettings"],i={filterSettings:["type","mode","showFilterBarStatus","immediateModeDelay","ignoreAccent","hierarchyMode"],searchSettings:["fields","operator","ignoreCase"],sortSettings:[],columns:[],selectedRowIndex:[]},a=["filter","edit","filterBarTemplate","headerTemplate","template","commandTemplate","commands","dataSource"],r=0;r<e.length;r++)for(var n=this[e[r]],s=0,o=i[e[r]];!t.isNullOrUndefined(o)&&s<o.length;s++)delete n[o[s]];return this.ignoreInArrays(a,this.columns),this.addOnPersist(e)},s.prototype.ignoreInArrays=function(e,t){for(var i=0;i<t.length;i++)this.ignoreInColumn(e,t[i])},s.prototype.ignoreInColumn=function(e,t){for(var i=0;i<e.length;i++)delete t[e[i]],t.filter={}},s.prototype.destroy=function(){this.notify("destroy",{}),this.unwireEvents(),t.isNullOrUndefined(this.validationDialogElement)||this.validationDialogElement.isDestroyed||this.validationDialogElement.destroy();for(var i=["ganttChartModule","timelineModule","chartRowsModule","treeGridModule","ganttDataUpdatesModule","dateValidationModule","tooltipModule"],a=0;a<i.length;a++)this[i[a]]&&(this[i[a]]=null);this.keyboardModule&&this.keyboardModule.destroy(),this.editModule&&this.editModule.dialogModule&&this.editModule.dialogModule.destroy(),this.splitterModule&&this.splitterModule.destroy(),this.toolbarModule&&this.toolbarModule.toolbar&&this.toolbarModule.toolbar.destroy(),t.isNullOrUndefined(this.dayMarkersModule)||(t.isNullOrUndefined(this.dayMarkersModule.eventMarkerRender)||t.isNullOrUndefined(this.dayMarkersModule.eventMarkerRender.eventMarkersContainer)||(this.dayMarkersModule.eventMarkerRender.eventMarkersContainer=null),t.isNullOrUndefined(this.dayMarkersModule.nonworkingDayRender)||(t.isNullOrUndefined(this.dayMarkersModule.nonworkingDayRender.nonworkingContainer)||(this.dayMarkersModule.nonworkingDayRender.nonworkingContainer=null),t.isNullOrUndefined(this.dayMarkersModule.nonworkingDayRender.weekendContainer)||(this.dayMarkersModule.nonworkingDayRender.weekendContainer=null),t.isNullOrUndefined(this.dayMarkersModule.nonworkingDayRender.holidayContainer)||(this.dayMarkersModule.nonworkingDayRender.holidayContainer=null))),this.connectorLineModule&&(this.connectorLineModule.dependencyViewContainer=null,this.connectorLineModule.svgObject=null,this.connectorLineModule.renderer=null,this.connectorLineModule.tooltipTable=null),this.treeGridPane=null,this.chartPane=null,this.initialChartRowElements=null,e.prototype.destroy.call(this),this.chartVerticalLineContainer=null,this.element.innerHTML="",t.removeClass([this.element],"e-gantt"),this.element.innerHTML="",this.isTreeGridRendered=!1,this.resetTemplates(),this.dataOperation.uid=null},s.prototype.getTaskbarHeight=function(){return this.chartRowsModule.taskBarHeight},s.prototype.requiredModules=function(){var e=[];return this.isDestroyed?e:(this.allowSorting&&e.push({member:"sort",args:[this]}),(this.allowFiltering||this.toolbar&&-1!==this.toolbar.indexOf("Search"))&&e.push({member:"filter",args:[this]}),this.allowReordering&&e.push({member:"reorder",args:[this]}),this.allowExcelExport&&e.push({member:"excelExport",args:[this]}),(this.allowRowDragAndDrop||this.allowTaskbarDragAndDrop)&&e.push({member:"rowDragAndDrop",args:[this]}),this.enableCriticalPath&&e.push({member:"criticalPath",args:[this]}),this.enableUndoRedo&&e.push({member:"undoRedo",args:[this]}),this.allowResizing&&e.push({member:"resize",args:[this]}),this.toolbar&&this.toolbar.length>0&&e.push({member:"toolbar",args:[this]}),(this.editSettings.allowAdding||this.editSettings.allowEditing||this.editSettings.allowDeleting||this.editSettings.allowTaskbarEditing||this.allowRowDragAndDrop)&&e.push({member:"edit",args:[this]}),this.allowSelection&&e.push({member:"selection",args:[this]}),this.tooltipSettings.showTooltip&&e.push({member:"tooltip",args:[this]}),(this.highlightWeekends||this.holidays&&this.holidays.length>0||this.eventMarkers&&this.eventMarkers.length>0)&&e.push({member:"dayMarkers",args:[this]}),this.enableContextMenu&&e.push({member:"contextMenu",args:[this]}),this.showColumnMenu&&e.push({member:"columnMenu",args:[this]}),this.allowPdfExport&&e.push({member:"pdfExport",args:[this]}),this.enableVirtualization&&e.push({member:"virtualScroll",args:[this]}),e)},s.prototype.sortColumn=function(e,t,i){this.sortModule&&this.allowSorting&&this.sortModule.sortColumn(e,t,i)},s.prototype.mergePersistGanttData=function(){this.treeGrid||(this.treeGrid=new n.TreeGrid);this.treeGrid.grid.mergePersistGridData.apply(this)},s.prototype.mergeColumns=function(e,t){this.treeGrid.grid.mergeColumns.apply(this,[e,t])},s.prototype.setFrozenCount=function(){this.treeGrid.grid.setFrozenCount.apply(this)},s.prototype.splitFrozenCount=function(e){this.treeGrid.grid.splitFrozenCount.apply(this,[e])},s.prototype.isFrozenGrid=function(){return this.treeGrid.grid.isFrozenGrid()},s.prototype.clearSorting=function(){this.sortModule.clearSorting()},s.prototype.renderChartGridLines=function(){var e="e-chart-row-border",i=this.chartVerticalLineContainer,a=document.getElementById(this.element.id+"GanttTaskTableBody").querySelectorAll("td");if("Vertical"===this.gridLines){if(t.isNullOrUndefined(i)?this.renderChartVerticalLines():"none"===window.getComputedStyle(i).display&&(i.style.display="block"),a&&a.length>0&&a[0].classList.contains(e))for(r=0;r<a.length;r++)t.removeClass([a[r]],e)}else if("Horizontal"===this.gridLines){if(t.isNullOrUndefined(i)||(i.style.display="none"),a&&a.length>0&&!a[0].classList.contains(e))for(r=0;r<a.length;r++)t.addClass([a[r]],e)}else if("Both"===this.gridLines){if(t.isNullOrUndefined(i)?this.renderChartVerticalLines():"none"===window.getComputedStyle(i).display&&(i.style.display="block"),a&&a.length>0&&!a[0].classList.contains(e))for(r=0;r<a.length;r++)t.addClass([a[r]],e)}else if("None"===this.gridLines&&(t.isNullOrUndefined(i)||"none"===window.getComputedStyle(i).display||(i.style.display="none"),a&&a.length>0&&a[0].classList.contains(e)))for(var r=0;r<a.length;r++)t.removeClass([a[r]],e)},s.prototype.updateGridLineContainerHeight=function(){this.chartVerticalLineContainer&&(this.chartVerticalLineContainer.style.height=t.formatUnit(this.getContentHeight()))},s.prototype.getContentHeight=function(){var e=this.ganttChartModule.scrollElement.offsetHeight-16,t=this.ganttChartModule.chartBodyContent.offsetHeight;return t<e?t:e},s.prototype.reUpdateDimention=function(e){var i=0;if(this.calculateDimensions(),t.isNullOrUndefined(this.toolbarModule)||t.isNullOrUndefined(this.toolbarModule.element)||(this.toolbarModule.toolbar.refresh(),this.toolbarModule.refreshToolbarItems(),i=this.toolbarModule.element.offsetHeight),this.treeGrid.height=this.ganttHeight-i-this.treeGrid.grid.getHeaderContent().offsetHeight,this.splitterModule.splitterObject.height=(this.ganttHeight-i).toString(),t.isNullOrUndefined(this.chartVerticalLineContainer)||(this.chartVerticalLineContainer.style.height=this.ganttHeight+"px"),!t.isNullOrUndefined(this.dayMarkersModule)){var a=t.getValue("nonworkingDayRender.holidayContainer",this.dayMarkersModule),r=t.getValue("nonworkingDayRender.weekendContainer",this.dayMarkersModule),n=t.getValue("eventMarkerRender.eventMarkersContainer",this.dayMarkersModule);a&&(a.style.height=this.ganttHeight+"px"),r&&(r.style.height=this.ganttHeight+"px"),n&&(n.style.height=this.ganttHeight+"px")}"width"===e&&(this.splitterModule.splitterObject.width=this.ganttWidth.toString()),this.ganttChartModule.scrollObject.setHeight(this.ganttHeight-this.ganttChartModule.chartTimelineContainer.offsetHeight-i)},s.prototype.renderChartVerticalLines=function(){this.element.contains(this.chartVerticalLineContainer)||(this.chartVerticalLineContainer=t.createElement("div",{id:this.element.id+"line-container",styles:"position:absolute;height:100%;"}),this.ganttChartModule.chartBodyContent.insertBefore(this.chartVerticalLineContainer,this.ganttChartModule.chartBodyContent.lastChild)),this.chartVerticalLineContainer.innerHTML="";var e=this.element.getElementsByClassName("e-timeline-header-table-container")[1];t.isNullOrUndefined(e)&&(e=this.element.getElementsByClassName("e-timeline-header-table-container")[0]);for(var i,a=e.getElementsByTagName("th"),r=a.length,n=0,s=t.createElement("div"),o=0;o<r;o++){n=0===o?-1:n+parseFloat(i),i=a[o].style.width;var l=t.createElement("div",{className:"e-line-container-cell",styles:(this.enableRtl?"right:"+(n+1):"left:"+(-1!==n?n+.3:n))+"px"});s.appendChild(l)}for(;s.firstChild;)this.chartVerticalLineContainer.appendChild(s.firstChild)},s.prototype.getDefaultLocale=function(){return{emptyRecord:"No records to display",id:"ID",name:"Name",startDate:"Start Date",endDate:"End Date",constraintDate:"Constraint Date",constraintType:"Constraint Type",advancedTab:"Advanced",duration:"Duration",progress:"Progress",dependency:"Dependency",notes:"Notes",criticalPath:"Critical Path",undo:"Undo",redo:"Redo",baselineStartDate:"Baseline Start Date",baselineEndDate:"Baseline End Date",baselineDuration:"Baseline Duration",taskMode:"Task Mode",changeScheduleMode:"Change Schedule Mode",subTasksStartDate:"SubTasks Start Date",subTasksEndDate:"SubTasks End Date",scheduleStartDate:"Schedule Start Date",scheduleEndDate:"Schedule End Date",auto:"Auto",manual:"Manual",type:"Type",offset:"Offset",resourceName:"Resources",resourceID:"Resource ID",day:"day",hour:"hour",minute:"minute",days:"days",hours:"hours",minutes:"minutes",generalTab:"General",customTab:"Custom Columns",writeNotes:"Write Notes",addDialogTitle:"New Task",editDialogTitle:"Task Information",add:"Add",edit:"Edit",update:"Update",delete:"Delete",cancel:"Cancel",search:"Search",task:" task",tasks:" tasks",zoomIn:"Zoom in",zoomOut:"Zoom out",zoomToFit:"Zoom to fit",excelExport:"Excel export",csvExport:"CSV export",pdfExport:"PDF export",expandAll:"Expand all",collapseAll:"Collapse all",nextTimeSpan:"Next timespan",prevTimeSpan:"Previous timespan",saveButton:"Save",cancelLink:"Cancel, keep the existing link",removeLink:'Remove the link and move "{0}" to start on "{1}".',removeConstraint:'Remove {0} constraint of task "{1}"',preserveLink:'Move the "{0}" to start on "{1}" and keep the link.',removeDependency:'Remove dependency from "{0}" to "{1}"',cancelChange:"Cancel the change and do nothing",validateEditing:"Validate Editing",schedulingConflicts:"Scheduling conflict",constraintTypeAsSoonAsPossible:"As Soon As Possible",constraintTypeAsLateAsPossible:"As Late As Possible",constraintTypeMustStartOn:"Must Start On",constraintTypeMustFinishOn:"Must Finish On",constraintTypeStartNoEarlierThan:"Start No Earlier Than",constraintTypeStartNoLaterThan:"Start No Later Than",constraintTypeFinishNoEarlierThan:"Finish No Earlier Than",constraintTypeFinishNoLaterThan:"Finish No Later Than",taskBeforePredecessorFS:'You moved "{0}" to start before "{1}" finishes and the two tasks are linked.As the result, the links cannot be honored. Select one action below to perform',taskAfterPredecessorFS:'You moved "{0}" away from "{1}" and the two tasks are linked.As the result, the links cannot be honored. Select one action below to perform',taskBeforePredecessorSS:'You moved "{0}" to start before "{1}" starts and the two tasks are linked.As the result, the links cannot be honored. Select one action below to perform',taskAfterPredecessorSS:'You moved "{0}" to start after "{1}" starts and the two tasks are linked.As the result, the links cannot be honored. Select one action below to perform',taskBeforePredecessorFF:'You moved "{0}" to finish before "{1}" finishes and the two tasks are linked.As the result, the links cannot be honored. Select one action below to perform',taskAfterPredecessorFF:'You moved "{0}" to finish after "{1}" finishes and the two tasks are linked.As the result, the links cannot be honored. Select one action below to perform',taskBeforePredecessorSF:'You moved "{0}" away from "{1}" to starts and the two tasks are linked.As the result, the links cannot be honored. Select one action below to perform',taskAfterPredecessorSF:'You moved "{0}" to finish after "{1}" starts and the two tasks are linked.As the result, the links cannot be honored. Select one action below to perform',okText:"Ok",confirmDelete:"Are you sure you want to Delete Record?",from:"From",to:"To",taskLink:"Task Link",lag:"Lag",start:"Start",finish:"Finish",enterValue:"Enter the value",taskInformation:"Task Information",deleteTask:"Delete Task",deleteDependency:"Delete Dependency",convert:"Convert",save:"Save",above:"Above",below:"Below",child:"Child",milestone:"Milestone",toTask:"To Task",toMilestone:"To Milestone",eventMarkers:"Event markers",leftTaskLabel:"Left task label",rightTaskLabel:"Right task label",timelineCell:"Timeline cell",confirmPredecessorDelete:"Are you sure you want to remove dependency link?",unit:"Unit",work:"Work",taskType:"Task Type",unassignedTask:"Unassigned Task",group:"Group",indent:"Indent",outdent:"Outdent",segments:"Segments",splitTask:"Split Task",mergeTask:"Merge Task",left:"Left",right:"Right",FF:"FF",FS:"FS",SF:"SF",SS:"SS"}},s.prototype.removeSortColumn=function(e){this.sortModule.removeSortColumn(e)},s.prototype.actionBeginTask=function(e){this.trigger("actionBegin",e),t.getValue("cancel",e)||this.showLoadingIndicator()},s.prototype.scrollToDate=function(e){var t=this.dateValidationModule.getDateFromFormat(e),i=this.dataOperation.getTaskLeft(t,!1);this.ganttChartModule.updateScrollLeft(i)},s.prototype.scrollToTask=function(e){if(-1!==this.ids.indexOf(e)){var t=this.flatData[this.ids.indexOf(e)].ganttProperties.left;this.ganttChartModule.updateScrollLeft(t)}},s.prototype.updateChartScrollOffset=function(e,i){t.isNullOrUndefined(e)||(e=this.ganttChartModule.scrollElement.scrollWidth<=e?this.ganttChartModule.scrollElement.scrollWidth:e,this.ganttChartModule.scrollObject.setScrollLeft(e,this.enableRtl?-1:0)),t.isNullOrUndefined(i)||(i=this.ganttChartModule.scrollElement.scrollHeight<=i?this.ganttChartModule.scrollElement.scrollHeight:i,this.ganttChartModule.scrollObject.setScrollTop(i))},s.prototype.getParentTask=function(e){if(t.isNullOrUndefined(e))return null;if(!this.autoCalculateDateScheduling&&this.dataMap&&this.dataMap.size>0&&!this.taskFields.hasChildMapping&&this.isLoad){var i=this.dataMap.get(e.uniqueID);if(i)return i}else{var a=this.flatData.find(function(t){return e.uniqueID===t.uniqueID});if(a)return a}return null},s.prototype.getRootParent=function(e,t){return e.level===t?e:this.getRootParent(this.getParentTask(e.parentItem),t)},s.prototype.filterByColumn=function(e,t,i,a,r,n){this.treeGrid.filterByColumn(e,t,i,a,r,n)},s.prototype.excelExport=function(e,t,i,a){return this.excelExportModule?this.treeGrid.excelExport(e,t,i,a):null},s.prototype.csvExport=function(e,t,i,a){return this.excelExportModule?this.treeGrid.csvExport(e,t,i,a):null},s.prototype.pdfExport=function(e,t,i,a){return this.pdfExportModule?this.pdfExportModule.export(e,t,i,a):null},s.prototype.clearFiltering=function(e){this.treeGrid.grid.clearFiltering(e)},s.prototype.removeFilteredColsByField=function(e){this.treeGrid.removeFilteredColsByField(e,!1)},s.prototype.renderWorkingDayCell=function(e){var t=!1,i=!1;if(t="Auto"!==this.taskMode&&"Custom"!==this.taskMode||!(!this.includeWeekend&&this.autoCalculateDateScheduling),"Custom"===this.taskMode&&this.taskFields.manual){var a=this.editModule;a&&a.cellEditModule&&a.cellEditModule.isCellEdit?i=a.cellEditModule.currentEditedRowData[this.taskFields.manual]:a&&a.dialogModule&&a.dialogModule.isEdit&&(i=a.dialogModule.editedRecord[this.taskFields.manual]),t=i||this.includeWeekend||!this.autoCalculateDateScheduling}var r=t?[]:this.nonWorkingDayIndex,n=this.totalHolidayDates;if(r.length>0&&-1!==r.indexOf(e.date.getDay()))e.isDisabled=!0;else if(n.length>0){var s=new Date(e.date.getTime());s.setHours(0,0,0),-1!==n.indexOf(s.getTime())&&(!this.autoCalculateDateScheduling||this.isLoad&&!this.treeGrid.loadChildOnDemand&&this.taskFields.hasChildMapping?e.isDisabled=!1:e.isDisabled=!0)}},s.prototype.previousTimeSpan=function(e){if(this.isReact&&this.clearTemplate(["TaskbarTemplate","ParentTaskbarTemplate","MilestoneTemplate","TaskLabelTemplate","RightLabelTemplate","LeftLabelTemplate"]),this.undoRedoModule&&this.isUndoRedoItemPresent("PreviousTimeSpan")){this.undoRedoModule.redoEnabled&&this.undoRedoModule.disableRedo(),this.undoRedoModule.createUndoCollection();var i={};i.action="PreviousTimeSpan",i.previousTimelineStartDate=t.extend([],[],[this.timelineModule.timelineStartDate],!0)[0],i.previousTimelineEndDate=t.extend([],[],[this.timelineModule.timelineEndDate],!0)[0],this.undoRedoModule.getUndoCollection[this.undoRedoModule.getUndoCollection.length-1]=i}this.timelineModule.performTimeSpanAction("prevTimeSpan","publicMethod",new Date(this.timelineModule.timelineStartDate.getTime()),new Date(this.timelineModule.timelineEndDate.getTime()),e)},s.prototype.nextTimeSpan=function(e){if(this.isReact&&this.clearTemplate(["TaskbarTemplate","ParentTaskbarTemplate","MilestoneTemplate","TaskLabelTemplate","RightLabelTemplate","LeftLabelTemplate"]),this.undoRedoModule&&this.isUndoRedoItemPresent("NextTimeSpan")){this.undoRedoModule.redoEnabled&&this.undoRedoModule.disableRedo(),this.undoRedoModule.createUndoCollection();var i={};i.action="NextTimeSpan",i.previousTimelineStartDate=t.extend([],[],[this.timelineModule.timelineStartDate],!0)[0],i.previousTimelineEndDate=t.extend([],[],[this.timelineModule.timelineEndDate],!0)[0],this.undoRedoModule.getUndoCollection[this.undoRedoModule.getUndoCollection.length-1]=i}this.timelineModule.performTimeSpanAction("nextTimeSpan","publicMethod",new Date(this.timelineModule.timelineStartDate.getTime()),new Date(this.timelineModule.timelineEndDate.getTime()),e)},s.prototype.updateProjectDates=function(e,i,a,r){if(this.timelineModule.totalTimelineWidth=0,this.cloneProjectStartDate=e,this.cloneProjectEndDate=i,this.isTimelineRoundOff=a,this.timelineModule.refreshTimelineByTimeSpan(),this.dataOperation.reUpdateGanttDataPosition(),!this.pdfExportModule||this.pdfExportModule&&!this.pdfExportModule.isPdfExport||this.pdfExportModule&&this.pdfExportModule.isPdfExport&&this.pdfExportModule.helper.exportProps&&this.pdfExportModule.helper.exportProps.fitToWidthSettings&&!this.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth){this.timelineModule.updateChartByNewTimeline();var n=window.outerWidth/window.innerWidth;if(this.timelineModule.isZoomToFit&&!this.enableTimelineVirtualization&&n<1){var s=void 0;s=this.enableVirtualization?Math.abs(this.timelineModule.totalTimelineWidth-this.element.getElementsByClassName("e-chart-scroll-container e-content")[0].clientWidth)+1:Math.abs(this.timelineModule.totalTimelineWidth-this.ganttChartModule.chartBodyContent.parentElement.clientWidth),this.ganttChartModule.chartBodyContent.style.width=t.formatUnit(this.timelineModule.totalTimelineWidth-s)}else this.ganttChartModule.chartBodyContent.style.width=t.formatUnit(this.timelineModule.totalTimelineWidth);this.ganttChartModule.updateLastRowBottomWidth(),this.taskFields.dependency&&this.ganttChartModule.reRenderConnectorLines(),"beforeAdd"!==r&&this.notify("selectRowByIndex",{})}},s.prototype.splitTask=function(e,t){this.isEdit=!0,this.chartRowsModule.splitTask(e,t)},s.prototype.mergeTask=function(e,t){this.chartRowsModule.mergeTask(e,t)},s.prototype.reorderColumns=function(e,t){this.treeGrid.reorderColumns(e,t)},s.prototype.initiateEditAction=function(e){this.isOnEdit=e,this.previousRecords={},this.editedRecords=[]},s.prototype.setRecordValue=function(e,i,a,r){if(i=t.isUndefined(i)?null:i,!(!this.isOnEdit&&!this.isOnDelete)){this.makeCloneData(e,a,r);var n=r?a:a.ganttProperties,s=n.rowUniqueID,o=this.getRecordByID(s),l=!1;if(l=!(!t.isNullOrUndefined(i)&&(t.isNullOrUndefined(i)||t.isNullOrUndefined(a[""+e])||(i instanceof Date?i.getTime()===a[""+e].getTime():a[""+e]===i)))||l,o&&(-1===this.editedRecords.indexOf(o)&&l||0===this.editedRecords.length)){if(this.editModule.draggedRecord&&this.editModule.draggedRecord.ganttProperties.taskId===n.taskId?this.editedRecords.splice(0,0,o):this.editedRecords.push(o),this.undoRedoModule){-1===this.undoRedoModule.changedRecords.indexOf(o)&&this.undoRedoModule.changedRecords.push(t.extend({},{},o,!0));var d=this.undoRedoModule.getUndoCollection,h=d.length>0?d[d.length-1].action:null;if(this.editModule&&this.editSettings.allowEditing&&!this.undoRedoModule.isUndoRedoPerformed&&!this.isOnDelete&&!this.isOnAdded&&"outdent"!==h&&"indent"!==h&&"RowDragAndDrop"!==h&&"TaskbarDragAndDrop"!==h){var p=this.previousFlatData.filter(function(e){return e.ganttProperties.taskId===o.ganttProperties.taskId})[0];p&&d[d.length-1]&&d[d.length-1].modifiedRecords&&-1===d[d.length-1].modifiedRecords.indexOf(p)&&d[d.length-1].modifiedRecords.push(p)}}this.enableImmutableMode&&this.modifiedRecords.push(o)}}t.setValue(e,i,a)},s.prototype.makeCloneData=function(e,i,a){var r,n,s,o=t.getValue(e,i);if(a&&(e="ganttProperties."+e),t.isNullOrUndefined(this.previousRecords[i.uniqueID])){var l={};this.previousRecords[i.uniqueID]=l}r=this.previousRecords[i.uniqueID],n=t.getValue(e,r),t.isUndefined(n)&&(s=o instanceof Date?new Date(o.getTime()):t.isObjectArray(o)?t.extend([],o,[],!0):t.isObject(o)?t.extend({},{},o,!0):o,t.isUndefined(s)?t.setValue(e,null,r):t.setValue(e,s,r))},s.prototype.closeGanttActions=function(){this.editModule&&(this.editModule.cellEditModule&&this.editModule.cellEditModule.isCellEdit?(this.treeGrid.closeEdit(),this.editModule.cellEditModule.isCellEdit=!1,t.isNullOrUndefined(this.toolbarModule)||this.toolbarModule.refreshToolbarItems()):this.editModule.dialogModule&&this.editModule.dialogModule.dialogObj&&this.editModule.dialogModule.dialogObj.visible&&(this.editModule.dialogModule.dialogObj.hide(),this.editModule.dialogModule.dialogClose()))},s.prototype.getTaskByUniqueID=function(e){var t=this.flatData.filter(function(t){return t.uniqueID===e});return t.length>0?t[0]:null},s.prototype.getRecordByID=function(e){return t.isNullOrUndefined(e)?null:this.flatData[this.ids.indexOf(e.toString())]},s.prototype.setSplitterPosition=function(e,t){var i={};i[t]=e;var a=this.splitterModule.calculateSplitterPosition(i);switch(t){case"view":this.splitterSettings.view=i[t];break;case"columnIndex":this.splitterModule.isSplitterResized=!0,this.splitterSettings.columnIndex=i[t];break;case"position":this.splitterModule.isSplitterResized=!0,this.splitterSettings.position=i[t]}var r=this.splitterModule.splitterObject.element.querySelectorAll(".e-pane")[0],n=this.splitterModule.splitterObject.element.querySelectorAll(".e-pane")[1];this.splitterModule.splitterPreviousPositionGrid=r.scrollWidth+1+"px",this.splitterModule.splitterPreviousPositionChart=n.scrollWidth+1+"px",this.splitterModule.splitterObject.paneSettings[0].size=a,this.splitterModule.splitterObject.paneSettings[1].size=parseFloat("99.75%")-parseFloat(a)+"%",this.splitterModule.triggerCustomResizedEvent()},s.prototype.expandByIndex=function(e){if("number"==typeof e){a=this.contructExpandCollapseArgs(null,e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.expandGanttRow(a)}else for(var t=0;t<e.length;t++)if("number"==typeof e[t]){var i=e[t],a=this.contructExpandCollapseArgs(null,i);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.expandGanttRow(a)}},s.prototype.expandByID=function(e){this.enableVirtualization&&(this.isExpandPerformed=!0);var t=this.contructExpandCollapseArgs(e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.expandGanttRow(t)},s.prototype.collapseByIndex=function(e){var t=this.contructExpandCollapseArgs(null,e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.collapseGanttRow(t)},s.prototype.collapseByID=function(e){var t=this.contructExpandCollapseArgs(e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.collapseGanttRow(t)},s.prototype.addRecord=function(e,i,a){if(this.editModule&&this.editSettings.allowAdding){if("ResourceView"===this.viewType){this.editModule.addRowPosition=i,this.editModule.addRowIndex=a;var r=void 0;t.isNullOrUndefined(e)||(r=this.undoRedoModule&&this.undoRedoModule.isUndoRedoPerformed?e.ganttProperties.resourceInfo:e[this.taskFields.resourceInfo]);var n=void 0,s=void 0;if(!t.isNullOrUndefined(r)&&r.length){for(var o=0;o<r.length&&(n="object"==typeof r[o]?r[o][this.resourceFields.id]:r[0],!(s=this.flatData[this.getTaskIds().indexOf("R"+n)]));o++);if(s&&(0===s.level||s.childRecords.length)){var l=s.childRecords[a];if("ResourceView"===this.viewType&&this.undoRedoModule&&this.undoRedoModule.isUndoRedoPerformed)this.editModule.addRecord(e,i,a);else if(l){var d="Above"===i||"Below"===i?i:"Child";"Child"===d?this.editModule.addRecord(e,d,this.getTaskIds().indexOf("R"+n)):this.editModule.addRecord(e,d,this.flatData.indexOf(l))}else this.editModule.addRecord(e,"Child",this.getTaskIds().indexOf("R"+n))}else this.editModule.addRecord(e,"Bottom")}else this.undoRedoModule&&this.undoRedoModule.isUndoRedoPerformed?this.editModule.addRecord(e,i,a):this.editModule.addRecord(e,"Bottom");this.editModule.addRowPosition=null,this.editModule.addRowIndex=null}else this.editModule.addRecord(e,i,a),"Bottom"===i&&(this.selectedRowIndex=a);"Above"!==i&&"Below"!==i&&"Child"!==i||(this.currentSelection=t.isNullOrUndefined(e)?this.currentSelection:e)}},s.prototype.updateRecordByID=function(e){this.editModule&&this.editSettings.allowEditing&&(this.updateDuration=!0,this.editModule.updateRecordByID(e),this.updateDuration=!1)},s.prototype.getCurrentViewData=function(){return this.treeGrid.getCurrentViewRecords().map(function(e){return e.taskData})},s.prototype.autoFitColumns=function(e){this.treeGrid.autoFitColumns(e)},s.prototype.getTaskInfo=function(e){var i=this.getRecordByID(e),a={};if(i&&i.ganttProperties){var r=i.ganttProperties,n=this.taskFields,s={baseline:this.renderBaseline,isCritical:this.enableCriticalPath,progressWidth:n.progress,segments:n.segments,isAutoSchedule:r.isAutoSchedule,wbs:this.enableWBS};for(var o in s)if(Object.prototype.hasOwnProperty.call(s,o))switch(o){case"baseline":r.baselineStartDate&&r.baselineEndDate&&(t.isNullOrUndefined(r.baselineLeft)||(a.baselineLeft=r.baselineLeft),t.isNullOrUndefined(r.baselineWidth)||(a.baselineWidth=r.baselineWidth));break;case"isCritical":r.isCritical&&(a.isCritical=r.isCritical,a.slack=r.slack);break;case"progressWidth":r.progressWidth&&(a.progressWidth=r.progressWidth);break;case"segments":r.segments&&(a.segments=r.segments);break;case"wbs":r.wbsCode&&(a.wbsCode=r.wbsCode),r.wbsPredecessor&&(a.wbsPredecessor=r.wbsPredecessor);break;case"isAutoSchedule":a.isAutoSchedule=r.isAutoSchedule,r.isAutoSchedule?(a.autoTaskLeft=r.left,a.autoTaskWidth=r.width):!r.isAutoSchedule&&i.hasChildRecords?(a.manualTaskAutoLeft=r.autoLeft,a.manualTaskAutoWidth=r.autoWidth,a.manualTaskLeft=r.left,a.manualTaskWidth=r.width):(a.manualTaskLeft=r.left,a.manualTaskWidth=r.width)}}return a},s.prototype.updateTaskId=function(e,t){this.editModule&&this.editSettings.allowEditing&&this.editModule.updateTaskId(e,t)},s.prototype.expandAtLevel=function(e){this.enableVirtualization&&(this.isExpandCollapseLevelMethod=!0),this.ganttChartModule.expandAtLevel(e)},s.prototype.indent=function(){this.editModule&&this.editSettings.allowEditing&&this.editModule.indent()},s.prototype.outdent=function(){this.editModule&&this.editSettings.allowEditing&&this.editModule.outdent()},s.prototype.getUndoActions=function(){return this.undoRedoModule?this.undoRedoModule.getUndoCollection:[]},s.prototype.getRedoActions=function(){return this.undoRedoModule?this.undoRedoModule.getRedoCollection:[]},s.prototype.clearUndoCollection=function(){this.undoRedoModule&&(this.undoRedoModule.getUndoCollection=[],this.toolbarModule&&this.toolbarModule.enableItems([this.controlId+"_undo"],!1))},s.prototype.clearRedoCollection=function(){this.undoRedoModule&&(this.undoRedoModule.getRedoCollection=[],this.toolbarModule&&this.toolbarModule.enableItems([this.controlId+"_redo"],!1))},s.prototype.undo=function(){this.undoRedoModule&&this.undoRedoModule.undoAction()},s.prototype.redo=function(){this.undoRedoModule&&this.undoRedoModule.redoAction()},s.prototype.showCriticalPath=function(e){if(this.criticalPathModule){this.criticalPathModule.showCriticalPath(e);var t=this.criticalPathModule;this.criticalPathModule.criticalConnectorLine(t.criticalPathCollection,t.detailPredecessorCollection,!0,t.predecessorCollectionTaskIds)}},s.prototype.getCriticalTasks=function(){return!t.isNullOrUndefined(this.criticalPathModule)&&this.enableCriticalPath?this.criticalPathModule.getCriticalTasks():null},s.prototype.zoomIn=function(){this.timelineModule.processZooming(!0)},s.prototype.zoomOut=function(){this.timelineModule.processZooming(!1)},s.prototype.fitToProject=function(){this.timelineModule.processZoomToFit(),this.ganttChartModule.updateScrollLeft(0)},s.prototype.reorderRows=function(e,t,i){this.rowDragAndDropModule.reorderRows(e,t,i)},s.prototype.updateRecordByIndex=function(e,i){if(this.editModule&&this.editSettings.allowEditing){var a=this.taskFields,r=this.updatedRecords.length>0?t.isNullOrUndefined(this.updatedRecords[e])?null:this.updatedRecords[e]:null;t.isNullOrUndefined(r)||(i[a.id]=r[a.id],this.editModule.updateRecordByID(i))}},s.prototype.addPredecessor=function(e,i){if(this.connectorLineModule){var a=this.connectorLineModule.getRecordByID(e.toString());this.editModule&&!t.isNullOrUndefined(a)&&this.editSettings.allowTaskbarEditing&&this.connectorLineEditModule.addPredecessor(a,i)}},s.prototype.removePredecessor=function(e){if(this.connectorLineModule){var i=this.connectorLineModule.getRecordByID(e.toString());this.editModule&&!t.isNullOrUndefined(i)&&this.editSettings.allowTaskbarEditing&&this.connectorLineEditModule.removePredecessor(i)}},s.prototype.updatePredecessor=function(e,i){if(this.connectorLineModule){var a=this.connectorLineModule.getRecordByID(e.toString());this.editModule&&!t.isNullOrUndefined(a)&&this.editSettings.allowTaskbarEditing&&this.connectorLineEditModule.updatePredecessor(a,i)}},s.prototype.openAddDialog=function(){this.editModule&&this.editModule.dialogModule&&this.editSettings.allowAdding&&this.editModule.dialogModule.openAddDialog()},s.prototype.openEditDialog=function(e){this.editModule&&this.editModule.dialogModule&&this.editSettings.allowEditing&&this.editModule.dialogModule.openEditDialog(e)},s.prototype.contructExpandCollapseArgs=function(e,i){var a,r,n;if(t.isNullOrUndefined(i)&&e)r=this.getRecordByID(e.toString()),a=this.getRowByID(e),t.isNullOrUndefined(a)||(n=t.getValue("rowIndex",a));else if(!t.isNullOrUndefined(i)){a=this.getRowByIndex(i);var s=this.focusModule.isFromKeyboardAction;n=s?t.getValue("rowIndex",a):i,r=s?this.currentViewData[n]:this.flatData[n]}return{data:r,gridRow:this.treeGrid.getRows()[n],chartRow:a,cancel:!1}},s.prototype.getRowByIndex=function(e){try{var i=this.element.querySelectorAll(".e-chart-row");return t.isNullOrUndefined(e)?null:i[e]}catch(e){return null}},s.prototype.getRowByID=function(e){var t,i=this,a=this.getRecordByID(e.toString());return t=this.loadChildOnDemand&&this.taskFields.hasChildMapping?this.updatedRecords.map(function(e){return e[i.taskFields.id]}).indexOf(a.ganttProperties.taskId):this.enableVirtualization?this.currentViewData.indexOf(a):this.updatedRecords.indexOf(a),-1!==t?this.getRowByIndex(t):null},s.prototype.getUnscheduledTaskClass=function(e){return t.isNullOrUndefined(e.startDate)&&t.isNullOrUndefined(e.endDate)&&t.isNullOrUndefined(e.duration)?" e-gantt-unscheduled-task":t.isNullOrUndefined(e.startDate)||t.isNullOrUndefined(e.endDate)||t.isNullOrUndefined(e.duration)?" e-gantt-unscheduled-task":""},s.prototype.isUnscheduledTask=function(e){return!!(t.isNullOrUndefined(e.startDate)||t.isNullOrUndefined(e.endDate)||t.isNullOrUndefined(e.duration))},s.prototype.createGanttPopUpElement=function(){var e=this.createElement("div",{className:"e-ganttpopup",styles:"display:none;"}),i=this.createElement("div",{className:"e-content",attrs:{tabIndex:"-1"}});t.append([i,this.createElement("div",{className:"e-uptail e-tail"})],e),i.appendChild(this.createElement("span")),t.append([i,this.createElement("div",{className:"e-downtail e-tail"})],e),document.getElementById(this.element.id+"GanttChart").appendChild(e)},s.prototype.getPredecessorTextValue=function(e){var t;switch(e){case"SS":t=this.localeObj.getConstant("start")+"-"+this.localeObj.getConstant("start");break;case"FF":t=this.localeObj.getConstant("finish")+"-"+this.localeObj.getConstant("finish");break;case"SF":t=this.localeObj.getConstant("start")+"-"+this.localeObj.getConstant("finish");break;case"FS":t=this.localeObj.getConstant("finish")+"-"+this.localeObj.getConstant("start")}return t},s.prototype.search=function(e){this.filterModule&&(this.searchSettings.key=e,this.dataBind())},s.prototype.getOffsetRect=function(e){var t=e.getBoundingClientRect(),i=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop,a=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,r=document.documentElement.clientTop||document.body.clientTop||0,n=document.documentElement.clientLeft||document.body.clientLeft||0,s=t.top+i-r,o=this.enableRtl?t.right+a-n:t.left+a-n;return{top:Math.round(s),left:Math.round(o),width:t.width,height:t.height}},s.prototype.expandAll=function(){this.ganttChartModule.expandCollapseAll("expand")},s.prototype.updateDataSource=function(e,i){if(this.isDynamicData=!0,!t.isNullOrUndefined(i))for(var a=0,r=Object.keys(i);a<r.length;a++){var n=r[a];switch(n){case"projectStartDate":this.setProperties({projectStartDate:i[n]},!0);break;case"projectEndDate":this.setProperties({projectEndDate:i[n]},!0)}}this.ganttChartModule.scrollObject.element.scrollLeft=0,this.dataSource=e},s.prototype.collapseAll=function(){this.ganttChartModule.expandCollapseAll("collapse")},s.prototype.getGridColumns=function(){return this.treeGrid.getColumns()},s.prototype.getColumnByField=function(e,t){var i=t.filter(function(t){return t.field===e});return i.length>0?i[0]:null},s.prototype.getGanttColumns=function(){return this.ganttColumns},s.prototype.showColumn=function(e,t){this.treeGrid.showColumns(e,t),this.updateTreeColumns()},s.prototype.hideColumn=function(e,t){this.treeGrid.hideColumns(e,t),this.updateTreeColumns()},s.prototype.setScrollTop=function(e){this.ganttChartModule.scrollObject.setScrollTop(e)},s.prototype.cancelEdit=function(){this.isCancelled=!0,this.closeGanttActions()},s.prototype.selectCell=function(e,t){this.selectionModule&&this.selectionModule.selectCell(e,t)},s.prototype.selectCells=function(e){this.selectionModule&&this.selectionModule.selectCells(e)},s.prototype.selectRow=function(e,t){this.selectionModule&&this.selectionModule.selectRow(e,t)},s.prototype.selectRows=function(e){this.selectionModule&&this.selectionModule.selectRows(e)},s.prototype.deleteRecord=function(e){this.editModule&&this.editModule.deleteRecord(e)},s.prototype.enableItems=function(e,t){this.toolbarModule&&this.toolbarModule.enableItems(e,t)},s.prototype.clearSelection=function(){this.selectionModule&&this.selectionModule.clearSelection()},s.prototype.updateDataArgs=function(e){if(!Array.isArray(e.data)){var i=[];i.push(e.data),t.setValue("data",i,e)}return e},s.prototype.convertToMilestone=function(e){var i=this.getRecordByID(e);if(!t.isNullOrUndefined(i)){var a=t.extend({},{},i.taskData,!0),r=this.taskFields;if(a[r.startDate]&&this.setRecordValue(r.startDate,i.ganttProperties.startDate,a,!0),t.isNullOrUndefined(r.duration)?(a[r.startDate]=new Date(i.ganttProperties.startDate),a[r.endDate]=new Date(i.ganttProperties.endDate)):a[r.duration]=0,t.isNullOrUndefined(r.milestone)||!1===a[r.milestone]&&(a[r.milestone]=!0),t.isNullOrUndefined(r.progress)||(a[r.progress]=0),!t.isNullOrUndefined(r.child)&&a[r.child]&&(a[r.child]=[]),!t.isNullOrUndefined(r.parentID)&&a[r.parentID]&&(a[r.parentID]=null),t.isNullOrUndefined(r.segments)||(a[r.segments]=null),"FixedWork"===(t.isNullOrUndefined(i.ganttProperties.taskType)?this.taskType:i.ganttProperties.taskType)&&(t.isNullOrUndefined(a[r.work])?i.ganttProperties.work=0:a[r.work]=0),!t.isNullOrUndefined(this.contextMenuModule)&&this.contextMenuModule.isOpen&&"Milestone"===this.contextMenuModule.item){t.isNullOrUndefined(r.dependency)||(a[r.dependency]=null);var n=this.editSettings.newRowPosition;this.addRecord(a,n,this.selectedRowIndex)}else i.hasChildRecords||i.ganttProperties.isMilestone||(this.isConvertedMilestone=!0,this.updateRecordByID(a),this.isConvertedMilestone=!1)}},s.prototype.changeTaskMode=function(e){if(this.undoRedoModule&&!this.undoRedoModule.isUndoRedoPerformed){this.undoRedoModule.redoEnabled&&this.undoRedoModule.disableRedo(),this.undoRedoModule.createUndoCollection();var i={};i.action="TaskMode",i.modifiedRecords=t.extend([],[e],[],!0),this.undoRedoModule.getUndoCollection[this.undoRedoModule.getUndoCollection.length-1]=i}var a=this.taskFields,r=this.getRecordByID(e[a.id]),n=r.ganttProperties;this.isOnEdit=!0,this.setRecordValue("isAutoSchedule",!n.isAutoSchedule,n,!0),t.isNullOrUndefined(this.taskFields.manual)||(this.setRecordValue("taskData."+a.manual,!n.isAutoSchedule,r),this.setRecordValue(a.manual,!n.isAutoSchedule,r)),this.editModule.updateTaskScheduleModes(r);var s={data:r};this.editModule.initiateUpdateAction(s)},s.prototype.getTaskIds=function(){return this.taskIds},s.prototype.setTaskIds=function(e){if("ProjectView"!==this.viewType){var t=e.ganttProperties.taskId;t=0===e.level?"R"+t:"T"+t,this.taskIds.push(t)}},s.prototype.renderTemplates=function(){this.isReact&&this.renderReactTemplates()},s.prototype.resetTemplates=function(){this.isReact&&this.clearTemplate(["TaskbarTemplate","ParentTaskbarTemplate","MilestoneTemplate","TaskLabelTemplate","RightLabelTemplate","LeftLabelTemplate","TooltipTaskbarTemplate","TooltipBaselineTemplate","TooltipConnectorLineTemplate","TimelineTemplate"])},ut([t.Property(!0)],s.prototype,"allowKeyboard",void 0),ut([t.Property(!1)],s.prototype,"enableImmutableMode",void 0),ut([t.Property(!0)],s.prototype,"allowParentDependency",void 0),ut([t.Property(!0)],s.prototype,"enableHtmlSanitizer",void 0),ut([t.Property(!0)],s.prototype,"disableHtmlEncode",void 0),ut([t.Complex({},et)],s.prototype,"loadingIndicator",void 0),ut([t.Property(!0)],s.prototype,"enableVirtualMaskRow",void 0),ut([t.Property(!0)],s.prototype,"loadChildOnDemand",void 0),ut([t.Property(!0)],s.prototype,"updateOffsetOnTaskbarEdit",void 0),ut([t.Property(!0)],s.prototype,"UpdateOffsetOnTaskbarEdit",void 0),ut([t.Property(!0)],s.prototype,"autoCalculateDateScheduling",void 0),ut([t.Property(!0)],s.prototype,"autoFocusTasks",void 0),ut([t.Property(!1)],s.prototype,"enableAdaptiveUI",void 0),ut([t.Property(!1)],s.prototype,"enableWBS",void 0),ut([t.Property(!1)],s.prototype,"enableAutoWbsUpdate",void 0),ut([t.Property(!0)],s.prototype,"allowSelection",void 0),ut([t.Property(!1)],s.prototype,"allowSorting",void 0),ut([t.Property(!0)],s.prototype,"enablePredecessorValidation",void 0),ut([t.Property(!1)],s.prototype,"showColumnMenu",void 0),ut([t.Property()],s.prototype,"columnMenuItems",void 0),ut([t.Property(["Sorting","Add","ColumnReorder","ColumnResize","ColumnState","Delete","Edit","Filtering","Indent","Outdent","NextTimeSpan","PreviousTimeSpan","RowDragAndDrop","TaskbarDragAndDrop","Search","ZoomIn","ZoomOut","ZoomToFit"])],s.prototype,"undoRedoActions",void 0),ut([t.Property()],s.prototype,"timezone",void 0),ut([t.Property(!1)],s.prototype,"collapseAllParentTasks",void 0),ut([t.Property(!1)],s.prototype,"highlightWeekends",void 0),ut([t.Property(0)],s.prototype,"treeColumnIndex",void 0),ut([t.Property([])],s.prototype,"dataSource",void 0),ut([t.Property("day")],s.prototype,"durationUnit",void 0),ut([t.Property(null)],s.prototype,"query",void 0),ut([t.Property(null)],s.prototype,"dateFormat",void 0),ut([t.Property("auto")],s.prototype,"height",void 0),ut([t.Property(!1)],s.prototype,"renderBaseline",void 0),ut([t.Property(!1)],s.prototype,"allowTaskbarDragAndDrop",void 0),ut([t.Property(!0)],s.prototype,"allowTaskbarOverlap",void 0),ut([t.Property("Horizontal")],s.prototype,"gridLines",void 0),ut([t.Complex({},Me)],s.prototype,"labelSettings",void 0),ut([t.Property(null)],s.prototype,"taskbarTemplate",void 0),ut([t.Property(null)],s.prototype,"parentTaskbarTemplate",void 0),ut([t.Property(null)],s.prototype,"timelineTemplate",void 0),ut([t.Property(null)],s.prototype,"milestoneTemplate",void 0),ut([t.Property()],s.prototype,"baselineColor",void 0),ut([t.Property("auto")],s.prototype,"width",void 0),ut([t.Property(!1)],s.prototype,"enableVirtualization",void 0),ut([t.Property(!1)],s.prototype,"enableTimelineVirtualization",void 0),ut([t.Property()],s.prototype,"toolbar",void 0),ut([t.Property(["Monday","Tuesday","Wednesday","Thursday","Friday"])],s.prototype,"workWeek",void 0),ut([t.Property(!1)],s.prototype,"includeWeekend",void 0),ut([t.Property(!1)],s.prototype,"allowUnscheduledTasks",void 0),ut([t.Property(!1)],s.prototype,"showInlineNotes",void 0),ut([t.Property(36)],s.prototype,"rowHeight",void 0),ut([t.Property(null)],s.prototype,"taskbarHeight",void 0),ut([t.Property(null)],s.prototype,"projectStartDate",void 0),ut([t.Property(null)],s.prototype,"projectEndDate",void 0),ut([t.Property(null)],s.prototype,"resourceIDMapping",void 0),ut([t.Property(null)],s.prototype,"resourceNameMapping",void 0),ut([t.Property([])],s.prototype,"resources",void 0),ut([t.Property([])],s.prototype,"segmentData",void 0),ut([t.Property(null)],s.prototype,"connectorLineBackground",void 0),ut([t.Property(1)],s.prototype,"connectorLineWidth",void 0),ut([t.Property([])],s.prototype,"columns",void 0),ut([t.Property([])],s.prototype,"addDialogFields",void 0),ut([t.Property([])],s.prototype,"editDialogFields",void 0),ut([t.Property(-1)],s.prototype,"selectedRowIndex",void 0),ut([t.Property("hour")],s.prototype,"workUnit",void 0),ut([t.Property("FixedUnit")],s.prototype,"taskType",void 0),ut([t.Property("ProjectView")],s.prototype,"viewType",void 0),ut([t.Collection([{from:8,to:12},{from:13,to:17}],re)],s.prototype,"dayWorkingTime",void 0),ut([t.Collection([],at)],s.prototype,"weekWorkingTime",void 0),ut([t.Collection([],Pe)],s.prototype,"holidays",void 0),ut([t.Collection([],me)],s.prototype,"eventMarkers",void 0),ut([t.Complex({},Ve)],s.prototype,"taskFields",void 0),ut([t.Complex({},Qe)],s.prototype,"resourceFields",void 0),ut([t.Complex({},He)],s.prototype,"timelineSettings",void 0),ut([t.Property([])],s.prototype,"zoomingLevels",void 0),ut([t.Complex({},Xe)],s.prototype,"sortSettings",void 0),ut([t.Complex({},ce)],s.prototype,"editSettings",void 0),ut([t.Complex({},Ge)],s.prototype,"tooltipSettings",void 0),ut([t.Complex({},Ie)],s.prototype,"selectionSettings",void 0),ut([t.Property(!1)],s.prototype,"allowFiltering",void 0),ut([t.Property(!1)],s.prototype,"allowExcelExport",void 0),ut([t.Property(!1)],s.prototype,"allowRowDragAndDrop",void 0),ut([t.Property(!1)],s.prototype,"allowReordering",void 0),ut([t.Property(!1)],s.prototype,"readOnly",void 0),ut([t.Property(!1)],s.prototype,"allowResizing",void 0),ut([t.Property(!1)],s.prototype,"enableContextMenu",void 0),ut([t.Property(!1)],s.prototype,"enableCriticalPath",void 0),ut([t.Property(!1)],s.prototype,"enableUndoRedo",void 0),ut([t.Property(10)],s.prototype,"undoRedoStepsCount",void 0),ut([t.Property()],s.prototype,"contextMenuItems",void 0),ut([t.Property(!1)],s.prototype,"allowPdfExport",void 0),ut([t.Property(!1)],s.prototype,"validateManualTasksOnLinking",void 0),ut([t.Property(!1)],s.prototype,"enableMultiTaskbar",void 0),ut([t.Property(!1)],s.prototype,"showOverAllocation",void 0),ut([t.Property("Auto")],s.prototype,"taskMode",void 0),ut([t.Complex({},ve)],s.prototype,"filterSettings",void 0),ut([t.Complex({},we)],s.prototype,"searchSettings",void 0),ut([t.Complex({},Ue)],s.prototype,"splitterSettings",void 0),ut([t.Event()],s.prototype,"queryTaskbarInfo",void 0),ut([t.Event()],s.prototype,"beforeExcelExport",void 0),ut([t.Event()],s.prototype,"excelExportComplete",void 0),ut([t.Event()],s.prototype,"excelQueryCellInfo",void 0),ut([t.Event()],s.prototype,"excelHeaderQueryCellInfo",void 0),ut([t.Event()],s.prototype,"rowDrag",void 0),ut([t.Event()],s.prototype,"rowDragStart",void 0),ut([t.Event()],s.prototype,"rowDragStartHelper",void 0),ut([t.Event()],s.prototype,"rowDrop",void 0),ut([t.Event()],s.prototype,"collapsing",void 0),ut([t.Event()],s.prototype,"collapsed",void 0),ut([t.Event()],s.prototype,"expanding",void 0),ut([t.Event()],s.prototype,"expanded",void 0),ut([t.Event()],s.prototype,"actionBegin",void 0),ut([t.Event()],s.prototype,"cellSave",void 0),ut([t.Event()],s.prototype,"actionComplete",void 0),ut([t.Event()],s.prototype,"actionFailure",void 0),ut([t.Event()],s.prototype,"dataStateChange",void 0),ut([t.Event()],s.prototype,"taskbarEdited",void 0),ut([t.Event()],s.prototype,"endEdit",void 0),ut([t.Event()],s.prototype,"cellEdit",void 0),ut([t.Event()],s.prototype,"load",void 0),ut([t.Event()],s.prototype,"created",void 0),ut([t.Event()],s.prototype,"destroyed",void 0),ut([t.Event()],s.prototype,"taskbarEditing",void 0),ut([t.Event()],s.prototype,"dataBound",void 0),ut([t.Event()],s.prototype,"beforeDataBound",void 0),ut([t.Event()],s.prototype,"resizeStart",void 0),ut([t.Event()],s.prototype,"resizing",void 0),ut([t.Event()],s.prototype,"resizeStop",void 0),ut([t.Event()],s.prototype,"splitterResizeStart",void 0),ut([t.Event()],s.prototype,"splitterResizing",void 0),ut([t.Event()],s.prototype,"splitterResized",void 0),ut([t.Event()],s.prototype,"columnDragStart",void 0),ut([t.Event()],s.prototype,"columnDrag",void 0),ut([t.Event()],s.prototype,"columnDrop",void 0),ut([t.Event()],s.prototype,"beforeTooltipRender",void 0),ut([t.Event()],s.prototype,"rowSelecting",void 0),ut([t.Event()],s.prototype,"rowSelected",void 0),ut([t.Event()],s.prototype,"rowDeselecting",void 0),ut([t.Event()],s.prototype,"rowDeselected",void 0),ut([t.Event()],s.prototype,"cellSelecting",void 0),ut([t.Event()],s.prototype,"cellSelected",void 0),ut([t.Event()],s.prototype,"cellDeselecting",void 0),ut([t.Event()],s.prototype,"cellDeselected",void 0),ut([t.Event()],s.prototype,"queryCellInfo",void 0),ut([t.Event()],s.prototype,"headerCellInfo",void 0),ut([t.Event()],s.prototype,"rowDataBound",void 0),ut([t.Event()],s.prototype,"columnMenuOpen",void 0),ut([t.Event()],s.prototype,"toolbarClick",void 0),ut([t.Event()],s.prototype,"columnMenuClick",void 0),ut([t.Event()],s.prototype,"contextMenuOpen",void 0),ut([t.Event()],s.prototype,"contextMenuClick",void 0),ut([t.Event()],s.prototype,"onTaskbarClick",void 0),ut([t.Event()],s.prototype,"recordDoubleClick",void 0),ut([t.Event()],s.prototype,"onMouseMove",void 0),ut([t.Event()],s.prototype,"beforePdfExport",void 0),ut([t.Event()],s.prototype,"pdfExportComplete",void 0),ut([t.Event()],s.prototype,"pdfQueryCellInfo",void 0),ut([t.Event()],s.prototype,"pdfQueryTaskbarInfo",void 0),ut([t.Event()],s.prototype,"pdfQueryTimelineCellInfo",void 0),ut([t.Event()],s.prototype,"pdfColumnHeaderQueryCellInfo",void 0),s=ut([t.NotifyPropertyChanges],s)}(t.Component);!function(e){e[e.NextPage=0]="NextPage",e[e.LastPage=1]="LastPage"}(e.PdfHorizontalOverflowType||(e.PdfHorizontalOverflowType={}));var gt=function(){function i(e){this.isCellEdit=!1,this.isResourceCellEdited=!1,this.parent=e,this.bindTreeGridProperties()}return i.prototype.bindTreeGridProperties=function(){this.parent.treeGrid.editSettings.allowEditing=this.parent.editSettings.allowEditing,this.parent.treeGrid.editSettings.allowNextRowEdit=this.parent.editSettings.allowNextRowEdit,this.parent.treeGrid.editSettings.mode="Cell",this.parent.treeGrid.cellEdit=this.ensureEditCell.bind(this),this.parent.editSettings.allowEditing&&n.TreeGrid.Inject(n.Edit)},i.prototype.ensureEditCell=function(i){var r=this,n=i.rowData,s=i.columnName;this.editedColumn=this.parent.getColumnByField(s,this.parent.ganttColumns);var o=this.parent.taskFields;if(this.parent.readOnly)return void(i.cancel=!0);if("Dialog"===this.parent.editSettings.mode)return void(i.cancel=!0);if(i.columnObject&&i.columnObject.field===this.parent.taskFields.constraintType&&i.columnObject.edit&&i.columnObject.edit.params&&Array.isArray(i.columnObject.edit.params.dataSource)){var l=Object.keys(e.ConstraintType).filter(function(t){return!isNaN(Number(e.ConstraintType[t]))}).map(function(t){return{text:r.parent.treeGridModule.getLocalizedConstraintTypeText(t),value:e.ConstraintType[t]}});if(i.rowData&&i.rowData.hasChildRecords){var d=this.parent.treeGridModule.getLocalizedConstraintTypeText("AsSoonAsPossible"),h=this.parent.treeGridModule.getLocalizedConstraintTypeText("StartNoEarlierThan"),p=this.parent.treeGridModule.getLocalizedConstraintTypeText("FinishNoLaterThan");i.columnObject.edit.params.dataSource=l.filter(function(e){return e.text===d||e.text===h||e.text===p})}else i.columnObject.edit.params.dataSource=l}if(!n.hasChildRecords||this.parent.allowParentDependency||(s!==o.endDate||(t.isNullOrUndefined(n[o.manual])||!1!==n[o.manual])&&"Auto"!==this.parent.taskMode)&&s!==o.duration&&s!==o.dependency&&s!==o.progress&&s!==o.work&&s!==o.type&&"taskType"!==s){var u=new a.Deferred,c=this.parent;return this.currentEditedRowData=i.rowData,this.parent.trigger("cellEdit",i,function(e){if(e.columnName===c.taskFields.progress&&e.rowData.hasChildRecords&&(e.cancel=!0),!i.rowData.ganttProperties.isAutoSchedule){var a=r.parent.taskFields;-1!==[a.constraintDate,a.constraintType].indexOf(i.columnObject.field)&&(e.cancel=!0)}0===n.level&&"ResourceView"===r.parent.viewType&&(e.cancel=!0),u.resolve(e),e.cancel||(e.columnName===r.parent.taskFields.notes||"WBSPredecessor"===e.columnName?r.openNotesEditor(e):(r.isCellEdit=!0,t.isNullOrUndefined(r.parent.toolbarModule)||r.parent.toolbarModule.refreshToolbarItems()))}),u}(s===o.dependency&&!this.parent.allowParentDependency||s!==o.dependency)&&(i.cancel=!0)},i.prototype.openNotesEditor=function(e){var t=this.parent.taskFields,i=e.rowData,a=e.columnName;if(a===t.notes&&!this.parent.showInlineNotes||"WBSPredecessor"===a){e.cancel=!0;var r=this.parent.editModule.dialogModule.updatedEditFields.map(function(e){return e.type}),n="WBSPredecessor"===a?r.indexOf("Dependency"):r.indexOf("Notes");-1!==n&&(this.parent.editModule.dialogModule.openEditDialog(i.ganttProperties.rowUniqueID),document.getElementById(this.parent.element.id+"_Tab").ej2_instances[0].selectedItem=n)}a===t.notes&&!0===this.parent.showInlineNotes&&(this.isCellEdit=!0)},i.prototype.initiateCellEdit=function(e,i){var a=!0;if("actionComplete"===e.name&&e.previousData===e.data[e.column.field]&&(a=!1),this.parent.undoRedoModule&&this.parent.isUndoRedoItemPresent("Edit")&&a){this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection();var r={};r.action="CellEditing",r.editedColumn=e.column.field,r.modifiedRecords=[],this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=r}var n=t.getValue("column",e),s=t.getValue("data",e),o={};o.action="CellEditing",o.data=this.parent.getTaskByUniqueID(s.uniqueID);var l=t.getValue("previousData",e),d=this.parent.taskFields.baselineEndDate===n.field||this.parent.taskFields.baselineStartDate===n.field,h=this.parent.allowUnscheduledTasks&&!d?s[n.field]:!t.isNullOrUndefined(s[n.field])&&""!==s[n.field]||this.parent.taskFields.duration!==n.field&&this.parent.taskFields.startDate!==n.field&&this.parent.taskFields.endDate!==n.field&&this.parent.taskFields.baselineDuration!==n.field&&this.parent.taskFields.baselineEndDate!==n.field&&this.parent.taskFields.baselineStartDate!==n.field?s[n.field]:l;if(t.isNullOrUndefined(s))this.parent.editModule.endEditAction(e);else{if(s[n.field]=l,o.data[n.field]=l,this.parent.initiateEditAction(!0),this.parent.weekWorkingTime.length>0&&h&&(n.field===this.parent.taskFields.startDate||n.field===this.parent.taskFields.baselineStartDate)){var p=n.field===this.parent.taskFields.startDate?s.ganttProperties.startDate:s.ganttProperties.baselineStartDate;if(this.parent.getStartTime(p)/3600===p.getHours()){var u=this.parent.getStartTime(h);this.parent.dataOperation.setTime(u,h),this.parent.setRecordValue(n.field,h,o.data)}else this.parent.setRecordValue(n.field,h,o.data)}else this.parent.setRecordValue(n.field,h,o.data);n.field===this.parent.taskFields.name?this.taskNameEdited(o):n.field===this.parent.taskFields.startDate?this.startDateEdited(o,!1):n.field===this.parent.taskFields.constraintDate||n.field===this.parent.taskFields.constraintType?this.constraintEdited(o):n.field===this.parent.taskFields.endDate?this.endDateEdited(o,e.previousData):n.field===this.parent.taskFields.duration?this.durationEdited(o):n.field===this.parent.taskFields.resourceInfo?this.resourceEdited(o,i,s):n.field===this.parent.taskFields.progress?this.progressEdited(o):n.field===this.parent.taskFields.baselineStartDate?this.startDateEdited(o,!0):n.field===this.parent.taskFields.baselineEndDate?this.endDateEditedforBaseline(o,e.previousData):n.field===this.parent.taskFields.baselineDuration?this.durationEdited(o,!0):n.field===this.parent.taskFields.dependency?this.dependencyEdited(o,l):n.field===this.parent.taskFields.notes?this.notedEdited(o):n.field===this.parent.taskFields.work?this.workEdited(o):n.field!==this.parent.taskFields.type&&"taskType"!==n.field||t.isNullOrUndefined(this.parent.taskFields.work)?n.field===this.parent.taskFields.manual?this.taskmodeEdited(o):(this.parent.setRecordValue("taskData."+n.field,o.data[n.field],o.data),this.parent.editModule.initiateSaveAction(o)):this.typeEdited(o,i)}this.isCellEdit=!1,t.isNullOrUndefined(this.parent.editModule.cellEditModule.editedColumn)||(this.parent.editModule.cellEditModule.editedColumn=null),t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},i.prototype.taskNameEdited=function(e){this.parent.setRecordValue("taskData."+this.parent.taskFields.name,e.data[this.parent.taskFields.name],e.data),this.parent.setRecordValue("taskName",e.data[this.parent.taskFields.name],e.data.ganttProperties,!0),this.updateEditedRecord(e)},i.prototype.notedEdited=function(e){this.parent.setRecordValue("taskData."+this.parent.taskFields.notes,e.data[this.parent.taskFields.notes],e.data),this.parent.setRecordValue("notes",e.data[this.parent.taskFields.notes],e.data.ganttProperties,!0),this.updateEditedRecord(e)},i.prototype.taskmodeEdited=function(e){this.parent.setRecordValue("isAutoSchedule",!e.data[this.parent.taskFields.manual],e.data.ganttProperties,!0),this.parent.editModule.updateTaskScheduleModes(e.data),this.updateEditedRecord(e)},i.prototype.updateGanttDataProperties=function(e,i,a){var r=e.data,n=r.ganttProperties,s=this.parent.dateValidationModule.getFieldMappings(a),o=s.startdateField,l=s.enddateField,d=s.durationField;t.isNullOrUndefined(i)?r.hasChildRecords||(a||(this.parent.setRecordValue(o,null,n,!0),this.parent.setRecordValue("isMilestone",!1,n,!0)),null===n.startDate&&null===n.endDate&&null!==n.duration||this.parent.setRecordValue(d,null,n,!0)):n[l]||!t.isNullOrUndefined(n[d])?(this.parent.setRecordValue(o,new Date(i.getTime()),n,!0),(!a||a&&!t.isNullOrUndefined(this.parent.taskFields.baselineDuration))&&this.parent.dateValidationModule.calculateEndDate(r,a)):t.isNullOrUndefined(n[l])&&t.isNullOrUndefined(n[d])&&this.parent.setRecordValue(o,new Date(i.getTime()),n,!0),a||this.parent.setRecordValue("isMilestone",0===n.duration,n,!0),this.parent.dataOperation.updateWidthLeft(e.data),this.parent.dataOperation.updateMappingData(r,o),this.parent.dataOperation.updateMappingData(r,l),this.parent.dataOperation.updateMappingData(r,d)},i.prototype.startDateEdited=function(e,t){var i=e.data,a=(e.data.ganttProperties,t?e.data[this.parent.taskFields.baselineStartDate]:e.data[this.parent.taskFields.startDate]);a=a?new Date(a.getTime()):null,a=this.parent.dateValidationModule.checkStartDate(a,i.ganttProperties,i.ganttProperties.isMilestone,void 0,t),e.data.ganttProperties.constraintDate&&(e.data.ganttProperties.constraintDate=a),this.updateGanttDataProperties(e,a,t),this.updateEditedRecord(e)},i.prototype.constraintEdited=function(i){var a=i.data,r=i.data.ganttProperties,n=i.data[this.parent.taskFields.startDate],s=i.data[this.parent.taskFields.constraintDate],o=i.data[this.parent.taskFields.constraintType];if(n=n?new Date(n.getTime()):null,t.isNullOrUndefined(s)){var l=a[this.parent.taskFields.startDate],d=a[this.parent.taskFields.endDate];switch(o){case e.ConstraintType.MustStartOn:case e.ConstraintType.StartNoEarlierThan:case e.ConstraintType.StartNoLaterThan:t.isNullOrUndefined(l)||(this.parent.setRecordValue("constraintDate",new Date(l.getTime()),r,!0),s=r.constraintDate);break;case e.ConstraintType.MustFinishOn:case e.ConstraintType.FinishNoEarlierThan:case e.ConstraintType.FinishNoLaterThan:t.isNullOrUndefined(d)||(this.parent.setRecordValue("constraintDate",new Date(d.getTime()),r,!0),s=r.constraintDate)}}else this.parent.setRecordValue("constraintDate",new Date(s.getTime()),r,!0);if(this.parent.setRecordValue("constraintType",o,r,!0),r.predecessor&&r.constraintType===e.ConstraintType.AsSoonAsPossible){var h=this.parent.predecessorModule.getPredecessorDate(i.data,r.predecessor);h&&(n=h)}else n=r.constraintType===e.ConstraintType.StartNoEarlierThan||r.constraintType===e.ConstraintType.MustStartOn||r.constraintType===e.ConstraintType.MustFinishOn?this.parent.dateValidationModule.getDateByConstraint(a,s):this.parent.dateValidationModule.getDateByConstraint(a,n);this.updateGanttDataProperties(i,n),this.parent.dataOperation.updateMappingData(a,"constraintDate"),this.updateEditedRecord(i)},i.prototype.validateEndDateWithSegments=function(e){for(var i=[],a=e.segments,r=0;r<a.length;r++){var n=a[parseInt(r.toString(),10)],s=n.endDate;s=!t.isNullOrUndefined(e.endDate)&&s.getTime()<e.endDate.getTime()&&r!==a.length-1?s:e.endDate,n.duration=this.parent.dataOperation.getDuration(n.startDate,s,e.durationUnit,e.isAutoSchedule,e.isMilestone),a.length>0&&s.getTime()<n.startDate.getTime()&&s.getTime()<=e.endDate.getTime()?a[r-1].duration=this.parent.dataOperation.getDuration(a[r-1].startDate,e.endDate,e.durationUnit,e.isAutoSchedule,e.isMilestone):i.push(n)}return i},i.prototype.endDateEdited=function(e,i){var a=e.data.ganttProperties,r=e.data[this.parent.taskFields.endDate];if(r=r?new Date(r.getTime()):null,t.isNullOrUndefined(r))this.parent.setRecordValue("endDate",r,a,!0),null===a.startDate&&null===a.endDate&&null!==a.duration||this.parent.setRecordValue("duration",null,a,!0),this.parent.setRecordValue("isMilestone",!1,a,!0);else{var n=this.parent.getCurrentDayEndTime(r);(0===r.getHours()||i&&r.toTimeString().slice(0,5)===i.toTimeString().slice(0,5))&&86400!==n&&this.parent.dateValidationModule.setTime(n,r),r=this.parent.dateValidationModule.checkEndDate(r,a,a.isMilestone),this.parent.setRecordValue("endDate",r,a,!0),!t.isNullOrUndefined(a.startDate)&&t.isNullOrUndefined(a.duration)?-1===this.parent.dateValidationModule.compareDates(a.endDate,a.startDate)&&(this.parent.setRecordValue("endDate",new Date(a.startDate.getTime()),a,!0),n=this.parent.getCurrentDayEndTime(a.endDate),this.parent.dateValidationModule.setTime(n,a.endDate)):!t.isNullOrUndefined(a.duration)&&t.isNullOrUndefined(a.startDate)&&this.parent.setRecordValue("startDate",this.parent.dateValidationModule.getStartDate(a.endDate,a.duration,a.durationUnit,a),a,!0),t.isNullOrUndefined(a.segments)||(a.segments=this.validateEndDateWithSegments(a)),this.compareDatesFromRecord(a)<=0?this.parent.dateValidationModule.calculateDuration(e.data):this.parent.editModule.revertCellEdit(e),this.updateDates(e),this.parent.setRecordValue("isMilestone",0===a.duration,a,!0),a.isMilestone&&this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(a.startDate,a),a,!0)}!t.isNullOrUndefined(e.data.ganttProperties.segments)&&e.data.ganttProperties.segments.length>0&&(this.parent.setRecordValue("segments",this.parent.dataOperation.setSegmentsInfo(e.data,!1),e.data.ganttProperties,!0),this.parent.dataOperation.updateMappingData(e.data,"segments")),this.parent.dataOperation.updateWidthLeft(e.data),this.parent.dataOperation.updateMappingData(e.data,"startDate"),this.parent.dataOperation.updateMappingData(e.data,"endDate"),this.parent.dataOperation.updateMappingData(e.data,"duration"),this.parent.editModule.updateResourceRelatedFields(e.data,"endDate"),this.updateEditedRecord(e)},i.prototype.endDateEditedforBaseline=function(e,i){var a=e.data.ganttProperties,r=e.data[this.parent.taskFields.baselineEndDate];if(r=r?new Date(r.getTime()):null,t.isNullOrUndefined(r))this.parent.setRecordValue("baselineEndDate",r,a,!0),null===a.baselineStartDate&&null===a.baselineEndDate&&null!==a.baselineDuration||this.parent.setRecordValue("baselineDuration",null,a,!0);else{var n=this.parent.getCurrentDayEndTime(r);(0===r.getHours()||i&&r.toTimeString().slice(0,5)===i.toTimeString().slice(0,5))&&86400!==n&&this.parent.dateValidationModule.setTime(n,r),r=this.parent.dateValidationModule.checkEndDate(r,a,a.isMilestone,!0),this.parent.setRecordValue("baselineEndDate",r,a,!0),!t.isNullOrUndefined(a.baselineStartDate)&&t.isNullOrUndefined(a.baselineDuration)?-1===this.parent.dateValidationModule.compareDates(a.baselineEndDate,a.baselineStartDate)&&(this.parent.setRecordValue("baselineEndDate",new Date(a.baselineStartDate.getTime()),a,!0),n=this.parent.getCurrentDayEndTime(a.baselineEndDate),this.parent.dateValidationModule.setTime(n,a.baselineEndDate)):!t.isNullOrUndefined(a.baselineDuration)&&t.isNullOrUndefined(a.baselineStartDate)&&this.parent.setRecordValue("baselineStartDate",this.parent.dateValidationModule.getStartDate(a.baselineEndDate,a.baselineDuration,a.durationUnit,a,!0),a,!0),this.compareDatesFromRecord(a,!0)<=0?this.parent.dateValidationModule.calculateDuration(e.data,!0):this.parent.editModule.revertCellEdit(e),this.updateDatesforBaseline(e)}this.parent.dataOperation.updateWidthLeft(e.data),this.parent.dataOperation.updateMappingData(e.data,"baselineStartDate"),this.parent.dataOperation.updateMappingData(e.data,"baselineEndDate"),this.parent.dataOperation.updateMappingData(e.data,"baselineDuration"),this.updateEditedRecord(e)},i.prototype.durationEdited=function(e,t){var i=/^[^\d.-]+$/,a=t?"baselineDuration":"duration";if(i.test(e.data[this.parent.taskFields[a]])){var r="The provided value for the "+this.parent.taskFields[a]+" field is invalid. Please ensure the "+this.parent.taskFields[a]+" field contains only valid numeric values.";this.parent.trigger("actionFailure",{error:r})}var n=e.data.ganttProperties;!t&&parseInt(e.data[this.parent.taskFields.duration],10)<0?e.data[this.parent.taskFields.duration]=n.duration:t&&parseInt(e.data[this.parent.taskFields.baselineDuration],10)<0&&(e.data[this.parent.taskFields.baselineDuration]=n.baselineDuration);var s=e.data[this.parent.taskFields[a]];this.parent.dataOperation.updateDurationValue(s,n,t),t?this.updateDatesforBaseline(e):(this.updateDates(e),this.parent.editModule.updateResourceRelatedFields(e.data,"duration")),this.updateEditedRecord(e)},i.prototype.updateDates=function(e){var i=e.data.ganttProperties,a=this.parent.dateValidationModule.getDateFromFormat(i.endDate),r=this.parent.dateValidationModule.getDateFromFormat(i.startDate),n=i.duration;t.isNullOrUndefined(n)?(this.parent.setRecordValue("isMilestone",!1,i,!0),null!==e.data[this.parent.taskFields.duration]&&this.parent.setRecordValue("endDate",null,i,!0)):(t.isNullOrUndefined(r)&&!t.isNullOrUndefined(a)&&this.parent.setRecordValue("startDate",this.parent.dateValidationModule.getStartDate(a,n,i.durationUnit,i),i,!0),0!==n&&i.isMilestone&&(this.parent.setRecordValue("isMilestone",!1,i,!0),t.isNullOrUndefined(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!1,e.data,!0),this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(i.startDate,i),i,!0)),!t.isNullOrUndefined(i.segments)&&i.segments.length>0&&(this.parent.setRecordValue("segments",this.parent.dataOperation.setSegmentsInfo(e.data,!1),i,!0),this.parent.dataOperation.updateMappingData(e.data,"segments")),this.parent.setRecordValue("isMilestone",0===i.duration,i,!0),this.parent.dateValidationModule.calculateEndDate(e.data)),this.parent.dataOperation.updateWidthLeft(e.data),this.parent.dataOperation.updateMappingData(e.data,"endDate"),this.parent.dataOperation.updateMappingData(e.data,"startDate"),this.parent.dataOperation.updateMappingData(e.data,"duration")},i.prototype.updateDatesforBaseline=function(e){var i=e.data.ganttProperties,a=this.parent.dateValidationModule.getDateFromFormat(i.baselineEndDate),r=this.parent.dateValidationModule.getDateFromFormat(i.baselineStartDate),n=i.baselineDuration;t.isNullOrUndefined(r)&&!t.isNullOrUndefined(a)&&this.parent.setRecordValue("baselineStartDate",this.parent.dateValidationModule.getStartDate(a,n,i.durationUnit,i,void 0,!0),i,!0),0!==n&&this.parent.setRecordValue("baselineStartDate",this.parent.dateValidationModule.checkStartDate(i.baselineStartDate,i,void 0,void 0,!0),i,!0),this.parent.dateValidationModule.calculateEndDate(e.data,!0),this.parent.dataOperation.updateWidthLeft(e.data),this.parent.dataOperation.updateMappingData(e.data,"baselineEndDate"),this.parent.dataOperation.updateMappingData(e.data,"baselineStartDate"),this.parent.dataOperation.updateMappingData(e.data,"baselineDuration")},i.prototype.progressEdited=function(e){var i=e.data;if(this.parent.setRecordValue("progress",i[this.parent.taskFields.progress]>100?100:i[this.parent.taskFields.progress],i.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.progress,i[this.parent.taskFields.progress]>100?100:i[this.parent.taskFields.progress],e.data),i.ganttProperties.isAutoSchedule||this.parent.setRecordValue("autoWidth",this.parent.dataOperation.calculateWidth(i,!1),i.ganttProperties,!0),!t.isNullOrUndefined(e.data.ganttProperties.segments)&&e.data.ganttProperties.segments.length>0&&!t.isNullOrUndefined(this.parent.editModule.taskbarEditModule)&&this.parent.editModule.taskbarEditModule.updateSegmentProgress(e.data.ganttProperties),!e.data.hasChildRecords){var a=i.ganttProperties.isAutoSchedule?i.ganttProperties.width:i.ganttProperties.autoWidth;this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(a,i.ganttProperties.progress),i.ganttProperties,!0)}this.updateEditedRecord(e)},i.prototype.resourceEdited=function(e,i,a){var r=this.parent.resourceFields,n=i[this.parent.taskFields.resourceInfo];if(n){this.isResourceCellEdited=!0;for(var s=this.parent.dataOperation.setResourceInfo(i).length,o=a.ganttProperties.resourceInfo,l=void 0,d=[],h=this.parent.resources,p=void 0,u=0;u<s;u++)!function(e){if(o){var i=o.length;for(p=0;p<i;p++){if(o[p][r.id]===n[e]){l=p;break}l=-1}}if(t.isNullOrUndefined(l)||-1===l){var a=h.filter(function(t){return n[e]===t[r.id]}),s=t.extend({},a[0]);s[r.unit]=100,d.push(s)}else d.push(o[parseInt(l.toString(),10)])}(u);e.data.ganttProperties.resourceInfo=d,this.parent.dataOperation.updateMappingData(e.data,"resourceInfo"),this.parent.editModule.updateResourceRelatedFields(e.data,"resource"),"ResourceView"===this.parent.viewType&&(this.parent.editModule.dialogModule.isResourceUpdate=!0,this.parent.editModule.dialogModule.previousResource=o),this.updateDates(e),this.updateEditedRecord(e)}},i.prototype.dependencyEdited=function(e,i){if(/[!@#$%^&*()_=[\]{};:<>|./?-]/.test(e.data[this.parent.taskFields.dependency])){var a="The provided value for the "+this.parent.taskFields.dependency+" field is invalid. Please ensure that the "+this.parent.taskFields.dependency+" field does not contain any special characters.";this.parent.trigger("actionFailure",{error:a})}this.parent.predecessorModule.updateUnscheduledDependency(e.data);var r=this.parent.localeObj.getConstant("FF"),n=this.parent.localeObj.getConstant("FS"),s=this.parent.localeObj.getConstant("SS"),o=this.parent.localeObj.getConstant("SF"),l="";if(!t.isNullOrUndefined(e.data[this.parent.taskFields.dependency])){var d=e.data[this.parent.taskFields.dependency].split(",");d.map(function(e,t){e.includes(r)?(l+=e.replace(r,"FF"),l+=d.length!==t+1?",":""):e.includes(n)?(l+=e.replace(n,"FS"),l+=d.length!==t+1?",":""):e.includes(s)?(l+=e.replace(s,"SS"),l+=d.length!==t+1?",":""):e.includes(o)?(l+=e.replace(o,"SF"),l+=d.length!==t+1?",":""):(l+=e,l+=d.length!==t+1?",":"")})}this.parent.connectorLineEditModule.updatePredecessor(e.data,l,e)||this.parent.editModule.revertCellEdit(i)},i.prototype.workEdited=function(e){var i=e.data.ganttProperties;(e.data[this.parent.taskFields.work]<0||t.isNullOrUndefined(e.data[this.parent.taskFields.work]))&&(e.data[this.parent.taskFields.work]=0),this.parent.updateDuration=!0;var a=e.data[this.parent.taskFields.work];this.parent.setRecordValue("work",a,i,!0),this.parent.editModule.updateResourceRelatedFields(e.data,"work"),this.updateDates(e),this.updateEditedRecord(e),this.parent.updateDuration=!1},i.prototype.typeEdited=function(e,t){var i=this.parent.taskFields.type||"taskType",a=e.data.ganttProperties,r=t[""+i];this.parent.setRecordValue("taskType",r,a,!0),"FixedDuration"===a.taskType&&0===a.duration&&this.parent.editModule.updateResourceRelatedFields(e.data,"work"),this.updateEditedRecord(e)},i.prototype.compareDatesFromRecord=function(e,t){var i=this.parent.dateValidationModule.getValidStartDate(e,null,t),a=this.parent.dateValidationModule.getValidEndDate(e,null,t);return this.parent.dateValidationModule.compareDates(i,a)},i.prototype.updateEditedRecord=function(e){this.parent.editModule.initiateUpdateAction(e)},i.prototype.destroy=function(){this.parent.editModule.cellEditModule=void 0},i}(),ft=function(){function e(e,t){this.parent=e,this.taskbarEdit=t}return e.prototype.createTooltip=function(e,t,a){var r=this;this.toolTipObj=new i.Tooltip({opensOn:e,position:"TopRight",enableRtl:this.parent.enableRtl,mouseTrail:t,cssClass:"e-gantt-tooltip",windowCollision:!0,target:a||null,animation:{open:{effect:"None"},close:{effect:"None"}}}),this.toolTipObj.target=".e-connectorpoint-left, .e-connectorpoint-right",this.toolTipObj.beforeRender=function(e){var t={data:r.taskbarEdit.taskBarEditRecord,args:e,content:r.toolTipObj.content};r.parent.trigger("beforeTooltipRender",t)},this.toolTipObj.afterOpen=function(e){r.updateTooltipPosition(e)},this.toolTipObj.isStringTemplate=!0,this.toolTipObj.appendTo(this.parent.chartPane)},e.prototype.updateTooltipPosition=function(e){e.element.style.visibility="visible";var i=this.parent.element.closest('[style*="zoom"]');if(t.isNullOrUndefined(i)){var a=this.parent.getOffsetRect(this.parent.chartPane).left+this.parent.chartPane.offsetWidth,r=e.element.offsetLeft;if(a<r+e.element.offsetWidth&&(r+=a-(r+e.element.offsetWidth)),e.element.style.left=r+"px",e.element.style.visibility="visible",e.target&&this.parent.tooltipSettings.editing){var n=e.target.getBoundingClientRect().top+window.scrollY,s=void 0;s=e.target.classList.contains("e-connectorpoint-left")||e.target.classList.contains("e-connectorpoint-right")?n-e.element.offsetHeight-14:n-e.element.offsetHeight-8,this.toolTipHeight=e.element.style.top=s+"px"}}},e.prototype.showHideTaskbarEditTooltip=function(e,i){e&&this.parent.tooltipSettings.showTooltip?(this.createTooltip("Custom",!1),this.parent.tooltipModule.toolTipObj.close(),this.updateTooltip(i),this.parent.tooltipSettings.editing&&(this.toolTipObj.openDelay=500),"ConnectorPointLeftDrag"===this.taskbarEdit.connectorSecondAction?this.toolTipObj.open(this.taskbarEdit.connectorSecondElement.querySelector("."+_)):"ConnectorPointRightDrag"===this.taskbarEdit.connectorSecondAction?this.toolTipObj.open(this.taskbarEdit.connectorSecondElement.querySelector(".e-connectorpoint-right")):this.toolTipObj.open(this.taskbarEdit.taskBarEditElement)):t.isNullOrUndefined(this.toolTipObj)||(this.toolTipObj.destroy(),this.toolTipObj=null)},e.prototype.updateTooltip=function(e){var i=this.taskbarEdit.taskBarEditRecord.ganttProperties,a=t.isNullOrUndefined(e)||-1===e?i.width:i.segments[e].width,r=t.isNullOrUndefined(e)||-1===e?i.progressWidth:i.segments[e].progressWidth,n=t.isNullOrUndefined(e)||-1===e?i.left:i.left+i.segments[e].left;if(!t.isNullOrUndefined(this.toolTipObj))if("ConnectorPointLeftDrag"===this.taskbarEdit.taskBarEditAction||"ConnectorPointRightDrag"===this.taskbarEdit.taskBarEditAction)this.toolTipObj.content=this.getTooltipText(e),this.parent.tooltipSettings.editing&&(this.toolTipObj.openDelay=500),this.toolTipObj.offsetY=-3;else{if(this.parent.tooltipSettings.editing&&(this.toolTipObj.openDelay=500),this.toolTipObj.content=this.getTooltipText(e),i.segments&&i.segments.length>0&&this.taskbarEdit.mainElement&&"ProgressResizing"===this.taskbarEdit.taskBarEditAction){var s=this.taskbarEdit.mainElement.querySelectorAll(".e-segmented-taskbar");this.toolTipObj.refresh(s[e])}else this.toolTipObj.refresh(this.taskbarEdit.taskBarEditElement);"LeftResizing"===this.taskbarEdit.taskBarEditAction?this.parent.enableRtl?this.toolTipObj.offsetX=0:this.toolTipObj.offsetX=-a:"RightResizing"===this.taskbarEdit.taskBarEditAction||"ParentResizing"===this.taskbarEdit.taskBarEditAction?this.parent.enableRtl?this.toolTipObj.offsetX=-a:this.toolTipObj.offsetX=0:"ProgressResizing"===this.taskbarEdit.taskBarEditAction?this.parent.enableRtl?this.toolTipObj.offsetX=-r:this.toolTipObj.offsetX=-(a-r):"MilestoneDrag"===this.taskbarEdit.taskBarEditAction?this.toolTipObj.offsetX=-this.parent.chartRowsModule.milestoneHeight/2:a>5&&(this.toolTipObj.offsetX=-(a+n-this.taskbarEdit.tooltipPositionX)),this.parent.tooltipSettings.editing&&document.getElementsByClassName("e-gantt-tooltip")[0]&&this.toolTipHeight&&(document.getElementsByClassName("e-gantt-tooltip")[0].style.top=this.toolTipHeight)}},e.prototype.getTooltipText=function(e){var i="",a=this.parent.globalize,r=this.taskbarEdit.taskBarEditRecord.ganttProperties;if(!t.isNullOrUndefined(r.segments)&&r.segments.length>0&&-1!==e&&"ProgressResizing"!==this.taskbarEdit.taskBarEditAction&&(r=r.segments[e]),this.parent.tooltipSettings.editing){var n=this.parent.tooltipModule.templateCompiler(this.parent.tooltipSettings.editing,this.parent,this.taskbarEdit.taskBarEditRecord,"TooltipEditingTemplate");t.getValue("tooltipEle",this.toolTipObj)&&this.parent.renderTemplates(),i=n[0]}else{var s=void 0,o=void 0,l=void 0;switch(t.isNullOrUndefined(r)||t.isNullOrUndefined(r.startDate)||(s='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("startDate")+"</td><td class="+G+'>:</td><td class = "e-gantt-tooltip-value">'+a.formatDate(r.startDate,{format:this.parent.getDateFormat()})+"</td></tr>"),t.isNullOrUndefined(r)||t.isNullOrUndefined(r.endDate)||(o='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("endDate")+"</td><td class="+G+'>:</td><td class = "e-gantt-tooltip-value">'+a.formatDate(r.endDate,{format:this.parent.getDateFormat()})+"</td></tr>"),t.isNullOrUndefined(r)||t.isNullOrUndefined(r.duration)||(l='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("duration")+"</td><td class="+G+'>:</td><td class = "e-gantt-tooltip-value">'+this.parent.getDurationString(r.duration,r.durationUnit)+"</td></tr>"),this.taskbarEdit.taskBarEditAction){case"ProgressResizing":var d='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("progress")+"</td><td class="+G+'>:</td><td class = "e-gantt-tooltip-value">'+r.progress+"</td></tr>";i='<table class = "e-gantt-tooltiptable"><tbody>'+d+"</tbody></table>";break;case"LeftResizing":i='<table class = "e-gantt-tooltiptable"><tbody>'+s+l+"</tbody></table>";break;case"RightResizing":case"ParentResizing":i='<table class = "e-gantt-tooltiptable"><tbody>'+o+l+"</tbody></table>";break;case"ChildDrag":case"ParentDrag":case"MilestoneDrag":case"ManualParentDrag":var h="",p="";t.isNullOrUndefined(this.taskbarEdit.taskBarEditRecord.ganttProperties.startDate)||(h=s),t.isNullOrUndefined(this.taskbarEdit.taskBarEditRecord.ganttProperties.endDate)||(p=o),i='<table class = "e-gantt-tooltiptable"><tbody>'+h+p+"</tbody></table>";break;case"ConnectorPointLeftDrag":case"ConnectorPointRightDrag":i=this.parent.connectorLineModule.tooltipTable,t.isNullOrUndefined(this.toolTipObj)&&(this.parent.connectorLineModule.tooltipTable.innerHTML="",this.parent.connectorLineModule.tooltipTable.appendChild(this.parent.connectorLineModule.getConnectorLineTooltipInnerTd(this.parent.editModule.taskbarEditModule.taskBarEditRecord.ganttProperties.taskName,this.parent.editModule.taskbarEditModule.fromPredecessorText,"","")))}}if("string"==typeof i){var u=function(){return i};return t.initializeCSPTemplate(u)}return i},e}(),mt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),yt=function(){return(yt=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)},Dt=function(e){function i(t){var i=e.call(this,t)||this;return i.leftValue=0,i.previousLeftValue=0,i.isMouseDragged=!1,i.dependencyCancel=!1,i.isDragged=!1,i.editElement=null,i.elementOffsetLeft=0,i.elementOffsetTop=0,i.elementOffsetWidth=0,i.elementOffsetHeight=0,i.segmentIndex=-1,i.currentItemTop=0,i.currentItemPrevTop=0,i.topValue=0,i.draggedRecordMarginTop="0px",i.isClonedElement=!1,i.updatePosition=!1,i.tooltipValue=0,i.parent=t,i.initPublicProp(),i.wireEvents(),i.editTooltip=new ft(i.parent,i),i}return mt(i,e),i.prototype.wireEvents=function(){this.parent.on("chartMouseDown",this.mouseDownHandler,this),this.parent.on("chartMouseUp",this.mouseUpHandler,this),this.parent.on("chartMouseLeave",this.mouseLeaveHandler,this),this.parent.on("chartMouseMove",this.mouseMoveAction,this),this.parent.on("chartMouseClick",this.mouseClickHandler,this)},i.prototype.initPublicProp=function(){this.taskBarEditElement=null,this.taskBarEditRecord=null,this.taskBarEditAction=null,this.connectorSecondElement=null,this.connectorSecondRecord=null,this.connectorSecondAction=null,this.highlightedSecondElement=null,this.fromPredecessorText=null,this.toPredecessorText=null,this.finalPredecessor=null,this.drawPredecessor=!1,this.roundOffDuration=!0,this.dragMouseLeave=!1,this.isMouseDragged=!1,this.previousItemProperty=["left","progress","duration","isMilestone","startDate","endDate","width","progressWidth","autoLeft","autoDuration","autoStartDate","autoEndDate","autoWidth","segments"],this.tapPointOnFocus=!1,this.touchEdit=!1},i.prototype.mouseDownHandler=function(e){if(this.parent.editSettings.allowTaskbarEditing&&!this.parent.readOnly)if(this.canDrag=!1,this.taskBarEditElement){var t=f(this.getElementByPosition(e),N);(t&&t.innerHTML===this.taskBarEditElement.innerHTML||this.taskBarEditElement.classList.contains("e-segmented-taskbar")||this.taskBarEditElement.classList.contains("collpse-parent-border"))&&(this.updateTaskBarEditElement(e),this.canDrag=!0,e.preventDefault())}else this.parent.isAdaptive||this.updateTaskBarEditElement(e)},i.prototype.mouseClickHandler=function(e){if(this.parent.editSettings.allowTaskbarEditing){var i=this.getElementByPosition(e),a=f(i,N);if(this.parent.selectionModule&&this.parent.selectionModule.enableSelectMultiTouch)return void(this.tapPointOnFocus&&this.updateTaskBarEditElement(e));this.tapPointOnFocus&&!t.isNullOrUndefined(this.taskBarEditElement)&&a&&a.innerHTML!==this.taskBarEditElement.innerHTML?(this.connectorSecondRecord=this.parent.ganttChartModule.getRecordByTaskBar(a),this.connectorSecondAction="ConnectorPointLeftDrag",this.connectorSecondElement=a,this.fromPredecessorText="Finish",this.validateConnectorPoint()&&this.taskBarEditingAction(e,!0),this.showHideActivePredecessors(!1),this.initPublicProp()):i.classList.contains("e-connectorpoint-left-hover")?(this.canDrag=!1,this.multipleSelectionEnabled(),this.showHideTaskBarEditingElements(i,this.taskBarEditElement),this.tapPointOnFocus=!0,this.taskBarEditAction="ConnectorPointLeftDrag",this.connectorSecondRecord=this.taskBarEditRecord,this.taskBarEditingAction(e,!1)):i.classList.contains("e-connectorpoint-right-hover")?(this.canDrag=!1,this.multipleSelectionEnabled(),this.showHideTaskBarEditingElements(i,this.taskBarEditElement),this.tapPointOnFocus=!0,this.taskBarEditAction="ConnectorPointRightDrag",this.connectorSecondRecord=this.taskBarEditRecord,this.taskBarEditingAction(e,!1)):(this.tapPointOnFocus&&(this.showHideActivePredecessors(!1),this.showHideTaskBarEditingElements(a,this.taskBarEditElement)),this.updateTaskBarEditElement(e))}},i.prototype.showHideActivePredecessors=function(e){var i=this.taskBarEditRecord.ganttProperties,a=i.predecessor,r="ResourceView"===this.parent.viewType?i.taskId:i.rowUniqueID;if(a)for(var n=0;n<a.length;n++){var s=a[n];r.toString()!==s.from&&r.toString()!==s.to||this.applyActiveColor(s.from,s.to,e)}var o=this.parent.ganttChartModule.chartBodyContainer;e?(t.addClass([this.taskBarEditElement],["e-active-child-task"]),t.addClass([o],["e-predecessor-touch-mode"])):(t.removeClass([this.taskBarEditElement],["e-active-child-task"]),t.removeClass([o],["e-predecessor-touch-mode"])),this.touchEdit=e,t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},i.prototype.applyActiveColor=function(e,i,a){var r=("ProjectView"===this.parent.viewType?this.taskBarEditRecord.ganttProperties.taskId.toString():this.taskBarEditRecord.ganttProperties.rowUniqueID.toString())===e?this.parent.connectorLineModule.getRecordByID(i):this.parent.connectorLineModule.getRecordByID(e),n=this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(r)];if(!t.isNullOrUndefined(n)){var s=n.querySelector("."+N),o=this.parent.element.querySelector("#ConnectorLineparent"+e+"child"+i);a?(t.addClass([s],["e-active-connected-task"]),o&&t.addClass([o],["e-active-connected-task"])):(t.removeClass([s],["e-active-connected-task"]),o&&t.removeClass([o],["e-active-connected-task"]))}},i.prototype.validateConnectorPoint=function(){var e=this.taskBarEditRecord.ganttProperties,t=this.connectorSecondRecord.ganttProperties,i=!0,a="ResourceView"===this.parent.viewType?e.taskId:e.rowUniqueID,r="ResourceView"===this.parent.viewType?t.taskId:t.rowUniqueID;if(this.connectorSecondRecord.hasChildRecords)i=!1;else if(t.predecessor)for(var n=0;n<t.predecessor.length;n++){var s=t.predecessor[n];if(s.from===a.toString()&&s.to===r.toString()){this.parent.connectorLineEditModule.childRecord=this.connectorSecondRecord,this.parent.connectorLineEditModule.predecessorIndex=n,this.parent.connectorLineEditModule.renderPredecessorDeleteConfirmDialog(),i=!1;break}if(s.from===r.toString()&&s.to===a.toString()){this.parent.connectorLineEditModule.childRecord=this.taskBarEditRecord,this.parent.connectorLineEditModule.predecessorIndex=n,this.parent.connectorLineEditModule.renderPredecessorDeleteConfirmDialog(),i=!1;break}}return i},i.prototype.mouseLeaveHandler=function(e){"ChildDrag"===this.taskBarEditAction||"ParentDrag"===this.taskBarEditAction||"ProgressResizing"===this.taskBarEditAction||"LeftResizing"===this.taskBarEditAction||"RightResizing"===this.taskBarEditAction?this.dragMouseLeave=!1:this.dragMouseLeave=!0},i.prototype.updateTaskBarEditElement=function(e){var i,a,r=this.getElementByPosition(e);if(r.classList.contains("e-gantt-manualparenttaskbar-right")||r.classList.contains("e-manualparent-main-container")||r.classList.contains(j))a=f(r,"e-manualparent-main-container");else if(r.classList.contains("e-gantt-manualparent-milestone"))a=f(r,"e-gantt-manualparent-milestone");else if(a=f(r,N),!t.isNullOrUndefined(a)&&!r.classList.contains("e-connectorpoint-left")&&!r.classList.contains("e-connectorpoint-right")&&(l=this.parent.ganttChartModule.getRecordByTaskBar(a))&&l.ganttProperties&&!t.isNullOrUndefined(l.ganttProperties.segments)&&l.ganttProperties.segments.length>0)if(r.classList.contains("e-progressbar-handler-after")){for(var n=0;n<l.ganttProperties.segments.length;n++)if(l.ganttProperties.segments[n].showProgress){a=a.querySelectorAll(".e-segmented-taskbar")[n];break}}else a=f(r,"e-gantt-child-taskbar-inner-div");if(this.parent.editSettings.allowTaskbarEditing&&a){this.showHideTaskBarEditingElements(a,this.editElement),this.editElement=a,this.realTaskbarElement=this.editElement;var s=this.editElement.getAttribute("data-segment-index");if(t.isNullOrUndefined(s)?this.segmentIndex=-1:this.segmentIndex=Number(s),this.taskBarEditRecord=this.parent.ganttChartModule.getRecordByTaskBar(this.editElement),"mousedown"===e.type||"touchstart"===e.type||"click"===e.type){this.taskBarEditAction=this.getTaskBarAction(e);var o=this.editElement.getAttribute("data-segment-index"),l=this.parent.ganttChartModule.getRecordByTaskBar(a),d=l.ganttProperties,h=this.editElement.parentElement.offsetLeft;this.currentData=l;var p=t.createElement("div",{styles:"height:100%;border-style:dashed;border-bottom:none;border-top:none;border-width:1px;position:absolute;z-index:10000"});t.addClass([p],"e-taskbar-resize-div"),p.style.setProperty("width",d.width+"px");var u=this.editElement.getAttribute("data-segment-index");!t.isNullOrUndefined(d.segments)&&this.parent.allowTaskbarDragAndDrop&&"LeftResizing"!==this.taskBarEditAction&&"RightResizing"!==this.taskBarEditAction&&"ProgressResizing"!==this.taskBarEditAction?p.style.setProperty("left",t.isNullOrUndefined(d.segments)?d.left+"px":h+"px"):p.style.setProperty("left",!t.isNullOrUndefined(d.segments)&&d.segments.length>1?h+d.segments[Number(u)].left+"px":d.left+"px");var c=this.parent.createElement("table"),g=this.parent.createElement("tbody");g.appendChild(p),c.appendChild(g);var m=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-clone-taskbar"),y=null;if(i="ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||t.isNullOrUndefined(o)||t.isNullOrUndefined(o)||0!==Number(o)?-1!==this.segmentIndex&&this.parent.allowTaskbarDragAndDrop&&"LeftResizing"!==this.taskBarEditAction&&"RightResizing"!==this.taskBarEditAction&&"ProgressResizing"!==this.taskBarEditAction?this.editElement.parentElement.cloneNode(!0):this.editElement.cloneNode(!0):this.editElement.parentElement.cloneNode(!0),!m){if(t.addClass([i],"e-clone-taskbar"),i.style.setProperty("position","absolute"),l.hasChildRecords&&!l.ganttProperties.isAutoSchedule){var D=this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer),v=this.parent.getOffsetRect(this.editElement);this.editElement.classList.contains("e-manualparent-main-container")?i.style.setProperty("left",l.ganttProperties.left-l.ganttProperties.autoLeft+"px"):i.style.setProperty(this.parent.enableRtl?"right":"left",Math.abs(v.left-D.left+Math.abs(this.parent.ganttChartModule.scrollElement.scrollLeft))+"px")}i.style.setProperty("top","0px"),y=this.parent.createElement("table");var k=this.parent.createElement("tbody");k.appendChild(i),y.appendChild(k)}if("ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||t.isNullOrUndefined(o)||t.isNullOrUndefined(o)||0!==Number(o))this.cloneTaskbarElement=i;else{var b=i.getElementsByClassName("e-segmented-taskbar");this.cloneTaskbarElement=b[Number(o)]}if(this.taskBarEditElement=this.cloneTaskbarElement,this.taskbarElement=y,this.taskbarResizer=c,this.currentIndex=o,this.roundOffDuration=!0,"ConnectorPointLeftDrag"!==this.taskBarEditAction&&"ConnectorPointRightDrag"!==this.taskBarEditAction||!t.isNullOrUndefined(this.parent.taskFields.dependency)||(this.taskBarEditAction=null),this.updateMouseDownProperties(e),"ResourceView"===this.parent.viewType||"ProjectView"===this.parent.viewType){if(0===this.taskBarEditRecord.level)return;if(this.parent.enableMultiTaskbar){var w=this.parent.getTaskByUniqueID(this.taskBarEditRecord.parentItem.uniqueID);t.isNullOrUndefined(w)||w.expanded||(this.prevZIndex=this.taskBarEditElement.style.zIndex,this.taskBarEditElement.style.zIndex="1000",this.taskBarEditElement.querySelector(".e-gantt-child-taskbar")&&t.addClass([this.taskBarEditElement.querySelector(".e-gantt-child-taskbar")],"e-collapsed-taskbar-drag"))}}}}else this.parent.isAdaptive?(this.taskBarEditElement&&this.showHideTaskBarEditingElements(a,this.editElement),this.initPublicProp()):this.showHideTaskBarEditingElements(a,this.editElement)},i.prototype.showHideTaskBarEditingElements=function(e,i,a){i=i||this.editElement;var r=!!this.parent.taskFields.progress,n=!0;if(!this.parent.readOnly){var s=e?this.parent.ganttChartModule.getRecordByTaskBar(e):i?this.parent.ganttChartModule.getRecordByTaskBar(i):null;if(this.parent.enableMultiTaskbar&&e){var o=this.parent.getParentTask(s.parentItem);t.isNullOrUndefined(o)||o.expanded||(n=!1,s&&s.ganttProperties.segments&&s.ganttProperties.segments.length>0?t.addClass([e.parentElement],["e-gantt-multi-taskbar"]):t.addClass([e],["e-gantt-multi-taskbar"]))}if(e){if(e.querySelector(".e-taskbar-left-resizer")){if(t.addClass([e.querySelector(".e-taskbar-left-resizer")],["e-left-resize-gripper"]),t.addClass([e.querySelector(".e-taskbar-right-resizer")],["e-right-resize-gripper"]),r){var l=s&&s.ganttProperties.segments&&s.ganttProperties.segments.length>0?e.parentElement.querySelector("."+W):e.querySelector("."+W);t.isNullOrUndefined(l)||(t.addClass([l],["e-progress-resize-gripper"]),l.style.top="3px")}}else this.parent.isAdaptive&&r&&this.parent.ganttChartModule.getRecordByTaskBar(e).hasChildRecords&&t.addClass([e],["e-active-parent-task"]);if(t.addClass(this.parent.ganttChartModule.scrollElement.querySelectorAll(".e-connector-line-container"),["e-connector-line-z-index"]),!t.isNullOrUndefined(this.parent.taskFields.dependency)&&(e.querySelector("."+_)||e.parentElement.querySelector("."+_))&&n){var d=t.isNullOrUndefined(e.querySelector("."+_))?e.parentElement:e;t.isNullOrUndefined(d.querySelector("."+_))||t.addClass([d.querySelector("."+_)],["e-connectorpoint-left-hover"]),t.isNullOrUndefined(d.querySelector(".e-connectorpoint-right"))||t.addClass([d.querySelector(".e-connectorpoint-right")],["e-connectorpoint-right-hover"])}}else a||t.removeClass(this.parent.ganttChartModule.scrollElement.querySelectorAll(".e-connector-line-container"),["e-connector-line-z-index"]);if(i&&e!==i){if(i.querySelector(".e-taskbar-left-resizer")&&(t.removeClass([i.querySelector(".e-taskbar-left-resizer")],["e-left-resize-gripper"]),t.removeClass([i.querySelector(".e-taskbar-right-resizer")],["e-right-resize-gripper"]),(l=s&&s.ganttProperties.segments&&s.ganttProperties.segments.length>0?i.parentElement:i)&&l.querySelector("."+W)&&t.removeClass([l.querySelector("."+W)],["e-progress-resize-gripper"])),t.isNullOrUndefined(this.parent.taskFields.dependency)||!i.querySelector("."+_)&&!i.parentElement.querySelector("."+_)){if(this.parent.isAdaptive){var h=this.parent.ganttChartModule.getRecordByTaskBar(i);h&&h.hasChildRecords&&t.removeClass([i],["e-active-parent-task"])}}else{var p=(d=t.isNullOrUndefined(i.querySelector("."+_))?i.parentElement:i).querySelector("."+_),u=d.querySelector(".e-connectorpoint-right");p&&t.removeClass([p],["e-connectorpoint-left-hover"]),u&&t.removeClass([u],["e-connectorpoint-right-hover"])}this.editElement=null}}},i.prototype.getTaskBarAction=function(e){var i=this.getElementByPosition(e),a=this.taskBarEditRecord,r="";return i.classList.contains("e-taskbar-left-resizer")?r="LeftResizing":i.classList.contains("e-taskbar-right-resizer")?r="RightResizing":(i.classList.contains(W)||t.closest(i,"."+W))&&this.parent.taskFields.progress?r="ProgressResizing":i.classList.contains(_)?r="ConnectorPointLeftDrag":i.classList.contains("e-connectorpoint-right")?r="ConnectorPointRightDrag":i.classList.contains("e-gantt-manualparenttaskbar-right")?r="ParentResizing":i.classList.contains(j)||i.classList.contains("e-manualparent-main-container")||i.classList.contains("e-gantt-manualparent-milestone")?r="ManualParentDrag":a&&(r=a.hasChildRecords?a[this.parent.taskFields.manual]?"":"ParentDrag":a.ganttProperties.isMilestone?"MilestoneDrag":"ChildDrag"),r},i.prototype.updateMouseDownProperties=function(e){var t=this.getCoordinate(e),i=this.parent.element.closest('[style*="zoom"]');if(i){var a=parseFloat(getComputedStyle(i).zoom);t.pageX=t.pageX/a,t.pageY=t.pageY/a}if(t.pageX||t.pageY){var r=this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer);this.parent.enableRtl?this.mouseDownX=Math.abs(t.pageX-(r.left+Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left))):this.mouseDownX=t.pageX-r.left+this.parent.ganttChartModule.scrollObject.previousScroll.left,this.tooltipPositionX=this.mouseDownX,this.mouseDownY=this.dragMoveY=t.pageY-r.top+this.parent.ganttChartModule.scrollObject.previousScroll.top}"ConnectorPointLeftDrag"!==this.taskBarEditAction&&"ConnectorPointRightDrag"!==this.taskBarEditAction||(this.fromPredecessorText="ConnectorPointLeftDrag"===this.taskBarEditAction?"start":"finish",this.parent.connectorLineModule.tooltipTable.innerHTML="",this.parent.connectorLineModule.tooltipTable.appendChild(this.parent.connectorLineModule.getConnectorLineTooltipInnerTd(this.taskBarEditRecord.ganttProperties.taskName,this.fromPredecessorText,"","")))},i.prototype.isMouseDragCheck=function(){if(!this.isMouseDragged&&this.taskBarEditAction&&(this.mouseDownX!==this.mouseMoveX&&(this.mouseDownX+3<this.mouseMoveX||this.mouseDownX-3>this.mouseMoveX)||this.mouseDownY!==this.mouseMoveY&&(this.mouseDownY+3<this.mouseMoveY||this.mouseDownY-3>this.mouseMoveY))){this.isMouseDragged=!0,this.parent.initiateEditAction(!0);var e=this.taskBarEditRecord.ganttProperties;this.previousItem=this.parent.timelineModule.extendFunction(e,this.previousItemProperty),"ConnectorPointLeftDrag"===this.taskBarEditAction||"ConnectorPointRightDrag"===this.taskBarEditAction||"ResourceView"===this.parent.viewType&&"ParentDrag"===this.taskBarEditAction||this.editTooltip.showHideTaskbarEditTooltip(!0,this.segmentIndex),this.taskBarEditElement.setAttribute("aria-grabbed","true")}},i.prototype.removeFirstBorder=function(e){var t="bottomSegment"===this.parent.rowDragAndDropModule.dropPosition;this.parent.element.getElementsByClassName("e-firstrow-border").length>0&&e&&(e.getAttribute("aria-rowindex")-1!=0||t)&&this.parent.element.getElementsByClassName("e-firstrow-border")[0].remove()},i.prototype.removeLastBorder=function(e){var t,i=e&&(e.classList.contains("e-emptyrow")||e.classList.contains("e-columnheader")||e.classList.contains("e-detailrow")),a=(t=this.parent.enableVirtualization?e&&!i&&this.parent.treeGrid.getRows()[this.parent.treeGrid.getCurrentViewRecords().length-1].getAttribute("data-uid")!==e.getAttribute("data-uid"):e&&!i&&this.parent.treeGrid.getRowByIndex(this.parent.treeGrid.getCurrentViewRecords().length-1).getAttribute("data-uid")!==e.getAttribute("data-uid"))||"topSegment"===this.parent.rowDragAndDropModule.dropPosition;this.parent.element.getElementsByClassName("e-lastrow-border").length>0&&e&&(t||a)&&this.parent.element.getElementsByClassName("e-lastrow-border")[0].remove()},i.prototype.removetopOrBottomBorder=function(){var e=[].slice.call(this.parent.element.querySelectorAll(".e-dropbottom, .e-droptop"));e.length&&(this.addRemoveClasses(e,!1,"e-dropbottom"),this.addRemoveClasses(e,!1,"e-droptop"))},i.prototype.topOrBottomBorder=function(e){var t;if(this.parent.enableVirtualization){var i=this.parent.treeGrid.getRows().filter(function(t){return parseInt(t.getAttribute("aria-rowindex"),10)-1==parseInt(e.getAttribute("aria-rowindex"),10)-1})[0],a=this.parent.treeGrid.getRows().indexOf(i);t=this.parent.getRowByIndex(a).children}else t=this.parent.getRowByIndex(parseInt(e.getAttribute("aria-rowindex"),10)-1).children;t&&("above"===this.parent.rowDragAndDropModule.dropPosition&&(this.addRemoveClasses(t,!0,"e-droptop"),this.parent.element.getElementsByClassName("e-lastrow-dragborder").length>0&&this.parent.element.getElementsByClassName("e-lastrow-dragborder")[0].remove()),"below"===this.parent.rowDragAndDropModule.dropPosition&&this.addRemoveClasses(t,!0,"e-dropbottom"))},i.prototype.removeChildBorder=function(){var e=[].slice.call(this.parent.element.querySelectorAll(".e-childborder"));e.length>0&&this.addRemoveClasses(e,!1,"e-childborder")},i.prototype.addRemoveClasses=function(e,t,i){for(var a=0,r=e.length;a<r;a++)t?e[parseInt(a.toString(),10)].classList.add(i):e[parseInt(a.toString(),10)].classList.remove(i)},i.prototype.addErrorElem=function(){var e=document.getElementsByClassName("e-clone-taskbar")[0];if(!document.querySelectorAll(".e-errorelem").length){var i=document.createElement("div");t.classList(i,["e-errorcontainer"],[]),t.classList(i,["e-icons","e-errorelem"],[]),this.taskBarEditRecord.ganttProperties.segments&&this.taskBarEditRecord.ganttProperties.segments.length>0&&(i.style.paddingTop=this.parent.taskbarHeight+"px"),e.appendChild(i)}},i.prototype.removeErrorElem=function(){var e=document.querySelector(".e-errorelem");e&&e.remove()},i.prototype.ensurePosition=function(e,i){var a=this;e.filter(function(e){if(e.hasChildRecords&&!t.isNullOrUndefined(e.childRecords)){if(-1!==e.childRecords.indexOf(i))return a.parent.rowDragAndDropModule.dropPosition="Invalid",void a.addErrorElem();a.ensurePosition(e.childRecords,i)}})},i.prototype.mouseMoveAction=function(e){var i=this;if(this.parent.isAdaptive){if(!this.canDrag)return;this.multipleSelectionEnabled()}var a=this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer),r=this.getCoordinate(e);this.parent.enableRtl?this.mouseMoveX=Math.abs(r.pageX-(a.left+Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left))):this.mouseMoveX=r.pageX-a.left+this.parent.ganttChartModule.scrollObject.previousScroll.left,this.mouseMoveY=r.pageY-a.top+this.parent.ganttChartModule.scrollObject.previousScroll.top,this.dragMouseLeave=!1;var n=!1;if("ChildDrag"===this.taskBarEditAction||"ParentDrag"===this.taskBarEditAction||"ManualParentDrag"===this.taskBarEditAction||"MilestoneDrag"===this.taskBarEditAction){var s=void 0;if(this.parent.enableVirtualization){V=this.parent.currentViewData.indexOf(this.taskBarEditRecord);s=this.parent.getRowByIndex(V)}else s=this.parent.getRowByIndex(this.taskBarEditRecord.index);var o={cancel:n,cloneElement:this.taskbarElement,data:this.taskBarEditRecord,target:e.target,rows:s};this.parent.trigger("rowDrag",o),n=o.cancel}if(n||this.isMouseDragCheck(),this.isMouseDragged&&this.taskBarEditAction){if(e.preventDefault(),!(t.isNullOrUndefined(this.taskbarElement)||t.isNullOrUndefined(this.editElement)||"ConnectorPointRightDrag"===this.taskBarEditAction||"ConnectorPointLeftDrag"===this.taskBarEditAction||"ResourceView"===this.parent.viewType&&this.currentData.hasChildRecords)){v=this.editElement.parentElement;if(this.parent.enableTimelineVirtualization&&this.parent.timelineModule.wholeTimelineWidth>3*this.parent.element.offsetWidth?v.style.setProperty("position","relative"):v.style.setProperty("position","absolute"),"ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||t.isNullOrUndefined(this.currentIndex)||t.isNullOrUndefined(this.currentIndex)||0!==Number(this.currentIndex)?this.parent.allowTaskbarDragAndDrop&&"LeftResizing"!==this.taskBarEditAction&&"RightResizing"!==this.taskBarEditAction&&"ProgressResizing"!==this.taskBarEditAction?this.parent.chartPane.getElementsByClassName("e-gantt-chart")[0].appendChild(this.taskbarElement):v.appendChild(this.taskbarElement):(this.taskbarElement.childNodes[0].childNodes[0].style.setProperty("top",v.parentElement.offsetTop+"px"),this.parent.allowTaskbarDragAndDrop&&"LeftResizing"!==this.taskBarEditAction&&"RightResizing"!==this.taskBarEditAction&&"ProgressResizing"!==this.taskBarEditAction?this.parent.chartPane.getElementsByClassName("e-gantt-chart")[0].appendChild(this.taskbarElement):v.parentElement.appendChild(this.taskbarElement)),"ProgressResizing"!==this.taskBarEditAction)if(this.parent.enableTimelineVirtualization&&this.parent.timelineModule.wholeTimelineWidth>3*this.parent.element.offsetWidth)(l=this.parent.ganttChartModule.chartBodyContainer.querySelectorAll(".e-chart-scroll-container"))[0].appendChild(this.taskbarResizer);else{var l=this.parent.ganttChartModule.chartBodyContainer.querySelectorAll(".e-chart-rows-container");l[0].appendChild(this.taskbarResizer)}}if(this.parent.allowTaskbarDragAndDrop&&("ChildDrag"===this.taskBarEditAction||"ParentDrag"===this.taskBarEditAction||"MilestoneDrag"===this.taskBarEditAction||"ManualParentDrag"===this.taskBarEditAction)){var d=this.parent.getOffsetRect(this.taskBarEditElement),h=!t.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?12:0,p=3+this.parent.chartRowsModule.connectorPointWidth+h,u=void 0;u=this.parent.enableRtl?Math.abs(d.left+p+1):Math.abs(d.left-p-1),this.isClonedElement||this.parent.enableRtl||(u-=this.parent.ganttChartModule.scrollElement.scrollLeft,this.isClonedElement=!0);var c=0;this.parent.rowDragAndDropModule.dropPosition=void 0;var g=void 0,m=void 0;m="touchmove"===e.type||"touchstart"===e.type||"touchend"===e.type?e.changedTouches[0].pageY:e.y,this.parent.enableRtl?(g=document.elementFromPoint(this.parent.ganttChartModule.chartBodyContainer.offsetWidth,m)).classList.contains("e-taskbar-resize-div")&&(g=document.elementFromPoint(this.parent.ganttChartModule.chartBodyContainer.offsetWidth-g.offsetWidth,m)):g=document.elementFromPoint(u,m);var y=void 0;if(this.parent.enableVirtualization)this.draggedTreeGridRowElement||(y=(v=this.editElement.parentElement).parentElement,this.draggedTreeGridRowElement=y,this.draggedTreeGridRowHeight=this.draggedTreeGridRowElement.offsetHeight);else if(y=this.parent.treeGrid.getRows()[this.parent.flatData.indexOf(this.taskBarEditRecord)],this.draggedTreeGridRowElement=y,this.parent.enableMultiTaskbar)if(this.taskBarEditRecord.parentItem&&!t.isNullOrUndefined(this.parent.getRowByID(this.taskBarEditRecord.parentItem.taskId))){if(this.draggedTreeGridRowHeight=this.parent.getRowByID(this.taskBarEditRecord.parentItem.taskId).offsetHeight,"ProjectView"===this.parent.viewType&&0===this.draggedTreeGridRowHeight)for(var D=this.parent.getRecordByID(this.taskBarEditRecord.parentItem.taskId);D.parentItem;)D=this.parent.getRecordByID(D.parentItem.taskId),this.draggedTreeGridRowHeight=this.parent.getRowByID(D.TaskID).offsetHeight}else{var v=this.editElement.parentElement;this.draggedTreeGridRowElement=v.parentElement,this.draggedTreeGridRowHeight=this.draggedTreeGridRowElement.offsetHeight}else this.draggedTreeGridRowHeight=this.draggedTreeGridRowElement.offsetHeight;var k;if(g&&(k=t.closest(g,"tr."+A)),k){var b=void 0;b=this.parent.enableVirtualization?this.parent.treeGrid.getRows().filter(function(e){return parseInt(e.getAttribute("aria-rowindex"),10)-1==parseInt(k.getAttribute("aria-rowindex"),10)-1})[0]:this.parent.treeGrid.getRows()[parseInt(k.getAttribute("aria-rowindex"),10)-1],this.removeFirstBorder(b),this.removeLastBorder(b),(t.isNullOrUndefined(b)||b.getAttribute("data-uid")!==this.draggedTreeGridRowElement.getAttribute("data-uid"))&&f(g,"e-chart-rows-container")||(this.parent.rowDragAndDropModule.dropPosition="Invalid",this.addErrorElem());var w=this.parent,T=0,S=w.toolbarModule?this.parent.toolbarModule.element.offsetHeight:0,P=this.parent.getOffsetRect(w.element),C=w.treeGrid.getHeaderContent().offsetHeight+P.top+S,R=w.treeGrid.getContent().firstElementChild.scrollTop;t.isNullOrUndefined(b)||(c=b.offsetTop-R);var M=((T=this.parent.enableVirtualization?this.parent.getOffsetRect(b).top:c+C)+this.draggedTreeGridRowHeight-T)/3,x=T+M,O=x+M,I=O+M,E="mousemove"===e.type?e.pageY:t.isNullOrUndefined(e.changedTouches)?null:e.changedTouches[0].pageY,F=E<=x,U=E>x&&E<=O,N=E>O&&E<=I;if(F||U||N){var L=void 0;if(this.parent.enableVirtualization){var V=this.parent.treeGrid.getRows().indexOf(b);L=this.parent.getRowByIndex(V)}else L=this.parent.getRowByIndex(parseInt(b.getAttribute("aria-rowindex"),10)-1);var B=t.getValue("rowIndex",L),W=this.parent.currentViewData[B],H=!0;"ResourceView"!==this.parent.viewType||this.taskBarEditRecord.hasChildRecords||W.hasChildRecords||t.isNullOrUndefined(W.parentItem)||this.taskBarEditRecord.parentItem.taskId!==W.parentItem.taskId||(H=!1),W&&this.ensurePosition([this.taskBarEditRecord],W),H&&(F&&"Invalid"!==this.parent.rowDragAndDropModule.dropPosition&&(this.parent.rowDragAndDropModule.dropPosition="above",this.removeChildBorder(),this.removeErrorElem(),this.removetopOrBottomBorder(),this.topOrBottomBorder(L)),U&&"Invalid"!==this.parent.rowDragAndDropModule.dropPosition&&(this.parent.rowDragAndDropModule.dropPosition="child",this.removetopOrBottomBorder(),this.addRemoveClasses(L.children,!0,"e-childborder")),N&&"Invalid"!==this.parent.rowDragAndDropModule.dropPosition&&(this.parent.rowDragAndDropModule.dropPosition="below",this.removetopOrBottomBorder(),this.removeErrorElem(),this.removeChildBorder(),this.removeFirstBorder(b),this.topOrBottomBorder(b)))}}}var j={cancel:!1,requestType:"taskbarediting",taskBarEditAction:this.taskBarEditAction,data:this.taskBarEditRecord};-1!==this.segmentIndex&&(j.requestType="mergeSegment"),this.parent.trigger("actionBegin",j,function(t){if(("ConnectorPointRightDrag"===j.taskBarEditAction||"ConnectorPointLeftDrag"===j.taskBarEditAction||"LeftResizing"===j.taskBarEditAction||"RightResizing"===j.taskBarEditAction||"ProgressResizing"===j.taskBarEditAction||"ChildDrag"===j.taskBarEditAction||"ParentDrag"===j.taskBarEditAction||"MilestoneDrag"===j.taskBarEditAction||"ManualParentDrag"===j.taskBarEditAction||"ParentResizing"===j.taskBarEditAction)&&(i.parent.showIndicator=!1,i.parent.undoRedoModule&&i.parent.isUndoRedoItemPresent("Edit"))){i.parent.undoRedoModule.redoEnabled&&i.parent.undoRedoModule.disableRedo();var a={};0===i.parent.undoRedoModule.getUndoCollection.length?(i.isDragged=!0,a.modifiedRecords=[],a.action=j.taskBarEditAction,i.parent.undoRedoModule.createUndoCollection(),i.parent.undoRedoModule.getUndoCollection[i.parent.undoRedoModule.getUndoCollection.length-1]=a,i.parent.editModule.createArray=!1,i.parent.undoRedoModule.changedRecords=[]):i.parent.editModule.createArray&&(i.isDragged=!0,a.modifiedRecords=[],a.action=j.taskBarEditAction,i.parent.undoRedoModule.createUndoCollection(),i.parent.undoRedoModule.getUndoCollection[i.parent.undoRedoModule.getUndoCollection.length-1]=a,i.parent.editModule.createArray=!1,i.parent.undoRedoModule.changedRecords=[])}!1===t.cancel?(i.parent.showIndicator&&i.parent.showLoadingIndicator(),i.taskBarEditingAction(e,!1)):i.editTooltip.updateTooltip(i.segmentIndex)})}else this.parent.isAdaptive||this.taskBarEditAction||this.updateTaskBarEditElement(e)},i.prototype.taskBarEditingAction=function(e,i){var a=this,r={},n=this.parent.ganttChartModule.getIndexByTaskBar(this.taskBarEditElement);if(null!==this.taskBarEditRecord){if(r.editingFields=this.taskBarEditRecord.ganttProperties,r.data=this.taskBarEditRecord,"ResourceView"===this.parent.viewType&&0===r.data.level)return;r.recordIndex=n,r.taskBarEditAction=this.taskBarEditAction,r.roundOffDuration=this.roundOffDuration,r.cancel=!1,r.previousData=this.previousItem,r.segmentIndex=this.segmentIndex,this.roundOffDuration=r.roundOffDuration,this.targetElement=r.target=this.cloneTaskbarElement,this.updateMouseMoveProperties(e),this.oldData||(this.oldData=t.extend([],[],[this.taskBarEditRecord],!0)[0]);var s=-1!==this.segmentIndex?this.segmentIndex:null;if("ProgressResizing"===this.taskBarEditAction){if(this.mainElement=f(this.taskBarEditElement,N),this.taskBarEditRecord.ganttProperties.segments&&this.taskBarEditRecord.ganttProperties.segments.length>0){s=-1;for(m=0;m<this.taskBarEditRecord.ganttProperties.segments.length;m++){var o=document.getElementsByClassName("e-child-progress-resizer e-progress-resize-gripper")[0].style,l=this.parent.enableRtl?parseInt(o.right,10)-8:parseInt(o.left,10)+8;l<this.taskBarEditRecord.ganttProperties.segments[m].width&&0===m&&(s=m),this.taskBarEditRecord.ganttProperties.segments[m+1]&&l<this.taskBarEditRecord.ganttProperties.segments[m+1].width+this.taskBarEditRecord.ganttProperties.segments[m+1].left&&l>this.taskBarEditRecord.ganttProperties.segments[m+1].left&&(s=m+1)}}this.performProgressResize(e,s)}else"LeftResizing"===this.taskBarEditAction?this.enableLeftResizing(e):"RightResizing"===this.taskBarEditAction||"ParentResizing"===this.taskBarEditAction?this.enableRightResizing(e):"ParentDrag"===this.taskBarEditAction||"ChildDrag"===this.taskBarEditAction||"MilestoneDrag"===this.taskBarEditAction||"ManualParentDrag"===this.taskBarEditAction?this.enableDragging(e):"ConnectorPointLeftDrag"!==this.taskBarEditAction&&"ConnectorPointRightDrag"!==this.taskBarEditAction||(this.updateConnectorLineSecondProperties(e),this.triggerDependencyEvent(e),this.drawFalseLine());if(this.parent.allowTaskbarDragAndDrop&&"LeftResizing"!==this.taskBarEditAction&&"RightResizing"!==this.taskBarEditAction&&"ProgressResizing"!==this.taskBarEditAction){var d=this.parent.getOffsetRect(this.parent.chartPane),h=this.getCoordinate(e),p={top:h.pageY,left:h.pageX},u={left:Math.abs(p.left-d.left),top:p.top-d.top};if("ResourceView"===this.parent.viewType&&this.parent.enableMultiTaskbar){var c=this.parent.getRecordByID(this.taskBarEditRecord.parentItem.taskId);if(!this.parent.allowTaskbarOverlap&&this.taskBarEditRecord.parentItem&&!c.expanded){var g=0;if(parseInt(this.editElement.style.marginTop,10)>this.parent.rowHeight){for(var m=0;m<c.childRecords.length&&c.childRecords[m].ganttProperties.taskId!==this.taskBarEditRecord.ganttProperties.taskId;m++)g+=this.parent.rowHeight;u.top=u.top-g}}}this.topValue=u.top;var y=void 0;y="touchmove"===e.type||"touchstart"===e.type||"touchend"===e.type?e.changedTouches[0].pageX:e.pageX,this.parent.enableRtl?this.leftValue=u.left-Math.abs(y-this.parent.getOffsetRect(this.taskBarEditElement).left)-(0!==this.previousLeftValue?y-this.previousLeftValue:0):this.leftValue=u.left-(y-this.parent.getOffsetRect(this.taskBarEditElement).left)+(0!==this.previousLeftValue?y-this.previousLeftValue:0),0===this.previousLeftValue&&(this.parent.enableRtl?(this.leftValue=this.leftValue-this.parent.ganttChartModule.scrollObject.previousScroll.left,0===this.parent.ganttChartModule.scrollObject.previousScroll.left&&(this.leftValue=this.leftValue-60)):this.leftValue=this.leftValue-this.parent.ganttChartModule.scrollObject.previousScroll.left),this.previousLeftValue=y}else this.leftValue=this.taskBarEditRecord.ganttProperties.left;this.currentSegmentIndex=s,this.setItemPosition(),this.updateEditedItem(),this.tooltipValue="touchmove"===e.type||"touchstart"===e.type||"touchend"===e.type?e.changedTouches[0].pageX:e.pageX,this.taskBarEditRecord.ganttProperties.segments&&-1===s||this.editTooltip.updateTooltip(s),i&&this.taskBarEditedAction(e),this.parent.trigger("taskbarEditing",r,function(e){if(!0!==e.cancel&&2!==e.data.ganttProperties.constraintType&&3!==e.data.ganttProperties.constraintType&&-1!==["ChildDrag","ParentDrag","MilestoneDrag","LeftResizing","RightResizing"].indexOf(e.taskBarEditAction)&&(r.data.ganttProperties.constraintType=4,r.data.ganttProperties.constraintDate=r.data.ganttProperties.startDate),("ChildDrag"===e.taskBarEditAction||"ParentDrag"===e.taskBarEditAction||"MilestoneDrag"===e.taskBarEditAction)&&(2===e.data.ganttProperties.constraintType||3===e.data.ganttProperties.constraintType)||"LeftResizing"===e.taskBarEditAction&&2===e.data.ganttProperties.constraintType||"RightResizing"===e.taskBarEditAction&&3===e.data.ganttProperties.constraintType){var i=a.parent.predecessorModule.filterPredecessorsByTarget(r.data.ganttProperties.predecessor,r.data,a.parent.viewType),n=e.data.ganttProperties.predecessor&&e.data.ganttProperties.predecessor.length>0;n&&0===i.length&&(n=!1),n||(e.cancel=!0)}e.cancel&&null!==a.taskBarEditRecord&&(a.tapPointOnFocus=!1,t.merge(a.taskBarEditRecord.ganttProperties,e.previousData))})}},i.prototype.updateMouseMoveProperties=function(e){var t=this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer),i=this.getCoordinate(e),a=this.parent.element.closest('[style*="zoom"]');if(a){var r=parseFloat(getComputedStyle(a).zoom);i.pageX=i.pageX/r,i.pageY=i.pageY/r}(i.pageX||i.pageY)&&(this.parent.enableRtl?this.mouseMoveX=Math.abs(i.pageX-(t.left+Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left))):this.mouseMoveX=i.pageX-t.left+this.parent.ganttChartModule.scrollObject.previousScroll.left,this.tooltipPositionX=this.mouseMoveX,this.mouseMoveY=i.pageY-t.top+this.parent.ganttChartModule.scrollObject.previousScroll.top);var n="ConnectorPointLeftDrag"===this.taskBarEditAction||"ConnectorPointRightDrag"===this.taskBarEditAction;if((this.taskBarEditRecord.ganttProperties.width>3||this.taskBarEditRecord.ganttProperties.isMilestone)&&("ProgressResizing"!==this.taskBarEditAction||0!==this.taskBarEditRecord.ganttProperties.progress&&100!==this.taskBarEditRecord.ganttProperties.progress)||n){var s=0;s=this.parent.enableRtl?Math.abs(Math.abs(this.mouseMoveX)-Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left)+t.left):this.mouseMoveX-this.parent.ganttChartModule.scrollObject.previousScroll.left+t.left;var o=this.mouseMoveY-this.parent.ganttChartModule.scrollObject.previousScroll.top+t.top;s+20>t.left+this.parent.ganttChartModule.chartBodyContainer.offsetWidth?(this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.left,this.startScrollTimer("right")):s+40>t.left+this.parent.ganttChartModule.chartBodyContainer.offsetWidth&&this.parent.enableRtl&&0===this.parent.ganttChartModule.scrollObject.previousScroll.left?(this.parent.ganttChartModule.scrollObject.previousScroll.left=-1,this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.left,this.startScrollTimer("right")):s-20<t.left?(this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.left,this.startScrollTimer("left")):o+80>t.top+this.parent.ganttChartModule.chartBodyContainer.offsetHeight?(this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.top,this.startScrollTimer("bottom")):o-20<t.top?(this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.top,this.startScrollTimer("top")):this.stopScrollTimer()}else this.stopScrollTimer()},i.prototype.startScrollTimer=function(e){var t=this;this.stopScrollTimer();var i=0;this.scrollTimer=window.setInterval(function(){if(-1===Math.sign(t.timerCount)&&(i=-1,t.timerCount=Math.abs(t.timerCount)),"right"===e){var a=t.parent.enableTimelineVirtualization?t.parent.timelineModule.wholeTimelineWidth:t.parent.timelineModule.totalTimelineWidth;t.timerCount=t.timerCount+1>=a?a:t.timerCount+1}else t.timerCount="bottom"===e?t.timerCount+1:t.timerCount-1<0?0:t.timerCount-1;"bottom"===e||"top"===e?t.parent.ganttChartModule.scrollObject.setScrollTop(t.timerCount):t.parent.ganttChartModule.scrollObject.setScrollLeft(t.timerCount,i),"ConnectorPointLeftDrag"!==t.taskBarEditAction&&"ConnectorPointRightDrag"!==t.taskBarEditAction||t.drawFalseLine()},0)},i.prototype.stopScrollTimer=function(){window.clearInterval(this.scrollTimer),this.scrollTimer=null},i.prototype.enableDragging=function(e){var i=this.taskBarEditRecord.ganttProperties,a=this.parent.enableTimelineVirtualization?this.parent.timelineModule.wholeTimelineWidth:this.parent.timelineModule.totalTimelineWidth,r=0;if(this.taskBarEditElement.classList.contains("e-segmented-taskbar")&&!this.taskBarEditElement.classList.contains("e-segment-first")){var n=this.taskBarEditRecord.ganttProperties.segments.map(function(e){return yt({},e)}),s=n[this.segmentIndex];this.mouseDownX>this.mouseMoveX?(r=t.isNullOrUndefined(this.previousMouseMove)?this.mouseDownX-this.mouseMoveX:this.previousMouseMove-this.mouseMoveX,this.previousMouseMove=this.mouseMoveX,s.left=s.left-r):(r=t.isNullOrUndefined(this.previousMouseMove)?this.mouseMoveX-this.mouseDownX:this.mouseMoveX-this.previousMouseMove,this.previousMouseMove=this.mouseMoveX,s.left=s.left+r);var o=n[this.segmentIndex-1],l=n[this.segmentIndex+1],d=void 0;d=this.taskBarEditElement.classList.contains("e-segment-inprogress")?s.left<o.left+o.width?o.left+o.width:s.width+s.left>l.left?l.left-s.width:s.left:s.left<o.left+o.width?o.left+o.width:i.left+s.width+s.left>=a?a-s.width:s.left,s.left=d,this.parent.setRecordValue("segments",n,i,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")}else{this.mouseDownX>this.mouseMoveX?(r=this.mouseDownX-this.mouseMoveX)>0&&this.parent.setRecordValue("left",this.previousItem.left-r,i,!0):(r=this.mouseMoveX-this.mouseDownX,this.parent.setRecordValue("left",this.previousItem.left+r,i,!0));d=i.left<0?0:i.left+i.width>=a?a-i.width:i.left;this.parent.setRecordValue("left",d,i,!0)}},i.prototype.validateProgressWidth=function(e,t,i){if(-1!==this.currentSegmentIndex&&e.segments){var a=this.currentSegmentIndex>=this.segmentIndex?0:0!==this.currentSegmentIndex?this.currentSegmentIndex:-1,r=this.currentSegmentIndex>=this.segmentIndex?this.currentSegmentIndex:this.segmentIndex;if(-1!==a)for(var n=a;n<r;n++)t-=e.segments[n+1].left-(e.segments[n].left+e.segments[n].width)}return e.segments&&e.segments.length>0&&(i=this.splitTasksDuration(e.segments)*this.parent.perDayWidth,i=e.segments.reduce(function(e,t){return e+t.width},0)),t>i&&(t=i),{progressWidth:t,totalTaskWidth:i}},i.prototype.performProgressResize=function(e,t){var i=this.taskBarEditRecord.ganttProperties,a=0,r=i.progressWidth;this.mouseDownX>this.mouseMoveX?this.mouseMoveX>i.left&&this.mouseMoveX<i.left+i.width&&i.left>0?(a=this.mouseMoveX-i.left,this.parent.setRecordValue("progressWidth",a,i,!0)):this.mouseMoveX>=i.left+i.width?this.parent.setRecordValue("progressWidth",i.width,i,!0):this.parent.setRecordValue("progressWidth",0,i,!0):this.mouseMoveX>i.left&&this.mouseMoveX<i.left+i.width?(a=this.mouseMoveX-i.left,this.parent.setRecordValue("progressWidth",a,i,!0)):this.mouseMoveX<=i.left?this.parent.setRecordValue("progressWidth",0,i,!0):this.parent.setRecordValue("progressWidth",i.width,i,!0);var n=i.progressWidth>i.width?i.width:i.progressWidth;n=i.progressWidth<0?0:i.progressWidth,-1===t&&t?this.parent.setRecordValue("progressWidth",r,i,!0):this.parent.setRecordValue("progressWidth",n,i,!0),this.progressValue=n;var s=i.width-i.progressWidth;this.progressBorderRadius=s<=4?4-s:0},i.prototype.enableLeftResizing=function(e){var t=this.taskBarEditRecord.ganttProperties,i=0;this.taskBarEditElement.classList.contains("e-segmented-taskbar")&&t.segments.length>1?this.enableSplitTaskLeftResize(t):(this.mouseDownX>this.mouseMoveX?this.mouseMoveX<t.left+t.width?(i=this.mouseDownX-this.mouseMoveX,t.left>0&&(this.parent.setRecordValue("left",this.previousItem.left-i,t,!0),this.parent.setRecordValue("width",this.previousItem.width+i,t,!0))):this.mouseMoveX>t.left+t.width&&(i=this.mouseDownX-this.mouseMoveX,this.parent.setRecordValue("left",this.previousItem.left-i,t,!0),this.parent.setRecordValue("width",3,t,!0)):this.mouseMoveX<t.left+t.width?(i=this.mouseMoveX-this.mouseDownX,t.left<t.left+t.width&&this.previousItem.left+i<=this.previousItem.left+this.previousItem.width&&(this.parent.setRecordValue("left",this.previousItem.left+i,t,!0),this.parent.setRecordValue("width",this.previousItem.width-i,t,!0))):(i=this.mouseMoveX-this.mouseDownX,this.parent.setRecordValue("left",this.previousItem.left+i,t,!0),this.parent.setRecordValue("width",3,t,!0)),t.segments&&1===t.segments.length&&(t.segments[0].width=t.width),this.updateEditPosition(e,t),this.parent.setRecordValue("left",this.previousItem.left+this.previousItem.width-t.width,t,!0))},i.prototype.enableSplitTaskLeftResize=function(e){var i=this.taskBarEditRecord.ganttProperties.segments.map(function(e){return yt({},e)}),a=i[this.segmentIndex],r=0;if(this.mouseDownX>this.mouseMoveX)if(this.mouseMoveX<e.left+a.width+a.left){if(r=t.isNullOrUndefined(this.previousMouseMove)?this.mouseDownX-this.mouseMoveX:this.previousMouseMove-this.mouseMoveX,this.previousMouseMove=this.mouseMoveX,a.left>0){if(a.left=a.left-r,a.width=a.width+r,0!==this.segmentIndex){var n=i[this.segmentIndex-1];if(e.left+a.left<e.left+n.left+n.width){var s=e.left+n.left+n.width-(e.left+a.left);a.width-=s,a.left=a.left+s}}}else if(a.left<=0&&0===this.segmentIndex){this.parent.setRecordValue("left",e.left-r,e,!0),this.parent.setRecordValue("width",e.width+r,e,!0),a.width=a.width+r;for(d=1;d<e.segments.length;d++){var o=i[d];o.left=o.left+r}}}else this.mouseMoveX>e.left+a.width+a.left&&(r=t.isNullOrUndefined(this.previousMouseMove)?this.mouseDownX-this.mouseMoveX:this.previousMouseMove-this.mouseMoveX,this.previousMouseMove=this.mouseMoveX,a.left=a.left-r,a.width=this.parent.perDayWidth);else if(this.mouseMoveX<e.left+a.width+a.left-this.parent.perDayWidth)if(r=t.isNullOrUndefined(this.previousMouseMove)?this.mouseMoveX-this.mouseDownX:this.mouseMoveX-this.previousMouseMove,this.previousMouseMove=this.mouseMoveX,0===this.segmentIndex&&a.left<=0){this.parent.setRecordValue("left",e.left+r,e,!0),this.parent.setRecordValue("width",e.width-r,e,!0),a.width=a.width-r;for(d=1;d<e.segments.length;d++){var l=i[d];l.left=l.left-r}}else a.left<a.left+a.width&&a.left+r<=a.left+a.width&&(a.left=a.left+r,a.width=a.width-r);else if(this.mouseMoveX<e.left+a.left+a.width&&a.width>this.parent.perDayWidth)if(r=t.isNullOrUndefined(this.previousMouseMove)?this.mouseMoveX-this.mouseDownX:this.mouseMoveX-this.previousMouseMove,this.previousMouseMove=this.mouseMoveX,r-=a.width-r<this.parent.perDayWidth?this.parent.perDayWidth>a.width?this.parent.perDayWidth-a.width:a.width-this.parent.perDayWidth:0,0===this.segmentIndex){this.parent.setRecordValue("width",e.width-r,e,!0),this.parent.setRecordValue("left",e.left+r,e,!0),a.width=a.width-r;for(var d=1;d<e.segments.length;d++){var h=i[d];h.left=h.left-r}}else a.left=a.left+r,a.width=a.width-r;this.parent.setRecordValue("segments",i,e,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")},i.prototype.updateEditPosition=function(e,t){this.updateIsMilestone(t),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(t.width,t.progress),t,!0)},i.prototype.updateIsMilestone=function(e){e.width<=3?(this.parent.setRecordValue("width",3,e,!0),this.parent.setRecordValue("isMilestone",!0,e,!0),t.isNullOrUndefined(this.taskBarEditRecord[this.parent.taskFields.milestone])||this.parent.setRecordValue(this.parent.taskFields.milestone,!0,this.taskBarEditRecord,!0)):(this.parent.setRecordValue("width",e.width,e,!0),this.parent.setRecordValue("isMilestone",!1,e,!0),t.isNullOrUndefined(this.taskBarEditRecord[this.parent.taskFields.milestone])||this.parent.setRecordValue(this.parent.taskFields.milestone,!1,this.taskBarEditRecord,!0))},i.prototype.enableRightResizing=function(e){var i=this.taskBarEditRecord.ganttProperties,a=0;if(this.taskBarEditElement.classList.contains("e-segmented-taskbar")&&i.segments.length>1){var r=this.taskBarEditRecord.ganttProperties.segments.map(function(e){return yt({},e)}),n=r[this.segmentIndex];if(this.mouseDownX>this.mouseMoveX){if(this.mouseMoveX>i.left+n.left&&this.mouseDownX-this.mouseMoveX>3)a=t.isNullOrUndefined(this.previousMouseMove)?this.mouseDownX-this.mouseMoveX:this.previousMouseMove-this.mouseMoveX,this.previousMouseMove=this.mouseMoveX,n.width=n.width-a;else if(this.mouseMoveX<i.left+n.left){var s=this.parent.timelineModule.isSingleTier&&("Hour"===this.parent.timelineModule.customTimelineSettings.bottomTier.unit||"Hour"===this.parent.timelineModule.customTimelineSettings.topTier.unit||"Minutes"===this.parent.timelineModule.customTimelineSettings.bottomTier.unit||"Minutes"===this.parent.timelineModule.customTimelineSettings.topTier.unit)||"Hour"===this.parent.timelineModule.customTimelineSettings.bottomTier.unit||"Minutes"===this.parent.timelineModule.customTimelineSettings.bottomTier.unit?this.parent.timelineModule.customTimelineSettings.timelineUnitSize:this.parent.perDayWidth;n.width=s}}else this.mouseMoveX>n.left&&(a=t.isNullOrUndefined(this.previousMouseMove)?this.mouseMoveX-this.mouseDownX:this.mouseMoveX-this.previousMouseMove,this.previousMouseMove=this.mouseMoveX,n.width=n.width+a);var o=void 0,l=this.segmentIndex!==r.length-1?r[this.segmentIndex+1]:null;t.isNullOrUndefined(l)||(this.taskBarEditElement.classList.contains("e-segment-last")||(o=n.left+n.width>l.left?l.left-n.left:n.width),n.width=o),this.segmentIndex===i.segments.length-1&&0===this.segmentIndex&&this.parent.setRecordValue("width",n.width,i,!0),this.parent.setRecordValue("segments",r,i,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")}else this.mouseDownX>this.mouseMoveX?this.mouseMoveX>i.left&&this.mouseDownX-this.mouseMoveX>3?(a=this.mouseDownX-this.mouseMoveX,this.parent.setRecordValue("width",this.previousItem.width-a,i,!0)):this.mouseMoveX<i.left&&this.parent.setRecordValue("width",3,i,!0):this.mouseMoveX>i.left&&(a=this.mouseMoveX-this.mouseDownX,this.parent.setRecordValue("width",this.previousItem.width+a,i,!0)),i.segments&&1===i.segments.length&&(i.segments[0].width=i.width),this.updateEditPosition(e,i)},i.prototype.updateEditedItem=function(){var e,i,a,r,n=this.taskBarEditRecord.ganttProperties;switch(this.taskBarEditAction){case"ProgressResizing":var s=n.progressWidth,o=n.width,l=this.validateProgressWidth(n,s,o);this.parent.setRecordValue("progress",this.getProgressPercent(l.totalTaskWidth,l.progressWidth),n,!0);break;case"LeftResizing":-1===this.segmentIndex?(e=this.getRoundOffStartLeft(n,this.roundOffDuration),i=this.getDateByLeft(e),t.isNullOrUndefined(n.endDate)&&(a=this.parent.dateValidationModule.getValidEndDate(n),this.parent.setRecordValue("endDate",a,n,!0)),r=this.parent.dateValidationModule.checkStartDate(i,n,null),this.parent.setRecordValue("startDate",new Date(r.getTime()),n,!0),0===this.parent.dateValidationModule.compareDates(n.startDate,n.endDate)&&t.isNullOrUndefined(n.isMilestone)&&!1===n.isMilestone&&0===n.duration&&this.parent.setRecordValue("duration",1,n,!0),n.isMilestone&&this.parent.setRecordValue("endDate",new Date(r.getTime()),n,!0),this.parent.dateValidationModule.calculateDuration(this.taskBarEditRecord),this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord,"duration")):this.updateSplitLeftResize(n);break;case"RightResizing":case"ParentResizing":if(-1===this.segmentIndex){e=this.getRoundOffEndLeft(n,this.roundOffDuration);var d=this.getDateByLeft(e);t.isNullOrUndefined(n.startDate)&&(r=this.parent.dateValidationModule.getValidStartDate(n),this.parent.setRecordValue("startDate",r,n,!0));var h=t.isNullOrUndefined(n.startDate)?r:n.startDate;a=n.isMilestone?h:this.parent.dateValidationModule.checkEndDate(d,this.taskBarEditRecord.ganttProperties),this.parent.setRecordValue("endDate",new Date(a.getTime()),n,!0),this.parent.dateValidationModule.calculateDuration(this.taskBarEditRecord),this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord,"duration")}else this.updateSplitRightResizing(n);break;case"ParentDrag":case"ChildDrag":case"MilestoneDrag":case"ManualParentDrag":-1===this.segmentIndex||0===this.segmentIndex||-1!==this.segmentIndex&&this.parent.allowTaskbarDragAndDrop?this.updateChildDrag(n):this.setSplitTaskDrag(n)}t.isNullOrUndefined(this.taskBarEditRecord.ganttProperties.segments)||this.parent.chartRowsModule.updateSegment(this.taskBarEditRecord.ganttProperties.segments,this.taskBarEditRecord.ganttProperties.taskId)},i.prototype.extractEndDates=function(e){var t=this,i=new Date(0);return e.forEach(function(e){var a=t.parent.getRecordByID(e.from);if(a&&a.ganttProperties){var r=null;switch(e.type){case"FS":case"FF":r=a.ganttProperties.endDate||a.ganttProperties.startDate;break;case"SS":case"SF":r=a.ganttProperties.startDate||a.ganttProperties.endDate}r&&r.getTime()>i.getTime()&&(i=r)}}),{maxEndDate:i}},i.prototype.isValidDependency=function(e){if(t.isNullOrUndefined(e.ganttProperties)||t.isNullOrUndefined(e.ganttProperties.predecessor))return{isValid:!0};var i=e.ganttProperties.predecessor,a=this.extractEndDates(i).maxEndDate;return(a=this.parent.predecessorModule.getPredecessorDate(e,i,null))?{isValid:(t.isNullOrUndefined(e.ganttProperties.startDate)?e.ganttProperties.endDate:e.ganttProperties.startDate).getTime()>=a.getTime(),maxDate:a}:{isValid:!0}},i.prototype.updateChildDrag=function(e){var i,a=this.getRoundOffStartLeft(e,this.roundOffDuration),r=this.getDateByLeft(a,e.isMilestone,e);0===this.segmentIndex?(this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(r,e,null),e,!0),e.segments[0].startDate=r,e.segments[0].endDate=this.parent.dataOperation.getEndDate(e.segments[0].startDate,e.segments[0].duration,e.durationUnit,e,!1),this.parent.setRecordValue("segments",e.segments,e,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments"),this.parent.chartRowsModule.incrementSegments(e.segments,0,this.taskBarEditRecord),this.parent.setRecordValue("endDate",e.segments[e.segments.length-1].endDate,e,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.segments,e.segments,this.taskBarEditRecord,!0)):!t.isNullOrUndefined(e.endDate)&&t.isNullOrUndefined(e.startDate)?(i=this.parent.dateValidationModule.checkStartDate(r,e,null),i=this.parent.dateValidationModule.checkEndDate(i,this.taskBarEditRecord.ganttProperties),this.parent.setRecordValue("endDate",i,e,!0)):(this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(r,e,null),e,!0),t.isNullOrUndefined(e.duration)||this.parent.dateValidationModule.calculateEndDate(this.taskBarEditRecord))},i.prototype.updateSplitLeftResize=function(e){var i=e.segments[this.segmentIndex],a=0===this.segmentIndex?this.getRoundOffStartLeft(e,this.roundOffDuration):this.getRoundOffStartLeft(i,this.roundOffDuration),r=this.getDateByLeft(a),n=this.parent.dataOperation.checkStartDate(r,e,!1),s=this.parent.dataOperation.getDuration(n,i.endDate,e.durationUnit,e.isAutoSchedule,e.isMilestone);if(i.startDate=new Date(n.getTime()),i.duration=s,this.parent.setRecordValue("duration",this.sumOfDuration(e.segments),e,!0),0===this.segmentIndex&&this.parent.setRecordValue("startDate",i.startDate,e,!0),this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord,"duration"),!t.isNullOrUndefined(e.segments[this.segmentIndex-1])){var o=this.parent.dataOperation.getDuration(e.segments[this.segmentIndex-1].endDate,e.segments[this.segmentIndex].startDate,e.durationUnit,e.isAutoSchedule,e.isMilestone);i.offsetDuration=o}this.parent.setRecordValue("segments",e.segments,e,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")},i.prototype.updateSplitRightResizing=function(e){var i=e.segments[this.segmentIndex],a=this.getRoundOffEndLeft(e,this.roundOffDuration),r=this.getDateByLeft(a),n=this.parent.dataOperation.checkEndDate(r,e,!1),s=this.parent.dataOperation.getDuration(i.startDate,n,e.durationUnit,e.isAutoSchedule,e.isMilestone);if(i.endDate=new Date(n.getTime()),i.duration=s,!t.isNullOrUndefined(e.segments[this.segmentIndex+1])){var o=e.segments[this.segmentIndex+1],l=this.parent.dataOperation.getDuration(e.segments[this.segmentIndex].endDate,o.startDate,e.durationUnit,e.isAutoSchedule,e.isMilestone);i.offsetDuration=l}this.parent.setRecordValue("segments",e.segments,e,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments"),this.parent.setRecordValue("duration",this.sumOfDuration(e.segments),e,!0),this.parent.setRecordValue("endDate",e.segments[e.segments.length-1].endDate,e,!0),this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord,"duration")},i.prototype.sumOfDuration=function(e){for(var t=0,i=0;i<e.length;i++)t+=e[i].duration;return t},i.prototype.setSplitTaskDrag=function(e){var i=e.segments[this.segmentIndex],a=this.parent.taskFields,r=this.getRoundOffStartLeft(i,this.roundOffDuration),n=this.getDateByLeft(r);n=this.parent.dateValidationModule.checkStartDate(n,e,null),i.startDate=n;var s=this.parent.dataOperation.getEndDate(i.startDate,i.duration,e.durationUnit,e,!1);if(e.segments[this.segmentIndex+1]&&s.getTime()>e.segments[this.segmentIndex+1].startDate.getTime()?i.endDate=e.segments[this.segmentIndex+1].startDate:i.endDate=s,i.duration=this.parent.dataOperation.getDuration(i.startDate,i.endDate,e.durationUnit,e.isAutoSchedule,e.isMilestone),this.parent.setRecordValue("duration",this.sumOfDuration(e.segments),e,!0),this.parent.setRecordValue("endDate",e.segments[e.segments.length-1].endDate,e,!0),t.isNullOrUndefined(a.endDate)||this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"endDate"),!t.isNullOrUndefined(e.segments[this.segmentIndex-1])){l=this.parent.dataOperation.getDuration(e.segments[this.segmentIndex-1].endDate,e.segments[this.segmentIndex].startDate,e.durationUnit,e.isAutoSchedule,e.isMilestone);1!==i.startDate.getDay()||0!==l||this.parent.includeWeekend||(l=1),i.offsetDuration=l}if(!t.isNullOrUndefined(e.segments[this.segmentIndex+1])){var o=e.segments[this.segmentIndex+1],l=this.parent.dataOperation.getDuration(e.segments[this.segmentIndex].endDate,o.startDate,e.durationUnit,e.isAutoSchedule,e.isMilestone);1!==o.startDate.getDay()||0!==l||this.parent.includeWeekend||(l=1),o.offsetDuration=l}this.parent.setRecordValue("segments",e.segments,e,!0),this.taskBarEditRecord[a.segments][this.segmentIndex]=this.parent.dataOperation.setSegmentTaskData(i,this.taskBarEditRecord[a.segments][this.segmentIndex]),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")},i.prototype.getRoundOffEndLeft=function(e,t){var i="None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier,a=e.width+e.left;if(-1!==this.segmentIndex&&e.segments.length>1){var r=e.segments[this.segmentIndex];a=a-e.width+r.width+r.left}var n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(a),1,"Day")/864e5),s=this.parent.perDayWidth-this.parent.perDayWidth/n,o=s/this.parent.perDayWidth;if(void 0===t&&(t=!1),t){if(t)if("Hour"===i){var l=this.parent.perDayWidth/24;n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(a),1,"Hour")/36e5),0!==(s=this.parent.perDayWidth/24-this.parent.perDayWidth/24/n)&&(a=a-s+l)}else if("Minutes"===i){var d=this.parent.perDayWidth/1440;n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(a),1,"Minutes")/6e4),0!==(s=this.parent.perDayWidth/1440-this.parent.perDayWidth/1440/n)&&(a=a-s+d)}else 0!==s&&(a=a-s+this.parent.perDayWidth)}else"Hour"!==i&&"Minutes"!==i&&(o>.5?a=a-s+this.parent.perDayWidth:o<.5&&(a=a-s+this.parent.perDayWidth/2));return a},i.prototype.getRoundOffStartLeft=function(e,i){var a=(t.isNullOrUndefined(e),e.left);-1!==this.segmentIndex&&t.isNullOrUndefined(e.segments)&&(a=e.left+this.taskBarEditRecord.ganttProperties.left);var r="None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier,n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(a,t.isNullOrUndefined(e)?e.isMilestone:null,e),1,"Day")/864e5),s=this.parent.perDayWidth-this.parent.perDayWidth/n,o=s/this.parent.perDayWidth;return void 0===i&&(i=!1),i?i&&("Hour"===r?(n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(a),1,"Hour")/36e5),a-=s=this.parent.perDayWidth/24-this.parent.perDayWidth/24/n):"Minutes"===r?(n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(a),1,"Minutes")/6e4),a-=s=this.parent.perDayWidth/1440-this.parent.perDayWidth/1440/n):a-=s):"Hour"!==r&&"Minutes"!==r&&(o<=.5?a-=s:o>.5&&(a=a-s+this.parent.perDayWidth/2)),a},i.prototype.getDateByLeft=function(e,i,a){var r=new Date(this.parent.timelineModule.timelineStartDate.toString()),n=864e5/this.parent.perDayWidth,s=new Date(r);if(this.parent.timelineSettings.showWeekend?s.setTime(s.getTime()+e*n):r=s=this.parent.timelineModule.calculateDateExcludingNonWorkingDays(e,r),this.parent.timelineSettings.showWeekend?this.parent.isInDst(s)?r.setTime(r.getTime()+(e-this.parent.perDayWidth/24)*n):r.setTime(r.getTime()+e*n):r=s,i&&!t.isNullOrUndefined(a.predecessorsName)&&""!==a.predecessorsName){var o=this.parent.getCurrentDayEndTime(a.isAutoSchedule?a.autoEndDate:a.endDate);this.parent.dateValidationModule.setTime(o,r),r=this.parent.dateValidationModule.checkStartDate(r,a,!0)}var l="None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.topTier:this.parent.timelineModule.bottomTier;return"Hour"!==l&&"Minutes"!==l&&this.parent.isInDst(new Date(this.parent.timelineModule.timelineStartDate.toString()))&&!this.parent.isInDst(r)&&r.setTime(r.getTime()+36e5),r},i.prototype.setItemPosition=function(){if(!t.isNullOrUndefined(this.editElement)){var e=this.editElement.parentElement;this.parent.allowTaskbarDragAndDrop&&"ChildDrag"===this.taskBarEditAction?e.style.position=null:this.parent.enableTimelineVirtualization&&this.parent.timelineModule.wholeTimelineWidth>3*this.parent.element.offsetWidth?e.style.setProperty("position","relative"):e.style.setProperty("position","absolute")}var i=this.taskBarEditRecord.ganttProperties,a=this.parent.enableRtl?"right":"left",r=t.isNullOrUndefined(i.segments)?null:i.segments[this.segmentIndex],n="MilestoneDrag"===this.taskBarEditAction||i.isMilestone?this.parent.chartRowsModule.milestoneHeight:i.width,s=this.parent.isAdaptive?n-2:n-10;t.isNullOrUndefined(r)||(s=this.parent.isAdaptive?r.width-2:r.width-10),this.taskBarEditElement.style.setProperty("opacity",".75");var o;o=this.parent.allowTaskbarDragAndDrop&&!i.isAutoSchedule&&this.taskBarEditRecord.hasChildRecords?this.taskBarEditElement:this.taskBarEditElement.classList.contains(N)?this.taskBarEditElement:"ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||0!==this.segmentIndex?t.closest(this.taskBarEditElement,"tr."+A).querySelector("."+N):this.taskBarEditElement.parentElement;var l=!(!this.taskBarEditElement.classList.contains("e-segmented-taskbar")&&!this.taskBarEditElement.querySelector(".e-segmented-taskbar")),d=this.taskBarEditElement.querySelector(".e-gantt-child-progressbar"),h=this.taskBarEditElement.querySelector("."+H),p=l?f(this.taskBarEditElement,N).querySelector("."+W):this.taskBarEditElement.querySelector("."+W),u=this.taskBarEditElement.querySelector(".e-taskbar-right-resizer"),c=this.taskBarEditElement.querySelector(".e-gantt-parent-taskbar"),g=this.taskBarEditElement.querySelector(".e-gantt-parent-progressbar"),m=this.taskBarEditElement.querySelector(".e-right-connectorpoint-outer-div"),y=o.querySelector(".e-right-connectorpoint-outer-div"),D=this.taskBarEditElement,v=this.taskBarEditElement.querySelector("."+j),k=(this.taskBarEditElement.querySelector(".e-gantt-manualparenttaskbar-right"),this.taskBarEditElement.querySelector(".e-gantt-manualparenttaskbar-left"),this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-taskbar-resize-div"));if(this.parent.allowTaskbarDragAndDrop&&!this.updatePosition&&(this.leftValue=this.leftValue+30,this.updatePosition=!0),"ConnectorPointRightDrag"!==this.taskBarEditAction&&"ConnectorPointLeftDrag"!==this.taskBarEditAction){if("ParentResizing"!==this.taskBarEditAction&&"ManualParentDrag"!==this.taskBarEditAction){if(!l||t.isNullOrUndefined(i.segments)||"RightResizing"!==this.taskBarEditAction&&0===this.segmentIndex||(t.isNullOrUndefined(k)||(!this.parent.allowTaskbarDragAndDrop||this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&"ChildDrag"!==this.taskBarEditAction&&"ParentDrag"!==this.taskBarEditAction)&&(k.style.width=r.width+"px"),this.taskBarEditElement.style.width=r.width+"px",this.parent.enableRtl?this.taskBarEditElement.style.right=r.left+"px":(this.taskBarEditElement.style.left=r.left+"px",t.isNullOrUndefined(k)||(!this.parent.allowTaskbarDragAndDrop||this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&"ChildDrag"!==this.taskBarEditAction&&"ParentDrag"!==this.taskBarEditAction)&&(k.style.left=r.left+this.editElement.parentElement.offsetLeft+"px"))),o.style.setProperty(a,(this.parent.allowTaskbarDragAndDrop?this.leftValue:i.left)+"px"),o.style.width=n+"px",l&&y&&(y.style.left=(this.parent.isAdaptive?n+10:n+2)+"px"),this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&"LeftResizing"!==this.taskBarEditAction&&"RightResizing"!==this.taskBarEditAction&&"ProgressResizing"!==this.taskBarEditAction){var b=this.parent.taskbarHeight/2;o.style.setProperty("top",this.topValue+b+"px"),o.style.zIndex="4"}if("LeftResizing"===this.taskBarEditAction&&0===this.segmentIndex){this.taskBarEditElement.style.setProperty("opacity",".75");for(var w=this.taskBarEditElement.parentElement.getElementsByClassName("e-segmented-taskbar"),T=0;T<i.segments.length;T++){var S=i.segments[T],P=w[T];P.style.width=S.width+"px",1===i.segments.length?(k.style.width=S.width+"px",k.style.setProperty(a,i.left+"px")):(0===T&&(k.style.width=S.width+"px",k.style.setProperty(a,S.left+i.left+"px")),this.parent.enableRtl?P.style.right=S.left+"px":P.style.left=S.left+"px")}}"ChildDrag"===this.taskBarEditAction&&(0===this.segmentIndex||-1!==this.segmentIndex&&this.parent.allowTaskbarDragAndDrop)&&(k.style.width=n+"px",k.style.setProperty(a,i.left+"px"),o.style.setProperty("opacity",".75"))}if(m&&(this.parent.enableRtl?m.style.left=(this.parent.isAdaptive?n+10:n-2)+"px":m.style.left=(this.parent.isAdaptive?n+10:n+2)+"px"),m&&"LeftResizing"===this.taskBarEditAction&&(m.style.left=n-2+"px"),p&&d&&("LeftResizing"===this.taskBarEditAction||"RightResizing"===this.taskBarEditAction||"ChildDrag"===this.taskBarEditAction||"ParentDrag"===this.taskBarEditAction)&&(p.style.display="none",d.style.display="none"),m&&"ProgressResizing"===this.taskBarEditAction&&(m.style.display="none"),"MilestoneDrag"===this.taskBarEditAction||i.isMilestone)o.style.setProperty(a,(this.parent.allowTaskbarDragAndDrop?this.leftValue:i.left-n/2)+"px"),k.style.setProperty(a,i.left-n/2+"px"),k.style.width=n+"px";else if("ProgressResizing"===this.taskBarEditAction)if(-1===this.segmentIndex){if(h.style.setProperty(a,i.left+i.progressWidth-10+"px"),!t.isNullOrUndefined(d)){d.style.width=i.progressWidth+"px",d.style.borderBottomRightRadius=this.progressBorderRadius+"px",d.style.borderTopRightRadius=this.progressBorderRadius+"px";var C=this.parent.enableRtl?i.progressWidth+8:i.progressWidth-8;p.style.setProperty(a,C+"px")}}else{this.updateSegmentProgress(this.taskBarEditRecord.ganttProperties);for(var R=o.querySelectorAll(".e-gantt-child-progressbar"),M=0;M<R.length;M++)i.segments[M]&&i.segments[M].progressWidth&&this.segmentIndex!==M&&(R[M].style.display="block",R[M].style.width=i.segments[M].progressWidth+"px");d.style.width=i.segments[this.segmentIndex].progressWidth+"px",d.style.borderBottomRightRadius=this.progressBorderRadius+"px",d.style.borderTopRightRadius=this.progressBorderRadius+"px";var x=this.parent.enableRtl?this.progressValue+8:this.progressValue-8;p.style.setProperty(a,x+"px")}else"RightResizing"!==this.taskBarEditAction||t.isNullOrUndefined(h)?"ParentDrag"===this.taskBarEditAction?(k.style.setProperty(a,i.left+"px"),k.style.width=n+"px",k.style.width=i.width+"px",t.isNullOrUndefined(c)||(c.style.width=n+"px",k.style.width=i.width+"px"),t.isNullOrUndefined(d)||t.isNullOrUndefined(g)||(g.style.width=i.progressWidth+"px")):"ParentResizing"===this.taskBarEditAction?(k.style.width=i.width+"px",k.style.setProperty(a,i.left+"px"),D.style.setProperty("width",i.width+"px"),v.style.setProperty("width",i.width+"px"),this.editElement.parentElement.style.setProperty("width",i.width+"px")):"ManualParentDrag"===this.taskBarEditAction?(k.style.width=i.width+"px",k.style.setProperty(a,i.left+"px"),D.style.setProperty(a,i.left-i.autoLeft+"px"),this.parent.allowTaskbarDragAndDrop&&(D.style.setProperty(a,this.leftValue+"px"),D.style.setProperty("top",this.topValue+"px"),D.style.zIndex="4")):(t.isNullOrUndefined(h)||l||(h.style.width=i.width+"px",h.style.left=i.left+"px",this.taskBarEditElement.style.width=i.width+"px",this.taskBarEditElement.style.left=(this.parent.allowTaskbarDragAndDrop?this.leftValue:i.left)+"px",k.style.setProperty(a,i.left+"px"),k.style.width=i.width+"px"),t.isNullOrUndefined(d)||(u.style.setProperty(a,s+"px"),d.style.width=i.progressWidth+"px",t.isNullOrUndefined(p)||p.style.setProperty(a,i.progressWidth-10+"px")),l&&(u.style.setProperty(a,s+"px"),d.style.width=r.width+"px",t.isNullOrUndefined(p)||p.style.setProperty(a,r.width-10+"px"))):(k.style.width=n+"px",h.style.width=n+"px",t.isNullOrUndefined(d)||(d.style.width=i.progressWidth+"px",u.style.setProperty(a,s+"px"),t.isNullOrUndefined(p)||p.style.setProperty(a,i.progressWidth-10+"px")))}if(this.parent.allowTaskbarDragAndDrop&&("ChildDrag"===this.taskBarEditAction||"ParentDrag"===this.taskBarEditAction||"ManualParentDrag"===this.taskBarEditAction||"MilestoneDrag"===this.taskBarEditAction)){var O=this.parent.enableRtl?parseInt(k.style.right,10):parseInt(k.style.left,10);this.parent.enableRtl?k.style.right=O-30+"px":k.style.left=O+30+"px"}},i.prototype.mouseUpHandler=function(e){var i=this.isMouseDragged;if(this.previousMouseMove=null,this.leftValue=0,this.previousLeftValue=0,this.editTooltip.showHideTaskbarEditTooltip(!1,this.segmentIndex),this.taskBarEditAction&&this.isMouseDragged)if(!this.dragMouseLeave&&this.taskBarEditedAction||this.parent.allowTaskbarDragAndDrop){if("touchmove"===e.type||"touchstart"===e.type||"touchend"===e.type){var a=this.getCoordinate(e);this.droppedTarget=document.elementFromPoint(a.pageX,a.pageY)}else{if(this.taskBarEditRecord.hasChildRecords&&!this.taskBarEditRecord.ganttProperties.isAutoSchedule){var r=this.parent.getOffsetRect(this.taskBarEditElement),n=!t.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?12:0,s=3+this.parent.chartRowsModule.connectorPointWidth+n,o=void 0;o=this.parent.enableRtl?Math.abs(r.left+s+1):Math.abs(Math.abs(r.left-s-1)-this.parent.ganttChartModule.scrollElement.scrollLeft),this.droppedTarget=document.elementFromPoint(o,e.y)}else this.droppedTarget=document.elementFromPoint(e.x,e.y);this.droppedTarget&&this.droppedTarget.classList.contains("e-span-label")&&(this.droppedTarget=document.elementFromPoint(e.x+this.droppedTarget.offsetWidth,e.y))}this.previousIds=this.parent.ids.slice(),this.previousFlatData=this.parent.flatData.slice(),this.taskBarEditedAction(e),this.isMouseDragged=!1}else{this.parent.isOnEdit=!1,this.cancelTaskbarEditActionInMouseLeave();var l=this.parent.criticalPathModule;this.parent.enableCriticalPath&&l&&l.criticalPathCollection&&l.criticalConnectorLine(l.criticalPathCollection,l.detailPredecessorCollection,!0,l.predecessorCollectionTaskIds)}this.parent.enableMultiTaskbar&&!t.isNullOrUndefined(this.taskBarEditElement)&&(t.isNullOrUndefined(this.taskBarEditElement.querySelector(".e-gantt-child-taskbar"))||this.taskBarEditElement.querySelector(".e-gantt-child-taskbar").classList.contains("e-collapsed-taskbar-drag")&&(t.removeClass([this.taskBarEditElement.querySelector(".e-gantt-child-taskbar")],"e-collapsed-taskbar-drag"),this.taskBarEditElement.style.zIndex=this.prevZIndex,this.prevZIndex="")),this.parent.isAdaptive&&!i||this.initPublicProp(),this.stopScrollTimer()},i.prototype.taskBarEditedAction=function(e){var i={},a=this.mouseDownX,r=this.mouseDownY,n=this.taskBarEditRecord,s=this.parent.ganttChartModule.getIndexByTaskBar(this.taskBarEditElement),o=this.mouseMoveX,l=this.getCoordinate(e).pageY-this.parent.ganttChartModule.chartBodyContainer.offsetTop;"ConnectorPointLeftDrag"!==this.taskBarEditAction&&"ConnectorPointRightDrag"!==this.taskBarEditAction||this.drawPredecessor||(this.dependencyCancel=!0);var d=[];("ConnectorPointLeftDrag"===this.taskBarEditAction||"ConnectorPointRightDrag"===this.taskBarEditAction)&&this.drawPredecessor&&(!this.connectorSecondRecord.hasChildRecords||this.connectorSecondRecord.hasChildRecords&&this.parent.allowParentDependency)?(d.push(t.extend([],[],[this.taskBarEditRecord],!0)[0]),this.parent.undoRedoModule&&(this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1].connectedRecords=d,this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!0)),this.parent.connectorLineEditModule.updatePredecessor(this.connectorSecondRecord,this.finalPredecessor)):("ConnectorPointLeftDrag"===this.taskBarEditAction||"ConnectorPointRightDrag"===this.taskBarEditAction||this.oldData&&JSON.stringify(n.ganttProperties)===JSON.stringify(this.oldData.ganttProperties)?this.parent.undoRedoModule&&this.parent.undoRedoModule.getUndoCollection.length>0&&(this.parent.totalUndoAction--,this.parent.undoRedoModule.getUndoCollection.splice(this.parent.undoRedoModule.getUndoCollection.length-1,1),this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!1)):this.parent.undoRedoModule&&this.parent.toolbarModule&&this.parent.undoRedoModule.getUndoCollection.length>0&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!0),(a!==o||Math.abs(r-l)>=(this.parent.rowHeight-this.parent.taskbarHeight)/2)&&null!==n&&(i.editingFields=n.ganttProperties,i.data=n,i.recordIndex=s,i.previousData=this.previousItem,i.taskBarEditAction=this.taskBarEditAction,i.action="TaskbarEditing",i.roundOffDuration=this.roundOffDuration,i.target=this.targetElement,this.taskbarEditedArgs=i,this.taskbarEdited(i))),this.parent.isProjectDateUpdated=!1},i.prototype.cancelTaskbarEditActionInMouseLeave=function(){this.parent.editModule.reUpdatePreviousRecords(!0)},i.prototype.updateSegmentProgress=function(e){for(var t=e.segments,i=!0,a=this.splitTasksDuration(t)*this.parent.perDayWidth,r=a*Math.ceil(e.progressWidth/a*100)/100,n=r,s=0;s<t.length;s++){var o=t[s];0!==s&&(r=o.left<=n?n-o.left:0),delete o.progressWidth,r>0&&r>o.width?(r-=o.width,o.progressWidth=o.width,o.showProgress=!1):i&&(o.progressWidth=r,o.showProgress=!0,r-=o.width,i=!1)}},i.prototype.taskbarEdited=function(e){var i=t.extend({},e),a=i.data,r=a.ganttProperties,n=this.parent.flatData.indexOf(a);if((this.parent.allowTaskbarDragAndDrop&&"ChildDrag"===this.taskBarEditAction||"ParentDrag"===this.taskBarEditAction||"MilestoneDrag"===this.taskBarEditAction||"ManualParentDrag"===this.taskBarEditAction)&&this.dragMoveY>0&&("ResourceView"===this.parent.viewType&&!a.hasChildRecords||"ProjectView"===this.parent.viewType)){if(this.parent.rowDragAndDropModule){var s=this.parent.currentViewData;this.taskBarEditRecord.parentItem&&s[this.taskBarEditRecord.parentItem.index]&&-1===this.parent.editedRecords.indexOf(s[this.taskBarEditRecord.parentItem.index])&&this.parent.editedRecords.push(s[this.taskBarEditRecord.parentItem.index]),this.removeChildBorder(),this.removeErrorElem(),this.removetopOrBottomBorder();var o=void 0;this.updatePosition=!1,this.draggedRecordMarginTop=this.taskBarEditElement.style.marginTop;var l=void 0;if(t.isNullOrUndefined(this.droppedTarget)||(l=t.closest(this.droppedTarget,"tr."+A)),l){var d=Array.from(this.parent.ganttChartModule.getChartRows()).indexOf(l);o=s[d];var h=this.parent.getRootParent(o,0).index,p=this.parent.getRootParent(this.taskBarEditRecord,0).index,u={cancel:!1,data:this.taskBarEditRecord,fromIndex:this.taskBarEditRecord.index,dropIndex:o.index,dropPosition:this.parent.rowDragAndDropModule.dropPosition,dropRecord:o};if(this.parent.trigger("rowDrop",u),!u.cancel&&o&&d!==n&&(h!==p||this.taskBarEditRecord.hasChildRecords&&o.hasChildRecords||!this.taskBarEditRecord.hasChildRecords)){var c=this.parent.flatData.indexOf(o),g=void 0;g=("ProjectView"!==this.parent.viewType||t.isNullOrUndefined(this.parent.rowDragAndDropModule.dropPosition))&&(o.hasChildRecords||!o.parentItem&&0===o.childRecords.length)?"child":this.parent.rowDragAndDropModule.dropPosition,this.parent.rowDragAndDropModule&&("ResourceView"!==this.parent.viewType||"child"!==g||o.hasChildRecords||t.isNullOrUndefined(o.parentItem)||(g="Invalid",this.parent.rowDragAndDropModule.dropPosition="Invalid"),g&&this.parent.rowDragAndDropModule.reorderRows([n],c,g)),this.dragMoveY=0}}this.isClonedElement=!1}this.parent.showOverAllocation&&this.parent.ganttChartModule.renderOverAllocationContainer()}if("ProgressResizing"===i.taskBarEditAction){if(i.previousData.progress!==r.progress){var f=i.data.ganttProperties.progressWidth,m=i.data.ganttProperties.width,y=this.validateProgressWidth(i.data.ganttProperties,f,m);this.parent.setRecordValue("progress",this.getProgressPercent(y.totalTaskWidth,y.progressWidth),r,!0),a.parentItem&&this.parent.editModule.updateParentProgress(a.parentItem),t.isNullOrUndefined(r.segments)||this.updateSegmentProgress(r)}}else{var D=i.data.ganttProperties.segments;if(!t.isNullOrUndefined(D)&&D.length>0&&("LeftResizing"===this.taskBarEditAction&&0!==this.segmentIndex||"ChildDrag"===this.taskBarEditAction&&0!==this.segmentIndex||"RightResizing"===this.taskBarEditAction)){var v=D[this.segmentIndex],k=this.taskBarEditRecord.ganttProperties,b=0===this.segmentIndex?null:D[this.segmentIndex-1],w=this.segmentIndex===D.length-1?null:D[this.segmentIndex+1],T=t.isNullOrUndefined(w)?this.parent.cloneProjectEndDate:new Date(w.startDate.getTime()),S=t.isNullOrUndefined(b)?this.parent.cloneProjectStartDate:new Date(b.endDate.getTime()),P=new Date(v.startDate.getTime()),C=new Date(v.endDate.getTime());if("Day"===this.parent.timelineModule.topTier&&"Hour"===this.parent.timelineModule.bottomTier?(P.setHours(P.getHours()-1),C.setHours(C.getHours()+1)):(P.setDate(P.getDate()),C.setDate(C.getDate())),this.parent.includeWeekend){if(T.setHours(0,0,0,0),S.setHours(0,0,0,0),P.setDate(P.getDate()-1),C.setDate(C.getDate()+1),P.setHours(0,0,0,0),C.setHours(0,0,0,0),P.getTime()<=S.getTime()&&!t.isNullOrUndefined(b)&&!t.isNullOrUndefined(v)){O=[{firstSegmentIndex:b.segmentIndex,secondSegmentIndex:v.segmentIndex}];this.parent.chartRowsModule.mergeTask(k.taskId,O)}else if(C.getTime()>=T.getTime()&&this.segmentIndex!==D.length-1){O=[{firstSegmentIndex:v.segmentIndex,secondSegmentIndex:w.segmentIndex}];this.parent.chartRowsModule.mergeTask(k.taskId,O)}else if(C.getTime()>=T.getTime()){v.endDate.setDate(this.parent.cloneProjectEndDate.getDate()-1),v.startDate=this.parent.dataOperation.getStartDate(v.endDate,v.duration,k.durationUnit,k);for(var R=D.length-2;R>=0;R--){var M=yt({},D[R]);if(!t.isNullOrUndefined(M)){var x=new Date(M.endDate);x.setDate(x.getDate()-M.offsetDuration),M.endDate=x,M.startDate=this.parent.dataOperation.getStartDate(M.endDate,M.duration,k.durationUnit,k)}}}}else if(C.getTime()<=T.getTime()&&this.segmentIndex!==D.length-1&&!this.parent.includeWeekend&&0===this.parent.dataOperation.getDuration(this.parent.dataOperation.checkStartDate(C,r,!1),T,r.durationUnit,!1,!1)){O=[{firstSegmentIndex:v.segmentIndex,secondSegmentIndex:w.segmentIndex}];this.parent.chartRowsModule.mergeTask(k.taskId,O)}else if(P.getTime()>=S.getTime()&&!t.isNullOrUndefined(b)&&!t.isNullOrUndefined(v)&&!this.parent.includeWeekend&&0===this.parent.dataOperation.getDuration(this.parent.dataOperation.checkEndDate(P,r,!1),S,r.durationUnit,!1,!1)){var O=[{firstSegmentIndex:b.segmentIndex,secondSegmentIndex:v.segmentIndex}];this.parent.chartRowsModule.mergeTask(k.taskId,O)}}this.parent.dataOperation.updateWidthLeft(i.data)}this.isDragged=!1,this.parent.dataOperation.updateTaskData(a),this.parent.editModule.initiateUpdateAction(i)},i.prototype.getProgressPercent=function(e,t){return Math.ceil(t/e*100)},i.prototype.drawFalseLine=function(){var e,i=this.mouseDownX,a=this.mouseDownY,r=this.mouseMoveX,n=this.mouseMoveY,s=Math.sqrt((i-r)*(i-r)+(a-n)*(a-n)),o=180*Math.atan2(n-a,r-i)/Math.PI,l="rotate("+(this.parent.enableRtl?-o:o)+"deg)",d=0;t.isNullOrUndefined(document.querySelectorAll(".e-chart-row")[0])||(d=document.querySelectorAll(".e-chart-row")[0].offsetWidth),"ConnectorPointLeftDrag"===this.taskBarEditAction&&(e=this.parent.enableRtl?d-(this.elementOffsetLeft+this.parent.chartRowsModule.connectorPointWidth/2)-Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left):this.elementOffsetLeft-this.parent.chartRowsModule.connectorPointWidth/2-this.parent.ganttChartModule.scrollObject.previousScroll.left),"ConnectorPointRightDrag"===this.taskBarEditAction&&(e=this.parent.enableRtl?d-(this.elementOffsetLeft+this.elementOffsetWidth+this.parent.chartRowsModule.connectorPointWidth/2)-Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left):this.elementOffsetLeft+this.elementOffsetWidth+this.parent.chartRowsModule.connectorPointWidth/2-Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left));var h=this.elementOffsetTop+this.elementOffsetHeight/2+this.parent.ganttChartModule.chartBodyContainer.offsetTop-this.parent.ganttChartModule.scrollObject.previousScroll.top;this.removeFalseLine(!1),this.falseLine=t.createElement("div",{className:"e-gantt-false-line",id:"ganttfalseline"+this.parent.element.id,styles:"position: absolute;transform:"+l+";border-top-width: 1px;border-top-style: dashed;z-index: 5;width:"+(s-3)+"px;top:"+h+"px;"}),this.parent.enableRtl?(this.falseLine.style.left="auto",this.falseLine.style.right=e+"px",this.falseLine.style.transformOrigin="100% 0%"):(this.falseLine.style.right="auto",this.falseLine.style.left=e+"px",this.falseLine.style.transformOrigin="0% 100%"),this.parent.ganttChartModule.chartBodyContainer.appendChild(this.falseLine)},i.prototype.removeFalseLine=function(e){this.falseLine&&(t.remove(this.falseLine),this.falseLine=null,e&&(this.elementOffsetLeft=0,this.elementOffsetTop=0,this.elementOffsetWidth=0,this.elementOffsetHeight=0,t.removeClass(this.parent.ganttChartModule.scrollElement.querySelectorAll(".e-connector-line-container"),["e-connector-line-z-index"])))},i.prototype.updateConnectorLineSecondProperties=function(e){var i=this.getElementByPosition(e),a=f(i,N),r=document.body.className.includes("e-bigger");this.connectorSecondAction=null;var n=0;f(i,_)?(this.connectorSecondAction="ConnectorPointLeftDrag",this.toPredecessorText="Start"):f(i,"e-connectorpoint-right")?(this.connectorSecondAction="ConnectorPointRightDrag",this.toPredecessorText="Finish"):(this.connectorSecondAction=null,this.toPredecessorText=null),this.taskBarEditElement!==a&&this.taskBarEditElement!==this.highlightedSecondElement&&(this.parent.virtualScrollModule&&this.parent.enableVirtualization&&(n=this.parent.virtualScrollModule.getTopPosition()),(this.parent.virtualScrollModule&&this.parent.enableVirtualization&&!this.elementOffsetLeft||!this.parent.enableVirtualization)&&(this.parent.allowParentDependency&&this.taskBarEditElement.children[0].classList.contains("e-manualparent-main-container")?(this.elementOffsetLeft=this.realTaskbarElement.children[0].offsetLeft+this.realTaskbarElement.offsetLeft-(r?10:0),this.elementOffsetTop=this.realTaskbarElement.parentElement.offsetTop+this.realTaskbarElement.offsetHeight/3-5+this.taskBarEditElement.children[0].offsetTop+n):(this.elementOffsetLeft=this.realTaskbarElement.offsetLeft-(r?10:0),this.elementOffsetTop=this.realTaskbarElement.parentElement.offsetTop+this.realTaskbarElement.offsetHeight/3+n),this.elementOffsetWidth=this.realTaskbarElement.offsetWidth+(r?20:0),this.elementOffsetHeight=this.realTaskbarElement.offsetHeight),this.showHideTaskBarEditingElements(a,this.highlightedSecondElement,!0)),t.isNullOrUndefined(this.connectorSecondAction)&&!t.isNullOrUndefined(this.connectorSecondElement)&&(!this.connectorSecondRecord.hasChildRecords||this.connectorSecondRecord.hasChildRecords&&this.parent.allowParentDependency)&&(this.editTooltip.showHideTaskbarEditTooltip(!1,this.segmentIndex),t.removeClass([this.connectorSecondElement.querySelector("."+_)],["e-connectorpoint-allow-block"]),t.removeClass([this.connectorSecondElement.querySelector(".e-connectorpoint-right")],["e-connectorpoint-allow-block"])),this.connectorSecondElement=this.connectorSecondAction?a:null,this.highlightedSecondElement=a,this.connectorSecondRecord=t.isNullOrUndefined(this.connectorSecondElement)?null:this.parent.ganttChartModule.getRecordByTaskBar(this.connectorSecondElement)},i.prototype.triggerDependencyEvent=function(e,i){var a,r=this.parent.element.closest('[style*="zoom"]');if(r){var n=parseFloat(getComputedStyle(r).zoom);a=e.pageY/n}var s,o,l=this.taskBarEditRecord.ganttProperties,d=this.connectorSecondRecord?this.connectorSecondRecord.ganttProperties:null,h=this.getElementByPosition(e),p=h,u="ResourceView"===this.parent.viewType?l.taskId:l.rowUniqueID;if("ConnectorPointLeftDrag"===this.taskBarEditAction?s=u+(this.parent.enableRtl?"F":"S"):"ConnectorPointRightDrag"===this.taskBarEditAction&&(s=u+(this.parent.enableRtl?"S":"F")),this.connectorSecondAction&&("ConnectorPointLeftDrag"===this.connectorSecondAction?(s+=this.parent.enableRtl?"F":"S",o=this.parent.enableRtl?"finish":"start"):"ConnectorPointRightDrag"===this.connectorSecondAction&&(s+=this.parent.enableRtl?"S":"F",o=this.parent.enableRtl?"start":"finish")),t.isNullOrUndefined(d))return void(this.drawPredecessor=!1);d.predecessorsName?this.finalPredecessor=d.predecessorsName+","+s:this.finalPredecessor=s;var c=this.parent.connectorLineEditModule.validatePredecessorRelation(this.connectorSecondRecord,this.finalPredecessor),g=this.parent.predecessorModule.calculatePredecessor(s,this.connectorSecondRecord),f={};if(f.fromItem=l,f.toItem=d,f.newPredecessorString=this.finalPredecessor,f.predecessor=g&&g[0],f.isValidLink=c,f.requestType="ValidateDependency",this.parent.trigger("actionBegin",f),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType||"ValidateDependency"===f.requestType?"ValidateDependency"!==f.requestType&&this.parent.showSpinner():this.parent.showMaskRow(),f.isValidLink=!(!c&&f.isValidLink)&&f.isValidLink,f.isValidLink){if(this.editTooltip.toolTipObj||this.parent.isAdaptive||this.editTooltip.showHideTaskbarEditTooltip(!0,this.segmentIndex),!t.isNullOrUndefined(this.editTooltip.toolTipObj)){this.parent.connectorLineModule.tooltipTable.innerHTML="",this.parent.connectorLineModule.tooltipTable.appendChild(this.parent.connectorLineModule.getConnectorLineTooltipInnerTd(this.parent.editModule.taskbarEditModule.taskBarEditRecord.ganttProperties.taskName,this.parent.editModule.taskbarEditModule.fromPredecessorText,"",""));var m=this.parent.connectorLineModule.tooltipTable.querySelector("#toPredecessor").querySelectorAll("td");if(m[1].innerText=d.taskName,m[2].innerText=this.parent.localeObj.getConstant(o),!t.isNullOrUndefined(this.parent.connectorLineModule.tooltipTable.parentElement)&&!t.isNullOrUndefined(this.parent.connectorLineModule.tooltipTable.parentElement.parentElement)){var y=this.parent.connectorLineModule.tooltipTable.parentElement.parentElement,D=t.isNullOrUndefined(a)?e.pageY:a;y.offsetTop+y.offsetHeight>D&&(y.style.top=e.pageY-y.offsetHeight-20+"px")}}this.drawPredecessor=!0}else this.parent.isAdaptive?(h.classList.contains(_)||h.classList.contains("e-connectorpoint-right"))&&this.showHideActivePredecessors(!0):t.addClass([p],["e-connectorpoint-allow-block"]),this.drawPredecessor=!1},i.prototype.getCoordinate=function(e){var t={},i=e;if(t.pageX=i.pageX,t.pageY=i.pageY,e&&"click"!==e.type){var a=e;"touchmove"!==a.type&&"touchstart"!==a.type&&"touchend"!==a.type||(t.pageX=a.changedTouches[0].pageX,t.pageY=a.changedTouches[0].pageY)}return t},i.prototype.getElementByPosition=function(e){if(this.parent.isAdaptive){var t=this.getCoordinate(e);return document.elementFromPoint(t.pageX-window.pageXOffset,t.pageY-window.pageYOffset)}return e.target},i.prototype.multipleSelectionEnabled=function(){this.parent.selectionModule&&"Cell"!==this.parent.selectionSettings.mode&&"Multiple"===this.parent.selectionSettings.type&&this.parent.selectionModule.hidePopUp()},i.prototype.unWireEvents=function(){this.parent.isDestroyed||(this.parent.off("chartMouseDown",this.mouseDownHandler),this.parent.off("chartMouseUp",this.mouseUpHandler),this.parent.off("chartMouseLeave",this.mouseLeaveHandler),this.parent.off("chartMouseMove",this.mouseMoveAction),this.parent.off("chartMouseClick",this.mouseClickHandler))},i.prototype.destroy=function(){this.unWireEvents(),this.stopScrollTimer(),this.parent.editModule.taskbarEditModule=void 0},i}(O),vt=function(){return(vt=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)},kt=function(){function o(e){this.isFromDialogPredecessor=!1,this.isTriggered=!1,this.taskFieldColumn=[],this.customFieldColumn=[],this.processedId=[],this.updatedEditFields=null,this.updatedAddFields=null,this.addedRecord=null,this.dialogEditValidationFlag=!1,this.ganttResources=[],this.isValidData=!0,this.isResourceTabUpdated=!1,this.previousResource=[],this.isResourceUpdate=!1,this.parent=e,this.localeObj=this.parent.localeObj,this.beforeOpenArgs={cancel:!1},this.types=this.getPredecessorType(),this.rowData={},this.editedRecord={},this.inputs={booleanedit:u.CheckBox,dropdownedit:s.DropDownList,datepickeredit:c.DatePicker,datetimepickeredit:c.DateTimePicker,maskededit:p.MaskedTextBox,numericedit:p.NumericTextBox,stringedit:p.TextBox,defaultedit:p.TextBox},this.processDialogFields(),this.wireEvents()}return o.prototype.wireEvents=function(){this.parent.on("chartDblClick",this.dblClickHandler,this)},o.prototype.dblClickHandler=function(e){var i=this.parent.ganttChartModule.getRecordByTarget(e);!t.isNullOrUndefined(i)&&this.parent.editModule&&this.parent.editSettings.allowEditing&&this.openEditDialog(i)},o.prototype.processDialogFields=function(){t.isNullOrUndefined(this.parent.editDialogFields)||this.parent.editDialogFields&&0===this.parent.editDialogFields.length?(this.updatedEditFields=this.getDefaultDialogFields(),this.updatedEditFields=this.validateDialogFields(this.updatedEditFields)):this.updatedEditFields=this.validateDialogFields(this.parent.editDialogFields),t.isNullOrUndefined(this.parent.addDialogFields)||this.parent.addDialogFields&&0===this.parent.addDialogFields.length?(this.updatedAddFields=this.getDefaultDialogFields(),this.updatedAddFields=this.validateDialogFields(this.updatedAddFields)):this.updatedAddFields=this.validateDialogFields(this.parent.addDialogFields)},o.prototype.validateDialogFields=function(e){for(var i=[],a=0,n=0;n<e.length;n++){var s=r.getActualProperties(e[n]);"General"!==s.type||!t.isNullOrUndefined(s.fields)&&0!==s.fields.length||(s.fields=this.getGeneralColumnFields()),"Advanced"!==s.type||!t.isNullOrUndefined(s.fields)&&0!==s.fields.length||(s.fields=this.getAdvancedColumnFields()),"Dependency"===s.type&&t.isNullOrUndefined(this.parent.taskFields.dependency)||"Resources"===s.type&&t.isNullOrUndefined(this.parent.taskFields.resourceInfo)||"Notes"===s.type&&t.isNullOrUndefined(this.parent.taskFields.notes)||("Custom"!==s.type||!t.isNullOrUndefined(s.fields)&&0!==s.fields.length||(a+=1,s.fields=this.getCustomColumnFields()),a>1||i.push(s))}return i},o.prototype.getGeneralColumnFields=function(){for(var e=[],t=0,i=Object.keys(this.parent.columnMapping);t<i.length;t++){var a=i[t];"dependency"!==a&&"resourceInfo"!==a&&"notes"!==a&&e.push(this.parent.columnMapping[a])}return e},o.prototype.getAdvancedColumnFields=function(){var e=[];return this.parent.columnMapping.constraintType&&e.push(this.parent.columnMapping.constraintType),this.parent.columnMapping.constraintDate&&e.push(this.parent.columnMapping.constraintDate),e},o.prototype.getCustomColumnFields=function(){for(var e=[],t=0;t<this.parent.customColumns.length;t++)e.push(this.parent.customColumns[t]);return e},o.prototype.getDefaultDialogFields=function(){var e=[],i={},a=this.parent.taskFields,r=this.parent.columnMapping;return 0!==Object.keys(r).length&&(i.type="General",e.push(i)),t.isNullOrUndefined(t.getValue("dependency",r))||(i={},!1!==this.parent.columnByField[r.dependency.valueOf()].visible&&(i.type="Dependency"),e.push(i)),t.isNullOrUndefined(t.getValue("resourceInfo",r))||(i={},!1!==this.parent.columnByField[r.resourceInfo.valueOf()].visible&&(i.type="Resources"),e.push(i)),t.isNullOrUndefined(t.getValue("constraintType",r))||t.isNullOrUndefined(t.getValue("constraintDate",r))||((i={}).type="Advanced",e.push(i)),t.isNullOrUndefined(t.getValue("notes",r))||(i={},!1!==this.parent.columnByField[r.notes.valueOf()].visible&&(i.type="Notes"),e.push(i)),t.isNullOrUndefined(t.getValue("segments",a))||((i={}).type="Segments",e.push(i)),this.parent.customColumns.length>0&&((i={}).type="Custom",e.push(i)),e},o.prototype.openAddDialog=function(){this.isEdit=!1,this.editedRecord=this.composeAddRecord(),this.isFromAddDialog=!0,this.createDialog()},o.prototype.getMinimumStartDate=function(){var e=a.DataUtil.aggregates.min(this.parent.flatData,"ganttProperties.startDate");return e=t.isNullOrUndefined(e)?new Date(this.parent.timelineModule.timelineStartDate.getTime()):new Date(e.getTime()),e=this.parent.dateValidationModule.checkStartDate(e),new Date(e.getTime())},o.prototype.composeAddRecord=function(){var e={};e.ganttProperties={};for(var i=this.parent.ganttColumns,a=this.parent.taskFields,r=this.parent.editModule.getNewTaskId(),n=0;n<i.length;n++){var s=i[n].field;s===a.id?(e[s]=r,e.ganttProperties.rowUniqueID=e[s]):i[n].field===a.startDate?(t.isNullOrUndefined(e[a.endDate])?e[s]=this.getMinimumStartDate():e[s]=new Date(e[a.endDate]),this.parent.timezone&&(e[s]=this.parent.dateValidationModule.remove(e[s],this.parent.timezone)),e.ganttProperties.startDate=new Date(e[s])):i[n].field===a.endDate?(t.isNullOrUndefined(e[a.startDate])?e[s]=this.getMinimumStartDate():e[s]=new Date(e[a.startDate]),this.parent.timezone&&(e[s]=this.parent.dateValidationModule.remove(e[s],this.parent.timezone)),e.ganttProperties.endDate=new Date(e[s])):i[n].field===a.duration?(e[s]=1,e.ganttProperties.duration=e[s],e.ganttProperties.durationUnit=this.parent.durationUnit.toLocaleLowerCase()):i[n].field===a.name?(e[s]=this.localeObj.getConstant("addDialogTitle")+" "+r,e.ganttProperties.taskName=e[s]):i[n].field===a.progress?(e[s]=0,e.ganttProperties.progress=e[s]):i[n].field===a.work?(e[s]=0,e.ganttProperties.work=e[s]):i[n].field===a.type?(e[s]=this.parent.taskType,e.ganttProperties.taskType=e[s]):e[this.parent.ganttColumns[n].field]=""}return e.ganttProperties.isAutoSchedule="Auto"===this.parent.taskMode||"Manual"!==this.parent.taskMode&&!0!==e[a.manual],e},o.prototype.openToolbarEditDialog=function(){var e=this.parent;if(e.editModule&&e.editSettings.allowEditing){e.selectionModule&&this.parent.ganttChartModule.focusedRowIndex>-1&&e.selectionModule.selectRow(this.parent.ganttChartModule.focusedRowIndex,!1,!1);var i=e.selectionModule?"Row"!==e.selectionSettings.mode&&"Both"!==e.selectionSettings.mode||1!==e.selectionModule.selectedRowIndexes.length?"Cell"===e.selectionSettings.mode&&1===e.selectionModule.getSelectedRowCellIndexes().length?e.updatedRecords[e.selectionModule.getSelectedRowCellIndexes()[0].rowIndex].ganttProperties.rowUniqueID:null:e.updatedRecords[e.selectionModule.selectedRowIndexes[0]].ganttProperties.rowUniqueID:null;t.isNullOrUndefined(i)||this.openEditDialog(i)}},o.prototype.openEditDialog=function(e){var i=this.parent;t.isNullOrUndefined(e)||(t.isNullOrUndefined(e.ganttProperties)||("string"==typeof e.ganttProperties.taskId?this.numericOrString="stringedit":this.numericOrString="numericedit"),t.isNullOrUndefined(e.ganttProperties)&&!t.isNullOrUndefined(e)&&(isNaN(Number(e))||"stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType?this.numericOrString="stringedit":this.numericOrString="numericedit")),"object"!=typeof e||t.isNullOrUndefined(e)?t.isNullOrUndefined(e)?i.selectedRowIndex>-1&&(this.rowData=i.currentViewData[i.selectedRowIndex],this.rowIndex=i.selectedRowIndex):(this.rowIndex=i.ids.indexOf(e.toString()),this.rowIndex>-1&&(this.rowData=i.flatData[this.rowIndex])):(this.rowIndex=this.parent.currentViewData.indexOf(e),this.rowIndex>-1&&(this.rowData=e)),this.isEdit=!0,"ResourceView"===this.parent.viewType&&0===this.rowData.level||0!==Object.keys(this.rowData).length&&(this.editedRecord=t.extend({},{},this.rowData,!0),this.isFromEditDialog=!0,this.createDialog())},o.prototype.createDialog=function(){var e=this,i=this.parent,a={};this.beforeOpenArgs.dialogModel=a,this.beforeOpenArgs.rowData=this.editedRecord,this.beforeOpenArgs.rowIndex=this.rowIndex;var r=this.parent.isAdaptive?"":"600px",n=this.parent.createElement("div",{id:i.element.id+"_dialog",styles:"max-width:"+r});n.classList.add("e-gantt-dialog"),i.element.appendChild(n),a.animationSettings={effect:"None"},a.header=this.localeObj.getConstant(this.isEdit?"editDialogTitle":"addDialogTitle"),a.isModal=!0,a.enableRtl=this.parent.enableRtl,a.allowDragging=!this.parent.isAdaptive&&!this.parent.enableAdaptiveUI,a.showCloseIcon=!0;var s=this.parent.isAdaptive?{X:"top",Y:"left"}:{X:"center",Y:"center"};a.position=s,a.height=this.parent.isAdaptive?"100%":"auto",a.target=document.body,a.close=this.dialogClose.bind(this),a.closeOnEscape=!0,a.beforeClose=function(e){"escape"===e.closedBy&&"key-pressed"===e.event.name&&"INPUT"===e.event.target.nodeName&&(e.cancel=!0)},a.open=function(i){var a=t.getValue("element",i),r=a.querySelector("#"+e.parent.element.id+"GeneralTabContainer");r&&r.scrollHeight>r.offsetHeight&&r.classList.add("e-scroll"),0===e.tabObj.selectedItem&&e.tabObj.select(0),e.parent.isAdaptive&&(a.style.maxHeight="none"),e.parent.focusModule&&e.parent.focusModule.setActiveElement(a)},a.locale=this.parent.locale,a.buttons=[{buttonModel:{content:this.localeObj.getConstant("saveButton"),cssClass:"e-primary"},click:this.buttonClick.bind(this)},{buttonModel:{cssClass:"e-flat",content:this.localeObj.getConstant("cancel")},click:this.buttonClick.bind(this)}],this.createTab(a,n)},o.prototype.buttonClick=function(e){var t=e.target;if(t.style.pointerEvents="none",this.localeObj.getConstant("cancel").toLowerCase()===e.target.innerText.trim().toLowerCase())this.dialog&&!this.dialogObj.isDestroyed&&(this.CustomformObj=null,this.formObj=null,this.storeValidTab=null,this.customFieldColumn=[],this.taskFieldColumn=[],this.dialogObj.hide(),this.dialogClose());else{if(this.CustomformObj&&!this.CustomformObj.validate())return void(t.style.pointerEvents="");if(this.formObj&&!this.formObj.validate())return void(t.style.pointerEvents="");if(this.storeDependencyTab||"Dependency"===this.firstOccuringTab){var i=void 0;if((i="Dependency"===this.firstOccuringTab?(r=e.target.closest("#"+this.parent.element.id+"_dialog")).querySelector(".e-gridform"):this.storeDependencyTab.querySelector(".e-gridform"))&&!i.ej2_instances[0].validate())return void(t.style.pointerEvents="")}if(this.storeResourceTab||"Resources"===this.firstOccuringTab){var a=void 0;if("Resources"===this.firstOccuringTab){var r=e.target.closest("#"+this.parent.element.id+"_dialog");a=r.querySelector(".e-gridform")}else a=this.storeResourceTab.querySelector(".e-gridform");if(a&&!a.ej2_instances[0].validate())return void(t.style.pointerEvents="")}this.initiateDialogSave(),this.parent.updateDuration=!1,this.CustomformObj=null,this.formObj=null,this.storeValidTab=null,this.customFieldColumn=[],this.taskFieldColumn=[],t.style.pointerEvents="auto"}},o.prototype.dialogClose=function(){this.dialog&&this.resetValues(),t.isNullOrUndefined(this.parent.focusModule)||t.isNullOrUndefined(this.parent.focusModule.getActiveElement(!0))||this.parent.focusModule.getActiveElement(!0).focus()},o.prototype.resetValues=function(){this.isEdit=!1,this.isAddNewResource=!1,this.editedRecord={},this.parent.triggeredColumnName="",this.rowData={},this.rowIndex=-1,this.addedRecord=null,this.ganttResources=[],this.dialogEditValidationFlag=!1,this.isFromAddDialog=!1,this.isFromEditDialog=!1,this.dialog&&!this.dialogObj.isDestroyed&&(this.destroyDialogInnerElements(),this.dialogObj.destroy(),t.remove(this.dialog))},o.prototype.destroyDialogInnerElements=function(){for(var e=this.parent,i=this.beforeOpenArgs.tabModel.items,a=0;a<i.length;a++){var r=i[a].content,n=r.getAttribute("id");t.isNullOrUndefined(n)&&""===n||("General"===(n=(n=n.replace(e.element.id,"")).replace("TabContainer",""))?this.destroyCustomField(r):"Dependency"===n?r.ej2_instances[0].destroy():"Notes"===n?r.ej2_instances[0].destroy():"Resources"===n?r.ej2_instances[0].destroy():-1!==n.indexOf("Custom")&&this.destroyCustomField(r))}},o.prototype.destroyCustomField=function(e){for(var i=e.childNodes,a=this.parent,n=0;n<i.length;n++){var s=i[n],o=s.querySelector('input[id^="'+a.element.id+'"]');if(o){var l=o.id.replace(a.element.id,""),d=s.querySelector("#"+a.element.id+l).ej2_instances[0];if(!t.isNullOrUndefined(d)){var h=a.columnByField[l];if(t.isNullOrUndefined(h)||t.isNullOrUndefined(h.edit)||t.isNullOrUndefined(h.edit.destroy)||!t.isNullOrUndefined(h.edit.params))d.destroy();else{var p=h.edit.destroy;"string"==typeof p?(p=r.getObject(p,window))():h.edit.destroy()}}}}},o.prototype.destroy=function(){this.resetValues(),this.parent.isDestroyed||(this.parent.off("chartDblClick",this.dblClickHandler),this.parent.editModule.dialogModule=void 0)},o.prototype.getEditFields=function(){return this.isEdit?this.updatedEditFields:this.updatedAddFields},o.prototype.createTab=function(e,a){var r,n=this,s=this.parent,o={},l=[],h=this.getEditFields(),p=s.taskFields,u=h.length;o.items=l,o.locale=this.parent.locale,o.enableRtl=this.parent.enableRtl,this.beforeOpenArgs.tabModel=o;var c=0;if(u>0)for(var g=0;g<u;g++){var f=h[g],m={};if("General"===f.type){if(0===Object.keys(s.columnMapping).length)continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("generalTab")),m.content="General",this.beforeOpenArgs[m.content]=this.getFieldsModel(f.fields)}else if("Segments"===f.type){if(t.isNullOrUndefined(p.segments))continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("segments")),m.content="Segments",this.beforeOpenArgs[m.content]=this.getSegmentsModel(f.fields)}else if("Dependency"===f.type){if(t.isNullOrUndefined(p.dependency))continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("dependency")),m.content="Dependency",this.beforeOpenArgs[m.content]=this.getPredecessorModel(f.fields)}else if("Resources"===f.type){if(t.isNullOrUndefined(p.resourceInfo))continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("resourceName")),m.content="Resources",this.beforeOpenArgs[m.content]=this.getResourcesModel(f.fields)}else if("Notes"===f.type){if(t.isNullOrUndefined(p.notes))continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("notes")),m.content="Notes",this.beforeOpenArgs[m.content]=this.getNotesModel(f.fields)}else if("Advanced"===f.type)t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("advancedTab")),m.content="Advanced",this.beforeOpenArgs[m.content]=this.getAdvancedModel(f.fields);else{if(t.isNullOrUndefined(f.fields)||0===f.fields.length)continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("customTab")),m.content="Custom"+c++,this.beforeOpenArgs[m.content]=this.getFieldsModel(f.fields)}m.header={text:f.headerText},l.push(m)}this.beforeOpenArgs.requestType=this.isEdit?"beforeOpenEditDialog":"beforeOpenAddDialog",this.parent.trigger("actionBegin",this.beforeOpenArgs,function(t){if(t.cancel)t.cancel=!1,n.parent.hideLoadingIndicator();else{n.parent.showLoadingIndicator(),n.renderTabItems(),o.selected=n.tabSelectedEvent.bind(n),o.height=n.parent.isAdaptive?"100%":"auto",o.overflowMode="Scrollable",n.tabObj=new d.Tab(o),n.tabObj.isStringTemplate=!0,r=n.parent.createElement("div",{id:s.element.id+"_Tab"}),n.tabObj.appendTo(r),e.content=r,n.dialog=a,n.dialogObj=new i.Dialog(e),n.dialogObj.isStringTemplate=!0,n.dialogObj.appendTo(n.dialog);var l={action:"OpenDialog",requestType:n.isEdit?"openEditDialog":"openAddDialog",data:n.beforeOpenArgs.rowData,element:n.dialog,cancel:!1};n.parent.treeGrid.grid.getColumns().some(function(e){return e.validationRules})&&(n.CustomformObj=null,n.formObj=null,n.storeValidTab=null,n.customFieldColumn=[],n.taskFieldColumn=[],n.changeFormObj(l.element)),n.parent.trigger("actionComplete",l,function(e){n.parent.hideLoadingIndicator(),e.cancel&&n.resetValues()})}})},o.prototype.changeFormObj=function(e){if(this.storeColumn||(this.storeColumn=this.parent.treeGrid.grid.getColumns()),this.taskfields||(this.taskfields=this.parent.taskFields.properties),this.storeValidTab||(this.storeValidTab=this.getFilteredDialogFields()),0!==this.customFieldColumn.length&&0!==this.taskFieldColumn.length||this.validateColumn(this.storeColumn,this.taskfields,this.storeValidTab),this.isFromAddDialog&&this.parent.addDialogFields&&this.parent.addDialogFields.length>0)"Resources"!==(t=this.parent.addDialogFields[0].type)&&"Dependency"!==t||(this.firstOccuringTab=t);else if(this.isFromEditDialog&&this.parent.editDialogFields&&this.parent.editDialogFields.length>0){var t=this.parent.editDialogFields[0].type;"Resources"!==t&&"Dependency"!==t||(this.firstOccuringTab=t)}if(!this.CustomformObj||!this.formObj){var i=this.customFieldColumn,a=this.taskFieldColumn;if(!this.CustomformObj&&i&&i.length>0){for(var r={},n=0;n<i.length;n++){var s=i[n];s.visible&&s.validationRules&&(r[s.field]=s.validationRules)}Object.keys(r).length>0&&(this.CustomformObj=e.querySelector("#"+this.parent.element.id+"Custom0TabContainer"),this.CustomformObj&&(this.CustomformObj=this.createFormObj(this.CustomformObj,r)))}if(!this.formObj&&a&&a.length>0){for(var r={},n=0;n<a.length;n++){var o=a[n];o.visible&&o.validationRules&&(r[o.field]=o.validationRules)}Object.keys(r).length>0&&(this.formObj=e.querySelector("#"+this.parent.element.id+"GeneralTabContainer"),this.formObj&&(this.formObj=this.createFormObj(this.formObj,r)))}}this.isFromAddDialog=!1,this.isFromEditDialog=!1},o.prototype.getFilteredDialogFields=function(){var e=this.isFromAddDialog?this.parent.addDialogFields:this.parent.editDialogFields;return 0!==e.length?e.filter(function(e){return"General"===e.type||"Custom"===e.type}):null},o.prototype.validateColumn=function(e,t,i){var a=this;i?i.forEach(function(t){var i="General"===t.type?a.taskFieldColumn:a.customFieldColumn;t.fields.forEach(function(t){var r=a.parent.getColumnByField(t,e);null!==r?i.push(r):i.push(a.parent.columnByField[t])})}):e.forEach(function(e){-1!==a.parent.customColumns.indexOf(e.field)?a.customFieldColumn.push(e):a.taskFieldColumn.push(e)})},o.prototype.createFormObj=function(e,t){var i=this;return new p.FormValidator(e,{rules:t,locale:this.parent.locale,validationComplete:function(e){i.validationComplete(e)},customPlacement:function(e,t){var a=e.getAttribute("name");if(a){var r=a;i.valErrorPlacement(e,t,r)}}})},o.prototype.valErrorPlacement=function(e,t,i){var a=i+"-tooltip",r=this.getElemTable(e);if(r){var n=r.querySelector(".e-tip-content");n&&(n.innerHTML=t.outerHTML)}else this.createTooltip(e,t,a)},o.prototype.createTooltip=function(e,t,i,a){void 0===a&&(a="block");var r=document.getElementById(i);r&&r.remove();var n=e.parentElement;n&&(n.style.position="relative");var s=document.createElement("div");s.className="e-tooltip-wrap e-lib e-control e-popup e-griderror",s.style.display=a,s.style.zIndex="1000";var o=i+"-label",l=document.createElement("div");l.id=o,l.className="sr-only";var d=document.createElement("div");d.className="e-tip-content";var h=document.createElement("div");h.className="error-message",h.appendChild(t.cloneNode(!0));var p=document.createElement("div");p.className="e-arrow-tip e-tip-top",p.appendChild(document.createElement("div")).className="e-arrow-tip-outer e-tip-top",p.appendChild(document.createElement("div")).className="e-arrow-tip-inner e-tip-top",s.setAttribute("aria-labelledby",o),d.appendChild(h),s.appendChild(d),s.appendChild(p),s.style.top="125%",s.style.left="50%",s.style.transform="translateX(-50%)",n&&(n.appendChild(l),n.appendChild(s))},o.prototype.getElemTable=function(e){var t=e.parentElement;return t?t.querySelector(".e-tooltip-wrap"):null},o.prototype.validationComplete=function(e){var t=this.getElemTable(e.element);t&&("failure"===e.status?t.style.display="":t.style.display="none")},o.prototype.tabSelectedEvent=function(e){var i=this.parent,a=e.selectedContent.childNodes[0].id,r=this.parent.editModule.dialogModule,n=r.dialog,s=n.getElementsByClassName("e-editedbatchcell").length>0,o=n.getElementsByClassName("e-editedrow").length>0||n.getElementsByClassName("e-addedrow").length>0;if(r.storeResourceTab&&s?document.querySelector("#"+i.element.id+"ResourcesTabContainer_gridcontrol").ej2_instances[0].saveCell():o&&r.storeDependencyTab&&document.querySelector("#"+i.element.id+"DependencyTabContainer").ej2_instances[0].editModule.batchSave(),a===i.element.id+"DependencyTabContainer"&&(this.storeDependencyTab=e.selectedContent),a===i.element.id+"ResourcesTabContainer"&&(this.storeResourceTab=e.selectedContent),a===i.element.id+"Custom0TabContainer"&&(d=(l=this.parent.treeGrid.grid.getColumns()).some(function(e){return e.validationRules}))&&this.changeFormObj(e.selectedContent),a===i.element.id+"GeneralTabContainer"){var l=this.parent.treeGrid.grid.getColumns(),d=l.some(function(e){return e.validationRules});d&&this.changeFormObj(e.selectedContent)}(this.parent.isAdaptive||this.parent.enableAdaptiveUI)&&this.responsiveTabContent(a,i),a===i.element.id+"ResourcesTabContainer"?this.resourceSelection(a):a===i.element.id+"NotesTabContainer"?document.getElementById(a).ej2_instances[0].refresh():a===i.element.id+"SegmentsTabContainer"&&(t.isNullOrUndefined(this.beforeOpenArgs.rowData.ganttProperties.startDate)?document.getElementById(a).ej2_instances[0].enableToolbarItems([this.parent.element.id+"SegmentsTabContainer_add"],!1):document.getElementById(a).ej2_instances[0].enableToolbarItems([this.parent.element.id+"SegmentsTabContainer_add"],!0))},o.prototype.responsiveTabContent=function(e,t){var i=document.getElementById(t.element.id+"_dialog_dialog-content"),a=i.clientHeight;a-=i.querySelector(".e-tab-header").offsetHeight;var r=document.querySelector("#"+e);if(r.classList.contains("e-grid")){a-=r.ej2_instances[0].getHeaderContent().offsetHeight;var n=r.querySelector(".e-toolbar");n&&(a-=n.offsetHeight)}r.parentElement.style.height=a+"px"},o.prototype.getFieldsModel=function(e){for(var i={},a=this.parent.columnByField,r=0;r<e.length;r++)if(e[r]!==this.parent.taskFields.dependency&&e[r]!==this.parent.taskFields.resourceInfo&&e[r]!==this.parent.taskFields.notes&&e[r]!==this.parent.taskFields.constraintDate&&e[r]!==this.parent.taskFields.constraintType&&!t.isNullOrUndefined(a[e[r]])){var n=e[r];this.createInputModel(a[n],i)}return i},o.prototype.getAdvancedModel=function(e){for(var i={},a=this.parent.columnByField,r=0;r<e.length;r++){var n=e[r];t.isNullOrUndefined(a[n])||n!==this.parent.taskFields.constraintDate&&n!==this.parent.taskFields.constraintType||this.createInputModel(a[n],i)}return i},o.prototype.processAndValidateScheduleDates=function(e,t){var i=e.editModule.dialogModule.dialog.querySelector("#"+e.element.id+t.constraintDate),a=e.editModule.dialogModule.dialog.querySelector("#"+e.element.id+t.constraintType),r=this.dialog.querySelector("#"+e.element.id+t.startDate),n=this.dialog.querySelector("#"+e.element.id+t.endDate);this.alignDateWithConstraint(i,a,r,n)},o.prototype.createInputModel=function(e,i){var a=this,r=this.parent,n=this.parent.locale,s=this.parent.taskFields,o={placeholder:e.headerText,floatLabelType:"Auto"};if(t.isNullOrUndefined(this.parent.taskFields.id)||t.isNullOrUndefined(this.parent.columnMapping.id)||t.isNullOrUndefined(this.numericOrString)||s.id===e.field&&(e.editType=this.numericOrString),e.editTemplate){var l=this.parent.currentViewData.indexOf(this.rowData),d=this.parent.chartRowsModule.templateCompiler(e.editTemplate)(t.extend({index:l},this.editedRecord),this.parent,"EditTemplate",this.parent.chartRowsModule.getTemplateID("EditTemplate"),!1,void 0,null,this.parent.treeGrid.root);i[e.field]=d}else switch(e.editType){case"booleanedit":var h={label:e.headerText,locale:n,enableRtl:this.parent.enableRtl};i[e.field]=h;break;case"defaultedit":case"stringedit":var p=o;p.enableRtl=this.parent.enableRtl,e.field!==r.columnMapping.duration&&e.field!==r.columnMapping.id&&e.field!==r.columnMapping.startDate&&e.field!==r.columnMapping.endDate&&e.field!==r.columnMapping.baselineDuration||(p.change=function(t){a.isTriggered?a.parent.triggeredColumnName="":(e.field!==a.parent.taskFields.duration&&e.field!==a.parent.taskFields.work&&e.field!==a.parent.taskFields.baselineDuration||a.isTriggered||(a.isTriggered=!0,a.parent.triggeredColumnName=e.field),a.validateScheduleFields(t,e,r))}),i[e.field]=o;break;case"numericedit":var u=o;u.enableRtl=this.parent.enableRtl,s.progress===e.field&&(u.min=0,u.max=100),u.change=function(t){a.isTriggered?a.parent.triggeredColumnName="":(e.field!==a.parent.taskFields.duration&&e.field!==a.parent.taskFields.work||a.isTriggered||(a.isTriggered=!0,a.parent.triggeredColumnName=e.field),a.validateScheduleFields(t,e,r))},i[e.field]=u;break;case"datepickeredit":var c=o;c.format=this.parent.getDateFormat(),c.enableRtl=this.parent.enableRtl,c.strictMode=!0,c.firstDayOfWeek=r.timelineModule.customTimelineSettings.weekStartDay,e.field!==r.columnMapping.startDate&&e.field!==r.columnMapping.endDate&&e.field!==r.columnMapping.constraintDate&&e.field!==r.columnMapping.baselineStartDate&&e.field!==r.columnMapping.baselineEndDate||((f=e.field===r.columnMapping.baselineStartDate||e.field===r.columnMapping.baselineEndDate)||(c.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent)),c.change=function(t){e.field!==s.constraintDate?a.validateScheduleFields(t,e,r):a.processAndValidateScheduleDates(r,s)}),i[e.field]=c;break;case"datetimepickeredit":var g=o;if(g.format=this.parent.getDateFormat(),g.enableRtl=this.parent.enableRtl,g.strictMode=!0,g.firstDayOfWeek=r.timelineModule.customTimelineSettings.weekStartDay,e.field===r.columnMapping.startDate||e.field===r.columnMapping.endDate||e.field===r.columnMapping.baselineStartDate||e.field===r.columnMapping.baselineEndDate){var f=e.field===r.columnMapping.baselineStartDate||e.field===r.columnMapping.baselineEndDate;f||(g.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent)),g.change=function(t){e.field!==s.constraintDate?a.validateScheduleFields(t,e,r):a.processAndValidateScheduleDates(r,s)}}i[e.field]=g;break;case"dropdownedit":if(e.field===r.columnMapping.type||e.field===r.columnMapping.manual||e.field===r.columnMapping.constraintType){var m=[{ID:1,Value:"FixedUnit"},{ID:2,Value:"FixedWork"},{ID:3,Value:"FixedDuration"}];o.dataSource=m,o.fields={value:"Value"};var y=o;y.enableRtl=this.parent.enableRtl,y.change=function(t){e.field===s.manual&&(a.editedRecord.ganttProperties.isAutoSchedule=!t.value),e.field!==s.constraintType?a.validateScheduleFields(t,e,r):(a.dialogConstraintValue=Number(t.value),a.processAndValidateScheduleDates(r,s))}}i[e.field]=o;break;case"maskededit":i[e.field]=o}return t.isNullOrUndefined(e.edit)||t.isNullOrUndefined(e.edit.params)||t.extend(i[e.field],e.edit.params),i},o.prototype.setConstraintDateBasedOnType=function(t,i,a,r,n){if(!t&&a)switch(i){case e.ConstraintType.StartNoEarlierThan:case e.ConstraintType.StartNoLaterThan:case e.ConstraintType.MustStartOn:a.value=new Date(r);break;case e.ConstraintType.FinishNoEarlierThan:case e.ConstraintType.FinishNoLaterThan:case e.ConstraintType.MustFinishOn:a.value=new Date(n)}},o.prototype.alignDateWithConstraint=function(t,i,a,r){var n=t?t.ej2_instances[0].value:this.editedRecord.ganttProperties.constraintDate,s=i?i.ej2_instances[0].value:this.editedRecord.ganttProperties.constraintType,o=a?a.ej2_instances[0].value:this.editedRecord.ganttProperties.startDate,l=r?r.ej2_instances[0].value:this.editedRecord.ganttProperties.endDate;!n&&s!==e.ConstraintType.AsSoonAsPossible&&s!==e.ConstraintType.AsLateAsPossible&&t&&this.setConstraintDateBasedOnType(n,s,t.ej2_instances[0],o,l);var d=new Date(o),h=new Date(l),p=this.parent.assignTimeToDate(n,this.parent.getCurrentDayStartTime(n)),u=this.parent.predecessorModule.filterPredecessorsByTarget(this.editedRecord.ganttProperties.predecessor,this.editedRecord,this.parent.viewType);switch(s){case e.ConstraintType.MustStartOn:p=n=this.parent.dateValidationModule.checkStartDate(new Date(p)),d.getTime()!==p.getTime()&&a&&(a.ej2_instances[0].value=n);break;case e.ConstraintType.MustFinishOn:p.setDate(p.getDate()+1),p=n=this.parent.dateValidationModule.checkEndDate(new Date(p)),h.getTime()!==p.getTime()&&(n=this.parent.dateValidationModule.getStartDate(n,this.editedRecord.ganttProperties.duration,this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties),a&&(a.ej2_instances[0].value=n));break;case e.ConstraintType.StartNoEarlierThan:p=n=this.parent.dateValidationModule.checkStartDate(new Date(p)),a&&(a.ej2_instances[0].value=n);break;case e.ConstraintType.StartNoLaterThan:if(this.editedRecord.ganttProperties.predecessor&&this.editedRecord.ganttProperties.predecessor.length>0&&0!==u.length){c=this.parent.editModule.taskbarEditModule.isValidDependency(this.editedRecord);a&&(a.ej2_instances[0].value=c.maxDate)}else this.editedRecord.parentItem?a&&(a.ej2_instances[0].value=this.parent.getRecordByID(this.editedRecord.parentItem.taskId).ganttProperties.startDate):a&&(a.ej2_instances[0].value=this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate)));break;case e.ConstraintType.FinishNoEarlierThan:p.setDate(p.getDate()+1),p=n=this.parent.dateValidationModule.checkEndDate(new Date(p)),h.getTime()!==p.getTime()&&(n=this.parent.dateValidationModule.getStartDate(n,this.editedRecord.ganttProperties.duration,this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties),a&&(a.ej2_instances[0].value=n));break;case e.ConstraintType.FinishNoLaterThan:if(this.editedRecord.ganttProperties.predecessor&&this.editedRecord.ganttProperties.predecessor.length>0&&0!==u.length){var c=this.parent.editModule.taskbarEditModule.isValidDependency(this.editedRecord);a&&(a.ej2_instances[0].value=c.maxDate)}else this.editedRecord.parentItem?a&&(a.ej2_instances[0].value=this.parent.getRecordByID(this.editedRecord.parentItem.taskId).ganttProperties.startDate):a&&(a.ej2_instances[0].value=this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate)));break;case e.ConstraintType.AsSoonAsPossible:this.editedRecord.ganttProperties.predecessor&&this.editedRecord.ganttProperties.predecessor.length>0&&0!==u.length?(c=this.parent.editModule.taskbarEditModule.isValidDependency(this.editedRecord)).maxDate&&a&&(a.ej2_instances[0].value=c.maxDate):this.editedRecord.parentItem?a&&(a.ej2_instances[0].value=this.parent.getRecordByID(this.editedRecord.parentItem.taskId).ganttProperties.startDate):a&&(a.ej2_instances[0].value=this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate))),t&&(t.ej2_instances[0].value=null);break;case e.ConstraintType.AsLateAsPossible:if(this.editedRecord.parentItem){var g=this.parent.dateValidationModule.checkEndDate(this.parent.getRecordByID(this.editedRecord.parentItem.taskId).ganttProperties.endDate),f=this.parent.dateValidationModule.getStartDate(g,this.editedRecord.ganttProperties.duration,this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties);a&&(a.ej2_instances[0].value=f)}else{var g=this.parent.dateValidationModule.checkEndDate(new Date(this.parent.projectEndDate)),m=this.parent.dateValidationModule.getStartDate(g,this.editedRecord.ganttProperties.duration,this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties);a&&(a.ej2_instances[0].value=m)}t&&(t.ej2_instances[0].value=null)}},o.prototype.validateScheduleFields=function(e,i,a){var r,n;t.isNullOrUndefined(a.editModule.dialogModule.dialog)||(n=a.editModule.dialogModule.dialog);var s,o=null,l=a.editModule.dialogModule.editedRecord,d=null,h=null,u="ResourceView"===this.parent.viewType?this.parent.getTaskIds():this.parent.ids,c=this.parent.viewType;if(t.isNullOrUndefined(e.element)?t.isNullOrUndefined(e.container)?t.isNullOrUndefined(e.event)||t.isNullOrUndefined(e.event.path)||t.isNullOrUndefined(e.event.path)[1]||(o=(s=e.event.path[1]).querySelector("input").getAttribute("id"),s=s.querySelector("#"+o)):(o=(s=e.container).querySelector("input").getAttribute("id"),s=s.querySelector("#"+o)):o=(s=e.element).getAttribute("id"),t.isNullOrUndefined(s))d=e.value,h=i.field;else if(d="datetimepickeredit"===i.editType?e.value:s.value,h=o.replace(a.element.id,""),"stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType){var g=function(e){return"ResourceView"===c?-1===u.indexOf("T"+e.value)&&-1===u.indexOf("R"+e.value):-1===u.indexOf(e.value)},f={rules:(r={},r[this.parent.taskFields.id]={required:!0,minLength:[g,"ID is already present, please enter new value"]},r)};new p.FormValidator("#"+this.parent.element.id+"GeneralTabContainer",f)}if(0===h.search("Segments"))return h=h.replace("SegmentsTabContainer",""),this.validateSegmentFields(a,h,d,e),this.isTriggered=!1,!0;var m=!1;this.parent.taskFields.baselineDuration!==h&&this.parent.taskFields.baselineStartDate!==h&&this.parent.taskFields.baselineEndDate!==h||(m=!0),this.validateScheduleValuesByCurrentField(h,d,this.editedRecord,m);var y=l.ganttProperties,D=this.parent.dateValidationModule.getFieldMappings(m),v=D.startdateField,k=D.enddateField,b=D.durationField,w=a.taskFields;return t.isNullOrUndefined(w.startDate||!t.isNullOrUndefined(w.baselineStartDate))||w[v]===h||this.updateScheduleFields(n,y,v),w[k]===h&&!t.isNullOrUndefined(y[v])&&!t.isNullOrUndefined(e.value)&&y[v].getTime()>e.value&&this.updateScheduleFields(n,y,k),t.isNullOrUndefined(w[k])||w[k]===h||(this.updateScheduleFields(n,y,k),this.parent.taskFields.constraintType&&this.updateScheduleFields(n,y,"constraintDate")),(!t.isNullOrUndefined(w[b])&&w[b]!==h||y[b]>=0)&&this.updateScheduleFields(n,y,b),t.isNullOrUndefined(w.work)||w.work===h&&"FixedWork"===y.taskType||this.updateScheduleFields(n,y,"work"),this.dialogEditValidationFlag=!1,this.isTriggered=!1,m=!1,!0},o.prototype.getConstraintDateElement=function(e,t,i){if(t===i.constraintDate)for(var a=0,r=this.beforeOpenArgs.tabModel.items;a<r.length;a++){var n=r[a];if("Advanced"===n.header.text)return n.content.querySelector("#"+e+t)}return null},o.prototype.updateScheduleFields=function(e,i,a){var r,n=this.parent,s=n.element.id,o=t.getValue(a,n.columnMapping),l=n.columnByField[o],d=this.parent.taskFields;if(l)if("stringedit"===l.editType){if(p=e.querySelector("#"+s+o)){var h=p.ej2_instances[0];h&&(r=t.isNullOrUndefined(l.edit)||t.isNullOrUndefined(l.edit.read)?t.isNullOrUndefined(l.valueAccessor)?this.parent.dataOperation.getDurationString(i[a],i.durationUnit):l.valueAccessor(o,n.editModule.dialogModule.editedRecord,l):l.edit.read(),h.value!==r.toString()&&d[a]===o?(h.value=r,h.dataBind()):d.startDate!==o&&d.endDate!==o&&d.baselineStartDate!==o&&d.baselineEndDate!==o||(d.startDate===o?h.value=i.startDate.toString():d.endDate===o?h.value=i.endDate.toString():d.baselineStartDate===o?h.value=i.baselineStartDate.toString():d.baselineEndDate===o&&(h.value=i.baselineEndDate.toString()),h.dataBind()))}}else if("datepickeredit"===l.editType||"datetimepickeredit"===l.editType){var p=e.querySelector("#"+s+o);if(p||(p=this.getConstraintDateElement(s,o,d)),p){var u=(l.editType,p.ej2_instances[0]);u&&(r=i[a],(t.isNullOrUndefined(u.value)&&!t.isNullOrUndefined(r)||t.isNullOrUndefined(r)&&!t.isNullOrUndefined(u.value)||u.value!==r&&!t.isNullOrUndefined(u.value)&&!t.isNullOrUndefined(r)&&u.value.toString()!==r.toString())&&(u.value=r,u.dataBind()))}}else if("numericedit"===l.editType){var c=e.querySelector("#"+s+o).ej2_instances[0];r=i[a],t.isNullOrUndefined(r)||c.value===r||(c.value=r,c.dataBind())}},o.prototype.validateDuration=function(e,i){var a=e.ganttProperties;if(!this.dialogEditValidationFlag){if(i||t.isNullOrUndefined(a.startDate)||m(a)||!t.isNullOrUndefined(a.duration))if(i||!m(a)&&t.isNullOrUndefined(a.startDate))if(i&&!t.isNullOrUndefined(a.baselineStartDate)){if(0!==e.ganttProperties.baselineDuration){r=this.parent.dateValidationModule.checkStartDate(a.baselineStartDate,void 0,void 0,void 0,!0);this.parent.setRecordValue("baselineStartDate",r,a,!0),this.parent.taskFields.baselineStartDate&&this.parent.dataOperation.updateMappingData(e,"baselineStartDate")}this.parent.dateValidationModule.calculateEndDate(e,i)}else(m(a)||t.isNullOrUndefined(a.endDate))&&t.isNullOrUndefined(a.endDate)?t.isNullOrUndefined(a.baselineEndDate)&&this.parent.dateValidationModule.calculateStartDate(e,i):this.parent.dateValidationModule.calculateStartDate(e,i);else{if(e.ganttProperties.isMilestone&&0!==e.ganttProperties.duration){var r=this.parent.dateValidationModule.checkStartDate(a.startDate);this.parent.setRecordValue("startDate",r,a,!0),this.parent.taskFields.startDate&&this.parent.dataOperation.updateMappingData(e,"startDate")}this.parent.dateValidationModule.calculateEndDate(e)}else this.parent.setRecordValue("endDate",null,a,!0),this.parent.setRecordValue("isMilestone",!1,a,!0);if(!i){var n=0===a.duration;this.parent.setRecordValue("isMilestone",n,a,!0)}this.dialogEditValidationFlag=!0}},o.prototype.validateStartDate=function(e,i){var a=e.ganttProperties,r=this.parent.taskFields,n=this.parent.dateValidationModule.getFieldMappings(i),s=n.startdateField,o=n.enddateField,l=n.durationField;this.dialogEditValidationFlag||(t.isNullOrUndefined(a[s])?(this.parent.setRecordValue(l,null,a,!0),i||(this.parent.setRecordValue("isMilestone",!1,a,!0),this.parent.allowUnscheduledTasks&&t.isNullOrUndefined(r.endDate)&&this.parent.setRecordValue("endDate",null,a,!0))):m(a)||i?t.isNullOrUndefined(r[l])?this.parent.dateValidationModule.calculateDuration(e,i):(t.isNullOrUndefined(r[o]),this.parent.dateValidationModule.calculateEndDate(e,i)):t.isNullOrUndefined(a.endDate)?t.isNullOrUndefined(a.duration)||this.parent.dateValidationModule.calculateEndDate(e):this.parent.dateValidationModule.calculateDuration(e),this.dialogEditValidationFlag=!0)},o.prototype.validateEndDate=function(e,i){var a=e.ganttProperties,r=this.parent.taskFields;if(!this.dialogEditValidationFlag){var n=this.parent.dateValidationModule.getFieldMappings(i),s=n.startdateField,o=n.enddateField,l=n.durationField;t.isNullOrUndefined(a[o])?(this.parent.setRecordValue(l,null,a,!0),i||this.parent.setRecordValue("isMilestone",!1,a,!0)):m(a)||i?t.isNullOrUndefined(r[l])?this.parent.dateValidationModule.calculateDuration(e,i):t.isNullOrUndefined(a[s])?this.parent.dateValidationModule.calculateStartDate(e,i):(i||!t.isNullOrUndefined(a.segments)&&a.segments.length>0&&(a.segments=this.parent.editModule.cellEditModule.validateEndDateWithSegments(a)),this.parent.dateValidationModule.calculateDuration(e,i)):t.isNullOrUndefined(a[l])?t.isNullOrUndefined(a[s])||this.parent.dateValidationModule.calculateDuration(e,i):this.parent.dateValidationModule.calculateStartDate(e,i),this.dialogEditValidationFlag=!0}},o.prototype.updateConstraintDate=function(t,i){var a=t.constraintType;a===e.ConstraintType.StartNoEarlierThan||a===e.ConstraintType.StartNoLaterThan?this.parent.setRecordValue("constraintDate",t.startDate,t,!0):a!==e.ConstraintType.FinishNoEarlierThan&&a!==e.ConstraintType.FinishNoLaterThan||this.parent.setRecordValue("constraintDate",t.endDate,t,!0),this.parent.dataOperation.updateMappingData(i,"constraintDate")},o.prototype.validateScheduleValuesByCurrentField=function(e,i,a,r){var n=this.parent,s=a.ganttProperties,o=n.taskFields;if(o.duration===e||o.baselineDuration===e){var l=!t.isNullOrUndefined(i)&&""!==i&&parseFloat(i)>=0,d=/^[^\d.-]+$/.test(i),h=""===i,p=r?o.baselineDuration:o.duration,u=this.parent.dateValidationModule.getFieldMappings(r),c=u.startdateField,g=u.enddateField,f=u.durationField;if(l)n.dataOperation.updateDurationValue(i,s,r),this.parent.setRecordValue(p,i,a),this.parent.setRecordValue("taskData."+p,s[f],a),r||!s.isMilestone||t.isNullOrUndefined(this.parent.editModule.cellEditModule)||((w={}).data=a,this.parent.editModule.cellEditModule.updateDates(w)),this.validateDuration(a,r);else if(r&&l||n.allowUnscheduledTasks)if(s[c]&&s[g]&&s[c].getTime()>s[g].getTime()||-1!==i.indexOf("-"))this.parent.setRecordValue(f,0,s,!0),s[g]&&this.parent.setRecordValue(c,s[g],s,!0);else if(h)this.parent.setRecordValue(f,null,s,!0),s[c]&&s[c]&&this.parent.setRecordValue(g,null,s,!0);else{if(d){var m="The provided value for the "+(r?o.baselineDuration:o.duration)+" field is invalid. Please ensure it contains only valid numeric values.";this.parent.trigger("actionFailure",{error:m})}this.parent.setRecordValue(f,s[f],s,!0)}r||this.parent.editModule.updateResourceRelatedFields(a,"duration")}if(o.startDate===e||o.baselineStartDate===e)if(""!==i){var y=r?"baselineStartDate":"startDate",D=this.parent.dateValidationModule.getDateFromFormat(i);D=this.parent.dateValidationModule.checkStartDate(D,s,void 0,void 0,r),this.parent.setRecordValue(y,D,s,!0),this.validateStartDate(a,r),this.parent.taskFields.constraintType&&this.updateConstraintDate(s,a)}else r||!n.allowUnscheduledTasks||a.hasChildRecords||(this.parent.setRecordValue("startDate",null,s,!0),this.parent.setRecordValue("duration",null,s,!0),this.parent.setRecordValue("isMilestone",!1,s,!0));if(o.endDate===e||o.baselineEndDate===e){var v=this.parent.dateValidationModule.getFieldMappings(r),c=v.startdateField,g=v.enddateField,f=v.durationField;if(""!==i){var k=this.parent.dateValidationModule.getDateFromFormat(i),b=this.parent.getCurrentDayEndTime(k);if(0===k.getHours()&&86400!==b&&this.parent.dateValidationModule.setTime(b,k),!t.isNullOrUndefined(s[c])&&!t.isNullOrUndefined(s[g])&&!t.isNullOrUndefined(k)&&s[c].getTime()>k.getTime()&&(k=s[g]),k=this.parent.dateValidationModule.checkEndDate(k,s,void 0,r),(t.isNullOrUndefined(s[c])||k.getTime()>=s[c].getTime())&&this.parent.setRecordValue(g,k,s,!0),this.validateEndDate(a,r),!r&&s.isMilestone&&!t.isNullOrUndefined(this.parent.editModule.cellEditModule)){var w={};w.data=a,this.parent.editModule.cellEditModule.updateDates(w)}}else n.allowUnscheduledTasks&&!r&&(this.parent.setRecordValue(g,null,s,!0),this.parent.setRecordValue(f,null,s,!0),r||this.parent.setRecordValue("isMilestone",!1,s,!0))}return o.work===e&&(t.isNullOrUndefined(i)||""===i||(this.parent.setRecordValue("work",i,s,!0),this.parent.editModule.updateResourceRelatedFields(a,"work"),this.validateDuration(a))),e===o.type&&(this.parent.setRecordValue("taskType",i,s,!0),i&&"FixedDuration"===i&&0===s.duration&&this.parent.editModule.updateResourceRelatedFields(a,"work")),o.manual===e&&this.parent.editModule.updateTaskScheduleModes(a),!0},o.prototype.getSegmentsModel=function(e){var i=this,a=this.parent.taskFields;(t.isNullOrUndefined(e)||0===e.length)&&(e=[],t.isNullOrUndefined(a.startDate)||e.push(this.parent.taskFields.startDate),t.isNullOrUndefined(a.endDate)||e.push(this.parent.taskFields.endDate),t.isNullOrUndefined(a.duration)||e.push(this.parent.taskFields.duration),t.isNullOrUndefined(a.id)||e.push(this.parent.taskFields.id));var r={};r.editSettings={allowEditing:!0,allowAdding:!0,allowDeleting:!0,mode:"Normal",newRowPosition:"Bottom"},r.locale=this.parent.locale,r.dataSource=[],r.rowHeight=this.parent.isAdaptive?48:null,r.toolbar=[{id:this.parent.element.id+"SegmentsTabContainer_add",prefixIcon:"e-add",tooltipText:this.localeObj.getConstant("add"),align:"Right",text:this.parent.isAdaptive?"":this.localeObj.getConstant("add")},{id:this.parent.element.id+"SegmentsTabContainer_delete",prefixIcon:"e-delete",tooltipText:this.localeObj.getConstant("delete"),align:"Right",text:this.parent.isAdaptive?"":this.localeObj.getConstant("delete")}];for(var n=[],s=this,o=0;o<e.length;o++)!function(a){var r={};switch(e[a]){case s.parent.taskFields.id:r={field:e[a],visible:!1,isPrimaryKey:!0},n.push(r);break;case s.parent.taskFields.startDate:case s.parent.taskFields.endDate:r={field:e[a],headerText:s.localeObj.getConstant(e[a]===s.parent.taskFields.startDate?"startDate":"endDate"),editType:"stringedit",width:"200px",edit:{write:function(r){var n;if(t.isNullOrUndefined(i.beforeOpenArgs.General)||t.isNullOrUndefined(i.beforeOpenArgs.General[e[a]])){var s=i.getGeneralColumnFields();n=i.getFieldsModel(s)[e[a]]}else n=i.beforeOpenArgs.General[e[a]];var o=r.rowData[r.column.field];t.setValue("value",o,n),new i.inputs[i.parent.columnByField[e[a]].editType](n).appendTo(r.element)},read:function(e){return e.ej2_instances[0].value}},format:s.parent.getDateFormat()},e[a]===s.parent.taskFields.startDate&&(r.validationRules={required:!0}),n.push(r);break;case s.parent.taskFields.duration:r={field:e[a],headerText:s.localeObj.getConstant(e[a].toLocaleLowerCase()),editType:"stringedit",width:"100px",edit:{write:function(r){var n;if(t.isNullOrUndefined(i.beforeOpenArgs.General)||t.isNullOrUndefined(i.beforeOpenArgs.General[e[a]])){var s=i.getGeneralColumnFields();n=i.getFieldsModel(s)[e[a]]}else n=i.beforeOpenArgs.General[e[a]];n.floatLabelType="Never";var o=r.rowData[r.column.field];t.isNullOrUndefined(o)?t.setValue("value",null,n):t.setValue("value",o,n),t.setValue("value",o,n),new p.TextBox(n).appendTo(r.element)},read:function(e){return e.ej2_instances[0].value.toString()}}},n.push(r)}}(o);return r.columns=n,r.height=this.parent.isAdaptive||this.parent.enableAdaptiveUI?"100%":"153px",r},o.prototype.getGridColumnByField=function(e,t){for(var i,a=0;a<t.length;a++)t[a].field===e&&(i=t[a]);return i},o.prototype.updateSegmentField=function(e,i,a){var r,n=this.parent.editModule.dialogModule.dialog,s=t.getValue("Segments",this.beforeOpenArgs),o=this.getGridColumnByField(e,s.columns),l=this.parent.element.id,d=a[e];"stringedit"===o.editType?r=n.querySelector("#"+l+"SegmentsTabContainer"+e).ej2_instances[0]:"datepickeredit"===o.editType&&(r=n.querySelector("#"+l+"SegmentsTabContainer"+e).ej2_instances[0]),t.isNullOrUndefined(r.value)||t.isNullOrUndefined(d)||r.value.toString()===d.toString()||(r.value=d,r.dataBind())},o.prototype.validateSegmentFields=function(e,i,a,r){var n=this.parent.taskFields;if(!t.isNullOrUndefined(n.duration)&&n.duration.toLowerCase()===i.toLowerCase()&&!t.isNullOrUndefined(a)&&""!==a){this.selectedSegment[n.duration]=Number(a);o=e.dataOperation.getEndDate(this.selectedSegment[n.startDate],Number(a),this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties,!1);o=e.dataOperation.checkEndDate(o,this.editedRecord.ganttProperties,!1),this.selectedSegment[n.endDate]=o}if(!t.isNullOrUndefined(n.startDate)&&n.startDate.toLowerCase()===i.toLowerCase()&&""!==a){var s=this.parent.dateValidationModule.getDateFromFormat(a);s=this.parent.dateValidationModule.checkStartDate(s),this.selectedSegment[n.startDate]=s,t.isNullOrUndefined(n.endDate)||(this.selectedSegment.endDate=this.parent.dataOperation.getEndDate(s,this.selectedSegment[n.duration],this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties,!1))}if(!t.isNullOrUndefined(n.endDate)&&n.endDate.toLowerCase()===i.toLowerCase()&&""!==a){var o=this.parent.dateValidationModule.getDateFromFormat(a),l=this.parent.getCurrentDayEndTime(o);0===o.getHours()&&86400!==l&&this.parent.dateValidationModule.setTime(l,o),o=this.parent.dateValidationModule.checkEndDate(o,this.editedRecord.ganttProperties),this.selectedSegment[n.endDate]=o,this.selectedSegment[n.duration]=this.parent.dataOperation.getDuration(this.selectedSegment[n.startDate],this.selectedSegment[n.endDate],this.editedRecord.ganttProperties.durationUnit,!0,!1,!0)}t.isNullOrUndefined(n.startDate)||this.updateSegmentField(n.startDate,r,this.selectedSegment),t.isNullOrUndefined(n.endDate)||this.updateSegmentField(n.endDate,r,this.selectedSegment),t.isNullOrUndefined(n.duration)||this.updateSegmentField(n.duration,r,this.selectedSegment)},o.prototype.getPredecessorModel=function(e){(t.isNullOrUndefined(e)||0===e.length)&&(e=["ID","Name","Type","Offset","UniqueId"]);var i={};i.editSettings={allowEditing:!0,allowAdding:!0,allowDeleting:!0,mode:"Normal"},i.locale=this.parent.locale,i.dataSource=[],i.rowHeight=this.parent.isAdaptive?48:null,i.toolbar=[{id:this.parent.element.id+"DependencyTabContainer_add",prefixIcon:"e-add",tooltipText:this.localeObj.getConstant("add"),align:"Right",text:this.parent.isAdaptive?"":this.localeObj.getConstant("add")},{id:this.parent.element.id+"DependencyTabContainer_delete",prefixIcon:"e-delete",tooltipText:this.localeObj.getConstant("delete"),align:"Right",text:this.parent.isAdaptive?"":this.localeObj.getConstant("delete")}];for(var a=[],r=0;r<e.length;r++){var n={};"id"===e[r].toLowerCase()?(n={field:"id",headerText:this.localeObj.getConstant("id"),allowEditing:!1,width:"70px"},a.push(n)):"name"===e[r].toLowerCase()?(n={field:"name",headerText:this.localeObj.getConstant("name"),editType:"stringedit",width:"250px",validationRules:{required:!0}},a.push(n)):"type"===e[r].toLowerCase()?(n={field:"type",headerText:this.localeObj.getConstant("type"),editType:"dropdownedit",dataSource:this.types,foreignKeyField:"id",foreignKeyValue:"text",defaultValue:"FS",validationRules:{required:!0},width:"150px"},a.push(n)):"offset"===e[r].toLowerCase()?(n={field:"offset",headerText:this.localeObj.getConstant("offset"),editType:"stringedit",defaultValue:this.parent.dataOperation.getDurationString(0,this.beforeOpenArgs.rowData.ganttProperties.durationUnit),validationRules:{required:!0},width:"100px"},a.push(n)):"uniqueid"===e[r].toLowerCase()&&(n={field:"uniqueId",isPrimaryKey:!0,visible:!1,defaultValue:M().toString()},a.push(n))}return i.columns=a,i.height=this.parent.isAdaptive||this.parent.enableAdaptiveUI?"100%":"153px",i},o.prototype.getResourcesModel=function(e){var i=this.parent.resourceFields;(t.isNullOrUndefined(e)||0===e.length)&&(e=[i.id,i.name,i.unit,i.group]);for(var a={allowFiltering:!0,treeColumnIndex:-1,childMapping:"",editSettings:{allowEditing:!0,mode:"Cell"},locale:this.parent.locale,allowSelection:!0,rowHeight:this.parent.isAdaptive?48:null,filterSettings:{type:"Menu"},selectionSettings:{checkboxOnly:!0,checkboxMode:"Default",persistSelection:!0,type:"Multiple"}},r=[{type:"checkbox",allowEditing:!1,allowSorting:!1,allowFiltering:!1,width:60}],n=0;n<e.length;n++){var s={};e[n]===i.id?(s={field:i.id,headerText:this.localeObj.getConstant("id"),isPrimaryKey:!0,width:"100px",allowEditing:!1},r.push(s)):e[n]===i.name?(s={field:i.name,headerText:this.localeObj.getConstant("name"),allowEditing:!1},r.push(s)):e[n]===i.unit?(s={field:i.unit,headerText:this.localeObj.getConstant("unit"),editType:"numericedit",edit:{params:{min:0}}},r.push(s)):e[n]!==i.group||t.isNullOrUndefined(i.group)||(s={field:i.group,headerText:this.localeObj.getConstant("group"),allowEditing:!1},r.push(s))}return a.columns=r,a.height=this.parent.isAdaptive||this.parent.enableAdaptiveUI?"100%":"196px",a},o.prototype.getNotesModel=function(e){return(t.isNullOrUndefined(e)||0===e.length)&&(e=["Bold","Italic","Underline","StrikeThrough","FontName","FontSize","FontColor","BackgroundColor","LowerCase","UpperCase","|","Alignments","OrderedList","UnorderedList","Outdent","Indent","|","CreateTable","CreateLink","|","ClearFormat","Print","|","Undo","Redo"]),{placeholder:this.localeObj.getConstant("writeNotes"),toolbarSettings:{items:e},height:this.parent.isAdaptive||this.parent.enableAdaptiveUI?"100%":"auto",locale:this.parent.locale}},o.prototype.createDivElement=function(e,i){return t.createElement("div",{className:e,id:i})},o.prototype.createFormElement=function(e,i){return t.createElement("form",{className:e,id:i})},o.prototype.createInputElement=function(e,i,a,r){return t.createElement(r||"input",{className:e,attrs:{type:"text",id:i,name:a,title:a}})},o.prototype.renderTabItems=function(){for(var e=!1,t=this.beforeOpenArgs.tabModel.items,i=0,a=0;a<t.length;a++){var r=t[a];r.content instanceof HTMLElement||("General"===r.content?r.content=this.renderGeneralTab(r.content):"Advanced"===r.content?r.content=this.renderAdvancedTab(r.content):"Dependency"===r.content?(this.editedRecord.hasChildRecords&&!this.parent.allowParentDependency&&(r.disabled=!0),r.content=this.renderPredecessorTab(r.content)):"Resources"===r.content?r.content=this.renderResourceTab(r.content):r.content==="Custom"+i?(e=!0,r.content=this.renderCustomTab(r.content,e),i++):"Notes"===r.content?r.content=this.renderNotesTab(r.content):"Segments"===r.content&&(this.editedRecord.hasChildRecords&&(r.disabled=!0),r.content=this.renderSegmentsTab(r.content)))}},o.prototype.segmentGridActionBegin=function(e){var i,a,r=this.parent.taskFields,n=this.beforeOpenArgs.Segments;if("add"===e.requestType||"beginEdit"===e.requestType||"save"===e.requestType){var s=n.dataSource,o=t.getValue("rowData",e),l=this.beforeOpenArgs.rowData.ganttProperties.startDate;if(!t.isNullOrUndefined(l)&&"add"===e.requestType){var d={},h=t.getValue(this.parent.taskFields.startDate,o),p=this.parent.taskFields.endDate?t.getValue(this.parent.taskFields.endDate,o):null,u=void 0;t.isNullOrUndefined(this.parent.taskFields.duration)||(u=t.getValue(this.parent.taskFields.duration,o));var c=!t.isNullOrUndefined(s)&&s.length>0?t.isNullOrUndefined(r.endDate)||t.isNullOrUndefined(s[0][r.endDate])?new Date(t.getValue(r.startDate,s[0]).getTime()):new Date(t.getValue(r.endDate,s[0]).getTime()):!t.isNullOrUndefined(this.beforeOpenArgs.rowData.ganttProperties.startDate)&&new Date(this.beforeOpenArgs.rowData.ganttProperties.startDate.getTime());c.setHours(0,0,0,0),!t.isNullOrUndefined(s)&&s.length>0&&c.setDate(c.getDate()+2),h=this.parent.dataOperation.checkStartDate(c),p=this.parent.dateValidationModule.getDateFromFormat(h);var g=this.parent.getCurrentDayEndTime(p);0===p.getHours()&&86400!==g&&this.parent.dateValidationModule.setTime(g,p),p=!t.isNullOrUndefined(r.endDate)&&!t.isNullOrUndefined(s)&&s.length<=0?this.beforeOpenArgs.rowData.ganttProperties.endDate:p;var f=this.beforeOpenArgs.rowData.ganttProperties;u=h.getTime()===p.getTime()?1:this.parent.dataOperation.getDuration(h,p,f.durationUnit,!0,!1,!0),t.isNullOrUndefined(r.duration)?((a={})[r.startDate]=h,a[r.endDate]=p,d=a):((i={})[r.startDate]=h,i[r.endDate]=p,i[r.duration]=u,d=i),e.rowData=d}if("save"===e.requestType){for(var m=n.dataSource,y=this.parent.taskFields.id,D=m.length;m.some(function(e){return e[y]===D});)D++;t.isNullOrUndefined(e.data[y])&&(e.data[y]=D,e.rowData[y]=D)}this.selectedSegment=e.rowData}},o.prototype.getDialogTabIndex=function(e){var t;return this.isEdit?this.parent.editDialogFields.map(function(i,a){i.type===e&&(t=a)}):this.parent.addDialogFields.map(function(i,a){i.type===e&&(t=a)}),t},o.prototype.setInjected=function(e,i,a,s,o,l,d){if(!t.isNullOrUndefined(e)&&!t.isNullOrUndefined(e.additionalParams)){i=e.additionalParams;for(var h in i)if(Object.prototype.hasOwnProperty.call(i,h))switch(h){case"allowFiltering":a.Inject(r.Filter);break;case"allowSorting":a.Inject(r.Sort);break;case"allowPaging":a.Inject(r.Page);break;case"allowGrouping":a.Inject(r.Group);break;case"editSettings":a.Inject(r.Edit);break;case"aggregates":a.Inject(r.Aggregate);break;case"showColumnChooser":a.Inject(r.ColumnChooser);break;case"showColumnMenu":a.Inject(r.ColumnMenu);break;case"contextMenuItems":a.Inject(r.ContextMenu);break;case"allowResizing":a.Inject(r.Resize);break;case"allowReordering":a.Inject(r.Reorder);break;case"detailTemplate":a.Inject(r.DetailRow);break;case"allowRowDragAndDrop":a.Inject(r.RowDD);break;case"searchSettings":a.Inject(r.Search);break;case"selectionSettings":a.Inject(Selection);break;case"enableVirtualization":a.Inject(n.VirtualScroll);break;case"toolbar":i.toolbar.map(function(e){switch(e){case"Search":a.Inject(r.Search);break;case"Print":a.Inject(r.Print);break;case"PdfExport":a.Inject(r.PdfExport);break;case"ExcelExport":a.Inject(r.ExcelExport)}}),l.toolbar,a.Inject(r.Toolbar);break;case"columns":l.columns}}},o.prototype.renderSegmentsTab=function(e){var i=this,a=this.parent,n=this.beforeOpenArgs[e];n.enableAdaptiveUI=this.parent.enableAdaptiveUI;var s=this.beforeOpenArgs.rowData,o=[];this.isEdit&&(o=t.isNullOrUndefined(s.taskData[this.parent.taskFields.segments])?[]:s.taskData[this.parent.taskFields.segments]),o.map(function(e,a){t.isNullOrUndefined(e[i.parent.taskFields.id])&&(e[i.parent.taskFields.id]=a)}),n.dataSource=o,n.actionBegin=this.segmentGridActionBegin.bind(this);var l,d=this.getDialogTabIndex("Segments");this.isEdit?this.isEdit&&(l=this.parent.editDialogFields[d]):l=this.parent.addDialogFields[d];var h,p=[],u=[];t.isNullOrUndefined(l)||t.isNullOrUndefined(l.additionalParams)||(h=l.additionalParams),this.setInjected(l,h,r.Grid,void 0,p,n,u),r.Grid.Inject(r.Edit,r.Page,r.Toolbar,r.ForeignKey),(n=vt({},n,h)).toolbar=p.concat(n.toolbar);var c=this.updateColumns(u,n.columns);n.columns=c;var g=new r.Grid(n),f=this.createDivElement("",a.element.id+""+e+"TabContainer");return g.appendTo(f),f},o.prototype.renderGeneralTab=function(e,i){var a,r=this.parent,n=[],s=this.beforeOpenArgs[e];a=i?this.createDivElement("e-edit-form-row",r.element.id+""+e+"TabContainer"):this.createFormElement("e-edit-form-row",r.element.id+""+e+"TabContainer");var o,l;this.parent.enableAdaptiveUI&&(a.style.height="100%",(o=t.createElement("table",{className:"e-table"})).style.width="100%",l=t.createElement("tbody"));for(var d=a.id,h=this,p=0,u=Object.keys(s);p<u.length;p++)!function(e){if(!1===h.parent.columnByField[e].visible||"WBSCode"===e||"WBSPredecessor"===e)return"continue";var t=h.parent.columnByField[e],i=s[e],r=void 0;if(t.editTemplate){var o=h.createDivElement("e-edit-form-column");i.forEach(function(e){return o.appendChild(e)}),r=o}else r=h.renderInputElements(i,t);h.parent.enableAdaptiveUI?l.appendChild(r):a.appendChild(r),n.push(e)}(u[p]);this.parent.enableAdaptiveUI&&(o.appendChild(l),a.appendChild(o)),d!==a.id&&(a.id=d);var c=this.getDialogTabIndex("General"),g=[];if(this.isEdit||t.isNullOrUndefined(this.parent.addDialogFields[c])||t.isNullOrUndefined(this.parent.addDialogFields[c].fields)?!this.isEdit||t.isNullOrUndefined(this.parent.editDialogFields[c])||t.isNullOrUndefined(this.parent.editDialogFields[c].fields)||(g=this.parent.editDialogFields[c].fields):g=this.parent.addDialogFields[c].fields,!t.isNullOrUndefined(g)){var f=g.filter(function(e){return!n.includes(e)});if(!t.isNullOrUndefined(f))for(var m=f,y=0;y<=m.length-1;y++){var D=document.getElementById(m[y]);if(!t.isNullOrUndefined(D)){var v=D.innerHTML,k=t.createElement("div");k.innerHTML=v,a.appendChild(k.children[0])}}}return a},o.prototype.renderAdvancedTab=function(e,i){var a,r=this.parent,n=[],s=this.beforeOpenArgs[e];a=i?this.createDivElement("e-edit-form-row",r.element.id+""+e+"TabContainer"):this.createFormElement("e-edit-form-row",r.element.id+""+e+"TabContainer");var o,l;this.parent.enableAdaptiveUI&&(a.style.height="100%",(o=t.createElement("table",{className:"e-table"})).style.width="100%",l=t.createElement("tbody"));for(var d=a.id,h=this,p=0,u=Object.keys(s);p<u.length;p++)!function(e){if(!1===h.parent.columnByField[e].visible)return"continue";var t=h.parent.columnByField[e],i=s[e],r=void 0;if(t.editTemplate){var o=h.createDivElement("e-edit-form-column");i.forEach(function(e){return o.appendChild(e)}),r=o}else r=h.renderInputElements(i,t);h.parent.enableAdaptiveUI?l.appendChild(r):a.appendChild(r),n.push(e)}(u[p]);this.parent.enableAdaptiveUI&&(o.appendChild(l),a.appendChild(o)),d!==a.id&&(a.id=d);var c=this.getDialogTabIndex("Advanced"),g=[];if(this.isEdit||t.isNullOrUndefined(this.parent.addDialogFields[c])||t.isNullOrUndefined(this.parent.addDialogFields[c].fields)?!this.isEdit||t.isNullOrUndefined(this.parent.editDialogFields[c])||t.isNullOrUndefined(this.parent.editDialogFields[c].fields)||(g=this.parent.editDialogFields[c].fields):g=this.parent.addDialogFields[c].fields,!t.isNullOrUndefined(g)){var f=g.filter(function(e){return!n.includes(e)});if(!t.isNullOrUndefined(f))for(var m=f,y=0;y<=m.length-1;y++){var D=document.getElementById(m[y]);if(!t.isNullOrUndefined(D)){var v=D.innerHTML,k=t.createElement("div");k.innerHTML=v,a.appendChild(k.children[0])}}}return a},o.prototype.isCheckIsDisabled=function(e){var i,a=!1;if(!1===e.allowEditing||e.isPrimaryKey||this.parent.readOnly)if(-1!==this.parent.customColumns.indexOf(e.field))a=!0;else if(e.field===this.parent.taskFields.baselineStartDate||e.field===this.parent.taskFields.baselineEndDate||e.field===this.parent.taskFields.work||e.field===this.parent.taskFields.type||e.field===this.parent.taskFields.id||e.field===this.parent.taskFields.name||e.field===this.parent.taskFields.duration||e.field===this.parent.taskFields.progress||e.field===this.parent.taskFields.startDate||e.field===this.parent.taskFields.endDate){for(var r=0;r<this.parent.currentViewData.length;r++)if(!t.isNullOrUndefined(this.parent.currentViewData[r].ganttProperties.taskId)){i=this.parent.currentViewData[r].ganttProperties.taskId;break}a="string"!=typeof i}if(this.isEdit&&(e.field===this.parent.taskFields.id&&(a=!0),this.editedRecord.hasChildRecords&&(e.field===this.parent.taskFields.endDate&&(!t.isNullOrUndefined(this.editedRecord[this.parent.taskFields.manual])&&!1===this.editedRecord[this.parent.taskFields.manual]||"Auto"===this.parent.taskMode)||e.field===this.parent.taskFields.duration||e.field===this.parent.taskFields.progress||e.field===this.parent.taskFields.work||e.field===this.parent.taskFields.type)&&(a=!0)),!this.editedRecord.ganttProperties.isAutoSchedule){var n=this.parent.taskFields;-1!==[n.constraintDate,n.constraintType].indexOf(e.field)&&(a=!0)}return a},o.prototype.isParentValid=function(e){if(e.length>0)for(var t=0;t<e.length;t++){if(e[t].uniqueID===this.beforeOpenArgs.rowData.uniqueID){this.isValidData=!1;break}if(e[t].hasChildRecords&&this.isParentValid(e[t].childRecords),!this.isValidData)break}return this.isValidData},o.prototype.renderPredecessorTab=function(e){var i=this,n=this.parent,o=this.beforeOpenArgs[e],l=this.parent.columnByField[this.parent.taskFields.dependency];(!1===l.allowEditing||l.isPrimaryKey||this.parent.readOnly)&&(o.editSettings.allowEditing=!1,o.editSettings.allowAdding=!1,o.editSettings.allowDeleting=!1);var d=this.beforeOpenArgs.rowData,h=[];this.taskNameCollection(),this.isEdit&&(h=this.predecessorEditCollection(d),this.updatePredecessorDropDownData(d));var p;d[this.parent.taskFields.dependency]&&(p=d[this.parent.taskFields.dependency].split(",").length),0!==this.preTableCollection.length&&this.preTableCollection.length!==p||(o.editSettings.allowAdding=!1),o.actionComplete=this.gridActionComplete.bind(this),o.dataSource=h,o.enableAdaptiveUI=this.parent.enableAdaptiveUI,o.enableRtl=this.parent.enableRtl,o.locale=this.parent.locale,o.actionBegin=this.gridActionBegin.bind(this),o.columns[1].edit={write:function(e){"add"===t.getValue("requestType",e)&&t.setValue("rowData.uniqueId",M(),e);new s.ComboBox({dataSource:new a.DataManager(i.idCollection),popupHeight:"180px",allowCustom:!1,enableRtl:i.parent.enableRtl,fields:{value:"text"},value:e.rowData.name,change:function(e){var a=t.closest(e.element,"tr").querySelector("#"+i.parent.element.id+"DependencyTabContainerid");a&&(t.isNullOrUndefined(e.itemData)||t.isNullOrUndefined(e.item)?a.value="":a.value=e.itemData.id)},autofill:!0}).appendTo(e.element)},read:function(e){return e.ej2_instances[0].value}};var u,c=this.getDialogTabIndex("Dependency");this.isEdit?this.isEdit&&(u=this.parent.editDialogFields[c]):u=this.parent.addDialogFields[c];var g,f=[],m=[];t.isNullOrUndefined(u)||t.isNullOrUndefined(u.additionalParams)||(g=u.additionalParams),this.setInjected(u,g,r.Grid,void 0,f,o,m),r.Grid.Inject(r.Edit,r.Page,r.Toolbar,r.ForeignKey),(o=vt({},o,g)).toolbar=o.toolbar.concat(f);var y=this.updateColumns(m,o.columns);o.columns=y;var D=new r.Grid(o),v=this.createDivElement("e-dependent-div",n.element.id+""+e+"TabContainer");return D.appendTo(v),v},o.prototype.updateColumns=function(e,t){var i={};return e.forEach(function(e){"object"==typeof e&&(i[e.field]=e)}),t.forEach(function(t){if("object"==typeof t){var a=t.field;i[a]?Object.assign(i[a],t):e.push(t)}}),e},o.prototype.gridActionBegin=function(e){var i=this,a=this.beforeOpenArgs.Dependency;if("add"===e.requestType||"beginEdit"===e.requestType){var r="add"!==e.requestType;this.idCollection=t.extend([],[],this.preTableCollection,!0);for(var n=a.dataSource,s=this,o=0;o<=n.length;o++)!function(a){s.idCollection.forEach(function(s,o){if(s.id===t.getValue("id",n[a])){var l=t.getValue("rowData",e);if(r&&t.getValue("id",l)===s.id)return;i.idCollection.splice(i.idCollection.indexOf(s),1)}})}(o)}},o.prototype.gridActionComplete=function(e){if("save"===e.requestType){var i=this.parent.editModule.dialogModule.dialog.querySelector("#"+this.parent.element.id+"DependencyTabContainer");if(!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(e.rows)&&e.rows.length===this.preTableCollection.length){var a=i.ej2_instances[0];a&&(a.editSettings.allowAdding=!1)}}},o.prototype.updateResourceCollection=function(e,i){if(!t.isNullOrUndefined(e.data)&&Object.keys(e.data).length){var a=document.querySelector("#"+i).ej2_instances[0];if(!t.isNullOrUndefined(a)&&a.getSelectedRecords().length>0){var r=a.getSelectedRecords(),n=void 0,s=[];for(n=0;n<r.length;n++){var o=r[n];t.isNullOrUndefined(o.taskData)||t.isNullOrUndefined(o.taskData[this.parent.resourceFields.unit])||t.isNullOrUndefined(e.data[this.parent.resourceFields.unit])||o.taskData[this.parent.resourceFields.id]!==e.data[this.parent.resourceFields.id]||(o.taskData[this.parent.resourceFields.unit]=e.data[this.parent.resourceFields.unit]),s.push(r[n].taskData)}this.ganttResources=t.extend([],s)}else this.ganttResources=[]}else this.ganttResources=[]},o.prototype.renderResourceTab=function(e){var i=this,a=this.parent,s=a.resourceFields,o=this.beforeOpenArgs.rowData;("beforeOpenEditDialog"===this.beforeOpenArgs.requestType&&!t.isNullOrUndefined(this.editedRecord[this.parent.taskFields.resourceInfo])||"beforeOpenAddDialog"===this.beforeOpenArgs.requestType&&!t.isNullOrUndefined(this.editedRecord[this.parent.taskFields.resourceInfo]))&&"object"==typeof this.editedRecord[this.parent.taskFields.resourceInfo]&&this.parent.setRecordValue("resourceInfo",this.parent.dataOperation.setResourceInfo(this.editedRecord),o.ganttProperties,!0);var l=o.ganttProperties.resourceInfo,d=this.beforeOpenArgs[e];d.enableAdaptiveUI=this.parent.enableAdaptiveUI,d.enableRtl=this.parent.enableRtl,d.locale=this.parent.locale;var h=a.element.id+""+e+"TabContainer",p=[];if(p=t.extend([],[],a.resources,!0),this.parent.dataOperation.updateResourceUnit(p),!t.isNullOrUndefined(l)){var u=void 0,c=l.length,g=void 0,f=p.length;for(u=0;u<c;u++)for(g=0;g<f;g++)l[u][s.id]===p[g][s.id]&&(p[g][s.unit]=l[u][s.unit])}d.dataSource=p;var m=o.ganttProperties.resourceInfo;if(this.isEdit&&!t.isNullOrUndefined(m))for(T=0;T<m.length;T++)this.ganttResources.push(m[T]);else if(!this.isEdit&&!t.isNullOrUndefined(m))for(T=0;T<m.length;T++)this.ganttResources.push(m[T]);d.actionBegin=function(e){if(e.rowData&&e.columnName===i.parent.resourceFields.unit&&i.editedRecord.ganttProperties.resourceInfo)for(var t=0;t<i.editedRecord.ganttProperties.resourceInfo.length;t++)i.editedRecord.ganttProperties.resourceInfo[t][i.parent.resourceFields.id]===e.rowData[i.parent.resourceFields.id]&&(i.editedRecord.ganttProperties.resourceInfo[t][i.parent.resourceFields.unit]=e.value)},d.rowSelected=function(e){i.updateResourceCollection(e,h),i.currentResources=i.ganttResources},d.rowDeselected=function(e){i.updateResourceCollection(e,h),i.currentResources=i.ganttResources};var y,D=this.createDivElement("e-resource-div",h),v=this.getDialogTabIndex("Resources");this.isEdit?this.isEdit&&(y=this.parent.editDialogFields[v]):y=this.parent.addDialogFields[v];var k,b,w=[];if(!t.isNullOrUndefined(y)&&!t.isNullOrUndefined(y.additionalParams)){k=y.additionalParams;for(var T in k)if(Object.prototype.hasOwnProperty.call(k,T))switch(T){case"allowFiltering":n.TreeGrid.Inject(n.Filter);break;case"allowSorting":n.TreeGrid.Inject(n.Sort);break;case"allowPaging":n.TreeGrid.Inject(n.Page);break;case"editSettings":n.TreeGrid.Inject(n.Edit);break;case"aggregates":case"showColumnChooser":n.TreeGrid.Inject(n.Aggregate);break;case"showColumnMenu":n.TreeGrid.Inject(r.ColumnMenu);break;case"contextMenuItems":n.TreeGrid.Inject(r.ContextMenu);break;case"allowResizing":n.TreeGrid.Inject(n.Resize);break;case"allowReordering":n.TreeGrid.Inject(n.Reorder);break;case"detailTemplate":n.TreeGrid.Inject(r.DetailRow);break;case"allowRowDragAndDrop":n.TreeGrid.Inject(n.RowDD);break;case"searchSettings":n.TreeGrid.Inject(r.Search);break;case"selectionSettings":n.TreeGrid.Inject(n.Selection);break;case"toolbar":(b=k.toolbar).map(function(e){switch(e){case"Search":n.TreeGrid.Inject(r.Search);break;case"Print":n.TreeGrid.Inject(r.Print);break;case"PdfExport":n.TreeGrid.Inject(r.PdfExport);break;case"ExcelExport":n.TreeGrid.Inject(r.ExcelExport)}}),t.isNullOrUndefined(b)||(d.toolbar=[],d.toolbar=d.toolbar.concat(b)),n.TreeGrid.Inject(n.Toolbar);break;case"enableVirtualization":n.TreeGrid.Inject(n.VirtualScroll);break;case"columns":w=d.columns}}n.TreeGrid.Inject(n.Selection,n.Filter,n.Edit,n.VirtualScroll,n.Toolbar),d=vt({},d,k);var S=this.updateColumns(w,d.columns);d.columns=S;var P=!1;d.showColumnMenu&&(P=d.showColumnMenu,d.showColumnMenu=!1);var C=new n.TreeGrid(d),R=this.parent.columnByField[this.parent.taskFields.resourceInfo];return(!1===R.allowEditing||R.isPrimaryKey||this.parent.readOnly)&&(C.allowSelection=!1,C.allowFiltering=!1,C.editSettings.allowEditing=!1),C.dataBound=function(){if(P&&(C.showColumnMenu=!0),i.parent.editDialogFields.length>=1&&"Resources"===i.parent.editDialogFields[0].type){var e=i.parent.element.id+"ResourcesTabContainer";i.resourceSelection(e)}},C.appendTo(D),D},o.prototype.resourceSelection=function(e){var i=this,a=document.querySelector("#"+e).ej2_instances[0];this.parent.triggeredColumnName="";var r=a.getCurrentViewRecords(),n=this.ganttResources;n&&n.length>0&&r.forEach(function(e,r){for(var s=0;s<n.length;s++)e.taskData[i.parent.resourceFields.id]!==n[s][i.parent.resourceFields.id]||t.isNullOrUndefined(a.selectionModule)||-1!==a.getSelectedRowIndexes().indexOf(r)||a.selectRow(r)})},o.prototype.renderCustomTab=function(e,t){return this.renderGeneralTab(e,t)},o.prototype.renderNotesTab=function(e){var i=this.parent,a=this.beforeOpenArgs[e];a.enableHtmlSanitizer=this.parent.enableHtmlSanitizer;var r,n=this.editedRecord.ganttProperties,s=this.createDivElement("",i.element.id+""+e+"TabContainer"),o=this.getDialogTabIndex("Notes"),l=[];this.isEdit?this.isEdit&&(r=this.parent.editDialogFields[o]):r=this.parent.addDialogFields[o];var d;if(!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(r.additionalParams)){d=r.additionalParams;for(var p in d)if(Object.prototype.hasOwnProperty.call(d,p))switch(p){case"toolbarSettings":for(var u=0;u<d.toolbarSettings.items.length;u++){var c=d.toolbarSettings.items[u];if(c)switch(c){case"Image":h.RichTextEditor.Inject(h.Image);break;case"CreateTable":h.RichTextEditor.Inject(h.Table);break;case"EmojiPicker":h.RichTextEditor.Inject(h.EmojiPicker);break;case"FileManager":h.RichTextEditor.Inject(h.FileManager);break;case"FormatPainter":h.RichTextEditor.Inject(h.FormatPainter)}}t.isNullOrUndefined(d.toolbarSettings.items)||(l=a.toolbarSettings.items),h.RichTextEditor.Inject(h.Toolbar);break;case"editorMode":h.RichTextEditor.Inject(h.MarkdownEditor)}}h.RichTextEditor.Inject(h.Toolbar,h.Link,h.HtmlEditor,h.QuickToolbar,h.Count,h.Table),a.value=n.notes;var g=this.parent.columnByField[this.parent.taskFields.notes];return(!1===g.allowEditing||g.isPrimaryKey||this.parent.readOnly)&&(a.enabled=!1),(a=vt({},a,d)).toolbarSettings.items=l.concat(a.toolbarSettings.items),new h.RichTextEditor(a).appendTo(s),s},o.prototype.renderInputElements=function(e,i){var a,n,s,o=this,l=this.parent.element.id,d=this.editedRecord,h=this.createDivElement("e-edit-form-column");this.parent.enableAdaptiveUI&&(n=t.createElement("tr"),s=t.createElement("td"),h.style.width="100%");var p={column:i,data:d};if(t.isNullOrUndefined(i.edit)||t.isNullOrUndefined(i.edit.create)||!t.isNullOrUndefined(i.edit.params))a=this.createInputElement("",l+""+i.field,i.field),h.appendChild(a);else{var u=i.edit.create;(a="string"==typeof u?(u=r.getObject(u,window))(p):i.edit.create(p)).className="",a.setAttribute("type","text"),a.setAttribute("id",l+""+i.field),a.setAttribute("name",i.field),a.setAttribute("title",i.field),h.appendChild(a)}if(e.enabled=t.isNullOrUndefined(e.enabled)?!this.isCheckIsDisabled(i):e.enabled,i.field===this.parent.taskFields.constraintType&&d.hasChildRecords){var c=this.parent.treeGridModule.getLocalizedConstraintTypeText("AsSoonAsPossible"),g=this.parent.treeGridModule.getLocalizedConstraintTypeText("StartNoEarlierThan"),f=this.parent.treeGridModule.getLocalizedConstraintTypeText("FinishNoLaterThan");e.dataSource=e.dataSource.filter(function(e){var t=e.text;return t===c||t===g||t===f})}if(i.field===this.parent.taskFields.duration)if(t.isNullOrUndefined(i.valueAccessor)){if(t.isNullOrUndefined(i.edit)){m=d.ganttProperties;e.value=this.parent.dataOperation.getDurationString(m.duration,m.durationUnit)}}else if("string"==typeof i.valueAccessor){y=r.getObject(i.valueAccessor,window);e.value=y(i.field,d,i)}else e.value=i.valueAccessor(i.field,d,i);else if(i.field===this.parent.taskFields.baselineDuration)if(t.isNullOrUndefined(i.valueAccessor)){if(t.isNullOrUndefined(i.edit)){var m=d.ganttProperties;e.value=this.parent.dataOperation.getDurationString(m.baselineDuration,m.durationUnit)}}else if("string"==typeof i.valueAccessor){var y=r.getObject(i.valueAccessor,window);e.value=y(i.field,d,i)}else e.value=i.valueAccessor(i.field,d,i);else"booleanedit"===i.editType?!0===d[i.field]?e.checked=!0:e.checked=!1:this.parent.taskFields[i.field]||"numericedit"!==i.editType||""!==d[i.field]&&0!==d[i.field]?e.value=d[i.field]:e.value=0;if(t.isNullOrUndefined(i.edit)||t.isNullOrUndefined(i.edit.write)||!t.isNullOrUndefined(i.edit.params))(v=new this.inputs[i.editType](e)).appendTo(a);else{var D=i.edit.write,v=void 0;v="string"==typeof D?(D=r.getObject(D,window))({column:i,rowData:d,element:a}):i.edit.write({column:i,rowData:d,element:a}),i.field===this.parent.taskFields.duration&&(v.change=function(e){o.validateScheduleFields(e,i,o.parent)})}return this.parent.enableAdaptiveUI?(s.appendChild(h),n.appendChild(s),n):h},o.prototype.taskNameCollection=function(){var e=this.parent.flatData;this.preTaskIds=[],this.preTableCollection=[];for(var t=0;t<e.length;t++){var i=e[t];if(this.parent.allowParentDependency){var a=i;if(i.parentUniqueID===this.beforeOpenArgs.rowData.uniqueID)this.isValidData=!1;else do{if(a.parentItem&&(a=this.parent.flatData[this.parent.ids.indexOf(a.parentItem.taskId)]).uniqueID===this.beforeOpenArgs.rowData.uniqueID){this.isValidData=!1;break}}while(a.parentItem);if(i.hasChildRecords&&this.isValidData&&(this.isValidData=this.isParentValid(i.childRecords)),!this.isValidData){this.isValidData=!0;continue}}else if(i.hasChildRecords)continue;var r="ResourceView"===this.parent.viewType?i.ganttProperties.taskId.toString():i.ganttProperties.rowUniqueID.toString(),n={id:r,text:r+"-"+i.ganttProperties.taskName,value:r};this.preTaskIds.push(n.id),this.preTableCollection.push(n)}},o.prototype.predecessorEditCollection=function(e){var i=[],a=e.ganttProperties;if(this.isEdit&&!t.isNullOrUndefined(this.parent.taskFields.dependency)&&!t.isNullOrUndefined(e)&&!t.isNullOrUndefined(a.predecessor))for(var r=a.predecessor,n=this.preTableCollection,s=0;s<r.length;s++){var o=r[s].from.toString(),l={};if(("ResourceView"===this.parent.viewType?a.taskId:a.rowUniqueID).toString()!==o){l.id=o;for(var d=0;d<n.length;d++)if(n[d].value===o){l.name=n[d].text;break}l.type=r[s].type;var h=r[s].offset,p=r[s].offsetUnit;l.offset=this.parent.dataOperation.getDurationString(h,p),l.uniqueId=M(),i.push(l)}}return i},o.prototype.updatePredecessorDropDownData=function(e){var t=-1,i="ResourceView"===this.parent.viewType?e.ganttProperties.taskId.toString():e.ganttProperties.rowUniqueID.toString();t=this.preTaskIds.indexOf(i),this.preTableCollection.splice(t,1),this.preTaskIds.splice(t,1),this.validSuccessorTasks(e,this.preTaskIds,this.preTableCollection)},o.prototype.validSuccessorTasks=function(e,t,i){var a=this,r=e.ganttProperties;if(r.predecessor&&r.predecessor.length>0){var n=r.predecessor,s="ResourceView"===this.parent.viewType?r.taskId.toString():r.rowUniqueID.toString();n.forEach(function(e){if(e.from.toString()===s){var r=e.to,n=-1;(n=t.indexOf(r))>-1&&(t.splice(n,1),i.splice(n,1));for(var o=a.parent.connectorLineModule.getRecordByID(r),l=!0,d=0,h=a.processedId;d<h.length;d++){var p=h[d];if(p.id===o.ganttProperties.taskId&&Array.isArray(p.value)&&Array.isArray(o.ganttProperties.predecessor)&&p.value.length===o.ganttProperties.predecessor.length){for(var u=!0,c=0;c<p.value.length;c++)if(p.value[c]!==o.ganttProperties.predecessor[c]){u=!1;break}if(u){l=!1;break}}}l&&(a.processedId.push({id:o.ganttProperties.taskId,value:o.ganttProperties.predecessor}),a.validSuccessorTasks(o,t,i))}})}},o.prototype.getPredecessorType=function(){var e=[this.parent.getPredecessorTextValue("SS"),this.parent.getPredecessorTextValue("SF"),this.parent.getPredecessorTextValue("FS"),this.parent.getPredecessorTextValue("FF")];return[{id:"FS",text:e[2],value:e[2]},{id:"FF",text:e[3],value:e[3]},{id:"SS",text:e[0],value:e[0]},{id:"SF",text:e[1],value:e[1]}]},o.prototype.initiateDialogSave=function(){if(this.isEdit?this.parent.initiateEditAction(!0):this.addedRecord={},this.currentResources&&(this.currentResources=null),this.parent.undoRedoModule&&this.parent.isUndoRedoItemPresent("Edit")&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.isEdit)){this.parent.undoRedoModule.createUndoCollection();var e={};if(e.action="DialogEdit",e.modifiedRecords=[],this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=e,"ResourceView"===this.parent.viewType){var i=!1;if(this.rowData.ganttProperties.resourceInfo){if(this.ganttResources.length!==this.rowData.ganttProperties.resourceInfo.length)i=!0;else for(l=0;l<this.rowData.ganttProperties.resourceInfo.length;l++)if(this.ganttResources[l][this.parent.resourceFields.id]!==this.rowData.ganttProperties.resourceInfo[l][this.parent.resourceFields.id]){i=!0;break}}else this.ganttResources.length>0&&(i=!0);if(i){var a={};a.deletedIndexes=[];var r="T"+this.rowData.ganttProperties.taskId,n=[];this.parent.taskIds.reduce(function(e,t){if(t===r)if(0===this.ganttResources.length)n.push(this.parent.flatData[this.parent.taskIds.indexOf(t)]);else for(var i=this.parent.getTaskByUniqueID(this.parent.flatData[this.parent.taskIds.indexOf(t)].parentUniqueID),a=0;a<this.ganttResources.length;a++)i.ganttProperties.taskId!==this.ganttResources[a][this.parent.resourceFields.id]&&-1===n.indexOf(this.parent.flatData[this.parent.taskIds.indexOf(t)])&&n.push(this.parent.flatData[this.parent.taskIds.indexOf(t)])}.bind(this),[]),this.parent.undoRedoModule.findPosition(t.extend([],[],n,!0),a,"deletedIndexes"),this.indexes?this.indexes.deletedIndexes[this.indexes.deletedIndexes.length]=a.deletedIndexes[0]:this.indexes=a}}}this.parent.updateDuration=!0;for(var s=this.parent,o=this.beforeOpenArgs.tabModel.items,l=0;l<o.length;l++){var d=o[l].content,h=d.getAttribute("id");t.isNullOrUndefined(h)&&""===h||("General"===(h=(h=h.replace(s.element.id,"")).replace("TabContainer",""))?this.updateGeneralTab(d,!1):"Advanced"===h?this.updateAdvancedTab(d):"Dependency"===h?(this.isFromDialogPredecessor=!0,this.updatePredecessorTab(d),this.isFromDialogPredecessor=!1):"Notes"===h?this.updateNotesTab(d):"Resources"===h?(this.updateResourceTab(d),this.dialogEditValidationFlag=!1):-1!==h.indexOf("Custom")?this.updateCustomTab(d):"Segments"===h&&this.updateSegmentsData(d))}if(!this.disableUndo&&this.parent.undoRedoModule&&(this.parent.undoRedoModule.getUndoCollection.splice(this.parent.undoRedoModule.getUndoCollection.length-1,1),this.parent.toolbarModule&&0===this.parent.undoRedoModule.getUndoCollection.length&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!1),this.parent.totalUndoAction--),this.isEdit){this.parent.editModule.editedRecord=this.rowData,this.parent.dataOperation.updateWidthLeft(this.rowData);var p={data:this.rowData,action:"DialogEditing"};this.parent.editModule.initiateUpdateAction(p)}else if(this.parent.editModule.editedRecord=this.addedRecord,"ResourceView"===this.parent.viewType){var u=t.extend({},this.addedRecord,!0);if(u[this.parent.taskFields.resourceInfo].length)for(l=0;l<u[this.parent.taskFields.resourceInfo].length;l++){var h=u[this.parent.taskFields.resourceInfo][l].toString(),c=this.parent.getTaskIds().indexOf("R"+h.toString());if(-1!==c){this.parent.editModule.addRecord(this.addedRecord,"Child",c);break}}else this.parent.editModule.addRecord(this.addedRecord,"Bottom")}else this.parent.editModule.addRecord(this.addedRecord,this.parent.editSettings.newRowPosition,this.parent.selectedRowIndex);return!0},o.prototype.compareObjects=function(e,i){return!t.isNullOrUndefined(e)&&e.every(function(e,t){for(var a=i[t],r=Object.keys(e),n=0;n<r.length;n++)if("startDate"===r[n]||"endDate"===r[n]){if(e[r[n]].getTime()!==a[r[n]].getTime())return!0}else if("duration"===r[n]&&e[r[n]]!==a[r[n]])return!0;return!1})},o.prototype.updateSegmentTaskData=function(e){var t=this.parent.taskFields;if(this.isEdit){var i=this.rowData.ganttProperties.segments;this.parent.setRecordValue("taskData."+this.parent.taskFields.segments,e,this.rowData);var a=this.parent.dataOperation.setSegmentsInfo(this.rowData,!0);(this.parent.enableUndoRedo&&i&&a&&i.length!==a.length||!i&&a||i&&!a||this.compareObjects(i,a))&&(this.disableUndo=!0),this.parent.setRecordValue("segments",a,this.rowData.ganttProperties,!0),this.parent.setRecordValue("segments",this.parent.dataOperation.setSegmentsInfo(this.rowData,!1),this.rowData.ganttProperties,!0),e.length<=0&&this.validateDuration(this.rowData)}else this.addedRecord[t.segments]=e},o.prototype.updateSegmentsData=function(e){var t,i=e.ej2_instances[0],a=i.isEdit;i.isEdit&&i.endEdit(),t=a&&i.currentViewData.length!==i.dataSource.length?i.dataSource:i.currentViewData,this.updateSegmentTaskData(t)},o.prototype.updateGeneralTab=function(e,i){var a=this.parent,n=e.childNodes,s={};this.isEdit||(s=this.addedRecord);for(var o=0;o<n.length;o++){var l=n[o],d=l.querySelector('input[id^="'+a.element.id+'"]')||l.querySelector('textarea[id^="'+a.element.id+'"]'),h=Array.from(l.children).find(function(e){return e.classList.contains("e-richtexteditor")});if(h&&(d=h),d){var p=d.id.replace(a.element.id,""),u=l.querySelector("#"+a.element.id+p).ej2_instances[0];if("stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType&&p===this.parent.taskFields.id){var c=u.value.toString();u.value=c}var g=a.columnByField[p];if((p===this.parent.taskFields.duration||this.parent.taskFields.baselineDuration?parseInt(this.rowData[p],10)!==parseInt(u.value,10):this.rowData[p]!==u.value)&&(this.disableUndo=!0),t.isNullOrUndefined(g)||t.isNullOrUndefined(g.edit)||t.isNullOrUndefined(g.edit.read)||!t.isNullOrUndefined(g.edit.params))if(t.isNullOrUndefined(g)||"booleanedit"!==g.editType){if(p===this.parent.taskFields.duration||p===this.parent.taskFields.baselineDuration){var f=parseFloat(String(u.value));s[p]=f}else if(this.parent.weekWorkingTime.length>0&&u.value&&(p===this.parent.taskFields.startDate||p===this.parent.taskFields.baselineStartDate)){var m=p===this.parent.taskFields.startDate?this.beforeOpenArgs.rowData.ganttProperties.startDate:this.beforeOpenArgs.rowData.ganttProperties.baselineStartDate;if(this.parent.getStartTime(m)/3600===m.getHours()){var y=this.parent.getStartTime(u.value);this.parent.dataOperation.setTime(y,u.value),s[p]=u.value}else s[p]=u.value}else s[p]=u.value;this.parent.enableHtmlSanitizer&&"string"==typeof u.value&&(u.value=t.SanitizeHtmlHelper.sanitize(u.value),s[p]=u.value)}else d instanceof HTMLInputElement&&!0===d.checked?s[p]=!0:s[p]=!1;else{var D=g.edit.read;"string"==typeof D?(D=r.getObject(D,window),s[p]=D(d,u.value)):s[p]=g.edit.read(d,u.value)}}}this.isEdit&&(i||this.updateScheduleProperties(this.editedRecord,this.rowData),a.editModule.validateUpdateValues(s,this.rowData,!0))},o.prototype.updateAdvancedTab=function(e){for(var t=this.parent,i=e.childNodes,a=this.isEdit?this.rowData:this.addedRecord,n=0;n<i.length;n++){var s=i[n],o=s.querySelector('input[id^="'+t.element.id+'"]'),l=Array.from(s.children).find(function(e){return e.classList.contains("e-richtexteditor")});if(l&&(o=l),o){var d=o.id.replace(t.element.id,""),h=s.querySelector("#"+t.element.id+d).ej2_instances[0],p=t.columnByField[d];if(this.rowData[d]!==h.value&&(this.disableUndo=!0),p&&p.edit&&!p.edit.params){var u=p.edit.read;"string"==typeof u&&(u=r.getObject(u,window)),a[d]=u(o,h.value)}else a[d]=o.ej2_instances[0].value}}this.isEdit&&t.editModule.validateUpdateValues(a,this.rowData,!0)},o.prototype.updateScheduleProperties=function(e,i){this.parent.setRecordValue("startDate",e.ganttProperties.startDate,i.ganttProperties,!0),this.parent.setRecordValue("endDate",e.ganttProperties.endDate,i.ganttProperties,!0),this.parent.setRecordValue("duration",e.ganttProperties.duration,i.ganttProperties,!0),this.parent.setRecordValue("baselineDuration",e.ganttProperties.baselineDuration,i.ganttProperties,!0),this.parent.setRecordValue("baselineStartDate",e.ganttProperties.baselineStartDate,i.ganttProperties,!0),this.parent.setRecordValue("baselineEndDate",e.ganttProperties.baselineEndDate,i.ganttProperties,!0),this.parent.setRecordValue("durationUnit",e.ganttProperties.durationUnit,i.ganttProperties,!0),this.parent.setRecordValue("work",e.ganttProperties.work,i.ganttProperties,!0),this.parent.setRecordValue("type",e.ganttProperties.taskType,i.ganttProperties,!0),this.parent.setRecordValue("taskType",e.ganttProperties.taskType,i.ganttProperties,!0),this.parent.setRecordValue("resourceNames",e.ganttProperties.resourceNames,i.ganttProperties,!0),this.parent.setRecordValue("resourceInfo",e.ganttProperties.resourceInfo,i.ganttProperties,!0),t.isNullOrUndefined(this.parent.taskFields.startDate)||this.parent.dataOperation.updateMappingData(i,"startDate"),t.isNullOrUndefined(this.parent.taskFields.endDate)||this.parent.dataOperation.updateMappingData(i,"endDate"),t.isNullOrUndefined(this.parent.taskFields.duration)||(this.parent.dataOperation.updateMappingData(i,"duration"),this.parent.setRecordValue("durationUnit",e.ganttProperties.durationUnit,this.rowData,!0),0===this.rowData.ganttProperties.duration?this.parent.setRecordValue("isMilestone",!0,i.ganttProperties,!0):this.parent.setRecordValue("isMilestone",!1,this.rowData.ganttProperties,!0)),t.isNullOrUndefined(this.parent.taskFields.baselineDuration)||this.parent.dataOperation.updateMappingData(i,"baselineDuration"),t.isNullOrUndefined(this.parent.taskFields.work)||this.parent.dataOperation.updateMappingData(this.rowData,"work"),t.isNullOrUndefined(this.parent.taskFields.manual)||this.parent.dataOperation.updateMappingData(this.rowData,"manual"),t.isNullOrUndefined(this.parent.taskFields.type)||this.parent.dataOperation.updateMappingData(this.rowData,"type"),t.isNullOrUndefined(this.parent.taskFields.resourceInfo)||this.parent.dataOperation.updateMappingData(this.rowData,"resourceInfo")},o.prototype.getMatchingPrefix=function(e,t){for(var i=e.name.split("-"),a="",r=0;r<i.length;r++)if(a=""===a?i[r]:a+"-"+i[r],-1!==t.indexOf(a))return[a];return[]},o.prototype.updatePredecessorTab=function(e){var i=e.ej2_instances[0];i.isEdit&&i.endEdit();for(var a=i.dataSource,r=[],n=[],s="",o=[],l=[],d=0;d<a.length;d++){var h=a[d],p=this.getMatchingPrefix(h,this.parent.ids);if((t.isNullOrUndefined(h.id)||h.id!==p[0]&&!t.isNullOrUndefined(p[0]))&&(h.id=p[0]),-1===o.indexOf(h.id)){if("ProjectView"===this.parent.viewType){var u=this.parent.flatData[this.parent.ids.indexOf(h.id)];u.hasChildRecords&&-1===l.indexOf(u)&&l.push(u)}var c=h.id+h.type;h.offset&&-1!==h.offset.indexOf("-")?c+=h.offset:c+="+"+h.offset,r.push(c),o.push(h.id)}}this.isEdit?(r.length>0?(n=this.parent.predecessorModule.calculatePredecessor(r.join(","),this.rowData),this.parent.setRecordValue("predecessor",n,this.rowData.ganttProperties,!0),s=this.parent.predecessorModule.getPredecessorStringValue(this.rowData)):(n=[],this.parent.setRecordValue("predecessor",n,this.rowData.ganttProperties,!0),s=""),this.parent.undoRedoModule&&this.parent.undoRedoModule.getUndoCollection.length>0&&(this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1].connectedRecords=l,""===s&&(t.isNullOrUndefined(this.rowData.ganttProperties.predecessorsName)||this.rowData.ganttProperties.predecessorsName===s||this.disableUndo)||(this.disableUndo=!0)),this.parent.setRecordValue("predecessorsName",s,this.rowData.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,s,this.rowData),this.parent.setRecordValue(this.parent.taskFields.dependency,s,this.rowData),this.parent.predecessorModule.updateUnscheduledDependency(this.rowData)):this.addedRecord[this.parent.taskFields.dependency]=r.length>0?r.join(","):""},o.prototype.updateResourceTab=function(e){var i=this,a=e.ej2_instances[0];a&&a.grid.endEdit();var r=this.ganttResources;r.forEach(function(e){null===e[i.parent.resourceFields.unit]&&(e[i.parent.resourceFields.unit]=0)}),"ResourceView"!==this.parent.viewType||t.isNullOrUndefined(this.rowData.ganttProperties)||(JSON.stringify(this.ganttResources)!==JSON.stringify(this.rowData.ganttProperties.resourceInfo)?(this.isResourceUpdate=!0,this.previousResource=t.isNullOrUndefined(this.rowData.ganttProperties.resourceInfo)?[]:this.rowData.ganttProperties.resourceInfo.slice()):this.isResourceUpdate=!1);var n=[];if(this.isEdit){if((this.rowData.ganttProperties.resourceInfo&&r.length!==this.rowData.ganttProperties.resourceInfo.length||t.isNullOrUndefined(this.rowData.ganttProperties.resourceInfo)&&r.length>0)&&(this.disableUndo=!0),!this.disableUndo)for(s=0;s<r.length;s++)if(JSON.stringify(r[s])!==JSON.stringify(this.rowData.ganttProperties.resourceInfo[s])){this.disableUndo=!0;break}this.parent.setRecordValue("resourceInfo",r,this.editedRecord.ganttProperties,!0),this.parent.dataOperation.updateMappingData(this.editedRecord,"resourceInfo"),this.parent.editModule.updateResourceRelatedFields(this.editedRecord,"resource"),this.validateDuration(this.editedRecord),this.updateScheduleProperties(this.editedRecord,this.rowData)}else{for(var s=0;s<r.length;s++)n.push(r[s][this.parent.resourceFields.id]),this.isAddNewResource=!0;this.addedRecord[this.parent.taskFields.resourceInfo]=n}},o.prototype.updateNotesTab=function(e){var t=this.parent,i=e.ej2_instances[0];this.isEdit?(t.columnByField[t.taskFields.notes].disableHtmlEncode?(this.rowData.ganttProperties.notes===i.getText()||null===this.rowData.ganttProperties.notes&&""===i.getText()||this.disableUndo||(this.disableUndo=!0),i.getHtml().includes("href")?this.parent.setRecordValue("notes",i.getHtml(),this.rowData.ganttProperties,!0):this.parent.setRecordValue("notes",i.getText(),this.rowData.ganttProperties,!0)):(this.rowData.ganttProperties.notes===i.getHtml()||null===this.rowData.ganttProperties.notes&&"<p><br></p>"===i.getHtml()||this.disableUndo||(this.disableUndo=!0),this.parent.setRecordValue("notes",i.getHtml(),this.rowData.ganttProperties,!0)),t.dataOperation.updateMappingData(this.rowData,"notes")):t.columnByField[t.taskFields.notes].disableHtmlEncode?this.addedRecord[this.parent.taskFields.notes]=i.getText():this.addedRecord[this.parent.taskFields.notes]=i.getHtml()},o.prototype.updateCustomTab=function(e){this.updateGeneralTab(e,!0)},o}(),bt=function(){return(bt=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)},wt=function(){function e(e){this.validationPredecessor=null,this.confirmPredecessorDialog=null,this.predecessorIndex=null,this.childRecord=null,this.validatedId=[],this.validatedOffsetIds=[],this.isPublicDependencyDelete=!1,this.parent=e,this.dateValidateModule=this.parent.dateValidationModule,this.parent.on("initPredessorDialog",this.initPredecessorValidationDialog,this)}return e.prototype.updateConnectorLineEditElement=function(e){var i=this.getConnectorLineHoverElement(e.target);t.getValue("editModule.taskbarEditModule.taskBarEditAction",this.parent)||this.highlightConnectorLineElements(i)},e.prototype.getConnectorLineHoverElement=function(e){var t=f(e,"e-connector-line"),i=f(e,"e-connector-line-arrow"),a=f(e,"e-critical-line"),r=f(e,"e-critical-line-arrow");return t||i||a||r?f(e,"e-connector-line-container"):null},e.prototype.highlightConnectorLineElements=function(e){e?e!==this.connectorLineElement&&(this.removeHighlight(),this.addHighlight(e)):this.removeHighlight()},e.prototype.addHighlight=function(e){this.connectorLineElement=e;var t=e.querySelector(".e-connector-line");t&&t.setAttribute("stroke-width",(this.parent.connectorLineModule.lineStroke+1).toString())},e.prototype.removeHighlight=function(){if(this.connectorLineElement){var e=this.connectorLineElement.querySelector(".e-connector-line");e&&e.setAttribute("stroke-width",this.parent.connectorLineModule.lineStroke.toString()),this.connectorLineElement=null}},e.prototype.getEditedConnectorLineString=function(e){for(var i,a,r,n,s,o=new Set,l=document.createDocumentFragment(),d=0;d<e.length;d++)if(i=e[d],a=i.ganttProperties.predecessor)for(var h=0;h<a.length;h++){var p=a[h],u="parent"+p.from+"child"+p.to;if(this.parent.connectorLineModule.removeConnectorLineById(u),r=this.parent.connectorLineModule.getRecordByID(p.from),n=this.parent.connectorLineModule.getRecordByID(p.to),(!this.parent.allowParentDependency&&(r&&r.expanded||n&&n.expanded)||this.parent.allowParentDependency&&(r||n))&&(s=this.parent.predecessorModule.updateConnectorLineObject(r,n,p),!t.isNullOrUndefined(s)&&!o.has(s.connectorLineId))){var c=this.parent.connectorLineModule.getConnectorLineTemplate(s);o.add(s.connectorLineId),l.appendChild(c)}}return l},e.prototype.refreshEditedRecordConnectorLine=function(e){this.parent.connectorLineModule.removePreviousConnectorLines(this.parent.previousRecords),this.parent.connectorLineModule.expandedRecords=this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.updatedRecords:this.parent.getExpandedRecords(this.parent.updatedRecords);var t=this.getEditedConnectorLineString(e);t&&this.parent.connectorLineModule.svgObject.appendChild(t)},e.prototype.idFromPredecessor=function(e){for(var i=e.split(","),a=[],r=[],n=[],s=0;s<i.length;s++){var o=[],l=void 0,d=!1,h=void 0,p=!1,u=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,c=i[s].split("-"),g=void 0;if(6===c.length&&(c[4]=c[4]+"-"+c[5],c.pop()),5===c.length&&c[4].length>=12&&(g=i[s].substring(0,36),u.test(g)&&(p=!0)),i[s].includes("-")){if(i[s].includes("-")&&(i[s].includes("days")||i[s].includes("day"))){var f=i[s].split(/-(?=\d)/);f.length>0&&(h=f[f.length-1])}if(i[s].includes("-")&&/[A-Za-z]/.test(h)){var m=i[s].indexOf(h);-1!==m&&(l=i[s].substring(0,m-1)).includes("-")&&(d=!0)}}if(p){var y=void 0,D=void 0;1===(y=c[4].split("+")).length?r[0]=i[s]:(D=y[1].length,r[0]=i[s].slice(0,-(D+1)),r[1]=y[1]),c[4].indexOf("-")>=0&&(1===(y=c[4].split("-")).length?r[0]=i[s]:(D=y[1].length,r[0]=i[s].slice(0,-(D+1)),r[1]=y[1]))}else d&&l.includes("-")?r[0]=l:(r=i[s].split("+"),i[s].indexOf("-")>=0&&(r=i[s].split("-")));t.isNullOrUndefined(r[0])||(-1===("ResourceView"===this.parent.viewType?this.parent.getTaskIds():this.parent.ids).indexOf(r[0])?-1!==r[0].indexOf(" ")?(1===(n=r[0].split(" ")).length&&(n=r[0].match(/(\d+|[A-z]+)/g)),o.push(n[0])):1===r[0].length||2===r[0].length?o.push(r[0]):o.push(r[0].slice(0,-2)):o.push(r[0])),a.push(o.join(""))}return a},e.prototype.predecessorValidation=function(e,i){for(var a,r,n=i.rowUniqueID,s=0;s<e.length;s++){a=e[s];var o=[];e.slice(0).splice(s,1);for(var l=this;null!==a;){var d=function(){var e=[];return-1!==o.indexOf(a)?"break":t.isNullOrUndefined(l.parent.connectorLineModule.getRecordByID(a))?{value:!1}:(r=l.parent.connectorLineModule.getRecordByID(a).ganttProperties,!t.isNullOrUndefined(r.predecessor)&&r.predecessor.length>0&&r.predecessor.forEach(function(t){r.rowUniqueID.toString()!==t.from&&e.push(t.from.toString())}),n.toString()===r.rowUniqueID.toString()||-1!==e.indexOf(n.toString())?{value:!1}:(o.push(a),!t.isNullOrUndefined(r.predecessor)&&r.predecessor.length>0?void(a=r.predecessor[0].from):"break"))}();if("object"==typeof d)return d.value;if("break"===d)break}}return!0},e.prototype.validatePredecessorRelation=function(e,i){var a,r,n=!0,s="ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;if(!t.isNullOrUndefined(i)&&i.length>0){a=this.idFromPredecessor(i);for(var o=this,l=0;l<a.length;l++){var d=function(i){if(o.parent.allowParentDependency){if(parseInt(a[a.length-1],10)!==e[o.parent.taskFields.id]){var l=o.parent.ids.indexOf(a[a.length-1]),d=o.parent.currentViewData[l];d&&e&&(n=o.parent.predecessorModule.validateParentPredecessor(d,e))}}else if(!o.checkParentRelation(e,a))return{value:!1};var h=[],p=!0;if(a.slice(0).forEach(function(e){-1===h.indexOf(e)?h.push(e):p=!1}),!p)return{value:!1};r=a[i];var u=[];a.slice(0).splice(i,1);for(;null!==r;){var c=function(){var i,a,n=[];if(-1!==u.indexOf(r))return"break";if(t.isNullOrUndefined(o.parent.connectorLineModule.getRecordByID(r.toString())))return{value:!1};if(a=o.parent.connectorLineModule.getRecordByID(r.toString()).ganttProperties,!t.isNullOrUndefined(a.predecessor)&&a.predecessor.length>0&&a.predecessor.forEach(function(e,t){a.rowUniqueID.toString()!==e.from&&(n.push(e.from.toString()),i=t)}),s.toString()===a.rowUniqueID.toString()||-1!==n.indexOf(s.toString()))return{value:!1};if(u.push(r),t.isNullOrUndefined(a.predecessor)||!(a.predecessor.length>0))return"break";var l=void 0;return n.length>1?l=o.predecessorValidation(n,e.ganttProperties):1===n.length&&(r=a.predecessor[i].from),!1===l?{value:!1}:void 0}();if("object"==typeof c)return c;if("break"===c)break}}(l);if("object"==typeof d)return d.value}}return n},e.prototype.addPredecessor=function(e,i){var a=t.isNullOrUndefined(e.ganttProperties.predecessorsName)||""===e.ganttProperties.predecessorsName?i:e.ganttProperties.predecessorsName+","+i;this.updatePredecessorHelper(e,a)},e.prototype.removePredecessor=function(e){this.isPublicDependencyDelete=!0,this.updatePredecessorHelper(e,null)},e.prototype.updatePredecessor=function(e,t,i){return this.updatePredecessorHelper(e,t,i)},e.prototype.updatePredecessorHelper=function(e,i,a){if(t.isUndefined(i)||this.validatePredecessorRelation(e,i)){this.parent.isOnEdit=!0;var r=[];t.isNullOrUndefined(i)||""===i||(r=this.parent.predecessorModule.calculatePredecessor(i,e)),this.parent.setRecordValue("predecessor",r,e.ganttProperties,!0);var n=this.parent.predecessorModule.getPredecessorStringValue(e);this.parent.setRecordValue("predecessorsName",n,e.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,n,e),this.parent.setRecordValue(this.parent.taskFields.dependency,n,e);var s={};return s.action=a&&a.action&&"CellEditing"===a.action?a.action:this.parent.contextMenuModule&&this.parent.contextMenuModule.isCntxtMenuDependencyDelete||this.isPublicDependencyDelete?"DeleteConnectorLine":"DrawConnectorLine",s.data=e,this.parent.editModule.initiateUpdateAction(s),!0}e.taskData[this.parent.taskFields.dependency]&&(e.taskData[this.parent.taskFields.dependency]=null);var o=i+" is an invalid relation for task "+this.parent.taskFields.id+". Kindly ensure the "+this.parent.taskFields.dependency+" field contains only valid predecessor relations.";return this.parent.trigger("actionFailure",{error:o}),!1},e.prototype.checkParentRelation=function(e,t){var i=e;if(i&&i.parentItem&&-1!==t.indexOf(i.parentItem.taskId.toString()))return!1;for(var a=this,r=0;r<t.length;r++){var n=function(e){var i=a.parent.currentViewData.filter(function(i){return i&&i.ganttProperties.rowUniqueID.toString()===t[e].toString()});if(i[0]&&i[0].hasChildRecords)return{value:!1}}(r);if("object"==typeof n)return n.value}return!0},e.prototype.initPredecessorValidationDialog=function(){if(this.parent.taskFields.dependency&&this.parent.isInPredecessorValidation){var e=t.createElement("div",{id:this.parent.element.id+"_dialogValidationRule"});this.parent.element.appendChild(e),this.renderValidationDialog()}},e.prototype.renderValidationDialog=function(){var e=this.parent.taskFields,t=e.constraintType&&e.constraintDate?this.parent.localeObj.getConstant("schedulingConflicts"):this.parent.localeObj.getConstant("validateEditing"),a=this.parent.element.id+"_dialogValidationRule",r=document.getElementById(a);r?(r.innerHTML="",r.style.zIndex="2000"):((r=document.createElement("div")).id=a,r.style.zIndex="2000",document.body.appendChild(r));var n=new i.Dialog({header:t,isModal:!0,enableRtl:this.parent.enableRtl,visible:!1,width:"50%",showCloseIcon:!0,zIndex:2e3,close:this.validationDialogClose.bind(this),content:"",buttons:[{click:this.validationDialogOkButton.bind(this),buttonModel:{content:this.parent.localeObj.getConstant("okText"),isPrimary:!0}},{click:this.validationDialogCancelButton.bind(this),buttonModel:{content:this.parent.localeObj.getConstant("cancel")}}],target:document.body,animationSettings:{effect:"None"}});n.isStringTemplate=!0,n.appendTo("#"+a),this.parent.validationDialogElement=n},e.prototype.validationDialogOkButton=function(){var e=this.parent.currentEditedArgs,t=document.getElementById(this.parent.element.id+"_ValidationAddlineOffset"),i=document.getElementById(this.parent.element.id+"_ValidationRemoveline"),a=document.getElementById(this.parent.element.id+"_ValidationCancel"),r=document.getElementById(this.parent.element.id+"_RemoveConstraint"),n=document.getElementById(this.parent.element.id+"_RemoveDependency"),s=document.getElementById(this.parent.element.id+"_CancelChange"),o=this.parent.editModule.violationArgs,l=o.matchedModifiedTask,d=o.args,h=o.matchedParedRecord||null;if(null!==r&&r.checked)l.ganttProperties.constraintType=4,this.parent.constraintViolationType="",this.parent.editModule.initiateSaveAction(d);else if(null!==n&&n.checked){var p=[],u=h?h.ganttProperties.taskId:d.data.ganttProperties.taskId;if(l&&Array.isArray(l.ganttProperties.predecessor))for(var c=0,g=l.ganttProperties.predecessor;c<g.length;c++){var f=g[c];if(f.from.toString()===u.toString()){p=[f];break}}if(this.parent.editModule.reUpdatePreviousRecords(void 0,void 0,l.uniqueID),l.parentItem&&l.parentItem.taskId){var m=this.parent.getRecordByID(l.parentItem.taskId);this.parent.dataOperation.updateParentItems(m,!0)}this.removePredecessors(l,p),this.parent.editModule.initiateSaveAction(d)}else null!==s&&s.checked&&(e.validateMode.respectLink=!0,this.applyPredecessorOption());!(null!==r&&r.checked||null!==n&&n.checked||null!==s&&s.checked)&&(e.validateMode.preserveLinkWithEditing=null!==t&&t.checked,e.validateMode.removeLink=null!==i&&i.checked,e.validateMode.respectLink=null!==a&&a.checked,this.applyPredecessorOption()),this.parent.validationDialogElement.hide()},e.prototype.validationDialogCancelButton=function(){this.parent.constraintViolationType="",this.parent.currentEditedArgs.validateMode.respectLink=!0,this.applyPredecessorOption(),this.parent.validationDialogElement.hide()},e.prototype.validationDialogClose=function(e){this.parent.constraintViolationType="",t.getValue("isInteracted",e)&&(this.parent.currentEditedArgs.validateMode.respectLink=!0,this.applyPredecessorOption())},e.prototype.applyPredecessorOption=function(){var e=this.parent.currentEditedArgs,t=e.data;if(e.validateMode.respectLink)this.parent.editModule.reUpdatePreviousRecords(),this.parent.chartRowsModule.refreshRecords([e.data]);else if(e.validateMode.removeLink)this.checkChildRecords(t),this.parent.editModule.updateEditedTask(e.editEventArgs);else if(e.validateMode.preserveLinkWithEditing){var i;if(this.parent.updateOffsetOnTaskbarEdit){var a=t.ganttProperties.taskId.toString();t.ganttProperties.predecessor&&t.ganttProperties.predecessor.forEach(function(e){if(a===e.from)return void(i=e.to)})}this.parent.editModule.updateEditedTask(e.editEventArgs);var r=[];this.processPredecessor(i,r),r=[]}},e.prototype.compareArrays=function(e,t){return e.length===t.length&&JSON.stringify(e)===JSON.stringify(t)},e.prototype.processPredecessor=function(e,t){var i=this;if(e){var a=this.parent.getRecordByID(e);if(a&&a.ganttProperties&&a.ganttProperties.predecessor){this.parent.connectorLineEditModule.validatedOffsetIds=[],this.calculateOffset(a);var r=!0,n=this.validatedId.find(function(e){return e.id===a.ganttProperties.taskId});if(n){var s=n.value;this.compareArrays(s,a.ganttProperties.predecessor)&&(r=!1)}a.ganttProperties.predecessor.forEach(function(e){a.ganttProperties.taskId===e.from&&r&&t&&-1===t.indexOf(e.to)&&(i.processPredecessor(e.to,t),t.push(e.to))})}}},e.prototype.checkChildRecords=function(e){var i=[],a=e.ganttProperties.taskId,r=e.ganttProperties.predecessor;if(t.isNullOrUndefined(r))this.validationPredecessor=r;else{for(s=0;s<r.length;s++){var n=r[s];n.to.toString()===a.toString()&&i.push(n)}this.validationPredecessor=i}if(t.isNullOrUndefined(this.validationPredecessor)||this.removePredecessors(e,this.validationPredecessor),e.childRecords.length>0)for(var s=0;s<e.childRecords.length;s++){var o=e.childRecords[s];this.validationPredecessor=o.ganttProperties.predecessor,t.isNullOrUndefined(this.validationPredecessor)||this.removePredecessors(o,this.validationPredecessor),o.childRecords.length>0&&this.checkChildRecords(o)}else if(!t.isNullOrUndefined(e.parentItem)){var l=this.parent.getRecordByID(e.parentItem.taskId);this.validationPredecessor=l.ganttProperties.predecessor,this.removePredecessors(l,this.validationPredecessor)}},e.prototype.compareObjects=function(e,t){var i=Object.keys(e).filter(function(e){return"offset"!==e}),a=Object.keys(t).filter(function(e){return"offset"!==e});return i.length===a.length&&i.every(function(i){return e[i]===t[i]})},e.prototype.getOffsetForPredecessor=function(e,i,a){var r=0;if((i.ganttProperties.startDate||i.ganttProperties.endDate)&&(a.ganttProperties.startDate||a.ganttProperties.endDate)){var n=void 0,s=void 0,o=void 0,l=void 0;switch(e.type){case"FS":n=new Date((i.ganttProperties.endDate||i.ganttProperties.startDate).getTime()),s=new Date((a.ganttProperties.startDate||a.ganttProperties.endDate).getTime());break;case"SS":n=new Date((i.ganttProperties.startDate||i.ganttProperties.endDate).getTime()),s=new Date((a.ganttProperties.startDate||a.ganttProperties.endDate).getTime());break;case"SF":n=new Date((i.ganttProperties.startDate||i.ganttProperties.endDate).getTime()),s=new Date((a.ganttProperties.endDate||a.ganttProperties.startDate).getTime());break;case"FF":n=new Date((i.ganttProperties.endDate||i.ganttProperties.startDate).getTime()),s=new Date((a.ganttProperties.endDate||a.ganttProperties.startDate).getTime())}if(n.getTime()<s.getTime())n=this.dateValidateModule.checkStartDate(n),s=this.dateValidateModule.checkEndDate(s,null),l=!1;else{var d=new Date(n.getTime());n=this.dateValidateModule.checkStartDate(s),s=this.dateValidateModule.checkEndDate(d,null),l=!0}n.getTime()<s.getTime()&&(o=this.dateValidateModule.getDuration(n,s,e.offsetUnit,!0,!1),this.parent.durationUnit===e.offsetUnit&&(i.ganttProperties.startDate&&t.isNullOrUndefined(i.ganttProperties.endDate)||t.isNullOrUndefined(i.ganttProperties.startDate)&&i.ganttProperties.endDate)&&(o-=1),r=l?-o:o)}return r},e.prototype.calculateOffset=function(e,i){var a=this;if(this.parent.autoCalculateDateScheduling&&!(this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)&&e&&null!==m(e.ganttProperties)){var r=t.extend([],e.ganttProperties.predecessor,[],!0),n=this.parent.predecessorModule.getValidPredecessor(e);if(n.length>0){this.cumulativePredecessorChanges=r;for(var s=this,o=0;o<n.length;o++)!function(i){var a=n[parseInt(i.toString(),10)],o=s.parent.connectorLineModule.getRecordByID(a.from);s.parent.undoRedoModule&&s.parent.undoRedoModule.isUndoRedoPerformed&&"ProjectView"===s.parent.viewType&&0===o.ganttProperties.predecessor.filter(function(e){return e.from===n[i].from&&e.to===n[i].to}).length&&o.ganttProperties.predecessor.push(n[i]);var l=s.getOffsetForPredecessor(a,o,e),d=P(a,"from",r,"to");-1!==d&&(r[d].offset=l);var h=t.extend([],o.ganttProperties.predecessor,[],!0),p=P(a,"from",h,"to");-1!==p&&(h[p].offset=l),s.parent.setRecordValue("predecessor",h,o.ganttProperties,!0)}(o)}else{var l=e.ganttProperties.predecessor;l&&l.length>0&&l.forEach(function(e){-1===a.validatedOffsetIds.indexOf(e.to)&&("ResourceView"===a.parent.viewType?(a.validatedOffsetIds.push(e.to),a.calculateOffset(a.parent.getRecordByID(a.parent.taskIds.indexOf("T"+e.to).toString()),!0)):a.calculateOffset(a.parent.getRecordByID(e.to),!0))})}if(i)this.parent.setRecordValue("predecessor",r,e.ganttProperties,!0);else if(0===n.length&&(this.cumulativePredecessorChanges=[]),r&&r.length>0&&this.cumulativePredecessorChanges&&this.cumulativePredecessorChanges.length>0){var d=r.map(function(e){var t=a.cumulativePredecessorChanges.find(function(t){return a.compareObjects(t,e)});return t?bt({},t):null}).filter(function(e){return null!==e});this.parent.setRecordValue("predecessor",d,e.ganttProperties,!0)}var h=this.parent.predecessorModule.getPredecessorStringValue(e);if(this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,h,e),this.parent.setRecordValue(this.parent.taskFields.dependency,h,e),this.parent.setRecordValue("predecessorsName",h,e.ganttProperties,!0),-1===this.validatedOffsetIds.indexOf(e.ganttProperties.taskId.toString())&&this.validatedOffsetIds.push(e.ganttProperties.taskId.toString()),e.hasChildRecords)for(o=0;o<e.childRecords.length;o++)-1===this.validatedOffsetIds.indexOf(e.childRecords[o].ganttProperties.taskId.toString())&&e.childRecords[o].ganttProperties.predecessor&&e.childRecords[o].ganttProperties.predecessor.length>0&&this.calculateOffset(e.childRecords[o]);else if(e.parentItem)for(var p=e.parentItem;p;){var u=this.parent.getRecordByID(p.taskId),c=u.ganttProperties.taskId.toString();if(-1===this.validatedOffsetIds.indexOf(c)&&u.ganttProperties.predecessor&&u.ganttProperties.predecessor.length>0){this.calculateOffset(u);break}p=u.parentItem}}},e.prototype.removePredecessors=function(e,i){var a=t.extend([],[],e.ganttProperties.predecessor,!0);if(!t.isNullOrUndefined(i)){for(var r=i.length,n=0;n<r;n++){var s=this.parent.connectorLineModule.getRecordByID(i[n].from),o=t.extend([],[],s.ganttProperties.predecessor,!0),l=P(i[n],"from",a,"to");a.splice(l,1);var d=P(i[parseInt(n.toString(),10)],"from",o,"to");o.splice(d,1),this.parent.setRecordValue("predecessor",o,s.ganttProperties,!0)}if(a.length!==e.ganttProperties.predecessor.length){this.parent.setRecordValue("predecessor",a,e.ganttProperties,!0);var h=this.parent.predecessorModule.getPredecessorStringValue(e);this.parent.setRecordValue("predecessorsName",h,e.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,h,e),this.parent.setRecordValue(this.parent.taskFields.dependency,h,e)}}},e.prototype.formatViolationType=function(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2")},e.prototype.openValidationDialog=function(e){var t=this.validationDialogTemplate(e);this.parent.validationDialogElement.setProperties({content:t});var i=this.parent.element.id+"_dialogValidationRule_dialog-content";this.parent.validationDialogElement.element.querySelector("#"+i).style.paddingTop="10px";var a=this.parent.element.id+"_dialogValidationRule_dialog-header";this.parent.validationDialogElement.element.querySelector("#"+a).style.padding="8px 16px",this.parent.validationDialogElement.show()},e.prototype.validationDialogTemplate=function(e){var i=this.parent.element.id,a=t.createElement("div",{className:"e-ValidationContent"}),r=t.getValue("task",e),n=t.getValue("parentTask",e),s=t.getValue("violationType",e),o=r.ganttProperties.taskName,l=t.isNullOrUndefined(this.parent.dateFormat)?"M/d/yyyy h:mm a":this.parent.dateFormat,d=this.parent.getFormatedDate(r.ganttProperties.startDate,l),h=[o,n.ganttProperties.taskName],p="";"MustStartOn"!==s&&"MustFinishOn"!==s&&"StartNoLaterThan"!==s&&"FinishNoLaterThan"!==s&&("taskBeforePredecessor_FS"===s?p=this.parent.localeObj.getConstant("taskBeforePredecessor_FS"):"taskAfterPredecessor_FS"===s?p=this.parent.localeObj.getConstant("taskAfterPredecessor_FS"):"taskBeforePredecessor_SS"===s?p=this.parent.localeObj.getConstant("taskBeforePredecessor_SS"):"taskAfterPredecessor_SS"===s?p=this.parent.localeObj.getConstant("taskAfterPredecessor_SS"):"taskBeforePredecessor_FF"===s?p=this.parent.localeObj.getConstant("taskBeforePredecessor_FF"):"taskAfterPredecessor_FF"===s?p=this.parent.localeObj.getConstant("taskAfterPredecessor_FF"):"taskBeforePredecessor_SF"===s?p=this.parent.localeObj.getConstant("taskBeforePredecessor_SF"):"taskAfterPredecessor_SF"===s&&(p=this.parent.localeObj.getConstant("taskAfterPredecessor_SF")),p=S(p,h));var c='<div id="'+i+'_ValidationText">'+p+"</div>",g=this.parent.localeObj.getConstant("cancelLink"),f=S(this.parent.localeObj.getConstant("removeLink"),[o,d]),m=S(this.parent.localeObj.getConstant("removeConstraint"),[s=this.formatViolationType(s),o]),y=S(this.parent.localeObj.getConstant("preserveLink"),[o,d]),D='\n <table>\n <tr><td><input type="radio" id="'+i+'_ValidationCancel" name="ValidationRule" checked/></td></tr>\n <tr><td><input type="radio" id="'+i+'_ValidationRemoveline" name="ValidationRule"/></td></tr>\n <tr><td><input type="radio" id="'+i+'_RemoveConstraint" name="ValidationRule"/></td></tr>\n <tr><td><input type="radio" id="'+i+'_ValidationAddlineOffset" name="ValidationRule"/></td></tr>\n </table>';a.innerHTML=c+D;var v=a.querySelector("#"+i+"_ValidationCancel"),k=a.querySelector("#"+i+"_ValidationRemoveline"),b=a.querySelector("#"+i+"_RemoveConstraint"),w=a.querySelector("#"+i+"_ValidationAddlineOffset");return v&&new u.RadioButton({label:g,name:"ValidationRule",value:"cancel",checked:!0,cssClass:"e-constraint-label"}).appendTo(v),k&&new u.RadioButton({label:f,name:"ValidationRule",value:"removeLink",cssClass:"e-constraint-label"}).appendTo(k),b&&new u.RadioButton({label:m,name:"ValidationRule",value:"removeConstraint",cssClass:"e-constraint-label"}).appendTo(b),w&&new u.RadioButton({label:y,name:"ValidationRule",value:"preserveLink",cssClass:"e-constraint-label"}).appendTo(w),a.querySelectorAll(".e-radio-wrapper").forEach(function(e){e.style.padding="6px",e.querySelector("span").style.fontWeight="normal"}),a},e.prototype.openConstraintValidationDialog=function(e){var t=this.constraintValidationDialogTemplate(e),i=this.parent.localeObj.getConstant("schedulingConflicts");this.parent.validationDialogElement.setProperties({content:t,header:i});var a=this.parent.element.id+"_dialogValidationRule_dialog-content";this.parent.validationDialogElement.element.querySelector("#"+a).style.paddingTop="10px";var r=this.parent.element.id+"_dialogValidationRule_dialog-header";this.parent.validationDialogElement.element.querySelector("#"+r).style.padding="8px 16px",this.parent.validationDialogElement.show()},e.prototype.constraintValidationDialogTemplate=function(e){var i=this.parent.element.id,a=e.parentRecord,r=e.record,n=e.predecessorLink,s=e.violationType,o=t.createElement("div",{className:"e-ValidationContent"}),l=r.ganttProperties.taskName,d="";a&&a.ganttProperties&&a.ganttProperties.taskName&&(d=a.ganttProperties.taskName);var h=this.parent.localeObj.getConstant("removeConstraint"),p=this.parent.localeObj.getConstant("removeDependency"),c=this.parent.localeObj.getConstant("cancelChange"),g=S(h,[s=this.formatViolationType(s),l]),f=S(p,[d,l]),m="<table>";m+='\n <tr>\n <td>\n <input type="radio" id="'+i+'_RemoveConstraint" name="ValidationRule" />\n </td>\n </tr>',void 0!==n&&(m+='\n <tr>\n <td>\n <input type="radio" id="'+i+'_RemoveDependency" name="ValidationRule"/>\n </td>\n </tr>'),m+='\n <tr>\n <td>\n <input type="radio" id="'+i+'_CancelChange" name="ValidationRule"/>\n </td>\n </tr>',m+="</table>",o.innerHTML=m;var y=o.querySelector("#"+i+"_RemoveConstraint");if(y&&new u.RadioButton({label:g,name:"ValidationRule",value:"removeConstraint",checked:!0,cssClass:"e-constraint-label"}).appendTo(y),void 0!==n){var D=o.querySelector("#"+i+"_RemoveDependency");D&&new u.RadioButton({label:f,name:"ValidationRule",value:"removeDependency",cssClass:"e-constraint-label"}).appendTo(D)}var v=o.querySelector("#"+i+"_CancelChange");return v&&new u.RadioButton({label:c,name:"ValidationRule",value:"cancelChange",cssClass:"e-constraint-label"}).appendTo(v),o.querySelectorAll(".e-radio-wrapper").forEach(function(e){e.style.padding="6px",e.querySelector("span").style.fontWeight="normal"}),o},e.prototype.validateTypes=function(e,i){var a,r=this.parent.predecessorModule.getValidPredecessor(e);this.validationPredecessor=[];var n,s,o,l=this.parent.predecessorModule.getPredecessorDate(e,r,null,!0);s=i?i.ganttProperties:e.ganttProperties;for(var d=this.parent.allowUnscheduledTasks&&t.isNullOrUndefined(l)?s.endDate:this.dateValidateModule.getEndDate(l,s.duration,s.durationUnit,s,!1),h=0;h<r.length;h++){a=this.parent.connectorLineModule.getRecordByID(r[h].from);var p=null;if("FS"===r[h].type)(0!==(g=this.parent.dateValidationModule.getDuration(l,s.startDate,this.parent.durationUnit,s.isAutoSchedule,s.isMilestone,!0))||0===g&&!1===this.parent.updateOffsetOnTaskbarEdit)&&(s.startDate<l?(this.validationPredecessor.push(r[parseInt(h.toString(),10)]),p="taskBeforePredecessor_FS"):s.startDate>l&&(this.validationPredecessor.push(r[parseInt(h.toString(),10)]),p="taskAfterPredecessor_FS"));else if("SS"===r[h].type){var u=new Date(s.endDate),c=new Date(l);s.startDate<l?(this.validationPredecessor.push(r[parseInt(h.toString(),10)]),p="taskBeforePredecessor_SS"):s.startDate>l?(this.validationPredecessor.push(r[parseInt(h.toString(),10)]),p="taskAfterPredecessor_SS"):this.parent.allowUnscheduledTasks&&t.isNullOrUndefined(s.startDate)&&t.isNullOrUndefined(s.duration)&&u.setHours(0,0,0,0)<c.setHours(0,0,0,0)?(this.validationPredecessor.push(r[parseInt(h.toString(),10)]),p="taskBeforePredecessor_SS"):this.parent.allowUnscheduledTasks&&t.isNullOrUndefined(s.startDate)&&t.isNullOrUndefined(s.duration)&&u.setHours(0,0,0,0)>c.setHours(0,0,0,0)&&(this.validationPredecessor.push(r[parseInt(h.toString(),10)]),p="taskAfterPredecessor_SS")}else if("FF"===r[h].type)(0!==(g=this.parent.dateValidationModule.getDuration(l,a.ganttProperties.endDate,this.parent.durationUnit,a.ganttProperties.isAutoSchedule,a.ganttProperties.isMilestone,!0))||0===g&&!1===this.parent.updateOffsetOnTaskbarEdit)&&(d<=a.ganttProperties.endDate?(this.validationPredecessor.push(r[parseInt(h.toString(),10)]),p="taskBeforePredecessor_FF"):d>a.ganttProperties.endDate&&(this.validationPredecessor.push(r[parseInt(h.toString(),10)]),p="taskAfterPredecessor_FF"));else if("SF"===r[h].type){var g=this.parent.dateValidationModule.getDuration(a.ganttProperties.startDate,d,this.parent.durationUnit,a.ganttProperties.isAutoSchedule,a.ganttProperties.isMilestone,!0);(0!==g||0===g&&!1===this.parent.updateOffsetOnTaskbarEdit)&&(d<a.ganttProperties.startDate?(this.validationPredecessor.push(r[parseInt(h.toString(),10)]),p="taskBeforePredecessor_SF"):d>=a.ganttProperties.startDate&&(this.validationPredecessor.push(r[parseInt(h.toString(),10)]),p="taskAfterPredecessor_SF"))}!t.isNullOrUndefined(p)&&t.isNullOrUndefined(o)&&(n=a,o=p)}return{parentTask:n,task:e,violationType:o}},e.prototype.addRemovePredecessor=function(e){var i=this.parent.previousRecords[e.uniqueID],a=t.isNullOrUndefined(e.ganttProperties.predecessor)?e.ganttProperties.predecessor:e.ganttProperties.predecessor.slice();if(i&&i.ganttProperties&&i.ganttProperties.hasOwnProperty("predecessor")){var r=i.ganttProperties.predecessor;if(!t.isNullOrUndefined(r))for(var n=this,s=0;s<r.length;s++)!function(i){var a=n.parent.connectorLineModule.getRecordByID(r[parseInt(i.toString(),10)].from);if(a===e)0===e.ganttProperties.predecessor.filter(function(e){return r[i].from===e.from&&r[i].to===e.to}).length&&(e.parentItem&&n.parent.taskFields.dependency&&e.ganttProperties.predecessor&&n.parent.allowParentDependency?r[i].from!==e.parentItem.taskId&&r[i].to!==e.parentItem.taskId&&e.ganttProperties.predecessor.push(r[parseInt(i.toString(),10)]):e.ganttProperties.predecessor.push(r[parseInt(i.toString(),10)]));else{var s=t.extend([],[],a.ganttProperties.predecessor,!0),o=P(r[parseInt(i.toString(),10)],"from",s,"to");-1!==o&&(s.splice(o,1),n.parent.setRecordValue("predecessor",s,a.ganttProperties,!0))}}(s);if(!t.isNullOrUndefined(a))for(var o=this,l=0;l<a.length;l++)!function(e){var i=o.parent.connectorLineModule.getRecordByID(a[parseInt(e.toString(),10)].from),r=t.extend([],[],i.ganttProperties.predecessor,!0);0===r.filter(function(t){return a[e].from===t.from&&a[e].to===t.to}).length&&(r.push(a[parseInt(e.toString(),10)]),o.parent.setRecordValue("predecessor",r,i.ganttProperties,!0))}(l)}},e.prototype.removePredecessorByIndex=function(e,i){if(this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed){this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection();var a={};a.action="DeleteDependency",a.modifiedRecords=t.extend([],[e],[],!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=a}var r=e.ganttProperties.predecessor,n=r.splice(i,1),s=this.parent.connectorLineModule.getRecordByID(n[0].from).ganttProperties.predecessor,o=P(n[0],"from",s,"to");s.splice(o,1);var l=this.parent.predecessorModule.getPredecessorStringValue(e);r.push(n[0]),this.parent.connectorLineEditModule.updatePredecessor(e,l)},e.prototype.renderPredecessorDeleteConfirmDialog=function(){this.confirmPredecessorDialog=new i.Dialog({width:"320px",isModal:!0,enableRtl:this.parent.enableRtl,content:this.parent.localeObj.getConstant("confirmPredecessorDelete"),buttons:[{click:this.confirmOkDeleteButton.bind(this),buttonModel:{content:this.parent.localeObj.getConstant("okText"),isPrimary:!0}},{click:this.confirmCloseDialog.bind(this),buttonModel:{content:this.parent.localeObj.getConstant("cancel")}}],target:this.parent.element,animationSettings:{effect:"None"}});var e=t.createElement("div",{id:this.parent.element.id+"_deletePredecessorConfirmDialog"});this.parent.element.appendChild(e),this.confirmPredecessorDialog.isStringTemplate=!0,this.confirmPredecessorDialog.appendTo(e)},e.prototype.confirmCloseDialog=function(){this.confirmPredecessorDialog.destroy()},e.prototype.confirmOkDeleteButton=function(){this.removePredecessorByIndex(this.childRecord,this.predecessorIndex),this.confirmPredecessorDialog.destroy()},e}(),Tt=function(){return(Tt=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)},St=function(){function r(e){if(this.isFromDeleteMethod=!1,this.targetedRecords=[],this.isNewRecordAdded=!1,this.isValidatedEditedRecord=!1,this.createArray=!0,this.violationArgs={},this.deletedRecord=[],this.canReset=!1,this.isFlatDataHaveUnAsignedTask=!1,this.updateParentRecords=[],this.isaddtoBottom=!1,this.confirmDialog=null,this.taskbarMoved=!1,this.predecessorUpdated=!1,this.isBreakLoop=!1,this.isDialogEditing=!1,this.deletedTaskDetails=[],this.parent=e,this.parent.predecessorModule.validatedChildItems=[],this.parent.editSettings.allowEditing&&"Auto"===this.parent.editSettings.mode&&(this.cellEditModule=new gt(this.parent)),this.parent.taskFields.dependency&&(this.parent.connectorLineEditModule=new wt(this.parent)),(this.parent.editSettings.allowAdding||this.parent.editSettings.allowEditing&&("Dialog"===this.parent.editSettings.mode||"Auto"===this.parent.editSettings.mode))&&(this.dialogModule=new kt(this.parent)),this.parent.editSettings.allowTaskbarEditing&&(this.taskbarEditModule=new Dt(this.parent)),this.parent.editSettings.allowDeleting){var i=t.createElement("div",{id:this.parent.element.id+"_deleteConfirmDialog"});this.parent.element.appendChild(i),this.renderDeleteConfirmDialog()}this.parent.treeGrid.recordDoubleClick=this.recordDoubleClick.bind(this),this.parent.treeGrid.editSettings.allowAdding=this.parent.editSettings.allowAdding,this.parent.treeGrid.editSettings.allowDeleting=this.parent.editSettings.allowDeleting,this.parent.treeGrid.editSettings.showDeleteConfirmDialog=this.parent.editSettings.showDeleteConfirmDialog,this.parent.treeGrid.editSettings.allowNextRowEdit=this.parent.editSettings.allowNextRowEdit,"Dialog"===this.parent.editSettings.mode&&n.TreeGrid.Inject(n.Edit),this.updateDefaultColumnEditors()}return r.prototype.getModuleName=function(){return"edit"},r.prototype.updateDefaultColumnEditors=function(){for(var e=[this.parent.taskFields.id,this.parent.taskFields.progress,this.parent.taskFields.resourceInfo,this.parent.taskFields.type,"taskType"],i=0;i<e.length;i++)if(!t.isNullOrUndefined(e[i])&&e[i].length>0){var a=this.parent.getColumnByField(e[parseInt(i.toString(),10)],this.parent.treeGridModule.treeGridColumns);a&&(a.field===this.parent.taskFields.id?this.updateIDColumnEditParams(a):a.field===this.parent.taskFields.progress&&t.isNullOrUndefined(a.edit)?this.updateProgessColumnEditParams(a):a.field===this.parent.taskFields.resourceInfo?this.updateResourceColumnEditor(a):a.field!==this.parent.taskFields.type&&"taskType"!==a.field||this.updateTaskTypeColumnEditor(a))}},r.prototype.updateIDColumnEditParams=function(e){var t={min:0,decimals:0,enableRtl:this.parent.enableRtl,validateDecimalOnType:!0,format:"n0",showSpinButton:!1};this.updateEditParams(e,t)},r.prototype.updateProgessColumnEditParams=function(e){var t={min:0,enableRtl:this.parent.enableRtl,decimals:0,validateDecimalOnType:!0,max:100,format:"n0"};this.updateEditParams(e,t)},r.prototype.updateEditParams=function(e,i){t.isNullOrUndefined(e.edit)?(e.edit={},e.edit.params={}):t.isNullOrUndefined(e.edit.params)&&(e.edit.params={}),t.extend(i,e.edit.params),e.edit.params=i,this.parent.getColumnByField(e.field,this.parent.ganttColumns).edit=e.edit},r.prototype.updateResourceColumnEditor=function(e){if(this.parent.treeGridModule.currentEditRow={},this.parent.editSettings.allowEditing&&t.isNullOrUndefined(e.edit)&&"Auto"===this.parent.editSettings.mode){e.editType="dropdownedit",e.edit=this.getResourceEditor();var i=this.parent.getColumnByField(e.field,this.parent.ganttColumns);i.editType="dropdownedit",i.edit=e.edit}},r.prototype.getResourceEditor=function(){var e,i=this,r=this.parent.resourceFields,n={};return s.MultiSelect.Inject(s.CheckBoxSelection),n.write=function(t){i.parent.treeGridModule.currentEditRow={},(e=new s.MultiSelect({dataSource:new a.DataManager(i.parent.resources),fields:{text:r.name,value:r.id},enableRtl:i.parent.enableRtl,mode:"CheckBox",showDropDownIcon:!0,popupHeight:"350px",delimiterChar:",",value:i.parent.treeGridModule.getResourceIds(t.rowData)})).appendTo(t.element)},n.read=function(e){var a=e.ej2_instances[0].value,n=[];t.isNullOrUndefined(a)&&(a=[]);for(var s=0;s<a.length;s++)for(var o=0;o<i.parent.resources.length;o++)if(i.parent.resources[o][r.id]===a[s]){n.push(i.parent.resources[o][r.name]);break}return i.parent.treeGridModule.currentEditRow[i.parent.taskFields.resourceInfo]=a,n.join(",")},n.destroy=function(){e&&e.destroy()},n},r.prototype.updateTaskTypeColumnEditor=function(e){if(this.parent.editSettings.allowEditing&&t.isNullOrUndefined(e.edit)&&"Auto"===this.parent.editSettings.mode){e.editType="dropdownedit",e.edit=this.getTaskTypeEditor();var i=this.parent.getColumnByField(e.field,this.parent.ganttColumns);i.editType="dropdownedit",i.edit=e.edit}},r.prototype.getTaskTypeEditor=function(){var e,i=this,r={},n=[{ID:1,Value:"FixedUnit"},{ID:2,Value:"FixedWork"},{ID:3,Value:"FixedDuration"}];return r.write=function(r){i.parent.treeGridModule.currentEditRow={},(e=new s.DropDownList({dataSource:new a.DataManager(n),enableRtl:i.parent.enableRtl,fields:{value:"Value"},popupHeight:"350px",value:t.getValue("taskType",r.rowData.ganttProperties)})).appendTo(r.element)},r.read=function(e){var t=e.ej2_instances[0].value,a=i.parent.taskFields.type||"taskType";return i.parent.treeGridModule.currentEditRow[a]=t,t},r.destroy=function(){e&&e.destroy()},r},r.prototype.reUpdateEditModules=function(){var e=this.parent.editSettings;if(e.allowEditing?(this.parent.editModule.cellEditModule&&"Dialog"===e.mode?(this.cellEditModule.destroy(),this.parent.treeGrid.recordDoubleClick=this.recordDoubleClick.bind(this)):t.isNullOrUndefined(this.parent.editModule.cellEditModule)&&"Auto"===e.mode&&(this.cellEditModule=new gt(this.parent)),this.parent.editModule.dialogModule&&"Auto"===e.mode?this.parent.treeGrid.recordDoubleClick=void 0:t.isNullOrUndefined(this.parent.editModule.dialogModule)&&(this.dialogModule=new kt(this.parent))):(this.cellEditModule&&this.cellEditModule.destroy(),this.dialogModule&&this.dialogModule.destroy()),e.allowDeleting&&e.showDeleteConfirmDialog){if(t.isNullOrUndefined(this.confirmDialog)){var i=t.createElement("div",{id:this.parent.element.id+"_deleteConfirmDialog"});this.parent.element.appendChild(i),this.renderDeleteConfirmDialog()}}else e.allowDeleting&&e.showDeleteConfirmDialog||this.confirmDialog&&!this.confirmDialog.isDestroyed&&this.confirmDialog.destroy();e.allowTaskbarEditing?t.isNullOrUndefined(this.parent.editModule.taskbarEditModule)&&(this.taskbarEditModule=new Dt(this.parent)):this.taskbarEditModule&&this.taskbarEditModule.destroy()},r.prototype.recordDoubleClick=function(e){if(this.parent.editSettings.allowEditing&&"Dialog"===this.parent.editSettings.mode){var i=void 0;if(e.row){var a=t.getValue("rowIndex",e.row);i=this.parent.currentViewData[a]}t.isNullOrUndefined(i)||this.dialogModule.openEditDialog(i)}this.parent.ganttChartModule.recordDoubleClick(e)},r.prototype.destroy=function(){this.cellEditModule&&this.cellEditModule.destroy(),this.taskbarEditModule&&this.taskbarEditModule.destroy(),this.dialogModule&&this.dialogModule.destroy(),this.confirmDialog&&!this.confirmDialog.isDestroyed&&this.confirmDialog.destroy()},r.prototype.updateRecordByID=function(e){var i=this;if(this.parent.enableImmutableMode&&this.parent.editSettings.allowEditing&&this.parent.treeGrid.element.getElementsByClassName("e-editedbatchcell").length>0&&this.parent.treeGrid.endEdit(),!this.parent.readOnly){var a=this.parent.taskFields;if(t.isNullOrUndefined(e)||t.isNullOrUndefined(e[a.id]))return;var r="ResourceView"===this.parent.viewType?this.parent.flatData[this.parent.getTaskIds().indexOf((e.hasChildRecords?"R":"T")+e[a.id])]:this.parent.getRecordByID(e[a.id]);if(t.isNullOrUndefined(r[a.milestone])||!0===r[a.milestone]&&(r[a.milestone]=!1),this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.isUndoRedoItemPresent("Edit")&&r){this.parent.undoRedoModule.createUndoCollection();var n={};n.requestType=this.parent.contextMenuModule&&this.parent.contextMenuModule.item?this.parent.contextMenuModule.item:"methodUpdate",n.modifiedRecords=t.extend([],[r],[],!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=n}if(!t.isNullOrUndefined(this.parent.editModule)&&r){if(this.parent.isOnEdit=!0,this.validateUpdateValues(e,r,!0),this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed){if("ProjectView"===this.parent.viewType&&e.ganttProperties.predecessor&&r.ganttProperties.predecessor)for(var s=this,o=0;o<e.ganttProperties.predecessor.length&&"break"!==function(t){var a=r.ganttProperties.predecessor.filter(function(a){return a.from===e.ganttProperties.predecessor[t].from&&a.to===e.ganttProperties.predecessor[t].to&&e.ganttProperties.predecessor[t].offset!==a.offset&&(i.parent.flatData[i.parent.ids.indexOf(a.to)].ganttProperties.predecessor.filter(function(i){return i.from===e.ganttProperties.predecessor[t].from&&i.to===e.ganttProperties.predecessor[t].to})[0].offset=e.ganttProperties.predecessor[t].offset),a.from!==e.ganttProperties.predecessor[t].from&&a.from!==e.ganttProperties.predecessor[t].to});if(a.length>0){for(var n=0;n<a.length;n++)for(var o=s.parent.flatData[s.parent.ids.indexOf(a[n].from)],l=0;l<o.ganttProperties.predecessor.length;l++)if(o.ganttProperties.predecessor[l].from===a[n].from&&o.ganttProperties.predecessor[l].to===a[n].to){o.ganttProperties.predecessor.splice(l,1);break}return"break"}}(o);o++);else if(!e.ganttProperties.predecessor&&r.ganttProperties.predecessor)for(o=0;o<r.ganttProperties.predecessor.length;o++){var l=void 0;l=r.ganttProperties.taskId.toString()===r.ganttProperties.predecessor[o].from?r.ganttProperties.predecessor[o].to:r.ganttProperties.predecessor[o].from;var d=this.parent.flatData[this.parent.ids.indexOf(l)];if(!t.isNullOrUndefined(d)&&!t.isNullOrUndefined(d.ganttProperties)&&!t.isNullOrUndefined(d.ganttProperties.predecessor))for(var h=0;h<d.ganttProperties.predecessor.length;h++)d.ganttProperties.predecessor[h].from===r.ganttProperties.predecessor[o].from&&d.ganttProperties.predecessor[h].to===r.ganttProperties.predecessor[o].to&&d.ganttProperties.predecessor.splice(h,1)}r.ganttProperties.resourceInfo=e.ganttProperties.resourceInfo,r[this.parent.taskFields.resourceInfo]=e[this.parent.taskFields.resourceInfo],r.taskData[this.parent.taskFields.resourceInfo]=e.taskData[this.parent.taskFields.resourceInfo],this.parent.setRecordValue("predecessorsName",e.ganttProperties.predecessorsName,r.ganttProperties,!0),this.parent.taskFields.dependency&&this.parent.setRecordValue(this.parent.taskFields.dependency,e[this.parent.taskFields.dependency],r),this.parent.setRecordValue("predecessor",e.ganttProperties.predecessor,r.ganttProperties,!0)}e[this.parent.taskFields.resourceInfo]&&(0!==r.ganttProperties.duration||"FixedWork"===r.ganttProperties.taskType&&!this.parent.isConvertedMilestone||this.parent.dataOperation.updateWorkWithDuration(r),this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed||this.updateResourceRelatedFields(r,"resource"),this.parent.dateValidationModule.calculateEndDate(r));var p=Object.keys(e);if(-1===p.indexOf(a.startDate)&&-1===p.indexOf(a.endDate)&&-1===p.indexOf(a.duration)||this.parent.dataOperation.calculateScheduledValues(r,r.taskData,!1),-1!==p.indexOf(a.baselineDuration)&&this.parent.dataOperation.calculateScheduledValuesforBaseline(r,r.taskData,!1),this.parent.dataOperation.updateWidthLeft(r),t.isUndefined(e[this.parent.taskFields.dependency])||e[this.parent.taskFields.dependency]===r.ganttProperties.predecessorsName){var u={};u.data=r,"ResourceView"===this.parent.viewType&&(u.action="methodUpdate"),this.parent.editModule.initiateUpdateAction(u)}else this.parent.connectorLineEditModule.updatePredecessor(r,e[this.parent.taskFields.dependency])}}},r.prototype.validateUpdateValues=function(e,i,a){for(var r=this.parent,n=r.taskFields,s=D(r.columnMapping),o=[],l=!1,d=0,h=Object.keys(e);d<h.length;d++){var p=h[d];if(n.startDate===p||n.endDate===p||n.duration===p||n.baselineDuration===p){var u=n.baselineDuration===p;if(t.isNullOrUndefined(e[""+p])&&!r.allowUnscheduledTasks)continue;var c=i.ganttProperties,g=n.duration===p||n.baselineDuration===p;if(a){if(g)r.dataOperation.updateDurationValue(e[p],c,u),!u&&c.duration>0&&c.isMilestone&&this.parent.setRecordValue("isMilestone",!1,c,!0);else{var f="string"==typeof e[p]?new Date(e[p]):e[p];p===n.endDate&&t.isNullOrUndefined(c.startDate)&&(t.isNullOrUndefined(e[n.duration])||""===e[n.duration]||Number.isNaN(e[n.duration]))&&(f=this.parent.editModule.dialogModule.isFromEditDialog?i.ganttProperties.endDate:e[n.endDate]),r.setRecordValue(s[p],f,c,!0),!i[n.startDate]||i[n.startDate]instanceof Date||(i[n.startDate]=new Date(i[n.startDate])),!i[n.endDate]||i[n.endDate]instanceof Date||(i[n.endDate]=new Date(i[n.endDate]))}r.dataOperation.updateMappingData(i,s[p])}else o.push(p),l=!0}else if(n.resourceInfo===p){var m=r.dataOperation.setResourceInfo(e);"ResourceView"===this.parent.viewType&&(JSON.stringify(m)!==JSON.stringify(i.ganttProperties.resourceInfo)?(this.parent.editModule.dialogModule.isResourceUpdate=!0,this.parent.editModule.dialogModule.previousResource=t.isNullOrUndefined(i.ganttProperties.resourceInfo)?[]:i.ganttProperties.resourceInfo.slice()):this.parent.editModule.dialogModule.isResourceUpdate=!1),this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed||(i.ganttProperties.resourceInfo=m),r.dataOperation.updateMappingData(i,"resourceInfo")}else if(n.dependency===p);else if(-1!==[n.progress,n.notes,n.durationUnit,n.milestone,n.name,n.baselineStartDate,n.baselineEndDate,n.id,n.segments,n.cssClass,n.constraintDate,n.constraintType].indexOf(p)){var y=r.columnByField[p],v=e[p];t.isNullOrUndefined(y)||"datepickeredit"!==y.editType&&"datetimepickeredit"!==y.editType||(v=r.dataOperation.getDateFromFormat(v));var k=s[p];switch(p){case n.id:k="taskId";break;case n.name:k="taskName";break;case n.constraintDate:k="constraintDate";break;case n.constraintType:k="constraintType";break;case n.cssClass:k="cssClass";break;case n.milestone:if(k="isMilestone",!t.isNullOrUndefined(n.duration)){var b=i.ganttProperties,w=e[n.duration];w=v?0:w<=0?1:w,r.setRecordValue(n.duration,w,i,!0),r.setRecordValue("duration",w,b,!0),r.setRecordValue("taskData."+n.duration,w,i)}break;case n.segments:if(i.ganttProperties.segments&&(k="segments",e&&!t.isNullOrUndefined(e[n.segments])&&e[n.segments].length>0&&e.ganttProperties&&e.ganttProperties.segments)){this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&(i.ganttProperties.segments=e.ganttProperties.segments);var T=i.ganttProperties.segments.reduce(function(e,t){return e+t.duration},0),S=i.ganttProperties.startDate,P=this.parent.dataOperation.getEndDate(S,T,i.ganttProperties.durationUnit,i.ganttProperties,!1);r.setRecordValue("endDate",r.dataOperation.getDateFromFormat(P),i.ganttProperties,!0)}}if(!t.isNullOrUndefined(k)){var C=[];if("segments"===k&&v&&v.length>0&&!t.isNullOrUndefined(i.ganttProperties.segments)){for(var R=0;R<v.length;R++){var M={};v[R][n.startDate]&&(M.startDate=v[R][n.startDate]),v[R][n.endDate]&&(M.endDate=v[R][n.endDate]),v[R][n.duration]&&(M.duration=parseFloat(v[R][n.duration])),v[R][n.id]&&(M.id=v[R][n.id]),C.push(M)}r.setRecordValue(k,C,i.ganttProperties,!0)}else("segments"!==k||"segments"===k&&t.isNullOrUndefined(v))&&r.setRecordValue(k,v,i.ganttProperties,!0)}if((p===n.baselineStartDate||p===n.baselineEndDate)&&i.ganttProperties.baselineStartDate&&i.ganttProperties.baselineEndDate){c=i.ganttProperties;r.setRecordValue("baselineStartDate",r.dataOperation.checkBaselineStartDate(c.baselineStartDate,c),c,!0);var x=this.parent.getCurrentDayEndTime(c.baselineEndDate);c.baselineEndDate&&0===c.baselineEndDate.getHours()&&86400!==x&&r.dataOperation.setTime(x,c.baselineEndDate),(c.baselineStartDate&&c.baselineEndDate&&c.baselineStartDate.getTime()>c.baselineEndDate.getTime()||!t.isNullOrUndefined(c.baselineStartDate)&&!t.isNullOrUndefined(c.startDate)&&c.baselineStartDate.getTime()===c.startDate.getTime()&&!t.isNullOrUndefined(c.baselineEndDate)&&!t.isNullOrUndefined(c.endDate)&&c.baselineEndDate.toLocaleDateString()===c.endDate.toLocaleDateString()&&c.isMilestone)&&(c.baselineEndDate=c.baselineStartDate),r.setRecordValue("baselineEndDate",r.dataOperation.checkBaselineEndDate(c.baselineEndDate),c,!0),r.setRecordValue("baselineLeft",r.dataOperation.calculateBaselineLeft(c),c,!0),r.setRecordValue("baselineWidth",r.dataOperation.calculateBaselineWidth(c),c,!0),!i[n.baselineStartDate]||i[n.baselineStartDate]instanceof Date||(i[n.baselineStartDate]=new Date(i[n.baselineStartDate])),!i[n.baselineEndDate]||i[n.baselineEndDate]instanceof Date||(i[n.baselineEndDate]=new Date(i[n.baselineEndDate]))}r.setRecordValue("taskData."+p,v,i),p===n.segments&&e&&!t.isNullOrUndefined(e[n.segments])&&e[n.segments].length>0&&(this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&e.ganttProperties&&e.ganttProperties.segments&&(i.ganttProperties.segments=e.ganttProperties.segments),r.dataOperation.setSegmentsInfo(i,!0)),r.setRecordValue(p,v,i)}else if(n.indicators===p){v=e[p];r.setRecordValue("indicators",v,i.ganttProperties,!0),r.setRecordValue("taskData."+p,v,i),r.setRecordValue(p,v,i)}else if(n.work===p)r.setRecordValue("work",e[p],i.ganttProperties,!0),this.parent.dataOperation.updateMappingData(i,"work"),this.parent.dataOperation.updateMappingData(i,"duration"),this.parent.dataOperation.updateMappingData(i,"endDate");else if(p===n.type){v=e[p];r.setRecordValue("taskType",v,i.ganttProperties,!0),r.setRecordValue(p,v,i),r.setRecordValue("taskData."+p,v,i)}else if(p===n.expandState){v=e[p];this.parent.setRecordValue("taskData."+p,v,i),this.parent.setRecordValue(this.parent.taskFields.expandState,v,i),this.parent.setRecordValue("expanded",v,i),this.parent.treeGrid.refresh()}else if(-1!==r.customColumns.indexOf(p)){var y=r.columnByField[p],v=e[p];t.isNullOrUndefined(y.edit)&&("datepickeredit"!==y.editType&&"datetimepickeredit"!==y.editType||(v=r.dataOperation.getDateFromFormat(v))),r.setRecordValue("taskData."+p,v,i),r.setRecordValue(p,v,i)}else n.manual===p&&(r.setRecordValue("isAutoSchedule",!e[p],i.ganttProperties,!0),this.parent.setRecordValue(p,e[p],i),this.updateTaskScheduleModes(i))}l&&this.validateScheduleValues(o,i,e)},r.prototype.updateResourceRelatedFields=function(e,i){var a=e.ganttProperties,r=this.parent.previousRecords,n=a.taskType?a.taskType:this.parent.taskType,s=a.isAutoSchedule,o=this.parent.editModule.dialogModule&&this.parent.editModule.dialogModule.currentResources?this.parent.editModule.dialogModule.currentResources:e.ganttProperties.resourceInfo;if(t.isNullOrUndefined(o))t.isNullOrUndefined(o)&&"FixedDuration"===n&&0===a.duration&&this.parent.dataOperation.updateWorkWithDuration(e);else switch(n){case"FixedUnit":if(t.isNullOrUndefined(r[a.uniqueID])||t.isNullOrUndefined(r[a.uniqueID].ganttProperties)||null!==r[a.uniqueID].ganttProperties.resourceNames&&""!==r[a.uniqueID].ganttProperties.resourceNames||this.parent.dataOperation.updateWorkWithDuration(e),0===o.length)return;s&&o.length?"resource"===i||"work"===i?this.parent.dataOperation.updateDurationWithWork(e):"duration"!==i&&"endDate"!==i||(this.parent.dataOperation.updateWorkWithDuration(e),0===a.duration&&this.parent.setRecordValue("isMilestone",!0,a,!0)):s||"work"!==i?this.parent.dataOperation.updateWorkWithDuration(e):this.parent.dataOperation.updateUnitWithWork(e);break;case"FixedWork":if(0===o.length)return;s?"duration"===i||"endDate"===i?(this.parent.dataOperation.updateUnitWithWork(e),0===a.duration&&this.parent.setRecordValue("isMilestone",!0,a,!0)):this.parent.dataOperation.updateDurationWithWork(e):"work"===i?this.parent.dataOperation.updateUnitWithWork(e):this.parent.dataOperation.updateWorkWithDuration(e);break;case"FixedDuration":if(0===o.length)return void this.parent.dataOperation.updateWorkWithDuration(e);o.length&&"work"===i&&"work"===i?this.parent.dataOperation.updateUnitWithWork(e):this.parent.dataOperation.updateWorkWithDuration(e)}},r.prototype.validateScheduleValues=function(e,t,i){var a=this.parent;e.length>2?a.dataOperation.calculateScheduledValues(t,i,!1):e.length>1?this.validateScheduleByTwoValues(i,e,t):this.dialogModule.validateScheduleValuesByCurrentField(e[0],i[e[0]],t)},r.prototype.validateScheduleByTwoValues=function(e,t,i){var a,r,n,s=this.parent,o=s.taskFields,l=i.ganttProperties,d=s.allowUnscheduledTasks;-1!==t.indexOf(o.startDate)&&(a=e[o.startDate]),-1!==t.indexOf(o.endDate)&&(r=e[o.endDate]),-1!==t.indexOf(o.duration)&&(n=e[o.duration]),a&&r||d&&-1!==t.indexOf(o.startDate)&&-1!==t.indexOf(o.endDate)?(s.setRecordValue("startDate",s.dataOperation.getDateFromFormat(a),l,!0),s.setRecordValue("endDate",s.dataOperation.getDateFromFormat(r),l,!0),s.dataOperation.calculateDuration(i)):r&&n||d&&-1!==t.indexOf(o.endDate)&&-1!==t.indexOf(o.duration)?(s.setRecordValue("endDate",s.dataOperation.getDateFromFormat(r),l,!0),s.dataOperation.updateDurationValue(n,l)):(a&&n||d&&-1!==t.indexOf(o.startDate)&&-1!==t.indexOf(o.duration))&&(s.setRecordValue("startDate",s.dataOperation.getDateFromFormat(a),l,!0),s.dataOperation.updateDurationValue(n,l))},r.prototype.isTaskbarMoved=function(e){var i=!1,a=e.ganttProperties,r=this.parent.previousRecords&&this.parent.previousRecords[e.uniqueID];if(r&&r.ganttProperties){var n=t.getValue("ganttProperties.startDate",r),s=t.getValue("ganttProperties.endDate",r),o=t.getValue("ganttProperties.duration",r),l=t.getValue("ganttProperties.durationUnit",r),d=Object.keys(r.ganttProperties);-1===d.indexOf("startDate")&&-1===d.indexOf("endDate")&&-1===d.indexOf("duration")&&-1===d.indexOf("durationUnit")||(t.isNullOrUndefined(n)&&!t.isNullOrUndefined(a.startDate)||t.isNullOrUndefined(s)&&!t.isNullOrUndefined(a.endDate)||t.isNullOrUndefined(a.startDate)&&!t.isNullOrUndefined(n)||t.isNullOrUndefined(a.endDate)&&!t.isNullOrUndefined(s)||n&&n.getTime()!==a.startDate.getTime()||s&&s.getTime()!==a.endDate.getTime()||!t.isNullOrUndefined(o)&&o!==a.duration||!t.isNullOrUndefined(o)&&o===a.duration&&l!==a.durationUnit)&&(i=!0)}return i},r.prototype.removeImmediateParentDependency=function(e,i){if(!Array.isArray(e))return[];for(var a=[],r=0;r<e.length;r++){var n=e[r],s=i.getRecordByID(n.from),o=i.getRecordByID(n.to);if(s&&o&&s.ganttProperties&&o.ganttProperties){var l=s.ganttProperties.taskId,d=o.ganttProperties.taskId,h=s.parentItem,p=o.parentItem,u=h&&h.taskId,c=p&&p.taskId,g=!t.isNullOrUndefined(u)&&!t.isNullOrUndefined(d)&&u.toString()===d.toString(),f=!t.isNullOrUndefined(c)&&!t.isNullOrUndefined(l)&&c.toString()===l.toString();g||f||a.push(n)}else a.push(n)}return a},r.prototype.isPredecessorUpdated=function(e){var i=!1,a=this.parent.previousRecords[e.uniqueID];if(a&&a.ganttProperties&&a.ganttProperties.hasOwnProperty("predecessor"))if(e.ganttProperties.predecessorsName===a.ganttProperties.predecessorsName||""===e.ganttProperties.predecessorsName&&t.isNullOrUndefined(a.ganttProperties.predecessorsName)){var r=this.removeImmediateParentDependency(a.ganttProperties.predecessor,this.parent);this.parent.setRecordValue("predecessor",r,e.ganttProperties,!0)}else i=!0;return i},r.prototype.isCheckPredecessor=function(e){var t=!1;return this.parent.previousRecords[e.uniqueID]&&this.parent.taskFields.dependency&&this.parent.isInPredecessorValidation&&this.parent.predecessorModule.getValidPredecessor(e).length>0&&this.isTaskbarMoved(e)&&(t=!0),t},r.prototype.updateGanttProperties=function(e,t){var i=["taskId","uniqueID","rowUniqueID","parentId","predecessor"];Object.keys(e.ganttProperties).forEach(function(a){-1===i.indexOf(a)&&(t.ganttProperties[a]=e.ganttProperties[a])})},r.prototype.shouldShowDialog=function(e,t){return!!t&&("MustStartOn"===e?!t.respectMustStartOn:"MustFinishOn"===e?!t.respectMustFinishOn:"StartNoLaterThan"===e?!t.respectStartNoLaterThan:"FinishNoLaterThan"===e&&!t.respectFinishNoLaterThan)},r.prototype.initiateUpdateAction=function(i){var a,r,n=this.isCheckPredecessor(i.data);if(t.isNullOrUndefined(i.data.parentItem)||n){if(i.data.childRecords.length>0&&!n&&!(n=this.isCheckPredecessor(i.data))&&this.isTaskbarMoved(i.data))for(c=0;c<i.data.childRecords.length;c++)this.parent.predecessorModule.getValidPredecessor(i.data.childRecords[c]).length>0&&(r=c,n=!0)}else a=this.parent.getRecordByID(i.data.parentItem.taskId),n=!!(this.isTaskbarMoved(i.data)&&this.parent.predecessorModule.getValidPredecessor(a).length>0&&this.parent.isInPredecessorValidation);(!this.parent.undoRedoModule||this.parent.undoRedoModule&&!this.parent.undoRedoModule.currentAction||this.parent.undoRedoModule.currentAction&&"indent"!==this.parent.undoRedoModule.currentAction.action&&"outdent"!==this.parent.undoRedoModule.currentAction.action)&&(this.taskbarMoved=this.isTaskbarMoved(i.data)),this.predecessorUpdated=this.isPredecessorUpdated(i.data),this.predecessorUpdated&&(this.parent.isConnectorLineUpdate=!0,this.parent.connectorLineEditModule.addRemovePredecessor(i.data));var s={};if(!n||!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)this.taskbarMoved&&(this.parent.isConnectorLineUpdate=!0),this.updateEditedTask(i);else{s=t.isNullOrUndefined(a)?t.isNullOrUndefined(r)?this.parent.connectorLineEditModule.validateTypes(i.data):this.parent.connectorLineEditModule.validateTypes(i.data.childRecords[r],i.data):this.parent.connectorLineEditModule.validateTypes(a,i.data),this.parent.isConnectorLineUpdate=!0;var o=this.parent.predecessorModule.filterPredecessorsByTarget(i.data.ganttProperties.predecessor,i.data,this.parent.viewType),l=i&&i.data&&i.data.ganttProperties?i.data.ganttProperties.constraintType:null,d=!t.isNullOrUndefined(t.getValue("violationType",s))||l===e.ConstraintType.MustStartOn||l===e.ConstraintType.MustFinishOn;if(d&&t.isNullOrUndefined(t.getValue("violationType",s))){for(var h=i.data.ganttProperties.predecessor,p=null,u=i.data.ganttProperties.taskId,c=0;c<h.length;c++){var g=h[c];if(g.to.toString()===u.toString()){p=g;break}}if(p){var f=this.parent.connectorLineModule.getRecordByID(p.from);s.parentTask=f}}if(!d||0===o.length&&i.data.ganttProperties.predecessor)this.updateEditedTask(i);else{var m=void 0;this.parent.taskFields.constraintDate&&this.parent.taskFields.constraintType?(this.taskViolation=this.parent.constraintViolationType,this.parent.constraintViolationType="PredecessorLink",m=this.validateConstraintViolation(i)):m=this.validateTaskEvent(i);var y=this.shouldShowDialog(this.taskViolation,m.validateMode),D=null;if(this.parent&&this.parent.editModule&&this.parent.editModule.taskbarEditModule&&"function"==typeof this.parent.editModule.taskbarEditModule.isValidDependency&&(D=this.parent.editModule.taskbarEditModule.isValidDependency(i.data)),D){var v=D.isValid;y||((!1===this.parent.updateOffsetOnTaskbarEdit&&!1===v&&!1===m.validateMode.respectLink||(m.data.ganttProperties.constraintType===e.ConstraintType.MustStartOn||m.data.ganttProperties.constraintType===e.ConstraintType.MustFinishOn)&&!1===m.validateMode.respectLink)&&(m.validateMode.respectLink=!0),!1===this.parent.updateOffsetOnTaskbarEdit&&!1===v&&!1===m.validateMode.respectLink&&(m.validateMode.respectLink=!0),m.data.ganttProperties.constraintType!==e.ConstraintType.MustStartOn&&m.data.ganttProperties.constraintType!==e.ConstraintType.MustFinishOn||(m.validateMode.respectLink=!0))}!1===m.validateMode.preserveLinkWithEditing&&!1===m.validateMode.removeLink&&!1===m.validateMode.respectLink||y?(this.violationArgs={matchedModifiedTask:i.data,args:i},this.taskViolation&&this.parent.taskFields.constraintDate&&this.parent.taskFields.constraintType&&(s.violationType=this.taskViolation,s.predecessorLink=!0),this.parent.connectorLineEditModule.openValidationDialog(s)):(this.parent.editModule&&this.parent.editModule.dialogModule&&this.parent.editModule.dialogModule.isEdit&&this.predecessorUpdated&&(this.isValidatedEditedRecord=!0,this.parent.predecessorModule.validatePredecessor(i.data,[],"")),this.parent.connectorLineEditModule.applyPredecessorOption())}}},r.prototype.validateTaskEvent=function(e){var t={};return this.resetValidateArgs(),this.parent.currentEditedArgs=t,t.cancel=!1,t.data=e.data,t.requestType="validateLinkedTask",t.validateMode=this.parent.dialogValidateMode,t.editEventArgs=e,this.parent.actionBeginTask(t),t},r.prototype.validateConstraintViolation=function(e){var t={};return this.resetValidateArgs(),this.parent.currentEditedArgs=t,t.cancel=!1,t.data=e.data,t.requestType="validateTaskViolation",t.violationType=this.parent.constraintViolationType,t.validateMode=this.parent.dialogValidateMode,t.editEventArgs=e,this.parent.actionBeginTask(t),t},r.prototype.resetValidateArgs=function(){this.parent.dialogValidateMode.preserveLinkWithEditing=!0,this.parent.dialogValidateMode.removeLink=!1,this.parent.dialogValidateMode.respectLink=!1,this.parent.dialogValidateMode.respectMustFinishOn=!1,this.parent.dialogValidateMode.respectMustFinishOn=!1,this.parent.dialogValidateMode.respectStartNoLaterThan=!1,this.parent.dialogValidateMode.respectFinishNoLaterThan=!1},r.prototype.validateChildPredecessors=function(){for(var e=this,t=this,i=0;i<this.parent.predecessorModule.validatedChildItems.length;i++)!function(i){var a=t.parent.predecessorModule.validatedChildItems[i];a.ganttProperties.predecessor&&a.ganttProperties.predecessor.length>0&&(t.parent.editedPredecessorRecords.some(function(t){return t[e.parent.taskFields.id]===a[e.parent.taskFields.id]})||t.parent.editedPredecessorRecords.push(a),t.isValidatedEditedRecord||(t.isFirstCall=!0),t.parent.predecessorModule.validatePredecessor(a,[],""))}(i)},r.prototype.updateEditedTask=function(i){var a=i.data;if(this.editedRecord=a,!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||this.updateParentChildRecord(a),this.parent.predecessorModule&&(this.parent.predecessorModule.isValidatedParentTaskID=""),(this.parent.isConnectorLineUpdate||this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed)&&this.parent.autoCalculateDateScheduling&&!(this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)){if(this.validateChildPredecessors(),a.ganttProperties.predecessor&&(this.parent.isMileStoneEdited=a.ganttProperties.isMilestone,this.taskbarMoved&&this.parent.editedPredecessorRecords.push(a),this.isValidatedEditedRecord||(this.isFirstCall=!0,"DialogEditing"===i.action&&(this.isDialogEditing=!0),this.parent.predecessorModule.validatePredecessor(a,[],""),this.parent.predecessorModule.isChildRecordValidated=[]),this.isValidatedEditedRecord=!1),this.parent.predecessorModule.isValidatedParentTaskID="",this.parent.allowParentDependency&&this.parent.predecessorModule.isValidatedParentTaskID!==a.ganttProperties.taskId&&a.hasChildRecords&&this.parent.previousRecords[a.uniqueID].ganttProperties.startDate&&"TaskbarEditing"!==i.action&&(!a.hasChildRecords||a.hasChildRecords&&a.ganttProperties.isAutoSchedule)&&(this.parent.predecessorModule.updateChildItems(a),this.validateChildPredecessors()),this.parent.predecessorModule.isValidatedParentTaskID="",this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed)for(g=0;g<a.childRecords.length;g++)a.childRecords[g].ganttProperties.predecessor&&this.parent.predecessorModule.validatePredecessor(a.childRecords[g],[],"");this.updateParentItemOnEditing(),this.parent.dataOperation.updateParentItems(a,!0)}if(a.parentItem){!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||this.parent.dataOperation.updateParentItems(a,!0);var r=this.parent.getRecordByID(a.parentItem.taskId);t.isNullOrUndefined(r)||r.ganttProperties.predecessorsName||(this.isFirstCall=!0,this.parent.predecessorModule.validatePredecessor(r,[],""),this.updateParentItemOnEditing())}if(this.parent.updateOffsetOnTaskbarEdit&&this.parent.connectorLineEditModule&&i.data&&(this.parent.connectorLineEditModule.validatedOffsetIds=[],this.parent.connectorLineEditModule.calculateOffset(i.data)),this.parent.predecessorModule.validatedParentIds=[],t.isNullOrUndefined(this.dialogModule)||this.dialogModule&&!this.dialogModule.isFromDialogPredecessor){var n=i.data.ganttProperties.predecessor,s=this.parent.editedRecords,o=void 0,l=-1,d=void 0,h=this.parent.taskFields.constraintDate,p=this.parent.taskFields.constraintType,u=[e.ConstraintType.MustStartOn,e.ConstraintType.MustFinishOn,e.ConstraintType.StartNoLaterThan,e.ConstraintType.FinishNoLaterThan];if(h&&p&&n&&s)for(g=0;g<n.length&&"break"!==function(e){var t=n[e].to,i=s.findIndex(function(e){return e.ganttProperties.taskId.toString()===t&&u.indexOf(e.ganttProperties.constraintType)>-1});if(-1!==i)return o=s[i],l=i,"break"}(g);g++);else if(s){for(g=0;g<s.length;g++){var c=s[g];if(-1!==u.indexOf(c.ganttProperties.constraintType)){o=c;break}}if(o&&o.ganttProperties&&o.ganttProperties.predecessor){n=o.ganttProperties.predecessor;for(var g=0;g<n.length&&"break"!==function(e){var t=n[e].from,i=s.findIndex(function(e){return e.ganttProperties.taskId.toString()===t});if(-1!==i)return d=s[i],l=i,"break"}(g);g++);}}var f=i.data.ganttProperties.taskId,m=this.parent.validationDialogElement?this.parent.validationDialogElement.element:null,y=!1;if(m&&(y=!m.ej2_instances[0].dialogOpen),y&&o&&o.ganttProperties.taskId!==f){this.violationArgs={matchedModifiedTask:o,matchedModifiedTaskIndex:l,args:i,matchedParedRecord:d};var D=o,v=d||i.data;if(t.isNullOrUndefined(this.parent.constraintViolationType)){var k=o.ganttProperties.constraintType;k===e.ConstraintType.MustStartOn?this.parent.constraintViolationType="MustStartOn":k===e.ConstraintType.MustFinishOn?this.parent.constraintViolationType="MustFinishOn":k===e.ConstraintType.StartNoLaterThan?this.parent.constraintViolationType="StartNoLaterThan":k===e.ConstraintType.FinishNoLaterThan&&(this.parent.constraintViolationType="FinishNoLaterThan")}var b=this.parent.editModule.validateConstraintViolation(i);if(b.violationType){var w=b.validateMode;this.shouldShowDialog(b.violationType,w)?this.parent.connectorLineEditModule.openConstraintValidationDialog({violationType:b.violationType,parentRecord:v,record:D,predecessorLink:n}):(b.validateMode.respectLink=!0,this.parent.connectorLineEditModule.applyPredecessorOption())}else this.initiateSaveAction(i)}else this.initiateSaveAction(i)}},r.prototype.updateParentItemOnEditing=function(){for(var e=this,i=t.getValue("parentRecord",this.parent.predecessorModule),a=0;a<i.length;a++)this.parent.dataOperation.updateParentItems(i[a]);this.parent.editModule.updateParentRecords&&this.parent.editModule.updateParentRecords.length>0&&this.parent.editModule.updateParentRecords.forEach(function(t){t.ganttProperties.predecessor&&t.ganttProperties.predecessor.length>0&&e.parent.predecessorModule.validatePredecessor(t,[],"")});for(a=0;a<i.length;a++)this.parent.dataOperation.updateParentItems(i[a]);t.setValue("parentRecord",[],this.parent.predecessorModule),t.setValue("parentIds",[],this.parent.predecessorModule)},r.prototype.updateParentChildRecord=function(e){var i=e;!i.hasChildRecords||!this.taskbarMoved||!1!==i[this.parent.taskFields.manual]&&"Auto"!==this.parent.taskMode||t.isNullOrUndefined(this.parent.editModule.cellEditModule)||this.parent.editModule.cellEditModule.isResourceCellEdited||this.parent.predecessorModule.updateChildItems(i),t.isNullOrUndefined(this.parent.editModule.cellEditModule)||(this.parent.editModule.cellEditModule.isResourceCellEdited=!1)},r.prototype.updateTaskScheduleModes=function(e){var t=e[this.parent.taskFields.startDate],i=e.ganttProperties;if(this.parent.taskFields.manual&&this.parent.setRecordValue(this.parent.taskFields.manual,!e.ganttProperties.isAutoSchedule,e),e.hasChildRecords&&i.isAutoSchedule)this.parent.setRecordValue("startDate",i.autoStartDate,i,!0),this.parent.setRecordValue("endDate",i.autoEndDate,i,!0),this.parent.setRecordValue("StartDate",i.autoStartDate,e,!0),this.parent.setRecordValue("EndDate",i.autoEndDate,e,!0),this.parent.setRecordValue("taskData.StartDate",i.autoStartDate,e,!0),this.parent.setRecordValue("taskData.EndDate",i.autoEndDate,e,!0),this.parent.setRecordValue("width",this.parent.dataOperation.calculateWidth(e,!0),i,!0),this.parent.setRecordValue("left",this.parent.dataOperation.calculateLeft(i,e,!0),i,!0),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(i.width,i.progress),i,!0),this.parent.dataOperation.calculateDuration(e);else if(e.hasChildRecords&&!i.isAutoSchedule)this.parent.dataOperation.updateWidthLeft(e),this.parent.dataOperation.calculateDuration(e),this.parent.setRecordValue("autoStartDate",i.autoStartDate,i,!0),this.parent.setRecordValue("autoEndDate",i.autoEndDate,i,!0),this.parent.setRecordValue("autoDuration",this.parent.dataOperation.calculateAutoDuration(e),i,!0),this.parent.dataOperation.updateAutoWidthLeft(e);else{var a=this.parent.dateValidationModule.checkStartDate(t,e.ganttProperties);this.parent.setRecordValue("startDate",a,e.ganttProperties,!0),this.parent.dataOperation.updateMappingData(e,"startDate"),this.parent.dateValidationModule.calculateEndDate(e),this.parent.setRecordValue("taskData."+this.parent.taskFields.manual,e[this.parent.taskFields.manual],e),this.parent.dataOperation.updateWidthLeft(e)}},r.prototype.updateParentProgress=function(e){var i=0,a=this.parent.getParentTask(e),r=a.childRecords,n=r?r.length:0,s=0,o=0,l=0,d={};if(r){for(var h=0;h<n;h++)r[h].ganttProperties.isMilestone&&!r[h].hasChildRecords||!m(r[h].ganttProperties)?o+=1:(d=this.parent.dataOperation.getParentProgress(r[h]),s+=t.getValue("totalProgress",d),l+=t.getValue("totalDuration",d));i=n-o>0?Math.round(s/l):0,isNaN(i)&&(i=0),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(a.ganttProperties.isAutoSchedule?a.ganttProperties.width:a.ganttProperties.autoWidth,i),a.ganttProperties,!0),this.parent.setRecordValue("progress",Math.floor(i),a.ganttProperties,!0),this.parent.setRecordValue("totalProgress",s,a.ganttProperties,!0),this.parent.setRecordValue("totalDuration",l,a.ganttProperties,!0)}this.parent.dataOperation.updateTaskData(a),a.parentItem&&this.updateParentProgress(a.parentItem)},r.prototype.revertCellEdit=function(e){this.parent.editModule.reUpdatePreviousRecords(!1,!0),this.resetEditProperties()},r.prototype.reUpdatePreviousRecords=function(e,t,i){for(var a=this.parent.previousRecords,r=i?[i]:Object.keys(a),n=0;n<r.length;n++){var s=r[n],o=a[s];if(o){var l=this.parent.getTaskByUniqueID(s);this.copyTaskData(l.taskData,o.taskData),delete o.taskData,this.copyTaskData(l.ganttProperties,o.ganttProperties),delete o.ganttProperties,this.copyTaskData(l,o);var d=this.parent.currentViewData.indexOf(l);if(e&&this.parent.chartRowsModule.refreshRow(d),t){var h="ProjectView"===this.parent.viewType?l.ganttProperties.taskId:l.ganttProperties.rowUniqueID;this.parent.treeGrid.grid.setRowData(h,l),this.parent.treeGrid.grid.getRowObjectFromUID(this.parent.treeGrid.grid.getDataRows()[d].getAttribute("data-uid")).data=l}}}},r.prototype.copyTaskData=function(e,i){t.isNullOrUndefined(i)||t.extend(e,i)},r.prototype.updateScheduleDatesOnEditing=function(e){},r.prototype.initiateSaveAction=function(e){var i=this,r={};r.requestType="beforeSave",r.data=e.data,r.cancel=!1,this.createArray=!0,this.parent.toolbarModule&&this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.undoRedoModule.getUndoCollection.length>0&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!0),r.modifiedRecords=this.parent.editedRecords,t.isNullOrUndefined(e.target)||(r.target=e.target),r.modifiedTaskData=w(this.parent.editedRecords,!0),"DrawConnectorLine"!==e.action&&"DeleteConnectorLine"!==e.action||(r.action=e.action,"DeleteConnectorLine"===e.action&&(this.parent.connectorLineEditModule.isPublicDependencyDelete=!1,this.parent.contextMenuModule&&(this.parent.contextMenuModule.isCntxtMenuDependencyDelete=!1)));var n=this.parent,s=Tt({},r.data.ganttProperties.baselineStartDate),o=Tt({},r.data.ganttProperties.baselineEndDate),l=r.data.ganttProperties.progress,d=JSON.parse(JSON.stringify(r.data.ganttProperties));this.parent.trigger("actionBegin",r,function(h){i.parent.treeGridModule.setCancelArgs=h.cancel,s===h.data.ganttProperties.baselineStartDate&&o===h.data.ganttProperties.baselineEndDate||(n.setRecordValue("baselineLeft",n.dataOperation.calculateBaselineLeft(h.data.ganttProperties),h.data.ganttProperties,!0),n.setRecordValue("baselineWidth",n.dataOperation.calculateBaselineWidth(h.data.ganttProperties),h.data.ganttProperties,!0)),i.parent.autoCalculateDateScheduling&&d!==h.data.ganttProperties&&!t.isNullOrUndefined(h.data.parentItem)&&(i.updateParentItemOnEditing(),i.parent.dataOperation.updateParentItems(h.data,!0));var p=h.data.ganttProperties,u=p.startDate,c=p.endDate,g=(p.segments,p.durationUnit),f=p.isAutoSchedule,m=p.isMilestone,y=i.parent.treeGridModule.perviousStartDate,D=i.parent.treeGridModule.perviousEndDate;if((t.isNullOrUndefined(p.segments)||0===p.segments.length)&&(!t.isNullOrUndefined(y)&&y.getTime()!==(!t.isNullOrUndefined(u)&&u.getTime())||!t.isNullOrUndefined(D)&&D.getTime()!==(!t.isNullOrUndefined(c)&&c.getTime()))){var v=i.parent.dateValidationModule.getDuration(u,c,g,f,m,!0);0!==v&&(p.isMilestone=!1,p.duration=v)}if(i.parent.dataOperation.updateWidthLeft(h.data),!t.isNullOrUndefined(i.parent.taskFields.progress)&&l!==h.data.ganttProperties.progress){var k=h.data.ganttProperties.isAutoSchedule?h.data.ganttProperties.width:h.data.ganttProperties.autoWidth;i.parent.setRecordValue("progressWidth",i.parent.dataOperation.getProgressWidth(k,h.data.ganttProperties.progress),h.data.ganttProperties,!0)}if(i.parent.chartRowsModule.updateSegment(h.data.ganttProperties.segments,h.data.ganttProperties.taskId),h.cancel)i.reUpdatePreviousRecords(),i.parent.chartRowsModule.refreshRecords([e.data]),i.resetEditProperties(r);else{if(i.parent.showLoadingIndicator(),h.modifiedRecords)for(var T=0;T<h.modifiedRecords.length;T++)i.parent.enableWBS&&i.parent.updateWBSPredecessor(h.modifiedRecords[T]),i.parent.dataOperation.updateTaskData(h.modifiedRecords[T]);if(h.modifiedTaskData=w(h.modifiedRecords,null,null,i.parent),b(i.parent.dataSource)){var S=i.parent.dataSource,P={changedRecords:h.modifiedTaskData},C=i.parent.query instanceof a.Query?i.parent.query:new a.Query,R=null,M=S.adaptor;if(M instanceof a.WebApiAdaptor&&M instanceof a.ODataAdaptor&&!S.dataSource.batchUrl){R=S.update(i.parent.taskFields.id,P.changedRecords,null,C)}else R=S.saveChanges(P,i.parent.taskFields.id,null,C);R.then(function(t){return i.dmSuccess(t,e)}).catch(function(t){return i.dmFailure(t,e)})}else i.saveSuccess(e);i.parent.enableVirtualization&&i.parent.enableTimelineVirtualization&&i.parent.ganttChartModule.setVirtualHeight(),i.parent.undoRedoModule&&(i.parent.previousFlatData=t.extend([],i.parent.flatData,[],!0))}}),this.parent.ganttChartModule.reRenderConnectorLines()},r.prototype.updateEditedFields=function(e){var t,i;t=e.changedRecords?e.changedRecords.length:e.length;for(var a=0;a<t;a++){i=e.changedRecords?e.changedRecords[parseInt(a.toString(),10)]:e[parseInt(a.toString(),10)];for(var r=Object.keys(i).length,n=0,s=Object.keys(i);n<r;n++){var o=s[parseInt(n.toString(),10)];this.parent.editedRecords[parseInt(a.toString(),10)][""+o]=i[""+o],this.parent.editedRecords[parseInt(a.toString(),10)].taskData[""+o]=i[""+o]}this.updateEditedRecordFields(i,this.parent.editedRecords[parseInt(a.toString(),10)])}},r.prototype.dmSuccess=function(e,t){this.updateEditedFields(e),this.saveSuccess(t)},r.prototype.updateEditedRecordFields=function(e,t){for(var i=this.parent.taskFields,a=Object.keys(e).length,r=0,n=Object.keys(e);r<a;r++){var s=n[parseInt(r.toString(),10)];t[""+s]=e[""+s]}null!==i.id&&(t.ganttProperties.taskId=e[i.id]),null!==i.name&&(t.ganttProperties.taskName=e[i.name]),null!==i.startDate&&(t.ganttProperties.startDate=e[i.startDate]),null!==i.endDate&&(t.ganttProperties.endDate=e[i.endDate]),null!==i.duration&&(t.ganttProperties.duration=parseFloat(e[i.duration])),null!==i.durationUnit&&(t.ganttProperties.durationUnit=e[i.durationUnit]),null!==i.progress&&(t.ganttProperties.progress=e[i.progress]),null!==i.dependency&&(t.ganttProperties.dependency=e[i.dependency]),null!==i.parentID&&(t.ganttProperties.parentID=e[i.parentID]),null!==i.baselineEndDate&&(t.ganttProperties.baselineEndDate=e[i.baselineEndDate]),null!==i.baselineStartDate&&(t.ganttProperties.baselineStartDate=e[i.baselineStartDate]),null!==i.resourceInfo&&(t.ganttProperties.resources=e[i.resourceInfo])},r.prototype.dmFailure=function(e,t){if(this.deletedTaskDetails.length){for(var i=this.deletedTaskDetails,a=0;a<i.length;a++)i[a].isDelete=!1;this.deletedTaskDetails=[]}this.reUpdatePreviousRecords(!0,!0),this.resetEditProperties(),this.parent.trigger("actionFailure",{error:e})},r.prototype.updateSharedTask=function(e){for(var i=e.ganttProperties.sharedTaskUniqueIds,a=0;a<i.length;a++){var r=this.parent.flatData[this.parent.ids.indexOf(i[a].toString())];r&&r.uniqueID!==e.uniqueID&&(this.updateGanttProperties(e,r),this.parent.setRecordValue("taskData",e.taskData,r,!0),this.parent.dataOperation.updateTaskData(r),this.parent.dataOperation.updateResourceName(r),t.isNullOrUndefined(r.parentItem)||this.parent.dataOperation.updateParentItems(r.parentItem))}},r.prototype.saveSuccess=function(e){var i={};if(this.parent.timelineSettings.updateTimescaleView){var a=this.parent.editedRecords;this.parent.timelineModule.updateTimeLineOnEditing([a],e.action)}if("ResourceView"===this.parent.viewType){"TaskbarEditing"===e.action||"DrawConnectorLine"===e.action||"DeleteConnectorLine"===e.action?this.updateSharedTask(e.data):"DialogEditing"!==e.action&&"CellEditing"!==e.action&&"methodUpdate"!==e.action||(this.parent.editModule.dialogModule.isResourceUpdate?(this.updateResoures(this.parent.editModule.dialogModule.previousResource,e.data.ganttProperties.resourceInfo,e.data),this.updateSharedTask(e.data),this.isTreeGridRefresh=!0):this.updateSharedTask(e.data));for(var r=0;r<this.updateParentRecords.length;r++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[r]);this.updateParentRecords=[],this.parent.editModule.dialogModule.isResourceUpdate=!1,this.parent.editModule.dialogModule.previousResource=[]}var n=this.parent.criticalPathModule;this.parent.enableCriticalPath&&n&&n.criticalPathCollection&&(n.showCriticalPath(!0),n.criticalConnectorLine(n.criticalPathCollection,n.detailPredecessorCollection,!0,n.predecessorCollectionTaskIds)),this.isTreeGridRefresh||(this.parent.editSettings.allowEditing&&this.parent.treeGrid.element.getElementsByClassName("e-editedbatchcell").length>0&&(this.parent.treeGrid.grid.element.querySelector("form").ej2_instances[0].validate()||(t.setValue("isEdit",!1,this.parent.treeGrid.grid),this.parent.editModule.cellEditModule.isCellEdit=!1),this.parent.treeGrid.endEdit()),this.parent.chartRowsModule.refreshRecords(this.parent.editedRecords),!this.parent.allowTaskbarOverlap&&this.parent.showOverAllocation&&(this.parent.contentHeight=this.parent.element.getElementsByClassName("e-content")[0].children[0].offsetHeight,this.parent.ganttChartModule.chartBodyContent.style.height=this.parent.contentHeight+"px",this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData),this.parent.taskFields.dependency&&this.parent.ganttChartModule.reRenderConnectorLines()),(this.parent.isConnectorLineUpdate||this.parent.undoRedoModule&&this.parent.undoRedoModule.currentAction&&this.parent.undoRedoModule.currentAction.connectedRecords)&&!t.isNullOrUndefined(this.parent.connectorLineEditModule)&&(this.parent.updatedConnectorLineCollection=[],this.parent.connectorLineIds=[],this.parent.connectorLineEditModule.refreshEditedRecordConnectorLine(this.parent.editedRecords),this.updateScheduleDatesOnEditing(e))),!this.parent.editSettings.allowTaskbarEditing||this.parent.editSettings.allowTaskbarEditing&&!this.taskbarEditModule.dependencyCancel?(i.requestType="save",i.data=e.data,i.modifiedRecords=this.parent.editedRecords,i.modifiedTaskData=w(this.parent.editedRecords,null,null,this.parent),!this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&"middleSegment"!==this.parent.rowDragAndDropModule.dropPosition&&this.updateRowIndex(),t.isNullOrUndefined(e.action)||t.setValue("action",e.action,i),"TaskbarEditing"===e.action&&(i.taskBarEditAction=e.taskBarEditAction),this.endEditAction(e),this.parent.trigger("actionComplete",i),this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&this.parent.rowDragAndDropModule.draggedRecord&&(this.parent.rowDragAndDropModule.draggedRecord=null),this.parent.hideLoadingIndicator()):(this.taskbarEditModule.dependencyCancel=!1,this.resetEditProperties()),"ResourceView"===this.parent.viewType&&this.isTreeGridRefresh&&(this.parent.treeGrid.parentData=[],this.parent.updatedConnectorLineCollection=[],this.parent.connectorLineIds=[],this.parent.predecessorModule.createConnectorLinesCollection(this.parent.flatData),this.parent.treeGrid.refresh(),this.isTreeGridRefresh=!1),this.parent.editedRecords=[]},r.prototype.updateResoures=function(e,i,a){var r=this.parent.flatData,n=i?i.length:0,s=e?e.length:0;if(0!==n||0!==s){for(c=0;c<n;c++){var o=[];if("NaN"===(f=parseInt(i[c][this.parent.resourceFields.id],10).toString())&&(f=i[c][this.parent.resourceFields.id]),!t.isNullOrUndefined(e))for(var l=0;l<e.length;l++){var d=parseInt(e[l][this.parent.resourceFields.id],10).toString();if("NaN"===d&&(d=e[l][this.parent.resourceFields.id]),d===f){o.push(l);break}}if(0===o.length){var h=r[this.parent.getTaskIds().indexOf("R"+f)];h&&this.addNewRecord(a,h)}else{var p=parseInt(o[0].toString(),10);"NaN"===p.toString()&&(p=o[0].toString()),e.splice(p,1)}}for(var u=e?e.length:0,c=0;c<u;c++){var g=a.ganttProperties.taskId,f=e[c][this.parent.resourceFields.id],m=r[this.parent.getTaskIds().indexOf("R"+f)];if(!t.isNullOrUndefined(m))for(var y=0;y<m.childRecords.length;y++)m.childRecords[y].ganttProperties.taskId===g&&this.removeChildRecord(m.childRecords[y])}if(n>0){var D=this.parent.getParentTask(a.parentItem);D&&D.ganttProperties.taskName===this.parent.localeObj.getConstant("unassignedTask")&&this.removeChildRecord(a)}0===n&&this.checkWithUnassignedTask(a),this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.flatData[this.parent.flatData.length-1].ganttProperties.taskName===this.parent.localeObj.getConstant("unassignedTask")&&!this.isFlatDataHaveUnAsignedTask&&(this.parent.flatData.splice(this.parent.flatData.length-1,1),this.parent.currentViewData.splice(this.parent.currentViewData.length-1,1),this.parent.taskIds.splice(this.parent.flatData.length-1,1),this.parent.ids.splice(this.parent.flatData.length-1,1)),this.isFlatDataHaveUnAsignedTask=!1}},r.prototype.checkWithUnassignedTask=function(e){for(var i=null,a=0;a<this.parent.flatData.length;a++)this.parent.flatData[a].ganttProperties.taskName===this.parent.localeObj.getConstant("unassignedTask")&&(i=this.parent.flatData[a]);if(t.isNullOrUndefined(i)){var r={};r[this.parent.taskFields.id]=0,r[this.parent.taskFields.name]=this.parent.localeObj.getConstant("unassignedTask");var n=this.parent.isOnEdit;this.parent.isOnEdit=!1;var s=this.parent.dataOperation.createRecord(r,0);this.parent.isOnEdit=n,this.addRecordAsBottom(s);var o=this.parent.flatData[this.parent.flatData.length-1],l=this.parent.flatData.indexOf(o)+1+o.childRecords.length;e.index=l,e.level=o.level+1,this.addNewRecord(e,o),this.parent.dataSource.push(e.taskData)}else this.addNewRecord(e,i),this.isFlatDataHaveUnAsignedTask=!0;var d=this.parent.currentViewData.filter(function(t){return t.ganttProperties.taskId===e.ganttProperties.taskId&&t.hasChildRecords===e.hasChildRecords})[0];e.parentItem=d.parentItem,e.parentUniqueID=d.parentUniqueID},r.prototype.addRecordAsBottom=function(e){var t=this.parent.flatData.length;this.parent.currentViewData.splice(t+1,0,e),this.parent.flatData.splice(t+1,0,e),this.parent.ids.splice(t+1,0,e.ganttProperties.rowUniqueID.toString());var i=0===e.level?"R"+e.ganttProperties.taskId:"T"+e.ganttProperties.taskId;this.parent.getTaskIds().splice(t+1,0,i),this.updateTreeGridUniqueID(e,"add")},r.prototype.addNewRecord=function(e,i){var a=null;a=t.extend({},{},e,!0),this.parent.setRecordValue("uniqueID",this.parent.dataOperation.getGanttUid(this.parent.element.id+"_data_"),a),this.parent.setRecordValue("uniqueID",a.uniqueID,a.ganttProperties,!0);var r=a.uniqueID.replace(this.parent.element.id+"_data_","");this.parent.setRecordValue("rowUniqueID",r,a),this.parent.setRecordValue("rowUniqueID",r,a.ganttProperties,!0),this.parent.setRecordValue("level",1,a),this.parent.taskFields.parentID&&this.parent.setRecordValue("parentId",i.ganttProperties.taskId,a.ganttProperties,!0),this.parent.setRecordValue("parentItem",this.parent.dataOperation.getCloneParent(i),a);var n=a.parentItem?a.parentItem.uniqueID:null;this.parent.setRecordValue("parentUniqueID",n,a),e.ganttProperties.sharedTaskUniqueIds.push(r),a.ganttProperties.sharedTaskUniqueIds=e.ganttProperties.sharedTaskUniqueIds,this.addRecordAsChild(i,a)},r.prototype.removeChildRecord=function(e){var t=this.parent,i=[];i=this.parent.dataSource instanceof a.DataManager&&this.parent.dataSource.dataSource.json.length>0?this.parent.dataSource.dataSource.json:this.parent.currentViewData;var r=this.parent.dataSource,n=e,s=this.parent.getParentTask(n.parentItem);if(n){if(n.parentItem){var o=s?s.childRecords:[],l=0;o&&o.length>0&&(1===o.length&&(this.parent.isOnDelete=!0,o[0].isDelete=!0,this.parent.dataOperation.updateParentItems(s),this.parent.isOnDelete=!1,o[0].isDelete=!1),l=o.indexOf(n),s.childRecords.splice(l,1),this.updateParentRecords.push(s))}if(n.ganttProperties.sharedTaskUniqueIds.length){var d=n.ganttProperties.sharedTaskUniqueIds.indexOf(n.ganttProperties.rowUniqueID);n.ganttProperties.sharedTaskUniqueIds.splice(d,1)}if(this.updateTreeGridUniqueID(n,"delete"),!this.parent.taskFields.parentID){var h=[];h.push(n.ganttProperties.rowUniqueID.toString()),"ProjectView"===this.parent.viewType&&this.parent.editModule.removeFromDataSource(h)}var p=this.parent.flatData.indexOf(n);if(t.taskFields.parentID){for(var u=void 0,c=this.parent.currentViewData,g=0;g<c.length;g++)c[g].ganttProperties.rowUniqueID===n.ganttProperties.rowUniqueID&&(u=g);-1!==u&&(r.length>0&&r.splice(u,1),i.splice(u,1),this.parent.flatData.splice(p,1),this.parent.ids.splice(p,1),this.parent.getTaskIds().splice(p,1))}var f=i.indexOf(n);if(!t.taskFields.parentID){var m=this.parent.editModule.getChildCount(n,0);i.splice(f,m+1),this.parent.flatData.splice(p,m+1),this.parent.ids.splice(p,m+1),this.parent.getTaskIds().splice(p,m+1)}n.parentItem&&s&&s.childRecords&&!s.childRecords.length&&(this.parent.setRecordValue("expanded",!1,s),this.parent.setRecordValue("hasChildRecords",!1,s))}},r.prototype.addRecordAsChild=function(e,i){var a,r,n=this.parent,s=this.parent.flatData.indexOf(e),o=this.parent.editModule.getChildCount(e,0),l=this.parent.getTaskByUniqueID(i.parentItem.uniqueID);if(this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&this.dialogModule.indexes&&this.dialogModule.indexes.deletedIndexes&&this.dialogModule.indexes.deletedIndexes.length>0)if(l.ganttProperties.taskName===this.parent.localeObj.getConstant("unassignedTask"))a=this.parent.taskIds.length+1;else for(var d=0;d<this.dialogModule.indexes.deletedIndexes.length;d++){if(this.dialogModule.indexes.deletedIndexes[d].data.parentUniqueID===i.parentUniqueID&&i.ganttProperties.taskId===this.dialogModule.indexes.deletedIndexes[d].data.ganttProperties.taskId){var h=this.dialogModule.indexes.deletedIndexes[d].index;a="above"===this.dialogModule.indexes.deletedIndexes[d].position?h:h+1;for(u=0;u<e.childRecords.length;u++)if("T"+e.childRecords[u].ganttProperties.taskId===this.dialogModule.indexes.deletedIndexes[d].id){r="above"===this.dialogModule.indexes.deletedIndexes[d].position?u:u+1;break}break}if(this.dialogModule.indexes.deletedIndexes[d].data.parentUniqueID!==i.parentUniqueID&&i.ganttProperties.taskId===this.dialogModule.indexes.deletedIndexes[d].data.ganttProperties.taskId){var p=this.parent.getTaskByUniqueID(i.parentItem.uniqueID);a=p.index+p.childRecords.length+1;break}}else if(this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&l.ganttProperties.taskName===this.parent.localeObj.getConstant("unassignedTask")&&this.parent.undoRedoModule.currentAction.deletedRecordsDetails){for(var u=0;u<this.parent.undoRedoModule.currentAction.deletedRecordsDetails.length;u++)if(this.parent.undoRedoModule.currentAction.deletedRecordsDetails[u].data.ganttProperties.taskId===i.ganttProperties.taskId){l.index?r=(a=this.parent.undoRedoModule.currentAction.deletedRecordsDetails[u].data.index)-l.index-1:(a=t.isNullOrUndefined(o)||0===o?s+1:o+s+1,r=0);break}}else if(!t.isNullOrUndefined(this.addRowIndex)&&this.addRowPosition&&e.childRecords&&"Child"!==this.addRowPosition){var c=e.childRecords[this.addRowIndex],g="Above"===this.addRowPosition||"Below"===this.addRowPosition?this.addRowPosition:"Child";a=c?this.addRowIndex+s+1:o+s+1,a="Above"===g?a:a+1}else a=t.isNullOrUndefined(o)||0===o?s+1:o+s+1;this.parent.currentViewData.splice(a,0,i),this.parent.flatData.splice(a,0,i),this.parent.ids.splice(a,0,i.ganttProperties.rowUniqueID.toString()),this.updateTreeGridUniqueID(i,"add");var f=0===i.level?"R"+i.ganttProperties.taskId:"T"+i.ganttProperties.taskId;this.parent.getTaskIds().splice(a,0,f),e.hasChildRecords||(this.parent.setRecordValue("hasChildRecords",!0,e),this.parent.setRecordValue("expanded",!0,e),e.childRecords.length||(e.childRecords=[],!n.taskFields.parentID&&t.isNullOrUndefined(e.taskData[this.parent.taskFields.child])&&(e.taskData[this.parent.taskFields.child]=[]))),r>=0?e.childRecords.splice(r,0,i):e.childRecords.splice(e.childRecords.length,0,i),t.isNullOrUndefined(i)||this.parent.taskFields.parentID||t.isNullOrUndefined(e.taskData[this.parent.taskFields.child])||e.taskData[this.parent.taskFields.child].splice(e.childRecords.length,0,i.taskData),t.isNullOrUndefined(i.parentItem)||this.updateParentRecords.push(e)},r.prototype.resetEditProperties=function(e){this.parent.currentEditedArgs={},this.resetValidateArgs(),this.parent.isOnEdit=!1,this.parent.predecessorModule.validatedChildItems=[],this.parent.isConnectorLineUpdate=!1,this.parent.editedPredecessorRecords=[],this.taskbarMoved=!1,this.predecessorUpdated=!1,t.isNullOrUndefined(this.dialogModule)||!t.isNullOrUndefined(e)&&(t.isNullOrUndefined(e)||"beforeSave"!==e.requestType||e.cancel)||(this.dialogModule.dialog&&!this.dialogModule.dialogObj.isDestroyed&&this.dialogModule.dialogObj.hide(),this.dialogModule.dialogClose()),this.parent.hideSpinner(),this.parent.initiateEditAction(!1)},r.prototype.endEditAction=function(e){this.resetEditProperties(),"TaskbarEditing"===e.action?(e.target=this.taskbarEditModule.editElement,this.parent.trigger("taskbarEdited",e)):"CellEditing"===e.action?this.parent.trigger("endEdit",e):"DialogEditing"===e.action&&(this.dialogModule.dialog&&!this.dialogModule.dialogObj.isDestroyed&&this.dialogModule.dialogObj.hide(),this.dialogModule.dialogClose())},r.prototype.saveFailed=function(e){this.reUpdatePreviousRecords(),this.parent.hideSpinner()},r.prototype.renderDeleteConfirmDialog=function(){var e=new i.Dialog({width:"320px",isModal:!0,visible:!1,enableRtl:this.parent.enableRtl,content:this.parent.localeObj.getConstant("confirmDelete"),buttons:[{click:this.confirmDeleteOkButton.bind(this),buttonModel:{content:this.parent.localeObj.getConstant("okText"),isPrimary:!0}},{click:this.closeConfirmDialog.bind(this),buttonModel:{content:this.parent.localeObj.getConstant("cancel")}}],target:this.parent.element,animationSettings:{effect:"None"}});e.appendTo("#"+this.parent.element.id+"_deleteConfirmDialog"),this.confirmDialog=e},r.prototype.closeConfirmDialog=function(){this.confirmDialog.hide()},r.prototype.confirmDeleteOkButton=function(){this.deleteSelectedItems(),this.confirmDialog.hide(),this.parent.element.querySelector(".e-treegrid").focus()},r.prototype.startDeleteAction=function(){this.parent.editSettings.allowDeleting&&!this.parent.readOnly&&(this.parent.editSettings.showDeleteConfirmDialog?this.confirmDialog.show():(this.deleteSelectedItems(),this.parent.element.querySelector(".e-treegrid").focus()))},r.prototype.deleteResourceRecords=function(e){for(var i=this,a=[],r=this,n=0;n<e.length;n++)!function(n){if(e[n].parentItem)if(1===e[n].ganttProperties.sharedTaskUniqueIds.length){for(var s=e[n],o=s.ganttProperties.sharedTaskUniqueIds,l=0;l<o.length;l++)-1!==r.parent.ids.indexOf(o[l].toString())?a.push(r.parent.flatData[r.parent.ids.indexOf(o[l].toString())]):r.parent.undoRedoModule&&r.parent.undoRedoModule.isUndoRedoPerformed&&r.parent.undoRedoModule.currentAction&&"Delete"===r.parent.undoRedoModule.currentAction.action&&a.push(r.parent.flatData[r.parent.taskIds.indexOf("T"+e[n].ganttProperties.taskId)]);-1!==r.parent.ids.indexOf(s.ganttProperties.rowUniqueID)&&-1===a.indexOf(r.parent.flatData[r.parent.ids.indexOf(s.ganttProperties.rowUniqueID)])&&a.push(r.parent.flatData[r.parent.ids.indexOf(s.ganttProperties.rowUniqueID)])}else e[n].ganttProperties.sharedTaskUniqueIds.length>1&&e.forEach(function(e){e.ganttProperties.sharedTaskUniqueIds.forEach(function(e){a.push(i.parent.getTaskByUniqueID(i.parent.element.id+"_data_"+e))})});else{var d=r.parent.flatData.filter(function(t){return t.ganttProperties.taskId===e[n].ganttProperties.taskId&&t.hasChildRecords})[0];t.isNullOrUndefined(d)||a.push(d)}}(n);this.deleteRow(a)},r.prototype.add=function(e,t){if(t.push(e),e.hasChildRecords)for(var i=e.childRecords,a=0;a<i.length;a++)this.add(i[a],t);else-1===t.indexOf(e)&&t.push(e)},r.prototype.deleteSelectedItems=function(){if(this.isFromDeleteMethod)this.targetedRecords.length&&("ResourceView"===this.parent.viewType?this.deleteResourceRecords(this.targetedRecords):this.deleteRow(this.targetedRecords)),this.isFromDeleteMethod=!1;else{var e=[];"Cell"!==this.parent.selectionSettings.mode?e=this.parent.selectionModule.getSelectedRecords():"Cell"===this.parent.selectionSettings.mode&&(e=this.parent.selectionModule.getCellSelectedRecords()),"ResourceView"===this.parent.viewType?this.deleteResourceRecords(e):this.deleteRow(e)}},r.prototype.deleteRecord=function(e){this.isFromDeleteMethod=!0;var i=typeof e;switch(this.targetedRecords=[],i){case"number":case"string":var a=e.toString();"ResourceView"===this.parent.viewType?t.isNullOrUndefined(a)||-1===this.parent.getTaskIds().indexOf("T"+a)||this.targetedRecords.push(this.parent.flatData[this.parent.getTaskIds().indexOf("T"+a)]):t.isNullOrUndefined(a)||-1===this.parent.ids.indexOf(a)||this.targetedRecords.push(this.parent.getRecordByID(a));break;case"object":Array.isArray(e)?this.updateTargetedRecords(e):this.targetedRecords.push(e.valueOf())}this.startDeleteAction()},r.prototype.updateTargetedRecords=function(e){if(e.length)if("object"===typeof e[0])this.targetedRecords=e;else for(var i=0;i<e.length;i++){var a=e[i].toString();"ResourceView"===this.parent.viewType?t.isNullOrUndefined(a)||-1===this.parent.getTaskIds().indexOf("T"+a)||this.targetedRecords.push(this.parent.flatData[this.parent.getTaskIds().indexOf("T"+a)]):t.isNullOrUndefined(a)||-1===this.parent.ids.indexOf(a)||this.targetedRecords.push(this.parent.getRecordByID(a))}},r.prototype.deleteRow=function(e){var i=this,a=e&&e.length?e:this.parent.selectionModule.getSelectedRecords();if(this.parent.addDeleteRecord=!0,a.length){if(this.parent.isOnDelete=!0,a.forEach(function(e){if(i.parent.undoRedoModule&&i.parent.undoRedoModule.isUndoRedoPerformed){("ProjectView"===i.parent.viewType?i.parent.getRecordByID(e.ganttProperties.taskId):i.parent.flatData[i.parent.taskIds.indexOf((e.hasChildRecords?"R":"T")+e.ganttProperties.taskId)]).isDelete=!0}e.isDelete=!0}),"ResourceView"!==this.parent.viewType||e.length||(a=[]),this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.isUndoRedoItemPresent("Delete")){this.parent.undoRedoModule.redoEnabled&&!this.parent.undoRedoModule.isUndoRedoPerformed&&(this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.getUndoCollection[0]=[]),this.parent.undoRedoModule.isUndoRedoPerformed||this.parent.undoRedoModule.createUndoCollection();var r={};r.action="Delete",r.deletedRecordsDetails=[],this.parent.undoRedoModule.findPosition(t.extend([],[],a,!0),r,"deletedRecordsDetails"),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=r}for(var n=this,s=0;s<a.length;s++)!function(e){var i=a[e];if(-1!==n.deletedTaskDetails.indexOf(i))return"continue";var r=[i];if("ResourceView"===n.parent.viewType&&n.parent.undoRedoModule&&n.parent.undoRedoModule.isUndoRedoPerformed&&a[e].ganttProperties.resourceInfo&&a[e].ganttProperties.resourceInfo.length>1&&(r=[],!a[e].hasChildRecords)){var s="T"+a[e].ganttProperties.taskId;n.parent.taskIds.reduce(function(e,t){e===s&&r.push(this.parent.flatData[t])}.bind(n),[])}for(var o=0;o<r.length;o++){var l=n.parent.getParentTask(r[o].parentItem);if(r[o].parentItem){var d=void 0;t.isNullOrUndefined(l)||(1===(d=l.childRecords).length?d:d.filter(function(e){return!e.isDelete})).length>0&&n.parent.dataOperation.updateParentItems(r[o].parentItem)}var h=r[o].ganttProperties.predecessor,p=!0;"ResourceView"===n.parent.viewType&&l&&l.ganttProperties.taskName!==n.parent.localeObj.getConstant("unassignedTask")&&(p=!1),h&&h.length&&p&&n.removePredecessorOnDelete(r[o]),n.deletedTaskDetails.push(r[o]),r[o].hasChildRecords&&n.deleteChildRecords(r[o])}}(s);this.parent.selectionModule&&this.parent.allowSelection&&this.parent.selectionModule.clearSelection();var o={};o.deletedRecordCollection=this.deletedTaskDetails,o.updatedRecordCollection=this.parent.editedRecords,o.cancel=!1,o.action="delete",this.initiateDeleteAction(o),this.parent.isOnDelete=!1}t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},r.prototype.removePredecessorOnDelete=function(e){for(var i=this,a=e.ganttProperties.predecessor,r=this,n=0;n<a.length;n++)!function(n){var s=a[n],o="ResourceView"===r.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID,l=r.parent.rowDragAndDropModule&&"middleSegment"===r.parent.rowDragAndDropModule.dropPosition||r.dropPosition&&"middleSegment"===r.dropPosition,d=e.hasChildRecords&&e.childRecords.some(function(e){return s.to.toString()===e[i.parent.taskFields.id].toString()}),h=e.hasChildRecords&&e.childRecords.some(function(e){return s.from.toString()===e[i.parent.taskFields.id].toString()});if(s.from.toString()===o.toString()&&(d&&l||r.parent.isOnDelete)){var p=r.parent.connectorLineModule.getRecordByID(s.to.toString());if(!t.isNullOrUndefined(p)){for(var u=t.extend([],[],p.ganttProperties.predecessor,!0),c=void 0,g=0;g<u.length;g++){var f="ResourceView"===r.parent.viewType?p.ganttProperties.taskId:p.ganttProperties.rowUniqueID;if(u[g].to.toString()===f.toString()&&u[g].from.toString()===o.toString()){c=g;break}}u.splice(c,1),r.updatePredecessorValues(p,u)}}else if(s.to.toString()===o.toString()&&(h&&l||r.parent.isOnDelete)){var m=r.parent.connectorLineModule.getRecordByID(s.from.toString());if(!t.isNullOrUndefined(m)){for(var y=t.extend([],[],m.ganttProperties.predecessor,!0),c=void 0,g=0;g<y.length;g++){var D="ResourceView"===r.parent.viewType?m.ganttProperties.taskId:m.ganttProperties.rowUniqueID;if(y[g].from.toString()===D.toString()&&y[g].to.toString()===o.toString()){c=g;break}}(e.uniqueID===m.parentUniqueID||e.parentUniqueID===m.uniqueID||r.parent.isOnDelete)&&(y.splice(c,1),r.updatePredecessorValues(m,y))}}}(n)},r.prototype.updatePredecessorValues=function(e,t){this.parent.setRecordValue("predecessor",t,e.ganttProperties,!0);var i=this.parent.predecessorModule.getPredecessorStringValue(e);this.parent.setRecordValue("predecessorsName",i,e.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,i,e),this.parent.setRecordValue(this.parent.taskFields.dependency,i,e)},r.prototype.updateTaskId=function(e,i){if(!this.parent.readOnly){var a="number"==typeof e?e.toString():e,r="number"==typeof i?i.toString():i,n=this.parent.ids;if(!t.isNullOrUndefined(a)&&!t.isNullOrUndefined(r)){var s=n.indexOf(a),o=n.indexOf(r);if(-1===s||o>-1)return;var l=this.parent.flatData[s];if(t.isNullOrUndefined(l)||(this.parent.setRecordValue("taskId",i,l.ganttProperties,!0),this.parent.setRecordValue("rowUniqueID",r,l.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.id,i,l,!0),this.parent.setRecordValue(this.parent.taskFields.id,i,l.taskData,!0)),n[s]=r,l.hasChildRecords&&this.parent.taskFields.parentID)for(var d=l.childRecords,h=0;h<d.length;h++){var p=d[h];p[this.parent.taskFields.parentID]=i,this.parent.chartRowsModule.refreshRecords([p])}if(this.parent.taskFields.dependency&&!t.isNullOrUndefined(l.ganttProperties.predecessor))for(var u=l.ganttProperties.predecessor,c=void 0,g=0;g<u.length;g++){var f=u[g];f.to===a?c=this.parent.flatData[n.indexOf(f.from)]:f.from===a&&(c=this.parent.flatData[n.indexOf(f.to)]),this.updatePredecessorOnUpdateId(c,a,r)}this.parent.treeGrid.parentData=[],this.parent.treeGrid.refresh()}}},r.prototype.updatePredecessorOnUpdateId=function(e,t,i){if(this.parent.flatData.indexOf(e)>-1)for(var a=e.ganttProperties.predecessor,r=0;r<a.length;r++){var n=a[r];n.to===t?n.to=i:n.from===t&&(n.from=i)}this.updatePredecessorValues(e,e.ganttProperties.predecessor)},r.prototype.deleteChildRecords=function(e){for(var i=this,a=e.childRecords,r=0;r<a.length;r++){var n=a[r];if(-1===this.deletedTaskDetails.indexOf(n)){var s=n.ganttProperties.predecessor,o=!0,l=this.parent.getParentTask(n.parentItem);"ResourceView"===this.parent.viewType&&l&&l.ganttProperties.taskName!==this.parent.localeObj.getConstant("unassignedTask")&&(o=!1),s&&s.length&&o&&this.removePredecessorOnDelete(n),!t.isNullOrUndefined(n.ganttProperties.sharedTaskUniqueIds)&&n.ganttProperties.sharedTaskUniqueIds.length>1?n.ganttProperties.sharedTaskUniqueIds.forEach(function(e){i.deletedTaskDetails.push(i.parent.getTaskByUniqueID(i.parent.element.id+"_data_"+e))}):this.deletedTaskDetails.push(n),n.hasChildRecords&&this.deleteChildRecords(n)}}},r.prototype.removeFromDataSource=function(e){var t;t=this.parent.dataSource instanceof a.DataManager?this.parent.dataSource.dataSource.json:this.parent.dataSource,this.removeData(t,e),this.isBreakLoop=!1},r.prototype.removeData=function(e,i){for(var a=0;a<e.length&&!this.isBreakLoop;a++)if(-1!==i.indexOf(t.getValue(this.parent.taskFields.id,e[a]).toString())){if(e[a][this.parent.taskFields.child]){r=e[a][this.parent.taskFields.child];this.removeData(r,i)}if(i.splice(i.indexOf(t.getValue(this.parent.taskFields.id,e[a]).toString()),1),e.splice(a,1),0===i.length){this.isBreakLoop=!0;break}}else if(e[a][this.parent.taskFields.child]){var r=e[a][this.parent.taskFields.child];this.removeData(r,i)}},r.prototype.initiateDeleteAction=function(e){var t=this;this.parent.showSpinner();var i={};i.requestType="beforeDelete",i.data=e.deletedRecordCollection,i.modifiedRecords=e.updatedRecordCollection,i.modifiedTaskData=w(e.updatedRecordCollection,null,null,this.parent),this.parent.trigger("actionBegin",i,function(i){if(i.cancel){for(var r=t.deletedTaskDetails,n=0;n<r.length;n++)r[n].isDelete=!1;t.deletedTaskDetails=[],t.reUpdatePreviousRecords(),t.parent.initiateEditAction(!1),t.parent.hideSpinner()}else if(t.parent.showLoadingIndicator(),b(t.parent.dataSource)){var s=t.parent.dataSource;t.parent.timezone&&i.modifiedRecords.forEach(function(e){T(e,t.parent)});var o={deletedRecords:w(i.data,null,null,t.parent),changedRecords:i.modifiedTaskData},l=s.adaptor,d=t.parent.query instanceof a.Query?t.parent.query:new a.Query;if(l instanceof a.WebApiAdaptor&&l instanceof a.ODataAdaptor&&!s.dataSource.batchUrl){for(var h=null,p=0;p<o.deletedRecords.length;p++)h=s.remove(t.parent.taskFields.id,o.deletedRecords[p],null,d);h.then(function(){for(var i=o.changedRecords.length-1;i>=0;i--)!function(e){o.deletedRecords.some(function(i){return i[t.parent.taskFields.id]===o.changedRecords[e].taskId})&&o.changedRecords.splice(e,1)}(i);s.update(t.parent.taskFields.id,o.changedRecords,null,d).then(function(){return t.deleteSuccess(e)}).catch(function(i){return t.dmFailure(i,e)})}).catch(function(i){return t.dmFailure(i,e)})}else s.saveChanges(o,t.parent.taskFields.id,null,d).then(function(){return t.deleteSuccess(e)}).catch(function(i){return t.dmFailure(i,e)})}else t.deleteSuccess(e)})},r.prototype.deleteSuccess=function(e){for(var i=this,a=this.parent.flatData,r=this.parent.currentViewData,n=[],s=0;s<e.deletedRecordCollection.length;s++)if("ProjectView"===this.parent.viewType){u=this.parent.getRecordByID(e.deletedRecordCollection[s].ganttProperties.taskId);t.isNullOrUndefined(u)||n.push(u)}else{var o=e.deletedRecordCollection[s].hasChildRecords,l=e.deletedRecordCollection[s].ganttProperties.taskName===this.parent.localeObj.getConstant("unassignedTask"),d=!e.deletedRecordCollection[s].expanded;if(o&&l&&d)return this.parent.hideLoadingIndicator(),this.deletedTaskDetails=[],void this.parent.initiateEditAction(!1);e.deletedRecordCollection[s].hasChildRecords?"R"+e.deletedRecordCollection[s].ganttProperties.taskId:"T"+e.deletedRecordCollection[s].ganttProperties.taskId,n.push(this.parent.getTaskByUniqueID(e.deletedRecordCollection[s].uniqueID))}var h=[];if(n.length>0){var p=void 0,u=void 0;if(this.parent.enableVirtualization?(p=this.parent.flatData.indexOf(n[n.length-1]),this.parent.staticSelectedRowIndex=this.parent.selectedRowIndex=p,u=this.parent.flatData[this.parent.selectedRowIndex+1],this.parent.isCollapseAll||(this.parent.staticSelectedRowIndex=p-(n.length-1))):(p=this.parent.currentViewData.indexOf(n[n.length-1]),this.parent.staticSelectedRowIndex=this.parent.selectedRowIndex=p,u=this.parent.currentViewData[this.parent.selectedRowIndex+1]),t.isNullOrUndefined(u)){var c=this.parent.selectedRowIndex-1;c>=0&&(this.parent.currentSelection=this.parent.enableVirtualization?this.parent.flatData[c]:this.parent.currentViewData[c])}else this.parent.currentSelection=u}this.deletedRecord=n;for(s=0;s<n.length;s++){var g=n[s],f=void 0,m=void 0,y=void 0;"ResourceView"===this.parent.viewType?g.hasChildRecords?(f=this.parent.taskIds.indexOf("R"+g.ganttProperties.taskId.toString()),m=this.parent.taskIds.indexOf("R"+g.ganttProperties.taskId.toString())):(f=this.parent.taskIds.indexOf("T"+g.ganttProperties.taskId.toString()),m=this.parent.taskIds.indexOf("T"+g.ganttProperties.taskId.toString())):(f=r.indexOf(g),m=a.indexOf(g),this.parent.editModule&&this.parent.editModule.updateParentRecords&&this.parent.editModule.updateParentRecords.length>0&&(y=this.parent.editModule.updateParentRecords.indexOf(g)));var D=this.parent.treeGrid.parentData.indexOf(g),v=t.getValue("dataOperation.dataArray",this.parent),k=v.indexOf(g.taskData),b=void 0;if(-1!==f&&r.splice(f,1),-1!==m&&a.splice(m,1),-1!==k&&v.splice(k,1),"number"==typeof y&&-1!==y&&this.parent.editModule.updateParentRecords.splice(y,1),!t.isNullOrUndefined(g)){if(h.push(g.ganttProperties.taskId.toString()),-1!==m&&(this.parent.ids.splice(m,1),"ResourceView"===this.parent.viewType&&(this.parent.getTaskIds().splice(m,1),g.hasChildRecords||(g.ganttProperties.resourceInfo=null,delete g.ganttProperties.resourceNames,g[this.parent.taskFields.resourceInfo]=null,g.ganttProperties.sharedTaskUniqueIds=[],delete g.taskData[this.parent.taskFields.resourceInfo]))),0===g.level&&-1!==D&&this.parent.treeGrid.parentData.splice(D,1),g.parentItem){var T=this.parent.getParentTask(g.parentItem);if(T){var S=T.childRecords;-1!==(b=S.indexOf(g))&&S.splice(b,1),S.length||this.parent.setRecordValue("hasChildRecords",!1,T)}}this.updateTreeGridUniqueID(g,"delete")}}h.length>0&&this.removeFromDataSource(h),this.updateRowIndex();var P={};if(this.parent.updatedConnectorLineCollection=[],this.parent.connectorLineIds=[],this.parent.predecessorModule.createConnectorLinesCollection(this.parent.flatData),this.parent.treeGrid.parentData=[],this.isAdded=!1,this.parent.treeGrid.editModule&&(this.parent.treeGrid.editModule.isOnBatch=!1),this.parent.treeGrid.refresh(),this.parent.enableImmutableMode&&this.refreshRecordInImmutableMode(),P.requestType="delete",P.data=e.deletedRecordCollection,P.modifiedRecords=e.updatedRecordCollection,P.modifiedTaskData=w(e.updatedRecordCollection,null,null,this.parent),t.setValue("action",e.action,P),this.parent.isOnDelete=!1,"ResourceView"===this.parent.viewType&&(!this.parent.undoRedoModule||this.parent.undoRedoModule&&(!this.parent.undoRedoModule.isUndoRedoPerformed||this.parent.undoRedoModule.isUndoRedoPerformed&&"Delete"===this.parent.undoRedoModule.currentAction.action)))for(var C=P.data.filter(function(e){return!e.hasChildRecords}),R=this,s=0;s<C.length;s++)!function(e){var t=R.parent.flatData.filter(function(e){return e.ganttProperties.taskName===i.parent.localeObj.getConstant("unassignedTask")})[0],a=[];t&&(a=t.childRecords.filter(function(t){return t.ganttProperties.taskId===C[e].ganttProperties.taskId}));var r=R.parent.getParentTask(C[e].parentItem);r&&r.ganttProperties.taskName!==R.parent.localeObj.getConstant("unassignedTask")&&0===a.length?R.checkWithUnassignedTask(C[e]):r||a&&0!==a.length||R.checkWithUnassignedTask(C[e]),t=R.parent.flatData.filter(function(e){return e.ganttProperties.taskName===i.parent.localeObj.getConstant("unassignedTask")})[0];var n=R.parent.currentViewData.filter(function(i){return i.ganttProperties.taskId===C[e].ganttProperties.taskId&&!i.hasChildRecords&&i.parentItem&&t.uniqueID===i.parentItem.uniqueID?i:null});n[0]&&R.parent.dataOperation.updateParentItems(n[0])}(s);this.parent.trigger("actionComplete",P),this.deletedTaskDetails=[],this.parent.initiateEditAction(!1),this.parent.hideLoadingIndicator(),this.parent.treeGrid.closeEdit()},r.prototype.getNewTaskId=function(){var e,t="ResourceView"===this.parent.viewType?this.parent.getTaskIds():this.parent.ids,i=t.length;if(e=this.parent.dataOperation.isTaskIDInteger&&this.parent.ids.length>0?Math.max.apply(Math,this.parent.ids.map(function(e){return Number(e)})):i+1,"ResourceView"===this.parent.viewType){if((-1!==t.indexOf("T"+e)||-1!==t.indexOf("R"+e))&&(e+=1,-1!==t.indexOf("T"+e)||-1!==t.indexOf("R"+e)))do{e+=1}while(-1!==t.indexOf("T"+e)||-1!==t.indexOf("R"+e))}else if(-1!==t.indexOf(e.toString())&&(e+=1,-1!==t.indexOf(e.toString())))do{e+=1}while(-1!==t.indexOf(e.toString()));return"stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType?e=e.toString():e},r.prototype.prepareNewlyAddedData=function(e,i){var a,r,n=this.parent.taskFields,s=this.parent.ids;if(e[n.id]&&(-1!==s.indexOf(e[n.id].toString())?e[n.id]=null:(r="string"==typeof e[n.id]?e[n.id]:parseInt(e[n.id],10),e[n.id]=t.isNullOrUndefined(r)?null:r)),e[n.id]||(a=this.getNewTaskId(),e[n.id]=a),this.parent.allowUnscheduledTasks||e[n.startDate]||(e[n.startDate]=this.parent.projectStartDate),!this.parent.allowUnscheduledTasks&&n.duration&&t.isNullOrUndefined(e[n.duration])&&(e[n.endDate]||(e[n.duration]="5")),n.progress&&(e[n.progress]=e[n.progress]?e[n.progress]>100?100:e[n.progress]:0),!this.parent.allowUnscheduledTasks&&!e[n.endDate]&&n.endDate&&!e[n.duration]){var o=this.parent.dataOperation.getDateFromFormat(this.parent.projectStartDate);t.isNullOrUndefined(o)||(o.setDate(o.getDate()+4),e[n.endDate]=this.parent.getFormatedDate(o,this.parent.getDateFormat()))}},r.prototype.processPredecessors=function(e,t){if(e.ganttProperties.predecessorsName&&(this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed||this.parent.predecessorModule.ensurePredecessorCollectionHelper(e,e.ganttProperties),this.parent.predecessorModule.updatePredecessorHelper(e),this.parent.predecessorModule.validatePredecessorDates(e)),e.childRecords&&e.childRecords.length>0&&t)for(var i=0;i<e.childRecords.length;i++)this.processPredecessors(e.childRecords[i],t)},r.prototype.updateNewlyAddedDataBeforeAjax=function(e,i,a,r,n){var s=this.parent.dataOperation.createRecord(e,i);switch(a){case"Above":s.index=n;break;case"Below":case"Child":s.index=n+1;break;case"Bottom":s.index=this.parent.enableVirtualization?this.parent.flatData.length:this.parent.currentViewData.length;break;case"Top":s.index=0}if(!t.isNullOrUndefined(r)){this.parent.setRecordValue("parentItem",this.parent.dataOperation.getCloneParent(r),s);c=s.parentItem?s.parentItem.index:null;this.parent.setRecordValue("parentIndex",c,s);g=s.parentItem?s.parentItem.uniqueID:null;this.parent.setRecordValue("parentUniqueID",g,s),t.isNullOrUndefined(this.parent.taskFields.id)||t.isNullOrUndefined(this.parent.taskFields.parentID)||!s.parentItem||("ProjectView"===this.parent.viewType&&this.parent.setRecordValue(this.parent.taskFields.parentID,s.parentItem.taskId,s.taskData,!0),this.parent.setRecordValue("parentId",s.parentItem.taskId,s.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.parentID,s.parentItem.taskId,s,!0))}if(this.parent.isOnEdit=!0,this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed)if(e.hasChildRecords){for(var o=[],l=this.parent.undoRedoModule.currentAction.deletedRecordsDetails,d=0;d<e.childRecords.length;d++)this.add(e.childRecords[d],o);for(var h=0;h<l.length;h++)if(e.ganttProperties.taskId===l[h].data.ganttProperties.taskId){"child"===l[h].position?a="Child":"below"===l[h].position?a="Below":"above"===l[h].position&&(a="Above"),this.backUpAndPushNewlyAddedRecord(s,a,r);for(d=0;d<o.length;d++)"ProjectView"===this.parent.viewType?o[d].parentItem.taskId===s.ganttProperties.taskId&&(o[d].parentItem.index=s.index,o[d].parentItem.taskId=s.ganttProperties.taskId,o[d].parentItem.uniqueID=s.ganttProperties.uniqueID,o[d].parentUniqueID=s.ganttProperties.uniqueID):(o[d].parentItem.index=s.index,o[d].parentItem.taskId=s.ganttProperties.rowUniqueID,o[d].parentItem.uniqueID=s.ganttProperties.uniqueID,o[d].parentUniqueID=s.ganttProperties.uniqueID);break}this.addRowSelectedItem=s,s.taskData[this.parent.taskFields.child]=[];for(var p=0;p<o.length;p++){this.parent.isOnEdit=!1;var u=this.parent.dataOperation.createRecord(o[p],o[p].level);if(0===u.childRecords.length&&u.taskData[this.parent.taskFields.child]&&(u.taskData[this.parent.taskFields.child]=[]),r=this.parent.getRecordByID(o[p].parentItem.taskId),!t.isNullOrUndefined(r)){this.parent.setRecordValue("parentItem",this.parent.dataOperation.getCloneParent(r),u);var c=u.parentItem?u.parentItem.index:null;this.parent.setRecordValue("parentIndex",c,u);var g=u.parentItem?u.parentItem.uniqueID:null;this.parent.setRecordValue("parentUniqueID",g,u),t.isNullOrUndefined(this.parent.taskFields.id)||t.isNullOrUndefined(this.parent.taskFields.parentID)||!u.parentItem||("ProjectView"===this.parent.viewType&&this.parent.setRecordValue(this.parent.taskFields.parentID,u.parentItem.taskId,u.taskData,!0),this.parent.setRecordValue("parentId",u.parentItem.taskId,u.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.parentID,u.parentItem.taskId,u,!0))}this.parent.isOnEdit=!0,u.parentItem&&(a=0===r.childRecords.length?"Child":"Below"),this.parent.getParentTask(u.parentItem).childRecords.length>0&&(this.addRowSelectedItem=this.parent.getParentTask(u.parentItem).childRecords[this.parent.getParentTask(u.parentItem).childRecords.length-1]),this.backUpAndPushNewlyAddedRecord(u,a,r);for(d=0;d<o.length;d++)"ProjectView"===this.parent.viewType?o[d].parentItem.taskId===u.ganttProperties.taskId&&(o[d].parentItem.index=u.index,o[d].parentItem.taskId=u.ganttProperties.taskId,o[d].parentItem.uniqueID=u.ganttProperties.uniqueID,o[d].parentUniqueID=u.ganttProperties.uniqueID):(o[d].parentItem.index=s.index,o[d].parentItem.taskId=s.ganttProperties.rowUniqueID,o[d].parentItem.uniqueID=s.ganttProperties.uniqueID,o[d].parentUniqueID=s.ganttProperties.uniqueID)}}else this.backUpAndPushNewlyAddedRecord(s,a,r);else this.backUpAndPushNewlyAddedRecord(s,a,r);if(this.parent.taskFields.dependency){var f=!(!this.parent.undoRedoModule||!this.parent.undoRedoModule.isUndoRedoPerformed);if(s.ganttProperties.predecessorsName)this.processPredecessors(s,f);else if(!s.ganttProperties.predecessorsName&&s.childRecords.length>0&&f)for(d=0;d<s.childRecords.length;d++)this.processPredecessors(s.childRecords[d],f)}return s.parentItem&&this.parent.getParentTask(s.parentItem).ganttProperties.isAutoSchedule&&this.parent.dataOperation.updateParentItems(s.parentItem),this.parent.isOnEdit=!1,s},r.prototype.getChildCount=function(e,t){var i;if(!e.hasChildRecords)return 0;for(var a=0;a<e.childRecords.length;a++)t++,(i=e.childRecords[a]).hasChildRecords&&(t=this.getChildCount(i,t));return t},r.prototype.getVisibleChildRecordCount=function(e,t,i){var a,r;if(e.hasChildRecords){r=(a=e.childRecords).length;for(var n=0;n<r;n++)-1!==i.indexOf(a[n])&&t++,a[n].hasChildRecords&&(t=this.getVisibleChildRecordCount(a[n],t,i))}else-1!==i.indexOf(e)&&t++;return t},r.prototype.updatePredecessorOnIndentOutdent=function(e){for(var i,a,r,n=e.ganttProperties.predecessor.length,s=e.ganttProperties,o=s.predecessor,l=[],d=0;d<n;d++){var h=this.parent.getRecordByID(o[d].from),p=this.parent.getRecordByID(o[d].to);if(!(r=this.parent.predecessorModule.validateParentPredecessor(h,p))||!this.parent.allowParentDependency)if(o[d].to===s.rowUniqueID.toString()){i=this.parent.getRecordByID(o[d].from),a=P(o[d],"from",i.ganttProperties.predecessor,"to");var u=t.extend([],i.ganttProperties.predecessor,[],!0);u.splice(a,1),this.parent.setRecordValue("predecessor",u,i.ganttProperties,!0)}else if(o[d].from===s.rowUniqueID.toString()){var c=(i=this.parent.getRecordByID(o[d].to)).ganttProperties.predecessorsName.toString().split(","),g=o[d].from+o[d].type,f=c.indexOf(g);c.splice(f,1),this.parent.setRecordValue("predecessorsName",c.join(","),i.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.dependency,c.join(","),i),a=P(o[d],"from",i.ganttProperties.predecessor,"to");var m=t.extend([],i.ganttProperties.predecessor,[],!0);m.splice(a,1),this.parent.setRecordValue("predecessor",m,i.ganttProperties,!0),this.parent.predecessorModule.validatePredecessorDates(i)}}r&&this.parent.allowParentDependency||(this.parent.setRecordValue("predecessor",l,e.ganttProperties,!0),this.parent.setRecordValue("predecessorsName","",e.ganttProperties,!0))},r.prototype.backUpAndPushNewlyAddedRecord=function(e,i,a){var r,n,s,o=this.parent.flatData,l=this.parent.currentViewData,d=this.parent.ids;switch(i){case"Top":o.splice(0,0,e),l.splice(0,0,e),d.splice(0,0,e.ganttProperties.rowUniqueID.toString());break;case"Bottom":if(o.push(e),l.push(e),d.push(e.ganttProperties.rowUniqueID.toString()),"ResourceView"===this.parent.viewType){var h=0===e.level?"R"+e.ganttProperties.taskId:"T"+e.ganttProperties.taskId;this.parent.getTaskIds().push(h)}break;case"Above":n=o.indexOf(this.addRowSelectedItem),s=l.indexOf(this.addRowSelectedItem),this.recordCollectionUpdate(void 0,n,s,e,a,i);break;case"Below":r=o.indexOf(this.addRowSelectedItem),this.addRowSelectedItem.hasChildRecords?(n=r+(p=this.getChildCount(this.addRowSelectedItem,0))+1,s=l.indexOf(this.addRowSelectedItem)+this.getVisibleChildRecordCount(this.addRowSelectedItem,0,l)+1):(n=r+1,s=l.indexOf(this.addRowSelectedItem)+1),this.recordCollectionUpdate(NaN,n,s,e,a,i);break;case"Child":if(r=o.indexOf(this.addRowSelectedItem),this.addRowSelectedItem.hasChildRecords){var p=this.getChildCount(this.addRowSelectedItem,0);n=r+p+1,this.addRowSelectedItem.expanded||this.parent.enableMultiTaskbar||this.parent.expandByID(this.addRowSelectedItem.ganttProperties.rowUniqueID),s=l.indexOf(this.addRowSelectedItem)+this.getVisibleChildRecordCount(this.addRowSelectedItem,0,l)+1}else this.parent.setRecordValue("hasChildRecords",!0,this.addRowSelectedItem),this.parent.setRecordValue("isMilestone",!1,this.addRowSelectedItem.ganttProperties,!0),this.parent.setRecordValue("expanded",!0,this.addRowSelectedItem),this.parent.setRecordValue("childRecords",[],this.addRowSelectedItem),n=r+1,s=l.indexOf(this.addRowSelectedItem)+1,this.addRowSelectedItem.ganttProperties.predecessor&&this.updatePredecessorOnIndentOutdent(this.addRowSelectedItem),t.isNullOrUndefined(this.addRowSelectedItem.ganttProperties.segments)||(this.addRowSelectedItem.ganttProperties.segments=null);this.recordCollectionUpdate(NaN,n,s,e,a,i)}this.newlyAddedRecordBackup=e},r.prototype.recordCollectionUpdate=function(e,i,r,n,s,o){var l=this.parent.flatData,d=this.parent.currentViewData,h=this.parent.ids;if(l.splice(i,0,n),d.splice(r,0,n),h.splice(i,0,n.ganttProperties.rowUniqueID.toString()),"ResourceView"===this.parent.viewType){var p=0===n.level?"R"+n.ganttProperties.taskId:"T"+n.ganttProperties.taskId;this.parent.getTaskIds().splice(i,0,p)}if(!t.isNullOrUndefined(s)&&(e="Above"===o?s.childRecords.indexOf(this.addRowSelectedItem):"Below"===o?s.childRecords.indexOf(this.addRowSelectedItem)+1:s.childRecords.length,s.childRecords.splice(e,0,n),this.parent.taskFields.child||(this.parent.taskFields.child="Children"),this.parent.dataSource instanceof a.DataManager&&t.isNullOrUndefined(s.taskData[this.parent.taskFields.parentID])||!t.isNullOrUndefined(this.parent.dataSource))){var u=this.parent.taskFields.child;s.taskData[u]&&s.taskData[u].length>0?"Above"===o||"Below"===o?s.taskData[u].splice(e,0,n.taskData):s.taskData[u].push(n.taskData):(s.taskData[u]=[],s.taskData[u].push(n.taskData)),this.isNewRecordAdded=!0}},r.prototype.constructTaskAddedEventArgs=function(e,t,i){var a={};if(a.action=a.requestType=i,e.length>1){a.data=[],a.newTaskData=[],a.recordIndex=[];for(r=0;r<e.length;r++)a.data[r]=e[r],a.newTaskData[r]=w([e[r]],a.data[r],a,this.parent),a.recordIndex[r]=e[r].index}else if(1===e.length)for(var r=0;r<e.length;r++)a.data=e[r],a.newTaskData=w([e[r]],a.data,a,this.parent),a.recordIndex=e[r].index;return a.modifiedRecords=t,a.modifiedTaskData=w(t,null,null,this.parent),a},r.prototype.addSuccess=function(e){this.parent.updatedConnectorLineCollection=[],this.parent.connectorLineIds=[],this.parent.predecessorModule.createConnectorLinesCollection(this.parent.flatData),this.parent.treeGrid.parentData=[],this.parent.addDeleteRecord=!0,this.parent.treeGrid.isAddedFromGantt=!0,this.isAdded=!0,this.parent.treeGrid.editModule&&(this.parent.treeGrid.editModule.isOnBatch=!1),this.parent.treeGrid.refresh(),this.parent.enableImmutableMode&&(this.parent.modifiedRecords=e.modifiedRecords,this.parent.modifiedRecords.push(e.data),this.refreshRecordInImmutableMode()),this.parent.treeGrid.closeEdit()},r.prototype.refreshRecordInImmutableMode=function(e,i){if(!i&&!t.isNullOrUndefined(e))for(r=e[0].index+1;r<this.parent.currentViewData.length&&e[0].level<this.parent.currentViewData[r].level;r++)this.parent.modifiedRecords.push(this.parent.currentViewData[r]);for(var a=this,r=0;r<this.parent.modifiedRecords.length;r++)!function(e){var t=a.parent.modifiedRecords[e],i=a.parent.rowDragAndDropModule&&a.parent.allowRowDragAndDrop?1:0,r=a.parent.taskFields.id,n=a.parent.currentViewData.findIndex(function(e){return e[r]===t[r]});if(a.parent.treeGrid.getRows()[n]){var s=a.parent.treeGrid.grid.getRowObjectFromUID(a.parent.treeGrid.grid.getDataRows()[n].getAttribute("data-uid"));a.parent.treeGrid.renderModule.cellRender({data:s.data,cell:a.parent.treeGrid.getRows()[n].cells[a.parent.treeColumnIndex+i],column:a.parent.treeGrid.grid.getColumns()[a.parent.treeColumnIndex],requestType:"rowDragAndDrop"}),a.parent.treeGrid.renderModule.RowModifier({data:t,row:a.parent.treeGrid.getRows()[n],rowHeight:a.parent.rowHeight})}}(r)},r.prototype.updateRealDataSource=function(e,i){var r=this.parent.taskFields,n=y(this.parent)?t.getValue("result",this.parent.dataSource):this.parent.dataSource;this.parent.dataSource instanceof a.DataManager&&(n=this.parent.dataSource.dataSource.json);for(var s=0;s<e.length;s++)(t.isNullOrUndefined(i)||t.isNullOrUndefined(this.addRowSelectedItem))&&(i="Bottom"===i?"Bottom":"Top"),"Top"===i?n.splice(0,0,e[s].taskData):"Bottom"===i?n.push(e[s].taskData):t.isNullOrUndefined(r.id)||t.isNullOrUndefined(r.parentID)||"Child"!==i?(this.isNewRecordAdded||this.addDataInRealDataSource(n,e[s].taskData,i),this.isNewRecordAdded=!1):n.push(e[s].taskData),this.isBreakLoop=!1},r.prototype.addDataInRealDataSource=function(e,i,a){for(var r=0;r<e.length;r++){var n=this.parent.taskFields.child;if(this.isBreakLoop)break;if(t.getValue(this.parent.taskFields.id,e[r]).toString()===this.addRowSelectedItem.ganttProperties.rowUniqueID.toString()){var s=void 0;if(this.parent.rowDragAndDropModule&&this.parent.rowDragAndDropModule.droppedRecord&&"ResourceView"===this.parent.viewType)for(var o=0;o<e.length;o++)if(e[o][this.parent.taskFields.id]===this.parent.rowDragAndDropModule.droppedRecord.ganttProperties.taskId){s=o;break}"Above"===a?s?e.splice(s,0,i):e.splice(r,0,i):"Below"===a?s?e.splice(s+1,0,i):e.splice(r+1,0,i):"Child"===a&&(e[r][n]&&e[r][n].length>0?e[r][n].push(i):(e[r][n]=[],e[r][n].push(i))),this.isBreakLoop=!0;break}if(e[r][n]){var l=e[r][n];this.addDataInRealDataSource(l,i,a)}}},r.prototype.updateClientDataFromServer=function(e,t){for(var i=e.addedRecords[0],a=Object.keys(i).length,r=0,n=Object.keys(i);r<a;r++){var s=n[parseInt(r.toString(),10)];t.data[""+s]=i[""+s]}null!==this.parent.taskFields.id&&(t.data.ganttProperties.taskId=i[this.parent.taskFields.id]),null!==this.parent.taskFields.name&&(t.data.ganttProperties.taskName=i[this.parent.taskFields.name]),null!==this.parent.taskFields.startDate&&(t.data.ganttProperties.startDate=i[this.parent.taskFields.startDate]),null!==this.parent.taskFields.endDate&&(t.data.ganttProperties.endDate=i[this.parent.taskFields.endDate]),null!==this.parent.taskFields.duration&&(t.data.ganttProperties.duration=parseFloat(i[this.parent.taskFields.duration])),null!==this.parent.taskFields.durationUnit&&(t.data.ganttProperties.durationUnit=i[this.parent.taskFields.durationUnit]),null!==this.parent.taskFields.progress&&(t.data.ganttProperties.progress=i[this.parent.taskFields.progress]),null!==this.parent.taskFields.dependency&&(t.data.ganttProperties.dependency=i[this.parent.taskFields.dependency]),null!==this.parent.taskFields.parentID&&(t.data.ganttProperties.parentID=i[this.parent.taskFields.parentID]),null!==this.parent.taskFields.baselineEndDate&&(t.data.ganttProperties.baselineEndDate=i[this.parent.taskFields.baselineEndDate]),null!==this.parent.taskFields.baselineStartDate&&(t.data.ganttProperties.baselineStartDate=i[this.parent.taskFields.baselineStartDate]),null!==this.parent.taskFields.resourceInfo&&(t.data.ganttProperties.resources=i[this.parent.taskFields.resourceInfo])},r.prototype.addNewUndoCollection=function(e,i){if(this.parent.undoRedoModule&&(!this.parent.undoRedoModule.isUndoRedoPerformed||this.parent.undoRedoModule.isUndoRedoPerformed&&"Add"===this.parent.undoRedoModule.currentAction.action&&"ResourceView"===this.parent.viewType)&&this.parent.isUndoRedoItemPresent("Add")){e.action="Add";for(var a=i.data.length>0?t.extend([],[],i.data,!0):[i.data],r=[],n=this,s=0;s<a.length;s++)!function(e){r=n.parent.flatData.filter(function(t){return a[e].index===t.index&&a[e].ganttProperties.taskId===t.ganttProperties.taskId})}(s);e.addedRecords=t.extend([],[],r,!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=e}},r.prototype.addRecord=function(e,i,r){var n=this,s=this.parent.taskFields.id;if(this.parent.editModule&&this.parent.editSettings.allowAdding){this.parent.isDynamicData=!0,this.parent.treeGrid.isAddedFromGantt=!0,this.parent.isOnAdded=!0;var o=[];if(t.isNullOrUndefined(e))this.validateTaskPosition(e,i,r,o);else if(e instanceof Array)if(this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed){var l=e,d=r;"ResourceView"===this.parent.viewType&&("below"===e[0].position?i="Below":"above"===e[0].position?i="Above":"child"===e[0].position&&(i="Child"),d=this.parent.taskIds.indexOf(e[0].id.toString()),l=e[0].data),this.validateTaskPosition(l,i,d,o)}else for(var h=0;h<e.length;h++)this.validateTaskPosition(e[h],i,r,o);else{if("object"!=typeof e)return;this.validateTaskPosition(e,i,r,o)}var p={};p=this.constructTaskAddedEventArgs(o,this.parent.editedRecords,"beforeAdd"),t.isNullOrUndefined(i)||(p.rowPosition=i),this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.isUndoRedoItemPresent("Add")&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection()),this.parent.trigger("actionBegin",p,function(e){n.parent.previousRecords={};var r,l=n.parent.taskFields;if(r="ResourceView"===n.parent.viewType?e.data.childRecords.length>0?n.parent.flatData[n.parent.getTaskIds().indexOf("R"+e.data[l.id])]:n.parent.flatData[n.parent.getTaskIds().indexOf("T"+e.data[l.id])]:n.parent.getRecordByID(e.data[l.id]),t.isNullOrUndefined(r)||(n.validateUpdateValues(e.newTaskData,r,!0),n.parent.dateValidationModule.calculateEndDate(r),n.parent.dataOperation.updateWidthLeft(r),n.parent.dataOperation.updateParentItems(r)),!t.isNullOrUndefined(e.data[""+s])&&e.data[s]!==e.data.ganttProperties.taskId){for(var d=0,h=Object.keys(n.parent.ids);d<h.length;d++){var p=h[d];if(n.parent.ids[p]===e.data.ganttProperties.taskId.toString()){n.parent.ids[p]=e.data[s].toString();break}}e.data.ganttProperties.taskId=e.data[s],e.newTaskData[s]=e.data[s],e.data.ganttProperties.rowUniqueID=e.data[s].toString()}if(e.cancel)n.removeAddedRecord(),n.reUpdatePreviousRecords(),n._resetProperties();else{n.parent.showLoadingIndicator();var u={};if(b(n.parent.dataSource)){var c=n.parent.dataSource,g={addedRecords:[e.newTaskData],changedRecords:e.modifiedTaskData},f=n.parent.query instanceof a.Query?n.parent.query:new a.Query,m=c.adaptor;if(!(m instanceof a.WebApiAdaptor||m instanceof a.ODataAdaptor||m instanceof a.ODataV4Adaptor)||c.dataSource.batchUrl){var D=e.data.ganttProperties.taskId;c.saveChanges(g,n.parent.taskFields.id,null,f).then(function(i){if(i.addedRecords[0][n.parent.taskFields.id].toString()!==e.data.ganttProperties.taskId){var a=n.parent.ids.indexOf(D);if(e.data.ganttProperties.taskId=i.addedRecords[0][n.parent.taskFields.id].toString(),e.newTaskData[s]=i.addedRecords[0][n.parent.taskFields.id].toString(),e.data.ganttProperties.rowUniqueID=i.addedRecords[0][n.parent.taskFields.id].toString(),n.parent.ids.some(function(e){return e===i.addedRecords[0][n.parent.taskFields.id].toString()})){var r="The provided ID value "+i.addedRecords[0][n.parent.taskFields.id]+" already exists. Please provide a unique ID value.";n.parent.trigger("actionFailure",{error:r})}else-1!==a?n.parent.ids.splice(a,1,i.addedRecords[0][n.parent.taskFields.id].toString()):n.parent.ids.push(i.addedRecords[0][n.parent.taskFields.id].toString())}var l=e.data.ganttProperties.taskId.toString();if(n.parent.taskFields.id&&!t.isNullOrUndefined(i.addedRecords[0][n.parent.taskFields.id])&&i.addedRecords[0][n.parent.taskFields.id].toString()===l){n.parent.setRecordValue("taskId",i.addedRecords[0][n.parent.taskFields.id],e.data.ganttProperties,!0),n.parent.setRecordValue("taskData",i.addedRecords[0],e.data),n.parent.setRecordValue(n.parent.taskFields.id,i.addedRecords[0][n.parent.taskFields.id],e.data),n.parent.setRecordValue("rowUniqueID",i.addedRecords[0][n.parent.taskFields.id].toString(),e.data.ganttProperties,!0),n.updateClientDataFromServer(i,e);var d=n.parent.ids.indexOf(l);-1!==d&&(n.parent.ids[d]=i.addedRecords[0][n.parent.taskFields.id].toString())}n.updateNewRecord(o,e)}).catch(function(t){n.removeAddedRecord(),n.dmFailure(t,e),n._resetProperties()})}else{c.insert(g.addedRecords,null,f).then(function(i){var a;a=t.isNullOrUndefined(i[0])?g.addedRecords[0]:i[0],o.forEach(function(e){t.isNullOrUndefined(e)||(n.updateEditedRecordFields(a,e),n.parent.dataOperation.updateTaskData(e))}),n.updateNewRecord(o,e)}).catch(function(t){n.removeAddedRecord(),n.dmFailure(t,e),n._resetProperties()})}}else{if("ProjectView"===n.parent.viewType){if("Top"===i||"Bottom"===i||"Above"===i||"Below"===i||"Child"===i||t.isNullOrUndefined(i)&&!e.data.parentItem)if(e.data instanceof Array)n.updateRealDataSource(e.data,i);else{var v=[];v.push(e.data),n.updateRealDataSource(v,i),n.parent.currentSelection=o[0]}}else(y(n.parent)?t.getValue("result",n.parent.dataSource):n.parent.dataSource).push(e.data.taskData);if(0===o.level&&n.parent.treeGrid.parentData.splice(0,0,o),n.updateTreeGridUniqueID(o,"add"),"ResourceView"===n.parent.viewType&&n.parent.undoRedoModule&&n.parent.undoRedoModule.currentAction){var k=!1;if(e.data.hasChildRecords?k=!0:e.data.parentItem&&n.parent.getTaskByUniqueID(e.data.parentItem.uniqueID).ganttProperties.taskName!==n.parent.localeObj.getConstant("unassignedTask")&&(k=!0),-1!==n.parent.taskIds.indexOf("R0")&&n.parent.undoRedoModule&&n.parent.undoRedoModule.isUndoRedoPerformed&&"Delete"===n.parent.undoRedoModule.currentAction.action&&k){var w=n.parent.flatData[n.parent.taskIds.indexOf("R0")],T=w.childRecords.filter(function(t){return t.ganttProperties.taskId===e.data.ganttProperties.taskId});e.data.hasChildRecords&&(T=e.data.childRecords);for(var S=0;S<T.length;S++)!function(e){if(1===w.childRecords.length)n.parent.flatData.splice(n.parent.taskIds.indexOf("R0"),2),n.parent.ids.splice(n.parent.taskIds.indexOf("R0"),2),n.parent.taskIds.splice(n.parent.taskIds.indexOf("R0"),2);else{var t=n.parent.taskIds.indexOf("T"+T[e].ganttProperties.taskId),i="T"+T[e].ganttProperties.taskId,a=n.parent.taskIds.reduce(function(e,t,a){return t===i&&e.push(a),e},[]);t=a[a.length-1],n.parent.taskIds.splice(t,1),n.parent.flatData.splice(t,1),n.parent.ids.splice(t,1)}}(S);w&&"ResourceView"===n.parent.viewType&&(n.parent.flatData[n.parent.taskIds.indexOf("R0")+1]||(n.parent.flatData.splice(n.parent.taskIds.indexOf("R0"),1),n.parent.ids.splice(n.parent.taskIds.indexOf("R0"),1),n.parent.taskIds.splice(n.parent.taskIds.indexOf("R0"),1)))}}n.refreshNewlyAddedRecord(e,o),"ResourceView"===n.parent.viewType&&n.parent.taskFields.work&&r&&n.parent.dataOperation.updateParentItems(r,!0),n.addNewUndoCollection(u,e),n._resetProperties()}n.parent.isOnAdded=!1}})}},r.prototype.createNewRecord=function(){for(var e={},i=this.parent.ganttColumns,a=this.parent.taskFields,r=this.parent.editModule.getNewTaskId(),n=0;n<i.length;n++){var s=i[n].field;s===a.id?e[s]=r:i[n].field===a.startDate?(t.isNullOrUndefined(e[a.endDate])?e[s]=this.parent.editModule.dialogModule.getMinimumStartDate():e[s]=new Date(e[a.endDate]),this.parent.timezone&&(e[s]=this.parent.dateValidationModule.remove(e[s],this.parent.timezone))):i[n].field===a.endDate?(t.isNullOrUndefined(e[a.startDate])?e[s]=this.parent.editModule.dialogModule.getMinimumStartDate():e[s]=new Date(e[a.startDate]),this.parent.timezone&&(e[s]=this.parent.dateValidationModule.remove(e[s],this.parent.timezone))):i[n].field===a.duration?e[s]=1:i[n].field===a.name?e[s]=this.parent.editModule.dialogModule.localeObj.getConstant("addDialogTitle")+" "+r:i[n].field===a.progress?e[s]=0:i[n].field===a.work?e[s]=0:i[n].field===a.type||"taskType"===i[n].field?e[s]=this.parent.taskType:i[n].field===a.milestone?e[s]=null:e[this.parent.ganttColumns[n].field]=""}return e},r.prototype.validateTaskPosition=function(e,i,a,r){var n=t.isNullOrUndefined(a)||isNaN(parseInt(a.toString(),10))?this.parent.selectionModule?"Row"!==this.parent.selectionSettings.mode&&"Both"!==this.parent.selectionSettings.mode||1!==this.parent.selectionModule.selectedRowIndexes.length?"Cell"===this.parent.selectionSettings.mode&&1===this.parent.selectionModule.getSelectedRowCellIndexes().length?this.parent.selectionModule.getSelectedRowCellIndexes()[0].rowIndex:null:this.parent.selectionModule.selectedRowIndexes[0]:null:a;this.addRowSelectedItem=t.isNullOrUndefined(n)?null:this.parent.updatedRecords[n],i=t.isNullOrUndefined(i)?this.parent.editSettings.newRowPosition:i,e=t.isNullOrUndefined(e)?this.createNewRecord():e,((t.isNullOrUndefined(n)||n<0||t.isNullOrUndefined(this.addRowSelectedItem))&&("Above"===i||"Below"===i||"Child"===i)||!i||"Above"!==i&&"Below"!==i&&"Child"!==i&&"Top"!==i&&"Bottom"!==i)&&(i="Top");var s,o=0;switch(i){case"Top":case"Bottom":o="ResourceView"===this.parent.viewType?1:0;break;case"Above":case"Below":o=this.addRowSelectedItem.level,s=this.parent.getParentTask(this.addRowSelectedItem.parentItem);break;case"Child":o=this.addRowSelectedItem.level+1,s=this.addRowSelectedItem}this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed||this.prepareNewlyAddedData(e,i);var l=this.updateNewlyAddedDataBeforeAjax(e,o,i,s,a);r.push(l)},r.prototype.updateRowIndex=function(){for(var e=this.parent.currentViewData,i=e.length,a=0;a<i;a++){var r=a;if(e[a].index=r,e[a].parentItem&&e[a].parentItem.taskId){var n=this.parent.getRecordByID(e[a].parentItem.taskId);t.isNullOrUndefined(n)||t.isNullOrUndefined(n.index)||t.isNullOrUndefined(n.level)||(e[a].parentItem.index=n.index,e[a].parentItem.level=n.level)}}},r.prototype.updateNewRecord=function(e,i){var a=this;e.forEach(function(e){0===e.level&&(a.parent.treeGrid.parentData.splice(0,0,e),t.getValue("dataOperation.dataArray",a.parent).splice(0,0,e.taskData)),a.updateTreeGridUniqueID(e,"add")}),this.updateTreeGridUniqueID(e,"add"),this.refreshNewlyAddedRecord(i,e);var r={};this.addNewUndoCollection(r,i),this._resetProperties()},r.prototype._resetProperties=function(){this.parent.isOnEdit=!1,this.parent.hideSpinner(),this.addRowSelectedItem=null,this.newlyAddedRecordBackup=null,this.isBreakLoop=!1,this.parent.element.tabIndex=0,this.parent.initiateEditAction(!1)},r.prototype.updateTreeGridUniqueID=function(e,i){"add"===i?t.setValue("uniqueIDCollection."+e.uniqueID,e,this.parent.treeGrid):"delete"===i&&t.deleteObject(t.getValue("uniqueIDCollection",this.parent.treeGrid),e.uniqueID)},r.prototype.refreshNewlyAddedRecord=function(e,i){var a=this;if(this.parent.selectionModule&&this.parent.allowSelection&&("Row"===this.parent.selectionSettings.mode||"Both"===this.parent.selectionSettings.mode)&&(this.parent.staticSelectedRowIndex=this.parent.currentViewData.indexOf(e.data)),this.parent.timelineSettings.updateTimescaleView){var r=[];e.modifiedRecords.length>0?(r=e.data.length>0?t.extend([],[],e.data,!0):[e.data]).push.apply(r,e.modifiedRecords):r=e.data.length>0?t.extend([],[],e.data,!0):[e.data],this.parent.timelineModule.updateTimeLineOnEditing([r],e.action)}if(this.addSuccess(e),e=this.constructTaskAddedEventArgs(i,e.modifiedRecords,"add"),this.updateRowIndex(),this.parent.trigger("actionComplete",e),this.parent.hideLoadingIndicator(),this.dialogModule.dialog&&!this.dialogModule.dialogObj.isDestroyed&&this.dialogModule.dialogObj.hide(),this.dialogModule.dialogClose(),"ResourceView"===this.parent.viewType)if(i.length>1)for(var n=0;n<i.length;n++){if(e.data[n].ganttProperties.sharedTaskUniqueIds.push(e.data[n].ganttProperties.rowUniqueID),e.data[n].ganttProperties.resourceInfo){var s=t.extend([],[],e.data[n].ganttProperties.resourceInfo,!0);s.splice(0,1),this.updateResoures([],s,e.data[n])}else(!this.parent.undoRedoModule||this.parent.undoRedoModule&&!e.data[n].hasChildRecords&&this.parent.undoRedoModule.isUndoRedoPerformed||!this.parent.undoRedoModule.isUndoRedoPerformed)&&(this.removeChildRecord(e.data[n]),this.parent.editModule.checkWithUnassignedTask(e.data[n]));for(u=0;u<this.updateParentRecords.length;u++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[u]);this.updateParentRecords=[]}else{e.data.ganttProperties.sharedTaskUniqueIds.push(e.data.ganttProperties.rowUniqueID);var o=e.data,l=o.ganttProperties,d=o.childRecords,h=this.parent.undoRedoModule,p=function(e,i){if(e&&e.length>1){var r=t.extend([],[],e,!0);r.splice(0,1),h&&h.isUndoRedoPerformed&&(a.parent.editModule.addRowIndex=void 0),a.updateResoures([],r,i)}};l.resourceInfo&&l.resourceInfo.length?p(l.resourceInfo,o):d.length>0&&d[0].ganttProperties.resourceInfo&&d[0].ganttProperties.resourceInfo.length?p(d[0].ganttProperties.resourceInfo,e.data.childRecords[0]):(!this.parent.undoRedoModule||this.parent.undoRedoModule&&!e.data.hasChildRecords&&this.parent.undoRedoModule.isUndoRedoPerformed||!this.parent.undoRedoModule.isUndoRedoPerformed)&&(this.removeChildRecord(e.data),this.parent.editModule.checkWithUnassignedTask(e.data));for(var u=0;u<this.updateParentRecords.length;u++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[u]);this.updateParentRecords=[]}},r.prototype.removeAddedRecord=function(){var e=this.parent.flatData,i=this.parent.currentViewData,a=this.parent.ids,r=e.indexOf(this.newlyAddedRecordBackup),n=i.indexOf(this.newlyAddedRecordBackup),s=a.indexOf(this.newlyAddedRecordBackup.ganttProperties.rowUniqueID.toString());if(t.deleteObject(this.parent.previousRecords,e[r].uniqueID),this.newlyAddedRecordBackup.parentItem){var o=this.parent.getParentTask(this.newlyAddedRecordBackup.parentItem),l=o.childRecords.indexOf(this.newlyAddedRecordBackup);o.childRecords.splice(l,1),0===o.childRecords.length&&o.hasChildRecords&&(o.hasChildRecords=!1)}e.splice(r,1),i.splice(n,1),a.splice(s,1)},r.prototype.getPrevRecordIndex=function(){var e=this.parent.updatedRecords[this.parent.selectionModule.getSelectedRowIndexes()[0]-1],t=this.parent.selectionModule.getSelectedRecords()[0],i=this.parent.getRootParent(e,t.level);return this.parent.updatedRecords.indexOf(i)},r.prototype.indent=function(){var e,i=this.parent.selectedRowIndex,a=!!this.parent.selectionModule&&(1===this.parent.selectionModule.selectedRowIndexes.length||1===this.parent.selectionModule.getSelectedRowCellIndexes().length),r=this.parent.updatedRecords[this.parent.selectionModule.getSelectedRowIndexes()[0]-1],n=this.parent.selectionModule.getSelectedRecords()[0];this.parent.editSettings.allowEditing&&0!==i&&-1!==i&&a&&"ResourceView"!==this.parent.viewType&&(t.isNullOrUndefined(this.parent.updatedRecords[i])||this.parent.updatedRecords[i].level-r.level!=1)&&(e=r.level-n.level==0?this.parent.selectionModule.getSelectedRowIndexes()[0]-1:this.getPrevRecordIndex(),this.indentOutdentRow([this.parent.selectionModule.getSelectedRowIndexes()[0]],e,"child"))},r.prototype.outdent=function(){var e,t=this.parent.selectionModule.getSelectedRowIndexes()[0],i=!!this.parent.selectionModule&&(1===this.parent.selectionModule.selectedRowIndexes.length||1===this.parent.selectionModule.getSelectedRowCellIndexes().length);if(this.parent.editSettings.allowEditing&&-1!==t&&0!==t&&i&&"ResourceView"!==this.parent.viewType&&0!==this.parent.updatedRecords[t].level){var a=this.parent.getTaskByUniqueID(this.parent.selectionModule.getSelectedRecords()[0].parentItem.uniqueID);e=this.parent.updatedRecords.indexOf(a),this.indentOutdentRow([t],e,"below")}},r.prototype.indentOutdentRow=function(e,t,i){var a=this;if(e[0],!0){"above"===i&&(this.dropPosition="topSegment"),"below"===i&&(this.dropPosition="bottomSegment"),"child"===i&&(this.dropPosition="middleSegment");for(var r=void 0,n=[],s=0;s<e.length;s++)this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.undoRedoModule.currentAction?this.parent.undoRedoModule.currentAction.modifiedRecord?n[s]=this.parent.undoRedoModule.currentAction.modifiedRecord[s].data:n[s]=this.parent.undoRedoModule.currentAction.data[s]:n[s]=this.parent.updatedRecords[e[s]];var o={data:n,dropIndex:t,dropPosition:this.dropPosition};"middleSegment"===this.dropPosition?r="indenting":"bottomSegment"===this.dropPosition&&(r="outdenting");var l={action:r,data:n[0],cancel:!1};this.parent.trigger("actionBegin",l,function(e){if(e.cancel)return void a.parent.hideLoadingIndicator();a.parent.showLoadingIndicator(),a.reArrangeRows(o,!0)})}},r.prototype.reArrangeRows=function(e,i){var a=this;if(this.dropPosition=e.dropPosition,this.parent.oldRecords=[],this.parent.oldRecords=t.extend([],[],e.data,!0),"Invalid"!==e.dropPosition&&this.parent.editModule){var r=this.parent,n=void 0;this.droppedRecord=r.updatedRecords[e.dropIndex];var s="middleSegment"===e.dropPosition?"Indent":"Outdent";this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.isUndoRedoItemPresent(s)&&((g={}).action=s,g.modifiedRecord=[],g.selectedRowIndexes=t.extend([],[],this.parent.selectionModule.selectedRowIndexes,!0),this.parent.undoRedoModule.findPosition(t.extend([],[],[e.data],!0)[0],g,"modifiedRecord"),g.droppedRecord=t.extend([],[],this.droppedRecord,!0),this.parent.undoRedoModule.redoEnabled&&(this.parent.undoRedoModule.redoEnabled=!1,this.parent.undoRedoModule.getUndoCollection=[],this.parent.undoRedoModule.getRedoCollection=[],this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_redo"],!1),this.parent.undoRedoModule.getUndoCollection[0]=[]),this.parent.undoRedoModule.createUndoCollection(),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=g);var o=[],l=this.droppedRecord;e.data[0]?o=e.data:o.push(e.data);for(var d=0,h=o.length,p=0;p<h;p++){if(this.parent.isOnEdit=!0,n=o[p],this.draggedRecord=n,"Invalid"!==this.dropPosition){i&&this.deleteDragRow();var u=this.treeGridData.indexOf(l);if(this.parent.editModule.updateResourceRelatedFields(l,""),"bottomSegment"===this.dropPosition&&-1!==u){if(l.hasChildRecords){d=this.parent.editModule.getChildCount(l,0),this.parent.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(u+d+1,0,this.draggedRecord.taskData),this.treeGridData.splice(u+d+1,0,this.draggedRecord),this.parent.ids.splice(u+d+1,0,this.draggedRecord.ganttProperties.rowUniqueID.toString());var c=this.parent.ids.indexOf(this.draggedRecord[this.parent.taskFields.id].toString());c!==u+d+1&&(this.parent.ids.splice(c,1),this.parent.ids.splice(u+d+1,0,this.draggedRecord[this.parent.taskFields.id].toString()))}else this.parent.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(u+1,0,this.draggedRecord.taskData),this.treeGridData.splice(u+1,0,this.draggedRecord),this.parent.ids.splice(u+1,0,this.draggedRecord.ganttProperties.rowUniqueID.toString());if(this.parent.setRecordValue("parentItem",this.treeGridData[u].parentItem,n),this.parent.setRecordValue("parentUniqueID",this.treeGridData[u].parentUniqueID,n),this.parent.setRecordValue("level",this.treeGridData[u].level,n),n.hasChildRecords){this.updateChildRecordLevel(n,1),this.updateChildRecord(n,u+d+1)}if(l.parentItem){var g=this.parent.getParentTask(l.parentItem).childRecords,f=g,m=f.indexOf(l)+1;f.splice(m,0,n)}}"middleSegment"===this.dropPosition&&this.dropMiddle(u),t.isNullOrUndefined(n.parentItem&&-1!==this.updateParentRecords.indexOf(n.parentItem))||this.updateParentRecords.push(this.parent.getTaskByUniqueID(n.parentItem.uniqueID))}if(t.isNullOrUndefined(n.parentItem)){var y=this.parent.treeGrid.parentData,D=y.indexOf(this.droppedRecord);"bottomSegment"===this.dropPosition&&y.splice(D+1,0,n)}this.refreshDataSource()}if("middleSegment"===this.dropPosition){if(!t.isNullOrUndefined(l.ganttProperties.predecessor))for(var v=l.ganttProperties.predecessor.length-1;v>=0;v--)if(!t.isNullOrUndefined(l.ganttProperties.predecessor)){var k=this.parent.getRecordByID(l.ganttProperties.predecessor[v].from),b=this.parent.getRecordByID(l.ganttProperties.predecessor[v].to),w=this.parent.predecessorModule.validateParentPredecessor(k,b);!l.ganttProperties.predecessor||w&&this.parent.allowParentDependency||(this.parent.editModule.removePredecessorOnDelete(l),l.ganttProperties.predecessor.splice(v,1),l.ganttProperties.predecessorsName=null,l[this.parent.taskFields.dependency]=null,l.taskData[this.parent.taskFields.dependency]=null)}l.ganttProperties.isMilestone&&(this.parent.setRecordValue("isMilestone",!1,l.ganttProperties,!0),t.isNullOrUndefined(l.taskData[this.parent.taskFields.milestone])||!0===l.taskData[this.parent.taskFields.milestone]&&(l.taskData[this.parent.taskFields.milestone]=!1))}for(T=0;T<this.updateParentRecords.length;T++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[T]);this.parent.editedRecords.forEach(function(e){a.isFirstCall=!0,a.parent.predecessorModule.validatePredecessor(e,[],"")});for(var T=0;T<this.updateParentRecords.length;T++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[T]);this.updateParentRecords=[],this.parent.isOnEdit=!1}this.canReset=!0,this.refreshRecord(e)},r.prototype.refreshRecord=function(e,t){var i=this;if(b(this.parent.dataSource)){var r=this.parent.dataSource,n={changedRecords:w(this.parent.editedRecords,null,null,this.parent)},s=this.parent.query instanceof a.Query?this.parent.query:new a.Query,o=null,l=r.adaptor;if(l instanceof a.WebApiAdaptor&&l instanceof a.ODataAdaptor&&!r.dataSource.batchUrl){o=r.update(this.parent.taskFields.id,n.changedRecords,null,s)}else o=r.saveChanges(n,this.parent.taskFields.id,null,s);o.then(function(a){return i.indentSuccess(a,e,t)}).catch(function(e){return i.indentFailure(e)})}else this.indentOutdentSuccess(e,t)},r.prototype.indentSuccess=function(e,t,i){this.updateEditedFields(e),this.indentOutdentSuccess(t,i)},r.prototype.indentFailure=function(e){this.parent.trigger("actionFailure",{error:e})},r.prototype.indentOutdentSuccess=function(e,t){if(this.parent.treeGrid.parentData=[],this.parent.treeGrid.editModule&&(this.parent.treeGrid.editModule.isOnBatch=!1),this.parent.treeGrid.refresh(),this.parent.enableImmutableMode&&(this.refreshRecordInImmutableMode(e.data,t),this.parent.chartRowsModule.refreshRecords(this.parent.editedRecords)),t?e.requestType="rowDropped":"middleSegment"===this.dropPosition?e.requestType="indented":"bottomSegment"===this.dropPosition&&(e.requestType="outdented"),e.modifiedRecords=this.parent.editedRecords,this.parent.timezone)for(var i=0;i<e.modifiedRecords.length;i++)T(e.modifiedRecords[i],this.parent);this.canReset&&(this.parent.previousRecords={}),this.canReset=!1,this.parent.trigger("actionComplete",e),this.parent.hideLoadingIndicator(),this.parent.rowDragAndDropModule&&(this.parent.rowDragAndDropModule.draggedRecord=null)},r.prototype.refreshDataSource=function(){var e,i,r=this.draggedRecord,n=this.droppedRecord,s=this.parent;if((e=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):s.dataSource).length>0&&!t.isNullOrUndefined(n)&&!n.parentItem){for(var o=0;o<Object.keys(e).length;o++)e[o][this.parent.taskFields.child]===n.taskData[this.parent.taskFields.child]&&(i=o);"topSegment"===this.dropPosition?this.parent.taskFields.parentID||e.splice(i,0,r.taskData):"bottomSegment"===this.dropPosition&&(this.parent.taskFields.parentID||e.splice(i+1,0,r.taskData))}else if(!this.parent.taskFields.parentID&&!t.isNullOrUndefined(n)&&n.parentItem&&("topSegment"===this.dropPosition||"bottomSegment"===this.dropPosition)){var l="topSegment"===this.dropPosition?"Above":"Below";this.parent.editModule.addRowSelectedItem=n;var d=[];Array.isArray(r)?d=r:d[0]=r,this.parent.editModule.updateRealDataSource(d,l),delete this.parent.editModule.addRowSelectedItem}this.parent.taskFields.parentID&&(r.parentItem?"topSegment"===this.dropPosition||"bottomSegment"===this.dropPosition?(r[this.parent.taskFields.parentID]=n[this.parent.taskFields.parentID],r.taskData[this.parent.taskFields.parentID]=n[this.parent.taskFields.parentID],r.ganttProperties.parentId=n[this.parent.taskFields.parentID]):(r[this.parent.taskFields.parentID]=n[this.parent.taskFields.id],r.taskData[this.parent.taskFields.parentID]=n[this.parent.taskFields.id],r.ganttProperties.parentId=n[this.parent.taskFields.id]):(r[this.parent.taskFields.parentID]=null,r.taskData[this.parent.taskFields.parentID]=null,r.ganttProperties.parentId=null))},r.prototype.deleteDragRow=function(){this.parent.dataSource instanceof a.DataManager?this.ganttData=t.getValue("dataOperation.dataArray",this.parent):this.ganttData=y(this.parent)?t.getValue("result",this.parent.dataSource):this.parent.dataSource,this.treeGridData=y(this.parent)?t.getValue("result",this.parent.treeGrid.dataSource):this.parent.treeGrid.dataSource;var e=this.parent.getTaskByUniqueID(this.draggedRecord.uniqueID);this.removeRecords(e)},r.prototype.updateIndentedChildRecords=function(e){for(var t={uniqueID:e.uniqueID,expanded:e.expanded,level:e.level,index:e.index,taskId:e.ganttProperties.rowUniqueID},i=0;i<e.childRecords.length;i++)this.parent.setRecordValue("parentItem",t,e.childRecords[i]),this.parent.setRecordValue("parentUniqueID",e.uniqueID,e.childRecords[i]);if(e.hasChildRecords){e=e.childRecords;for(var a=0;a<e.length;a++)this.updateIndentedChildRecords(e[a])}},r.prototype.dropMiddle=function(e){var i,a,r=this.parent;if(this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.undoRedoModule.currentAction.modifiedRecord&&"child"!==this.parent.undoRedoModule.currentAction.modifiedRecord[0].position?"above"===this.parent.undoRedoModule.currentAction.modifiedRecord[0].position?a=this.parent.ids.indexOf(this.parent.undoRedoModule.currentAction.modifiedRecord[0].id.toString()):"below"===this.parent.undoRedoModule.currentAction.modifiedRecord[0].position&&(a=this.parent.ids.indexOf(this.parent.undoRedoModule.currentAction.modifiedRecord[0].id.toString())+1):(i=this.parent.editModule.getChildCount(this.droppedRecord,0),a=t.isNullOrUndefined(i)||0===i?e+1:i+e+1),"middleSegment"===this.dropPosition){if(this.droppedRecord.ganttProperties.isAutoSchedule&&!t.isNullOrUndefined(this.droppedRecord.ganttProperties.predecessorsName)&&""!==this.droppedRecord.ganttProperties.predecessorsName){var n=this.droppedRecord.ganttProperties.startDate;this.parent.setRecordValue("startDate",n,this.draggedRecord.ganttProperties,!0),this.parent.dateValidationModule.calculateEndDate(this.draggedRecord),this.parent.dataOperation.updateTaskData(this.draggedRecord),this.parent.dataOperation.updateTaskLeftWidth(this.draggedRecord)}if(r.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(a,0,this.draggedRecord.taskData),this.treeGridData.splice(a,0,this.draggedRecord),this.parent.ids.splice(a,0,this.draggedRecord[this.parent.taskFields.id].toString()),this.recordLevel(),this.draggedRecord.hasChildRecords&&(this.updateChildRecord(this.draggedRecord,a,this.droppedRecord.expanded),this.parent.enableImmutableMode)){var s=this.draggedRecord;this.updateIndentedChildRecords(s)}t.isNullOrUndefined(this.draggedRecord.parentItem&&-1!==this.updateParentRecords.indexOf(this.draggedRecord.parentItem))&&this.updateParentRecords.push(this.draggedRecord.parentItem)}},r.prototype.updateChildRecordLevel=function(e,t){var i,a=0;if(t++,!e.hasChildRecords)return 0;a=e.childRecords.length;for(var r=0;r<a;r++){i=e.childRecords[r];var n=void 0;if(e.parentItem){n=this.parent.treeGrid.uniqueIDCollection[e.parentItem.uniqueID]}i.level=e.parentItem?n.level+t:e.level+1,i.hasChildRecords&&(t--,t=this.updateChildRecordLevel(i,t))}return t},r.prototype.updateChildRecord=function(e,t,i){var a,r=this.parent,n=0;if(!e.hasChildRecords)return 0;n=e.childRecords.length;for(var s=0;s<n;s++)a=e.childRecords[s],t++,r.flatData.splice(t,0,a),this.parent.ids.splice(t,0,a.ganttProperties.rowUniqueID.toString()),r.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(t,0,a.taskData),a.hasChildRecords&&(t=this.updateChildRecord(a,t));return t},r.prototype.removeRecords=function(e){var i,r=this.parent;i=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):this.parent.dataSource;var n=e;if(n){var s=this.parent.getParentTask(n.parentItem);if(n.parentItem){var o=s?s.childRecords:[],l=0;o&&o.length>0&&(l=o.indexOf(n),s.childRecords.splice(l,1),this.parent.taskFields.parentID||s.taskData[this.parent.taskFields.child].splice(l,1),this.updateParentRecords.push(s))}if(r.taskFields.parentID){n.hasChildRecords&&n.childRecords.length>0&&this.removeChildItem(n);for(var d=void 0,h=i.length>0?i:this.parent.currentViewData,p=0;p<h.length;p++)h[p][this.parent.taskFields.id]===n.taskData[this.parent.taskFields.id]&&(d=p);if(-1!==d){i.length>0&&i.splice(d,1);for(var u=void 0,p=0;p<this.treeGridData.length;p++)this.treeGridData[p][this.parent.taskFields.id]===n.taskData[this.parent.taskFields.id]&&(u=p);this.treeGridData.splice(u,1),this.parent.ids.splice(u,1),-1!==this.parent.treeGrid.parentData.indexOf(n)&&this.parent.treeGrid.parentData.splice(this.parent.treeGrid.parentData.indexOf(n),1)}}var c=this.treeGridData.indexOf(n);if(!r.taskFields.parentID){var g=this.getChildCount(n,0);this.treeGridData.splice(c,g+1),this.parent.ids.splice(c,g+1);var f=this.ganttData.indexOf(n.taskData);-1!==f&&(this.ganttData.splice(f,1),this.parent.treeGrid.parentData.splice(f,1))}n.parentItem&&s&&s.childRecords&&!s.childRecords.length&&(this.parent.setRecordValue("expanded",!1,s),this.parent.setRecordValue("hasChildRecords",!1,s))}},r.prototype.removeChildItem=function(e){for(var i,r,n=0;n<e.childRecords.length;n++){i=e.childRecords[n];var s=void 0;s=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):this.parent.dataSource;for(var o=0;o<s.length;o++)s[o][this.parent.taskFields.id]===i.taskData[this.parent.taskFields.id]&&(r=o);if(-1!==r){s.length>0&&s.splice(r,1);for(var l=void 0,d=0;d<this.treeGridData.length;d++)this.treeGridData[d][this.parent.taskFields.id]===i.taskData[this.parent.taskFields.id]&&(l=d);this.treeGridData.splice(l,1),this.parent.ids.splice(l,1)}i.hasChildRecords&&this.removeChildItem(i)}},r.prototype.insertDraggedRecordAtIndex=function(e,t){var i=t.index,a=e.childRecords.findIndex(function(e){return e.index>=i});-1===a?e.childRecords.splice(e.childRecords.length,0,t):e.childRecords.splice(a,0,t)},r.prototype.recordLevel=function(){var e=this.parent,i=this.draggedRecord,a=this.droppedRecord,r=e.taskFields.child;if(a.hasChildRecords||(a.hasChildRecords=!0,a.childRecords.length||(a.childRecords=[],!e.taskFields.parentID&&t.isNullOrUndefined(a.taskData[r])&&(a.taskData[r]=[]))),"middleSegment"===this.dropPosition){var n=t.extend({},a);delete n.childRecords;var s={uniqueID:n.uniqueID,expanded:n.expanded,level:n.level,index:n.index,taskId:n.ganttProperties.rowUniqueID};if(this.parent.setRecordValue("parentItem",s,i),this.parent.setRecordValue("parentUniqueID",a.uniqueID,i),this.insertDraggedRecordAtIndex(a,i),t.isNullOrUndefined(i)||e.taskFields.parentID||t.isNullOrUndefined(a.taskData[r])||a.taskData[e.taskFields.child].splice(a.childRecords.length,0,i.taskData),!t.isNullOrUndefined(a.ganttProperties.segments)&&a.ganttProperties.segments.length>0&&(a.ganttProperties.segments=null,a.taskData[e.taskFields.segments]=null),i.hasChildRecords){i.level=a.level+1,this.updateChildRecordLevel(i,1)}else i.level=a.level+1;a.expanded=!0}},r}(),Pt=function(){function e(e){this.parent=e,n.TreeGrid.Inject(n.Reorder),this.parent.treeGrid.allowReordering=this.parent.allowReordering,this.bindEvents()}return e.prototype.getModuleName=function(){return"reorder"},e.prototype.bindEvents=function(){var e=this;this.parent.treeGrid.columnDragStart=function(t){e.parent.trigger("columnDragStart",t)},this.parent.treeGrid.columnDrag=function(t){e.parent.trigger("columnDrag",t)},this.parent.treeGrid.columnDrop=function(t){e.parent.trigger("columnDrop",t)}},e.prototype.destroy=function(){},e}(),Ct=function(){return(Ct=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)},Rt=function(){function e(e){this.parent=e,n.TreeGrid.Inject(n.Resize),this.parent.treeGrid.allowResizing=this.parent.allowResizing,this.bindEvents()}return e.prototype.getModuleName=function(){return"resize"},e.prototype.bindEvents=function(){var e=this;this.parent.treeGrid.resizeStart=function(t){if(e.parent.undoRedoModule&&e.parent.isUndoRedoItemPresent("ColumnResize")){e.parent.undoRedoModule.createUndoCollection();var i={};i.action="ColumnResize",i.resizedColumn=Ct({},t.column),e.parent.undoRedoModule.getUndoCollection[e.parent.undoRedoModule.getUndoCollection.length-1]=i}e.parent.trigger("resizeStart",t)},this.parent.treeGrid.resizing=function(t){e.parent.trigger("resizing",t)},this.parent.treeGrid.resizeStop=function(t){e.parent.trigger("resizeStop",t)}},e.prototype.destroy=function(){},e}(),Mt=function(){function e(e){this.parent=e,n.TreeGrid.Inject(n.Filter),this.parent.treeGrid.allowFiltering=this.parent.allowFiltering,this.updateCustomFilters(),this.parent.treeGrid.filterSettings=r.getActualProperties(this.parent.filterSettings),this.addEventListener()}return e.prototype.getModuleName=function(){return"filter"},e.prototype.updateCustomFilters=function(){for(var e=this.parent.taskFields,t=0;t<this.parent.ganttColumns.length;t++){var i=this.parent.ganttColumns[t];("datepickeredit"!==i.editType&&"datetimepickeredit"!==i.editType||i.field!==e.startDate&&i.field!==e.endDate&&i.field!==e.baselineStartDate&&i.field!==e.baselineEndDate)&&(i.field!==e.duration||"stringedit"!==i.editType)||this.initiateFiltering(this.parent.ganttColumns[t])}},e.prototype.updateModel=function(){this.parent.filterSettings=this.parent.treeGrid.filterSettings},e.prototype.addEventListener=function(){this.parent.on("updateModel",this.updateModel,this),this.parent.on("actionBegin",this.actionBegin,this),this.parent.on("actionComplete",this.actionComplete,this),this.parent.on("columnMenuOpen",this.columnMenuOpen,this)},e.prototype.wireEvents=function(e){t.EventHandler.add(document.getElementById(e),"click",this.mouseClickHandler,this)},e.prototype.initiateFiltering=function(e){var t=this.parent.getColumnByField(e.field,this.parent.treeGridModule.treeGridColumns);e.allowFiltering=!1!==e.allowFiltering,!e.allowFiltering||"Menu"!==this.parent.filterSettings.type&&"Excel"!==this.parent.filterSettings.type||e.filter||(e.filter={ui:this.getCustomFilterUi(e)}),t&&(t.allowFiltering=e.allowFiltering,t.filter=e.allowFiltering?e.filter:{})},e.prototype.getCustomFilterUi=function(e){var t=this.parent.taskFields,i={};return"datepickeredit"!==e.editType||e.field!==t.startDate&&e.field!==t.endDate&&e.field!==t.baselineStartDate&&e.field!==t.baselineEndDate?"datetimepickeredit"!==e.editType||e.field!==t.startDate&&e.field!==t.endDate&&e.field!==t.baselineStartDate&&e.field!==t.baselineEndDate?e.field===t.duration&&"stringedit"===e.editType&&(i=this.getDurationFilter()):i=this.getDateTimePickerFilter():i=this.getDatePickerFilter(e.field),i},e.prototype.mouseClickHandler=function(e){t.closest(e.target,".e-excelfilter")&&this.parent.treeGrid.grid.notify("click",e)},e.prototype.unWireEvents=function(){t.EventHandler.remove(this.parent.element,"click",this.mouseClickHandler)},e.prototype.getDatePickerFilter=function(e){var i,a=this,n=this.parent,s=e===n.taskFields.startDate||e===n.taskFields.baselineStartDate?n.defaultStartTime:n.defaultEndTime;return{create:function(e){var n=r.getCustomDateFormat(e.column.format,e.column.type),s=t.createElement("input",{className:"flm-input"});e.target.appendChild(s),(i=new c.DatePicker({placeholder:a.parent.localeObj.getConstant("enterValue"),format:n})).enableRtl=a.parent.enableRtl,i.appendTo(s)},write:function(e){i.value=e.filteredValue},read:function(e){i.value&&i.value.setSeconds(s),e.fltrObj.filterByColumn(e.column.field,e.operator,i.value)}}},e.prototype.getDateTimePickerFilter=function(){var e,i=this;return{create:function(a){var n=r.getCustomDateFormat(a.column.format,a.column.type),s=t.createElement("input",{className:"flm-input"});a.target.appendChild(s),(e=new c.DateTimePicker({placeholder:i.parent.localeObj.getConstant("enterValue"),format:n})).enableRtl=i.parent.enableRtl,e.appendTo(s)},write:function(t){e.value=t.filteredValue},read:function(t){t.fltrObj.filterByColumn(t.column.field,t.operator,e.value)}}},e.prototype.getDurationFilter=function(){var e,i=this,a=this.parent,r="";return{create:function(a){var r=t.createElement("input",{className:"e-input"});r.setAttribute("placeholder",i.parent.localeObj.getConstant("enterValue")),a.target.appendChild(r),(e=new p.TextBox).enableRtl=i.parent.enableRtl,e.appendTo(r)},write:function(t){e.value=t.filteredValue?r:""},read:function(n){var s=i.parent.dataOperation.getDurationValue(e.value),o=t.getValue("duration",s),l=t.getValue("durationUnit",s);if(o>=0){var d=void 0;"minute"===l?d=60*o/a.secondsPerDay:"hour"===l?d=60*o*60/a.secondsPerDay:(d=o,l="day"),n.fltrObj.filterByColumn(n.column.field,n.operator,d),r=i.parent.dataOperation.getDurationString(o,l)}else n.fltrObj.filterByColumn(n.column.field,n.operator,null),r=null}}},e.prototype.columnMenuOpen=function(e){this.filterMenuElement&&document.body.contains(this.filterMenuElement)&&t.remove(this.filterMenuElement),this.filterMenuElement=null},e.prototype.actionBegin=function(e){},e.prototype.closeFilterOnContextClick=function(e){var i=document.querySelector("body > div.e-datepicker"),a=document.querySelector("body > div.e-datetimepicker");if(this.filterMenuElement&&document.body.contains(this.filterMenuElement)){var r=t.closest(e,"#"+this.parent.element.id)||e.querySelector("#"+this.parent.element.id);(this.filterMenuElement.contains(e)||t.isNullOrUndefined(r))&&(this.filterMenuElement.contains(e)||this.parent.enableAdaptiveUI||!t.isNullOrUndefined(i)||!t.isNullOrUndefined(a)||"DIV"!==e.nodeName&&"HTML"!==e.nodeName&&"SPAN"!==e.nodeName&&"BUTTON"!==e.nodeName||e.classList.contains("e-dropdownbase"))||(t.remove(this.filterMenuElement),this.parent.treeGrid.grid.notify("filter-menu-close",{isOpen:!1}),this.filterMenuElement=null)}},e.prototype.actionComplete=function(e){if(t.isNullOrUndefined(e.filterModel)||t.isNullOrUndefined(e.filterModel.dialogObj)||t.isNullOrUndefined(e.filterModel.dialogObj.element)||"Excel"===this.parent.filterSettings.type&&this.wireEvents(e.filterModel.dialogObj.element.id),e.requestType===r.filterAfterOpen){"Menu"===this.parent.treeGrid.filterSettings.type?this.filterMenuElement=t.getValue("filterModel.dlgObj.element",e):this.filterMenuElement=t.getValue("filterModel.dialogObj.element",e),this.updateFilterMenuPosition(this.filterMenuElement,e);var i=this.parent.taskFields.id,a=this.parent.taskFields.dependency,n=this.parent.taskFields.resourceInfo,s=this.parent.treeGrid.grid.filterModule,o=t.getValue("values",s);if(e.columnName===a&&t.isNullOrUndefined(t.getValue(a,o))||e.columnName===n&&t.isNullOrUndefined(t.getValue(n,o))){var l=this.filterMenuElement.querySelector(".e-dropdownlist"),d=void 0;t.isNullOrUndefined(l)||((d=t.getValue("ej2_instances[0]",l)).index=2,d.dataBind())}else if(e.columnName===i&&t.isNullOrUndefined(t.getValue(i,o))&&"Menu"===this.parent.treeGrid.filterSettings.type){var l=this.filterMenuElement.querySelector(".e-flmenu-input"),d=t.getValue("ej2_instances[0]",l);!t.isNullOrUndefined(d)&&t.isNullOrUndefined(this.parent.columnByField[e.columnName].format)&&(d.format="n")}}},e.prototype.setPosition=function(e,t){var i=this.parent.element.getBoundingClientRect(),a=this.parent.element.offsetParent.getBoundingClientRect(),r=e.getBoundingClientRect(),n=t.getBoundingClientRect(),s=i.left-r.left,o=this.parent.enableRtl?Math.abs(s)-n.width:r.width-s,l=a.top;"BODY"===t.offsetParent.tagName&&(l=0);var d=r.top-l+window.scrollY;t.style.left="",t.style.top=d+"px",t.style.marginLeft=o+"px"},e.prototype.updateFilterMenuPosition=function(e,i){t.addClass([e],"e-gantt"),this.parent.enableAdaptiveUI||document.querySelector("#"+this.parent.controlId).appendChild(e);var a;if(e.style.display="block",this.parent.showColumnMenu){if(a=document.querySelector("#treeGrid"+this.parent.controlId+"_gridcontrol_colmenu_Filter"))if(e.style.zIndex=a.parentElement.style.zIndex,"Menu"===this.parent.treeGrid.filterSettings.type)this.setPosition(a,t.getValue("filterModel.dlgObj.element",i));else{var n=t.getValue("filterModel.dialogObj.element",i);n&&(n.style.visibility="hidden"),this.setPosition(a,n)}}else a=this.parent.treeGrid.grid.getColumnHeaderByField(i.columnName).querySelector(".e-filtermenudiv"),"Menu"===this.parent.treeGrid.filterSettings.type?r.getFilterMenuPostion(a,t.getValue("filterModel.dlgObj",i)):r.getFilterMenuPostion(a,t.getValue("filterModel.dialogObj",i));e.style.visibility="visible","Menu"===this.parent.treeGrid.filterSettings.type&&e.querySelector(".e-valid-input").focus(),"Excel"===this.parent.treeGrid.filterSettings.type&&document.querySelector(".e-searchinput").focus()},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("updateModel",this.updateModel),this.parent.off("actionBegin",this.actionBegin),this.parent.off("actionComplete",this.actionComplete),this.parent.off("columnMenuOpen",this.columnMenuOpen))},e.prototype.destroy=function(){this.removeEventListener(),this.unWireEvents()},e}(),xt=function(){function e(e){this.parent=e,n.TreeGrid.Inject(n.Sort),this.parent.treeGrid.allowSorting=this.parent.allowSorting,this.parent.treeGrid.sortSettings=r.getActualProperties(this.parent.sortSettings),this.addEventListener()}return e.prototype.getModuleName=function(){return"sort"},e.prototype.addEventListener=function(){this.parent.on("updateModel",this.updateModel,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("updateModel",this.updateModel)},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.sortColumn=function(e,t,i){this.parent.treeGrid.sortByColumn(e,t,i)},e.prototype.clearSorting=function(){this.parent.treeGrid.clearSorting()},e.prototype.updateModel=function(){this.parent.sortSettings=this.parent.treeGrid.sortSettings},e.prototype.removeSortColumn=function(e){this.parent.treeGrid.grid.removeSortColumn(e)},e}(),Ot=function(){function e(e){this.isSelectionFromChart=!1,this.isFromChart=!1,this.multipleIndexes=[],this.selectedRowIndexes=[],this.enableSelectMultiTouch=!1,this.openPopup=!1,this.parent=e,this.bindEvents(),this.parent.treeGrid.selectedRowIndex=this.parent.selectedRowIndex,this.parent.treeGrid.allowSelection=this.parent.allowSelection,this.parent.treeGrid.grid.selectionSettings.enableToggle=this.parent.selectionSettings.enableToggle,this.parent.treeGrid.selectionSettings=r.getActualProperties(this.parent.selectionSettings),this.wireEvents()}return e.prototype.getModuleName=function(){return"selection"},e.prototype.wireEvents=function(){this.parent.on("selectRowByIndex",this.selectRowByIndex,this),this.parent.isAdaptive?(this.parent.on("chartMouseClick",this.mouseUpHandler,this),this.parent.on("treeGridClick",this.popUpClickHandler,this)):this.parent.on("chartMouseUp",this.mouseUpHandler,this)},e.prototype.selectRowByIndex=function(){-1===this.parent.selectedRowIndex&&-1===this.parent.staticSelectedRowIndex||(this.selectRow(-1!==this.parent.staticSelectedRowIndex?this.parent.staticSelectedRowIndex:this.parent.selectedRowIndex),this.parent.staticSelectedRowIndex=-1)},e.prototype.bindEvents=function(){this.parent.treeGrid.rowSelecting=this.rowSelecting.bind(this),this.parent.treeGrid.rowSelected=this.rowSelected.bind(this),this.parent.treeGrid.rowDeselecting=this.rowDeselecting.bind(this),this.parent.treeGrid.rowDeselected=this.rowDeselected.bind(this),this.parent.treeGrid.cellSelecting=this.cellSelecting.bind(this),this.parent.treeGrid.cellSelected=this.cellSelected.bind(this),this.parent.treeGrid.cellDeselecting=this.cellDeselecting.bind(this),this.parent.treeGrid.cellDeselected=this.cellDeselected.bind(this)},e.prototype.rowSelecting=function(e){if(!this.parent.isGanttChartRendered)return void(e.cancel=!0);e.isCtrlPressed=this.isMultiCtrlRequest||e.isCtrlPressed,e.isShiftPressed=this.isMultiShiftRequest||e.isShiftPressed,e.target=this.actualTarget,t.isNullOrUndefined(e.foreignKeyData)||0!==Object.keys(e.foreignKeyData).length||delete e.foreignKeyData,this.parent.selectionSettings&&this.parent.selectionSettings.persistSelection&&(this.parent.treeGrid.grid.selectionModule.checkSelectAllClicked=!0),this.parent.trigger("rowSelecting",e),(this.isMultiShiftRequest||this.isMultiCtrlRequest)&&(this.isMultiShiftRequest=this.isMultiCtrlRequest=!1)},e.prototype.rowSelected=function(e){var i="Multiple"!==this.parent.selectionSettings.type||t.isNullOrUndefined(e.rowIndexes)?[e.rowIndex]:e.rowIndexes;if(this.addRemoveClass(i,e.name),this.selectedRowIndexes=t.extend([],this.getSelectedRowIndexes(),[],!0),this.parent.setProperties({selectedRowIndex:this.parent.treeGrid.grid.selectedRowIndex},!0),this.isMultiShiftRequest&&(this.selectedRowIndexes=i),this.parent.autoFocusTasks)if(this.parent.enableTimelineVirtualization&&(this.parent.isRowSelected=!0),e.data&&!t.isNullOrUndefined(e.data.length))for(var a=0;a<e.data.length;a++)this.parent.ganttChartModule.updateScrollLeft(e.data[a].ganttProperties.left);else this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping&&t.isNullOrUndefined(t.getValue("data.ganttProperties.left",e))&&(e.data=this.parent.getRecordByID(e.data.taskId)),this.parent.ganttChartModule.updateScrollLeft(t.getValue("data.ganttProperties.left",e));if(e.target=this.actualTarget,t.isNullOrUndefined(e.foreignKeyData)||0!==Object.keys(e.foreignKeyData).length||delete e.foreignKeyData,this.prevRowIndex=e.rowIndex,t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems(e),!t.isNullOrUndefined(this.parent.focusModule.previousActiveElement)){var r=this.parent.focusModule.previousActiveElement;t.removeClass([r],"e-focused"),t.removeClass([r],"e-focus")}this.parent.trigger("rowSelected",e)},e.prototype.rowDeselecting=function(e){e.target=this.actualTarget,e.isInteracted=this.isInteracted,this.parent.trigger("rowDeselecting",e)},e.prototype.rowDeselected=function(e){var i,a;if(0!==this.multipleIndexes.length)i=this.multipleIndexes;else if(t.isNullOrUndefined(e.rowIndexes))i=[e.rowIndex];else{for(var r=0;r<e.rowIndexes.length;r++)e.rowIndexes[r]===e.rowIndex&&(a=!0);i=a?e.rowIndexes:[e.rowIndex]}this.addRemoveClass(i),this.selectedRowIndexes=t.extend([],this.getSelectedRowIndexes(),[],!0),this.parent.setProperties({selectedRowIndex:-1},!0),1===this.selectedRowIndexes.length&&this.parent.setProperties({selectedRowIndex:this.selectedRowIndexes[0]},!0),t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems(),"Multiple"===this.parent.selectionSettings.type&&this.parent.isAdaptive&&0===this.selectedRowIndexes.length&&this.hidePopUp(),e.target=this.actualTarget,e.isInteracted=this.isInteracted,this.parent.trigger("rowDeselected",e),this.isInteracted=!1,this.multipleIndexes=[]},e.prototype.cellSelecting=function(e){var t=new a.Deferred;return this.parent.trigger("cellSelecting",e,function(e){t.resolve(e)}),t},e.prototype.cellSelected=function(e){this.parent.trigger("cellSelected",e),t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},e.prototype.cellDeselecting=function(e){this.parent.trigger("cellDeselecting",e)},e.prototype.cellDeselected=function(e){this.parent.trigger("cellDeselected",e),t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},e.prototype.selectCell=function(e,t){this.parent.treeGrid.selectCell(e,t)},e.prototype.selectCells=function(e){this.parent.treeGrid.grid.selectCells(e)},e.prototype.selectRow=function(e,i,a){var r=[].slice.call(this.parent.ganttChartModule.chartBodyContent.querySelector("tbody").children);this.parent.enableVirtualization&&(this.parent.treeGridModule.addedRecord||this.parent.editModule&&this.parent.editModule.isAdded)&&(e=this.parent.getExpandedRecords(this.parent.flatData).indexOf(this.parent.flatData[e]),this.parent.treeGridModule.addedRecord=!1,this.parent.editModule&&(this.parent.editModule.isAdded=!1));var n,s=r.filter(function(t){return parseInt(t.getAttribute("aria-rowindex"),10)-1===e})[0];-1===e||t.isNullOrUndefined(s)&&!this.parent.enableVirtualization||"Cell"===this.parent.selectionSettings.mode||(this.parent.showActiveElement&&!t.isNullOrUndefined(a)&&!a||this.isFromChart?(this.isFromChart&&(this.isFromChart=!1),this.parent.treeGrid.grid.selectionModule.preventFocus=!0):this.parent.treeGrid.grid.selectionModule.preventFocus=!1,t.isNullOrUndefined(this.selectedClass)||this.selectedClass!==s||i||(n=!0),!0!==n&&this.parent.treeGrid.selectRow(e,i),this.parent.treeGrid.grid.selectionModule.preventFocus=!0!==this.parent.treeGrid.grid.selectionModule.preventFocus&&this.parent.treeGrid.grid.selectionModule.preventFocus,this.prevRowIndex=e,this.selectedClass=s)},e.prototype.selectRows=function(e){!t.isNullOrUndefined(e)&&e.length>0&&this.parent.treeGrid.selectRows(e)},e.prototype.getSelectedRowIndexes=function(){return this.parent.treeGrid.getSelectedRowIndexes()},e.prototype.getSelectedRowCellIndexes=function(){return this.parent.treeGrid.getSelectedRowCellIndexes()},e.prototype.getSelectedRecords=function(){if(this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping){for(var e=[],t=this.parent.selectionModule.getSelectedRowIndexes(),i=this,a=0;a<t.length;a++)!function(a){var r=i.parent.currentViewData.filter(function(e){return e.index===t[a]})[0];e.push(r)}(a);return e}return this.parent.treeGrid.getSelectedRecords()},e.prototype.getCellSelectedRecords=function(){for(var e=this.parent.selectionModule.getSelectedRowCellIndexes(),t=[],i=0;i<e.length;i++)t.push(this.parent.currentViewData[e[i].rowIndex]);return t},e.prototype.getSelectedRows=function(){return this.parent.treeGrid.getSelectedRows()},e.prototype.clearSelection=function(){this.addRemoveClass(this.selectedRowIndexes),this.parent.treeGrid.clearSelection(),this.parent.selectedRowIndex=-1,this.selectedRowIndexes=[],this.selectedClass=null,t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems(),this.isInteracted=!1},e.prototype.highlightSelectedRows=function(e,i){if(this.isMultiCtrlRequest=e.ctrlKey||this.enableSelectMultiTouch,this.isMultiShiftRequest=e.shiftKey,this.actualTarget=e.target,this.isInteracted=!0,this.isSelectionFromChart=i,i){var a=t.closest(e.target,"tr.e-chart-row"),r=parseInt(a.getAttribute("aria-rowindex"),10)-1,n=this.parent.selectionSettings.enableToggle;"Single"===this.parent.selectionSettings.type||!this.isMultiCtrlRequest&&!this.isMultiShiftRequest?(this.parent.selectionSettings.persistSelection&&this.addRemoveClass(this.selectedRowIndexes,e.name),(!this.parent.allowTaskbarDragAndDrop||this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&!this.parent.rowDragAndDropModule.draggedRecord)&&(this.isFromChart=!0,this.selectRow(r,n))):this.isMultiShiftRequest?this.selectRowsByRange(t.isNullOrUndefined(this.prevRowIndex)?r:this.prevRowIndex,r):(t.setValue("isMultiCtrlRequest",!0,this.parent.treeGrid.grid.selectionModule),this.parent.treeGrid.grid.selectionModule.addRowsToSelection([r]),this.selectedRowIndexes.indexOf(r)>-1&&this.addRemoveClass([r],e.name))}},e.prototype.getselectedrowsIndex=function(e,t){for(var i=[],a=e<t?{i:e,max:t}:{i:t,max:e},r=a.i,n=a.max;r<=n;r++)i.push(r);e>t&&i.reverse(),this.selectedRowIndexes=i},e.prototype.selectRowsByRange=function(e,t){this.isSelectionFromChart=!0,this.getselectedrowsIndex(e,t),this.selectRows(this.selectedRowIndexes)},e.prototype.addRemoveClass=function(e,i){"number"==typeof e&&(e=[e]);for(var a=[].slice.call(this.parent.ganttChartModule.chartBodyContent.querySelector("tbody").children),r=this,n=0;n<e.length;n++)!function(n){var s=a.filter(function(t){return parseInt(t.getAttribute("aria-rowindex"),10)-1===e[parseInt(n.toString(),10)]})[0];if(!t.isNullOrUndefined(s)){var o=!1,l=r.getSelectedRowIndexes().indexOf(e[parseInt(n.toString(),10)]),d=r.getSelectedRecords().length;r.parent.selectionSettings.persistSelection&&r.parent.selectionSettings.enableToggle&&!t.isNullOrUndefined(i)&&"Multiple"!==r.parent.selectionSettings.type&&d>0&&(o=!0),r.parent.selectionSettings.enableToggle&&r.parent.selectionSettings.persistSelection&&l>-1&&"Single"===r.parent.selectionSettings.type&&o||l>-1&&!t.isNullOrUndefined(i)&&"Multiple"===r.parent.selectionSettings.type?r.addClass(s):t.isNullOrUndefined(i)?r.removeClass(s):l>-1&&r.addClass(s),r.parent.selectionSettings.enableToggle&&l>-1&&("Single"===r.parent.selectionSettings.type||!r.isMultiCtrlRequest&&!r.isMultiShiftRequest)&&r.parent.selectionSettings.persistSelection&&"chartMouseUp"===i&&r.isSelectionFromChart&&r.removeClass(s)}}(n)},e.prototype.addClass=function(e){t.addClass([e],"e-active"),e.setAttribute("aria-selected","true")},e.prototype.removeClass=function(e){t.removeClass([e],"e-active"),e.removeAttribute("aria-selected")},e.prototype.showPopup=function(e){this.isSelectionFromChart?(r.setCssInGridPopUp(this.parent.element.querySelector(".e-ganttpopup"),e,"e-rowselect e-icons e-icon-rowselect"+(this.enableSelectMultiTouch&&(this.getSelectedRecords().length>1||this.getSelectedRowCellIndexes().length>1)?" e-spanclicked":"")),document.getElementsByClassName("e-gridpopup")[0].style.display="none",this.openPopup=!0):0===this.selectedRowIndexes.length&&this.hidePopUp()},e.prototype.hidePopUp=function(){this.openPopup?(document.getElementsByClassName("e-ganttpopup")[0].style.display="none",this.openPopup=!1):document.getElementsByClassName("e-gridpopup")[0].style.display="none"},e.prototype.popUpClickHandler=function(e){var i=e.target,a=this.parent.treeGrid.grid,r=t.closest(i,".e-ganttpopup")?t.closest(i,".e-ganttpopup"):t.closest(i,".e-gridpopup");if(r){var n=r.querySelector(".e-rowselect");t.closest(i,".e-ganttpopup")&&!n.classList.contains("e-spanclicked")?(this.enableSelectMultiTouch=!0,n.classList.add("e-spanclicked")):t.closest(i,".e-gridpopup")&&n.classList.contains("e-spanclicked")?(this.openPopup=!0,this.enableSelectMultiTouch=!0):(this.hidePopUp(),this.enableSelectMultiTouch=!1,t.closest(i,".e-ganttpopup")&&n.classList.remove("e-spanclicked"))}else"Multiple"===this.parent.selectionSettings.type&&this.parent.isAdaptive&&t.closest(i,".e-rowcell")&&(0===this.selectedRowIndexes.length&&"Row"===this.parent.selectionSettings.mode||0===this.getCellSelectedRecords().length&&"Cell"===this.parent.selectionSettings.mode)&&this.hidePopUp();a&&t.setValue("enableSelectMultiTouch",this.enableSelectMultiTouch,a.selectionModule)},e.prototype.mouseUpHandler=function(e){var i=!1,a=document.querySelectorAll(".e-drag-item"),n=null;if(e.target.closest(".e-rowcell")?n=e.target:e.target.closest(".e-chart-row")&&(n=e.target.closest(".e-left-label-container")||e.target.closest(".e-taskbar-main-container")||e.target.closest(".e-right-label-container")),this.parent.focusModule&&this.parent.focusModule.setActiveElement(n),this.parent.editModule&&this.parent.editSettings.allowTaskbarEditing&&this.parent.editModule.taskbarEditModule){var s=this.parent.editModule.taskbarEditModule;(s.isMouseDragged||s.tapPointOnFocus)&&(i=!0)}if(!i&&this.parent.element.contains(e.target)&&1!==a.length){var o=r.parentsUntil(e.target,"e-chart-row"),l=e.target,d=l.classList.contains("e-rowcell")||l.closest("td.e-rowcell")&&l.closest("td.e-rowcell").classList.contains("e-rowcell")||l.classList.contains("e-row")||l.parentElement&&l.parentElement.classList.contains("e-checkbox-wrapper")||l.classList.contains("e-treegridexpand")||l.classList.contains("e-treegridcollapse")||!t.isNullOrUndefined(o);this.popUpClickHandler(e),"Cell"!==this.parent.selectionSettings.mode&&d?(t.closest(e.target,"tr.e-chart-row")?(this.parent.enableVirtualization&&(this.parent.treeGrid.grid.selectionModule.isInteracted=!0),this.parent.treeGrid.isFromChartSide=!0,this.highlightSelectedRows(e,!0)):(this.parent.treeGrid.isFromChartSide=!1,this.highlightSelectedRows(e,!1)),"Multiple"===this.parent.selectionSettings.type&&this.parent.isAdaptive&&(this.selectedRowIndexes.length>0?this.showPopup(e):this.hidePopUp())):this.isSelectionFromChart=!1}},e.prototype.maintainSelectedRecords=function(e){this.parent.selectionModule.getSelectedRowIndexes().indexOf(e)>-1&&this.addRemoveClass([e])},e.prototype.destroy=function(){this.parent.isDestroyed||(this.parent.off("selectRowByIndex",this.selectRowByIndex),this.parent.isAdaptive?(this.parent.off("chartMouseClick",this.mouseUpHandler),this.parent.off("treeGridClick",this.popUpClickHandler)):this.parent.off("chartMouseUp",this.mouseUpHandler))},e}(),It=function(){function e(e){this.predefinedItems={},this.items=["Add","Edit","Update","Delete","Cancel","ExpandAll","CollapseAll","Search","PrevTimeSpan","NextTimeSpan","ZoomIn","ZoomOut","ZoomToFit","ExcelExport","CsvExport","PdfExport","Indent","Outdent","CriticalPath"],this.parent=e,this.id=this.parent.element.id,this.parent.on("ui-toolbarupdate",this.propertyChanged,this)}return e.prototype.getModuleName=function(){return"toolbar"},e.prototype.renderToolbar=function(){if((this.parent.toolbar||[]).length>0){this.element=t.createElement("div",{id:this.parent.controlId+"_Gantt_Toolbar",className:"e-gantt-toolbar"}),this.parent.treeGrid.grid.headerModule?this.parent.element.insertBefore(this.element,this.parent.treeGridPane.offsetParent):this.parent.element.appendChild(this.element);for(var e=0,i=["Add","Edit","Update","Delete","Cancel","ExpandAll","CollapseAll","PrevTimeSpan","NextTimeSpan","ZoomIn","ZoomOut","ZoomToFit","ExcelExport","CsvExport","PdfExport","Indent","Outdent","CriticalPath","Undo","Redo"];e<i.length;e++){var a=i[e],r=void 0,n=void 0;"CriticalPath"===a?(r="critical-path",n="criticalPath"):(r=a.toLowerCase(),n=a[0].toLowerCase()+a.slice(1)),this.predefinedItems[a]={id:this.parent.element.id+"_"+r,prefixIcon:"e-"+r,text:this.parent.isAdaptive?"":this.parent.localeObj.getConstant(n),tooltipText:this.parent.localeObj.getConstant(n)+("add"===n||"edit"===n||"delete"===n?this.parent.localeObj.getConstant("task"):"expandAll"===n||"collapseAll"===n?this.parent.localeObj.getConstant("tasks"):""),align:this.parent.isAdaptive?"Right":"Left"},this.parent.enableRtl&&("PrevTimeSpan"===a&&(this.predefinedItems[a].prefixIcon="e-nexttimespan"),"NextTimeSpan"===a&&(this.predefinedItems[a].prefixIcon="e-prevtimespan"))}var s=this.parent.localeObj.getConstant("search");this.parent.isAdaptive?this.predefinedItems.Search={id:this.id+"_searchbutton",prefixIcon:"e-search-icon",tooltipText:s,align:"Right"}:this.predefinedItems.Search={id:this.id+"_search",template:'<div class="e-input-group e-search" role="search"><input id="'+this.id+'_searchbar" class="e-input" name="input" type="search"placeholder= "'+s+'"/><span id="'+this.id+'_searchbutton" class="e-input-group-icon e-search-icon e-icons"tabindex="-1" title="'+s+'" aria-label= "search" role="button"></span></div>',tooltipText:s,align:"Right",cssClass:"e-search-wrapper"},this.createToolbar()}},e.prototype.addReactToolbarPortals=function(e){this.parent.isReact&&e&&(this.parent.portals=this.parent.portals.concat(e),this.parent.renderTemplates())},e.prototype.createToolbar=function(){var e=this.getItems();this.toolbar=new d.Toolbar({items:e,enableRtl:this.parent.enableRtl,clicked:this.toolbarClickHandler.bind(this),height:this.parent.isAdaptive?48:"auto"}),this.toolbar.isStringTemplate=!0,this.toolbar.isReact=this.parent.isReact,this.toolbar.on("render-react-toolbar-template",this.addReactToolbarPortals,this),this.toolbar.appendTo(this.element),this.parent.treeGrid.grid&&this.parent.isReact&&(this.parent.treeGrid.grid.portals=this.parent.portals);var i=this.element.querySelector("#"+this.parent.element.id+"_cancel"),a=this.element.querySelector("#"+this.parent.element.id+"_update");i&&t.addClass([i],"e-grid"),a&&t.addClass([a],"e-grid");var r=!1;this.parent.toolbar.map(function(e){"Search"===e&&(r=!0)}),this.parent.isAdaptive&&r?(this.element.insertBefore(this.getSearchBarElement(),this.element.childNodes[0]),this.searchElement=this.element.querySelector("#"+this.parent.element.id+"_searchbar"),new p.TextBox({placeholder:this.parent.localeObj.getConstant("search"),enableRtl:this.parent.enableRtl,floatLabelType:"Never",showClearButton:!0}).appendTo(this.searchElement)):this.searchElement=this.element.querySelector("#"+this.parent.element.id+"_searchbar"),this.parent.filterModule&&(this.wireEvent(),this.parent.searchSettings&&this.updateSearchTextBox()),this.enableItems([this.parent.controlId+"_redo",this.parent.controlId+"_undo"],!1),this.parent.readOnly&&this.enableItems([this.parent.element.id+"_add",this.parent.element.id+"_update",this.parent.element.id+"_delete",this.parent.element.id+"_cancel",this.parent.element.id+"_indent",this.parent.element.id+"_outdent"],!1)},e.prototype.getSearchBarElement=function(){var e=this,i=t.createElement("div",{className:"e-adaptive-searchbar",styles:"display: none"}),a=t.createElement("input",{attrs:{type:"text"},id:this.parent.element.id+"_searchbar"}),r=t.createElement("span",{className:"e-backarrowspan e-icons"});return r.onclick=function(){i.style.display="none",e.element.childNodes[1].style.display="block"},i.appendChild(r),i.appendChild(a),i},e.prototype.wireEvent=function(){this.searchElement&&(t.EventHandler.add(this.searchElement,"keyup",this.keyUpHandler,this),t.EventHandler.add(this.searchElement,"focus",this.focusHandler,this),t.EventHandler.add(this.searchElement,"blur",this.blurHandler,this))},e.prototype.propertyChanged=function(e){t.getValue("module",e)===this.getModuleName()&&this.parent.toolbar&&(this.element&&this.element.parentNode&&t.remove(this.element),this.renderToolbar(),this.refreshToolbarItems())},e.prototype.unWireEvent=function(){this.searchElement&&(t.EventHandler.remove(this.searchElement,"keyup",this.keyUpHandler),t.EventHandler.remove(this.searchElement,"focus",this.focusHandler),t.EventHandler.remove(this.searchElement,"blur",this.blurHandler),this.searchElement=null),this.parent.isDestroyed||this.parent.off("ui-toolbarupdate",this.propertyChanged)},e.prototype.keyUpHandler=function(e){13===e.keyCode&&this.parent.searchSettings.key!==this.searchElement.value&&(this.parent.searchSettings.key=this.searchElement.value,this.parent.dataBind())},e.prototype.focusHandler=function(e){e.target.parentElement.classList.add("e-input-focus")},e.prototype.blurHandler=function(e){e.target.parentElement.classList.remove("e-input-focus")},e.prototype.updateSearchTextBox=function(){this.searchElement&&this.searchElement.value!==this.parent.searchSettings.key&&(this.searchElement.value=this.parent.searchSettings.key)},e.prototype.getItems=function(){var e=[],t=this.parent.toolbar,i=-1;if(t.forEach(function(e,t){("string"==typeof e&&"Search"===e||"object"==typeof e&&"Search"===e.text)&&(i=t)}),i>-1){var a=t.splice(i,1);t.push(a[0])}for(var r=0,n=t;r<n.length;r++){var s=n[r];"string"==typeof s?e.push(this.getItemObject(s)):e.push(this.getItem(s))}return e},e.prototype.getItem=function(e){var i=this.predefinedItems[e.text],a=i?t.extend(i,i,e):e;return a.align||(a.align=this.parent.isAdaptive?"Right":"Left"),a},e.prototype.getItemObject=function(e){return this.predefinedItems[e]||{text:e,id:this.id+"_"+e}},e.prototype.toolbarClickHandler=function(e){var i=this,a=this.parent,r=this.id;this.parent.isToolBarClick=!1,t.extend(e,{cancel:!1}),a.trigger("toolbarClick",e,function(n){if(!n.cancel)switch(e.item.properties.id!==i.parent.element.id+"_pdfexport"&&e.item.properties.id!==i.parent.element.id+"_critical-path"||i.parent.showLoadingIndicator(),!0===i.parent.isAdaptive&&(n.item.id!==r+"_edit"&&n.item.id!==r+"_add"&&n.item.id!==r+"_delete"&&n.item.id!==r+"_searchbutton"&&n.item.id!==r+"_expandall"&&n.item.id!==r+"_collapseall"||i.parent.selectionModule&&"Multiple"===i.parent.selectionSettings.type&&(i.parent.selectionModule.hidePopUp(),document.getElementsByClassName("e-gridpopup")[0].style.display="none")),!t.isNullOrUndefined(n.item)&&n.item.id){case r+"_edit":a.editModule&&a.editSettings.allowEditing&&a.editModule.dialogModule.openToolbarEditDialog();break;case r+"_indent":a.editModule&&a.selectionModule.getSelectedRecords().length&&a.indent();break;case r+"_critical-path":a.enableCriticalPath?a.enableCriticalPath=!1:a.enableCriticalPath=!0;break;case r+"_outdent":a.editModule&&a.selectionModule.getSelectedRecords().length&&a.outdent();break;case r+"_update":a.editModule.cellEditModule.isCellEdit=!1,a.treeGrid.grid.saveCell();break;case r+"_cancel":a.cancelEdit();break;case r+"_add":a.editModule&&a.editSettings.allowAdding&&a.editModule.dialogModule.openAddDialog();break;case r+"_delete":i.parent.selectionModule&&i.parent.editModule&&("Cell"!==i.parent.selectionSettings.mode&&i.parent.selectionModule.selectedRowIndexes.length||"Cell"===i.parent.selectionSettings.mode&&i.parent.selectionModule.getSelectedRowCellIndexes().length)&&i.parent.editModule.startDeleteAction();break;case r+"_search":if(t.getValue("originalEvent.target.id",n)===i.parent.element.id+"_searchbutton"&&i.parent.filterModule){var s=i.element.querySelector("#"+i.parent.element.id+"_searchbar").value;i.parent.searchSettings.key!==s&&(i.parent.searchSettings.key=s,i.parent.dataBind())}break;case r+"_searchbutton":var o=i.element.querySelector(".e-adaptive-searchbar");o.parentElement.childNodes[1].style.display="none",o.style.display="block";break;case r+"_expandall":i.parent.ganttChartModule.expandCollapseAll("expand"),i.parent.isCollapseAll=!1;break;case r+"_collapseall":i.parent.ganttChartModule.expandCollapseAll("collapse"),i.parent.isCollapseAll=!0;break;case r+"_prevtimespan":i.parent.previousTimeSpan();break;case r+"_nexttimespan":i.parent.nextTimeSpan();break;case r+"_zoomin":i.zoomIn();break;case r+"_zoomout":i.zoomOut();break;case r+"_zoomtofit":i.zoomToFit();break;case r+"_undo":i.parent.undo();break;case r+"_redo":i.parent.redo()}})},e.prototype.zoomIn=function(){this.parent.timelineModule.processZooming(!0),this.parent.timelineModule.isZooming=!1},e.prototype.zoomToFit=function(){this.parent.timelineModule.isZoomIn&&(this.parent.timelineModule.isZoomIn=!1),this.parent.timelineModule.processZoomToFit(),this.parent.ganttChartModule.updateScrollLeft(0),this.parent.timelineModule.isZoomToFit=!1},e.prototype.zoomOut=function(){this.parent.timelineModule.processZooming(!1),this.parent.timelineModule.isZooming=!1},e.prototype.refreshToolbarItems=function(e){var i=this.parent,a=[],r=[],n=i.editSettings,s=this.id,o=i.selectedRowIndex;if(this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)for(v=0;v<i.updatedRecords.length;v++)if(i.updatedRecords[v].index===o){o=v;break}var l,d=!1;i.selectionModule&&(1!==i.selectionModule.getSelectedRecords().length&&1!==i.selectionModule.getSelectedRowCellIndexes().length||(d=!0)),i.selectionModule&&"Multiple"===i.selectionSettings.type&&i.selectionModule.selectedRowIndexes.length>1&&(d=!1);var h=!1;if(i.selectionModule&&i.selectionSettings.persistSelection){var p=i.selectionModule.getSelectedRecords().length;if(i.selectionSettings.persistSelection&&1===p)for(v=0;v<p;v++)-1===(b=i.currentViewData.indexOf(i.selectionModule.getSelectedRecords()[v]))&&(h=!0);h&&(d=!1)}var u=this.toolbar?this.toolbar.items:[],c=[s+"_add",s+"_edit",s+"_delete",s+"_update",s+"_cancel",s+"_indent",s+"_outdent"],g="ResourceView"===this.parent.viewType&&0!==t.getValue("data.level",e)||"ProjectView"===this.parent.viewType;if(t.isNullOrUndefined(this.parent.editModule))r.push(s+"_delete"),r.push(s+"_add"),r.push(s+"_edit"),r.push(s+"_update"),r.push(s+"_cancel"),r.push(s+"_indent"),r.push(s+"_outdent");else{var f=!!i.editModule.taskbarEditModule&&i.editModule.taskbarEditModule.touchEdit,m=i.flatData&&i.flatData.length;n.allowAdding&&!f?a.push(s+"_add"):r.push(s+"_add"),n.allowEditing&&g&&m&&d&&!f?a.push(s+"_edit"):r.push(s+"_edit"),n.allowEditing&&0!==o&&-1!==o&&m&&d&&"ResourceView"!==this.parent.viewType?t.isNullOrUndefined(i.updatedRecords[o])||0!==i.updatedRecords[o].level||!m||f?(l=i.updatedRecords[o-1],t.isNullOrUndefined(i.updatedRecords[o])||i.updatedRecords[o].level-l.level!=1||-1===o?-1!==o&&(a.push(s+"_indent"),a.push(s+"_outdent")):(r.push(s+"_indent"),a.push(s+"_outdent"))):(a.push(s+"_indent"),r.push(s+"_outdent")):(r.push(s+"_indent"),r.push(s+"_outdent"));var y=!!i.selectionModule&&(i.selectionModule.getSelectedRecords().length>0||i.selectionModule.getSelectedRowCellIndexes().length>0);if(i.selectionModule&&i.selectionSettings.persistSelection){h&&(y=!1);var D=(p=i.selectionModule.getSelectedRecords()).length;if(i.selectionSettings.persistSelection&&D>1)for(var v=0;v<D;v++){if((b=i.currentViewData.indexOf(p[v]))>-1){y=!0;break}y=!1}}if(n.allowDeleting&&m&&y&&!f?a.push(s+"_delete"):r.push(s+"_delete"),"Auto"===i.editSettings.mode&&!t.isNullOrUndefined(i.editModule.cellEditModule)&&i.editModule.cellEditModule.isCellEdit){(a=[]).push(s+"_update",s+"_cancel"),r=[];for(w=0;w<u.length;w++)u[w].id!==s+"_update"&&u[w].id!==s+"_cancel"&&-1!==c.indexOf(u[w].id)&&r.push(u[w].id)}else{r.push(s+"_update",s+"_cancel");for(w=0;w<u.length;w++)-1===a.indexOf(u[w].id)&&-1===r.indexOf(u[w].id)&&a.push(u[w].id)}}for(var k=0;k<a.length;k++){for(var b=void 0,w=0;w<u.length;w++)if(u[w].id===a[k]){b=w;break}u.length>0&&!t.isNullOrUndefined(u[b])&&u[b].properties.visible&&this.toolbar.hideItem(b,!1)}for(var T=0;T<r.length;T++){for(var b=void 0,w=0;w<u.length;w++)if(u[w].id===r[T]){b=w;break}u.length>0&&this.toolbar.hideItem(b,!0)}},e.prototype.enableItems=function(e,t){for(var i=0,a=e;i<a.length;i++){var r=a[i],n=this.element.querySelector("#"+r);n&&this.toolbar.enableItems(n.parentElement,t)}},e.prototype.destroy=function(){this.parent.filterModule&&this.unWireEvent(),this.parent.isDestroyed||(this.toolbar&&this.toolbar.off("render-react-toolbar-template",this.addReactToolbarPortals),this.toolbar.destroy(),t.remove(this.element))},e}(),Et=function(){function e(e){this.weekendWidthUpdated=!1,this.parent=e,this.nonworkingContainer=null,this.holidayContainer=null,this.weekendContainer=null}return e.prototype.createNonworkingContainer=function(){this.parent.ganttChartModule.chartBodyContent.contains(this.nonworkingContainer)||(this.nonworkingContainer=t.createElement("div",{className:"e-nonworking-day-container"}),this.parent.enableTimelineVirtualization&&(this.nonworkingContainer.style.height="100%"),this.parent.ganttChartModule.chartBodyContent.insertBefore(this.nonworkingContainer,this.parent.ganttChartModule.chartBodyContent.firstChild))},e.prototype.renderHolidays=function(){var e=this;if(this.parent.holidays&&this.parent.holidays.length>0){this.createNonworkingContainer(),this.nonworkingContainer.contains(this.holidayContainer)||(this.holidayContainer=t.createElement("div",{className:"e-holiday-container"}),this.parent.enableTimelineVirtualization&&(this.holidayContainer.style.height="100%",this.holidayContainer.style.zIndex="-1"),this.nonworkingContainer.appendChild(this.holidayContainer));var i=this.getHolidaysElement().childNodes;this.holidayContainer.innerHTML="",i.forEach(function(t){e.holidayContainer.appendChild(t.cloneNode(!0))})}else this.holidayContainer&&this.holidayContainer.parentNode&&(t.remove(this.holidayContainer),this.nonworkingContainer&&0===this.nonworkingContainer.childNodes.length&&t.remove(this.nonworkingContainer))},e.prototype.getHolidaysElement=function(){var e,i,a=t.createElement("div"),r=this.parent.contentHeight,n=0;t.isNullOrUndefined(this.parent.toolbarModule)||t.isNullOrUndefined(this.parent.toolbarModule.element)||(n=this.parent.toolbarModule.element.offsetHeight);for(var s=this.parent.ganttHeight-n-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight,o=0;o<this.parent.holidays.length;o++){this.parent.holidays[o].from&&this.parent.holidays[o].to?(e=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[o].from),(i=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[o].to)).setDate(i.getDate()+1),e.setHours(0,0,0,0),i.setHours(0,0,0,0)):this.parent.holidays[o].from?(e=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[o].from)).setHours(0,0,0,0):this.parent.holidays[o].to&&(e=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[o].to)).setHours(0,0,0,0);var l=this.parent.holidays[o].from&&this.parent.holidays[o].to?this.parent.dataOperation.getTaskWidth(e,i):this.parent.perDayWidth,d=this.parent.dataOperation.getTaskLeft(e,!1,!0),h=this.parent.enableRtl?"right:"+d+"px;":"left:"+d+"px;",p=t.createElement("div",{className:"e-holiday",styles:h+" width:"+l+"px; height:100%;"}),u=s<r?s/2:r/2,c=t.createElement("span",{className:"e-span",styles:"top:"+u+"px;left:"+l/2+"px;"}),g=this.parent.disableHtmlEncode?"textContent":"innerHTML";c[g]=this.parent.holidays[o].label?this.parent.holidays[o].label:"",this.parent.enableHtmlSanitizer&&"string"==typeof c[g]&&(c[g]=t.SanitizeHtmlHelper.sanitize(c[g])),p.appendChild(c),this.parent.holidays[o].cssClass&&p.classList.add(this.parent.holidays[o].cssClass),a.appendChild(p)}return a},e.prototype.renderWeekends=function(){var e=this;if(this.parent.highlightWeekends&&this.parent.timelineSettings.showWeekend){this.createNonworkingContainer(),this.nonworkingContainer.contains(this.weekendContainer)||(this.weekendContainer=t.createElement("div",{className:"e-weekend-container"}),this.parent.enableTimelineVirtualization&&(this.weekendContainer.style.height="100%",this.weekendContainer.style.zIndex="-1"),this.nonworkingContainer.appendChild(this.weekendContainer));var i=this.getWeekendElements().childNodes;this.weekendContainer.innerHTML="",i.forEach(function(t){e.weekendContainer.appendChild(t.cloneNode(!0))})}else this.weekendContainer&&(t.remove(this.weekendContainer),this.weekendContainer=null,this.nonworkingContainer&&0===this.nonworkingContainer.childNodes.length&&(t.remove(this.nonworkingContainer),this.nonworkingContainer=null))},e.prototype.getWeekendElements=function(){var e=t.createElement("div"),i=this.parent.enableTimelineVirtualization&&0!==this.parent.ganttChartModule.scrollObject.element.scrollLeft?this.parent.ganttChartModule.scrollObject.getTimelineLeft():null,a=this.parent.enableTimelineVirtualization&&!t.isNullOrUndefined(i)?new Date(this.parent.timelineModule.dateByLeftValue(i).getTime()):new Date(this.parent.timelineModule.timelineStartDate.getTime()),r=this.parent.enableTimelineVirtualization?new Date(this.parent.timelineModule.weekendEndDate.getTime()):new Date(this.parent.timelineModule.timelineEndDate.getTime()),n=this.parent.nonWorkingDayIndex,s=!0,o=!0;this.weekendWidthUpdated=!1;var l=this.parent.dataOperation.hasDSTTransition(a.getFullYear());do{if(-1!==n.indexOf(a.getDay())){var d=this.parent.dataOperation.getTaskLeft(a,!1,!0),h=this.parent.perDayWidth;if(s){var p=new Date(a.getTime()),u=new Date(p.getTime());u.setDate(u.getDate()+1),u.setHours(0,0,0,0),h=this.parent.dataOperation.getTaskWidth(p,u),s=!1}if(!l){var c=new Date(a),g=new Date(a);c.setDate(c.getDate()+1);var f=c.getTimezoneOffset(),m=g.getTimezoneOffset();if(o)o=!1;else{var y="Hour"===this.parent.timelineModule.bottomTier&&1===this.parent.timelineModule.customTimelineSettings.bottomTier.count||"Minutes"===this.parent.timelineModule.bottomTier&&60===this.parent.timelineModule.customTimelineSettings.bottomTier.count||"Hour"===this.parent.timelineModule.topTier&&1===this.parent.timelineModule.customTimelineSettings.topTier.count&&"Minutes"===this.parent.timelineModule.bottomTier&&(30===this.parent.timelineModule.customTimelineSettings.bottomTier.count||15===this.parent.timelineModule.customTimelineSettings.bottomTier.count);this.weekendWidthUpdated||y&&f<m&&(h-=this.parent.perDayWidth/24,this.weekendWidthUpdated=!0)}}var D=this.parent.enableRtl?"right:"+d+"px;":"left:"+d+"px;",v=t.createElement("div",{className:"e-weekend",styles:D+" width:"+h+"px;height:100%;"});e.appendChild(v)}a.setDate(a.getDate()+1),a.setHours(0,0,0,0)}while(a<r);return e},e.prototype.updateHolidayLabelHeight=function(){var e=this.parent.getContentHeight(),i=document.getElementById(this.parent.element.id),a=0;t.isNullOrUndefined(this.parent.toolbarModule)||t.isNullOrUndefined(this.parent.toolbarModule.element)||(a=this.parent.toolbarModule.element.offsetHeight);for(var r="auto"===this.parent.height?i.offsetHeight-a-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight:this.parent.ganttHeight-a-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight,n=r<e?r/2:e/2,s=this.holidayContainer.querySelectorAll(".e-span"),o=0;o<s.length;o++)s[o].style.top=t.formatUnit(n)},e.prototype.updateContainerHeight=function(){var e=this.parent.getContentHeight();this.holidayContainer&&(this.holidayContainer.style.height=t.formatUnit(e),this.updateHolidayLabelHeight()),this.weekendContainer&&(this.weekendContainer.style.height=t.formatUnit(e))},e.prototype.removeContainers=function(){this.holidayContainer&&t.remove(this.holidayContainer),this.weekendContainer&&(t.remove(this.weekendContainer),this.weekendContainer=null),this.nonworkingContainer&&(t.remove(this.nonworkingContainer),this.nonworkingContainer=null)},e}(),Ft=function(){function e(e){this.parent=e,this.eventMarkersContainer=null}return e.prototype.renderEventMarkers=function(){this.parent.eventMarkers&&this.parent.eventMarkers.length>0?(this.parent.ganttChartModule.chartBodyContent.contains(this.eventMarkersContainer)||(this.eventMarkersContainer=t.createElement("div",{className:"e-event-markers-container"}),this.eventMarkersContainer.setAttribute("role","term"),this.parent.ganttChartModule.chartBodyContent.appendChild(this.eventMarkersContainer)),this.eventMarkersContainer.innerHTML="",this.getEventMarkersElements(this.eventMarkersContainer)):this.removeContainer()},e.prototype.removeContainer=function(){this.eventMarkersContainer&&(t.remove(this.eventMarkersContainer),this.eventMarkersContainer=null)},e.prototype.getEventMarkersElements=function(e){for(var i,a,r,n,s=[],o=0;o<this.parent.eventMarkers.length;o++)if(!t.isNullOrUndefined(this.parent.eventMarkers[o].day)){this.parent.isFromEventMarker=!0,i=this.parent.dataOperation.getTaskLeft(this.parent.dateValidationModule.getDateFromFormat(this.parent.eventMarkers[o].day,!0),!1,!0),this.parent.isFromEventMarker=!1,s.push({id:o,left:i,label:this.parent.eventMarkers[o].label,date:this.parent.dateValidationModule.getDateFromFormat(this.parent.eventMarkers[o].day,!0)});var l=void 0;if(l=this.parent.enableRtl?"right:"+i+"px;":"left:"+i+"px;",a=t.createElement("div",{className:"e-event-markers",styles:l+" height:100%;",id:"stripline"+o}),this.parent.eventMarkers[o].label){r=t.createElement("div",{className:"e-span-label"});var d=this.parent.disableHtmlEncode?"textContent":"innerHTML";r[d]=this.parent.eventMarkers[o].label,this.parent.enableHtmlSanitizer&&"string"==typeof r[d]&&(r[d]=t.SanitizeHtmlHelper.sanitize(r[d])),this.parent.enableRtl?r.style.right="5px":r.style.left="5px",a.appendChild(r),n=t.createElement("div",{className:"e-gantt-right-arrow"}),a.appendChild(n)}this.parent.eventMarkers[o].cssClass&&a.classList.add(this.parent.eventMarkers[o].cssClass),a.setAttribute("tabindex","-1"),a.setAttribute("aria-label",this.parent.localeObj.getConstant("eventMarkers")+" "+("string"==typeof this.parent.eventMarkers[o].day?this.parent.eventMarkers[o].day:this.parent.getFormatedDate(this.parent.eventMarkers[o].day))+" "+this.parent.eventMarkers[o].label),e.appendChild(a)}this.parent.eventMarkerColloction=s},e.prototype.updateContainerHeight=function(){this.eventMarkersContainer&&(this.eventMarkersContainer.style.height=t.formatUnit(this.parent.getContentHeight()))},e}(),Ut=function(){function e(e){this.parent=e,this.nonworkingDayRender=new Et(this.parent),this.eventMarkerRender=new Ft(this.parent),this.wireEvents()}return e.prototype.wireEvents=function(){this.parent.on("refreshDayMarkers",this.refreshMarkers,this),this.parent.on("updateHeight",this.updateHeight,this),this.parent.on("ui-update",this.propertyChanged,this)},e.prototype.propertyChanged=function(e){for(var i=Object.keys(t.getValue("properties",e)),a=0;a<i.length;a++)switch(i[a]){case"eventMarkers":this.eventMarkerRender.renderEventMarkers(),this.updateHeight();break;case"highlightWeekends":this.nonworkingDayRender.renderWeekends(),this.updateHeight();break;case"holidays":this.nonworkingDayRender.renderHolidays(),this.updateHeight()}},e.prototype.refreshMarkers=function(){this.nonworkingDayRender.renderWeekends(),this.nonworkingDayRender.renderHolidays(),"Vertical"!==this.parent.gridLines&&"Both"!==this.parent.gridLines||this.parent.renderChartVerticalLines(),this.eventMarkerRender.renderEventMarkers()},e.prototype.updateHeight=function(){this.nonworkingDayRender.updateContainerHeight(),this.eventMarkerRender.updateContainerHeight(),this.parent.ganttChartModule.scrollObject.updateTopPosition()},e.prototype.getModuleName=function(){return"dayMarkers"},e.prototype.destroy=function(){this.parent.isDestroyed||(this.nonworkingDayRender.removeContainers(),this.eventMarkerRender.removeContainer(),this.parent.off("refreshDayMarkers",this.refreshMarkers),this.parent.off("updateHeight",this.updateHeight),this.parent.off("ui-update",this.propertyChanged))},e}(),Nt=function(){function e(e){this.validatedids=[],this.resourceCollectionIds=[],this.criticalTasks=[],this.parent=e}return e.prototype.getCriticalTasks=function(){return this.criticalTasks},e.prototype.showCriticalPath=function(e){var t=this.parent.ids,i=this.parent.flatData;if(e&&this.parent.flatData.length>0){this.parent.enableCriticalPath=!0;var a=this.parent.treeGrid.parentData,r=a[0].ganttProperties.endDate,n=0,s=[],o=[],l=[],d=0,h=[],p=[],u=[],c=[],g=[],f=[];this.criticalTasks=[],a[0].ganttProperties.autoEndDate>a[0].ganttProperties.endDate&&!a[0].ganttProperties.isAutoSchedule&&(r=a[0].ganttProperties.autoEndDate);for(y=1;y<a.length;y++)a[y].ganttProperties.endDate>=r&&(r=a[y].ganttProperties.endDate),a[y].ganttProperties.isAutoSchedule||a[y].ganttProperties.autoEndDate>=r&&(r=a[y].ganttProperties.autoEndDate);this.maxEndDate=r;for(var m=0;m<i.length;m++)i[m].isCritical=!1,i[m].ganttProperties.isCritical=!1,n=this.parent.dataOperation.getDuration(i[m].ganttProperties.endDate,r,i[m].ganttProperties.durationUnit,i[m].ganttProperties.isAutoSchedule,i[m].ganttProperties.isMilestone),i[m].slack=n+" "+i[m].ganttProperties.durationUnit,i[m].ganttProperties.slack=n+" "+i[m].ganttProperties.durationUnit,i[m].ganttProperties.endDate>=r&&s.push(i[m].ganttProperties.taskId),i[m].ganttProperties.predecessor&&0!==i[m].ganttProperties.predecessor.length&&(o.push(i[m]),l.push(i[m].ganttProperties.taskId));if("ResourceView"===this.parent.viewType)for(var y=0;y<this.parent.taskIds.length;y++)this.resourceCollectionIds[y]=this.parent.taskIds[y].slice(1);for(var D=this,v=0;v<s.length;v++)!function(e){if(-1===l.indexOf(s[e])){if("ProjectView"===D.parent.viewType)d=t.indexOf(s[e].toString());else for(var a=D.parent.currentViewData.filter(function(t){return parseInt(t.ganttProperties.taskId,10)===s[e]}),r=0;r<a.length;r++)!a[r].hasChildRecords&&a[r].ganttProperties.endDate>=D.maxEndDate&&(d=a[r].index);i[d].ganttProperties.progress<100&&(i[d].isCritical=!0,i[d].ganttProperties.isCritical=!0),i[d].slack="0 "+i[d].ganttProperties.durationUnit,h.push(s[e])}else p.push(s[e])}(v);for(var k=o.length,b=[],w=0;w<k;w++){for(var T=-1,S=-1,P=-1,C=-1,R=w,M=o[w].ganttProperties.predecessor,x=o[w].ganttProperties.predecessor.length,O=o[w].ganttProperties.taskId,I=0;I<x;I++)(isNaN(Number(M[I].from))||"string"==typeof O?(isNaN(Number(M[I].from)),M[I].from):parseInt(M[I].from,10))===O&&(-1===T?M[I].offset?(T=M[I].to+":"+M[I].offset+M[I].offsetUnit,P=M[I].type):(T=M[I].to,P=M[I].type):M[I].offset?(T=T+","+M[I].to+":"+M[I].offset+M[I].offsetUnit,P=P+","+M[I].type):(T=T+","+M[I].to,P=P+","+M[I].type)),(isNaN(Number(M[I].to))||"string"==typeof O?(isNaN(Number(M[I].to)),M[I].to):parseInt(M[I].to,10))===O&&(-1===S?M[I].offset?(S=M[I].from+":"+M[I].offset+M[I].offsetUnit,C=M[I].type):(S=M[I].from,C=M[I].type):M[I].offset?(S=S+","+M[I].from+":"+M[I].offset+M[I].offsetUnit,C=C+","+M[I].type):(S=S+","+M[I].from,C=C+","+M[I].type));-1===S&&(S=null,C=null),-1===T&&(T=null,P=null),u.push({from:S,fromPredecessor:C,taskid:O,to:T,toPredecessor:P,currentIndex:R,slack:null,enddate:null}),c.push(O)}for(var E=u.length,F=0,U=void 0,N=0;N<E;N++)if(!u[N].to){U=u[N].taskid,F="ProjectView"===this.parent.viewType?t.indexOf(U.toString()):this.resourceCollectionIds.indexOf(U.toString());var L=i[F].ganttProperties;n=this.parent.dataOperation.getDuration(L.endDate,r,"minute",L.isAutoSchedule,L.isMilestone),u[N].slack=n,u[N].fs=-1,u[N].enddate=L.endDate,b.push({fromdata:u[N].from,todateID:u[N].taskid,fromDataPredecessor:u[N].fromPredecessor})}for(var V={},v=0;v<b.length;v++)g.push(b[v]),this.slackCalculation(g,u,c,r,i,t,V);f=this.finalCriticalPath(u,h,i,t,r),this.validatedids=[],this.criticalPathCollection=f,this.detailPredecessorCollection=u,this.predecessorCollectionTaskIds=c}if(!1===e&&this.parent.flatData.length>0){var B=void 0;this.parent.enableCriticalPath=!1;for(N=0;N<this.criticalPathCollection.length;N++)B=t.indexOf(this.criticalPathCollection[N].toString()),i[B].isCritical=!1;this.criticalPathCollection=[],this.detailPredecessorCollection=[],this.predecessorCollectionTaskIds=[]}},e.prototype.slackCalculation=function(e,i,a,r,n,s,o){var l=e[0].fromdata.split(","),d=e[0].fromDataPredecessor.split(",");a=(a=a.toString()).split(",");for(var h,p,u,c,g,f,m,y,D=[],v=0;v<l.length;v++){if(D=l[v].split(":"),h=a.indexOf(D[0].toString()),c=a.indexOf(e[0].todateID.toString()),-1!==h){var k=h.toString(),b=JSON.stringify(i[h]);if(Object.prototype.hasOwnProperty.call(o,k)&&o[k]===b)return;o[k]=b}"ProjectView"===this.parent.viewType?(p=s.indexOf(D[0].toString()),u=s.indexOf(e[0].todateID.toString())):(p=this.resourceCollectionIds.indexOf(D[0].toString()),u=this.resourceCollectionIds.indexOf(e[0].todateID.toString()));var w=void 0;-1!==p&&(w=n[p].ganttProperties);var T=n[u].ganttProperties;if(D.length>1&&(m=-1!==D[1].indexOf("hour")?60*parseFloat(D[1]):-1!==D[1].indexOf("day")?parseFloat(D[1])*(this.parent.secondsPerDay/3600)*60:parseFloat(D[1])),w&&-1!==h&&("FS"===d[v]&&(g=w.endDate>T.startDate?-this.parent.dataOperation.getDuration(T.startDate,w.endDate,"minute",w.isAutoSchedule,w.isMilestone):this.parent.dataOperation.getDuration(w.endDate,T.startDate,"minute",w.isAutoSchedule,w.isMilestone),t.isNullOrUndefined(i[h].slack)?D.length<=1&&(i[c].slack+g<=0?i[h].slack=0:i[h].slack=i[c].slack+g):i[h].slack>g&&0!==i[h].slack&&D.length<=1&&(i[c].slack+g<=0?i[h].slack=0:i[h].slack=i[c].slack+g),D.length>1&&(i[h].slack=i[c].slack+g,i[h].slack=i[h].slack-m,i[h].slack<=0&&(i[h].slack=0)),i[h].fs=1,i[h].fsslack=i[h].slack,i[h].enddate=w.startDate,w.endDate>=r&&(i[h].slack=0)),"SS"===d[v]&&(w.isAutoSchedule?(g=w.startDate>T.startDate?-this.parent.dataOperation.getDuration(T.endDate,w.startDate,"minute",w.isAutoSchedule,w.isMilestone):this.parent.dataOperation.getDuration(w.startDate,T.startDate,"minute",w.isAutoSchedule,w.isMilestone),t.isNullOrUndefined(i[h].slack)?D.length<=1&&(i[c].slack+g<=0?i[h].slack=0:i[h].slack=i[c].slack+g):i[h].slack>g&&0!==i[h].slack&&D.length<=1&&(i[c].slack+g<=0?i[h].slack=0:i[h].slack=i[c].slack+g),D.length>1&&(i[h].slack=i[c].slack+g,i[h].slack=i[h].slack-m,i[h].slack<=0&&(i[h].slack=0)),i[h].fs=1,i[h].fsslack=i[h].slack,i[h].enddate=w.startDate):w.isAutoSchedule||(g=this.getSlackDuration(w.endDate,r,"minute",n[p]),t.isNullOrUndefined(i[h].slack)?i[h].slack=g:i[h].slack>g&&0!==i[h].slack&&(i[h].slack=g)),w.endDate>=r&&w.endDate<=r&&(i[h].slack=0)),"FF"===d[v]&&(1!==i[c].fs&&1!==i[c].ff&&-1!==i[c].fs||(1!==i[c].fs&&1!==i[c].ff||(f=T.endDate,y=i[c].slack),-1===i[c].fs&&(f=i[c].enddate,y=i[c].slack),g=f>w.endDate?-this.getSlackDuration(w.endDate,f,"minute",n[p]):this.getSlackDuration(f,w.endDate,"minute",n[p]),t.isNullOrUndefined(i[h].slack)?D.length<=1&&(i[h].slack=y-g<0?0:y-g):i[h].slack>g&&0!==i[h].slack&&D.length<=1&&(i[h].slack=y-g<0?0:y-g),D.length>1&&(i[h].slack=i[c].slack-g,i[h].slack=i[h].slack-m,i[h].slack<=0&&(i[h].slack=0)),i[h].ff=1,i[h].enddate=f,i[h].fsslack=y),w.endDate>=r&&w.endDate<=r&&(i[h].slack=0)),"SF"===d[v]&&(w.isAutoSchedule?t.isNullOrUndefined(i[h].slack)?(D.length<=1?t.isNullOrUndefined(i[c].to)?(g=this.getSlackDuration(w.endDate,r,"minute",n[p]),i[h].slack=g):t.isNullOrUndefined(i[c].to)||(g=T.endDate>w.startDate?-this.parent.dataOperation.getDuration(w.startDate,T.endDate,"minute",w.isAutoSchedule,w.isMilestone):this.getSlackDuration(T.endDate,w.startDate,"minute",n[p]),i[c].slack+g<=0?i[h].slack=0:i[h].slack=i[c].slack+g):D.length>1&&(g=T.endDate>=w.endDate?w.startDate>T.endDate?-this.getSlackDuration(T.endDate,w.startDate,"minute",n[p]):this.parent.dataOperation.getDuration(w.startDate,T.endDate,"minute",w.isAutoSchedule,w.isMilestone):this.getSlackDuration(w.endDate,r,"minute",n[p]),i[h].slack=i[c].slack+g,i[h].slack=i[h].slack-m,i[h].slack<=0&&(i[h].slack=0)),i[h].fs=1,i[h].fsslack=i[h].slack,i[h].enddate=w.startDate):(D.length<=1?(t.isNullOrUndefined(i[c].to)?g=this.getSlackDuration(w.endDate,r,"minute",n[p]):t.isNullOrUndefined(i[c].to)||(g=T.endDate>w.startDate?-this.parent.dataOperation.getDuration(w.startDate,T.endDate,"minute",w.isAutoSchedule,w.isMilestone):this.getSlackDuration(T.endDate,w.startDate,"minute",n[p])),i[h].slack>g&&0!==i[h].slack&&(t.isNullOrUndefined(i[c].to)?i[h].slack=g:t.isNullOrUndefined(i[c].to)||(i[c].slack+g<=0?i[h].slack=0:i[h].slack=i[c].slack+g))):D.length>1&&(g=T.endDate>w.endDate?w.startDate>T.endDate?-this.getSlackDuration(T.endDate,w.startDate,"minute",n[p]):this.parent.dataOperation.getDuration(w.startDate,T.endDate,"minute",w.isAutoSchedule,w.isMilestone):this.getSlackDuration(w.endDate,r,"minute",n[p]),i[h].slack>g&&0!==i[h].slack&&(i[h].slack=i[c].slack+g,i[h].slack=i[h].slack-m,i[h].slack<=0&&(i[h].slack=0))),i[h].fs=1,i[h].fsslack=i[h].slack,i[h].enddate=w.startDate):w.isAutoSchedule||(g=this.getSlackDuration(w.endDate,r,"minute",n[p]),t.isNullOrUndefined(i[h].slack)?i[h].slack=g:i[h].slack>g&&0!==i[h].slack&&(i[h].slack=g)),w.endDate>=r&&w.endDate<=r&&(i[h].slack=0)),i[h].from)){var S=[];S.push({fromdata:i[h].from,todateID:i[h].taskid,fromDataPredecessor:i[h].fromPredecessor}),this.slackCalculation(S,i,a,r,n,s,o)}}},e.prototype.getSlackDuration=function(e,t,i,a){var r=this.parent.dateValidationModule.checkStartDate(new Date(e)),n=this.parent.dateValidationModule.checkEndDate(new Date(t));return this.parent.dataOperation.getTimeDifference(r,n,!0)<=0?0:this.parent.dataOperation.getDuration(r,n,i,a.ganttProperties.isAutoSchedule,!0)},e.prototype.updateCriticalTasks=function(e,t){for(var i=0;i<e.ganttProperties.predecessor.length;i++){var a=void 0;if("ProjectView"===this.parent.viewType)a=this.parent.getRecordByID(e.ganttProperties.predecessor[i].from);else{var r=this.resourceCollectionIds.indexOf(e.ganttProperties.predecessor[i].from.toString());a=this.parent.flatData[r]}var n=void 0;e.ganttProperties.endDate&&e.ganttProperties.endDate.getTime()>=this.maxEndDate.getTime()&&(e.ganttProperties.slack=e.slack="0 "+e.ganttProperties.durationUnit,e.ganttProperties.progress<100&&(e.isCritical=!0,e.ganttProperties.isCritical=!0,-1===t.indexOf(e.ganttProperties.taskId)&&t.push(e.ganttProperties.taskId))),a&&("FS"===e.ganttProperties.predecessor[i].type?n=this.parent.dataOperation.getDuration(a.ganttProperties.endDate,e.ganttProperties.startDate,a.ganttProperties.durationUnit,a.ganttProperties.isAutoSchedule,!0):"SS"===e.ganttProperties.predecessor[i].type?n=this.parent.dataOperation.getDuration(a.ganttProperties.startDate,e.ganttProperties.startDate,a.ganttProperties.durationUnit,a.ganttProperties.isAutoSchedule,!0):"FF"===e.ganttProperties.predecessor[i].type?n=this.parent.dataOperation.getDuration(a.ganttProperties.endDate,e.ganttProperties.endDate,a.ganttProperties.durationUnit,a.ganttProperties.isAutoSchedule,!0):"SF"===e.ganttProperties.predecessor[i].type&&(n=this.parent.dataOperation.getDuration(e.ganttProperties.endDate,a.ganttProperties.startDate,a.ganttProperties.durationUnit,a.ganttProperties.isAutoSchedule,!0)),n>=0&&-1===this.validatedids.indexOf(parseInt(a.ganttProperties.taskId,10))&&a.ganttProperties.taskId!==e.ganttProperties.taskId&&(a.ganttProperties.slack=e.ganttProperties.slack,a.slack=e.slack,a.isCritical=e.ganttProperties.isCritical,a.ganttProperties.isCritical=e.ganttProperties.isCritical,-1===t.indexOf(a.ganttProperties.taskId)&&a.ganttProperties.isCritical&&a.ganttProperties.progress<100&&(t.push(a.ganttProperties.taskId),this.validatedids.push(parseInt(a.ganttProperties.taskId,10)),-1===this.criticalTasks.indexOf(a)&&this.criticalTasks.push(a)),a.ganttProperties.predecessorsName&&this.updateCriticalTasks(a,t)))}},e.prototype.finalCriticalPath=function(e,t,i,a,r){for(var n,s=[],o=e.length-1;o>=0;o--){var l=i[n="ProjectView"===this.parent.viewType?a.indexOf(e[o].taskid.toString()):this.resourceCollectionIds.indexOf(e[o].taskid.toString())].ganttProperties.predecessor,d="0 "+i[n].ganttProperties.durationUnit;if(l&&l.length>0)for(c=l.length-1;c>=0;c--){var h=void 0;h="ProjectView"===this.parent.viewType?this.parent.ids.indexOf(l[c].to):this.resourceCollectionIds.indexOf(l[c].to);var p=void 0,u=i[n].ganttProperties;-1!==h&&("FS"===l[c].type?l[c].to!==u.taskId.toString()&&(l[c].to!==u.taskId.toString()||"ResourceView"===this.parent.viewType?p=this.parent.dataOperation.getDuration(u.endDate,i[h].ganttProperties.startDate,u.durationUnit,u.isAutoSchedule,u.isMilestone):-1!==(h=this.parent.ids.indexOf(l[c].from))&&0===(p=this.parent.dataOperation.getDuration(i[h].ganttProperties.endDate,u.startDate,u.durationUnit,u.isAutoSchedule,u.isMilestone))&&n!==h&&i[n].slack===d&&(i[h].slack=i[n].slack,i[h].ganttProperties.slack=i[n].slack),-1!==h&&(0===p&&n!==h&&i[n].slack!==d?(i[n].slack=i[h].slack,i[n].ganttProperties.slack=i[h].slack):0!==p&&n!==h&&i[h].isCritical&&(i[n].slack=p+" "+i[n].ganttProperties.durationUnit,i[n].ganttProperties.slack=p+" "+i[n].ganttProperties.durationUnit))):p="SF"===l[c].type?this.parent.dataOperation.getDuration(u.startDate,i[h].ganttProperties.endDate,u.durationUnit,u.isAutoSchedule,u.isMilestone):"SS"===l[c].type?this.parent.dataOperation.getDuration(u.startDate,i[h].ganttProperties.startDate,u.durationUnit,u.isAutoSchedule,u.isMilestone):this.parent.dataOperation.getDuration(u.endDate,i[h].ganttProperties.endDate,u.durationUnit,u.isAutoSchedule,u.isMilestone),("number"==typeof i[n][this.parent.taskFields.id]?parseInt(l[c].from,10):l[c].from)===i[n][this.parent.taskFields.id]&&i[h].slack===d&&p<=0&&(i[n].slack=d,i[n].ganttProperties.slack=d))}i[n].slack===d&&i[n].ganttProperties.progress<100&&(i[n].isCritical=!0,i[n].ganttProperties.isCritical=!0,-1===this.criticalTasks.indexOf(i[n])&&this.criticalTasks.push(i[n]),-1===s.indexOf(e[o].taskid)&&s.push(e[o].taskid)),i[n].ganttProperties.predecessor&&i[n].ganttProperties.predecessor.length>0&&this.updateCriticalTasks(i[n],s)}if(t.length>0)for(var c=0;c<t.length;c++)-1!==(n="ProjectView"===this.parent.viewType?a.indexOf(t[c].toString()):this.resourceCollectionIds.indexOf(t[c].toString()))&&i[n].ganttProperties.progress<100&&(this.criticalTasks.push(i[n]),-1===s.indexOf(t[c])&&(s=s.concat(t[c])));return s},e.prototype.criticalConnectorLine=function(e,i,a,r){this.parent.removeCriticalPathStyles();for(var n=this,s=0;s<e.length;s++)!function(i){var a;if("ProjectView"===n.parent.viewType)a=n.parent.flatData[n.parent.ids.indexOf(e[i].toString())];else for(var r=n.parent.flatData.filter(function(t){return t.ganttProperties.taskId.toString()===e[i].toString()}),s=0;s<r.length;s++)(r[s].ganttProperties.isCritical||r[s].ganttProperties.endDate>=n.maxEndDate)&&(a=r[s]);var o=n.parent.currentViewData.indexOf(a),l=n.parent.getRowByIndex(o),d=void 0,h=n.parent.taskFields;if(a&&a.parentItem){var p=n.parent.currentViewData.filter(function(e){return a.parentItem.uniqueID===e.uniqueID}),u=n.parent.flatData.indexOf(p[0]),c=n.parent.getRowByIndex(u);if(c)for(var g=c.querySelectorAll(".e-taskbar-main-container"),f=0;f<g.length;f++)g[f].getAttribute("rowuniqueid")===a.rowUniqueID&&t.addClass(g[f].querySelectorAll(".e-gantt-child-taskbar-inner-div"),"e-gantt-child-critical-taskbar-inner-div")}d=n.parent.allowUnscheduledTasks&&a&&!a[h.startDate]&&!a[h.endDate]&&a[h.duration]?"e-gantt-critical-unscheduled-taskbar":"e-gantt-child-critical-progressbar-inner-div",l&&("ProjectView"===n.parent.viewType||"ResourceView"===n.parent.viewType&&!a.hasChildRecords)&&(l.getElementsByClassName("e-gantt-milestone")[0]&&t.addClass(l.querySelectorAll(".e-gantt-milestone"),"e-critical-milestone"),l.getElementsByClassName("e-gantt-child-taskbar-inner-div").length>0&&t.addClass(l.querySelectorAll(".e-gantt-child-taskbar-inner-div"),"e-gantt-child-critical-taskbar-inner-div"),l.getElementsByClassName("e-gantt-child-progressbar-inner-div").length>0&&t.addClass(l.querySelectorAll(".e-gantt-child-progressbar-inner-div"),d))}(s);if(0!==i.length)for(var o=0,l=void 0,d=[],h=void 0,p=void 0,s=0;s<this.criticalPathCollection.length;s++)if(o=r.indexOf(this.criticalPathCollection[s]),l=i[o],-1!==o&&l.to){d=l.to.split(",");for(var u=0;u<d.length;u++)if(p=d[u].split("+"),d[u].indexOf("-")>=0&&(p=d[u].split("-")),h=p[0].replace(":",""),"number"==typeof e[u]&&(h=parseInt(p[0],10)),-1!==e.indexOf(h)){var c=String(l.taskid),g=String(h);this.parent.element.querySelectorAll("#ConnectorLineparent"+c.replace(/([.])/g,"\\$1")+"child"+g.replace(/([.])/g,"\\$1")).length>0&&(t.addClass(this.parent.element.querySelectorAll("#ConnectorLineparent"+c.replace(/([.])/g,"\\$1")+"child"+g.replace(/([.])/g,"\\$1"))[0].querySelectorAll(".e-connector-line"),"e-critical-line"),t.addClass(this.parent.element.querySelectorAll("#ConnectorLineparent"+c.replace(/([.])/g,"\\$1")+"child"+g.replace(/([.])/g,"\\$1"))[0].querySelectorAll(".e-connector-line-arrow"),"e-critical-line-arrow"))}}},e.prototype.getModuleName=function(){return"criticalPath"},e.prototype.destroy=function(){!this.parent.enableCriticalPath&&this.parent.criticalPathModule&&(this.parent.criticalPathModule=void 0)},e}(),Lt=function(){return(Lt=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)},Vt=function(){function e(e){this.isUndoRedoPerformed=!1,this.changedRecords=[],this.getRedoCollection=[],this.getUndoCollection=[],this.redoEnabled=!1,this.previousSortedColumns=[],this.searchString="",this.isFromUndoRedo=!1,this.undoActionDetails={},this.canUpdateIndex=!0,this.sortedColumnsLength=0,this.isZoomingUndoRedoProgress=!1,this.uniqueDeletedRecords=[],this.parent=e}return e.prototype.isInHierarchyOf=function(e,t){for(var i=e.parentItem;i;){if(i.taskId===t.ganttProperties.taskId.toString())return!0;i=i.parentItem}return!1},e.prototype.isPartOfExistingHierarchy=function(e){return this.uniqueDeletedRecords.some(function(t){return!!this.isInHierarchyOf(e.data,t.data)||!!(t.data&&t.data.childRecords&&t.data.childRecords.some(function(t){return t.ganttProperties.taskId===e.data.ganttProperties.taskId}))}.bind(this))},e.prototype.undoAction=function(){var e=this;if(this.getUndoCollection.length>0){var i=this.getUndoCollection[this.getUndoCollection.length-1],a={};if("ZoomIn"===i.action||"ZoomOut"===i.action||"ZoomToFit"===i.action)a.action=i.action,a.previousZoomingLevel=t.extend({},{},this.parent.currentZoomingLevel,!0);else if("NextTimeSpan"===i.action||"PreviousTimeSpan"===i.action)a.action=i.action,a.previousTimelineStartDate=t.extend([],[this.parent.timelineModule.timelineStartDate],[],!0)[0],a.previousTimelineEndDate=t.extend([],[this.parent.timelineModule.timelineEndDate],[],!0)[0];else if("Sorting"===i.action)a.action="Sorting",a.sortColumns=this.previousSortedColumns;else if("Filtering"===i.action)a.action="Filtering",a.filteredColumns=i.filteredColumns;else if("ColumnReorder"===i.action)a.action=i.action,a.toColumn=i.fromColumn,a.fromColumn=i.toColumn,a.fromIndex=i.toIndex,a.toIndex=i.fromIndex;else if("Search"===i.action)a.action=i.action,a.searchString=this.searchString;else if("ColumnState"===i.action)a.action=i.action,a.showhideColumns=i.showhideColumns;else if("ColumnResize"===i.action)a.action=i.action,a.resizedColumn=Lt({},this.parent.treeGrid.columns[i.resizedColumn.index]);else if("RowDragAndDrop"===i.action||"TaskbarDragAndDrop"===i.action){for(var r=[],n=0;n<i.beforeDrop.length;n++)"ProjectView"===this.parent.viewType?r.push(this.parent.getRecordByID(i.beforeDrop[n].data.ganttProperties.taskId)):r.push(this.parent.flatData[this.getResourceViewRowIndex(i.beforeDrop[n].data)]);a.action=i.action,a.beforeDrop=[];var s={},o=t.extend([],[],[this.parent.getRecordByID(i.afterDrop.dropRecord.ganttProperties.taskId)],!0)[0];s.data=[];for(n=0;n<i.afterDrop.data.length;n++)"ProjectView"===this.parent.viewType?s.data.push(t.extend([],[],[this.parent.getRecordByID(i.afterDrop.data[n].ganttProperties.taskId)],!0)[0]):s.data.push(t.extend([],[],[this.parent.flatData[this.getResourceViewRowIndex(i.afterDrop.data[n])]],!0)[0]);s.dropRecord=t.extend([],[],[o],!0)[0],s.dropPosition=i.afterDrop.dropPosition,a.afterDrop=s,this.findPosition(r,a,"beforeDrop")}else if("Indent"===i.action||"Outdent"===i.action)a.selectedRowIndexes=i.selectedRowIndexes,a.droppedRecord=t.extend([],[],[this.parent.flatData[this.parent.ids.indexOf(i.droppedRecord.ganttProperties.taskId.toString())]],!0)[0],a.modifiedRecord=[],this.findPosition(t.extend([],[],[this.parent.flatData[this.parent.ids.indexOf(i.modifiedRecord[0].data.ganttProperties.taskId.toString())]],!0),a,"modifiedRecord"),a.action=i.action;else if("Delete"===i.action){a.action="Delete",a.deleteRecords=[];for(n=0;n<i.deletedRecordsDetails.length;n++){var l=i.deletedRecordsDetails[n];this.isPartOfExistingHierarchy(l)||this.uniqueDeletedRecords.push(l)}i.deletedRecordsDetails=this.uniqueDeletedRecords,a.deleteRecords=this.uniqueDeletedRecords.map(function(e){return e.data}),this.uniqueDeletedRecords=[]}else if("Add"===i.action){a.action="Add",a.deletedRecordsDetails=[];r=i.addedRecords;this.findPosition(r,a,"deletedRecordsDetails")}else{a.action=i.action,a.modifiedRecords=[];for(n=0;n<i.modifiedRecords.length;n++){var d=void 0;d="ProjectView"===this.parent.viewType?this.findTaskRowIndex(i.modifiedRecords[n].ganttProperties.taskId.toString()):this.parent.undoRedoModule.getResourceViewRowIndex(i.modifiedRecords[n]),a.modifiedRecords.push(t.extend([],[this.parent.flatData[d]],[],!0)[0])}}if(this.getRedoCollection.push(a),this.isUndoRedoPerformed=!0,this.changedRecords=[],this.currentAction=i,"ZoomIn"===i.action||"ZoomOut"===i.action||"ZoomToFit"===i.action)this.parent.timelineSettings.timelineViewMode=i.previousZoomingLevel.timelineViewMode,this.parent.timelineSettings.timelineUnitSize=i.previousZoomingLevel.timelineUnitSize,this.parent.timelineSettings.updateTimescaleView=i.previousZoomingLevel.updateTimescaleView,this.parent.timelineSettings.topTier.unit=i.previousZoomingLevel.topTier.unit,this.parent.timelineSettings.topTier.count=i.previousZoomingLevel.topTier.count,this.parent.timelineSettings.topTier.format=i.previousZoomingLevel.topTier.format,this.parent.timelineSettings.bottomTier.unit=i.previousZoomingLevel.bottomTier.unit,this.parent.timelineSettings.bottomTier.count=i.previousZoomingLevel.bottomTier.count,this.parent.timelineSettings.bottomTier.format=i.previousZoomingLevel.bottomTier.format,this.parent.timelineSettings.weekStartDay=i.previousZoomingLevel.weekStartDay,this.parent.timelineSettings.weekendBackground=i.previousZoomingLevel.weekendBackground,this.isZoomingUndoRedoProgress=!0,"ZoomToFit"===i.action&&this.parent.timelineModule.refreshTimeline(),this.isUndoRedoPerformed=!1;else if("NextTimeSpan"===i.action||"PreviousTimeSpan"===i.action)this.parent.updateProjectDates(i.previousTimelineStartDate,i.previousTimelineEndDate,!1),this.isUndoRedoPerformed=!1;else if("Sorting"===i.action)if(this.isFromUndoRedo=!0,this.sortedColumnsLength=0,i.sortColumns.length>0)for(n=0;n<i.sortColumns.length;n++)this.parent.treeGrid.sortByColumn(i.sortColumns[n].field,i.sortColumns[n].direction,n>0);else this.parent.clearSorting();else if("Filtering"===i.action){this.isFromUndoRedo=!0;for(n=this.getUndoCollection.length-1;n>=0;n--)if(this.getUndoCollection[n].filteredColumns){for(var h=[],p=0;p<this.getUndoCollection[n].filteredColumns.length;p++)h.push(this.getUndoCollection[n].filteredColumns[p].field);this.parent.clearFiltering(h)}}else if("ColumnReorder"===i.action){this.isFromUndoRedo=!0;var u=this.parent.treeGrid.columns[i.fromIndex].field,c=this.parent.treeGrid.columns[i.toIndex].field;this.parent.reorderColumns(u,c)}else if("Search"===i.action)this.isFromUndoRedo=!0,this.parent.search(i.searchString);else if("ColumnState"===i.action){this.isFromUndoRedo=!0;for(n=0;n<i.showhideColumns.length;n++)i.showhideColumns[n].visible?this.parent.hideColumn(i.showhideColumns[n].field,"field"):this.parent.showColumn(i.showhideColumns[n].field,"field");this.isUndoRedoPerformed=!1}else if("ColumnResize"===i.action)this.parent.treeGrid.columns[i.resizedColumn.index].width=i.resizedColumn.width,this.parent.treeGrid.refreshColumns();else if("RowDragAndDrop"===i.action||"TaskbarDragAndDrop"===i.action)for(n=0;n<i.beforeDrop.length;n++){var g=this.findTaskRowIndex(i.beforeDrop[n].data.ganttProperties.taskId.toString()),f=this.findTaskRowIndex(i.beforeDrop[n].id.toString());this.parent.reorderRows([g],f,i.beforeDrop[n].position)}else if("Indent"===i.action||"Outdent"===i.action)this.parent.selectRow(this.findTaskRowIndex(i.modifiedRecord[0].data.ganttProperties.taskId.toString())),"Indent"===i.action?this.parent.outdent():this.parent.indent();else if("Delete"===i.action)for(n=0;n<i.deletedRecordsDetails.length;n++){var m=this.findTaskRowIndex(i.deletedRecordsDetails[n].id.toString()),y=void 0;if("above"===i.deletedRecordsDetails[n].position&&(y="Above"),"below"===i.deletedRecordsDetails[n].position&&(y="Below"),"child"===i.deletedRecordsDetails[n].position&&(y="Child"),t.isNullOrUndefined(y)){var D=i.deletedRecordsDetails[n].position;y=D.charAt(0).toUpperCase()+D.slice(1)}i.deletedRecordsDetails[n].data.ganttProperties.predecessor&&i.deletedRecordsDetails[n].data.ganttProperties.predecessor.length>0&&i.deletedRecordsDetails[n].data.ganttProperties.predecessor.forEach(function(t){var i=e.parent.connectorLineModule.getRecordByID(t.to);if(i){i.ganttProperties.predecessor.push(t);var a=e.parent.predecessorModule.getPredecessorStringValue(i);i.ganttProperties.predecessorsName=a}}),this.parent.addRecord(i.deletedRecordsDetails[n].data,y,m)}else if("Add"===i.action){var v=t.extend([],[this.parent.editSettings.showDeleteConfirmDialog],[],!0)[0];this.parent.editSettings.showDeleteConfirmDialog=!1;var k=i.addedRecords;if("ResourceView"===this.parent.viewType&&1===i.addedRecords.length&&i.addedRecords[0].parentItem){var b=this.parent.getTaskByUniqueID(i.addedRecords[0].parentItem.uniqueID);1===b.childRecords.length&&"Unassigned Task"===b.ganttProperties.taskName&&(k=b)}this.parent.deleteRecord(k),this.parent.enableVirtualization&&this.parent.treeGrid.virtualScrollModule&&!t.isNullOrUndefined(this.parent.treeGrid.virtualScrollModule.ganttEndIndex)&&(this.parent.treeGrid.virtualScrollModule.ganttEndIndex=this.parent.flatData.length),this.parent.editSettings.showDeleteConfirmDialog=v}else{if(this.parent.updateRecordByID(this.getUndoCollection[this.getUndoCollection.length-1].modifiedRecords[0]),i.connectedRecords&&"ProjectView"===this.parent.viewType)for(n=0;n<i.connectedRecords.length;n++)this.parent.updateRecordByID(i.connectedRecords[n]);this.isUndoRedoPerformed=!1}var w={};(w=t.extend([],[],[this.getUndoCollection[this.getUndoCollection.length-1]],!0)[0]).requestType="afterUndoAction",this.parent.trigger("onAfterUndo",w),"RowDragAndDrop"!==i.action&&"TaskbarDragAndDrop"!==i.action&&"Indent"!==i.action&&"Outdent"!==i.action||(this.undoActionDetails=this.getUndoCollection[this.getUndoCollection.length-1]),this.getRedoCollection.length>0&&(this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_redo"],!0),this.redoEnabled=!0),this.getUndoCollection.splice(this.getUndoCollection.length-1,1),0===this.getUndoCollection.length&&this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!1)}else this.getUndoCollection.splice(this.getUndoCollection.length-1,1),0===this.getUndoCollection.length&&this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!1)},e.prototype.redoAction=function(){if(this.getRedoCollection.length>0){var e=this.getRedoCollection[this.getRedoCollection.length-1],i={};if("ZoomIn"===e.action||"ZoomOut"===e.action||"ZoomToFit"===e.action)i.action=e.action,i.previousZoomingLevel=t.extend({},{},this.parent.currentZoomingLevel,!0),i.previousZoomingLevel.bottomTier.format=this.parent.timelineModule.customTimelineSettings.bottomTier.format,i.previousZoomingLevel.topTier.format=this.parent.timelineModule.customTimelineSettings.topTier.format;else if("NextTimeSpan"===e.action||"PreviousTimeSpan"===e.action)i.action=e.action,i.previousTimelineStartDate=t.extend([],[this.parent.timelineModule.timelineStartDate],[],!0)[0],i.previousTimelineEndDate=t.extend([],[this.parent.timelineModule.timelineEndDate],[],!0)[0];else if("Sorting"===e.action)i.action="Sorting",i.sortColumns=t.extend([],this.parent.sortSettings.columns,[],!0);else if("Filtering"===e.action)i.action="Filtering",i.filteredColumns=e.filteredColumns;else if("ColumnReorder"===e.action)i.action=e.action,i.toColumn=e.fromColumn,i.fromColumn=e.toColumn,i.fromIndex=e.toIndex,i.toIndex=e.fromIndex;else if("Search"===e.action)i.action=e.action,i.searchString=t.extend([],[this.parent.searchSettings.key],[],!0)[0];else if("ColumnState"===e.action)i.action=e.action,i.showhideColumns=e.showhideColumns;else if("ColumnResize"===e.action)i.action=e.action,i.resizedColumn=Lt({},this.parent.treeGrid.columns[e.resizedColumn.index]);else if("RowDragAndDrop"===e.action||"TaskbarDragAndDrop"===e.action){for(var a=[],r=0;r<e.beforeDrop.length;r++)"ProjectView"===this.parent.viewType?a.push(this.parent.getRecordByID(e.beforeDrop[r].data.ganttProperties.taskId)):a.push(this.parent.flatData[this.getResourceViewRowIndex(e.beforeDrop[r].data)]);i.action=e.action,i.beforeDrop=[];var n={},s=void 0;e.afterDrop.dropRecord&&(s=t.extend([],[],[this.parent.getRecordByID(e.afterDrop.dropRecord.ganttProperties.taskId)],!0)[0]),n.data=[];for(r=0;r<e.afterDrop.data.length;r++)"ProjectView"===this.parent.viewType?n.data.push(t.extend([],[],[this.parent.getRecordByID(e.afterDrop.data[r].ganttProperties.taskId)],!0)[0]):void 0!==e.afterDrop.data[r]&&n.data.push(t.extend([],[],[this.parent.flatData[this.getResourceViewRowIndex(e.afterDrop.data[r])]],!0)[0]);n.dropRecord=t.extend([],[],[s],!0)[0],n.dropPosition=e.afterDrop.dropPosition,i.afterDrop=n,this.findPosition(a,i,"beforeDrop")}else if("Indent"===e.action||"Outdent"===e.action)i.selectedRowIndexes=e.selectedRowIndexes,i.droppedRecord=t.extend([],[],[this.parent.flatData[this.parent.ids.indexOf(e.droppedRecord.ganttProperties.taskId.toString())]],!0)[0],i.modifiedRecord=[],this.findPosition(t.extend([],[],[this.parent.flatData[this.parent.ids.indexOf(e.modifiedRecord[0].data.ganttProperties.taskId.toString())]],!0),i,"modifiedRecord"),i.action=e.action;else if("Delete"===e.action)i.action="Delete",i.deletedRecordsDetails=[],this.findPosition(t.extend([],[],e.deleteRecords,!0),i,"deletedRecordsDetails");else if("Add"===e.action)i.action="Add",i.addedRecords=[e.deletedRecordsDetails[0].data];else{i.action=e.action,i.modifiedRecords=[];for(r=0;r<e.modifiedRecords.length;r++){var o=this.findTaskRowIndex(e.modifiedRecords[r].ganttProperties.taskId.toString());i.modifiedRecords.push(t.extend([],[this.parent.flatData[o]],[],!0)[0])}}if(this.getUndoCollection.push(i),this.isUndoRedoPerformed=!0,this.currentAction=e,"ZoomIn"===e.action||"ZoomOut"===e.action||"ZoomToFit"===e.action)"ZoomToFit"===e.action?this.parent.fitToProject():(this.parent.timelineSettings.timelineViewMode=e.previousZoomingLevel.timelineViewMode,this.parent.timelineSettings.timelineUnitSize=e.previousZoomingLevel.timelineUnitSize,this.parent.timelineSettings.updateTimescaleView=e.previousZoomingLevel.updateTimescaleView,this.parent.timelineSettings.topTier.unit=e.previousZoomingLevel.topTier.unit,this.parent.timelineSettings.topTier.count=e.previousZoomingLevel.topTier.count,this.parent.timelineSettings.topTier.format=e.previousZoomingLevel.topTier.format,this.parent.timelineSettings.bottomTier.unit=e.previousZoomingLevel.bottomTier.unit,this.parent.timelineSettings.bottomTier.count=e.previousZoomingLevel.bottomTier.count,this.parent.timelineSettings.bottomTier.format=e.previousZoomingLevel.bottomTier.format,this.parent.timelineSettings.weekStartDay=e.previousZoomingLevel.weekStartDay,this.parent.timelineSettings.weekendBackground=e.previousZoomingLevel.weekendBackground,this.isZoomingUndoRedoProgress=!0),this.isUndoRedoPerformed=!1;else if("NextTimeSpan"===e.action||"PreviousTimeSpan"===e.action)this.parent.updateProjectDates(e.previousTimelineStartDate,e.previousTimelineEndDate,!1),this.isUndoRedoPerformed=!1;else if("Sorting"===e.action)if(this.isFromUndoRedo=!0,this.sortedColumnsLength=0,0===e.sortColumns.length)this.parent.clearSorting();else for(r=0;r<e.sortColumns.length;r++)this.parent.treeGrid.sortByColumn(e.sortColumns[r].field,e.sortColumns[r].direction,e.sortColumns.length>1);else if("ColumnState"===e.action){this.isFromUndoRedo=!0;for(r=0;r<e.showhideColumns.length;r++)e.showhideColumns[r].visible?this.parent.hideColumn(e.showhideColumns[r].field,"field"):this.parent.showColumn(e.showhideColumns[r].field,"field");this.isUndoRedoPerformed=!1}else if("Filtering"===e.action)for(var l=0;l<e.filteredColumns.length;l++)this.isFromUndoRedo=!0,this.parent.filterByColumn(e.filteredColumns[l].field,e.filteredColumns[l].operator,e.filteredColumns[l].value,e.filteredColumns[l].predicate,e.filteredColumns[l].matchCase,e.filteredColumns[l].ignoreAccent);else if("ColumnReorder"===e.action){this.isFromUndoRedo=!0;var d=this.parent.treeGrid.columns[e.fromIndex].field,h=this.parent.treeGrid.columns[e.toIndex].field;this.parent.reorderColumns(d,h)}else if("Search"===e.action)this.isFromUndoRedo=!0,this.parent.search(e.searchString);else if("ColumnResize"===e.action)this.parent.treeGrid.columns[e.resizedColumn.index].width=e.resizedColumn.width,this.parent.treeGrid.refreshColumns();else if("RowDragAndDrop"===e.action||"TaskbarDragAndDrop"===e.action)for(r=0;r<e.beforeDrop.length;r++){var p=this.findTaskRowIndex(e.beforeDrop[r].data.ganttProperties.taskId.toString()),u=this.findTaskRowIndex(e.beforeDrop[r].id.toString());this.parent.reorderRows([p],u,e.beforeDrop[r].position)}else if("Indent"===e.action||"Outdent"===e.action)this.parent.selectRow(e.selectedRowIndexes[0]),"Indent"===e.action&&this.parent.indent(),"Outdent"===e.action&&this.parent.outdent();else if("Delete"===e.action){var c=t.extend([],[this.parent.editSettings.showDeleteConfirmDialog],[],!0)[0];this.parent.editSettings.showDeleteConfirmDialog=!1,this.parent.deleteRecord(e.deleteRecords),this.parent.editSettings.showDeleteConfirmDialog=c}else if("Add"===e.action)if("ResourceView"===this.parent.viewType&&e.deletedRecordsDetails.length>1)this.parent.editModule.addRecord(t.extend([],[],e.deletedRecordsDetails,!0));else for(r=0;r<e.deletedRecordsDetails.length;r++){var g=this.findTaskRowIndex(e.deletedRecordsDetails[r].id.toString()),f=void 0;"above"===e.deletedRecordsDetails[r].position&&(f="Above"),"below"===e.deletedRecordsDetails[r].position&&(f="Below"),"child"===e.deletedRecordsDetails[r].position&&(f="Child"),"bottom"===e.deletedRecordsDetails[r].position&&(f="Bottom"),this.parent.editModule.addRecord(e.deletedRecordsDetails[r].data,f,g)}else this.parent.updateRecordByID(e.modifiedRecords[0]),this.isUndoRedoPerformed=!1;this.getUndoCollection.length>0&&this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!0),this.getRedoCollection.splice(this.getRedoCollection.length-1,1),0===this.getRedoCollection.length&&this.parent.toolbarModule&&(this.redoEnabled=!1,this.parent.toolbarModule.enableItems([this.parent.controlId+"_redo"],!1))}},e.prototype.findTaskRowIndex=function(e){var t=this;return this.parent.updatedRecords.findIndex(function(i){var a=i.ganttProperties.taskId.toString();if("ProjectView"===t.parent.viewType)return a===e;var r=(0===i.level||"Unassigned Task"===i.ganttProperties.taskName?"R":"T")+a;return a===e||r===e})},e.prototype.getResourceViewRowIndex=function(e){if(e){var t=0===e.level?"R":"T";return this.parent.taskIds.indexOf(t+e.ganttProperties.taskId.toString())}return-1},e.prototype.createUndoCollection=function(){this.parent.totalUndoAction+1>this.parent.undoRedoStepsCount&&this.getUndoCollection.length===this.parent.totalUndoAction&&(this.getUndoCollection.splice(0,1),this.disableRedo()),this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!0),0===this.getUndoCollection.length?(this.getUndoCollection[0]=[],this.parent.totalUndoAction+1<=this.parent.undoRedoStepsCount&&this.parent.totalUndoAction++):Object.keys(this.getUndoCollection[this.getUndoCollection.length-1]).length>0&&(this.getUndoCollection[this.getUndoCollection.length]=[],this.parent.totalUndoAction+1<=this.parent.undoRedoStepsCount&&this.parent.totalUndoAction++)},e.prototype.disableRedo=function(){this.redoEnabled=!1,this.getRedoCollection=[],this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_redo"],!1)},e.prototype.findPosition=function(e,i,a){for(var r=this,n=0;n<e.length;n++)!function(n){var s={};if(s.data=e[n],"ProjectView"===r.parent.viewType)if(!e[n].hasChildRecords&&e[n].parentItem)if((c=r.parent.getRecordByID(e[n].parentItem.taskId)).childRecords.length>1){w=r.parent.ids.indexOf(e[n].ganttProperties.taskId.toString());if((b=r.parent.flatData[w-1]).parentItem&&b.parentItem.taskId.toString()===c.ganttProperties.taskId.toString())s.position="below",s.id=t.extend([],[r.parent.flatData[r.parent.ids.indexOf(e[n].ganttProperties.taskId.toString())-1].ganttProperties.taskId],[],!0)[0];else{s.position="above";var o=r.parent.flatData[r.parent.ids.indexOf(e[n].ganttProperties.taskId.toString())+1],l=r.parent.ids.indexOf(e[n].ganttProperties.taskId.toString())+1,d=n;do{!(P=e[d+1])||P&&o.ganttProperties.taskId.toString()!==P.ganttProperties.taskId.toString()?o&&o.parentItem?s.id=t.extend([],[o.ganttProperties.taskId],[],!0)[0]:(s.id=t.extend([],[e[n].parentItem.taskId],[],!0)[0],s.position="child"):(d++,l++,o=r.parent.flatData[l])}while(!s.id)}}else s.position="child",s.id=t.extend([],[c.ganttProperties.taskId],[],!0)[0];else if(e[n].hasChildRecords||e[n].parentItem){if(e[n].hasChildRecords&&!e[n].parentItem){for(var h=void 0,o=void 0,p=void 0,u=0;u<r.parent.treeGrid.parentData.length;u++)if(r.parent.treeGrid.parentData[u].ganttProperties.taskId.toString()===e[n].ganttProperties.taskId.toString()){h=u,o=r.parent.treeGrid.parentData[u+1],p=u+1;break}if(-1!==h)if(0===h){s.position="above";d=n;do{!(P=e[d+1])||P&&o.ganttProperties.taskId.toString()!==P.ganttProperties.taskId.toString()?(o||(o=r.parent.treeGrid.parentData[h]),s.id=t.extend([],[o.ganttProperties.taskId],[],!0)[0]):(d++,p++,o=r.parent.treeGrid.parentData[p])}while(!s.id)}else s.position="below",s.id=t.extend([],[r.parent.treeGrid.parentData[h-1].ganttProperties.taskId],[],!0)[0]}else if(e[n].hasChildRecords&&e[n].parentItem){var c=r.parent.getRecordByID(e[n].parentItem.taskId),g=c.childRecords,f=g.length,m=e[n].ganttProperties.taskId.toString();if(1===f)s.position="child",s.id=t.extend([],[c.ganttProperties.taskId],[],!0)[0];else{var y=g.findIndex(function(e){return e.ganttProperties.taskId.toString()===m});-1!==y&&(0===y?(s.position="above",s.id=g[1].ganttProperties.taskId):(s.position="below",s.id=g[y-1].ganttProperties.taskId))}}}else{r.parent.ids.indexOf(e[n].ganttProperties.taskId.toString())===r.parent.ids.length-1?s.position="below":s.position="above";for(var h=void 0,o=void 0,p=void 0,u=0;u<r.parent.treeGrid.parentData.length;u++)if(r.parent.treeGrid.parentData[u].ganttProperties.taskId.toString()===e[n].ganttProperties.taskId.toString()){h=u,o=r.parent.treeGrid.parentData[u+1],p=u+1;break}d=n;do{!(P=e[d+1])||P&&o.ganttProperties.taskId.toString()!==P.ganttProperties.taskId.toString()?o?s.id=t.extend([],[o.ganttProperties.taskId],[],!0)[0]:((o=r.parent.treeGrid.parentData[h-1])||(o=r.parent.treeGrid.parentData[h]),s.id=t.extend([],[o.ganttProperties.taskId],[],!0)[0]):(d++,p++,o=r.parent.treeGrid.parentData[p])}while(!s.id)}else if(e[n].parentItem){var D=void 0;if(1===(D=e[n].parentItem.index?r.parent.flatData[e[n].parentItem.index]:r.parent.flatData[r.parent.ids.indexOf(e[n].parentItem.taskId)]).childRecords.length)s.position="child",s.id="R"+D.ganttProperties.taskId,"deletedIndexes"===a&&(s.position="child",s.index=D.index);else{for(var v=void 0,k=0;k<D.childRecords.length;k++)if(D.childRecords[k].ganttProperties.taskId.toString()===e[n].ganttProperties.taskId.toString()){v=k;break}var b=D.childRecords[v-1];if(b&&b.parentItem&&b.parentUniqueID===D.uniqueID)s.position="below",s.id=t.extend([],["T"+r.parent.flatData[r.parent.taskIds.indexOf("T"+e[n].ganttProperties.taskId.toString())-1].ganttProperties.taskId],[],!0)[0],"deletedIndexes"===a&&(s.index=r.parent.taskIds.indexOf("T"+e[n].ganttProperties.taskId.toString())-1);else{l=void 0;if(v!==D.childRecords.length-1){s.position="above",0===v&&D.childRecords[1]?l=D.childRecords[1].index:D.childRecords[v-1]&&(l=D.childRecords[v-1].index);var o=r.parent.flatData[l],w=l,d=n;do{!(P=e[d+1])||P&&o.ganttProperties.taskId.toString()!==P.ganttProperties.taskId.toString()?o&&o.parentItem?(s.id=t.extend([],["T"+o.ganttProperties.taskId],[],!0)[0],"deletedIndexes"===a&&(s.index=t.extend([],[o.index],[],!0)[0],0===v&&D.childRecords[1].ganttProperties.taskId===o.ganttProperties.taskId&&(s.index=s.index-1))):(s.id=t.extend([],["R"+e[n].parentItem.taskId],[],!0)[0],s.position="child","deletedIndexes"===a&&(s.index=e[n].parentItem.index)):(d++,w++,o=r.parent.flatData[w])}while(!s.id)}else v===D.childRecords.length-1?s.position="below":s.position="above",s.id="T"+D.childRecords[v-1].ganttProperties.taskId,"deletedIndexes"===a&&(s.index=D.childRecords[v-1].index)}}}else{var T=r.parent.treeGrid.parentData.filter(function(t){return t.ganttProperties.taskId===e[n].ganttProperties.taskId})[0],S=r.parent.treeGrid.parentData.indexOf(T);if(0===S){s.position="above";for(var o=void 0,p=void 0,u=0;u<r.parent.treeGrid.parentData.length;u++)if(r.parent.treeGrid.parentData[u].ganttProperties.taskId===e[n].ganttProperties.taskId){o=r.parent.treeGrid.parentData[u+1],p=u+1;break}d=n;do{var P=e[d+1];!P||P&&o.ganttProperties.taskId!==P.ganttProperties.taskId?(s.id="R"+o.ganttProperties.taskId,"deletedIndexes"===a&&(s.index=o.index)):(d++,p++,o=r.parent.treeGrid.parentData[p])}while(!s.id)}else s.position="below",s.id="R"+r.parent.treeGrid.parentData[S-1].ganttProperties.taskId,"deletedIndexes"===a&&(s.index=r.parent.treeGrid.parentData[S-1].index)}if("deletedIndexes"===a){var C=r.parent.getTaskByUniqueID(s.data.parentUniqueID);if(0===r.parent.editModule.dialogModule.ganttResources.length&&-1===i[a].indexOf(s))i[a].push(s);else for(k=0;k<r.parent.editModule.dialogModule.ganttResources.length;k++)r.parent.editModule.dialogModule.ganttResources[k][r.parent.resourceFields.id]!==C.ganttProperties.taskId&&-1===i[a].indexOf(s)&&i[a].push(s)}else i[a].some(function(e){return e.data.ganttProperties.taskId===s.data.ganttProperties.taskId})||i[a].push(s)}(n)},e.prototype.getModuleName=function(){return"undoRedo"},e.prototype.destroy=function(){!this.parent.enableUndoRedo&&this.parent.undoRedoModule&&(this.parent.undoRedoModule=void 0)},e}(),Bt=function(){function e(e){var i=this;this.segmentIndex=-1,this.isCntxtMenuDependencyDelete=!1,this.headerContextMenuClick=function(e){var a=t.closest(e.event.target,".e-row"),r=t.closest(e.event.target,".e-chart-row");t.isNullOrUndefined(a)&&t.isNullOrUndefined(r)&&(e.type="Header",i.parent.trigger("contextMenuClick",e))},this.headerContextMenuOpen=function(e){var a=t.closest(e.event.target,".e-row"),r=t.closest(e.event.target,".e-chart-row");t.isNullOrUndefined(a)&&t.isNullOrUndefined(r)?(e.type="Header",i.parent.trigger("contextMenuOpen",e)):e.cancel=!0},this.parent=e,this.ganttID=e.element.id,n.TreeGrid.Inject(n.ContextMenu),this.parent.treeGrid.contextMenuClick=this.headerContextMenuClick.bind(this),this.parent.treeGrid.contextMenuOpen=this.headerContextMenuOpen.bind(this),this.addEventListener(),this.resetItems()}return e.prototype.addEventListener=function(){this.parent.isDestroyed||(this.parent.on("initiate-contextMenu",this.render,this),this.parent.on("reRender-contextMenu",this.reRenderContextMenu,this),this.parent.on("contextMenuClick",this.contextMenuItemClick,this),this.parent.on("contextMenuOpen",this.contextMenuBeforeOpen,this))},e.prototype.reRenderContextMenu=function(e){e.module===this.getModuleName()&&e.enable&&(this.contextMenu&&(this.contextMenu.destroy(),t.remove(this.element)),this.resetItems(),this.render())},e.prototype.render=function(){this.element=this.parent.createElement("ul",{id:this.ganttID+"_contextmenu",className:"e-grid"}),this.parent.element.appendChild(this.element);var e="#"+this.ganttID;this.contextMenu=new d.ContextMenu({items:this.getMenuItems(),locale:this.parent.locale,enableRtl:this.parent.enableRtl,target:e,animationSettings:{effect:"None"},select:this.contextMenuItemClick.bind(this),beforeOpen:this.contextMenuBeforeOpen.bind(this),onOpen:this.contextMenuOpen.bind(this),onClose:this.contextMenuOnClose.bind(this),cssClass:"e-gantt"}),this.contextMenu.appendTo(this.element),this.parent.treeGrid.contextMenuItems=this.headerMenuItems},e.prototype.contextMenuItemClick=function(e){this.item=this.getKeyFromId(e.item.id);var i,a,r,n=t.getValue("parentObj",e.item),s=-1;switch(e.type="Content",e.rowData=this.rowData,this.parent.trigger("contextMenuClick",e),n&&!t.isNullOrUndefined(n.id)&&"DeleteDependency"===this.getKeyFromId(n.id)&&(s=n.items.indexOf(e.item)),this.parent.isAdaptive&&("TaskInformation"!==this.item&&"Above"!==this.item&&"Below"!==this.item&&"Child"!==this.item&&"DeleteTask"!==this.item||this.parent.selectionModule&&"Multiple"===this.parent.selectionSettings.type&&(this.parent.selectionModule.hidePopUp(),document.getElementsByClassName("e-gridpopup")[0].style.display="none")),this.item){case"TaskInformation":t.isNullOrUndefined(this.rowData)||("string"==typeof this.rowData.ganttProperties.taskId?this.parent.openEditDialog(this.rowData.ganttProperties.rowUniqueID):this.parent.openEditDialog(Number(this.rowData.ganttProperties.rowUniqueID)));break;case"Above":case"Below":case"Child":if(t.isNullOrUndefined(this.rowData))0===this.parent.flatData.length&&this.parent.addRecord();else if(i=this.item,a=t.extend({},{},this.rowData.taskData,!0),r=this.parent.taskFields,a[r.startDate]&&this.parent.setRecordValue(r.startDate,this.rowData.ganttProperties.startDate,a,!0),a[r.endDate]&&this.parent.setRecordValue(r.endDate,this.rowData.ganttProperties.endDate,a,!0),t.isNullOrUndefined(r.dependency)||(a[r.dependency]=null),!t.isNullOrUndefined(r.child)&&a[r.child]&&delete a[r.child],!t.isNullOrUndefined(r.parentID)&&a[r.parentID]&&(a[r.parentID]=null),this.rowData){if("ResourceView"===this.parent.viewType&&this.rowData.parentItem&&a[this.parent.taskFields.resourceInfo]){var o=this.parent.getParentTask(this.rowData.parentItem),l=this.parent.resourceFields.id,d=this.rowData.taskData[this.parent.taskFields.resourceInfo].find(function(e){return e[l]===o.ganttProperties.taskId});a[this.parent.taskFields.resourceInfo]=d?[d]:[]}var h=this.parent.updatedRecords.indexOf(this.rowData);this.parent.addRecord(a,i,h)}break;case"Milestone":case"ToMilestone":if(t.isNullOrUndefined(this.rowData)){if(0===this.parent.flatData.length&&"Milestone"===this.item){var p=this.parent.editModule.createNewRecord(),u=this.parent.taskFields;this.parent.taskFields.duration&&(p[u.duration]=0),this.parent.taskFields.milestone&&(p[u.milestone]=!0),this.parent.addRecord(p)}}else this.parent.convertToMilestone(this.rowData.ganttProperties.rowUniqueID);break;case"DeleteTask":"Cell"!==this.parent.selectionSettings.mode&&this.parent.selectionModule.selectedRowIndexes.length>1||"Cell"===this.parent.selectionSettings.mode&&this.parent.selectionModule.getSelectedRowCellIndexes().length?this.parent.editModule.startDeleteAction():this.parent.editModule.deleteRecord(this.rowData);break;case"ToTask":if(!t.isNullOrUndefined(this.rowData)){if(a=t.extend({},{},this.rowData.taskData,!0),r=this.parent.taskFields,t.isNullOrUndefined(r.duration)){a[r.startDate]=new Date(this.rowData.taskData[r.startDate]);var c=new Date(this.rowData.taskData[r.startDate]);c.setDate(c.getDate()+1),a[r.endDate]=c}else{var g=parseInt(a[r.duration],10)<=0?1:a[r.duration];a[r.duration]=g,this.parent.setRecordValue("duration",g,this.rowData.ganttProperties,!0)}t.isNullOrUndefined(a[r.milestone])||!0===a[r.milestone]&&(a[r.milestone]=!1);var f=t.isNullOrUndefined(this.rowData.ganttProperties.taskType)?this.parent.taskType:this.rowData.ganttProperties.taskType;"FixedWork"!==f&&"FixedUnit"!==f||(this.parent.dataOperation.updateWorkWithDuration(this.rowData),t.isNullOrUndefined(a[r.work])||(a[r.work]=this.rowData.ganttProperties.work)),a[r.startDate]&&this.parent.setRecordValue(r.startDate,this.rowData.ganttProperties.startDate,a,!0),this.parent.updateRecordByID(a)}break;case"Cancel":this.parent.cancelEdit();break;case"Save":this.parent.editModule.cellEditModule.isCellEdit=!1,this.parent.treeGrid.grid.saveCell();break;case"Dependency"+s:this.isCntxtMenuDependencyDelete=!0,this.parent.connectorLineEditModule.removePredecessorByIndex(this.rowData,s);break;case"Auto":case"Manual":this.parent.changeTaskMode(this.rowData);break;case"Indent":this.parent.indent();break;case"Outdent":this.parent.outdent();break;case"Left":case"Right":this.mergeCall(this.item);break;case"SplitTask":this.splitTaskCall(e)}},e.prototype.splitTaskCall=function(e){var i=this;this.isEdit=!0;var a=this.parent.taskFields,r=this.getClickedDate(e.element);t.isNullOrUndefined(this.parent.timelineSettings.bottomTier)&&"Hour"!==this.parent.timelineSettings.bottomTier.unit&&r.setHours(0,0,0,0);var n={rowData:this.rowData,requestType:"splitTaskbar",splitDate:r,cancel:!1,target:this.targetElement};this.parent.trigger("actionBegin",n,function(e){e.cancel||(i.parent.showLoadingIndicator(),i.parent.chartRowsModule.splitTask(i.rowData[a.id],r),i.parent.chartRowsModule.updateSegment(i.rowData.ganttProperties.segments,i.rowData.ganttProperties.taskId))})},e.prototype.mergeCall=function(e){var i=this;this.isEdit=!0;var a=this.parent.taskFields,r=this.rowData.ganttProperties.segments,n=[{firstSegmentIndex:"Right"===e?this.segmentIndex:r[this.segmentIndex-1].segmentIndex,secondSegmentIndex:"Left"===e?this.segmentIndex:r[this.segmentIndex+1].segmentIndex}],s={rowData:this.rowData,mergeSegmentIndexes:n,requestType:"mergeSegment",cancel:!1,target:this.targetElement};this.parent.trigger("actionBegin",s,function(e){!1===e.cancel&&(t.isNullOrUndefined(i.parent.loadingIndicator)||"Shimmer"!==i.parent.loadingIndicator.indicatorType?i.parent.showSpinner():i.parent.showMaskRow(),i.parent.chartRowsModule.mergeTask(i.rowData[a.id],n))})},e.prototype.getClickedDate=function(e){var i;if(this.parent.enableRtl){var a=this.parent.element.getBoundingClientRect(),r=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,n=document.documentElement.clientLeft||document.body.clientLeft||0;i=a.left+r-n}else i=this.parent.getOffsetRect(this.parent.element).left;var s,o;this.parent.enableRtl?(s=Math.abs(i+this.parent.ganttChartModule.chartElement.offsetWidth-this.rowData.ganttProperties.left-this.parent.ganttChartModule.scrollElement.scrollLeft),o=Math.abs(this.clickedPosition-s)):(s=i+this.parent.ganttChartModule.chartElement.offsetLeft+this.rowData.ganttProperties.left-this.parent.ganttChartModule.scrollElement.scrollLeft,o=this.clickedPosition-s);var l=Math.ceil(o/this.parent.perDayWidth);if(!this.parent.timelineSettings.showWeekend){var d=new Date(this.rowData.ganttProperties.startDate),h=864e5/this.parent.perDayWidth;if(!this.parent.timelineSettings.showWeekend){var p=Math.floor(o*h/864e5),u=7-this.parent.nonWorkingDayIndex.length,c=Math.floor(p/u),g=p%u;d.setDate(d.getDate()+7*c);for(var f=0;f<g;)d.setDate(d.getDate()+1),-1===this.parent.nonWorkingDayIndex.indexOf(d.getDay())&&f++;var m=d;l+=this.parent.timelineModule.calculateNonWorkingDaysBetweenDates(new Date(this.rowData.ganttProperties.startDate),m)}}var y=this.rowData.ganttProperties.startDate;t.isNullOrUndefined(this.parent.timelineSettings.bottomTier)||"Hour"!==this.parent.timelineSettings.bottomTier.unit||(l=Math.ceil(o/this.parent.timelineSettings.timelineUnitSize),l-=1);var D;return t.isNullOrUndefined(this.parent.timelineSettings.bottomTier)||"Minutes"!==this.parent.timelineSettings.bottomTier.unit&&"Hour"!==this.parent.timelineSettings.bottomTier.unit?D=this.parent.dataOperation.getEndDate(y,l,this.rowData.ganttProperties.duration>1?this.rowData.ganttProperties.durationUnit:"None"!==this.parent.timelineSettings.bottomTier.unit?this.parent.timelineSettings.bottomTier.unit.toLocaleLowerCase():this.parent.timelineSettings.topTier.unit.toLocaleLowerCase(),this.rowData,!1):(l=Math.ceil(o/this.parent.timelineSettings.timelineUnitSize),l-=1,D=this.parent.dataOperation.getEndDate(y,l,this.parent.timelineSettings.bottomTier.unit.toLocaleLowerCase(),this.rowData,!1)),D},e.prototype.contextMenuBeforeOpen=function(e){var i=this,r=e.event?e.event.target:this.parent.focusModule?this.parent.ganttChartModule.targetElement:this.parent.focusModule.getActiveElement();!t.isNullOrUndefined(this.parent.editModule)&&this.parent.editModule.cellEditModule&&this.parent.editModule.cellEditModule.isCellEdit&&(r.parentElement.classList.contains("e-row")||r.parentElement.classList.contains("e-treecolumn-container"))&&this.parent.treeGrid.endEdit(),t.isNullOrUndefined(e.element)||e.element.id!==this.parent.element.id+"_contextmenu"||(this.clickedPosition=t.getValue("event",e).clientX);var n=t.closest(r,".e-gantt-child-taskbar");n&&(this.targetElement=e.target=n),e.gridRow=t.closest(r,".e-row"),e.chartRow=t.closest(r,".e-chart-row");var s=t.closest(r,".e-gantt");if(!t.closest(r,".e-gridform")&&this.parent.editModule&&this.parent.editModule.cellEditModule&&this.parent.editModule.cellEditModule.isCellEdit&&this.parent.editModule.dialogModule.dialogObj&&!this.parent.editModule.dialogModule.dialogObj.open&&(this.parent.treeGrid.grid.saveCell(),this.parent.editModule.cellEditModule.isCellEdit=!1),this.parent.readOnly&&this.contextMenu.enableItems(["Add","Save","Convert","Delete Dependency","Delete Task","TaskMode","Indent","Outdent","SplitTask","MergeTask"],!1),(t.isNullOrUndefined(e.gridRow)&&t.isNullOrUndefined(e.chartRow)||0===this.contentMenuItems.length)&&((t.isNullOrUndefined(e.parentItem)||t.isNullOrUndefined(s))&&t.isNullOrUndefined(t.closest(r,".e-content"))?e.cancel=!0:e.cancel=!1),!e.cancel){var o=-1;e.gridRow?o=parseInt(e.gridRow.getAttribute("aria-rowindex"),0)-1:e.chartRow&&(o=parseInt(e.chartRow.getAttribute("aria-rowindex"),0)-1),this.parent.selectionModule&&this.parent.allowSelection&&!e.parentItem&&!t.isNullOrUndefined(e.chartRow)&&this.parent.selectionModule.selectRow(o),e.parentItem||(this.rowData=this.parent.ganttChartModule.getRecordByTarget(e.event));for(var l=0,d=e.items;l<d.length;l++){var h=d[l];h.separator||(!r.classList.contains("e-gantt-unscheduled-taskbar")||h.text!==this.getLocale("splitTask")&&h.text!==this.getLocale("mergeTask")?this.updateItemStatus(h,r,o):this.hideItems.push(h.text))}if(e.rowData=this.rowData,e.type="Content",e.disableItems=this.disableItems,e.hideItems=this.hideItems,e.hideChildItems=[],!t.isNullOrUndefined(e.rowData)&&0===e.rowData.level&&"ResourceView"===this.parent.viewType)return void(e.cancel=!0);var p=new a.Deferred;return this.parent.trigger("contextMenuOpen",e,function(t){p.resolve(t),i.hideItems=t.hideItems,i.disableItems=t.disableItems,t.parentItem||t.hideItems.length!==t.items.length||(i.revertItemStatus(),t.cancel=!0),i.hideItems.length>0&&i.contextMenu.hideItems(i.hideItems),i.disableItems.length>0&&i.contextMenu.enableItems(i.disableItems,!1),e.hideChildItems.length>0&&i.contextMenu.hideItems(e.hideChildItems)}),p}},e.prototype.updateItemStatus=function(e,i,a){var r=this.getKeyFromId(e.id),n=t.closest(i,".e-gridform"),s=[],o=t.closest(i,".e-gantt-child-taskbar")||t.closest(i,"e-taskbar-right-resizer")||t.closest(i,"e-taskbar-left-resizer");if(n)"Save"!==r&&"Cancel"!==r&&this.hideItems.push(e.text);else switch(r){case"TaskInformation":this.parent.editSettings.allowEditing&&this.parent.editModule||this.updateItemVisibility(e.text),0===this.parent.flatData.length&&this.hideItems.push(e.text);break;case"Add":this.parent.editSettings.allowAdding&&this.parent.editModule||this.updateItemVisibility(e.text);break;case"Save":case"Cancel":this.hideItems.push(e.text);break;case"Convert":!t.isNullOrUndefined(this.rowData)&&this.rowData.hasChildRecords?this.hideItems.push(e.text):this.parent.editSettings.allowEditing&&this.parent.editModule?(t.isNullOrUndefined(this.rowData)||this.rowData.ganttProperties.isMilestone?s.push(this.createItemModel(Z,"ToTask",this.getLocale("toTask"))):s.push(this.createItemModel(Z,"ToMilestone",this.getLocale("toMilestone"))),e.items=s):this.updateItemVisibility(e.text),0===this.parent.flatData.length&&this.hideItems.push(e.text);break;case"DeleteDependency":var l=this.getPredecessorsItems();t.isNullOrUndefined(this.rowData)||!this.rowData.hasChildRecords||this.parent.allowParentDependency?this.parent.editSettings.allowDeleting&&0!==l.length&&this.parent.editModule?l.length>0&&(e.items=l):this.updateItemVisibility(e.text):this.hideItems.push(e.text);break;case"DeleteTask":this.parent.editSettings.allowDeleting&&this.parent.editModule||this.updateItemVisibility(e.text),0===this.parent.flatData.length&&this.hideItems.push(e.text);break;case"TaskMode":"Custom"!==this.parent.taskMode?this.updateItemVisibility(e.text):(this.rowData.ganttProperties.isAutoSchedule?s.push(this.createItemModel(Z,"Manual",this.getLocale("manual"))):s.push(this.createItemModel(Z,"Auto",this.getLocale("auto"))),e.items=s);break;case"Indent":if(this.parent.allowSelection&&this.parent.editModule&&this.parent.editSettings){var d=this.parent.selectedRowIndex,h=!!this.parent.selectionModule&&(1===this.parent.selectionModule.selectedRowIndexes.length||1===this.parent.selectionModule.getSelectedRowCellIndexes().length),p=this.parent.updatedRecords[this.parent.selectionModule.getSelectedRowIndexes()[0]-1];this.parent.editSettings.allowEditing&&0!==d&&-1!==d&&h&&"ResourceView"!==this.parent.viewType&&this.parent.updatedRecords[parseInt(d.toString(),10)].level-p.level!=1||this.updateItemVisibility(e.text)}else this.hideItems.push(e.text);break;case"Outdent":if(this.parent.allowSelection&&this.parent.editModule&&this.parent.editSettings){var u=this.parent.selectionModule.getSelectedRowIndexes()[0],c=!!this.parent.selectionModule&&(1===this.parent.selectionModule.selectedRowIndexes.length||1===this.parent.selectionModule.getSelectedRowCellIndexes().length);this.parent.editSettings.allowEditing&&-1!==u&&0!==u&&c&&"ResourceView"!==this.parent.viewType&&0!==this.parent.updatedRecords[parseInt(u.toString(),10)].level||this.updateItemVisibility(e.text)}else this.hideItems.push(e.text);break;case"SplitTask":var g=!1,f=!1,m=this.parent.taskFields;t.isNullOrUndefined(this.parent.timelineSettings.bottomTier)||(g="Minutes"===this.parent.timelineSettings.bottomTier.unit,f="Hour"===this.parent.timelineSettings.bottomTier.unit),(this.parent.readOnly||!o||t.isNullOrUndefined(m.segments)||this.parent.updatedRecords[Number(a)].hasChildRecords||this.parent.updatedRecords[Number(a)].ganttProperties.duration<2&&!g&&!f)&&this.updateItemVisibility(e.text);break;case"MergeTask":this.parent.readOnly||!o?this.updateItemVisibility(e.text):this.mergeItemVisiblity(i,e)}},e.prototype.mergeItemVisiblity=function(e,i){var a=[],r=this.parent.taskFields,n=this.getClickedDate(e);this.segmentIndex=this.parent.chartRowsModule.getSegmentIndex(n,this.rowData);var s=this.rowData.ganttProperties.segments;!t.isNullOrUndefined(s)&&s.length>0?t.isNullOrUndefined(r.segments)&&-1===this.segmentIndex?this.updateItemVisibility(i.text):(0===this.segmentIndex?a.push(this.createItemModel(Z,"Right",this.getLocale("right"))):this.segmentIndex===s.length-1?a.push(this.createItemModel(Z,"Left",this.getLocale("left"))):(a.push(this.createItemModel(Z,"Right",this.getLocale("right"))),a.push(this.createItemModel(Z,"Left",this.getLocale("left")))),i.items=a):this.hideItems.push(i.text)},e.prototype.updateItemVisibility=function(e){!!t.isNullOrUndefined(this.parent.contextMenuItems)?this.hideItems.push(e):this.disableItems.push(e)},e.prototype.contextMenuOpen=function(e){this.isOpen=!0;var i=this.parent.args=e.element.querySelectorAll("li:not(.e-menu-hide):not(.e-disabled)")[0];t.isNullOrUndefined(i)||t.addClass([i],"e-focused")},e.prototype.getMenuItems=function(){for(var e=0,i=t.isNullOrUndefined(this.parent.contextMenuItems)?this.getDefaultItems():this.parent.contextMenuItems;e<i.length;e++){var a=i[e];"string"==typeof a&&-1!==this.getDefaultItems().indexOf(a)?this.buildDefaultItems(a):"string"!=typeof a&&(-1!==this.getDefaultItems().indexOf(a.text)?this.buildDefaultItems(a.text,a.iconCss):".e-gridheader"===a.target?this.headerMenuItems.push(a):this.contentMenuItems.push(a))}return this.contentMenuItems},e.prototype.createItemModel=function(e,t,i,a){return{text:i,id:this.generateID(t),target:e,iconCss:a?"e-icons "+a:null}},e.prototype.getLocale=function(e){return this.parent.localeObj.getConstant(e)},e.prototype.buildDefaultItems=function(e,t){var i;switch(e){case"AutoFitAll":case"AutoFit":case"SortAscending":case"SortDescending":this.headerMenuItems.push(e);break;case"TaskInformation":i=this.createItemModel(Z,e,this.getLocale("taskInformation"),this.getIconCSS("e-edit",t));break;case"Indent":i=this.createItemModel(Z,e,this.getLocale("indent"),this.getIconCSS("e-indent",t));break;case"Outdent":i=this.createItemModel(Z,e,this.getLocale("outdent"),this.getIconCSS("e-outdent",t));break;case"Save":i=this.createItemModel("e-edit",e,this.getLocale("save"),this.getIconCSS("e-save",t));break;case"Cancel":i=this.createItemModel("e-edit",e,this.getLocale("cancel"),this.getIconCSS("e-cancel",t));break;case"Add":(i=this.createItemModel(Z,e,this.getLocale("add"),this.getIconCSS("e-add",t))).items=[],i.items.push(this.createItemModel(Z,"Above",this.getLocale("above"),this.getIconCSS("e-add-above",t))),i.items.push(this.createItemModel(Z,"Below",this.getLocale("below"),this.getIconCSS("e-add-below",t))),"ResourceView"!==this.parent.viewType&&i.items.push(this.createItemModel(Z,"Child",this.getLocale("child"))),i.items.push(this.createItemModel(Z,"Milestone",this.getLocale("milestone")));break;case"DeleteTask":i=this.createItemModel(Z,e,this.getLocale("deleteTask"),this.getIconCSS("e-delete",t));break;case"DeleteDependency":(i=this.createItemModel(Z,e,this.getLocale("deleteDependency"))).items=[],i.items.push({});break;case"Convert":(i=this.createItemModel(Z,e,this.getLocale("convert"))).items=[],i.items.push({});break;case"TaskMode":(i=this.createItemModel(Z,e,this.getLocale("changeScheduleMode"))).items=[],i.items.push({});break;case"SplitTask":i=this.createItemModel(Z,e,this.getLocale("splitTask"));break;case"MergeTask":(i=this.createItemModel(Z,e,this.getLocale("mergeTask"))).items=[],i.items.push({})}i&&this.contentMenuItems.push(i)},e.prototype.getIconCSS=function(e,i){return t.isNullOrUndefined(i)?e:i},e.prototype.getPredecessorsItems=function(){this.predecessors=this.parent.predecessorModule.getValidPredecessor(this.rowData);for(var e,t=[],i=0,a=0,r=this.predecessors;a<r.length;a++){var n=r[a],s=this.parent.connectorLineModule.getRecordByID(n.from).ganttProperties,o=s.rowUniqueID+" - "+s.taskName,l="Dependency"+i++;e=this.createItemModel(Z,l,o),t.push(e)}return t},e.prototype.getDefaultItems=function(){return["AutoFitAll","AutoFit","TaskInformation","DeleteTask","Save","Cancel","SortAscending","SortDescending","Add","DeleteDependency","Convert","TaskMode","Indent","Outdent","SplitTask","MergeTask"]},e.prototype.getModuleName=function(){return"contextMenu"},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("initiate-contextMenu",this.render),this.parent.off("reRender-contextMenu",this.reRenderContextMenu),this.parent.off("contextMenuClick",this.contextMenuItemClick),this.parent.off("contextMenuOpen",this.contextMenuOpen))},e.prototype.contextMenuOnClose=function(e){e.items.length>0&&e.items[0].parentObj instanceof d.ContextMenu&&this.revertItemStatus()},e.prototype.revertItemStatus=function(){this.contextMenu.showItems(this.hideItems),this.contextMenu.enableItems(this.disableItems),this.hideItems=[],this.disableItems=[],this.isOpen=!1},e.prototype.resetItems=function(){this.hideItems=[],this.disableItems=[],this.headerMenuItems=[],this.contentMenuItems=[],this.item=null},e.prototype.generateID=function(e){return this.ganttID+"_contextMenu_"+e},e.prototype.getKeyFromId=function(e){var t=this.ganttID+"_contextMenu_";return e.indexOf(t)>-1?e.replace(t,""):"Custom"},e.prototype.destroy=function(){this.contextMenu.destroy(),t.remove(this.element),this.removeEventListener(),this.contextMenu=null,this.element=null},e}(),At=function(){function e(e){this.parent=e,n.TreeGrid.Inject(n.ExcelExport),this.parent.treeGrid.allowExcelExport=this.parent.allowExcelExport,this.bindEvents()}return e.prototype.getModuleName=function(){return"excelExport"},e.prototype.destroy=function(){},e.prototype.bindEvents=function(){var e=this;this.parent.treeGrid.beforeExcelExport=function(i){e.parent.trigger("beforeExcelExport",i),t.isNullOrUndefined(e.parent.loadingIndicator)||"Shimmer"!==e.parent.loadingIndicator.indicatorType?e.parent.showSpinner():e.parent.showMaskRow()},this.parent.treeGrid.excelQueryCellInfo=function(t){e.parent.trigger("excelQueryCellInfo",t)},this.parent.treeGrid.excelHeaderQueryCellInfo=function(t){e.parent.trigger("excelHeaderQueryCellInfo",t)},this.parent.treeGrid.excelExportComplete=function(i){e.parent.trigger("excelExportComplete",i),t.isNullOrUndefined(e.parent.loadingIndicator)||"Shimmer"!==e.parent.loadingIndicator.indicatorType?e.parent.hideSpinner():e.parent.hideMaskRow()}},e}(),Wt=function(){function e(e){n.TreeGrid.Inject(n.ColumnMenu),this.parent=e}return e.prototype.getColumnMenu=function(){return this.parent.treeGrid.columnMenuModule.getColumnMenu()},e.prototype.destroy=function(){},e.prototype.getModuleName=function(){return"columnMenu"},e}(),Ht=function(){function e(e){this.isTest=!1,this.updateParentRecords=[],this.isaddtoBottom=!1,this.updateCollection={},this.isSharedTask=!1,this.canDrop=!0,this.parent=e,n.TreeGrid.Inject(n.RowDD),this.parent.treeGrid.allowRowDragAndDrop=this.parent.allowRowDragAndDrop,this.bindEvents()}return e.prototype.getModuleName=function(){return"rowDragAndDrop"},e.prototype.destroy=function(){},e.prototype.bindEvents=function(){this.parent.treeGrid.rowDragStart=this.rowDragStart.bind(this),this.parent.treeGrid.rowDragStartHelper=this.rowDragStartHelper.bind(this),this.parent.treeGrid.rowDrag=this.rowDrag.bind(this),this.parent.treeGrid.rowDrop=this.rowDrop.bind(this)},e.prototype.rowDragStart=function(e){this.parent.trigger("rowDragStart",e),this.parent.element.style.position="relative"},e.prototype.addErrorElem=function(){var e=document.querySelector(".e-ganttdrag");if(e&&!!!e.querySelector(".e-errorelem")){var t=document.createElement("div");t.classList.add("e-errorcontainer","e-icons","e-errorelem");var i=e.querySelector(".e-rowcell");if(i){var a=i.childNodes,r=i.querySelector(".errorValue");r&&(a=r.childNodes,r.remove()),i.innerHTML="";var n=document.createElement("span");n.className="errorValue",n.style.paddingLeft="16px",a.forEach(function(e){n.appendChild(e.cloneNode(!0))}),i.appendChild(t),i.appendChild(n)}}},e.prototype.removeErrorElem=function(){var e=document.querySelector(".e-errorelem");e&&e.remove()},e.prototype.rowDrag=function(e){var i=this.parent.element.querySelector(".e-cloneproperties");i.style.display="none";var a=i.cloneNode(!0);a.classList.add("e-ganttdrag"),a.style.display="",this.parent.element.querySelectorAll(".e-cloneproperties").length<=1?this.parent.element.appendChild(a):document.getElementsByClassName("e-cloneproperties")[0].querySelectorAll(".e-errorelem").length?this.addErrorElem():this.removeErrorElem(),"Both"===this.parent.gridLines&&t.addClass(this.parent.element.querySelectorAll(".e-ganttdrag .e-rowcell"),["e-bothganttlines"]);var r,n,s=this.parent.element.querySelector(".e-ganttdrag"),o=this.parent.element.getClientRects()[0].top,l=this.parent.element.getClientRects()[0].left;this.parent.isAdaptive?(r=e.originalEvent.event.touches[0].clientX-l,n=e.originalEvent.event.touches[0].clientY-o):(r=t.getValue("event",e.originalEvent).clientX-l,n=t.getValue("event",e.originalEvent).clientY-o),s.style.left=r+20+"px",s.style.top=n+20+"px",this.parent.trigger("rowDrag",e)},e.prototype.rowDragStartHelper=function(e){this.parent.trigger("rowDragStartHelper",e),this.parent.readOnly&&(e.cancel=!0)},e.prototype.rowDrop=function(e){if(this.parent.isAdaptive){var i=document.querySelector(".e-ganttdrag");i&&i.remove()}var a=t.closest(e.target,".e-row");this.parent.oldRecords=t.extend([],[],e.data,!0);var r=a?parseInt(a.getAttribute("aria-rowindex"),10)-1:e.dropIndex;e.dropIndex=r,e.dropRecord=this.parent.updatedRecords[e.dropIndex],this.parent.trigger("rowDrop",e),"ResourceView"!==this.parent.viewType||this.validPosition(e,e.dropRecord)||(e.cancel=!0),e.cancel||(e.requestType="beforeDrop",this.parent.trigger("actionBegin",e),e.cancel?this.parent.hideLoadingIndicator():(this.parent.showLoadingIndicator(),this.dropRows(e,!0),e.cancel=!0))},e.prototype.validPosition=function(e,i){var a=i.level,r=t.getValue("level",e.data[0]),n=e.data[0];return this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&(n=this.parent.currentViewData[this.parent.undoRedoModule.getResourceViewRowIndex(n)]),!("middleSegment"===e.dropPosition&&(1===a||0===r)||"middleSegment"!==e.dropPosition&&(0===r&&1===a||1===r&&0===a)||t.getValue("parentItem",n)&&i.uniqueID===t.getValue("parentItem",n).uniqueID)},e.prototype.dropRows=function(e,i){if(!this.parent.readOnly){if(this.dropPosition=e.dropPosition,"Invalid"!==e.dropPosition&&this.parent.editModule){var a=this.parent;if(this.droppedRecord=a.updatedRecords[e.dropIndex],"ResourceView"===this.parent.viewType&&!this.validPosition(e,this.droppedRecord))return void(this.droppedRecord=null);if(this.parent.undoRedoModule&&this.parent.isUndoRedoItemPresent("RowDragAndDrop")){if(!this.parent.undoRedoModule.isUndoRedoPerformed){this.parent.undoRedoModule.redoEnabled&&(this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection()),!e.target&&this.parent.editModule&&this.parent.editModule.taskbarEditModule&&this.parent.editModule.taskbarEditModule.taskBarEditAction?this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=[]:this.parent.undoRedoModule.createUndoCollection();for(var r=[],n=this,s=0;s<e.data.length;s++)!function(t){r.push(n.parent.flatData.filter(function(i){return e.data[t].ganttProperties.taskId===i.ganttProperties.taskId})[0])}(s);var o=t.extend([],[],r,!0),l={};e.name?l.action="RowDragAndDrop":l.action="TaskbarDragAndDrop",l.beforeDrop=[];var d={};d.dropRecord=t.extend([],[],[e.dropRecord?e.dropRecord:this.droppedRecord],!0)[0],d.data=t.extend([],[],e.data,!0),"middleSegment"===e.dropPosition?d.dropPosition="child":"topSegment"===e.dropPosition?d.dropPosition="above":"bottomSegment"===e.dropPosition&&(d.dropPosition="below"),l.afterDrop=d,this.parent.undoRedoModule.findPosition(o,l,"beforeDrop"),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=l}this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!0)}var h=void 0,p=[],u=this.droppedRecord;e.data[0]?p=e.data:p.push(e.data);for(var c=0,g=p.length,f=this,s=0;s<g;s++){var m=function(e){if(f.parent.isOnEdit=!0,h=p[e],f.draggedRecord=h,"Invalid"!==f.dropPosition){if("ResourceView"===f.parent.viewType&&(f.checkisSharedTask(),0!==f.draggedRecord.level&&(f.previousParent=f.draggedRecord.parentItem.uniqueID)),f.isSharedTask)return{value:void 0};i&&f.deleteDragRow();var r=f.treeGridData.indexOf(u);if("topSegment"===f.dropPosition&&f.dropAtTop(r),"bottomSegment"===f.dropPosition&&!f.isSharedTask){if(u.hasChildRecords){if(c=f.parent.editModule.getChildCount(u,0),f.parent.taskFields.parentID&&f.ganttData.length>0&&f.ganttData.splice(r+c+1,0,f.draggedRecord.taskData),f.treeGridData.splice(r+c+1,0,f.draggedRecord),f.parent.ids.splice(r+c+1,0,f.draggedRecord.ganttProperties.rowUniqueID.toString()),"ResourceView"===f.parent.viewType){var n=0===f.draggedRecord.level?"R"+f.draggedRecord.ganttProperties.taskId:"T"+f.draggedRecord.ganttProperties.taskId;f.parent.getTaskIds().splice(r+c+1,0,n)}}else if(f.parent.taskFields.parentID&&f.ganttData.length>0&&f.ganttData.splice(r+1,0,f.draggedRecord.taskData),f.treeGridData.splice(r+1,0,f.draggedRecord),f.parent.ids.splice(r+1,0,f.draggedRecord.ganttProperties.rowUniqueID.toString()),"ResourceView"===f.parent.viewType){var s=0===f.draggedRecord.level?"R"+f.draggedRecord.ganttProperties.taskId:"T"+f.draggedRecord.ganttProperties.taskId;f.parent.getTaskIds().splice(r+1,0,s)}if(f.parent.setRecordValue("parentItem",f.treeGridData[r].parentItem,h),f.parent.setRecordValue("parentUniqueID",f.treeGridData[r].parentUniqueID,h),f.parent.setRecordValue("level",f.treeGridData[r].level,h),h.hasChildRecords){f.updateChildRecordLevel(h,1),f.updateChildRecord(h,r+c+1)}if(u.parentItem){var o=f.parent.getParentTask(u.parentItem).childRecords,l=o.indexOf(u)+1;o.splice(l,0,h)}}if("middleSegment"===f.dropPosition&&(f.dropMiddle(r),u.childRecords.length>0&&(delete u.ganttProperties.segments,delete u.taskData[f.parent.taskFields.segments])),0!==f.treeGridData.length){for(var d=0;d<f.treeGridData.length;d++)if(f.treeGridData[parseInt(d.toString(),10)].index=d,!t.isNullOrUndefined(f.treeGridData[parseInt(d.toString(),10)].parentItem)){var g=t.getValue("uniqueIDCollection."+f.treeGridData[parseInt(d.toString(),10)].parentUniqueID,f.parent.treeGrid);f.treeGridData[parseInt(d.toString(),10)].parentItem.index=g.index}f.parent.undoRedoModule&&(f.parent.undoRedoModule.canUpdateIndex=!1)}t.isNullOrUndefined(h.parentItem&&-1!==f.updateParentRecords.indexOf(h.parentItem))||f.updateParentRecords.push(h.parentItem)}if(!f.parent.enableVirtualization){var m=a.flatData,y=void 0,D=void 0,v=f.parent.dataSource,k=f.parent.taskFields.id;if(h.index<u.index){y=h.index;for(var b=0;b<v.length&&"break"!==function(e){var t=f.parent.currentViewData.filter(function(t){return t[k]===v[e][k]})[0];if(t&&t.index>u.index)return D=t.index,"break"}(b);b++);}else{y=u.index;for(var w=0;w<v.length&&"break"!==function(e){var t=f.parent.currentViewData.filter(function(t){return t[k]===v[e][k]})[0];if(t&&t.index>h.index)return D=t.index,"break"}(w);w++);}for(var T=y;T<=D;T++)!function(e){if(!t.isNullOrUndefined(m[e])&&(m[e].index=e,!t.isNullOrUndefined(m[e].parentItem))){var i=m.filter(function(t){return t.uniqueID===m[e].parentUniqueID})[0];m[e].parentItem.index=i.index}}(T)}a.rowDragAndDropModule.refreshDataSource()}(s);if("object"==typeof m)return m.value}if("middleSegment"===this.dropPosition){if(u.ganttProperties.predecessor)for(var y=u.ganttProperties.predecessor.length,D=0;D<y;D++)if(u.ganttProperties.predecessor&&u.ganttProperties.predecessor[D]){var v=this.parent.getRecordByID(u.ganttProperties.predecessor[D].from),k=this.parent.getRecordByID(u.ganttProperties.predecessor[D].to),b=this.parent.predecessorModule.validateParentPredecessor(v,k);if(u.ganttProperties.predecessor&&(!b||!this.parent.allowParentDependency)&&(this.parent.editModule.removePredecessorOnDelete(u),u.ganttProperties.predecessor.splice(0,1),u.ganttProperties.predecessorsName)){for(var w=u.ganttProperties.predecessorsName.split(","),s=0;s<w.length;s++)-1!==w[s].indexOf(h.ganttProperties.taskId+"")&&w.splice(s,1);var T=w.join();u.ganttProperties.predecessorsName=T,u[this.parent.taskFields.dependency]=T,u.taskData[this.parent.taskFields.dependency]=T}}u.ganttProperties.isMilestone&&(this.parent.setRecordValue("isMilestone",!1,u.ganttProperties,!0),t.isNullOrUndefined(u.taskData[this.parent.taskFields.milestone])||!0===u.taskData[this.parent.taskFields.milestone]&&(u.taskData[this.parent.taskFields.milestone]=!1))}if("ResourceView"===this.parent.viewType&&!this.isSharedTask){var S=void 0;S="middleSegment"===this.dropPosition?this.droppedRecord.uniqueID:this.droppedRecord.parentItem?this.droppedRecord.parentItem.uniqueID:this.droppedRecord.uniqueID;var P=this.parent.getTaskByUniqueID(S),C={};C[this.parent.taskFields.resourceInfo]=[],C[this.parent.taskFields.resourceInfo].push(P.ganttProperties.taskId),this.removeExistingResources();var R=this.parent.dataOperation.setResourceInfo(C),M=this.draggedRecord;t.isNullOrUndefined(M.ganttProperties.resourceInfo)&&(M.ganttProperties.resourceInfo=[]),"Unassigned Task"===P.ganttProperties.taskName?(M.ganttProperties.resourceInfo=[],M.ganttProperties.sharedTaskUniqueIds=[M.ganttProperties.rowUniqueID]):M.ganttProperties.resourceInfo.push(R[0]),this.updateCurrentTask(M),"Unassigned Task"===P.ganttProperties.taskName?this.deleteSharedResourceTask():this.updateSharedResourceTask()}if(this.parent.taskFields.dependency&&this.parent.allowParentDependency){var x,O=!0,I=void 0;I=h.parentItem?this.parent.flatData[this.parent.ids.indexOf(h.parentItem.taskId)]:h;var E=void 0;if((x=u.parentItem?this.parent.flatData[this.parent.ids.indexOf(u.parentItem.taskId)]:u).uniqueID===I.uniqueID||I.parentItem&&x.uniqueID===this.parent.flatData[this.parent.ids.indexOf(I.parentItem.taskId)].uniqueID){E=this.parent.currentViewData.filter(function(e){if(e.ganttProperties.predecessor&&e.ganttProperties.predecessor.length>0)for(var t=0;t<e.ganttProperties.predecessor.length;t++)return parseInt(e.ganttProperties.predecessor[t].to,10)===parseInt(x.ganttProperties.taskId,10)||parseInt(e.ganttProperties.predecessor[t].from,10)===parseInt(x.ganttProperties.taskId,10);return null});for(var F=[],s=0;s<E.length;s++){if(F=[],E[s].ganttProperties.predecessor)for(var U=0;U<E[s].ganttProperties.predecessor.length;U++)parseInt(E[s].ganttProperties.taskId,10)!==parseInt(E[s].ganttProperties.predecessor[U].from,10)?F.push(E[s].ganttProperties.predecessor[U].from):F.push(E[s].ganttProperties.predecessor[U].to);for(var N=this,L=0;L<F.length;L++)!function(e){var t=F[e].replace(/\D/g,""),i=N.parent.currentViewData.filter(function(e){return parseInt(e.ganttProperties.taskId,10)===parseInt(t,10)});(O=N.parent.predecessorModule.validateParentPredecessor(E[s],i[0]))||(N.parent.dataOperation.resetDependency(E[s]),N.parent.dataOperation.resetDependency(i[0]))}(L)}}}for(L=0;L<this.updateParentRecords.length;L++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[L]);if("ProjectView"===this.parent.viewType&&this.parent.editModule&&this.parent.editModule.taskbarEditModule&&this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.predecessorModule&&"TaskbarDragAndDrop"===this.parent.undoRedoModule.currentAction.action&&"child"!==this.parent.undoRedoModule.currentAction.beforeDrop[0].position){var V=this.parent.flatData[this.parent.ids.indexOf(this.parent.undoRedoModule.currentAction.afterDrop.dropRecord.ganttProperties.taskId.toString())];this.parent.editModule.taskbarEditModule.taskBarEditRecord=V,this.parent.editModule.taskbarEditModule.taskBarEditAction="ChildDrag",this.parent.predecessorModule.validatePredecessor(V,[],""),this.parent.editModule.taskbarEditModule.taskBarEditAction=null}this.updateParentRecords=[],this.parent.isOnEdit=!1}t.isNullOrUndefined(this.parent.editModule)||this.parent.editModule.refreshRecord(e,!0),(!this.parent.undoRedoModule||this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed)&&(this.parent.previousFlatData=t.extend([],[],this.parent.flatData,!0))}this.parent.oldRecords=[]},e.prototype.updateCurrentTask=function(e){this.parent.dataOperation.updateMappingData(e,"resourceInfo"),this.parent.editModule.updateResourceRelatedFields(e,"resource"),this.parent.editModule.dialogModule.dialogEditValidationFlag=!1,this.parent.editModule.dialogModule.validateDuration(e),this.parent.dataOperation.updateWidthLeft(e),this.parent.dataOperation.updateTaskData(e)},e.prototype.deleteSharedResourceTask=function(){for(var e=0;e<this.parent.getTaskIds().length;e++)this.parent.getTaskIds()[e]==="T"+this.draggedRecord.ganttProperties.taskId&&("Unassigned Task"!==this.parent.getTaskByUniqueID(this.parent.flatData[e].parentItem.uniqueID).ganttProperties.taskName&&this.removeRecords(this.parent.flatData[e]),t.isNullOrUndefined(this.parent.flatData[parseInt(e.toString(),10)].parentItem&&-1!==this.updateParentRecords.indexOf(this.parent.flatData[parseInt(e.toString(),10)].parentItem))||this.updateParentRecords.push(this.parent.flatData[e].parentItem))},e.prototype.removeExistingResources=function(){var e=this.parent.getTaskByUniqueID(this.previousParent);if(this.draggedRecord.ganttProperties.resourceInfo&&e)for(var t=0;t<this.draggedRecord.ganttProperties.resourceInfo.length;t++)if(this.draggedRecord.ganttProperties.resourceInfo[parseInt(t.toString(),10)][this.parent.resourceFields.id]===e.ganttProperties.taskId){this.draggedRecord.ganttProperties.resourceInfo.splice(t,1);break}},e.prototype.updateSharedResourceTask=function(){for(var e=0;e<this.parent.getTaskIds().length;e++)this.parent.getTaskIds()[e]==="T"+this.draggedRecord.ganttProperties.taskId&&(this.parent.editModule.updateGanttProperties(this.draggedRecord,this.parent.flatData[e]),this.parent.dataOperation.updateTaskData(this.parent.flatData[e]),t.isNullOrUndefined(this.parent.flatData[parseInt(e.toString(),10)].parentItem&&-1!==this.updateParentRecords.indexOf(this.parent.flatData[parseInt(e.toString(),10)].parentItem))||this.updateParentRecords.push(this.parent.flatData[e].parentItem))},e.prototype._getExistingTaskWithID=function(e){for(var t=[],i=0;i<this.parent.getTaskIds().length;i++)this.parent.getTaskIds()[i]==="T"+e.ganttProperties.taskId&&t.push(this.parent.flatData[i]);return t},e.prototype.removeResourceInfo=function(e){var i=this.parent.getTaskByUniqueID(this.draggedRecord.parentItem.uniqueID);if(e.ganttProperties.resourceInfo&&e.ganttProperties.resourceInfo.length>1){var a=this._getExistingTaskWithID(e),r=void 0;if(null===a)return;for(var n=0;n<a.length;n++)for(var s=(r=a[n]).ganttProperties.resourceInfo,o=0;o<s.length;o++)if(s[o][this.parent.resourceFields.id]===i.ganttProperties.taskId){s.splice(o,1),this.parent.setRecordValue("resourceInfo",s,r.ganttProperties,!0),this.updateCurrentTask(r),t.isNullOrUndefined(r.parentItem&&-1!==this.updateParentRecords.indexOf(r.parentItem))||this.updateParentRecords.push(r.parentItem);break}}},e.prototype.refreshDataSource=function(){var e,i,r=this.draggedRecord,n=this.droppedRecord,s=this.parent,o=this.parent.taskFields;if((e=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):s.dataSource).length>0&&!t.isNullOrUndefined(n)&&!n.parentItem){for(var l=0;l<Object.keys(e).length;l++)t.isNullOrUndefined(n.taskData[o.child])||e[l][o.child]!==n.taskData[o.child]?t.isNullOrUndefined(n.taskData[o.child])&&n.taskData[o.id]===e[l][o.id]&&(i=l):i=l;"topSegment"===this.dropPosition?this.parent.taskFields.parentID||e.splice(i,0,r.taskData):"bottomSegment"===this.dropPosition&&(this.parent.taskFields.parentID||e.splice(i+1,0,r.taskData))}else if(!this.parent.taskFields.parentID&&!t.isNullOrUndefined(n)&&n.parentItem&&("topSegment"===this.dropPosition||"bottomSegment"===this.dropPosition)){var d="topSegment"===this.dropPosition?"Above":"Below";this.parent.editModule.addRowSelectedItem=n,this.parent.editModule.updateRealDataSource([r],d),delete this.parent.editModule.addRowSelectedItem}if(this.parent.taskFields.parentID)if(r.parentItem){var h="middleSegment"===this.dropPosition?this.parent.taskFields.id:this.parent.taskFields.parentID;r[this.parent.taskFields.parentID]=n[h],r.ganttProperties.parentId=n[h],("ResourceView"===this.parent.viewType&&"middleSegment"!==this.dropPosition||"ProjectView"===this.parent.viewType)&&(r.taskData[this.parent.taskFields.parentID]=n.taskData[h])}else r[this.parent.taskFields.parentID]=null,r.taskData[this.parent.taskFields.parentID]=null,r.ganttProperties.parentId=null;if(this.parent.editModule&&this.parent.editModule.taskbarEditModule&&this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.predecessorModule&&"TaskbarDragAndDrop"===this.parent.undoRedoModule.currentAction.action){var p=void 0;p="ProjectView"===this.parent.viewType?this.parent.flatData[this.parent.ids.indexOf(this.parent.undoRedoModule.currentAction.afterDrop.data[0].ganttProperties.taskId.toString())]:this.parent.flatData[this.parent.undoRedoModule.getResourceViewRowIndex(this.parent.undoRedoModule.currentAction.afterDrop.data[0])],this.parent.editModule.taskbarEditModule.taskBarEditRecord=p,this.parent.editModule.taskbarEditModule.taskBarEditAction="ChildDrag",this.parent.predecessorModule.validatePredecessor(p,[],""),this.parent.editModule.taskbarEditModule.taskBarEditAction=null}},e.prototype.dropMiddle=function(e){var i=this.parent,a=this.parent.editModule.getChildCount(this.droppedRecord,0),r=t.isNullOrUndefined(a)||0===a?e+1:a+e+1;if("middleSegment"===this.dropPosition&&!this.isSharedTask){if(i.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(r,0,this.draggedRecord.taskData),this.treeGridData.splice(r,0,this.draggedRecord),this.parent.ids.splice(r,0,this.draggedRecord.ganttProperties.rowUniqueID.toString()),"ResourceView"===this.parent.viewType){var n=0===this.draggedRecord.level?"R"+this.draggedRecord.ganttProperties.taskId:"T"+this.draggedRecord.ganttProperties.taskId;this.parent.getTaskIds().splice(r,0,n)}this.draggedRecord.hasChildRecords&&this.updateChildRecord(this.draggedRecord,r,this.droppedRecord.expanded),this.recordLevel(),t.isNullOrUndefined(this.draggedRecord.parentItem&&-1!==this.updateParentRecords.indexOf(this.draggedRecord.parentItem))&&this.updateParentRecords.push(this.draggedRecord.parentItem)}},e.prototype.recordLevel=function(){var e=this.parent,i=this.draggedRecord,a=this.droppedRecord,r=e.taskFields.child;if(a.hasChildRecords||(a.hasChildRecords=!0,a.childRecords.length||(a.childRecords=[],!e.taskFields.parentID&&t.isNullOrUndefined(a.taskData[r])&&(a.taskData[r]=[]))),"middleSegment"===this.dropPosition){var n=t.extend({},a);delete n.childRecords;var s={uniqueID:n.uniqueID,expanded:n.expanded,level:n.level,index:n.index,taskId:n.ganttProperties.rowUniqueID};if(this.parent.setRecordValue("parentItem",s,i),this.parent.setRecordValue("parentUniqueID",a.uniqueID,i),a.childRecords.splice(a.childRecords.length,0,i),t.isNullOrUndefined(i)||e.taskFields.parentID||t.isNullOrUndefined(a.taskData[r])||a.taskData[e.taskFields.child].splice(a.childRecords.length,0,i.taskData),i.hasChildRecords){i.level=a.level+1,this.parent.setRecordValue("level",this.draggedRecord.level,this.draggedRecord),this.updateChildRecordLevel(i,1)}else i.level=a.level+1;this.parent.enableMultiTaskbar||(a.expanded=!0)}},e.prototype.deleteDragRow=function(){this.treeGridData=y(this.parent)?t.getValue("result",this.parent.treeGrid.dataSource):this.parent.treeGrid.dataSource,this.parent.dataSource instanceof a.DataManager?this.ganttData=t.getValue("dataOperation.dataArray",this.parent):this.ganttData=y(this.parent)?t.getValue("result",this.parent.dataSource):this.parent.dataSource;var e;if(this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed)if("ProjectView"===this.parent.viewType)e=this.parent.flatData[this.parent.ids.indexOf(this.draggedRecord.ganttProperties.taskId.toString())];else{var i=this.draggedRecord.hasChildRecords?"R":"T";e=this.parent.flatData[this.parent.taskIds.indexOf(i+this.draggedRecord.ganttProperties.taskId)]}else e=this.parent.getTaskByUniqueID(this.draggedRecord.uniqueID);this.removeRecords(e)},e.prototype.checkisSharedTask=function(){this.isSharedTask=!1;for(var e=null,t=0===this.droppedRecord.level?this.droppedRecord.uniqueID:this.droppedRecord.parentItem.uniqueID,i=this.parent.getTaskByUniqueID(t).childRecords,a=0;a<i.length;a++)this.draggedRecord.hasChildRecords||"T"+this.draggedRecord.ganttProperties.taskId!="T"+i[a].ganttProperties.taskId||(this.isSharedTask=!0,e=i[a]);this.isSharedTask&&this.removeResourceInfo(e)},e.prototype.dropAtTop=function(e){var i=this.parent;if(!this.isSharedTask){if(i.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(e,0,this.draggedRecord.taskData),this.treeGridData.splice(e,0,this.draggedRecord),this.parent.ids.splice(e,0,this.draggedRecord.ganttProperties.rowUniqueID.toString()),this.parent.setRecordValue("parentItem",this.droppedRecord.parentItem,this.draggedRecord),this.parent.setRecordValue("parentUniqueID",this.droppedRecord.parentUniqueID,this.draggedRecord),this.parent.setRecordValue("level",this.droppedRecord.level,this.draggedRecord),"ResourceView"===this.parent.viewType){var a=0===this.draggedRecord.level?"R"+this.draggedRecord.ganttProperties.taskId:"T"+this.draggedRecord.ganttProperties.taskId;this.parent.getTaskIds().splice(e,0,a)}if(this.draggedRecord.hasChildRecords){this.updateChildRecord(this.draggedRecord,e),this.updateChildRecordLevel(this.draggedRecord,1)}if(this.droppedRecord.parentItem){var r=this.parent.getParentTask(this.droppedRecord.parentItem).childRecords,n=r.indexOf(this.droppedRecord);r.splice(n,0,this.draggedRecord)}t.isNullOrUndefined(this.draggedRecord.parentItem&&-1!==this.updateParentRecords.indexOf(this.draggedRecord.parentItem))||this.updateParentRecords.push(this.draggedRecord.parentItem)}},e.prototype.updateChildRecordLevel=function(e,t){var i,a=0;if(t++,!e.hasChildRecords)return 0;a=e.childRecords.length;for(var r=0;r<a;r++){i=e.childRecords[r];var n=void 0;if(e.parentItem){n=this.parent.treeGrid.uniqueIDCollection[e.parentItem.uniqueID]}i.level=e.parentItem?n.level+t:e.level+1,this.parent.setRecordValue("level",i.level,i),i.hasChildRecords&&(t--,t=this.updateChildRecordLevel(i,t))}return t},e.prototype.updateChildRecord=function(e,t,i){var a,r=this.parent,n=0;if(!e.hasChildRecords)return 0;n=e.childRecords.length;for(var s=0;s<n;s++){if(a=e.childRecords[s],t++,r.flatData.splice(t,0,a),this.parent.ids.splice(t,0,a.ganttProperties.rowUniqueID.toString()),"ResourceView"===this.parent.viewType){var o=(0===a.level?"R":"T")+a.ganttProperties.taskId;this.parent.getTaskIds().splice(t,0,o)}r.taskFields.parentID&&r.dataSource.length>0&&this.ganttData.splice(t,0,a.taskData),a.hasChildRecords&&(t=this.updateChildRecord(a,t))}return t},e.prototype.removeRecords=function(e){var i,r=this.parent;i=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):this.parent.dataSource;var n=e,s=n&&n.parentItem?this.parent.getParentTask(n.parentItem):null;if(n){if(n.parentItem){var o=[];s&&(o=s.childRecords);var l=0;o&&o.length>0&&("ResourceView"===this.parent.viewType&&1===o.length&&(this.parent.isOnDelete=!0,o[0].isDelete=!0,this.parent.dataOperation.updateParentItems(s),this.parent.isOnDelete=!1,o[0].isDelete=!1),l=o.indexOf(n),s.childRecords.splice(l,1),!this.parent.taskFields.parentID&&s.taskData[this.parent.taskFields.child]&&s.taskData[this.parent.taskFields.child].splice(l,1),this.updateParentRecords.push(s))}if(!this.parent.taskFields.parentID){var d=[];d.push(n.ganttProperties.taskId.toString()),("ProjectView"===this.parent.viewType||"ResourceView"===this.parent.viewType&&"middleSegment"!==this.dropPosition)&&this.parent.editModule.removeFromDataSource(d)}if(r.taskFields.parentID){n.hasChildRecords&&n.childRecords.length>0&&this.removeChildItem(n);for(var h=void 0,p=i.length>0&&"ResourceView"!==this.parent.viewType?i:this.parent.updatedRecords,u=0;u<p.length;u++)"ResourceView"===this.parent.viewType?p[u].ganttProperties.rowUniqueID===n.ganttProperties.rowUniqueID&&(h=u):p[u][this.parent.taskFields.id]===n.taskData[this.parent.taskFields.id]&&(h=u);if(-1!==h){i.length>0&&i.splice(h,1);var c=this.treeGridData.indexOf(n);this.treeGridData.splice(c,1),this.parent.ids.splice(c,1),-1!==this.parent.treeGrid.parentData.indexOf(n)&&this.parent.treeGrid.parentData.splice(this.parent.treeGrid.parentData.indexOf(n),1),"ResourceView"===this.parent.viewType&&this.parent.getTaskIds().splice(h,1)}}var g=this.treeGridData.indexOf(n);if(!r.taskFields.parentID){var f=this.parent.editModule.getChildCount(n,0);this.treeGridData.splice(g,f+1),this.parent.ids.splice(g,f+1);var m=this.ganttData.indexOf(n.taskData);-1!==m&&(this.ganttData.splice(m,1),this.parent.treeGrid.parentData.splice(m,1)),"ResourceView"===this.parent.viewType&&this.parent.getTaskIds().splice(g,f+1)}n.parentItem&&s&&s.childRecords&&!s.childRecords.length&&(s.expanded=!1,s.hasChildRecords=!1)}},e.prototype.removeChildItem=function(e){for(var i,r,n=0;n<e.childRecords.length;n++){i=e.childRecords[n];var s=void 0;s=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):this.parent.dataSource;for(var o=0;o<s.length;o++)s[o][this.parent.taskFields.id]===i.taskData[this.parent.taskFields.id]&&(r=o);if(-1!==r){s.length>0&&s.splice(r,1);var l=this.treeGridData.indexOf(i);this.treeGridData.splice(l,1),this.parent.ids.splice(l,1),"ResourceView"===this.parent.viewType&&this.parent.getTaskIds().splice(r,1)}i.hasChildRecords&&this.removeChildItem(i)}},e.prototype.reorderRows=function(e,i,a){if(!this.parent.readOnly){if(e[0]===i||"above"!==a&&"below"!==a&&"child"!==a)return;"above"===a&&(this.dropPosition="topSegment"),"below"===a&&(this.dropPosition="bottomSegment"),"child"===a&&(this.dropPosition="middleSegment");var r=void 0;this.parent.undoRedoModule&&(r=t.extend([],[],[this.parent.undoRedoModule.currentAction],!0)[0]);for(var n=[],s=0;s<e.length;s++)this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&("RowDragAndDrop"===r.action||"TaskbarDragAndDrop"===r.action)?n[s]=r.beforeDrop[s].data:n[s]=this.parent.flatData[e[s]];var o={data:n,dropIndex:i,dropPosition:this.dropPosition};this.dropRows(o,!0)}},e}(),jt=function(){function e(e){this.theme=e,this.ganttStyle={},this.setTheme(this.ganttStyle,this.theme),this.ganttStyle.eventMarker.lineStyle.dashStyle=g.PdfDashStyle.Dash}return Object.defineProperty(e.prototype,"style",{get:function(){return this.ganttStyle},enumerable:!0,configurable:!0}),e.prototype.setTheme=function(e,t){switch(this.initStyles(e),e.columnHeader.fontSize=9.5,e.columnHeader.fontColor=new g.PdfColor(0,0,0),e.columnHeader.fontColor.gray=.2,e.columnHeader.backgroundColor=new g.PdfColor(255,255,255),e.columnHeader.borderColor=new g.PdfColor(234,234,234),e.columnHeader.format.lineAlignment=1,e.columnHeader.format.alignment=0,e.fontFamily=g.PdfFontFamily.Helvetica,e.cell.fontSize=9.5,e.cell.backgroundColor=new g.PdfColor(255,255,255),e.cell.borderColor=new g.PdfColor(234,234,234),e.cell.fontColor=new g.PdfColor(0,0,0),e.cell.fontColor.gray=.2,e.cell.format.lineAlignment=1,e.cell.format.alignment=0,e.footer.fontSize=9.5,e.footer.fontStyle=0,e.footer.format.alignment=1,e.footer.format.lineAlignment=1,e.footer.borderColor=new g.PdfColor(235,235,235),e.timeline.fontSize=9.5,e.timeline.fontStyle=0,e.timeline.backgroundColor=new g.PdfColor(252,252,252),e.timeline.fontColor=new g.PdfColor(40,40,39),e.chartGridLineColor=new g.PdfColor(235,235,235),e.timeline.borderColor=new g.PdfColor(235,235,235),e.eventMarker.label.backgroundColor=new g.PdfColor(100,253,191),e.eventMarker.label.fontColor=new g.PdfColor(33,33,33),e.eventMarker.lineStyle=new g.PdfPen(new g.PdfColor(227,22,91)),e.eventMarker.lineStyle.dashStyle=g.PdfDashStyle.Dash,e.holiday.backgroundColor=new g.PdfColor(238,238,238),t){case"Bootstrap":e.taskbar.taskColor=new g.PdfColor(49,122,185),e.taskbar.progressColor=new g.PdfColor(33,82,125),e.taskbar.criticalTaskColor=new g.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new g.PdfColor(255,85,85),e.taskbar.baselineColor=new g.PdfColor(240,173,78),e.taskbar.baselineBorderColor=new g.PdfColor(240,173,78),e.criticalConnectorLineColor=new g.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new g.PdfColor(255,85,85),e.taskbar.parentTaskColor=new g.PdfColor(119,119,119),e.taskbar.parentProgressColor=new g.PdfColor(85,85,85),e.taskbar.taskBorderColor=new g.PdfColor(33,82,125),e.taskbar.parentTaskBorderColor=new g.PdfColor(85,85,85),e.taskbar.milestoneColor=new g.PdfColor(85,85,85),e.footer.fontColor=new g.PdfColor(0,0,0),e.footer.fontColor.gray=.2,e.connectorLineColor=new g.PdfColor(33,82,125),e.footer.backgroundColor=new g.PdfColor(255,255,255),e.taskbar.progressFontColor=new g.PdfColor(255,255,255),e.label.fontColor=new g.PdfColor(0,0,0),e.taskbar.splitLineBackground=new g.PdfColor(51,51,51),e.taskbar.unscheduledTaskBarColor=new g.PdfColor(49,122,185),e.taskbar.manualParentBackground=new g.PdfColor(119,119,119),e.taskbar.manualParentProgress=new g.PdfColor(85,85,85),e.taskbar.manualChildBackground=new g.PdfColor(117,56,201),e.taskbar.manualChildProgress=new g.PdfColor(87,42,150),e.taskbar.manualLineColor=new g.PdfColor(152,154,156),e.taskbar.manualParentBorder=new g.PdfColor(85,85,85),e.taskbar.manualChildBorder=new g.PdfColor(87,42,150),e.eventMarker.label.backgroundColor=new g.PdfColor(138,109,59),e.eventMarker.label.fontColor=new g.PdfColor(252,248,227),e.eventMarker.lineStyle=new g.PdfPen(new g.PdfColor(49,122,185)),e.holiday.backgroundColor=new g.PdfColor(238,238,238);break;case"Bootstrap 4":e.taskbar.taskColor=new g.PdfColor(0,123,255),e.taskbar.progressColor=new g.PdfColor(0,86,179),e.taskbar.criticalTaskColor=new g.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new g.PdfColor(255,85,85),e.taskbar.baselineColor=new g.PdfColor(255,193,7),e.taskbar.baselineBorderColor=new g.PdfColor(255,193,7),e.criticalConnectorLineColor=new g.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new g.PdfColor(255,85,85),e.taskbar.parentTaskColor=new g.PdfColor(108,117,125),e.taskbar.parentProgressColor=new g.PdfColor(73,80,87),e.taskbar.taskBorderColor=new g.PdfColor(0,86,179),e.taskbar.parentTaskBorderColor=new g.PdfColor(73,80,87),e.taskbar.milestoneColor=new g.PdfColor(73,80,87),e.footer.fontColor=new g.PdfColor(0,0,0),e.footer.fontColor.gray=.2,e.connectorLineColor=new g.PdfColor(0,86,179),e.footer.backgroundColor=new g.PdfColor(255,255,255),e.taskbar.progressFontColor=new g.PdfColor(255,255,255),e.label.fontColor=new g.PdfColor(33,37,41),e.taskbar.splitLineBackground=new g.PdfColor(0,0,0),e.taskbar.unscheduledTaskBarColor=new g.PdfColor(0,123,255),e.taskbar.manualParentBackground=new g.PdfColor(108,117,125),e.taskbar.manualParentProgress=new g.PdfColor(73,80,87),e.taskbar.manualChildBackground=new g.PdfColor(133,83,241),e.taskbar.manualChildProgress=new g.PdfColor(102,40,238),e.taskbar.manualLineColor=new g.PdfColor(152,154,156),e.taskbar.manualParentBorder=new g.PdfColor(73,80,87),e.taskbar.manualChildBorder=new g.PdfColor(102,40,238),e.eventMarker.label.backgroundColor=new g.PdfColor(255,193,7),e.eventMarker.label.fontColor=new g.PdfColor(0,0,0),e.eventMarker.lineStyle=new g.PdfPen(new g.PdfColor(0,123,255)),e.holiday.backgroundColor=new g.PdfColor(233,236,239);break;case"Fabric":e.columnHeader.fontColor=new g.PdfColor(102,102,102),e.cell.fontColor=new g.PdfColor(51,51,51),e.taskbar.taskColor=new g.PdfColor(0,120,214),e.taskbar.progressColor=new g.PdfColor(0,91,163),e.taskbar.criticalTaskColor=new g.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new g.PdfColor(255,85,85),e.taskbar.baselineColor=new g.PdfColor(216,59,1),e.taskbar.baselineBorderColor=new g.PdfColor(216,59,1),e.criticalConnectorLineColor=new g.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new g.PdfColor(255,85,85),e.taskbar.parentTaskColor=new g.PdfColor(118,118,118),e.taskbar.parentProgressColor=new g.PdfColor(80,80,80),e.taskbar.taskBorderColor=new g.PdfColor(0,91,163),e.taskbar.parentTaskBorderColor=new g.PdfColor(80,80,80),e.taskbar.milestoneColor=new g.PdfColor(80,80,80),e.footer.fontColor=new g.PdfColor(51,51,51),e.footer.fontColor.gray=.2,e.connectorLineColor=new g.PdfColor(0,69,122),e.footer.backgroundColor=new g.PdfColor(255,255,255),e.taskbar.progressFontColor=new g.PdfColor(255,255,255),e.label.fontColor=new g.PdfColor(51,51,51),e.taskbar.splitLineBackground=new g.PdfColor(0,0,0),e.taskbar.unscheduledTaskBarColor=new g.PdfColor(0,120,214),e.taskbar.manualParentBackground=new g.PdfColor(118,118,118),e.taskbar.manualParentProgress=new g.PdfColor(80,80,80),e.taskbar.manualChildBackground=new g.PdfColor(154,56,186),e.taskbar.manualChildProgress=new g.PdfColor(109,24,136),e.taskbar.manualLineColor=new g.PdfColor(152,154,156),e.taskbar.manualParentBorder=new g.PdfColor(80,80,80),e.taskbar.manualChildBorder=new g.PdfColor(109,24,136),e.eventMarker.label.backgroundColor=new g.PdfColor(202,232,255),e.eventMarker.label.fontColor=new g.PdfColor(0,90,158),e.eventMarker.lineStyle=new g.PdfPen(new g.PdfColor(0,120,214)),e.holiday.backgroundColor=new g.PdfColor(244,244,244);break;default:e.taskbar.taskColor=new g.PdfColor(88,105,197),e.taskbar.progressColor=new g.PdfColor(63,81,181),e.taskbar.criticalTaskColor=new g.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new g.PdfColor(255,85,85),e.taskbar.baselineColor=new g.PdfColor(193,87,0),e.taskbar.baselineBorderColor=new g.PdfColor(193,87,0),e.criticalConnectorLineColor=new g.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new g.PdfColor(255,85,85),e.taskbar.parentTaskColor=new g.PdfColor(132,132,132),e.taskbar.parentProgressColor=new g.PdfColor(97,97,97),e.taskbar.taskBorderColor=new g.PdfColor(63,81,181),e.taskbar.parentTaskBorderColor=new g.PdfColor(51,51,51),e.taskbar.milestoneColor=new g.PdfColor(97,97,97),e.footer.fontColor=new g.PdfColor(0,0,0),e.footer.fontColor.gray=.2,e.connectorLineColor=new g.PdfColor(63,81,181),e.footer.backgroundColor=new g.PdfColor(255,255,255),e.taskbar.progressFontColor=new g.PdfColor(255,255,255),e.label.fontColor=new g.PdfColor(51,51,51),e.taskbar.splitLineBackground=new g.PdfColor(0,0,0),e.taskbar.unscheduledTaskBarColor=new g.PdfColor(63,81,181),e.taskbar.manualParentBackground=new g.PdfColor(97,97,97),e.taskbar.manualParentProgress=new g.PdfColor(97,97,97),e.taskbar.manualChildBackground=new g.PdfColor(0,135,134),e.taskbar.manualChildProgress=new g.PdfColor(0,135,134),e.taskbar.manualLineColor=new g.PdfColor(152,154,156),e.taskbar.manualParentBorder=new g.PdfColor(97,97,97),e.taskbar.manualChildBorder=new g.PdfColor(0,135,134),e.eventMarker.label.backgroundColor=new g.PdfColor(253,191,100),e.eventMarker.label.fontColor=new g.PdfColor(33,33,33),e.eventMarker.lineStyle=new g.PdfPen(new g.PdfColor(227,22,91)),e.holiday.backgroundColor=new g.PdfColor(238,238,238)}},e.prototype.initStyles=function(e){e.columnHeader={},e.columnHeader.format=new g.PdfStringFormat,e.cell={},e.cell.format=new g.PdfStringFormat,e.timeline={},e.footer={},e.footer.format=new g.PdfStringFormat,e.label={},e.taskbar={},e.eventMarker={},e.eventMarker.label={},e.eventMarker.lineStyle=new g.PdfPen(null),e.holiday={}},e}(),zt=function(){function e(){this.mKeys=[],this.mValues=[]}return e.prototype.size=function(){return this.mKeys.length},e.prototype.add=function(e,t){if(void 0===e||null===e||void 0===t||null===t)throw new ReferenceError("Provided key or value is not valid.");if(this.mKeys.indexOf(e)<0)return this.mKeys.push(e),this.mValues.push(t),1;throw new RangeError("An item with the same key has already been added.")},e.prototype.keys=function(){return this.mKeys},e.prototype.values=function(){return this.mValues},e.prototype.getValue=function(e){if(void 0===e||null===e)throw new ReferenceError("Provided key is not valid.");var t=this.mKeys.indexOf(e);if(t<0)throw new RangeError("No item with the specified key has been added.");return this.mValues[t]},e.prototype.setValue=function(e,t){if(void 0===e||null===e)throw new ReferenceError("Provided key is not valid.");var i=this.mKeys.indexOf(e);i<0?(this.mKeys.push(e),this.mValues.push(t)):this.mValues[i]=t},e.prototype.remove=function(e){if(void 0===e||null===e)throw new ReferenceError("Provided key is not valid.");var t=this.mKeys.indexOf(e);if(t<0)throw new RangeError("No item with the specified key has been added.");return this.mKeys.splice(t,1),this.mValues.splice(t,1),!0},e.prototype.containsKey=function(e){if(void 0===e||null===e)throw new ReferenceError("Provided key is not valid.");return!(this.mKeys.indexOf(e)<0)},e.prototype.clear=function(){this.mKeys=[],this.mValues=[]},e}(),Gt=function(){function e(){var e=new g.PdfPen(new g.PdfColor(0,0,0));e.dashStyle=g.PdfDashStyle.Solid;var t=new g.PdfPen(new g.PdfColor(0,0,0));t.dashStyle=g.PdfDashStyle.Solid;var i=new g.PdfPen(new g.PdfColor(0,0,0));i.dashStyle=g.PdfDashStyle.Solid;var a=new g.PdfPen(new g.PdfColor(0,0,0));a.dashStyle=g.PdfDashStyle.Solid,this.leftPen=e,this.rightPen=t,this.topPen=i,this.bottomPen=a}return Object.defineProperty(e.prototype,"left",{get:function(){return this.leftPen},set:function(e){this.leftPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"right",{get:function(){return this.rightPen},set:function(e){this.rightPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"top",{get:function(){return this.topPen},set:function(e){this.topPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bottom",{get:function(){return this.bottomPen},set:function(e){this.bottomPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"all",{set:function(e){this.leftPen=this.rightPen=this.topPen=this.bottomPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isAll",{get:function(){return this.leftPen===this.rightPen&&this.leftPen===this.topPen&&this.leftPen===this.bottomPen},enumerable:!0,configurable:!0}),Object.defineProperty(e,"default",{get:function(){return new e},enumerable:!0,configurable:!0}),e}(),qt=function(){function e(e,t,i,a){this.hasLeftPad=!1,this.hasRightPad=!1,this.hasTopPad=!1,this.hasBottomPad=!1,void 0===e?(this.leftPad=this.rightPad=5.76,this.bottomPad=this.topPad=.5):(this.leftPad=e,this.rightPad=t,this.topPad=i,this.bottomPad=a,this.hasLeftPad=!0,this.hasRightPad=!0,this.hasTopPad=!0,this.hasBottomPad=!0)}return Object.defineProperty(e.prototype,"left",{get:function(){return this.leftPad},set:function(e){this.leftPad=e,this.hasLeftPad=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"right",{get:function(){return this.rightPad},set:function(e){this.rightPad=e,this.hasRightPad=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"top",{get:function(){return this.topPad},set:function(e){this.topPad=e,this.hasTopPad=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bottom",{get:function(){return this.bottomPad},set:function(e){this.bottomPad=e,this.hasBottomPad=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"all",{set:function(e){this.leftPad=this.rightPad=this.topPad=this.bottomPad=e,this.hasLeftPad=!0,this.hasRightPad=!0,this.hasTopPad=!0,this.hasBottomPad=!0},enumerable:!0,configurable:!0}),e}(),_t=function(){function e(){}return e}(),Zt=function(){function t(){this.cellSpacing=0,this.borderOverlapStyle=g.PdfBorderOverlapStyle.Overlap,this.allowHorizontalOverflow=!1,this.horizontalOverflowType=e.PdfHorizontalOverflowType.LastPage,this.cellPadding=new qt}return t}(),Xt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),Yt=function(i){function a(e){var t=i.call(this,e)||this;return t.columnRanges=[],t.repeatRowIndex=-1,t.pageHeightCollection=[],t.headerHeight=0,t.currentBounds=new g.RectangleF(0,0,0,0),t}return Xt(a,i),Object.defineProperty(a.prototype,"treegrid",{get:function(){return this.elements},enumerable:!0,configurable:!0}),a.prototype.layoutInternal=function(e){this.currentPage=e.page;var t=e.format;return null!==this.currentPage&&(this.currentPageBounds=this.currentPage.getClientSize()),this.currentGraphics=this.currentPage.graphics,null!==t&&t.break===g.PdfLayoutBreakType.FitColumnsToPage?this.currentBounds=new g.RectangleF(new g.PointF(e.bounds.x,e.bounds.y),new g.SizeF(this.treegrid.columns.width,this.currentGraphics.clientSize.height)):this.currentBounds=new g.RectangleF(new g.PointF(e.bounds.x,e.bounds.y),this.currentGraphics.clientSize),0!==this.treegrid.rows.count&&(this.currentBounds.width=e.bounds.width>0?e.bounds.width:this.currentBounds.width-this.treegrid.rows.getRow(0).cells.getCell(0).style.borders.left.width/2),this.startLocation=new g.PointF(e.bounds.x,e.bounds.y),e.bounds.height>0&&(this.currentBounds.height=e.bounds.height),this.treegrid.style.allowHorizontalOverflow||this.treegrid.isFitToWidth?(this.treegrid.measureColumnsWidth(this.currentBounds),this.columnRanges.push([0,this.treegrid.columns.count-1])):(this.treegrid.measureColumnsWidth(),this.determineColumnDrawRanges()),this.layoutOnPage(e)},a.prototype.determineColumnDrawRanges=function(){for(var e=0,t=0,i=0,a=this.treegrid.taskbar.isAutoFit()?R(this.currentGraphics.clientSize.width)-this.currentBounds.x:this.currentGraphics.clientSize.width-this.currentBounds.x,r=0;r<this.treegrid.columns.count;r++)if((i+=this.treegrid.columns.getColumn(r).width)>=a){for(var n=0,s=e;s<=r&&!((n+=this.treegrid.columns.getColumn(s).width)>a);s++)t=s;this.columnRanges.push([e,t]),e=t+1,t<=r&&(i=this.treegrid.columns.getColumn(r).width)}this.columnRanges.push([e,this.treegrid.columns.count-1])},a.prototype.getFormat=function(e){return e},a.prototype.updateCollection=function(e,t,i,a,r,n,s){if(null!=e){var o=n;t.length>0&&(o=t[t.length-1].pageNumber),i.push({rowIndex:a,height:r,pageNumber:o+s})}},a.prototype.layoutOnPage=function(t){for(var i=0,a=0,r=[],n=[],s=this.getFormat(t.format),o=null,l=new zt,d=t.page,h=0;h<this.columnRanges.length;h++){var p=this.columnRanges[h];this.cellStartIndex=p[0],this.cellEndIndex=p[1];for(var u=this.treegrid.rows.count,c=0,f=!1,m=0;m<u;m++){var y=this.treegrid.rows.getRow(m);c++;var D=this.currentBounds.y;null===this.currentPage||l.containsKey(this.currentPage)||(r.push({height:i,pageNumber:a}),a++,i=0,l.add(this.currentPage,p));var v=this.drawRow(y);for(D===this.currentBounds.y?(f=!0,this.repeatRowIndex=this.treegrid.rows.rowCollection.indexOf(y)):(f=!1,this.repeatRowIndex=-1,this.updateCollection(this.currentPage,r,n,m,y.height,a,0));!v.isFinish&&null!==d;)if(this.treegrid.allowRowBreakAcrossPages)this.currentPage=this.getNextPageFormat(s),this.treegrid.enableHeader&&this.drawHeader(),this.checkBounds(s),v=this.drawRow(y),i+=y.height,this.updateCollection(this.currentPage,r,n,m,y.height,a,1);else{if(!this.treegrid.allowRowBreakAcrossPages&&c<length){this.currentPage=this.getNextPageFormat(s),this.treegrid.enableHeader&&this.drawHeader();break}if(c>=length)break}if(!v.isFinish&&null!==d&&s.layout!==g.PdfLayoutType.OnePage&&f){if(this.startLocation.x=this.currentBounds.x,this.currentPage=this.getNextPageFormat(s),this.treegrid.enableHeader&&this.drawHeader(),this.startLocation.y=this.currentBounds.y,s.paginateBounds===new g.RectangleF(0,0,0,0))this.currentBounds.x+=this.startLocation.x;else{var k=this.currentBounds.x;this.currentBounds.x=k}this.currentBounds.x===Gt.default.left.width/2&&(this.currentBounds.y+=this.startLocation.x),this.drawRow(y),null===this.currentPage||l.containsKey(this.currentPage)||l.add(this.currentPage,p),this.updateCollection(this.currentPage,r,n,m,y.height,a,0)}}this.columnRanges.indexOf(p)<this.columnRanges.length-1&&null!==d&&s.layout!==g.PdfLayoutType.OnePage&&(this.currentPage=this.getNextPageFormat(s),this.checkBounds(s))}o=this.getLayoutResult(),this.treegrid.style.allowHorizontalOverflow&&this.treegrid.style.horizontalOverflowType===e.PdfHorizontalOverflowType.NextPage&&this.reArrangePages(l),r.push({height:i,pageNumber:a});var b={};this.headerHeight=n[0].height,n.forEach(function(e){b[e.pageNumber]||(b[e.pageNumber]=[]),b[e.pageNumber].push(e.height)});var w=Object.keys(b).map(function(e){var t=parseInt(e,10);return{pageNumber:t,totalHeight:b[t].reduce(function(e,t){return e+t},0)}});return this.pageHeightCollection=w,o},a.prototype.checkBounds=function(e){var t=new g.PointF(Gt.default.right.width/2,Gt.default.top.width/2);e.paginateBounds===new g.RectangleF(0,0,0,0)&&this.startLocation===t&&(this.currentBounds.x+=this.startLocation.x,this.currentBounds.y+=this.startLocation.y)},a.prototype.drawHeader=function(){this.drawRow(this.treegrid.rows.getRow(0))},a.prototype.reArrangePages=function(e){for(var t=this.currentPage.document,i=[],a=e.keys(),r=0;r<a.length;r++)(o=a[r]).section=null,i.push(o),t.pages.remove(o);for(r=0;r<e.size();r++)for(var n=e.size()/this.columnRanges.length,s=r;s<e.size();s+=n){var o=i[s];-1===t.pages.indexOf(o)&&t.pages.add(o)}},a.prototype.getNextPageFormat=function(e){var t=this.currentPage.section,i=null,a=t.indexOf(this.currentPage);return i=a===t.count-1?t.add():t.getPages()[a+1],this.currentGraphics=i.graphics,this.currentBounds=new g.RectangleF(new g.PointF(0,0),i.getClientSize()),i},a.prototype.getLayoutResult=function(){var e=new g.RectangleF(this.startLocation,new g.SizeF(this.currentBounds.width,this.currentBounds.y-this.startLocation.y));return new Kt(this.currentPage,e)},a.prototype.checkIfDefaultFormat=function(e){var t=new g.PdfStringFormat;return e.alignment===t.alignment&&e.characterSpacing===t.characterSpacing&&e.clipPath===t.clipPath&&e.firstLineIndent===t.firstLineIndent&&e.horizontalScalingFactor===t.horizontalScalingFactor&&e.lineAlignment===t.lineAlignment&&e.lineLimit===t.lineLimit&&e.lineSpacing===t.lineSpacing&&e.measureTrailingSpaces===t.measureTrailingSpaces&&e.noClip===t.noClip&&e.paragraphIndent===t.paragraphIndent&&e.rightToLeft===t.rightToLeft&&e.subSuperScript===t.subSuperScript&&e.wordSpacing===t.wordSpacing&&e.wordWrap===t.wordWrap},a.prototype.drawRow=function(e,i,a){if(t.isNullOrUndefined(i)){var r=new g.RowLayoutResult;return a=e.rowBreakHeight>0?e.rowBreakHeight:e.height,a>this.currentPageBounds.height?this.treegrid.allowRowBreakAcrossPages?(r.isFinish=!0,this.drawRowWithBreak(r,e,a)):(r.isFinish=!1,this.drawRow(e,r,a)):this.currentBounds.y+a>this.currentPageBounds.height||this.currentBounds.y+a>this.currentBounds.height?this.repeatRowIndex>-1&&this.repeatRowIndex===e.rowIndex?this.treegrid.allowRowBreakAcrossPages?(r.isFinish=!0,this.drawRowWithBreak(r,e,a)):(r.isFinish=!1,this.drawRow(e,r,a)):r.isFinish=!1:(r.isFinish=!0,this.drawRow(e,r,a)),r}var n=new g.PointF(this.currentBounds.x,this.currentBounds.y);i.bounds=new g.RectangleF(n,new g.SizeF(0,0));var s=0;a=this.reCalculateHeight(e,a);for(var o=this.cellStartIndex;o<=this.cellEndIndex;o++){var l=e.cells.getCell(o),d=this.treegrid.columns.getColumn(o);if(!t.isNullOrUndefined(l.value)){d.isTreeColumn&&(s=e.level);var h=l.columnSpan>1&&o>this.cellEndIndex+1;if(!h)for(var p=1;p<l.columnSpan;p++)e.cells.getCell(o+p).isCellMergeContinue=!0;var u=new g.SizeF(d.width,a);l.columnSpan>1&&(u=new g.SizeF(l.width,a),o+=l.columnSpan),!this.checkIfDefaultFormat(d.format)&&this.checkIfDefaultFormat(l.style.format)&&(l.style.format=d.format),l.draw(this.currentGraphics,new g.RectangleF(n,u),h,s),e.treegrid.style.allowHorizontalOverflow&&(l.columnSpan>this.cellEndIndex||o+l.columnSpan>this.cellEndIndex+1)&&this.cellEndIndex<e.cells.count-1&&(e.rowOverflowIndex=this.cellEndIndex),n.x+=d.width,s=0}}return this.currentBounds.y+=a,i.bounds=new g.RectangleF(new g.PointF(i.bounds.x,i.bounds.y),new g.SizeF(n.x,n.y)),null},a.prototype.drawRowWithBreak=function(e,t,i){var a=new g.PointF(this.currentBounds.x,this.currentBounds.y);e.bounds=new g.RectangleF(a,new g.SizeF(0,0));var r=0;this.treegridHeight=this.currentBounds.height,t.rowBreakHeight=this.currentBounds.y+i-this.currentBounds.height;for(var n=0;n<t.cells.count;n++)(l=t.cells.getCell(n)).measureHeight()===i&&null===l.value&&(t.rowBreakHeight=this.currentBounds.y+i-this.currentBounds.height);for(var s=this.cellStartIndex;s<=this.cellEndIndex;s++){var o=this.treegrid.columns.getColumn(s);o.isTreeColumn&&(r=10*t.level);var l=t.cells.getCell(s),d=l.columnSpan+s>this.cellEndIndex+1&&l.columnSpan>1;if(!d)for(var h=1;h<l.columnSpan;h++)t.cells.getCell(s+h).isCellMergeContinue=!0;var p=this.treegridHeight>0?this.treegridHeight:this.currentBounds.height,u=new g.SizeF(o.width,p);!this.checkIfDefaultFormat(o.format)&&this.checkIfDefaultFormat(l.style.format)&&(l.style.format=o.format),l.draw(this.currentGraphics,new g.RectangleF(a,u),d,r),e.isFinish=e.isFinish?l.finishedDrawingCell:e.isFinish,a.x+=o.width,r=0,this.currentBounds.y+=this.treegridHeight>0?this.treegridHeight:i,e.bounds=new g.RectangleF(new g.PointF(e.bounds.x,e.bounds.y),new g.SizeF(a.x,a.y))}},a.prototype.reCalculateHeight=function(e,i){for(var a=0,r=this.cellStartIndex;r<=this.cellEndIndex;r++)t.isNullOrUndefined(e.cells.getCell(r).remainingString)&&""!==e.cells.getCell(r).remainingString||(a=Math.max(a,e.cells.getCell(r).measureHeight()));return Math.max(i,a)},a}(g.ElementLayouter),Kt=function(e){function t(t,i){return e.call(this,t,i)||this}return Xt(t,e),t}(g.PdfLayoutResult),Qt=function(e){function t(t){return void 0===t?e.call(this)||this:e.call(this,t)||this}return Xt(t,e),t}(g.PdfLayoutFormat),$t=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),Jt=function(e){function i(){var t=e.call(this)||this;return t.treeGridSize=new g.SizeF(0,0),t.treeColumnIndex=0,t.allowRowBreakAcrossPages=!0,t.enableHeader=!0,t.isFitToWidth=!1,t.columns=new si(t),t.rows=new ai(t),t.headers=new ri(t),t.style=new Zt,t.rowHeight=0,t}return $t(i,e),Object.defineProperty(i.prototype,"size",{get:function(){return 0===this.treeGridSize.width&&0===this.treeGridSize.height&&(this.treeGridSize=this.calculateTreeGridSize()),this.treeGridSize},set:function(e){this.treeGridSize=e},enumerable:!0,configurable:!0}),i.prototype.draw=function(e,t,i,a){if(t instanceof g.PointF&&void 0===t.width&&void 0===i)return this.drawHelper(e,t.x,t.y);if("number"==typeof t&&"number"==typeof i&&void 0===a)return this.drawHelper(e,t,i,null);if(t instanceof g.RectangleF&&void 0!==t.width&&void 0===i)return this.drawHelper(e,t,null);if(t instanceof g.PointF&&void 0===t.width&&i instanceof g.PdfLayoutFormat)return this.drawHelper(e,t.x,t.y,i);if("number"==typeof t&&"number"==typeof i&&(a instanceof g.PdfLayoutFormat||null===a)){var r=e.graphics.clientSize.width-t,n=new g.RectangleF(t,i,r,0);return this.drawHelper(e,n,a)}return t instanceof g.RectangleF&&void 0!==t.width&&"boolean"==typeof i?this.drawHelper(e,t,null):this.drawHelper(e,t,i)},i.prototype.measureColumnsWidth=function(e){if(void 0!==e)for(var t=this.columns.getDefaultWidths(e.width-e.x),i=0;i<this.columns.count;i++)this.columns.getColumn(i).width<0&&(this.columns.getColumn(i).width=t[i]);else{for(var t=[],a=0,r=0,n=this.columns.count,i=0;i<n;i++){for(var s=this.rows.count,o=0;o<s;o++){var l=this.rows.getRow(o).cells.getCell(i).width,d=this.initialWidth>0?Math.min(this.initialWidth,l):l;a=Math.max(a,d),a=Math.max(this.columns.getColumn(i).width,a),this.columns.getColumn(i).isTreeColumn&&(r=Math.max(r,this.rows.getRow(o).level))}this.columns.getColumn(i).isTreeColumn?t.push(a+10*r):t.push(a),a=0}for(i=0;i<this.columns.count;i++)this.columns.getColumn(i).width<0&&(this.columns.getColumn(i).width=t[i])}},i.prototype.calculateTreeGridSize=function(){for(var e=0,t=this.columns.width,i=0;i<this.headers.count;i++)e+=(a=this.headers.getHeader(i)).height;for(i=0;i<this.rows.count;i++){var a=this.rows.getRow(i);e+=a.height}return new g.SizeF(t,e)},i.prototype.drawGrid=function(e,t,i,a){this.initialWidth=e.graphics.clientSize.width;var r=new g.RectangleF(0,0,e.getClientSize().height,0);return this.draw(e,r,a)},i.prototype.layout=function(e){if(0!==this.rows.count){var i=0!==this.rows.getRow(0).cells.count?this.rows.getRow(0).cells.getCell(0).style:null;if(!t.isNullOrUndefined(i)&&1!==i.borders.left.width){var a=i.borders.left.width/2,r=i.borders.top.width/2;if(e.bounds.x===Gt.default.right.width/2&&e.bounds.y===Gt.default.right.width/2){var n=new g.RectangleF(new g.PointF(a,r),new g.SizeF(this.size.width,this.size.height));e.bounds=n}}}return this.layouter=new Yt(this),this.layouter.layoutInternal(e)},i}(g.PdfLayoutElement),ei=function(){function e(e){this.cellWidth=0,this.cellHeight=0,this.finishedDrawingCell=!0,t.isNullOrUndefined(e)?(this.rowSpan=1,this.columnSpan=1):this.row=e,this.style={}}return Object.defineProperty(e.prototype,"height",{get:function(){return 0===this.cellHeight&&(this.cellHeight=this.measureHeight()),this.cellHeight},set:function(e){this.cellHeight=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return 0===this.cellWidth&&(this.cellWidth=this.measureWidth()),Math.round(this.cellWidth)},set:function(e){this.cellWidth=e},enumerable:!0,configurable:!0}),e.prototype.measureWidth=function(){var e=0,t=new g.PdfStringLayouter;if("string"==typeof this.value){var i=new g.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,this.style.fontStyle);i=this.row.isParentRow?new g.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,g.PdfFontStyle.Bold):new g.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,this.style.fontStyle),this.row.treegrid.ganttStyle.font&&(i=this.row.treegrid.ganttStyle.font),e+=t.layout(this.value,i,this.style.format,new g.SizeF(Number.MAX_VALUE,Number.MAX_VALUE),!1,new g.SizeF(0,0)).actualSize.width,e+=2*(this.style.borders.left.width+this.style.borders.right.width)}return void 0!==this.row.treegrid.style.cellPadding.left&&this.row.treegrid.style.cellPadding.hasLeftPad&&(e+=this.row.treegrid.style.cellPadding.left),void 0!==this.row.treegrid.style.cellPadding.right&&this.row.treegrid.style.cellPadding.hasRightPad&&(e+=this.row.treegrid.style.cellPadding.right),e+=this.row.treegrid.style.cellSpacing},e.prototype.measureHeight=function(){var e=this.row.treegrid.rowHeight,i=0,a=this.calculateWidth();a-=this.row.treegrid.style.cellPadding.right+this.row.treegrid.style.cellPadding.left,a-=this.style.borders?this.style.borders.left.width+this.style.borders.right.width:0;var r=new g.PdfStringLayouter;if("string"==typeof this.value||"string"==typeof this.remainingString){var n=this.value;this.finishedDrawingCell||(n=t.isNullOrUndefined(this.remainingString)||""===this.remainingString?this.value:this.remainingString);var s=null;s=this.row.isParentRow?new g.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,g.PdfFontStyle.Bold):new g.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,this.style.fontStyle),this.row.treegrid.ganttStyle.font&&(s=this.row.treegrid.ganttStyle.font);var o=r.layout(n,s,this.style.format,new g.SizeF(a-10,0),!1,new g.SizeF(0,0)),l=Math.max(o.lineHeight,o.actualSize.height);n.length>80?i+=l+20:i+=l+o.size.height/2,i+=2*(this.style.borders.top.width+this.style.borders.bottom.width)}return i+=this.row.treegrid.style.cellPadding.top+this.row.treegrid.style.cellPadding.bottom,i+=this.row.treegrid.style.cellSpacing,i>e?i:e},e.prototype.calculateWidth=function(){for(var e=this.row.cells.indexOf(this),t=this.columnSpan,i=0,a=0;a<t;a++)i+=this.row.treegrid.columns.getColumn(e+a)?this.row.treegrid.columns.getColumn(e+a).width:0;return this.row.treegrid.columns.getColumn(e)&&this.row.treegrid.columns.getColumn(e).isTreeColumn&&(i-=10*this.row.level),i},e.prototype.draw=function(e,t,i,a){var r=null;this.drawCellBackground(e,t);var n=new g.PdfSolidBrush(this.style.fontColor),s=null;if(this.row.isParentRow){var o=g.PdfFontStyle.Bold;this.style.fontStyle&&(o=this.style.fontStyle),s=new g.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,o)}else s=new g.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,this.style.fontStyle);this.row.treegrid.ganttStyle.font&&(s=this.row.treegrid.ganttStyle.font);var l=t;if(this.isHeaderCell||(l.x=l.x,l.width=l.width),l.height>=e.clientSize.height&&(this.row.treegrid.allowRowBreakAcrossPages?(l.height-=l.y,t.height-=t.y):(l.height=e.clientSize.height,t.height=e.clientSize.height)),l=this.adjustContentLayoutArea(l),this.image&&this.value){f=void 0;f=this.image.width<=l.width?new g.RectangleF(l.x+a,l.y-this.style.padding.bottom,this.image.width,this.image.height):l,e.drawImage(this.image,f.x+a,f.y-5,f.width,f.height);var d=null,h=void 0,p=this.fontStyle;p||(p=this.style);u=new g.PdfStandardFont(p.fontFamily,p.fontSize,p.fontStyle);h=p.fontFamily?u:s;c=n;this.row.treegrid.ganttStyle.cell.fontBrush&&(c=new g.PdfSolidBrush(this.row.treegrid.ganttStyle.cell.fontBrush)),this.row.treegrid.ganttStyle.cell.format.alignment&&!this.isHeaderCell&&(this.style.format.alignment=this.row.treegrid.ganttStyle.cell.format.alignment),this.finishedDrawingCell?(d=""===this.remainingString?this.remainingString:this.value,e.drawString(d,h,null,c,l.x+a+(f.width?f.width+8:0),this.isHeaderCell?l.y-16:l.y-this.style.padding.bottom,l.width-a-10,l.height-10,this.style.format)):e.drawString(this.remainingString,h,null,c,l.x+a,this.isHeaderCell?l.y-16:l.y,this.style.format),r=e.stringLayoutResult}else if("string"==typeof this.value||"string"==typeof this.remainingString){var d=null,h=void 0,u=new g.PdfStandardFont(this.style.fontFamily,this.style.fontSize,this.style.fontStyle);h=this.style.fontFamily?u:s;var c=n;this.row.treegrid.ganttStyle.cell.fontBrush&&(c=new g.PdfSolidBrush(this.row.treegrid.ganttStyle.cell.fontBrush)),this.row.treegrid.ganttStyle.cell.format.alignment&&!this.isHeaderCell&&(this.style.format.alignment=this.row.treegrid.ganttStyle.cell.format.alignment),this.finishedDrawingCell?(d=""===this.remainingString?this.remainingString:this.value,e.drawString(d,h,null,c,l.x+a,this.isHeaderCell?l.y-16:l.y-this.style.padding.bottom-3,l.width-a-10,l.height-10,this.style.format)):e.drawString(this.remainingString,h,null,c,l.x+a,this.isHeaderCell?l.y-16:l.y,this.style.format),r=e.stringLayoutResult}else if(this.value instanceof g.PdfImage||this.value instanceof g.PdfBitmap){var f=void 0;f=this.value.width<=l.width?new g.RectangleF(l.x,l.y,this.value.width,l.height):l,e.drawImage(this.value,f.x,f.y-10,f.width,f.height)}else this.value instanceof g.PdfTextWebLink&&this.value.draw(e.currentPage,l);return null!==this.style.borders&&this.drawCellBorder(e,t),r},e.prototype.drawCellBackground=function(e,t){var i=new g.PdfSolidBrush(this.style.backgroundColor);null!==i&&(e.save(),e.drawRectangle(i,t.x,t.y,t.width,t.height),e.restore())},e.prototype.adjustContentLayoutArea=function(e){var t=new g.RectangleF(new g.PointF(e.x,e.y),new g.SizeF(e.width,e.height)),i=this.style.padding;if(this.value instanceof Jt){var a=this.value.size;this.style.format.alignment===g.PdfTextAlignment.Center?(t.x+=i.left+(t.width-a.width)/2,t.y+=i.top+(t.height-a.height)/2):this.style.format.alignment===g.PdfTextAlignment.Left?(t.x+=i.left,t.y+=i.top):this.style.format.alignment===g.PdfTextAlignment.Right&&(t.x+=i.left+(t.width-a.width),t.y+=i.top)}else t.x+=i.left,t.y+=i.top;return t},e.prototype.drawCellBorder=function(e,t){if(this.row.treegrid.style.borderOverlapStyle===g.PdfBorderOverlapStyle.Inside&&(t.x+=this.style.borders.left.width,t.y+=this.style.borders.top.width,t.width-=this.style.borders.right.width,t.height-=this.style.borders.bottom.width),this.style.borders.isAll&&this.isHeaderCell)return e.drawRectangle(this.style.borders.left,t.x,t.y,t.width,t.height),void e.restore();var i=new g.PointF(t.x,t.y+t.height),a=new g.PointF(t.x,t.y),r=this.style.borders.left;r.lineCap=this.style.borders.left.dashStyle===g.PdfDashStyle.Solid?g.PdfLineCap.Square:r.lineCap,e.drawLine(r,i,a),e.restore(),i=new g.PointF(t.x+t.width,t.y),a=new g.PointF(t.x+t.width,t.y+t.height),r=this.style.borders.right,t.x+t.width>e.clientSize.width-r.width/2&&(i=new g.PointF(e.clientSize.width-r.width/2,t.y),a=new g.PointF(e.clientSize.width-r.width/2,t.y+t.height)),r.lineCap=this.style.borders.right.dashStyle===g.PdfDashStyle.Solid?g.PdfLineCap.Square:r.lineCap,e.drawLine(r,i,a),e.restore(),i=new g.PointF(t.x,t.y),a=new g.PointF(t.x+t.width,t.y),(r=this.style.borders.top).lineCap=this.style.borders.top.dashStyle===g.PdfDashStyle.Solid?g.PdfLineCap.Square:r.lineCap,e.drawLine(r,i,a),e.restore(),i=new g.PointF(t.x+t.width,t.y+t.height),a=new g.PointF(t.x,t.y+t.height),r=this.style.borders.bottom,t.y+t.height>e.clientSize.height-r.width/2&&(i=new g.PointF(t.x+t.width,e.clientSize.height-r.width/2),a=new g.PointF(t.x,e.clientSize.height-r.width/2)),r.lineCap=this.style.borders.bottom.dashStyle===g.PdfDashStyle.Solid?g.PdfLineCap.Square:r.lineCap,e.drawLine(r,i,a),e.restore()},e}(),ti=function(){function e(e){this.treegridRow=e,this.cells=[]}return e.prototype.getCell=function(e){if(e<0||e>=this.count)throw new Error("IndexOutOfRangeException");return this.cells[e]},Object.defineProperty(e.prototype,"count",{get:function(){return this.cells.length},enumerable:!0,configurable:!0}),e.prototype.add=function(e){if(void 0===e){var t=new ei;return this.add(t),e}e.row=this.treegridRow,this.cells.push(e)},e.prototype.indexOf=function(e){return this.cells.indexOf(e)},e}(),ii=function(){function e(e){this.treegridRowOverflowIndex=0,this.rowHeight=0,this.rowWidth=0,this._isParentRow=!1,this.intendLevel=0,this.pdfTreeGrid=e}return Object.defineProperty(e.prototype,"cells",{get:function(){return t.isNullOrUndefined(this.treegridCells)&&(this.treegridCells=new ti(this)),this.treegridCells},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isParentRow",{get:function(){return this._isParentRow},set:function(e){this._isParentRow=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"treegrid",{get:function(){return this.pdfTreeGrid},set:function(e){this.pdfTreeGrid=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowBreakHeight",{get:function(){return void 0===this.treegridRowBreakHeight&&(this.treegridRowBreakHeight=0),this.treegridRowBreakHeight},set:function(e){this.treegridRowBreakHeight=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowOverflowIndex",{get:function(){return this.treegridRowOverflowIndex},set:function(e){this.treegridRowOverflowIndex=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"level",{get:function(){return this.intendLevel},set:function(e){this.intendLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return 0===this.rowHeight&&(this.rowHeight=this.measureHeight()),this.rowHeight},set:function(e){this.rowHeight=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return 0===this.rowWidth&&(this.rowWidth=this.measureWidth()),this.rowWidth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowIndex",{get:function(){return this.treegrid.rows.rowCollection.indexOf(this)},enumerable:!0,configurable:!0}),e.prototype.measureWidth=function(){for(var e=this.treegrid.columns.columns,t=0,i=0;i<e.length;i++)t+=e[i].width;return t},e.prototype.measureHeight=function(){for(var e=0===this.cells.count||t.isNullOrUndefined(this.cells.getCell(0).height)?33:this.cells.getCell(0).height,i=0;i<this.cells.count;i++){var a=this.cells.getCell(i);e=1===a.columnSpan||1===a.rowSpan?Math.max(e,a.height):Math.min(e,a.height),a.height=e}return e},e}(),ai=function(){function e(e){this.rows=[],this.treegrid=e}return Object.defineProperty(e.prototype,"count",{get:function(){return this.rows.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowCollection",{get:function(){return this.rows},enumerable:!0,configurable:!0}),e.prototype.addRow=function(e){if(void 0===e){var t=new ii(this.treegrid);return this.addRow(t),t}if(0===e.cells.count)for(var i=0;i<this.treegrid.columns.count;i++)e.cells.add(new ei);this.rows.push(e)},e.prototype.getRow=function(e){return this.rows[e]},e}(),ri=function(){function e(e){this.rows=[],this.treegrid=e,this.rows=[]}return e.prototype.getHeader=function(e){return this.rows[e]},Object.defineProperty(e.prototype,"count",{get:function(){return this.rows.length},enumerable:!0,configurable:!0}),e.prototype.add=function(e){this.rows.push(e)},e.prototype.indexOf=function(e){return this.rows.indexOf(e)},e}(),ni=function(){function e(e){this.columnWidth=0,this.treeColumnIndex=!1,this._headerText="",this._field="",this.treegrid=e}return Object.defineProperty(e.prototype,"headerText",{get:function(){return this._headerText},set:function(e){this._headerText=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"field",{get:function(){return this._field},set:function(e){this._field=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.columnWidth},set:function(e){this.columnWidth=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isTreeColumn",{get:function(){return this.treeColumnIndex},set:function(e){this.treeColumnIndex=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"format",{get:function(){return t.isNullOrUndefined(this.stringFormat)&&(this.stringFormat=new g.PdfStringFormat),this.stringFormat},set:function(e){this.stringFormat=e},enumerable:!0,configurable:!0}),e}(),si=function(){function e(e){this.internalColumns=[],this.columnWidth=0,this.treegrid=e,this.internalColumns=[]}return e.prototype.add=function(e){for(var t=0;t<e;t++){this.internalColumns.push(new ni(this.treegrid));for(var i=0;i<this.treegrid.rows.count;i++){var a=this.treegrid.rows.getRow(i),r=new ei;r.value="",a.cells.add(r)}}},Object.defineProperty(e.prototype,"count",{get:function(){return this.internalColumns.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return 0===this.columnWidth&&(this.columnWidth=this.measureColumnsWidth()),this.columnWidth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columns",{get:function(){return this.internalColumns},enumerable:!0,configurable:!0}),e.prototype.getColumn=function(e){if(e>=0&&e<=this.columns.length)return this.columns[e];throw Error("can not get the column from the index: "+e)},e.prototype.measureColumnsWidth=function(){var e=0;this.treegrid.measureColumnsWidth();for(var t=0,i=this.internalColumns.length;t<i;t++)e+=this.internalColumns[t].width;return e},e.prototype.getDefaultWidths=function(e){for(var t=[],i=this.count,a=0;a<this.count;a++)t[a]=this.internalColumns[a].width,this.internalColumns[a].width>0?(e-=this.internalColumns[a].width,i--):t[a]=0;for(a=0;a<this.count;a++){var r=e/i;t[a]<=0&&(t[a]=r)}return t},e}(),oi=function(){return(oi=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)},li=function(){function e(e){this.totalColumnWidth=0,this.beforeSinglePageExport={},this.baselineHeight=8,this.parent=e}return e.prototype.processToFit=function(){this.beforeSinglePageExport.zoomingProjectStartDate=this.parent.zoomingProjectStartDate,this.beforeSinglePageExport.zoomingProjectEndDate=this.parent.zoomingProjectEndDate,this.beforeSinglePageExport.cloneProjectStartDate=this.parent.cloneProjectStartDate,this.beforeSinglePageExport.cloneProjectEndDate=this.parent.cloneProjectEndDate,this.beforeSinglePageExport.customTimelineSettings=t.extend({},this.parent.timelineModule.customTimelineSettings,null,!0),this.beforeSinglePageExport.isTimelineRoundOff=this.parent.isTimelineRoundOff,this.beforeSinglePageExport.topTier=this.parent.timelineModule.topTier,this.beforeSinglePageExport.topTierCellWidth=this.parent.timelineModule.topTierCellWidth,this.beforeSinglePageExport.topTierCollection=this.parent.timelineModule.topTierCollection,this.beforeSinglePageExport.bottomTier=this.parent.timelineModule.bottomTier,this.beforeSinglePageExport.bottomTierCellWidth=this.parent.timelineModule.bottomTierCellWidth,this.beforeSinglePageExport.bottomTierCollection=this.parent.timelineModule.bottomTierCollection,this.beforeSinglePageExport.totalTimelineWidth=this.parent.timelineModule.totalTimelineWidth,this.beforeSinglePageExport.timelineStartDate=this.parent.timelineModule.timelineStartDate,this.beforeSinglePageExport.timelineEndDate=this.parent.timelineModule.timelineEndDate,this.beforeSinglePageExport.timelineRoundOffEndDate=this.parent.timelineModule.timelineRoundOffEndDate,this.beforeSinglePageExport.perDayWidth=this.parent.perDayWidth,this.beforeSinglePageExport.updatedConnectorLineCollection=t.extend([],this.parent.updatedConnectorLineCollection,null,!0),this.parent.timelineModule.isZoomToFit=!0,this.parent.timelineModule.isZooming=!1,this.parent.zoomingProjectStartDate||(this.parent.zoomingProjectStartDate=this.parent.cloneProjectStartDate,this.parent.zoomingProjectEndDate=this.parent.cloneProjectEndDate),this.parent.zoomingProjectStartDate>this.parent.cloneProjectStartDate&&(this.parent.cloneProjectStartDate=new Date(this.parent.allowUnscheduledTasks?this.parent.zoomingProjectStartDate:this.parent.cloneProjectStartDate)),t.isNullOrUndefined(this.parent.projectStartDate)&&t.isNullOrUndefined(this.parent.projectEndDate)&&this.parent.dataOperation.calculateProjectDates();var e,i,a=(this.parent.cloneProjectEndDate.getTime()-this.parent.cloneProjectStartDate.getTime())/864e5;this.exportProps.fitToWidthSettings.gridWidth&&(i=(i=parseInt(this.exportProps.fitToWidthSettings.gridWidth.split("%")[0],10))>100?100:i),e=this.exportProps.fitToWidthSettings.chartWidth?(e=parseInt(this.exportProps.fitToWidthSettings.chartWidth.split("%")[0],10))>100?100:e:this.exportProps.fitToWidthSettings.gridWidth?100-i:70;var r,n,s,o=this.parent.pdfExportModule.pdfPageDimensions.width*e/100,l=o/a,d=this.parent.zoomingLevels.slice().sort(function(e,t){return e.perDayWidth||t.perDayWidth?e.perDayWidth<t.perDayWidth?1:-1:0});if(0!==l){for(var h=0;h<d.length;h++){if(n=d[h],h===d.length-1){r=d[h];break}if(s=d[h+1],l>=n.perDayWidth){r=d[h];break}if(l<n.perDayWidth&&l>s.perDayWidth){r=d[h+1];break}}var p=t.extend({},{},r,!0);t.isNullOrUndefined(this.parent.projectStartDate)&&this.parent.timelineModule.roundOffDateToZoom(this.parent.cloneProjectStartDate,!0,l,p.bottomTier.unit,r),t.isNullOrUndefined(this.parent.projectEndDate)&&this.parent.timelineModule.roundOffDateToZoom(this.parent.cloneProjectEndDate,!1,l,p.bottomTier.unit,r);var u=this.parent.timelineModule.calculateNumberOfTimelineCells(p),c=this.parent.pdfExportModule.pdfPageDimensions.height<=0?0:17;p.timelineUnitSize=Math.abs(o-c)/u,this.parent.timelineModule.changeTimelineSettings(p),this.parent.timelineModule.isZoomToFit=!1,this.parent.timelineModule.isZooming=!1}},e.prototype.processGridExport=function(e,t,i){this.flatData=e,this.gantt=t,this.exportValueFormatter=new di(this.parent.locale),this.exportProps=i,this.rowIndex=0,this.colIndex=0,this.columns=this.parent.treeGrid.columns,this.gantt.treeColumnIndex=this.parent.treeColumnIndex,this.gantt.rowHeight=C(this.parent.rowHeight),this.gantt.style.cellPadding.left=0,this.gantt.style.cellPadding.right=0,this.ganttStyle=this.gantt.ganttStyle,this.gantt.borderColor=this.ganttStyle.chartGridLineColor,this.parent.pdfExportModule.isPdfExport=!0,this.exportProps.fitToWidthSettings&&this.exportProps.fitToWidthSettings.isFitToWidth&&this.processToFit(),this.processHeaderContent(),this.processGanttContent(),this.processTimeline(),this.processTaskbar(),this.processPredecessor(),this.parent.pdfExportModule.isPdfExport=!1},e.prototype.processHeaderContent=function(){var e=this;this.rowIndex++,this.row=this.gantt.rows.addRow();var t=0;this.columns.forEach(function(i){e.isColumnVisible(i)&&(e.processColumnHeader(i,t),t++)})},e.prototype.processColumnHeader=function(e,i){this.gantt.columns.add(1);var a=this.gantt.columns.getColumn(i);this.columns[this.parent.treeColumnIndex].field===e.field&&(a.isTreeColumn=!0);var r=parseInt(e.width,10);a.width=C(r),this.totalColumnWidth+=a.width,a.headerText=e.headerText,a.field=e.field;var n=this.row.cells.getCell(i);n.value=e.headerText,n.isHeaderCell=!0,this.ganttStyle&&this.ganttStyle.columnHeader&&!t.isNullOrUndefined(this.ganttStyle.columnHeader.fontBrush)&&(n.style.fontBrush=new g.PdfColor(this.ganttStyle.columnHeader.fontBrush));var s=this.parent.timelineModule.isSingleTier?45:60;this.copyStyles(this.ganttStyle.columnHeader,n,!1),this.row.height=C(s),e.headerTextAlign&&(n.style.format.alignment=g.PdfTextAlignment[e.headerTextAlign]);var o={image:null,value:null,fontStyle:{fontBrush:null}};n.fontStyle={fontSize:9};var l={cell:n,style:n.style,value:n.value,column:e,image:null,headerTemplate:o};this.parent.pdfColumnHeaderQueryCellInfo&&this.parent.trigger("pdfColumnHeaderQueryCellInfo",l),l.headerTemplate.image&&l.headerTemplate.value?(l.image=new g.PdfBitmap(l.headerTemplate.image[0].base64),l.image.height=l.headerTemplate.image[0].height||l.image.height,l.image.width=l.headerTemplate.image[0].width||l.image.width,n.image=l.image,n.value=l.headerTemplate.value,n.fontStyle.fontSize=l.headerTemplate.fontStyle.fontSize,n.fontStyle.fontFamily=l.headerTemplate.fontStyle.fontFamily,n.fontStyle.fontBrush=l.headerTemplate.fontStyle.fontColor):n.value=l.value},e.prototype.isColumnVisible=function(e){return e.visible||this.exportProps.includeHiddenColumn},e.prototype.processGanttContent=function(){var e=this;0===this.flatData.length?this.renderEmptyGantt():this.flatData.forEach(function(t){e.row=e.gantt.rows.addRow(),t.hasChildRecords?(e.gantt.rows.getRow(e.rowIndex).isParentRow=!0,e.processRecordRow(t)):e.processRecordRow(t),e.rowIndex++})},e.prototype.processTimeline=function(){this.parent.enableTimelineVirtualization&&(this.parent.timelineModule.pdfExportTopTierCollection=[],this.parent.timelineModule.pdfExportBottomTierCollection=[],this.parent.timelineModule.createTimelineSeries());var e=this.parent.timelineModule;if(this.gantt.chartHeader.topTierHeight=this.gantt.chartHeader.bottomTierHeight=this.parent.timelineModule.isSingleTier?45:30,this.gantt.chartHeader.topTierCellWidth=e.topTierCellWidth,this.gantt.chartHeader.bottomTierCellWidth=e.bottomTierCellWidth,this.gantt.chartHeader.topTier=t.extend([],[],this.parent.enableTimelineVirtualization?e.pdfExportTopTierCollection:e.topTierCollection,!0),this.gantt.chartHeader.bottomTier=t.extend([],[],this.parent.enableTimelineVirtualization?e.pdfExportBottomTierCollection:e.bottomTierCollection,!0),this.exportProps&&this.exportProps.fitToWidthSettings&&this.exportProps.fitToWidthSettings.isFitToWidth&&this.parent.enableTimelineVirtualization){var i="None"===e.topTier?"bottomTier":"topTier";this.gantt.chartHeader.width=e.calculateWidthBetweenTwoDate(i,e.timelineStartDate,e.timelineEndDate)}else this.gantt.chartHeader.width=this.parent.enableTimelineVirtualization?this.parent.timelineModule.wholeTimelineWidth:e.totalTimelineWidth;this.gantt.chartHeader.height=t.isNullOrUndefined(this.gantt.rows.getRow(0).height)?65:this.gantt.rows.getRow(0).height,this.gantt.timelineStartDate=new Date(e.timelineStartDate.getTime())},e.prototype.processPredecessor=function(){var e=this;(t.isNullOrUndefined(this.exportProps.showPredecessorLines)||this.exportProps.showPredecessorLines)&&(this.parent.pdfExportModule.isPdfExport=!0,this.parent.predecessorModule.createConnectorLinesCollection(this.flatData),this.parent.updatedConnectorLineCollection.forEach(function(t){var i=e.gantt.predecessor.add();i.parentLeft=t.parentLeft,i.childLeft=t.childLeft,i.parentWidth=t.parentWidth,i.childWidth=t.childWidth,i.parentIndex=e.findIndexUsingParent(e.flatData,t.parentIndex),i.childIndex=e.findIndexUsingParent(e.flatData,t.childIndex),i.rowHeight=t.rowHeight,i.type=t.type,i.milestoneParent=t.milestoneParent,i.milestoneChild=t.milestoneChild,i.parentEndPoint=t.parentEndPoint,i.lineWidth=C(e.parent.connectorLineWidth>5?5:e.parent.connectorLineWidth),t.isCritical?i.connectorLineColor=e.ganttStyle.criticalConnectorLineColor:i.connectorLineColor=e.ganttStyle.connectorLineColor,e.gantt.predecessorCollection.push(i)}),this.parent.pdfExportModule.isPdfExport=!1)},e.prototype.findIndexUsingParent=function(e,t){return e.findIndex(function(e){return e.index===t})},e.prototype.processRecordRow=function(e){var t=this;this.colIndex=0,this.row.level=e.level,this.columns.forEach(function(i){t.isColumnVisible(i)&&(t.processRecordCell(e,i,t.row),t.colIndex++)})},e.prototype.processRecordCell=function(e,i,a){var r=a.cells.getCell(this.colIndex),n=this.parent.taskFields,s=e.ganttProperties;"datepickeredit"===i.editType||"datetimepickeredit"===i.editType?r.value=e[i.field]:i.field===n.duration?r.value=this.parent.getDurationString(s.duration,s.durationUnit):i.field===n.baselineDuration?r.value=this.parent.getDurationString(s.baselineDuration,s.durationUnit):i.field===n.resourceInfo?r.value=s.resourceNames:i.field===n.work?r.value=this.parent.getWorkString(s.work,s.workUnit):r.value=t.isNullOrUndefined(e[i.field])?"":"number"===i.type?e[i.field]:e[i.field].toString();var o=t.isNullOrUndefined(r.value)?"":"number"===i.type?r.value:r.value.toString(),l=t.isNullOrUndefined(o)?"":o;r.isHeaderCell=!1,r.style.padding=new qt,this.copyStyles(this.ganttStyle.cell,r,a.isParentRow),i.index!==this.parent.treeColumnIndex?r.style.format.alignment=g.PdfTextAlignment[i.textAlign]:r.style.format.paragraphIndent=10*r.row.level;var d={data:e,value:l,column:i,style:r.style,cell:r};if(d.value=this.exportValueFormatter.formatCellValue(d,this.parent),this.parent.pdfQueryCellInfo){if(this.parent.trigger("pdfQueryCellInfo",d),d.style.backgroundColor&&(r.style.backgroundColor=d.style.backgroundColor),d.style.borderColor&&(r.style.borderColor=d.style.borderColor),d.style.fontBrush&&(r.style.fontBrush=d.style.fontBrush),d.style.fontColor&&(r.style.fontColor=d.style.fontColor),d.style.fontFamily){var h=d.style.fontFamily,p=this.getFontFamily(h);r.style.fontFamily=p}else r.style.fontFamily=this.ganttStyle.fontFamily;if(d.style.fontSize&&(r.style.fontSize=d.style.fontSize),d.style.fontStyle){var u=d.style.fontStyle,c=this.getFontStyle(u);r.style.fontStyle=c}else r.style.fontStyle=this.ganttStyle.footer.fontStyle;d.style.format&&(r.style.format=d.style.format),d.style.padding&&(r.style.padding=d.style.padding)}if(!t.isNullOrUndefined(d.image)&&!t.isNullOrUndefined(d.image.base64)){var f=t.extend({},d.image,null,!0);d.image=new g.PdfBitmap(d.image.base64),d.image.height=f.height?f.height:d.image.height,d.image.width=f.width?f.width:d.image.width,r.image=d.image}r.value=d.value,t.isNullOrUndefined(d.hyperLink)||t.isNullOrUndefined(d.hyperLink.displayText)&&t.isNullOrUndefined(d.hyperLink.target)||(r.value=this.setHyperLink(d))},e.prototype.setHyperLink=function(e){var t=new g.PdfTextWebLink;return t.url=e.hyperLink.target,t.text=e.hyperLink.displayText||e.hyperLink.target,t.font=new g.PdfStandardFont(g.PdfFontFamily.Helvetica,9.75),t.brush=new g.PdfSolidBrush(new g.PdfColor(51,102,187)),t},e.prototype.processTaskbar=function(){var e=this;this.flatData.forEach(function(i){var a=e.gantt.taskbar.add(),r=i.ganttProperties;a.left=r.left,a.width=r.width,a.left<0&&(a.width=a.width+a.left,a.left=0),a.progress=r.progress,a.isScheduledTask=m(r),m&&(t.isNullOrUndefined(r.endDate)&&t.isNullOrUndefined(r.duration)?a.unscheduledTaskBy="startDate":t.isNullOrUndefined(r.startDate)&&t.isNullOrUndefined(r.duration)?a.unscheduledTaskBy="endDate":(a.unscheduledTaskBy="duration",a.unscheduleStarteDate=e.parent.dateValidationModule.getValidStartDate(i.ganttProperties),a.unscheduleEndDate=e.parent.dateValidationModule.getValidEndDate(i.ganttProperties))),a.startDate=r.startDate,a.endDate=r.endDate,a.height=e.parent.chartRowsModule.taskBarHeight,a.indicators=r.indicators,a.autoStartDate=r.autoStartDate,a.autoEndDate=r.autoEndDate,a.isAutoSchedule=r.isAutoSchedule,a.autoWidth=r.autoWidth,a.autoLeft=r.autoLeft,a.segment=r.segments,a.isSpliterTask=!t.isNullOrUndefined(r.segments)&&0!==r.segments.length,a.isSpliterTask&&(a.segmentCollection=a.segment.map(function(e){return oi({},e)})),a.baselineTop=e.parent.chartRowsModule.baselineTop,a.isMilestone=r.isMilestone,a.baselineStartDate=r.baselineStartDate,a.baselineEndDate=r.baselineEndDate,a.baselineLeft=r.baselineLeft,a.baselineWidth=r.baselineWidth,a.baselineLeft<0&&(a.baselineWidth=a.baselineWidth+a.baselineLeft,a.baselineLeft=0),a.milestoneColor=new g.PdfColor(e.ganttStyle.taskbar.milestoneColor),a.isParentTask=i.hasChildRecords,r.isMilestone&&(a.height=r.width),i[e.parent.labelSettings.leftLabel]&&(a.leftTaskLabel.value=i[e.parent.labelSettings.leftLabel].toString()),i[e.parent.labelSettings.rightLabel]&&(a.rightTaskLabel.value=i[e.parent.labelSettings.rightLabel].toString()),t.isNullOrUndefined(i[e.parent.labelSettings.taskLabel])||(a.taskLabel=i[e.parent.labelSettings.taskLabel].toString());var n=r.isMilestone?Math.floor(e.parent.chartRowsModule.taskBarHeight/2)+33:33,s=!(i.hasChildRecords&&!i.ganttProperties.isAutoSchedule),o=s?r.left:r.autoLeft,l=s?r.width:r.autoWidth;a.rightTaskLabel.left=o+l+n,a.fontFamily=e.ganttStyle.fontFamily,a.progressWidth=r.progressWidth,a.labelColor=new g.PdfColor(e.ganttStyle.label.fontColor),a.progressFontColor=new g.PdfColor(e.ganttStyle.taskbar.progressFontColor),a.isParentTask?(a.taskColor=new g.PdfColor(e.ganttStyle.taskbar.parentTaskColor),a.taskBorderColor=new g.PdfColor(e.ganttStyle.taskbar.parentTaskBorderColor),a.progressColor=new g.PdfColor(e.ganttStyle.taskbar.parentProgressColor)):i.isCritical?(a.taskColor=new g.PdfColor(e.ganttStyle.taskbar.criticalTaskColor),a.progressColor=new g.PdfColor(e.ganttStyle.taskbar.criticalProgressColor),a.taskBorderColor=new g.PdfColor(e.ganttStyle.taskbar.criticalTaskBorderColor),a.milestoneColor=new g.PdfColor(e.ganttStyle.taskbar.criticalTaskColor)):(a.taskColor=new g.PdfColor(e.ganttStyle.taskbar.taskColor),a.progressColor=new g.PdfColor(e.ganttStyle.taskbar.progressColor),a.taskBorderColor=new g.PdfColor(e.ganttStyle.taskbar.taskBorderColor)),a.manualParentBorder=new g.PdfColor(e.ganttStyle.taskbar.manualParentBorder),a.manualChildBorder=new g.PdfColor(e.ganttStyle.taskbar.manualChildBorder),a.manuallineColor=new g.PdfColor(e.ganttStyle.taskbar.manualLineColor),a.unscheduledTaskBarColor=new g.PdfColor(e.ganttStyle.taskbar.unscheduledTaskBarColor),a.manualParentBackground=new g.PdfColor(e.ganttStyle.taskbar.manualParentBackground),a.manualParentProgress=new g.PdfColor(e.ganttStyle.taskbar.manualParentProgress),a.manualChildBackground=new g.PdfColor(e.ganttStyle.taskbar.manualChildBackground),a.manualChildProgress=new g.PdfColor(e.ganttStyle.taskbar.manualChildProgress),a.splitLineBackground=new g.PdfColor(e.ganttStyle.taskbar.splitLineBackground),a.baselineColor=new g.PdfColor(e.ganttStyle.taskbar.baselineColor),a.baselineBorderColor=new g.PdfColor(e.ganttStyle.taskbar.baselineBorderColor),a.gridLineColor=new g.PdfColor(e.ganttStyle.chartGridLineColor);var d={};d.leftLabel={value:null,image:null,fontStyle:{fontBrush:null}},d.rightLabel={value:null,image:null,fontStyle:{fontBrush:null}},d.taskLabel={value:null,image:null,fontStyle:{fontBrush:null}},a.labelSettings=d;var h={value:null,image:null,fontStyle:{fontBrush:null}};a.taskbarTemplate=h,e.gantt.taskbarCollection.push(a);var p={};p.progressFontColor=a.progressFontColor,p.taskColor=a.taskColor,p.taskBorderColor=a.taskBorderColor,p.progressColor=a.progressColor,p.milestoneColor=a.milestoneColor,p.baselineColor=a.baselineColor,p.baselineBorderColor=a.baselineBorderColor,p.unscheduledTaskBarColor=a.unscheduledTaskBarColor,p.manualParentBackground=a.manualParentBackground,p.manualParentBorder=a.manualParentBorder,p.manualParentProgress=a.manualParentProgress,p.manualChildBackground=a.manualChildBackground,p.manualChildProgress=a.manualChildProgress,p.manualLineColor=a.manuallineColor,p.manualChildBorder=a.manualChildBorder,p.manualChildProgress=a.manualChildProgress,p.splitLineBackground=a.splitLineBackground;var u={taskbar:p,data:i,indicators:i.ganttProperties.indicators,labelSettings:d,taskbarTemplate:h};if(e.parent.pdfQueryTaskbarInfo){var c=[];if(u.taskbar.taskSegmentStyles=null,u.data.ganttProperties.segments){for(k=0;k<u.data.ganttProperties.segments.length;k++){var f={taskColor:u.taskbar.taskColor,taskBorderColor:u.taskbar.taskBorderColor,progressColor:u.taskbar.progressColor};c.push(f)}u.taskbar.taskSegmentStyles=c}e.parent.trigger("pdfQueryTaskbarInfo",u),a.taskSegmentStyles=u.taskbar.taskSegmentStyles,a.progressFontColor=u.taskbar.progressFontColor,a.taskColor=u.taskbar.taskColor,a.taskBorderColor=u.taskbar.taskBorderColor,a.progressColor=u.taskbar.progressColor,a.milestoneColor=u.taskbar.milestoneColor,a.baselineColor=u.taskbar.baselineColor,a.baselineBorderColor=u.taskbar.baselineBorderColor,a.unscheduledTaskBarColor=u.taskbar.unscheduledTaskBarColor,a.manualParentBackground=u.taskbar.manualParentBackground,a.manualParentProgress=u.taskbar.manualParentProgress,a.manualParentBorder=u.taskbar.manualParentBorder,a.manualChildBackground=u.taskbar.manualChildBackground,a.manualChildProgress=u.taskbar.manualChildProgress,a.manuallineColor=u.taskbar.manualLineColor,a.manualChildBorder=u.taskbar.manualChildBorder,a.manualChildProgress=u.taskbar.manualChildProgress,a.splitLineBackground=u.taskbar.splitLineBackground,a.indicators=u.indicators,a.labelSettings.leftLabel.value=u.labelSettings.leftLabel.value;var y=u.labelSettings.leftLabel.image;a.labelSettings.rightLabel.value=u.labelSettings.rightLabel.value;var D=u.labelSettings.rightLabel.image;if(t.isNullOrUndefined(u.labelSettings.taskLabel.value)||(a.taskLabel=u.labelSettings.taskLabel.value),!t.isNullOrUndefined(u.labelSettings.leftLabel.image)&&Array.isArray(u.labelSettings.leftLabel.image[0].base64)&&u.labelSettings.leftLabel.image[0].base64.length>0){v=u.labelSettings.leftLabel.image[0].base64.length;a.labelSettings.leftLabel.image=[];for(k=0;k<v;k++)a.labelSettings.leftLabel.image.push({base64:y[0].base64[k],width:y[0].width,height:y[0].height})}else t.isNullOrUndefined(u.labelSettings.leftLabel.image)||(a.labelSettings.leftLabel.image=u.labelSettings.leftLabel.image);if(!t.isNullOrUndefined(u.labelSettings.rightLabel.image)&&Array.isArray(u.labelSettings.rightLabel.image[0].base64)&&u.labelSettings.rightLabel.image[0].base64.length>0){var v=u.labelSettings.rightLabel.image[0].base64.length;a.labelSettings.rightLabel.image=[];for(var k=0;k<v;k++)a.labelSettings.rightLabel.image.push({base64:D[0].base64[k],width:D[0].width,height:D[0].height})}else t.isNullOrUndefined(u.labelSettings.rightLabel.image)||(a.labelSettings.rightLabel.image=u.labelSettings.rightLabel.image);var b=function(i,r){if(i.progressFontColor=r.taskbar.progressFontColor,i.taskColor=new g.PdfColor(r.taskbar.taskColor),i.taskBorderColor=r.taskbar.taskBorderColor,i.progressColor=r.taskbar.progressColor,i.milestoneColor=r.taskbar.milestoneColor,!t.isNullOrUndefined(r.taskbarTemplate.image)&&!t.isNullOrUndefined(r.taskbarTemplate.image[0].base64)){var n=r.taskbarTemplate.image[0].width,s=a.isMilestone&&r.taskbarTemplate.image[0].height<.7*e.parent.chartRowsModule.taskBarHeight?r.taskbarTemplate.image[0].height:.7*e.parent.chartRowsModule.taskBarHeight-2,o=t.isNullOrUndefined(r.taskbarTemplate.image[0].height)?a.height-2:r.taskbarTemplate.image[0].height<a.height?r.taskbarTemplate.image[0].height:a.height-2,l=a.isMilestone?s:o;i.taskbarTemplate.image=r.taskbarTemplate.image,i.taskbarTemplate.image[0].width=n,i.taskbarTemplate.image[0].height=l}t.isNullOrUndefined(r.taskbarTemplate.value)||(i.taskbarTemplate.value=r.taskbarTemplate.value,i.taskbarTemplate.value=r.taskbarTemplate.value,i.taskbarTemplate.fontStyle.fontColor=r.taskbarTemplate.fontStyle.fontColor,i.taskbarTemplate.fontStyle.fontSize=r.taskbarTemplate.fontStyle.fontSize,i.taskbarTemplate.fontStyle.fontFamily=r.taskbarTemplate.fontStyle.fontFamily,i.taskbarTemplate.fontStyle.fontStyle=r.taskbarTemplate.fontStyle.fontStyle,i.taskbarTemplate.fontStyle.fontBrush=r.taskbarTemplate.fontStyle.fontBrush)};u.data.hasChildRecords||0===u.data.ganttProperties.duration?u.data.hasChildRecords&&0!==u.data.ganttProperties.duration?b(a,u):0===u.data.ganttProperties.duration&&b(a,u):b(a,u)}})},e.prototype.getHorizontalAlignment=function(e,t){switch(void 0===t&&(t=new g.PdfStringFormat),e){case"Right":t.alignment=g.PdfTextAlignment.Right;break;case"Center":t.alignment=g.PdfTextAlignment.Center;break;case"Justify":t.alignment=g.PdfTextAlignment.Justify;break;case"Left":t.alignment=g.PdfTextAlignment.Left}return t},e.prototype.getVerticalAlignment=function(e,t,i){switch(void 0===t&&(t=new g.PdfStringFormat,t=this.getHorizontalAlignment(i,t)),e){case"Bottom":t.lineAlignment=g.PdfVerticalAlignment.Bottom;break;case"Middle":t.lineAlignment=g.PdfVerticalAlignment.Middle;break;case"Top":t.lineAlignment=g.PdfVerticalAlignment.Top}return t},e.prototype.getFontFamily=function(e){switch(e){case"TimesRoman":return 2;case"Courier":return 1;case"Symbol":return 3;case"ZapfDingbats":return 4;default:return 0}},e.prototype.getFontStyle=function(e){switch(e){case"Strikeout":return 8;case"Underline":return 4;case"Italic":return 2;case"Bold":return 1;default:return 0}},e.prototype.getFont=function(e){if(e.font)return e.font;var i=this.exportProps.ganttStyle&&this.exportProps.ganttStyle.fontFamily?this.exportProps.ganttStyle.fontFamily:g.PdfFontFamily.TimesRoman,a=t.isNullOrUndefined(e.style.fontSize)?9.75:.75*e.style.fontSize,r=t.isNullOrUndefined(e.style.fontFamily)?i:this.getFontFamily(e.style.fontFamily),n=g.PdfFontStyle.Regular;return new g.PdfStandardFont(r,a,n)},e.prototype.renderEmptyGantt=function(){var e=this.gantt.rows.addRow();0===e.cells.count&&e.cells.add(),e.cells.getCell(0).isHeaderCell=!1,e.height=C(this.parent.rowHeight),this.copyStyles(this.ganttStyle.columnHeader,e.cells.getCell(0),e.isParentRow);var t=this.columns.length;e.cells.getCell(0).value=this.parent.localeObj.getConstant("emptyRecord"),this.mergeCells(1,0,t)},e.prototype.mergeCells=function(e,t,i){this.gantt.rows.getRow(e).cells.getCell(t).columnSpan=i},e.prototype.copyStyles=function(e,t,i){t.style.fontColor=new g.PdfColor(e.fontColor),t.style.backgroundColor=new g.PdfColor(e.backgroundColor),t.style.borderColor=new g.PdfColor(e.borderColor),t.style.fontSize=e.fontSize,t.style.fontStyle=e.fontStyle,t.style.format=Object.assign(new g.PdfStringFormat,e.format),t.style.borders=new Gt,t.style.borders.all=new g.PdfPen(t.style.borderColor),t.style.padding=new qt;var a=0;t.isHeaderCell?(a=this.parent.timelineModule.isSingleTier?22.5:30,t.style.padding.top=a-e.fontSize>0?a-e.fontSize:a):(a=this.parent.rowHeight/2,t.style.padding.top=a),t.style.padding.bottom=a-e.fontSize>0?a-e.fontSize:0,t.style.padding.left=10,t.style.padding.right=10,e.padding&&(t.style.padding=e.padding),e.borders&&(t.style.borders=e.borders)},e.prototype.initializePdf=function(e){this.pdfDoc=e;var i=[],a=this.pdfDoc.pageSettings.width-82;if(this.exportProps&&this.exportProps.fitToWidthSettings&&this.exportProps.fitToWidthSettings.isFitToWidth){var r=void 0;r=this.exportProps.fitToWidthSettings.gridWidth?parseInt(this.exportProps.fitToWidthSettings.gridWidth.split("%")[0],10):this.exportProps.fitToWidthSettings.chartWidth?100-parseInt(this.exportProps.fitToWidthSettings.chartWidth.split("%")[0],10):30;for(var n=this.parent.pdfExportModule.pdfPageDimensions.width*r/100/this.gantt.columns.columns.length,s=0;s<this.gantt.columns.columns.length;s++)this.gantt.columns.getColumn(s).width=n}var o=this.parent.pdfExportModule.pdfPage;if(this.totalColumnWidth>this.pdfDoc.pageSettings.width-82&&this.totalColumnWidth<o.getClientSize().width?this.gantt.style.allowHorizontalOverflow=!0:a/this.columns.length<i[0]&&(this.gantt.columns.getColumn(0).width=i[0]),this.exportProps.enableFooter||t.isNullOrUndefined(this.exportProps.enableFooter)){var l=this.parent.pdfExportModule.getPageSize(this.exportProps.pageSize),d=new g.RectangleF(0,0,l.width,35),h=new g.PdfPen(this.ganttStyle.footer.borderColor),p=new g.PdfPageTemplateElement(d),u=new g.PdfSolidBrush(this.ganttStyle.footer.backgroundColor);p.graphics.drawRectangle(h,u,0,0,l.width,35);var c=new g.PdfStandardFont(this.ganttStyle.fontFamily,this.ganttStyle.footer.fontSize,this.ganttStyle.footer.fontStyle);this.ganttStyle.font&&(c=this.ganttStyle.font);var f=new g.PdfSolidBrush(this.ganttStyle.footer.fontColor),m=new g.PdfPageNumberField(c),y=new g.PdfPageCountField(c,f),D=new g.PdfCompositeField(c,f,"Page {0}",m,y);D.stringFormat=this.ganttStyle.footer.format,D.bounds=d,D.draw(p.graphics,new g.PointF(0,0)),e.template.bottom=p}var v=o.size,k=t.isNullOrUndefined(v)?this.pdfDoc.pageSettings.size:v;if(!t.isNullOrUndefined(this.exportProps.header)){var b=this.exportProps.header,w=new g.PointF(0,b.fromTop),T=new g.SizeF(1.1*k.width,b&&b.height?.75*b.height:50),d=new g.RectangleF(w,T);e.template.top=this.drawPageTemplate(new g.PdfPageTemplateElement(d),b)}if(!this.exportProps.enableFooter&&!t.isNullOrUndefined(this.exportProps.footer)){var p=this.exportProps.footer,w=new g.PointF(0,k.width-80-(p&&p.fromBottom?.75*p.fromBottom:0)),T=new g.SizeF(1.1*k.width,p&&p.height?.75*p.height:50),d=new g.RectangleF(w,T);this.pdfDoc.template.bottom=this.drawPageTemplate(new g.PdfPageTemplateElement(d),p)}},e.prototype.drawPageTemplate=function(e,t){for(var i=0,a=t.contents;i<a.length;i++){var r=a[i];switch(r.type){case"Text":if(""===r.value||void 0===r.value||null===r.value||"string"!=typeof r.value)throw new Error("please enter the valid input value in text content...");this.drawText(e,r);break;case"PageNumber":this.drawPageNumber(e,r);break;case"Image":if(void 0===r.src||null===r.src||""===r.src)throw new Error("please enter the valid base64 string in image content...");this.drawImage(e,r);break;case"Line":this.drawLine(e,r);break;default:throw new Error("Please set valid content type...")}}return e},e.prototype.drawText=function(e,i){var a=this.getFont(i);this.ganttStyle.font&&(a=this.ganttStyle.font);var r=this.getBrushFromContent(i),n=null;if(!t.isNullOrUndefined(i.style.textPenColor)){var s=this.hexToRgb(i.style.textPenColor);n=new g.PdfPen(new g.PdfColor(s.r,s.g,s.b))}null===r&&null===n&&(r=new g.PdfSolidBrush(new g.PdfColor(0,0,0)));var o=i.value.toString(),l=.75*i.position.x,d=.75*i.position.y,h=new g.PdfStringFormat;t.isNullOrUndefined(i.style.stringFormat)||(h.alignment=i.style.stringFormat.alignment);var p=this.setContentFormat(i,h);null===p||t.isNullOrUndefined(p.format)||t.isNullOrUndefined(p.size)?e.graphics.drawString(o,a,n,r,l,d,h):e.graphics.drawString(o,a,n,r,l,d,p.size.width,p.size.height,p.format)},e.prototype.drawPageNumber=function(e,i){var a=this.getFont(i),r=null;if(t.isNullOrUndefined(i.style.textBrushColor))r=new g.PdfSolidBrush(new g.PdfColor(0,0,0));else{var n=this.hexToRgb(i.style.textBrushColor);r=new g.PdfSolidBrush(new g.PdfColor(n.r,n.g,n.b))}var s=new g.PdfPageNumberField(a,r);s.numberStyle=this.getPageNumberStyle(i.pageNumberType);var o,l;if(t.isNullOrUndefined(i.format))l="{0}",o=new g.PdfCompositeField(a,r,l,s);else{var d="$total";if(-1!==i.format.indexOf(d)&&-1!==i.format.indexOf("$current"))(h=new g.PdfPageCountField(a)).numberStyle=this.getPageNumberStyle(i.pageNumberType),l=i.format.indexOf(d)>i.format.indexOf("$current")?(l=i.format.replace("$current","0")).replace(d,"1"):(l=i.format.replace("$current","1")).replace(d,"0"),o=new g.PdfCompositeField(a,r,l,s,h);else if(-1!==i.format.indexOf("$current")&&-1===i.format.indexOf(d))l=i.format.replace("$current","0"),o=new g.PdfCompositeField(a,r,l,s);else{var h=new g.PdfPageCountField(a);l=i.format.replace(d,"0"),o=new g.PdfCompositeField(a,r,l,h)}}var p=.75*i.position.x,u=.75*i.position.y,c=this.setContentFormat(i,o.stringFormat);null===c||t.isNullOrUndefined(c.format)||t.isNullOrUndefined(c.size)||(o.stringFormat=c.format,o.bounds=new g.RectangleF(p,u,c.size.width,c.size.height)),o.draw(e.graphics,p,u)},e.prototype.drawImage=function(e,i){var a=.75*i.position.x,r=.75*i.position.y,n=t.isNullOrUndefined(i.size)||t.isNullOrUndefined(i.size.width)?void 0:.5*i.size.width,s=t.isNullOrUndefined(i.size)||t.isNullOrUndefined(i.size.height)?void 0:.75*i.size.height,o=new g.PdfBitmap(i.src);t.isNullOrUndefined(n)?e.graphics.drawImage(o,a,r):e.graphics.drawImage(o,a,r,n,s)},e.prototype.drawLine=function(e,i){var a=.75*i.points.x1,r=.75*i.points.y1,n=.75*i.points.x2,s=.75*i.points.y2,o=this.getPenFromContent(i);t.isNullOrUndefined(i.style)||(t.isNullOrUndefined(i.style.penSize)||"number"!=typeof i.style.penSize||(o.width=.75*i.style.penSize),o.dashStyle=this.getDashStyle(i.style.dashStyle)),e.graphics.drawLine(o,a,r,n,s)},e.prototype.getPenFromContent=function(e){var i=new g.PdfPen(new g.PdfColor(0,0,0));if(!t.isNullOrUndefined(e.style)&&null!==e.style&&!t.isNullOrUndefined(e.style.penColor)){var a=this.hexToRgb(e.style.penColor);i=new g.PdfPen(new g.PdfColor(a.r,a.g,a.b))}return i},e.prototype.getDashStyle=function(e){switch(e){case"Dash":return 1;case"Dot":return 2;case"DashDot":return 3;case"DashDotDot":return 4;default:return 0}},e.prototype.getBrushFromContent=function(e){var i=null;if(!t.isNullOrUndefined(e.style.textBrushColor)){var a=this.hexToRgb(e.style.textBrushColor);i=new g.PdfSolidBrush(new g.PdfColor(a.r,a.g,a.b))}return i},e.prototype.hexToRgb=function(e){if(null===e||""===e||7!==e.length)throw new Error("please set valid hex value for color...");e=e.substring(1);var t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:255&t}},e.prototype.setContentFormat=function(e,i){var a=e.size?.75*e.size.width:this.pdfDoc.pageSettings.size.width,r=e.size?.75*e.size.height:t.isNullOrUndefined(this.exportProps.footer)?0:.5*this.exportProps.footer.height;if(i=new g.PdfStringFormat(g.PdfTextAlignment.Left,g.PdfVerticalAlignment.Middle),!t.isNullOrUndefined(e.style.hAlign))switch(e.style.hAlign){case"Right":i.alignment=g.PdfTextAlignment.Right;break;case"Center":i.alignment=g.PdfTextAlignment.Center;break;case"Justify":i.alignment=g.PdfTextAlignment.Justify;break;default:i.alignment=g.PdfTextAlignment.Left}return t.isNullOrUndefined(e.style.vAlign)||(i=this.getVerticalAlignment(e.style.vAlign,i)),{format:i,size:new g.SizeF(a,r)}},e.prototype.getPageNumberStyle=function(e){switch(e){case"LowerLatin":return 2;case"LowerRoman":return 3;case"UpperLatin":return 4;case"UpperRoman":return 5;default:return 1}},e}(),di=function(){function i(e){this.valueFormatter=new r.ValueFormatter(e),this.internationalization=new t.Internationalization(e)}return i.prototype.returnFormattedValue=function(e,i){return!t.isNullOrUndefined(e.value)&&e.value?this.valueFormatter.getFormatFunction(i)(e.value):""},i.prototype.formatCellValue=function(i,a){if(i.isForeignKey&&(i.value=t.getValue(i.column.foreignKeyValue,r.getForeignData(i.column,{},i.value)[0])),"number"===i.column.type&&void 0!==i.column.format&&""!==i.column.format)return i.value?this.internationalization.getNumberFormat({format:i.column.format})(i.value):"";if("boolean"===i.column.type)return i.value?"true":"false";if("date"!==i.column.type&&"datetime"!==i.column.type&&"time"!==i.column.type||void 0===i.column.format||""===i.value){if((t.isNullOrUndefined(i.column.type)||t.isNullOrUndefined(i.value))&&t.isNullOrUndefined(i.value))return"";if(i.column.field===a.taskFields.constraintType){var n=e.ConstraintType[i.value],s=a.treeGridModule.getLocalizedConstraintTypeText(n);i.value=s}return i.value.toString()}if("string"==typeof i.value&&(i.value=new Date(i.value)),"string"==typeof i.column.format){var o=void 0;return o="date"===i.column.type?{type:"date",format:i.column.format}:"time"===i.column.type?{type:"time",format:i.column.format}:{type:"dateTime",format:i.column.format},this.returnFormattedValue(i,o)}if(i.column.format instanceof Object&&void 0===i.column.format.type)return i.value.toString();var l=void 0;return l="date"===i.column.type?{type:i.column.format.type,format:i.column.format.format,skeleton:i.column.format.skeleton}:"time"===i.column.type?{type:"time",format:i.column.format.format,skeleton:i.column.format.skeleton}:{type:"dateTime",format:i.column.format.format,skeleton:i.column.format.skeleton},this.returnFormattedValue(i,l)},i}(),hi=function(){return(hi=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)},pi=function(){function e(e){this.baselineHeight=8,this.segment=[],this.segmentCollection=[],this.leftTaskLabel={},this.rightTaskLabel={},this.startPage=-1,this.endPage=-1,this.pageDetailedWidth=0,this.defaultFontSize=9,this.spaceBetweenImageAndValue=8,this.parent=e}return e.prototype.add=function(){return new e(this.parent)},e.prototype.GetNextPage=function(e){var t=e.section,i=t.indexOf(e);return i===t.count-1?t.add():t.getPages()[i+1]},e.prototype.isAutoFit=function(){return!!(this.parent.pdfExportModule&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth||this.parent.timelineModule.isZoomedToFit)},e.prototype.drawTaskbar=function(e,i,a,r,n,s,o,l){var d=this,h=e.graphics,p=!1,u=e.getClientSize();i.y+n>u.height&&((e=this.GetNextPage(e)).contentWidth=this.isAutoFit()?R(a.endPoint-a.startPoint):a.endPoint-a.startPoint,h=e.graphics,i.y=0,this.parent.pdfExportModule.gantt.currentPage=this.parent.pdfExportModule.gantt.currentPage+1,this.parent.pdfExportModule.gantt.eventMarker.renderHeight=this.parent.pdfExportModule.gantt.layouter.pageHeightCollection[this.parent.pdfExportModule.gantt.currentPage].totalHeight,this.parent.pdfExportModule.gantt.enableHeader&&(this.parent.pdfExportModule.gantt.chartHeader.drawPageTimeline(e,i,a,this.parent.pdfExportModule.gantt.currentPage),i.y=C(this.parent.timelineModule.isSingleTier?45:60)),p=!0),this.drawLeftLabel(e,i,a,r,s);var c,f,m,y=new g.PdfStandardFont(this.fontFamily,this.defaultFontSize,g.PdfFontStyle.Regular),D=null,v=new g.PdfSolidBrush(this.progressFontColor);c=y,!t.isNullOrUndefined(s.taskbarTemplate.value)&&s.taskbarTemplate.fontStyle&&s.taskbarTemplate.fontStyle.fontFamily&&s.taskbarTemplate.fontStyle.fontSize&&(c=new g.PdfStandardFont(s.taskbarTemplate.fontStyle.fontFamily,s.taskbarTemplate.fontStyle.fontSize,s.taskbarTemplate.fontStyle.fontStyle)),f=!t.isNullOrUndefined(s.taskbarTemplate.value)&&s.taskbarTemplate.fontStyle&&s.taskbarTemplate.fontStyle.fontColor?new g.PdfSolidBrush(s.taskbarTemplate.fontStyle.fontColor):v,m=!t.isNullOrUndefined(s.taskbarTemplate.value)&&s.taskbarTemplate.fontStyle&&s.taskbarTemplate.fontStyle.fontBrush?new g.PdfPen(s.taskbarTemplate.fontStyle.fontBrush):D,!t.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(y=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var k,b,w=this.parent.pdfExportModule.helper.exportProps.ganttStyle,T=this.labelSettings.taskLabel;if(T.fontStyle.fontSize||T.fontStyle.fontFamily||T.fontStyle.fontStyle){var S=T.fontStyle&&T.fontStyle.fontFamily?T.fontStyle.fontFamily:this.fontFamily||g.PdfFontFamily.Helvetica,P=T.fontStyle&&T.fontStyle.fontSize?T.fontStyle.fontSize:this.defaultFontSize,M=T.fontStyle&&"string"==typeof T.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(T.fontStyle.fontStyle):T.fontStyle&&T.fontStyle.fontStyle?T.fontStyle.fontStyle:g.PdfFontStyle.Regular;k=new g.PdfStandardFont(S,P,M)}else w&&w.label&&w.label.fontBrush?b=new g.PdfSolidBrush(w.label.fontBrush):k=y;b=s.labelSettings.taskLabel.fontStyle.fontColor?new g.PdfSolidBrush(s.labelSettings.taskLabel.fontStyle.fontColor):w&&w.label&&w.label.fontColor?new g.PdfSolidBrush(w.label.fontColor):v,t.isNullOrUndefined(w)||t.isNullOrUndefined(w.label)||t.isNullOrUndefined(w.label.fontBrush)||(D=new g.PdfPen(w.label.fontBrush)),t.isNullOrUndefined(w)||t.isNullOrUndefined(w.label)||t.isNullOrUndefined(w.label.fontSize)&&t.isNullOrUndefined(w.label.fontStyle)&&t.isNullOrUndefined(w.label.fontFamily)||(k=this.getPdfFont(w));var x=new g.PdfStringFormat;x.lineAlignment=g.PdfVerticalAlignment.Middle,x.alignment=g.PdfTextAlignment.Right;var O,I=!1;!t.isNullOrUndefined(this.taskLabel)&&/^[a-zA-Z0-9]/.test(this.taskLabel)&&("0"!==this.taskLabel&&"0%"!==this.taskLabel||(O=this.width,x.alignment=g.PdfTextAlignment.Left)),(!t.isNullOrUndefined(this.taskLabel)&&/^[a-zA-Z]/.test(this.taskLabel)||!t.isNullOrUndefined(s.taskbarTemplate.value))&&(I=!0,x.alignment=g.PdfTextAlignment.Left),t.isNullOrUndefined(w)||t.isNullOrUndefined(w.label)||t.isNullOrUndefined(w.label.format)||(x=w.label.format);var E={left:0,right:0,top:0,bottom:0};t.isNullOrUndefined(w)||t.isNullOrUndefined(w.label)||t.isNullOrUndefined(w.label.padding)||(E=w.label.padding);var F=-1,U=new g.PdfPen(s.baselineBorderColor),N=new g.PdfSolidBrush(s.baselineColor),L=s.taskbarTemplate;if(s.isMilestone)this.drawMilestone(e,i,a,r,s,!1),this.parent.renderBaseline&&s.baselineStartDate&&s.baselineEndDate&&this.drawMilestone(e,i,a,r,s,!0);else{var V=new g.PdfPen(s.taskBorderColor),B=new g.PdfSolidBrush(s.taskColor),A=new g.PdfPen(s.manualParentBorder),W=new g.PdfPen(s.manualChildBorder),H=new g.PdfPen(s.manuallineColor),j=(new g.PdfPen(s.manualParentProgress),new g.PdfPen(s.manuallineColor)),z=new g.PdfSolidBrush(s.manuallineColor),G=new g.PdfPen(s.splitLineBackground),q=new g.PdfSolidBrush(s.manualParentBackground),_=new g.PdfSolidBrush(s.manualChildBackground),Z=new g.PdfSolidBrush(s.manualChildProgress),X=new g.PdfSolidBrush(s.manualParentProgress),Y=new g.PdfPen(s.progressColor),K=new g.PdfSolidBrush(s.progressColor),Q=C((this.parent.rowHeight-this.height)/2),$=C((this.parent.rowHeight-this.height)/4.5),J=this.parent.renderBaseline?$:Q;F=e.section.indexOf(e);var ee=t.isNullOrUndefined(this.unscheduleStarteDate)?this.startDate:this.unscheduleStarteDate,te=t.isNullOrUndefined(this.unscheduleEndDate)?this.endDate:this.unscheduleEndDate;if(a.startDate<=ee&&te<=a.endDate){if(this.isStartPoint||(this.taskStartPoint=hi({},i),this.isStartPoint=!0),this.isScheduledTask||"duration"!==this.unscheduledTaskBy)if(this.isScheduledTask||"endDate"!==this.unscheduledTaskBy)if(this.isScheduledTask||"duration"===this.unscheduledTaskBy){if(s.isSpliterTask)G.dashStyle=g.PdfDashStyle.Dot,this.isAutoFit()?h.drawLine(G,new g.PointF(i.x+(this.left-r)+.5,i.y+J+C(s.height/2)),new g.PointF(s.width+i.x+(this.left-r)+.5,i.y+J+C(s.height/2))):h.drawLine(G,new g.PointF(i.x+C(this.left-r)+.5,i.y+J+C(s.height/2)),new g.PointF(C(s.width)+i.x+C(this.left-r)+.5,i.y+J+C(s.height/2))),s.segmentCollection.map(function(e,a){var n=t.isNullOrUndefined(d.taskSegmentStyles)?V:new g.PdfPen(d.taskSegmentStyles[a].taskBorderColor),o=t.isNullOrUndefined(d.taskSegmentStyles)?B:new g.PdfSolidBrush(d.taskSegmentStyles[a].taskColor);if(d.isAutoFit()){if(h.drawRectangle(n,o,i.x+(d.left+e.left-r)+.5,i.y+J,e.width,C(s.height)),L.image||L.value){l=void 0;if(t.isNullOrUndefined(s.taskbarTemplate.image))l=0;else{l=s.taskbarTemplate.image[0].width;p=new g.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(p,i.x+(d.left+e.left-r)+.5,i.y+J,C(s.taskbarTemplate.image[0].width),C(s.taskbarTemplate.image[0].height))}t.isNullOrUndefined(s.taskbarTemplate.value)||h.drawString(s.taskbarTemplate.value,c,m,f,i.x+(d.left+e.left-r)+.5+l,i.y+J,C(e.width),C(s.height),x)}}else if(h.drawRectangle(n,o,i.x+C(d.left+e.left-r)+.5,i.y+J,C(e.width),C(s.height)),L.image||L.value){var l=void 0;if(t.isNullOrUndefined(s.taskbarTemplate.image))l=0;else{l=s.taskbarTemplate.image[0].width;var p=new g.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(p,i.x+C(d.left+e.left-r)+.5,i.y+J,C(s.taskbarTemplate.image[0].width),C(s.taskbarTemplate.image[0].height))}t.isNullOrUndefined(s.taskbarTemplate.value)||h.drawString(s.taskbarTemplate.value,c,m,f,i.x+C(d.left+e.left-r)+.5+l,i.y+J,C(e.width),C(s.height),x)}});else if(!s.isAutoSchedule&&s.isParentTask)h.save(),(oe=new g.PdfPath).addEllipse(0,0,5,5),this.isAutoFit()?h.translateTransform(i.x+(this.left-r)+.5,i.y+J-2):h.translateTransform(i.x+C(this.left-r)+.5,i.y+J-2),h.drawPath(H,z,oe),h.restore(),(de=new g.PdfPath).addEllipse(0,0,5,5),h.save(),this.isAutoFit()?h.translateTransform(i.x+(this.left-r)+.5+this.width,i.y+J-2):h.translateTransform(i.x+C(this.left-r)+.5+C(this.width),i.y+J-2),h.drawPath(H,z,de),h.restore(),j.dashStyle=g.PdfDashStyle.Solid,this.isAutoFit()?h.drawLine(j,new g.PointF(i.x+(this.left-r)+.5,i.y+J),new g.PointF(s.width+i.x+(this.left-r)+.5,i.y+J)):h.drawLine(j,new g.PointF(i.x+C(this.left-r)+.5,i.y+J),new g.PointF(C(s.width)+i.x+C(this.left-r)+.5,i.y+J));else if(s.isAutoSchedule||s.isParentTask)if(this.isAutoFit())if(t.isNullOrUndefined(L.value)&&t.isNullOrUndefined(L.image))h.drawRectangle(V,B,i.x+(this.left-r)+.5,i.y+J,s.width,C(s.height));else{h.drawRectangle(V,B,i.x+(this.left-r)+.5,i.y+J,s.width,C(s.height));ce=void 0;if(t.isNullOrUndefined(s.taskbarTemplate.image))ce=0;else{ce=s.taskbarTemplate.image[0].width/2;ge=new g.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ge,i.x+(this.left-r)+.5,i.y+J+(s.height-s.taskbarTemplate.image[0].height)/2,s.taskbarTemplate.image[0].width/2,s.taskbarTemplate.image[0].height/2)}s.taskbarTemplate.value&&(I&&(O=this.width),h.drawString(s.taskbarTemplate.value,c,m,f,i.x+(this.left-r)+ce,i.y+J,O,C(this.height),x))}else if(t.isNullOrUndefined(L.value)&&t.isNullOrUndefined(L.image))h.drawRectangle(V,B,i.x+C(this.left-r)+.5,i.y+J,C(s.width),C(s.height));else{h.drawRectangle(V,B,i.x+C(this.left-r)+.5,i.y+J,C(s.width),C(s.height));ce=void 0;if(t.isNullOrUndefined(s.taskbarTemplate.image))ce=0;else{ce=s.taskbarTemplate.image[0].width;ge=new g.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ge,i.x+C(this.left-r)+1,i.y+J+1+C((s.height-s.taskbarTemplate.image[0].height)/2),C(s.taskbarTemplate.image[0].width),C(s.taskbarTemplate.image[0].height))}t.isNullOrUndefined(s.taskbarTemplate.value)||h.drawString(s.taskbarTemplate.value,c,m,f,i.x+C(this.left-r)+ce,i.y+J,C(O),C(this.height),x)}else h.save(),h.setTransparency(.87),this.isAutoFit()?h.drawRectangle(W,_,i.x+(this.left-r)+.5,i.y+J,s.width,C(s.height)):h.drawRectangle(W,_,i.x+C(this.left-r)+.5,i.y+J,C(s.width),C(s.height)),h.restore(),this.isAutoFit()?h.drawRectangle(null,Z,i.x+(this.left-r)+.5,i.y+J,s.progressWidth,C(this.height)):h.drawRectangle(null,Z,i.x+C(this.left-r)+.5,i.y+J,C(s.progressWidth),C(this.height));this.isScheduledTask&&!s.isSpliterTask?t.isNullOrUndefined(L.image)&&t.isNullOrUndefined(L.value)&&(this.isAutoFit()&&s.isAutoSchedule?h.drawRectangle(Y,K,i.x+(this.left-r)+.5,i.y+J,s.progressWidth,C(s.height)):s.isAutoSchedule&&h.drawRectangle(Y,K,i.x+C(this.left-r)+.5,i.y+J,C(s.progressWidth),C(s.height)),t.isNullOrUndefined(this.parent.labelSettings.taskLabel)||t.isNullOrUndefined(this.taskLabel)||("0"!==this.taskLabel&&"0%"!==this.taskLabel&&(O=this.progressWidth),I&&(O=this.width),this.isAutoFit()?h.drawString(this.taskLabel.toString(),k,D,b,i.x+(this.left-r)-(E.left+E.right),i.y+J-(E.top+E.bottom),O,C(this.height),x):h.drawString(this.taskLabel.toString(),k,D,b,i.x+C(this.left-r)-(E.left+E.right),i.y+J-(E.top+E.bottom),C(O),C(this.height),x))):s.isSpliterTask&&s.segment.map(function(e,a){var n=t.isNullOrUndefined(d.taskSegmentStyles)?Y:new g.PdfPen(d.taskSegmentStyles[a].progressColor),o=t.isNullOrUndefined(d.taskSegmentStyles)?K:new g.PdfSolidBrush(d.taskSegmentStyles[a].progressColor);d.isAutoFit()?h.drawRectangle(n,o,i.x+(d.left+e.left-r)+.5,i.y+J,e.progressWidth,C(s.height)):h.drawRectangle(n,o,i.x+C(d.left+e.left-r)+.5,i.y+J,C(e.progressWidth),C(s.height))})}else this.drawUnscheduledTask(h,i,r,J);else this.drawUnscheduledTask(h,i,r,J);else{var ie=void 0,ae=void 0;if(this.isAutoFit()){if(ie=new g.PdfLinearGradientBrush(new g.PointF(i.x+(this.left-r)+.5+s.width/2,0),new g.PointF(i.x+(this.left-r),0),new g.PdfColor(s.unscheduledTaskBarColor),new g.PdfColor(255,255,255)),h.drawRectangle(ie,i.x+(this.left-r)+.5,i.y+J,s.width,C(s.height)),ae=new g.PdfLinearGradientBrush(new g.PointF(i.x+(this.left-r)+.5+s.width,0),new g.PointF(i.x+(this.left-r)+s.width/2,0),new g.PdfColor(255,255,255),new g.PdfColor(s.unscheduledTaskBarColor)),h.drawRectangle(ae,i.x+(this.left-r)+.5+s.width/2,i.y+J,s.width/2,C(s.height)),L.image||L.value){ce=void 0;if(t.isNullOrUndefined(s.taskbarTemplate.image))ce=0;else{ce=s.taskbarTemplate.image[0].width;ge=new g.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ge,i.x+(this.left-r)+.5,i.y+J,C(s.taskbarTemplate.image[0].width),C(s.taskbarTemplate.image[0].height))}t.isNullOrUndefined(s.taskbarTemplate.value)||h.drawString(s.taskbarTemplate.value,c,m,f,i.x+(this.left-r)+.5+ce,i.y+J,C(s.width),C(this.height),x)}}else if(ie=new g.PdfLinearGradientBrush(new g.PointF(i.x+C(this.left-r)+.5+C(s.width)/2,0),new g.PointF(i.x+C(this.left-r),0),new g.PdfColor(s.unscheduledTaskBarColor),new g.PdfColor(255,255,255)),h.drawRectangle(ie,i.x+C(this.left-r)+.5,i.y+J,C(s.width),C(s.height)),ae=new g.PdfLinearGradientBrush(new g.PointF(i.x+C(this.left-r)+.5+C(s.width),0),new g.PointF(i.x+C(this.left-r)+C(s.width)/2,0),new g.PdfColor(255,255,255),new g.PdfColor(s.unscheduledTaskBarColor)),h.drawRectangle(ae,i.x+C(this.left-r)+.5+C(s.width)/2,i.y+J,C(s.width)/2,C(s.height)),L.image||L.value){ce=void 0;if(t.isNullOrUndefined(s.taskbarTemplate.image))ce=0;else{ce=s.taskbarTemplate.image[0].width;ge=new g.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ge,i.x+C(this.left-r)+.5,i.y+J,C(s.taskbarTemplate.image[0].width),C(s.taskbarTemplate.image[0].height))}t.isNullOrUndefined(s.taskbarTemplate.value)||h.drawString(s.taskbarTemplate.value,c,m,f,i.x+C(this.left-r)+.5+ce,i.y+J,C(s.width),C(this.height),x)}}this.isCompleted=!0,this.startPage=F,this.endPage=F}else if(a.startDate<=ee&&a.endDate>=ee&&te>=a.endDate){this.isStartPoint||(this.taskStartPoint=hi({},i),this.isStartPoint=!0);var re=this.width,ne=0,se=0;if(this.width=this.width-(a.totalWidth-(this.left-r)),ne=a.totalWidth-(this.left-r),se=a.totalWidth-(this.left-r),re<ne&&(ne=re),this.isScheduledTask||"duration"!==this.unscheduledTaskBy)if(this.isScheduledTask||"duration"===this.unscheduledTaskBy)if(!s.isAutoSchedule&&s.isParentTask){h.save();var oe=new g.PdfPath;oe.addEllipse(0,0,5,5),this.isAutoFit()?h.translateTransform(i.x+(this.left-r)+.5,i.y+J-2):h.translateTransform(i.x+C(this.left-r)+.5,i.y+J-2),h.drawPath(H,z,oe),h.restore(),j.dashStyle=g.PdfDashStyle.Solid,this.isAutoFit()?h.drawLine(j,new g.PointF(i.x+(this.left-r)+.5,i.y+J),new g.PointF(ne+i.x+(this.left-r)+.5,i.y+J)):h.drawLine(j,new g.PointF(i.x+C(this.left-r)+.5,i.y+J),new g.PointF(C(ne)+i.x+C(this.left-r)+.5,i.y+J))}else if(s.isAutoSchedule||s.isParentTask)if(this.isScheduledTask||"duration"===this.unscheduledTaskBy)if(this.isScheduledTask||"endDate"!==this.unscheduledTaskBy)if(s.isSpliterTask){var le=0;G.dashStyle=g.PdfDashStyle.Dot,this.isAutoFit()?h.drawLine(G,new g.PointF(i.x+(this.left-r)+.5,i.y+J+C(s.height/2)),new g.PointF(ne+(this.left-r)+i.x,i.y+J+C(s.height/2))):h.drawLine(G,new g.PointF(i.x+C(this.left-r)+.5,i.y+J+C(s.height/2)),new g.PointF(C(ne)+C(this.left-r)+i.x,i.y+J+C(s.height/2))),s.segmentCollection.map(function(e,n){if(e.startDate<a.endDate&&e.endDate>a.startDate){var o=t.isNullOrUndefined(d.taskSegmentStyles)?V:new g.PdfPen(d.taskSegmentStyles[n].taskBorderColor),l=t.isNullOrUndefined(d.taskSegmentStyles)?B:new g.PdfSolidBrush(d.taskSegmentStyles[n].taskColor),p=t.isNullOrUndefined(d.taskSegmentStyles)?Y:new g.PdfPen(d.taskSegmentStyles[n].progressColor),u=t.isNullOrUndefined(d.taskSegmentStyles)?K:new g.PdfSolidBrush(d.taskSegmentStyles[n].progressColor),y=ne-e.left;e.width<y&&(y=e.width);var D=y;if(e.progressWidth<D&&(D=e.progressWidth),d.isAutoFit()){if(h.drawRectangle(o,l,i.x+(d.left-r)+.5+e.left,i.y+J,e.width,C(s.height)),h.drawRectangle(p,u,i.x+(d.left+e.left-r)+.5,i.y+J,e.progressWidth,C(s.height)),L.image||L.value){v=void 0;if(t.isNullOrUndefined(s.taskbarTemplate.image))v=0;else{v=s.taskbarTemplate.image[0].width;k=new g.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(k,i.x+(d.left-r)+.5+e.left,i.y+J,s.taskbarTemplate.image[0].width,s.taskbarTemplate.image[0].height)}t.isNullOrUndefined(s.taskbarTemplate.value)||h.drawString(s.taskbarTemplate.value,c,m,f,i.x+(d.left-r)+.5+e.left+v,i.y+J,e.width,s.height,x)}}else if(h.drawRectangle(o,l,i.x+C(d.left-r)+.5+C(e.left),i.y+J,C(y),C(s.height)),h.drawRectangle(p,u,i.x+C(d.left+e.left-r)+.5,i.y+J,C(D),C(s.height)),L.image||L.value){var v=void 0;if(t.isNullOrUndefined(s.taskbarTemplate.image))v=0;else{v=s.taskbarTemplate.image[0].width;var k=new g.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(k,i.x+C(d.left-r)+.5+C(e.left),i.y+J,C(s.taskbarTemplate.image[0].width),C(s.taskbarTemplate.image[0].height))}t.isNullOrUndefined(s.taskbarTemplate.value)||h.drawString(s.taskbarTemplate.value,c,m,f,i.x+C(d.left-r)+.5+C(e.left)+v,i.y+J,C(e.width),C(s.height),x)}0===d.segmentCollection[parseInt(n.toString(),10)].width?d.segmentCollection[parseInt(n.toString(),10)].progressWidth=0:e.width-d.segmentCollection[parseInt(n.toString(),10)].width<e.progressWidth&&e.width!==d.segmentCollection[n].width&&(d.segmentCollection[parseInt(n.toString(),10)].progressWidth=e.progressWidth-(e.width-d.segmentCollection[n].width)),y>=(le=e.left+e.width)?(d.segmentCollection[parseInt(n.toString(),10)].width=0,d.segmentCollection[parseInt(n.toString(),10)].left=0):(y>=le-e.width?(d.segmentCollection[parseInt(n.toString(),10)].left=0,d.segmentCollection[parseInt(n.toString(),10)].width=e.width-y):d.segmentCollection[parseInt(n.toString(),10)].left=e.left-a.totalWidth,ne>=le&&(d.segmentCollection[parseInt(n.toString(),10)].width=0))}}),this.pageDetailedWidth+=ne}else{if(this.isAutoFit())if(t.isNullOrUndefined(L.value)&&t.isNullOrUndefined(L.image))h.drawRectangle(V,B,i.x+(this.left-r)+.5,i.y+J,ne,C(s.height));else{if(h.drawRectangle(V,B,i.x+(this.left-r)+.5,i.y+J,ne,C(s.height)),!t.isNullOrUndefined(s.taskbarTemplate.image)){ge=new g.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ge,i.x+(this.left-r)+.5,i.y+J+C((s.height-s.taskbarTemplate.image[0].height)/.5),s.taskbarTemplate.image[0].width/2,s.taskbarTemplate.image[0].height/2)}if(!t.isNullOrUndefined(s.taskbarTemplate.value)){ce=t.isNullOrUndefined(s.taskbarTemplate.image)?0:s.taskbarTemplate.image[0].width;h.drawString(s.taskbarTemplate.value,c,m,f,i.x+(this.left-r)+ce,i.y+J,C(O),C(this.height),x)}}else if(t.isNullOrUndefined(L.value)&&t.isNullOrUndefined(L.image))h.drawRectangle(V,B,i.x+C(this.left-r)+.5,i.y+J,C(ne),C(s.height));else{h.drawRectangle(V,B,i.x+C(this.left-r)+.5,i.y+J,C(ne),C(s.height));ce=void 0;if(t.isNullOrUndefined(s.taskbarTemplate.image))ce=0;else{ce=s.taskbarTemplate.image[0].width;ge=new g.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ge,i.x+C(this.left-r)+1,i.y+J+1+C((s.height-s.taskbarTemplate.image[0].height)/2),C(s.taskbarTemplate.image[0].width),C(s.taskbarTemplate.image[0].height))}if(!t.isNullOrUndefined(s.taskbarTemplate.value)){this.stringLeft=C(this.left);me=this.getWidth(s.taskbarTemplate.value,a.endPoint-this.stringLeft,15);h.drawString(me.lines[0].text,c,m,f,i.x+C(this.left-r)+ce,i.y+J,C(O),C(this.height),x),t.isNullOrUndefined(me.remainder)||(this.remainString=me.remainder,this.stringLeft=a.endPoint)}}if(s.isAutoSchedule&&!s.isSpliterTask){ye=0;if(ye=this.progressWidth<=ne?this.progressWidth:ne,t.isNullOrUndefined(L.image)&&t.isNullOrUndefined(L.value)&&(this.isAutoFit()?h.drawRectangle(Y,K,i.x+(this.left-r)+.5,i.y+J,ye,C(s.height)):h.drawRectangle(Y,K,i.x+C(this.left-r)+.5,i.y+J,C(ye),C(s.height))),this.progressWidth-=ye,this.parent.labelSettings.taskLabel&&!t.isNullOrUndefined(this.taskLabel))if(O=ye,I&&(O=ne),this.stringLeft=this.left,t.isNullOrUndefined(s.taskbarTemplate.value)){me=this.getWidth(this.taskLabel.toString(),a.endPoint-this.stringLeft,15);h.drawString(me.lines[0].text,k,D,b,i.x+C(this.left-r),i.y+J,C(O),C(this.height),x),t.isNullOrUndefined(me.remainder)||(this.remainString=me.remainder,this.stringLeft=a.endPoint)}else this.isAutoFit()?h.drawString(this.taskLabel.toString(),k,D,b,i.x+(this.left-r)-(E.left+E.right),i.y+J-(E.top+E.bottom),O,C(this.height),x):h.drawString(this.taskLabel.toString(),k,D,b,i.x+C(this.left-r)-(E.left+E.right),i.y+J-(E.top+E.bottom),C(O),C(this.height),x)}}else this.drawUnscheduledTask(h,i,r,J);else this.drawUnscheduledTask(h,i,r,J);else this.isAutoFit()?h.drawRectangle(W,null,i.x+(this.left-r)+.5,i.y+J,ne,C(s.height)):h.drawRectangle(W,null,i.x+C(this.left-r)+.5,i.y+J,C(ne),C(s.height)),h.save(),h.setTransparency(.87),this.isAutoFit()?h.drawRectangle(null,_,i.x+(this.left-r)+.5,i.y+J,ne,C(s.height)):h.drawRectangle(null,_,i.x+C(this.left-r)+.5,i.y+J,C(ne),C(s.height)),h.restore(),this.isAutoFit()?h.drawRectangle(null,Z,i.x+(this.left-r)+.5,i.y+J,se,C(s.height)):h.drawRectangle(null,Z,i.x+C(this.left-r)+.5,i.y+J,C(se),C(s.height)),s.progressWidth=s.progressWidth-se;else this.drawUnscheduledTask(h,i,r,J);else{var ie=void 0,ae=void 0;if(this.isAutoFit()){if(ie=new g.PdfLinearGradientBrush(new g.PointF(i.x+(this.left-r)+.5+ne/2,0),new g.PointF(i.x+(this.left-r),0),new g.PdfColor(s.unscheduledTaskBarColor),new g.PdfColor(255,255,255)),h.drawRectangle(ie,i.x+(this.left-r)+.5,i.y+J,ne,C(s.height)),ae=new g.PdfLinearGradientBrush(new g.PointF(i.x+(this.left-r)+.5+ne,0),new g.PointF(i.x+(this.left-r)+ne/2,0),new g.PdfColor(255,255,255),new g.PdfColor(s.unscheduledTaskBarColor)),h.drawRectangle(ae,i.x+(this.left-r)+.5+ne/2,i.y+J,ne/2,C(s.height)),L.image||L.value){ce=void 0;if(t.isNullOrUndefined(s.taskbarTemplate.image))ce=0;else{ce=s.taskbarTemplate.image[0].width;ge=new g.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ge,i.x+(this.left-r)+.5,i.y+J,C(s.taskbarTemplate.image[0].width),C(s.taskbarTemplate.image[0].height))}t.isNullOrUndefined(s.taskbarTemplate.value)||h.drawString(s.taskbarTemplate.value,c,m,f,i.x+(this.left-r)+.5+ce,i.y+J,C(s.width),C(this.height),x)}}else if(ie=new g.PdfLinearGradientBrush(new g.PointF(i.x+C(this.left-r)+.5+C(ne)/2,0),new g.PointF(i.x+C(this.left-r),0),new g.PdfColor(s.unscheduledTaskBarColor),new g.PdfColor(255,255,255)),h.drawRectangle(ie,i.x+C(this.left-r)+.5,i.y+J,C(ne),C(s.height)),ae=new g.PdfLinearGradientBrush(new g.PointF(i.x+C(this.left-r)+.5+C(ne),0),new g.PointF(i.x+C(this.left-r)+C(ne)/2,0),new g.PdfColor(255,255,255),new g.PdfColor(s.unscheduledTaskBarColor)),h.drawRectangle(ae,i.x+C(this.left-r)+.5+C(ne)/2,i.y+J,C(ne)/2,C(s.height)),L.image||L.value){ce=void 0;if(t.isNullOrUndefined(s.taskbarTemplate.image))ce=0;else{ce=s.taskbarTemplate.image[0].width;ge=new g.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ge,i.x+C(this.left-r)+.5,i.y+J,C(s.taskbarTemplate.image[0].width),C(s.taskbarTemplate.image[0].height))}t.isNullOrUndefined(s.taskbarTemplate.value)||h.drawString(s.taskbarTemplate.value,c,m,f,i.x+C(this.left-r)+.5+ce,i.y+J,C(s.width),C(this.height),x)}}this.left=0,this.isCompleted=!1,this.startPage=F}else if(te<=a.endDate&&a.startDate<=te&&!this.isCompleted){if(this.isStartPoint||(this.taskStartPoint=hi({},i),this.isStartPoint=!0),this.isScheduledTask||"duration"!==this.unscheduledTaskBy)if(!s.isAutoSchedule&&s.isParentTask){var de=new g.PdfPath;de.addEllipse(0,0,5,5),h.save();var he=i.x+C(this.left+.5),pe=C(s.width)+he-5,ue=i.y+J;h.drawLine(j,he,ue,pe,ue),h.translateTransform(pe,ue-2),h.drawPath(H,z,de),h.restore(),j.dashStyle=g.PdfDashStyle.Solid}else s.isAutoSchedule||s.isParentTask?this.isScheduledTask||"endDate"!==this.unscheduledTaskBy?s.isSpliterTask?(G.dashStyle=g.PdfDashStyle.Dot,h.drawLine(G,new g.PointF(i.x+C(this.left)+.5,i.y+J+C(s.height/2)),new g.PointF(C(s.width)+i.x+C(this.left),i.y+J+C(s.height/2))),s.segmentCollection.map(function(e,r){var n=t.isNullOrUndefined(d.taskSegmentStyles)?V:new g.PdfPen(d.taskSegmentStyles[r].taskBorderColor),o=t.isNullOrUndefined(d.taskSegmentStyles)?B:new g.PdfSolidBrush(d.taskSegmentStyles[r].taskColor);if(0!==e.width&&e.startDate<a.endDate&&e.endDate>a.startDate){0!==d.segmentCollection[r].left&&(d.segmentCollection[r].left=d.segmentCollection[r].left-d.pageDetailedWidth);var l=a.totalWidth-e.left;e.width<l&&(l=e.width);var p=l;e.progressWidth<p&&(p=e.progressWidth),h.drawRectangle(n,o,i.x+C(s.left+.5+e.left),i.y+J,C(l),C(s.height));var u=t.isNullOrUndefined(d.taskSegmentStyles)?Y:new g.PdfPen(d.taskSegmentStyles[r].progressColor),y=t.isNullOrUndefined(d.taskSegmentStyles)?K:new g.PdfSolidBrush(d.taskSegmentStyles[r].progressColor);if(h.drawRectangle(u,y,i.x+C(s.left+.5+e.left),i.y+J,C(p),C(s.height)),L.image||L.value){var D=void 0;if(t.isNullOrUndefined(s.taskbarTemplate.image))D=0;else{D=s.taskbarTemplate.image[0].width;var v=new g.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(v,i.x+C(s.left+.5+e.left),i.y+J,C(s.taskbarTemplate.image[0].width),C(s.taskbarTemplate.image[0].height))}t.isNullOrUndefined(s.taskbarTemplate.value)||h.drawString(s.taskbarTemplate.value,c,m,f,i.x+C(s.left+.5+e.left)+D,i.y+J,C(e.width),C(s.height),x)}}}),this.pageDetailedWidth+=a.totalWidth):h.drawRectangle(V,B,i.x+C(s.left+.5),i.y+J,C(s.width),C(s.height)):this.drawUnscheduledTask(h,i,r,J):(h.drawRectangle(W,null,i.x+C(this.left+.5),i.y+J,C(s.width),C(s.height)),h.save(),h.setTransparency(.87),h.drawRectangle(null,_,i.x+C(this.left+.5),i.y+J,C(s.width),C(s.height)),h.restore(),h.drawRectangle(null,Z,i.x+C(this.left+.5),i.y+J,C(s.progressWidth),C(s.height)));else{var ie=void 0,ae=void 0;if(ie=new g.PdfLinearGradientBrush(new g.PointF(i.x+C(s.left+.5)+C(s.width)/2,0),new g.PointF(i.x+C(s.left+.5),0),new g.PdfColor(s.unscheduledTaskBarColor),new g.PdfColor(255,255,255)),h.drawRectangle(ie,i.x+C(s.left+.5),i.y+J,C(s.width),C(s.height)),ae=new g.PdfLinearGradientBrush(new g.PointF(i.x+C(s.left+.5)+C(s.width),0),new g.PointF(i.x+C(s.left+.5)+C(s.width)/2,0),new g.PdfColor(255,255,255),new g.PdfColor(s.unscheduledTaskBarColor)),h.drawRectangle(ae,i.x+C(s.left+.5)+C(s.width)/2,i.y+J,C(s.width)/2,C(s.height)),L.image||L.value){ce=void 0;if(t.isNullOrUndefined(s.taskbarTemplate.image))ce=0;else{ce=s.taskbarTemplate.image[0].width;ge=new g.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ge,i.x+C(s.left+.5),i.y+J,C(s.taskbarTemplate.image[0].width),C(s.taskbarTemplate.image[0].height))}t.isNullOrUndefined(s.taskbarTemplate.value)||h.drawString(s.taskbarTemplate.value,c,m,f,i.x+C(s.left+.5)+ce,i.y+J,C(s.width),C(this.height),x)}}if(this.isScheduledTask&&!s.isSpliterTask&&(t.isNullOrUndefined(L.image)&&t.isNullOrUndefined(L.value)&&s.isAutoSchedule&&h.drawRectangle(Y,K,i.x+C(s.left+.5),i.y+J,C(s.progressWidth),C(s.height)),!t.isNullOrUndefined(this.taskLabel)))if(O=this.progressWidth,I&&(O=this.width),I&&t.isNullOrUndefined(s.taskbarTemplate.value)){if(!t.isNullOrUndefined(this.remainString)){me=this.getWidth(this.remainString,a.endPoint-this.stringLeft,15);h.drawString(me.lines[0].text,k,D,b,i.x+C(this.left)-(E.left+E.right),i.y+J-(E.top+E.bottom),C(O),C(this.height),x)}}else t.isNullOrUndefined(this.taskLabel)||I||(O=this.progressWidth,I&&(O=this.width),h.drawString(this.taskLabel.toString(),k,D,b,i.x+C(this.left)-(E.left+E.right),i.y+J-(E.top+E.bottom),C(O),C(this.height),x));this.isCompleted=!0,this.endPage=F}else if(ee<a.startDate&&te>a.endDate){if(this.isStartPoint||(this.taskStartPoint=hi({},i),this.isStartPoint=!0),this.isScheduledTask||"duration"!==this.unscheduledTaskBy)if(this.isScheduledTask||"endDate"!==this.unscheduledTaskBy)if(s.isAutoSchedule||s.isParentTask)if(!s.isAutoSchedule&&s.isParentTask)j.dashStyle=g.PdfDashStyle.Solid,h.drawLine(j,i.x+C(s.left)+.5,i.y+J,C(a.totalWidth),i.y+J);else if(s.isSpliterTask)G.dashStyle=g.PdfDashStyle.Dot,this.isAutoFit()?h.drawLine(G,new g.PointF(i.x+this.left+.5,i.y+J+C(s.height/2)),new g.PointF(a.totalWidth+i.x+this.left,i.y+J+C(s.height/2))):h.drawLine(G,new g.PointF(i.x+C(this.left)+.5,i.y+J+C(s.height/2)),new g.PointF(C(a.totalWidth)+i.x+C(this.left),i.y+J+C(s.height/2))),s.segmentCollection.map(function(e,r){var n=t.isNullOrUndefined(d.taskSegmentStyles)?V:new g.PdfPen(d.taskSegmentStyles[r].taskBorderColor),o=t.isNullOrUndefined(d.taskSegmentStyles)?B:new g.PdfSolidBrush(d.taskSegmentStyles[r].taskColor);if(0!==e.width&&e.startDate<a.endDate&&e.endDate>a.startDate){0!==d.segmentCollection[r].left&&(d.segmentCollection[r].left=d.segmentCollection[r].left-d.pageDetailedWidth);var l=a.totalWidth-e.left;e.width<l&&(l=e.width);var p=l;e.progressWidth<p&&(p=e.progressWidth),h.drawRectangle(n,o,i.x+C(s.left+.5+e.left),i.y+J,C(l),C(s.height));var u=t.isNullOrUndefined(d.taskSegmentStyles)?Y:new g.PdfPen(d.taskSegmentStyles[r].progressColor),c=t.isNullOrUndefined(d.taskSegmentStyles)?K:new g.PdfSolidBrush(d.taskSegmentStyles[r].progressColor);h.drawRectangle(u,c,i.x+C(s.left+.5+e.left),i.y+J,C(p),C(s.height)),e.width>l&&(d.segmentCollection[parseInt(r.toString(),10)].width=e.width-l,d.segmentCollection[parseInt(r.toString(),10)].left=0)}}),this.pageDetailedWidth+=a.totalWidth;else{if(h.drawRectangle(V,B,i.x+C(s.left)+.5,i.y+J,C(a.totalWidth),C(s.height)),!t.isNullOrUndefined(s.taskbarTemplate.value)&&!t.isNullOrUndefined(this.remainString)){me=this.getWidth(this.remainString,a.endPoint-this.stringLeft,15);h.drawString(me.lines[0].text,c,m,f,i.x+C(s.left)+.5,i.y+J,C(a.totalWidth),C(this.height),x)}if(this.isScheduledTask&&!s.isParentTask){ye=0;ye=this.progressWidth<=a.totalWidth?this.progressWidth:a.totalWidth,t.isNullOrUndefined(L.image)&&t.isNullOrUndefined(L.value)&&h.drawRectangle(Y,K,i.x+C(s.left)+.5,i.y+J,C(ye),C(s.height)),this.progressWidth-=ye,t.isNullOrUndefined(this.taskLabel)||(O=ye,I&&(O=this.width),h.drawString(this.taskLabel.toString(),k,D,b,i.x+C(this.left)-(E.left+E.right),i.y+J-(E.top+E.bottom),C(O),C(this.height),x))}}else{h.drawRectangle(W,null,i.x+C(s.left)+.5,i.y+J,C(a.totalWidth),C(s.height)),h.save(),h.setTransparency(.87),h.drawRectangle(null,_,i.x+C(s.left)+.5,i.y+J,C(a.totalWidth),C(s.height)),h.restore();ye=0;ye=this.progressWidth<=a.totalWidth?this.progressWidth:a.totalWidth,t.isNullOrUndefined(L.image)&&t.isNullOrUndefined(L.value)&&h.drawRectangle(Y,K,i.x+C(s.left)+.5,i.y+J,C(ye),C(s.height)),this.progressWidth-=ye,h.drawRectangle(null,Z,i.x+C(s.left)+.5,i.y+J,C(ye),C(s.height))}else this.drawUnscheduledTask(h,i,r,J);else{var ie=void 0,ae=void 0;if(ie=new g.PdfLinearGradientBrush(new g.PointF(i.x+C(s.left)+.5+C(a.totalWidth)/2,0),new g.PointF(i.x+C(s.left),0),new g.PdfColor(s.unscheduledTaskBarColor),new g.PdfColor(255,255,255)),h.drawRectangle(ie,i.x+C(s.left)+.5,i.y+J,C(a.totalWidth),C(s.height)),ae=new g.PdfLinearGradientBrush(new g.PointF(i.x+C(s.left)+.5+C(a.totalWidth),0),new g.PointF(i.x+C(s.left)+C(a.totalWidth)/2,0),new g.PdfColor(255,255,255),new g.PdfColor(s.unscheduledTaskBarColor)),h.drawRectangle(ae,i.x+C(s.left)+.5+C(a.totalWidth)/2,i.y+J,C(a.totalWidth)/2,C(s.height)),L.image||L.value){var ce=void 0;if(t.isNullOrUndefined(s.taskbarTemplate.image))ce=0;else{ce=s.taskbarTemplate.image[0].width;var ge=new g.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ge,i.x+C(s.left)+.5,i.y+J,C(s.taskbarTemplate.image[0].width),C(s.taskbarTemplate.image[0].height))}t.isNullOrUndefined(s.taskbarTemplate.value)||h.drawString(s.taskbarTemplate.value,c,m,f,i.x+C(s.left+.5)+ce,i.y+J,C(s.width),C(this.height),x)}}this.isCompleted=!1,this.width-=a.totalWidth}if(this.parent.renderBaseline&&s.baselineStartDate&&s.baselineEndDate)if(a.startDate<=s.baselineStartDate&&s.baselineEndDate<=a.endDate)this.isStartPoint||(this.taskStartPoint=hi({},i),this.isStartPoint=!0),this.parent.renderBaseline&&s.baselineStartDate&&s.baselineEndDate&&(this.isAutoFit()?h.drawRectangle(U,N,i.x+(s.baselineLeft-r)+.5,i.y+J+C(s.height+3),s.baselineWidth,C(this.baselineHeight)):h.drawRectangle(U,N,i.x+C(s.baselineLeft-r)+.5,i.y+J+C(s.height+3),C(s.baselineWidth),C(this.baselineHeight))),this.isCompletedBaseline=!0,this.startPage=F,this.endPage=F;else if(a.startDate<=s.baselineStartDate&&a.endDate>=s.baselineStartDate&&s.baselineEndDate>=a.endDate){this.isStartPoint||(this.taskStartPoint=hi({},i),this.isStartPoint=!0);fe=0;(re=this.baselineWidth)<(fe=a.totalWidth-(s.baselineLeft-r))&&(fe=re),this.parent.renderBaseline&&s.baselineStartDate&&s.baselineEndDate&&(this.isAutoFit()?h.drawRectangle(U,N,i.x+(s.baselineLeft-r)+.5,i.y+J+C(s.height+3),fe,C(this.baselineHeight)):h.drawRectangle(U,N,i.x+C(s.baselineLeft-r)+.5,i.y+J+C(s.height+3),C(fe),C(this.baselineHeight))),s.baselineWidth=s.baselineWidth-fe,this.baselineLeft=0,this.isCompletedBaseline=!1,this.startPage=F}else s.baselineEndDate<=a.endDate&&a.startDate<=s.baselineEndDate&&!this.isCompletedBaseline?(this.parent.renderBaseline&&s.baselineStartDate&&s.baselineEndDate&&(this.isAutoFit()?h.drawRectangle(U,N,i.x+(s.baselineLeft+.5),i.y+J+C(s.height+3),s.baselineWidth,C(this.baselineHeight)):h.drawRectangle(U,N,i.x+C(s.baselineLeft+.5),i.y+J+C(s.height+3),C(s.baselineWidth),C(this.baselineHeight))),this.isCompletedBaseline=!0,this.endPage=F):s.baselineStartDate<a.startDate&&s.baselineEndDate>a.endDate&&(this.parent.renderBaseline&&s.baselineStartDate&&s.baselineEndDate&&(this.isAutoFit()?h.drawRectangle(U,N,i.x+s.baselineLeft+.5,i.y+J+C(s.height+3),a.totalWidth,C(s.baselineHeight)):h.drawRectangle(U,N,i.x+C(s.baselineLeft)+.5,i.y+J+C(s.height+3),C(a.totalWidth),C(s.baselineHeight))),this.isCompletedBaseline=!1,this.baselineWidth-=a.totalWidth);if(!this.isAutoSchedule&&s.isParentTask)if(a.startDate<=s.autoStartDate&&s.autoEndDate<=a.endDate)this.isStartPoint||(this.taskStartPoint=hi({},i),this.isStartPoint=!0),!s.isAutoSchedule&&s.isParentTask&&(this.isAutoFit()?h.drawRectangle(A,null,i.x+(this.autoLeft-r)+.5,i.y+J+10,this.autoWidth,C(12)):h.drawRectangle(A,null,i.x+C(this.autoLeft-r)+.5,i.y+J+10,C(this.autoWidth),C(12)),h.save(),h.setTransparency(.87),this.isAutoFit()?h.drawRectangle(null,q,i.x+(this.autoLeft-r)+.5,i.y+J+10,this.autoWidth,C(12)):h.drawRectangle(null,q,i.x+C(this.autoLeft-r)+.5,i.y+J+10,C(this.autoWidth),C(12)),h.restore(),this.isAutoFit()?h.drawRectangle(null,X,i.x+(this.autoLeft-r)+.5,i.y+J+10,s.progressWidth,C(12)):h.drawRectangle(null,X,i.x+C(this.autoLeft-r)+.5,i.y+J+10,C(s.progressWidth),C(12))),t.isNullOrUndefined(this.taskLabel)||(this.isAutoFit()?h.drawString(this.taskLabel.toString(),k,D,b,i.x+(this.autoLeft-r)+.5-(E.left+E.right),i.y+J+8-(E.top+E.bottom),this.autoWidth,C(this.height),x):h.drawString(this.taskLabel.toString(),k,D,b,i.x+C(this.autoLeft-r)+.5-(E.left+E.right),i.y+J+8-(E.top+E.bottom),C(this.autoWidth),C(this.height),x)),this.isCompletedAutotask=!0,this.startPage=F,this.endPage=F;else if(a.startDate<=s.autoStartDate&&a.endDate>=s.autoStartDate&&s.autoEndDate>=a.endDate){this.isStartPoint||(this.taskStartPoint=hi({},i),this.isStartPoint=!0);var fe=0,se=0;if(fe=a.totalWidth-(this.autoLeft-r),se=a.totalWidth-(this.autoLeft-r),!s.isAutoSchedule&&s.isParentTask&&(this.isAutoFit()?h.drawRectangle(A,null,i.x+(this.autoLeft-r)+.5,i.y+J+10,fe,C(12)):h.drawRectangle(A,null,i.x+C(this.autoLeft-r)+.5,i.y+J+10,C(fe),C(12)),h.save(),h.setTransparency(.87),this.isAutoFit()?h.drawRectangle(null,q,i.x+(this.autoLeft-r)+.5,i.y+J+10,fe,C(12)):h.drawRectangle(null,q,i.x+C(this.autoLeft-r)+.5,i.y+J+10,C(fe),C(12)),h.restore(),this.isAutoFit()?h.drawRectangle(null,X,i.x+(this.autoLeft-r)+.5,i.y+J+10,s.progressWidth,C(12)):h.drawRectangle(null,X,i.x+C(this.autoLeft-r)+.5,i.y+J+10,C(se),C(12)),s.autoWidth=s.autoWidth-fe,s.progressWidth=s.progressWidth-se),this.parent.labelSettings.taskLabel&&!t.isNullOrUndefined(this.taskLabel))if(this.stringLeft=this.autoLeft,t.isNullOrUndefined(s.taskbarTemplate.value)){me=this.getWidth(this.taskLabel.toString(),a.endPoint-this.stringLeft,15);h.drawString(me.lines[0].text,k,D,b,i.x+C(this.autoLeft-r)+.5,i.y+J+10,C(s.progressWidth),C(this.height),x),t.isNullOrUndefined(me.remainder)||(this.remainString=me.remainder,this.stringLeft=a.endPoint)}else this.isAutoFit()?h.drawString(this.taskLabel.toString(),k,D,b,i.x+(this.autoLeft-r)+.5-(E.left+E.right),i.y+J+10-(E.top+E.bottom),s.progressWidth,C(this.height),x):h.drawString(this.taskLabel.toString(),k,D,b,i.x+C(this.autoLeft-r)+.5-(E.left+E.right),i.y+J+10-(E.top+E.bottom),C(s.progressWidth),C(this.height),x);this.autoLeft=0,this.isCompletedAutotask=!1,this.startPage=F}else if(s.autoEndDate<=a.endDate&&a.startDate<=s.autoEndDate&&!this.isCompletedAutotask){if(this.isStartPoint?!s.isAutoSchedule&&s.isParentTask&&(h.drawRectangle(A,null,i.x+C(this.autoLeft+.5),i.y+J+10,C(s.autoWidth),C(12)),h.save(),h.setTransparency(.87),h.drawRectangle(q,i.x+C(this.autoLeft+.5),i.y+J+10,C(s.autoWidth),C(12)),h.restore(),h.drawRectangle(null,X,i.x+C(this.autoLeft+.5),i.y+J+10,C(s.progressWidth),C(12))):(this.taskStartPoint=hi({},i),this.isStartPoint=!0),!t.isNullOrUndefined(this.taskLabel))if(I&&t.isNullOrUndefined(s.taskbarTemplate.value)){if(!t.isNullOrUndefined(this.remainString)){var me=this.getWidth(this.remainString,a.endPoint-this.stringLeft,15);h.drawString(me.lines[0].text,k,D,b,i.x+C(this.autoLeft+.5)-(E.left+E.right),i.y+J+10-(E.top+E.bottom),C(s.progressWidth),C(this.height),x)}}else t.isNullOrUndefined(this.taskLabel)||I||h.drawString(this.taskLabel.toString(),k,D,b,i.x+C(this.autoLeft+.5)-(E.left+E.right),i.y+J+10-(E.top+E.bottom),C(s.progressWidth),C(this.height),x);this.isCompletedAutotask=!0,this.endPage=F}else if(s.autoStartDate<a.startDate&&s.autoEndDate>a.endDate){if(this.isStartPoint||(this.taskStartPoint=hi({},i),this.isStartPoint=!0),!s.isAutoSchedule&&s.isParentTask){var ye=0;ye=this.progressWidth<=a.totalWidth?this.progressWidth:a.totalWidth,this.isAutoFit()?h.drawRectangle(null,X,i.x+(this.autoLeft+.5),i.y+J+10,ye,C(12)):0!==s.progressWidth&&h.drawRectangle(null,X,i.x+C(this.autoLeft+.5),i.y+J+10,C(ye),C(12)),this.progressWidth-=ye,this.isAutoFit()?h.drawRectangle(A,null,i.x+this.autoLeft+.5,i.y+J+10,a.totalWidth,C(12)):h.drawRectangle(A,null,i.x+C(this.autoLeft)+.5,i.y+J+10,C(a.totalWidth),C(12)),h.save(),h.setTransparency(.87),this.isAutoFit()?h.drawRectangle(null,q,i.x+(this.autoLeft-r)+.5,i.y+J+10,a.totalWidth,C(12)):h.drawRectangle(null,q,i.x+C(this.autoLeft)+.5,i.y+J+10,C(a.totalWidth),C(12)),h.restore()}this.isCompletedAutotask=!1,this.autoWidth-=a.totalWidth}!t.isNullOrUndefined(s.indicators)&&s.indicators.length>0&&s.indicators.map(function(s,o){var l=d.parent.dateValidationModule.getDateFromFormat(s.date,!0);if(a.startDate<=l&&l<=a.endDate){var p=d.parent.chartRowsModule.getIndicatorleft(s.date);if(!t.isNullOrUndefined(s.base64)){var u=new g.PdfBitmap(s.base64);if(d.isAutoFit()){h.drawImage(u,i.x+(p-r)+.5+10-d.parent.perDayWidth/2,i.y+J,10,10);c=h.save();h.setClip(new g.RectangleF(i.x,i.y,e.contentWidth,n)),h.drawString(s.name,y,null,g.PdfBrushes.Black,i.x+(p-r)+.5+15+10-d.parent.perDayWidth/2,i.y+J,null),h.restore(c)}else{h.drawImage(u,i.x+C(p-r)+.5+10,i.y+J,10,10);var c=h.save();h.setClip(new g.RectangleF(i.x,i.y,e.contentWidth,n)),h.drawString(s.name,y,null,g.PdfBrushes.Black,i.x+C(p-r)+.5+15+10,i.y+J,null),h.restore(c)}}}})}return this.drawRightLabel(e,i,a,r),p},e.prototype.getPdfFont=function(e){var t;if(e&&e.label&&(e.label.fontSize||e.label.fontStyle||e.label.fontFamily)){var i=e.label.fontSize?e.label.fontSize:this.defaultFontSize,a=e.label.fontFamily,r=e.label.fontFamily?a:this.fontFamily,n=e.label.fontStyle,s=e.label.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(n):g.PdfFontStyle.Regular;t=new g.PdfStandardFont(r,i,s)}return t},e.prototype.drawRightLabel=function(e,i,a,r){var n,s=e.graphics;if(t.isNullOrUndefined(this.rightTaskLabel.value))if(t.isNullOrUndefined(this.labelSettings.rightLabel.image))this.labelSettings.rightLabel.value&&this.drawRightLabelValue(e,i,a,r,this.labelSettings.rightLabel.value);else{this.previousWidthofRightImage=0,this.previousWidthofRightValue=0;for(var o=0;o<this.labelSettings.rightLabel.image.length;o++)if(this.drawRigthlabelImage(e,i,a,r,this.labelSettings.rightLabel.image[o]),this.labelSettings.rightLabel.value){var l=this.labelSettings.rightLabel.value.split(",");l&&(this.rightTaskLabel.isCompleted=!1,this.drawRightLabelValue(e,i,a,r-this.spaceBetweenImageAndValue,l[o]))}}else{n=this.rightTaskLabel.isLeftCalculated?this.rightTaskLabel.left:this.isAutoFit()?this.rightTaskLabel.left:C(this.rightTaskLabel.left);var d=void 0;d=this.isAutoFit()?n-r+i.x:n-C(r)+i.x;var h=this.isAutoFit()?C(n):n;if(a.startPoint<=h&&h<a.endPoint&&!t.isNullOrUndefined(this.rightTaskLabel.value)&&!this.rightTaskLabel.isCompleted){var p=this.getWidth(this.rightTaskLabel.value,a.endPoint-h,15),u=new g.PdfStandardFont(this.fontFamily,this.defaultFontSize),c=void 0,f=this.parent.pdfExportModule.helper.exportProps.ganttStyle;t.isNullOrUndefined(f)||t.isNullOrUndefined(f.label)||t.isNullOrUndefined(f.label.fontSize)&&t.isNullOrUndefined(f.label.fontStyle)&&t.isNullOrUndefined(f.label.fontFamily)||(c=this.getPdfFont(f)),t.isNullOrUndefined(c)||(u=c);var m={left:0,right:0,top:0,bottom:0};t.isNullOrUndefined(f)||t.isNullOrUndefined(f.label)||t.isNullOrUndefined(f.label.padding)||(m=f.label.padding),!t.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(u=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var y=(C(this.parent.rowHeight)-p.actualSize.height)/2,D=new g.PointF(d+m.left,i.y+y+m.top),v=new g.SizeF(e.contentWidth-d-(m.left+m.right),p.actualSize.height-(m.top+m.bottom)),k=new g.RectangleF(D,v),b=new g.PdfStringFormat;if(b.alignment=g.PdfTextAlignment.Left,b.lineAlignment=g.PdfVerticalAlignment.Middle,t.isNullOrUndefined(f)||t.isNullOrUndefined(f.label)||t.isNullOrUndefined(f.label.format)||t.isNullOrUndefined(f.label.format.alignment)||(b.alignment=f.label.format.alignment),p.actualSize.width>0){var w=this.parent.pdfExportModule.helper.exportProps.ganttStyle,T=new g.PdfSolidBrush(w&&w.label&&w.label.fontBrush?w.label.fontBrush:this.labelColor),S=null;t.isNullOrUndefined(w)||t.isNullOrUndefined(w.label)||t.isNullOrUndefined(w.label.backgroundColor)||(S=new g.PdfSolidBrush(w.label.backgroundColor));var P=null;if(t.isNullOrUndefined(w)||t.isNullOrUndefined(w.label)||t.isNullOrUndefined(w.label.borderColor)||(P=new g.PdfPen(w.label.borderColor)),this.labelSettings.rightLabel&&(this.labelSettings.rightLabel.fontStyle.fontSize||this.labelSettings.rightLabel.fontStyle.fontStyle||this.labelSettings.rightLabel.fontStyle.fontFamily)){var R=this.labelSettings.rightLabel,M=R.fontStyle&&R.fontStyle.fontFamily?R.fontStyle.fontFamily:this.fontFamily||g.PdfFontFamily.Helvetica,x=R.fontStyle&&R.fontStyle.fontSize?R.fontStyle.fontSize:u.fontSize||this.defaultFontSize,O=R.fontStyle&&"string"==typeof R.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(R.fontStyle.fontStyle):R.fontStyle&&R.fontStyle.fontStyle?R.fontStyle.fontStyle:g.PdfFontStyle.Regular;u=new g.PdfStandardFont(M,x,O),T=R.fontStyle.fontColor?new g.PdfSolidBrush(R.fontStyle.fontColor):T}var I=u.measureString(p.lines[0].text);s.drawRectangle(P,S,k.x-3,k.y,I.width+6,I.height),s.drawString(p.lines[0].text,u,null,T,k.x,k.y,v.width,v.height,b),null!==p.remainder?(this.rightTaskLabel.value=p.remainder,this.rightTaskLabel.left=a.endPoint,this.rightTaskLabel.isLeftCalculated=!0):this.rightTaskLabel.isCompleted=!0}else this.rightTaskLabel.left=a.endPoint}}},e.prototype.drawRigthlabelImage=function(e,i,a,r,n){var s,o,l=e.graphics;if(!t.isNullOrUndefined(this.labelSettings.rightLabel)&&!t.isNullOrUndefined(this.labelSettings.rightLabel.image)){if(this.labelSettings.isLeftCalculated)s=this.rightTaskLabel.left;else if(this.isAutoFit())this.labelSettings.rightLabel.image.length>1?(s=this.rightTaskLabel.left+ +this.previousWidthofRightValue,this.previousWidthofRightImage=n.width):s=this.rightTaskLabel.left;else{var d=void 0;t.isNullOrUndefined(this.labelSettings.rightLabel.value)||(d=this.labelSettings.rightLabel.value.split(",")),this.labelSettings.rightLabel.image.length>1&&d.length>1?(s=C(this.rightTaskLabel.left)+this.previousWidthofRightValue,this.previousWidthofRightImage=n.width):this.labelSettings.rightLabel.image.length>1?(s=C(this.rightTaskLabel.left)+this.previousWidthofRightImage,this.previousWidthofRightImage=n.width):s=C(this.rightTaskLabel.left)}var h=void 0;h=this.isAutoFit()?s-r+i.x:s-C(r)+i.x;var p=this.isAutoFit()?C(s):s;if(a.startPoint<=p&&p<a.endPoint&&!t.isNullOrUndefined(this.labelSettings.rightLabel)&&!this.rightTaskLabel.isCompleted){var u=new g.SizeF(n.width,n.height),c=(C(this.parent.rowHeight)-u.height)/2,f=new g.PointF(h,i.y+c),m=new g.SizeF(u.width,u.height);o=new g.RectangleF(f,m);var y=new g.PdfBitmap(n.base64);u.width>0?(l.drawImage(y,o.x,o.y,u.width,u.height),null!==this.labelSettings.rightLabel.value?this.rightTaskLabel.isLeftCalculated=!0:t.isNullOrUndefined(this.labelSettings.rightLabel.value)&&(this.rightTaskLabel.isCompleted=!0)):this.rightTaskLabel.left=a.endPoint}}},e.prototype.drawRightLabelValue=function(e,i,a,r,n){var s,o=e.graphics;if(!t.isNullOrUndefined(this.labelSettings.rightLabel.value)){if(this.labelSettings.isLeftCalculated)s=this.rightTaskLabel.left;else if(this.isAutoFit())if(this.labelSettings.rightLabel.image)if(this.labelSettings.rightLabel.image.length>1){if(s=this.rightTaskLabel.left+this.previousWidthofRightImage+this.previousWidthofRightValue,!t.isNullOrUndefined(n)){h=this.getWidthofrightLabel(n,a.endPoint-s,15);this.previousWidthofRightValue+=h.actualSize.width+this.previousWidthofRightImage}}else s=this.rightTaskLabel.left+this.labelSettings.rightLabel.image[0].width;else s=this.rightTaskLabel.left;else if(this.labelSettings.rightLabel.image)if(this.labelSettings.rightLabel.image.length>1){if(s=C(this.rightTaskLabel.left)+this.previousWidthofRightImage+this.previousWidthofRightValue,!t.isNullOrUndefined(n)){h=this.getWidthofrightLabel(n,a.endPoint-s,15);this.previousWidthofRightValue+=h.actualSize.width+this.previousWidthofRightImage}}else s=C(this.rightTaskLabel.left)+this.labelSettings.rightLabel.image[0].width;else s=C(this.rightTaskLabel.left);var l=void 0;l=this.isAutoFit()?s-r+i.x:s-C(r)+i.x;var d=this.isAutoFit()?C(s):s;if(a.startPoint<=d&&d<a.endPoint&&!t.isNullOrUndefined(n)&&!this.rightTaskLabel.isCompleted){var h=this.getWidthofrightLabel(n,a.endPoint-d,15),p=new g.PdfStandardFont(this.fontFamily,this.defaultFontSize);!t.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(p=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var u=(C(this.parent.rowHeight)-h.actualSize.height)/2,c=new g.PointF(l,i.y+u),f=new g.SizeF(h.actualSize.width,h.actualSize.height),m=new g.RectangleF(c,f),y=new g.PdfStringFormat;if(y.alignment=g.PdfTextAlignment.Right,y.lineAlignment=g.PdfVerticalAlignment.Middle,h.actualSize.width>0){var D=new g.PdfSolidBrush(this.labelColor),v=this.labelSettings.rightLabel,k=v.fontStyle&&v.fontStyle.fontFamily?v.fontStyle.fontFamily:this.fontFamily||g.PdfFontFamily.Helvetica,b=v.fontStyle&&v.fontStyle.fontSize?v.fontStyle.fontSize:p.fontSize||this.defaultFontSize,w=v.fontStyle&&"string"==typeof v.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(v.fontStyle.fontStyle):v.fontStyle&&v.fontStyle.fontStyle?v.fontStyle.fontStyle:g.PdfFontStyle.Regular,T=new g.PdfStandardFont(k,b,w),S=v.fontStyle.fontColor?new g.PdfSolidBrush(v.fontStyle.fontColor):D;o.drawString(n,T,null,S,m.x,m.y,h.actualSize.width,h.actualSize.height,y),t.isNullOrUndefined(h.remainder)||null===h.remainder?t.isNullOrUndefined(v.value)&&(this.rightTaskLabel.isCompleted=!0):(this.rightTaskLabel.value=h.remainder,this.rightTaskLabel.left=a.endPoint,this.rightTaskLabel.isLeftCalculated=!0)}else this.rightTaskLabel.left=a.endPoint}}},e.prototype.drawLeftLabel=function(e,i,a,r,n){var s,o=e.graphics;if(t.isNullOrUndefined(this.leftTaskLabel.value))if(t.isNullOrUndefined(this.labelSettings.leftLabel)||t.isNullOrUndefined(this.labelSettings.leftLabel.image))t.isNullOrUndefined(this.labelSettings.leftLabel)||t.isNullOrUndefined(this.labelSettings.leftLabel.value)||this.drawLeftLabelValue(e,i,a,r,this.labelSettings.leftLabel.value);else{this.previousWidthofLeftImage=0,this.previousWidthofLeftValue=0,this.totalLeftWidth=0;for(p=0;p<this.labelSettings.leftLabel.image.length;p++){var l=void 0,d=void 0;t.isNullOrUndefined(this.labelSettings.leftLabel.value)||(l=this.labelSettings.leftLabel.value.split(","),d=this.getWidth(l[p],Number.MAX_VALUE,15));var h=t.isNullOrUndefined(d)?0:d.actualSize.width;this.totalLeftWidth+=this.labelSettings.leftLabel.image[p].width+h}for(var p=0;p<this.labelSettings.leftLabel.image.length;p++)this.drawLeftLabelImage(e,i,a,r,this.labelSettings.leftLabel.image[p]),this.labelSettings.leftLabel.value&&(l=this.labelSettings.leftLabel.value.split(","))&&this.drawLeftLabelValue(e,i,a,r-this.spaceBetweenImageAndValue,l[p])}else{var u=0;if(u=this.left,this.leftTaskLabel.isLeftCalculated)s=this.leftTaskLabel.left;else{var d=this.getWidth(this.leftTaskLabel.value,Number.MAX_VALUE,15),c=this.isMilestone?Math.floor(this.parent.chartRowsModule.taskBarHeight/2)+33:33;s=this.isAutoFit()?u-c-d.actualSize.width:C(u-c)-d.actualSize.width,this.leftTaskLabel.left=s,this.leftTaskLabel.isLeftCalculated=!0}var f=void 0;if(this.isAutoFit()){if(f=s-C(r)+i.x,!n.isAutoSchedule&&n.isParentTask){m=n.left-n.autoLeft;f=n.left<n.autoLeft?s-r+i.x:s-r+i.x-m}}else if(f=s-C(r)+i.x,!n.isAutoSchedule&&n.isParentTask){var m=C(n.left)-C(n.autoLeft);f=n.left<n.autoLeft?s-C(r)+i.x:s-C(r)+i.x-m}var y=this.isAutoFit()?C(s):s;if(a.startPoint<=y&&y<a.endPoint&&!t.isNullOrUndefined(this.leftTaskLabel.value)&&!this.leftTaskLabel.isCompleted){var d=this.getWidth(this.leftTaskLabel.value,a.endPoint-y,15),D=new g.PdfStandardFont(this.fontFamily,this.defaultFontSize),v=void 0,k=this.parent.pdfExportModule.helper.exportProps.ganttStyle;t.isNullOrUndefined(k)||t.isNullOrUndefined(k.label)||t.isNullOrUndefined(k.label.fontSize)&&t.isNullOrUndefined(k.label.fontStyle)&&t.isNullOrUndefined(k.label.fontFamily)||(v=this.getPdfFont(k)),t.isNullOrUndefined(v)||(D=v),!t.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(D=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var b={left:0,right:0,top:0,bottom:0};t.isNullOrUndefined(k)||t.isNullOrUndefined(k.label)||t.isNullOrUndefined(k.label.padding)||(b=k.label.padding);var w=(C(this.parent.rowHeight)-d.actualSize.height)/2,T=new g.PointF(f+b.left,i.y+w+b.top),S=new g.SizeF(d.actualSize.width-(b.left+b.right),d.actualSize.height-(b.top+b.bottom)),P=new g.RectangleF(T,S),R=new g.PdfStringFormat;if(R.alignment=g.PdfTextAlignment.Right,R.lineAlignment=g.PdfVerticalAlignment.Middle,d.actualSize.width>0){var M=new g.PdfSolidBrush(k&&k.label&&k.label.fontBrush?k.label.fontBrush:this.labelColor),x=null;t.isNullOrUndefined(k)||t.isNullOrUndefined(k.label)||t.isNullOrUndefined(k.label.backgroundColor)||(x=new g.PdfSolidBrush(k.label.backgroundColor));var O=null;if(t.isNullOrUndefined(k)||t.isNullOrUndefined(k.label)||t.isNullOrUndefined(k.label.borderColor)||(O=new g.PdfPen(k.label.borderColor)),this.labelSettings.leftLabel&&(this.labelSettings.leftLabel.fontStyle.fontSize||this.labelSettings.leftLabel.fontStyle.fontStyle||this.labelSettings.leftLabel.fontStyle.fontFamily)){var I=this.labelSettings.leftLabel,E=I.fontStyle&&I.fontStyle.fontFamily?I.fontStyle.fontFamily:this.fontFamily||g.PdfFontFamily.Helvetica,F=I.fontStyle&&I.fontStyle.fontSize?I.fontStyle.fontSize:D.fontSize||this.defaultFontSize,U=I.fontStyle&&"string"==typeof I.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(I.fontStyle.fontStyle):I.fontStyle&&I.fontStyle.fontStyle?I.fontStyle.fontStyle:g.PdfFontStyle.Regular;D=new g.PdfStandardFont(E,F,U),M=I.fontStyle.fontColor?new g.PdfSolidBrush(I.fontStyle.fontColor):M}var N=D.measureString(d.lines[0].text);o.drawRectangle(O,x,P.x-3,P.y,N.width+6,N.height),o.drawString(d.lines[0].text,D,null,M,P.x,P.y,d.actualSize.width,d.actualSize.height,R),null!==d.remainder?(this.leftTaskLabel.value=d.remainder,this.leftTaskLabel.left=a.endPoint):this.leftTaskLabel.isCompleted=!0}else this.leftTaskLabel.left=a.endPoint}}},e.prototype.drawLeftLabelImage=function(e,i,a,r,n){var s,o=e.graphics,l=0;if(l=this.left,!t.isNullOrUndefined(this.labelSettings.leftLabel)&&!t.isNullOrUndefined(this.labelSettings.leftLabel.image)){if(this.leftTaskLabel.isLeftCalculated)s=this.labelSettings.leftLabel.image.length>1?this.leftTaskLabel.left+this.previousWidthofLeftValue:this.leftTaskLabel.left;else{var d=new g.SizeF(n.width,n.height),h=this.isMilestone?Math.floor(this.parent.chartRowsModule.taskBarHeight/2)+33:33,p=this.labelSettings.leftLabel.value.split(",");this.isAutoFit()?this.labelSettings.leftLabel.image.length>0&&p.length>0?(s=l-this.totalLeftWidth-d.width,this.previousWidthofLeftImage+=d.width):s=l-h-d.width:this.labelSettings.leftLabel.image.length>0&&p.length>0?(s=C(l)-this.totalLeftWidth-d.width,this.previousWidthofLeftImage+=d.width):s=C(l-h)-d.width,this.leftTaskLabel.left=s,this.leftTaskLabel.isLeftCalculated=!0}var u=void 0;if(u=(this.isAutoFit(),s-C(r)+i.x),a.startPoint<=s&&s<a.endPoint&&!t.isNullOrUndefined(n)&&!this.leftTaskLabel.isCompleted){var d=new g.SizeF(n.width,n.height),c=(C(this.parent.rowHeight)-d.height)/2,f=new g.PointF(u,i.y+c),m=new g.SizeF(d.width,d.height),y=new g.RectangleF(f,m),D=new g.PdfBitmap(n.base64);d.width>0?(o.drawImage(D,y.x,y.y,d.width,d.height),this.totalLeftWidth=this.totalLeftWidth-d.width):this.leftTaskLabel.left=a.endPoint}}},e.prototype.drawLeftLabelValue=function(e,i,a,r,n){var s,o=e.graphics;if(!t.isNullOrUndefined(n)){var l=0;if(l=this.left,this.leftTaskLabel.isLeftCalculated)if(1===(p=this.labelSettings.leftLabel.value.split(",")).length){s=this.leftTaskLabel.left+(this.previousWidthofLeftImage?this.previousWidthofLeftImage:0),this.labelSettings.left=s;d=this.getWidthofLeftLabel(n,Number.MAX_VALUE,15);this.previousWidthofLeftValue+=this.previousWidthofLeftImage+d.actualSize.width}else if(p.length>1){m=0!==this.previousWidthofLeftValue?this.previousWidthofLeftValue+this.previousWidthofLeftImage:this.previousWidthofLeftImage;s=this.leftTaskLabel.left+m,this.labelSettings.left=s;d=this.getWidthofLeftLabel(n,Number.MAX_VALUE,15);this.previousWidthofLeftValue+=this.previousWidthofLeftImage+d.actualSize.width}else s=this.leftTaskLabel.left;else{var d=this.getWidthofLeftLabel(n,Number.MAX_VALUE,15),h=this.isMilestone?Math.floor(this.parent.chartRowsModule.taskBarHeight/2)+33:33,p=this.labelSettings.leftLabel.value.split(",");if(this.isAutoFit()){var u=!t.isNullOrUndefined(this.labelSettings.leftLabel.image),c=u?this.labelSettings.leftLabel.image.length:0;if(1===p.length&&u&&1===c){s=this.leftTaskLabel.left+this.previousWidthofLeftImage,this.labelSettings.left=s;var f=this.getWidthofLeftLabel(n,Number.MAX_VALUE,15);this.previousWidthofLeftValue+=this.previousWidthofLeftImage+f.actualSize.width}else if(p.length>1&&u&&c>1){var m=0!==this.previousWidthofLeftValue?this.previousWidthofLeftValue+this.previousWidthofLeftImage:this.previousWidthofLeftImage;s=this.leftTaskLabel.left+m,this.labelSettings.left=s;var y=this.getWidthofLeftLabel(n,Number.MAX_VALUE,15);this.previousWidthofLeftValue+=this.previousWidthofLeftImage+y.actualSize.width}else s=l-h-d.actualSize.width}else s=C(l-h)-d.actualSize.width;this.leftTaskLabel.left=s,this.leftTaskLabel.isLeftCalculated=!0}var D=void 0;D=(this.isAutoFit(),s-C(r)+i.x);var v=this.isAutoFit()?C(s):s;if(a.startPoint<=v&&v<a.endPoint&&!t.isNullOrUndefined(n)&&!this.leftTaskLabel.isCompleted){var d=this.getWidthofLeftLabel(n,a.endPoint-v,15),k=new g.PdfStandardFont(this.fontFamily,this.defaultFontSize);!t.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(k=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var b=(C(this.parent.rowHeight)-d.actualSize.height)/2,w=new g.PointF(D,i.y+b),T=new g.SizeF(d.actualSize.width,d.actualSize.height),S=new g.RectangleF(w,T),P=new g.PdfStringFormat;if(P.alignment=g.PdfTextAlignment.Right,P.lineAlignment=g.PdfVerticalAlignment.Middle,d.actualSize.width>0){var R=new g.PdfSolidBrush(this.labelColor),M=this.labelSettings.leftLabel,x=M.fontStyle&&M.fontStyle.fontFamily?M.fontStyle.fontFamily:this.fontFamily||g.PdfFontFamily.Helvetica,O=M.fontStyle&&M.fontStyle.fontSize?M.fontStyle.fontSize:k.fontSize||this.defaultFontSize,I=M.fontStyle&&"string"==typeof M.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(M.fontStyle.fontStyle):M.fontStyle&&M.fontStyle.fontStyle?M.fontStyle.fontStyle:g.PdfFontStyle.Regular,E=new g.PdfStandardFont(x,O,I),F=M.fontStyle.fontColor?new g.PdfSolidBrush(M.fontStyle.fontColor):R;o.drawString(n,E,null,F,S.x,S.y,d.actualSize.width,d.actualSize.height,P);p=M.value.split(",");t.isNullOrUndefined(d.remainder)||null===d.remainder?t.isNullOrUndefined(M.image)||1!==M.image.length||1!==p.length||(this.leftTaskLabel.isCompleted=!0):(this.leftTaskLabel.value=d.remainder,this.leftTaskLabel.left=a.endPoint)}else this.leftTaskLabel.left=a.endPoint}}},e.prototype.getWidth=function(e,i,a){var r;r=new g.PdfStandardFont(this.fontFamily,this.defaultFontSize);var n=this.parent.pdfExportModule.helper.exportProps.ganttStyle;t.isNullOrUndefined(n)||t.isNullOrUndefined(n.label)||t.isNullOrUndefined(n.label.fontSize)&&t.isNullOrUndefined(n.label.fontStyle)&&t.isNullOrUndefined(n.label.fontFamily)||(a=(r=this.getPdfFont(n)).height),!t.isNullOrUndefined(n)&&n.font&&(a=(r=n.font).height);var s=this.labelSettings.leftLabel;if(s&&(s.fontStyle.fontSize||s.fontStyle.fontFamily||s.fontStyle.fontStyle)){var o=s.fontStyle&&s.fontStyle.fontFamily?s.fontStyle.fontFamily:this.fontFamily||g.PdfFontFamily.Helvetica,l=s.fontStyle&&s.fontStyle.fontSize?s.fontStyle.fontSize:this.defaultFontSize,d=s.fontStyle&&"string"==typeof s.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(s.fontStyle.fontStyle):s.fontStyle&&s.fontStyle.fontStyle?s.fontStyle.fontStyle:g.PdfFontStyle.Regular;r=new g.PdfStandardFont(o,l,d)}var h=this.labelSettings.rightLabel;if(h&&(h.fontStyle.fontSize||h.fontStyle.fontFamily||h.fontStyle.fontStyle)){var o=h.fontStyle&&h.fontStyle.fontFamily?h.fontStyle.fontFamily:this.fontFamily||g.PdfFontFamily.Helvetica,l=h.fontStyle&&h.fontStyle.fontSize?h.fontStyle.fontSize:this.defaultFontSize,d=h.fontStyle&&"string"==typeof h.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(h.fontStyle.fontStyle):h.fontStyle&&h.fontStyle.fontStyle?h.fontStyle.fontStyle:g.PdfFontStyle.Regular;r=new g.PdfStandardFont(o,l,d)}var p=new g.PdfStringLayouter,u=new g.PdfStringFormat;return u.alignment=g.PdfTextAlignment.Left,u.wordWrap=g.PdfWordWrapType.Character,u.lineAlignment=g.PdfVerticalAlignment.Middle,p.layout(e,r,u,new g.SizeF(i,a),!1,new g.SizeF(i,a))},e.prototype.getWidthofLeftLabel=function(e,i,a){var r,n=this.labelSettings.leftLabel;if(n.fontStyle.fontSize||n.fontStyle.fontFamily||n.fontStyle.fontStyle){var s=n.fontStyle&&n.fontStyle.fontFamily?n.fontStyle.fontFamily:this.fontFamily||g.PdfFontFamily.Helvetica,o=n.fontStyle&&n.fontStyle.fontSize?n.fontStyle.fontSize:this.defaultFontSize,l=n.fontStyle&&"string"==typeof n.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(n.fontStyle.fontStyle):n.fontStyle&&n.fontStyle.fontStyle?n.fontStyle.fontStyle:g.PdfFontStyle.Regular;r=new g.PdfStandardFont(s,o,l)}else r=new g.PdfStandardFont(this.fontFamily,this.defaultFontSize);!t.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(r=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var d=new g.PdfStringLayouter,h=new g.PdfStringFormat;return h.alignment=g.PdfTextAlignment.Left,h.wordWrap=g.PdfWordWrapType.Character,h.lineAlignment=g.PdfVerticalAlignment.Middle,d.layout(e,r,h,new g.SizeF(i,a),!1,new g.SizeF(i,a))},e.prototype.getWidthofrightLabel=function(e,i,a){var r,n=this.labelSettings.rightLabel;if(n.fontStyle.fontSize||n.fontStyle.fontFamily||n.fontStyle.fontStyle){var s=n.fontStyle&&n.fontStyle.fontFamily?n.fontStyle.fontFamily:this.fontFamily||g.PdfFontFamily.Helvetica,o=n.fontStyle&&n.fontStyle.fontSize?n.fontStyle.fontSize:this.defaultFontSize,l=n.fontStyle&&"string"==typeof n.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(n.fontStyle.fontStyle):n.fontStyle&&n.fontStyle.fontStyle?n.fontStyle.fontStyle:g.PdfFontStyle.Regular;r=new g.PdfStandardFont(s,o,l)}else r=new g.PdfStandardFont(this.fontFamily,this.defaultFontSize);!t.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(r=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var d=new g.PdfStringLayouter,h=new g.PdfStringFormat;return h.alignment=g.PdfTextAlignment.Left,h.wordWrap=g.PdfWordWrapType.Character,h.lineAlignment=g.PdfVerticalAlignment.Middle,d.layout(e,r,h,new g.SizeF(i,a),!1,new g.SizeF(i,a))},e.prototype.drawUnscheduledTask=function(e,t,i,a){var r=new g.PdfSolidBrush(this.taskColor);this.isAutoFit()?e.drawRectangle(r,t.x+(this.left-i),t.y+a,C(3),C(this.height)):e.drawRectangle(r,t.x+C(this.left-i),t.y+a,C(3),C(this.height))},e.prototype.drawMilestone=function(e,i,a,r,n,s){if(a.startDate<=this.startDate&&this.startDate<=a.endDate){var o=e.graphics,l=e.section.indexOf(e);this.taskStartPoint=hi({},i);var d=new g.PdfPen(this.milestoneColor),h=C((this.parent.rowHeight-this.height)/3),p=C((this.parent.rowHeight-this.height)/2),u=this.parent.renderBaseline?h:p,c=new g.PdfSolidBrush(this.milestoneColor),f=new g.PdfPen(this.baselineBorderColor),m=new g.PdfSolidBrush(this.baselineColor);o.save();var y=Math.floor(.8*this.parent.chartRowsModule.taskBarHeight);if(s||(this.isAutoFit()?o.translateTransform(i.x+(this.left-r),i.y+u-.7*this.parent.chartRowsModule.taskBarHeight/2):o.translateTransform(i.x+C(this.left-r),i.y+u-.7*this.parent.chartRowsModule.taskBarHeight/2)),s&&(this.isAutoFit()?o.translateTransform(i.x+(n.baselineLeft-r),i.y+u-.7*this.parent.chartRowsModule.taskBarHeight/2):o.translateTransform(i.x+C(n.baselineLeft-r),i.y+u-.7*this.parent.chartRowsModule.taskBarHeight/2)),o.rotateTransform(45),this.parent.renderBaseline&&this.baselineStartDate&&this.baselineEndDate&&s&&o.drawRectangle(f,m,2,2,C(y),C(y)),s||o.drawRectangle(d,c,0,0,C(y),C(y)),o.restore(),this.isAutoFit()){if(!t.isNullOrUndefined(n.taskbarTemplate.image)){var D=new g.PdfBitmap(n.taskbarTemplate.image[0].base64),v=i.x+(this.left-r)-.7*this.parent.chartRowsModule.taskBarHeight/2+(.7*this.parent.chartRowsModule.taskBarHeight-n.taskbarTemplate.image[0].height)/1,k=n.taskbarTemplate.image[0].width/2,b=n.taskbarTemplate.image[0].height/2;o.drawImage(D,v,i.y+u-.7*this.parent.chartRowsModule.taskBarHeight/2+(.7*this.parent.chartRowsModule.taskBarHeight-n.taskbarTemplate.image[0].height)/.5,k,b)}}else if(!t.isNullOrUndefined(n.taskbarTemplate.image)){var D=new g.PdfBitmap(n.taskbarTemplate.image[0].base64),v=i.x+C(this.left-r)-.7*this.parent.chartRowsModule.taskBarHeight/2+C(.7*this.parent.chartRowsModule.taskBarHeight-n.taskbarTemplate.image[0].height)/1;o.drawImage(D,v,i.y+u-.7*this.parent.chartRowsModule.taskBarHeight/2+C((.7*this.parent.chartRowsModule.taskBarHeight-n.taskbarTemplate.image[0].height)/.5),C(n.taskbarTemplate.image[0].width),C(n.taskbarTemplate.image[0].height-2))}this.endPage=this.startPage=l}},e}(),ui=function(){function e(e){this.holidayCompleted=!1,this.holidayWidth=0,this.fitHolidayCompleted=!1,this.timelineWidth=0,this.lastWidth=0,this.topTierValueLeftPadding=8,this.timelineHeight=0,this.width=0,this.gantt=e,this.parent=e.parent,this.topTierPoint=new g.PointF,this.bottomTierPoint=new g.PointF,this.topTierIndex=0,this.bottomTierIndex=0,this.prevTopTierIndex=0,this.prevBottomTierIndex=0}return e.prototype.drawTimeline=function(e,t,i,a){this.detailsTimeline=i,this.pageIndex=a,this.timelineHeight=this.gantt.layouter.headerHeight;var r=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?R(Math.floor(i.totalWidth)):Math.round(i.totalWidth),n=0;for(this.topTierPoint.x=t.x,this.topTierPoint.y=t.y,this.prevTopTierIndex=this.topTierIndex,this.prevBottomTierIndex=this.bottomTierIndex;r>0;){var s=this.topTier[this.topTierIndex];if(this.topTier.length>this.topTierIndex){h=!1;this.topTier[this.topTierIndex].isFinished||(r>=s.width?(n=s.width,s.isFinished=!0,s.completedWidth=n,h=!0):(n=r,h=!1,s.isFinished=!1,s.width=s.width-r,s.completedWidth=n));var o=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?n:C(n);this.triggerQueryTimelinecell(e,this.topTierPoint.x,this.topTierPoint.y,this.topTierHeight,o,s.value,!0,this.parent.timelineModule.isSingleTier&&"Day"===this.parent.timelineSettings.topTier.unit?s.startDate:null),this.topTierPoint.x+=o,r-=n,h&&this.topTierIndex++}else r=0}r=Math.round(i.totalWidth);var l=this.parent.timelineModule.isSingleTier?0:this.topTierHeight;for(this.bottomTierPoint=new g.PointF(t.x,C(t.y+l));r>0;){var d=this.bottomTier[this.bottomTierIndex];if(this.bottomTier.length>this.bottomTierIndex){var h=!0,p=d.width;r<p&&(p=r,h=!1,d.completedWidth=p),this.triggerQueryTimelinecell(e,this.bottomTierPoint.x,this.bottomTierPoint.y,this.bottomTierHeight,this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?p:C(p),d.value,!1,d.startDate),this.bottomTierPoint.x=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?this.bottomTierPoint.x+p:this.bottomTierPoint.x+C(p),r-=p,d.completedWidth=p,this.bottomTierIndex++,r>0&&r<p&&(r=d.width-1)}else r=0}this.timelineWidth=this.lastWidth},e.prototype.drawPageTimeline=function(e,i,a,r){this.pageIndex=r,this.timelineHeight=0,this.topTierPoint=t.extend({},{},i,!0);for(s=this.prevTopTierIndex;s<=this.topTierIndex;s++)if(this.topTier.length>s){var n=this.topTier[s];n.completedWidth>0&&(this.triggerQueryTimelinecell(e,this.topTierPoint.x,this.topTierPoint.y,this.topTierHeight,this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?n.completedWidth:C(n.completedWidth),n.value,!0,this.parent.timelineModule.isSingleTier&&"Day"===this.parent.timelineSettings.topTier.unit?n.startDate:null),this.topTierPoint.x+=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?n.completedWidth:C(n.completedWidth))}this.bottomTierPoint.x=i.x,this.bottomTierPoint.y=C(i.y+this.topTierHeight);for(var s=this.prevBottomTierIndex;s<=this.bottomTierIndex;s++)if(this.bottomTier.length>s){var o=this.bottomTier[s];o.completedWidth>0&&(this.triggerQueryTimelinecell(e,this.bottomTierPoint.x,this.bottomTierPoint.y,this.bottomTierHeight,this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?o.width:C(o.width),o.value,!1,o.startDate),this.bottomTierPoint.x=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?this.bottomTierPoint.x+o.width:this.bottomTierPoint.x+C(o.width))}},e.prototype.triggerQueryTimelinecell=function(e,i,a,r,n,s,o,l){var d=this,h=new Date(l).getDay(),p=e.graphics,u={},c=this.gantt.ganttStyle;u.borderColor=new g.PdfColor(c.timeline.borderColor),u.fontColor=new g.PdfColor(c.timeline.fontColor),u.fontSize=c.timeline.fontSize,u.fontStyle=c.timeline.fontStyle,u.backgroundColor=new g.PdfColor(c.timeline.backgroundColor),c.timeline.padding&&(u.padding=c.timeline.padding);var f=this.initializePdfStringFormat(c,o);u.format=f;var m={timelineCell:u,value:s};this.parent.pdfQueryTimelineCellInfo&&this.parent.trigger("pdfQueryTimelineCellInfo",m);var y=m.timelineCell,D=new g.PdfSolidBrush(m.timelineCell.backgroundColor),v=this.parent.nonWorkingDayIndex,k=!1,b=new g.PdfSolidBrush(c.holiday.backgroundColor);this.parent.highlightWeekends&&-1!==v.indexOf(h)&&("Day"===this.parent.timelineModule.bottomTier||"None"===this.parent.timelineModule.bottomTier&&"Day"===this.parent.timelineModule.topTier)&&(D=b,k=!0),this.parent.holidays.map(function(e){var t=new Date(e.from),a=new Date(e.to),r=new Date(l);if(t<=r&&a>=r&&("Day"===d.parent.timelineModule.bottomTier||"None"===d.parent.timelineModule.bottomTier&&"Day"===d.parent.timelineModule.topTier)){if(D=b,t.getTime()===r.getTime()&&(d.holidayWidth=i),a.getTime()===r.getTime()){d.holidayLabel=e.label;var s=new Date(e.to);s.setDate(s.getDate()+1);var o=d.parent.dataOperation.getTaskWidth(t,s);d.holidayNumberOfDays=C(o)/n,d.holidayCompleted=!0}k=!0}else"Day"!==d.parent.timelineModule.bottomTier&&d.detailsTimeline.startDate<=t&&d.detailsTimeline.endDate>=t&&d.parent.timelineModule.bottomTierCollection.map(function(i){i.startDate<=t&&i.endDate>=t&&i.startDate===l&&(d.fitHolidayCompleted=!0,d.fromDataHoliday=e.from,d.holidayLabel=e.label)})});var w=k&&c.holiday&&c.holiday.borders?c.holiday.borders.left:k&&c.holiday&&c.holiday.borderColor?new g.PdfPen(c.holiday.borderColor):new g.PdfPen(m.timelineCell.borderColor);this.parent.pdfExportModule.gantt.taskbar.isAutoFit()||(this.lastWidth=i+n);var T=k&&(c.holiday.borderColor||c.holiday.borders)?n-2:n;p.drawRectangle(w,D,i,a,T,C(r));var S=o||"Both"!==this.parent.gridLines&&"Vertical"!==this.parent.gridLines?null:new g.PdfPen(c.chartGridLineColor),P=k&&(c.holiday.borderColor||c.holiday.borders)?w:S;p.drawRectangle(P,D,i,a+C(r),T,this.gantt.layouter.pageHeightCollection[this.pageIndex].totalHeight-this.timelineHeight);var R=new g.PdfStandardFont(c.fontFamily,y.fontSize,y.fontStyle);c.font&&(R=c.font);var M=this.getPdfFont(c);t.isNullOrUndefined(M)||(R=M);var x=c.holiday&&c.holiday.fontColor?new g.PdfSolidBrush(c.holiday.fontColor):new g.PdfSolidBrush(new g.PdfColor(0,0,0)),O=c.holiday&&c.holiday.fontBrush?new g.PdfPen(new g.PdfColor(c.holiday.fontBrush)):null,I=new g.PdfStringFormat;I=c.holiday&&c.holiday.format?c.holiday.format:null;var E={left:0,right:0,top:0,bottom:0};t.isNullOrUndefined(c)||t.isNullOrUndefined(c.holiday)||t.isNullOrUndefined(c.holiday.padding)||(E=c.holiday.padding);var F;if(t.isNullOrUndefined(this.holidayLabel)||(F=R.measureString(this.holidayLabel)),this.holidayCompleted){var U=(this.gantt.layouter.pageHeightCollection[this.pageIndex].totalHeight-this.timelineHeight)/2,N=p.save(),L=R.height,V=R.size;p.translateTransform(this.holidayWidth+n-V/2*this.holidayNumberOfDays-L+L/2+n*this.holidayNumberOfDays/2,40),p.rotateTransform(-90),p.translateTransform(-U,-(this.holidayWidth+n+V)/((this.holidayWidth+n)/n)),F.width+10<U&&p.drawString(this.holidayLabel,R,O,x,5-(E.left+E.right),5-(E.top+E.bottom),F.width+10,F.height+10,I),p.restore(N),this.holidayCompleted=!1}if(this.fitHolidayCompleted){var U=(this.gantt.layouter.pageHeightCollection[this.pageIndex].totalHeight-this.timelineHeight)/2,B=b,V=R.size;p.drawRectangle(P,B,i+n/2-V,a+C(r),V,2*U);var A=p.save();p.translateTransform(i+n+n/2-V,40),p.rotateTransform(-90),p.translateTransform(-U,-(this.holidayWidth+n+V)/((this.holidayWidth+n)/n)),F.width+10<U&&p.drawString(this.holidayLabel,R,O,x,5-(E.left+E.right),5-(E.top+E.bottom),F.width+10,F.height+10,I),p.restore(A),this.fitHolidayCompleted=!1}var W=new g.PdfStandardFont(c.fontFamily,y.fontSize,y.fontStyle);c.font&&(W=c.font);var H=new g.PdfSolidBrush(t.isNullOrUndefined(c.timeline.fontBrush)?m.timelineCell.fontColor:c.timeline.fontBrush),j=c.timeline.padding?m.timelineCell.padding.left:0,z=c.timeline.padding?m.timelineCell.padding.top:0,G=p.save();p.setClip(new g.RectangleF(i,a,n,C(r))),o?i=i+j+this.topTierValueLeftPadding:i+=j,p.drawString(m.value,W,null,H,i,a+z,C(n),C(r),y.format),p.restore(G)},e.prototype.initializePdfStringFormat=function(e,i){var a=new g.PdfStringFormat;return t.isNullOrUndefined(e.timeline.format)?i?(a.lineAlignment=g.PdfVerticalAlignment.Middle,a.alignment=g.PdfTextAlignment.Left):(a.lineAlignment=g.PdfVerticalAlignment.Middle,a.alignment=g.PdfTextAlignment.Center,a.wordWrap=g.PdfWordWrapType.Character):a=e.timeline.format,a},e.prototype.getPdfFont=function(e){var t;if(e&&e.holiday&&(e.holiday.fontSize||e.holiday.fontStyle||e.holiday.fontFamily)){var i=e.holiday.fontSize?e.holiday.fontSize:9,a=e.holiday.fontFamily?e.holiday.fontFamily:this.fontFamily,r=e.holiday.fontStyle?e.holiday.fontStyle:g.PdfFontStyle.Regular;t=new g.PdfStandardFont(a,i,r)}return t},e}(),ci=function(){function e(e,t){this.parent=e,this.pdfGantt=t}return e.prototype.add=function(){return new e(this.parent)},e.prototype.drawPredecessor=function(e){this.pdfGantt=e;var t,i,a=e.result.page.section.getPages(),r=e.taskbarCollection[this.parentIndex],n=e.taskbarCollection[this.childIndex],s=new g.PdfPage,o=new g.PdfPage,l="",d=0,h=0;if(n&&r){switch(this.type){case"FS":if(!(n.startPage>-1&&r.endPage>-1))return;s=a[r.endPage],o=a[n.startPage],t=e.pdfPageDetail[r.endPage-e.chartPageIndex],i=e.pdfPageDetail[n.startPage-e.chartPageIndex],l=this.parentIndex<this.childIndex?this.parentLeft<this.childLeft&&this.childLeft>this.parentLeft+this.parentWidth+25?"FSType1":"FSType2":this.parentLeft<this.childLeft&&this.childLeft>this.parentLeft+this.parentWidth+25?"FSType3":"FSType4";break;case"SF":if(!(n.endPage>-1&&r.startPage>-1))return;s=a[r.startPage],o=a[n.endPage],t=e.pdfPageDetail[r.endPage-e.chartPageIndex],i=e.pdfPageDetail[n.startPage-e.chartPageIndex],l=this.parentIndex<this.childIndex?this.parentLeft>this.childLeft+this.childWidth?"SFType1":"SFType2":this.parentLeft>this.childLeft+this.childWidth?"SFType3":"SFType4";break;case"FF":if(!(n.endPage>-1&&r.endPage>-1))return;s=a[r.endPage],o=a[n.endPage],t=e.pdfPageDetail[r.endPage-e.chartPageIndex],i=e.pdfPageDetail[n.endPage-e.chartPageIndex],l=this.parentIndex<this.childIndex?this.childLeft+this.childWidth>=this.parentLeft+this.parentWidth?"FFType1":"FFType2":this.childLeft+this.childWidth>=this.parentLeft+this.parentWidth?"FFType3":"FFType4";break;case"SS":if(!(n.startPage>-1&&r.startPage>-1))return;s=a[r.startPage],o=a[n.startPage],t=e.pdfPageDetail[r.startPage-e.chartPageIndex],i=e.pdfPageDetail[n.startPage-e.chartPageIndex],l=this.parentIndex<this.childIndex?this.parentLeft>=this.childLeft?"SSType1":"SSType2":this.parentLeft>=this.childLeft?"SSType3":"SSType4"}var p=Math.round((this.parent.rowHeight-15)/2),u=Math.round((this.parent.rowHeight-1)/2),c=Math.round((this.parent.rowHeight-10)/2),f=this.parent.renderBaseline?c:!r.isAutoSchedule&&r.isParentTask||!n.isAutoSchedule&&n.isParentTask?p:u;f=C(f);var m=void 0,y=void 0,D=void 0,v=void 0,k=void 0,b=void 0;m=y=D=v=k=b=new g.PointF;var w={x:r.taskStartPoint.x,y:r.taskStartPoint.y},T={x:n.taskStartPoint.x,y:n.taskStartPoint.y};d=w.y+t.startPoint.y,h=T.y+i.startPoint.y;var S=void 0,P=void 0,R=void 0,M=void 0,x=void 0;switch(this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?(S=new g.PointF(this.parentLeft+this.parentWidth,d+f),P=new g.PointF(this.parentLeft-1,d+f),R=new g.PointF(this.childLeft-20,h+f),M=new g.PointF(this.childLeft-6-this.lineWidth-1,h+f),x=new g.PointF(this.childLeft+this.childWidth+6+this.lineWidth+1,h+f)):(S=new g.PointF(C(this.parentLeft+this.parentWidth),d+f),P=new g.PointF(C(this.parentLeft)-1,d+f),R=new g.PointF(C(this.childLeft-20),h+f),M=new g.PointF(C(this.childLeft-6-this.lineWidth)-1,h+f),x=new g.PointF(C(this.childLeft+this.childWidth+6+this.lineWidth)+1,h+f)),l){case"FSType1":case"FSType3":m=S,y=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?new g.PointF(this.childLeft-20,d+f):new g.PointF(C(this.childLeft-20),d+f),D=R,v=M,this.connectLines(s,o,m,y,D,v,n,f);break;case"FSType2":m=S,y=new g.PointF(m.x+10,d+f),D=new g.PointF(m.x+10,h+2),v=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?new g.PointF(this.childLeft-20,h+2):new g.PointF(C(this.childLeft-20),h+2),k=R,b=M,this.connectLines(s,o,m,y,D,v,n,f,k,b);break;case"FSType4":m=S,y=new g.PointF(m.x+10,d+f),D=new g.PointF(m.x+10,d+2),v=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?new g.PointF(this.childLeft-20,d+2):new g.PointF(C(this.childLeft-20),d+2),k=R,b=M,this.connectLines(s,o,m,y,D,v,n,f,k,b);break;case"FFType1":case"FFType3":this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?(m=new g.PointF(this.parentLeft+this.parentWidth+1,d+f),y=new g.PointF(this.childLeft+this.childWidth+20,d+f)):(m=new g.PointF(C(this.parentLeft+this.parentWidth)+1,d+f),y=new g.PointF(C(this.childLeft+this.childWidth+20),d+f)),D=new g.PointF(y.x,h+f),v=x,this.connectLines(s,o,m,y,D,v,n,f);break;case"FFType2":case"FFType4":this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?(m=new g.PointF(this.parentLeft+this.parentWidth+1,d+f),y=new g.PointF(this.parentLeft+this.parentWidth+20,d+f)):(m=new g.PointF(C(this.parentLeft+this.parentWidth)+1,d+f),y=new g.PointF(C(this.parentLeft+this.parentWidth+20),d+f)),D=new g.PointF(y.x,h+f),v=x,this.connectLines(s,o,m,y,D,v,n,f);break;case"SSType1":case"SSType3":m=P,y=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?new g.PointF(this.childLeft-20,d+f):new g.PointF(C(this.childLeft-20),d+f),D=new g.PointF(y.x,h+f),v=M,this.connectLines(s,o,m,y,D,v,n,f);break;case"SSType2":case"SSType4":m=P,y=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?new g.PointF(this.parentLeft-20,d+f):new g.PointF(C(this.parentLeft-20),d+f),D=new g.PointF(y.x,h+f),v=M,this.connectLines(s,o,m,y,D,v,n,f);break;case"SFType1":case"SFType3":m=P,y=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?new g.PointF(this.childLeft+this.childWidth+20,d+f):new g.PointF(C(this.childLeft+this.childWidth+20),d+f),D=new g.PointF(y.x,h+f),v=x,this.connectLines(s,o,m,y,D,v,n,f);break;case"SFType2":m=P,this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?(y=new g.PointF(this.parentLeft-20,d+f),v=new g.PointF(this.childLeft+this.childWidth+20,h+2)):(y=new g.PointF(C(this.parentLeft-20),d+f),v=new g.PointF(C(this.childLeft+this.childWidth+20),h+2)),D=new g.PointF(y.x,h+2),k=new g.PointF(v.x,h+f),b=x,this.connectLines(s,o,m,y,D,v,n,f,k,b);break;case"SFType4":m=P,this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?(y=new g.PointF(this.parentLeft-20,d+f),v=new g.PointF(this.childLeft+this.childWidth+20,d+2)):(y=new g.PointF(C(this.parentLeft-20),d+f),v=new g.PointF(C(this.childLeft+this.childWidth+20),d+2)),D=new g.PointF(y.x,d+2),k=new g.PointF(v.x,h+f),b=x,this.connectLines(s,o,m,y,D,v,n,f,k,b)}}},e.prototype.connectLines=function(e,i,a,r,n,s,o,l,d,h){this.drawLine(e,a,r),this.drawLine(e,r,n),this.drawLine(e,n,s),t.isNullOrUndefined(d)||t.isNullOrUndefined(h)||(this.drawLine(e,s,d),this.drawLine(e,d,h)),this.drawArrow(i,o,l)},e.prototype.contains=function(e,t,i){return e.x<=t&&t<e.x+e.width&&e.y<=i&&i<e.y+e.height},e.prototype.findPageIndex=function(e){for(var t=-1,i=0;i<this.pdfGantt.pdfPageDetail.length;i++){var a=this.pdfGantt.pdfPageDetail[i],r=new g.RectangleF(a.startPoint.x,a.startPoint.y,a.width,a.height);if(this.contains(r,e.x,e.y)){t=i;break}}return t},e.prototype.drawLine=function(e,t,i){var a=this.pdfGantt.result.page.section.getPages(),r=e.graphics,n={x:i.x,y:i.y},s={x:i.x,y:i.y},o={x:i.x,y:i.y},l=this.pdfGantt.pdfPageDetail[e.section.indexOf(e)-this.pdfGantt.chartPageIndex],d=new g.RectangleF(l.startPoint.x,l.startPoint.y,l.width,l.height),h=this.contains(d,t.x,t.y),p=this.contains(d,i.x,i.y),u=-1;if(t=new g.PointF(t.x,t.y),i=new g.PointF(i.x,i.y),!h&&!p||p&&!h)(u=this.findPageIndex(t))>-1&&(l=this.pdfGantt.pdfPageDetail[u],s=t,n=i,this.drawLine(a[u+this.pdfGantt.chartPageIndex],s,n));else if(!p&&h){var c=d.x,f=d.x+d.width,m=d.y+d.height,y=d.y;c>i.x?(o.x=i.x=c-1,s.x=c-1):f<i.x?(o.x=i.x=f,s.x=f,o.x+=1):m<i.y?(o.y=i.y=m,s.y=m,o.y+=1,this.pdfGantt.enableHeader&&(s.y+=C(this.parent.timelineModule.isSingleTier?45:62))):y>i.y&&(s.y=o.y=y-1,i.y=y,this.pdfGantt.enableHeader&&(o.y+=C(this.parent.timelineModule.isSingleTier?45:62),i.y+=C(this.parent.timelineModule.isSingleTier?45:62))),-1!==(u=this.findPageIndex(o))&&this.drawLine(a[u+this.pdfGantt.chartPageIndex],s,n)}if(h){t=new g.PointF(t.x,t.y),i=new g.PointF(i.x,i.y),t.x=t.x+l.pageStartX-l.startPoint.x,t.y=t.y-l.startPoint.y,i.x=i.x+l.pageStartX-l.startPoint.x,i.y=i.y-l.startPoint.y;var D=new g.PdfSolidBrush(this.connectorLineColor),v=new g.PdfPen(D,C(this.lineWidth));r.drawLine(v,t,i)}},e.prototype.drawArrow=function(e,t,i){var a,r=this.pdfGantt.pdfPageDetail[e.section.indexOf(e)-this.pdfGantt.chartPageIndex],n=new g.RectangleF(new g.PointF(r.startPoint.x,r.startPoint.y),new g.SizeF(r.width,r.height)),s=new g.PointF,o=e.section.getPages(),l=6+this.lineWidth;if(s=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?"FS"===this.type||"SS"===this.type?new g.PointF(this.childLeft-1,t.taskStartPoint.y+r.startPoint.y):new g.PointF(this.childLeft+this.childWidth+1,t.taskStartPoint.y+r.startPoint.y):"FS"===this.type||"SS"===this.type?new g.PointF(C(this.childLeft)-1,t.taskStartPoint.y+r.startPoint.y):new g.PointF(C(this.childLeft+this.childWidth)+1,t.taskStartPoint.y+r.startPoint.y),!this.contains(n,s.x,s.y)){var d=this.findPageIndex(s);d>-1&&(r=this.pdfGantt.pdfPageDetail[d],e=o[d+this.pdfGantt.chartPageIndex])}var h=e.graphics;s.x=s.x-r.startPoint.x+r.pageStartX,s.y=s.y-r.startPoint.y;var p=new g.PointF(s.x,s.y+i);a=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?"FS"===this.type||"SS"===this.type?new g.PointF(p.x-l,p.y-l):new g.PointF(p.x+l,p.y-l):"FS"===this.type||"SS"===this.type?new g.PointF(p.x-C(l),p.y-C(l)):new g.PointF(p.x+C(l),p.y-C(l));var u,c,f=new g.PdfSolidBrush(this.connectorLineColor);this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?(u=new g.PointF(a.x,a.y+2*l),c=new g.PdfPen(f,this.lineWidth)):(u=new g.PointF(a.x,a.y+C(2*l)),c=new g.PdfPen(f,C(this.lineWidth))),this.childLeft>0&&(h.drawLine(c,p,a),h.drawLine(c,a,u),h.drawLine(c,u,p))},e}(),gi=function(){function e(e){this.renderHeight=0,this.parent=e}return e.prototype.drawEventMarker=function(e,i,a,r,n,s,o){var l=e.graphics,d=(e.getClientSize(),new g.PdfStandardFont(g.PdfFontFamily.Helvetica,10));!t.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(d=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var h;t.isNullOrUndefined(n.label)||(h=d.measureString(n.label));var p=o.eventMarker.lineStyle;if(p.dashStyle=o.eventMarker.lineStyle.dashStyle,r.startDate<=n.date&&n.date<=r.endDate){var u=new g.PdfStringFormat;u.alignment=g.PdfTextAlignment.Center;var c=t.isNullOrUndefined(o.eventMarker.label.format)?u:o.eventMarker.label.format,f=new g.PdfSolidBrush(o.eventMarker.label.backgroundColor),m=o.eventMarker.label&&o.eventMarker.label.fontColor?new g.PdfSolidBrush(o.eventMarker.label.fontColor):null,y=this.getPdfFont(o);t.isNullOrUndefined(y)&&(y=d);var D=o.eventMarker.label.borders?o.eventMarker.label.borders:null;if(o.eventMarker.label.borderColor){var v=new Gt;v.all=new g.PdfPen(new g.PdfColor(o.eventMarker.label.borderColor)),D=v}var k=t.isNullOrUndefined(D)||t.isNullOrUndefined(D.left)?null:D.left,b={left:0,right:0,top:0,bottom:0};t.isNullOrUndefined(o)||t.isNullOrUndefined(o.eventMarker)||t.isNullOrUndefined(o.eventMarker.label)||t.isNullOrUndefined(o.eventMarker.label.padding)||(b=o.eventMarker.label.padding);var w=t.isNullOrUndefined(o.eventMarker.label.fontBrush)?null:new g.PdfPen(o.eventMarker.label.fontBrush),T=this.parent.dataOperation.getTaskLeft(this.parent.dateValidationModule.getDateFromFormat(n.date,!0),!1,!0);if(this.parent.pdfExportModule.gantt.taskbar.isAutoFit())l.drawLine(p,new g.PointF(i.x+(T-a)+10,s),new g.PointF(i.x+(T-a)+10,this.renderHeight)),!t.isNullOrUndefined(n.label)&&n.label.length>0&&(S=s+C(50)+2*h.height)<this.renderHeight&&(l.save(),l.translateTransform(i.x+(T-a)+7+10,s+C(50)+h.height/2),l.rotateTransform(45),l.drawRectangle(k,f,0,0,8,8),l.restore(),l.drawRectangle(k,f,i.x+(T-a)+7+10,s+C(50),h.width+10,2*h.height),l.drawString(n.label,y,w,m,i.x+(T-a)+12+10-(b.left+b.right),s+C(50)+C(h.height/2)-(b.top+b.bottom),h.width,h.height,c));else if(l.drawLine(p,new g.PointF(i.x+C(T-a)+10,s),new g.PointF(i.x+C(T-a)+10,this.renderHeight)),!t.isNullOrUndefined(n.label)&&n.label.length>0){var S=s+C(50)+2*h.height;S<this.renderHeight&&(l.save(),l.translateTransform(i.x+C(T-a)+7+10,s+C(50)+h.height/2),l.rotateTransform(45),l.drawRectangle(k,f,0,0,8,8),l.restore(),l.drawRectangle(k,f,i.x+C(T-a)+7+10,s+C(50),h.width+10,2*h.height),l.drawString(n.label,y,w,m,i.x+C(T-a)+12+10-(b.left+b.right),s+C(51)+C(h.height/2)-(b.top+b.bottom),h.width,h.height,c))}}},e.prototype.getPdfFont=function(e){var t;if(e&&e.eventMarker&&e.eventMarker.label&&(e.eventMarker.label.fontSize||e.eventMarker.label.fontStyle||e.eventMarker.label.fontFamily)){var i=e.eventMarker.label.fontSize?e.eventMarker.label.fontSize:9,a=e.eventMarker.label.fontFamily?e.eventMarker.label.fontFamily:this.fontFamily,r=e.eventMarker.label.fontStyle?e.eventMarker.label.fontStyle:g.PdfFontStyle.Regular;t=new g.PdfStandardFont(a,i,r)}return t},e}(),fi=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function a(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(a.prototype=i.prototype,new a)}}(),mi=function(){return(mi=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)},yi=function(e){function i(t){var i=e.call(this)||this;return i.exportProps={},i.changeCloneProjectDates=!1,i.currentPage=0,i.parent=t,i.chartHeader=new ui(i),i.eventMarker=new gi(t),i.predecessor=new ci(t,i),i.headerDetails=[],i.pdfPageDetail=[],i.taskbarCollection=[],i.predecessorCollection=[],i}return fi(i,e),Object.defineProperty(i.prototype,"taskbar",{get:function(){return t.isNullOrUndefined(this.taskbars)&&(this.taskbars=new pi(this.parent)),this.taskbars},enumerable:!0,configurable:!0}),i.prototype.drawChart=function(e){this.result=e,this.totalPages=this.result.page.section.count,this.perColumnPages=this.totalPages/this.layouter.columnRanges.length,this.calculateRange(),this.drawGantttChart(),this.drawPageBorder()},i.prototype.calculateRange=function(){for(var e=this.layouter.columnRanges[this.layouter.columnRanges.length-1],i=0,a=!0,r=0,n=0,s=0,o=C(this.chartHeader.width),l=this.parent.timelineModule,d=e[0];d<=e[1];d++)i+=this.layouter.treegrid.columns.getColumn(d).width;for((i+=.5)+100<this.result.page.getClientSize().width?(n=this.result.page.getClientSize().width-i,this.chartPageIndex=this.startPageIndex=this.totalPages-this.perColumnPages,a=!1,this.startPoint=new g.PointF(i,0)):(this.result.page.section.add(),this.chartPageIndex=this.startPageIndex=this.totalPages,a=!0,this.startPoint=new g.PointF(s,0));Math.round(s)<Math.round(o);){a?r=this.result.page.getClientSize().width:(r=n,a=!0);var h={},p=[],u=C(this.chartHeader.bottomTierCellWidth),c=0;0!==this.chartHeader.bottomTierCellWidth&&(c=Math.floor(r/u)*u),p[0]=s,o-s<=c?(p[1]=o,h.totalWidth=R(o-s)):(p[1]=s+c,h.totalWidth=R(c)),h.startPoint=p[0],h.endPoint=p[1],0===this.parent.cloneProjectStartDate.getHours()&&0===this.parent.cloneProjectStartDate.getMinutes()&&0===this.parent.cloneProjectStartDate.getSeconds()&&(this.changeCloneProjectDates=!0,this.parent.cloneProjectStartDate.setHours(8));var f=this.parent.dataOperation.getDateFromFormat(this.parent.timelineModule.timelineStartDate),m=t.isNullOrUndefined(l.customTimelineSettings.bottomTier.count)?l.customTimelineSettings.topTier.count:l.customTimelineSettings.bottomTier.count;switch("None"===l.customTimelineSettings.bottomTier.unit?l.customTimelineSettings.topTier.unit:l.customTimelineSettings.bottomTier.unit){case"Minutes":h.startDate=new Date(f.getTime());var y=Math.floor(R(h.startPoint)/this.chartHeader.bottomTierCellWidth);h.startDate.setMinutes(h.startDate.getMinutes()+y*m),h.startDate.setSeconds(h.startDate.getSeconds()+1),h.endDate=new Date(h.startDate.getTime());var D=Math.floor(R(h.endPoint-h.startPoint)/this.chartHeader.bottomTierCellWidth);h.endDate.setMinutes(h.endDate.getMinutes()+D*m);break;case"Hour":h.startDate=new Date(f.getTime());var v=Math.floor(R(h.startPoint)/this.chartHeader.bottomTierCellWidth),k=new Date(h.startDate.getTime());this.parent.timelineSettings.showWeekend?(h.startDate.setHours(h.startDate.getHours()+v*m),h.startDate.setMinutes(h.startDate.getMinutes()+1)):(k=this.calculateHoursWithoutNonworkingDays(k,v,m),h.startDate=new Date(k.getTime()));var b=Math.floor((h.endPoint-h.startPoint)/R(this.chartHeader.bottomTierCellWidth));k=new Date(h.startDate.getTime()),this.parent.timelineSettings.showWeekend?k.setHours(k.getHours()+b*m):k=this.calculateHoursWithoutNonworkingDays(k,b,m),h.endDate=new Date(k.getTime());break;case"Day":h.startDate=new Date(f.getTime());var w=Math.round(h.startPoint/C(this.chartHeader.bottomTierCellWidth)),k=new Date(h.startDate.getTime());this.parent.timelineSettings.showWeekend?h.startDate.setDate(h.startDate.getDate()+w*m):h.startDate=this.calculateDaysWithoutNonworkingDays(h.startDate,w*m);var T=Math.round((h.endPoint-h.startPoint)/C(this.chartHeader.bottomTierCellWidth))-1;h.startDate.setHours(0,0,0,0),k=new Date(h.startDate.getTime()),this.parent.timelineSettings.showWeekend?k.setDate(k.getDate()+T*m):k=this.calculateDaysWithoutNonworkingDays(k,T*m);var S=1e3*this.parent.workingTimeRanges[0].to;h.endDate=new Date(k.getTime()),h.endDate.setTime(h.endDate.getTime()+S);break;case"Week":h.startDate=new Date(f.getTime());var P=h.startPoint/C(this.chartHeader.bottomTierCellWidth)*7;this.parent.timelineSettings.showWeekend?h.startDate.setDate(h.startDate.getDate()+P*m):h.startDate=this.calculateDaysWithoutNonworkingDays(h.startDate,P*m);var M=7*Math.round((h.endPoint-h.startPoint)/C(this.chartHeader.bottomTierCellWidth))-1;h.endDate=new Date(h.startDate.getTime()),this.parent.timelineSettings.showWeekend?h.endDate.setDate(h.startDate.getDate()+M*m):h.endDate=this.calculateDaysWithoutNonworkingDays(h.endDate,M*m);break;case"Month":h.startDate=new Date(f.getTime());var x=h.startPoint/C(this.chartHeader.bottomTierCellWidth)*31;h.startDate.setDate(h.startDate.getDate()+x*m);var O=31*Math.round((h.endPoint-h.startPoint)/C(this.chartHeader.bottomTierCellWidth))-1;h.endDate=new Date(h.startDate.getTime()),h.endDate.setDate(h.startDate.getDate()+O*m);break;case"Year":h.startDate=new Date(f.getTime());var I=h.startPoint/C(this.chartHeader.bottomTierCellWidth)*365;h.startDate.setDate(h.startDate.getDate()+I*m);var E=365*Math.round((h.endPoint-h.startPoint)/C(this.chartHeader.bottomTierCellWidth))-1;h.endDate=new Date(h.startDate.getTime()),h.endDate.setDate(h.startDate.getDate()+E*m)}this.headerDetails.push(h),s+=c}},i.prototype.calculateHoursWithoutNonworkingDays=function(e,t,i){for(var a=0;a<t*i;)e.setHours(e.getHours()+1),-1===this.parent.nonWorkingDayIndex.indexOf(e.getDay())&&a++,-1!==this.parent.nonWorkingDayIndex.indexOf(e.getDay())&&e.setHours(24,0,0,0);return e},i.prototype.calculateDaysWithoutNonworkingDays=function(e,t){var i=new Date(e.getTime()),a=7-this.parent.nonWorkingDayIndex.length,r=Math.floor(t/a),n=t%a;for(i.setDate(i.getDate()+7*r);n>0;)i.setDate(i.getDate()+1),-1===this.parent.nonWorkingDayIndex.indexOf(i.getDay())&&n--;return i},i.prototype.drawPageBorder=function(){for(var e=this.result.page.section.getPages(),t=0;t<e.length;t++){var i=e[t],a=i.graphics,r=i.getClientSize(),n=new g.PdfPen(new g.PdfColor(this.ganttStyle.chartGridLineColor));a.drawRectangle(n,0,0,r.width,r.height)}},i.prototype.drawGantttChart=function(){var e,t=this,i=this.startPoint,a=new g.PointF,r=0,n=0,s=0;this.headerDetails.forEach(function(o,l){t.currentPage=0;var d=t.result.page.section.getPages()[t.startPageIndex];d.contentWidth=t.parent.pdfExportModule.gantt.taskbar.isAutoFit()?R(t.headerDetails[l].endPoint-t.headerDetails[l].startPoint):t.headerDetails[l].endPoint-t.headerDetails[l].startPoint,t.chartHeader.drawTimeline(d,t.startPoint,o,0),i.y=i.y+C(t.parent.timelineModule.isSingleTier?45:60),r=i.x,s=C(t.parent.timelineModule.isSingleTier?45:60),t.headerDetails[t.headerDetails.indexOf(o)].startIndex=t.startPageIndex,t.headerDetails[t.headerDetails.indexOf(o)].pageStartPoint=i;for(var h=0;h<t.taskbarCollection.length;h++){var p=t.taskbarCollection[h],u=t.rows.getRow(h+1).height,c=t.result.page.section.getPages()[t.startPageIndex],f=c.graphics,m=new g.PdfPen(new g.PdfColor(t.ganttStyle.chartGridLineColor)),y=void 0;!d.contentWidth||"Both"!==t.parent.gridLines&&"Horizontal"!==t.parent.gridLines||(y=t.chartHeader.timelineWidth,f.drawRectangle(m,r,i.y,d.contentWidth+.5,u)),p.drawTaskbar(c,i,o,n,u,t.taskbarCollection[parseInt(h.toString(),10)],y,l)&&(t.enableHeader?i.y=C(t.parent.timelineModule.isSingleTier?45:60):i.y=0,t.startPageIndex++,(e={}).height=s,e.pageStartX=r,e.startPoint=mi({},a),t.parent.pdfExportModule.gantt.taskbar.isAutoFit(),e.width=o.totalWidth,t.pdfPageDetail.push(e),a.y+=e.height,t.enableHeader?s=t.chartHeader.height:(i.y=0,s=0)),i.y+=u,s+=u,t.eventMarker.renderHeight=t.layouter.pageHeightCollection[t.currentPage].totalHeight,t.parent.eventMarkerColloction.map(function(e){var a=C(t.parent.timelineModule.isSingleTier?45:60);0!==t.currentPage&&(t.eventMarker.renderHeight=t.layouter.pageHeightCollection[t.currentPage].totalHeight+a);var r=t.result.page.section.getPages()[t.startPageIndex];t.eventMarker.drawEventMarker(r,i,n,o,e,a,t.ganttStyle)})}t.headerDetails[l].endIndex=t.startPageIndex,n+=o.totalWidth,(e={}).height=s,e.pageStartX=r,e.startPoint=mi({},a),t.parent.pdfExportModule.gantt.taskbar.isAutoFit()?e.width=o.totalWidth:e.width=C(o.totalWidth),t.pdfPageDetail.push(e),a.x+=e.width,a.y=0,t.enableHeader?s=t.chartHeader.height:i.y=0,t.headerDetails.indexOf(o)!==t.headerDetails.length-1&&(t.result.page.section.add(),t.startPageIndex=t.result.page.section.count-1,i=t.startPoint=new g.PointF(0,0))});for(var o=0;o<this.predecessorCollection.length;o++)this.predecessorCollection[o].drawPredecessor(this)},i}(Jt),Di=function(){function e(e){this.isPdfExport=!1,this.parent=e,this.helper=new li(this.parent),this.pdfDocument=void 0}return e.prototype.getModuleName=function(){return"pdfExport"},e.prototype.destroy=function(){},e.prototype.initGantt=function(){this.pdfDocument=void 0,this.gantt=new yi(this.parent)},e.prototype.export=function(e,i,a,r){var n=this;this.isBlob=r;var s={requestType:"beforePdfExport",ganttObject:this.parent,cancel:!1};return this.parent.trigger("beforePdfExport",s),t.getValue("cancel",s)||this.parent.showLoadingIndicator(),t.getValue("cancel",s)?new Promise(function(e,t){return e()}):new Promise(function(t,r){n.exportWithData(a,t,e,i)})},e.prototype.exportWithData=function(e,i,a,r){var n=this,s=[],o=this.parent.getExpandedRecords(this.parent.updatedRecords);t.isNullOrUndefined(a)&&(a={}),a.fitToWidthSettings&&a.fitToWidthSettings.isFitToWidth?("CurrentViewData"===a.exportType?this.helper.beforeSinglePageExport.cloneFlatData=t.extend([],this.parent.currentViewData,null,!0):"AllData"===a.exportType?this.helper.beforeSinglePageExport.cloneFlatData=t.extend([],this.parent.flatData,null,!0):this.helper.beforeSinglePageExport.cloneFlatData=t.extend([],o,null,!0),this.helper.beforeSinglePageExport.cloneCurrentViewData=t.extend([],this.parent.currentViewData,null,!0),s=this.helper.beforeSinglePageExport.cloneFlatData):s=t.isNullOrUndefined(a.exportType)?o:"CurrentViewData"===a.exportType?this.parent.currentViewData:this.parent.flatData,this.initGantt(),t.isNullOrUndefined(e)?this.pdfDocument=new g.PdfDocument:this.pdfDocument=e,this.processExport(s,a,r).then(function(){n.parent.trigger("pdfExportComplete",n.isBlob?{promise:n.blobPromise}:{}),n.parent.hideLoadingIndicator(),i(n.pdfDocument)})},e.prototype.processExport=function(e,i,a){var r=this,n=this.pdfDocument.sections.add();return this.processSectionExportProperties(n,i),this.pdfPage=n.pages.add(),this.pdfPageDimensions=this.pdfPage.getClientSize(),new Promise(function(t,a){r.helper.processGridExport(e,r.gantt,i),r.helper.initializePdf(r.pdfDocument),t()}).then(function(){var e=new Qt;e.break=g.PdfLayoutBreakType.FitElement;var n=r.gantt.drawGrid(r.pdfPage,0,0,e);return r.gantt.drawChart(n),r.helper.exportProps&&r.helper.exportProps.fitToWidthSettings&&r.helper.exportProps.fitToWidthSettings.isFitToWidth&&(r.parent.zoomingProjectStartDate=r.helper.beforeSinglePageExport.zoomingProjectStartDate,r.parent.zoomingProjectEndDate=r.helper.beforeSinglePageExport.zoomingProjectEndDate,r.parent.cloneProjectStartDate=r.helper.beforeSinglePageExport.cloneProjectStartDate,r.parent.cloneProjectEndDate=r.helper.beforeSinglePageExport.cloneProjectEndDate,r.parent.timelineModule.customTimelineSettings=r.helper.beforeSinglePageExport.customTimelineSettings,r.parent.isTimelineRoundOff=r.helper.beforeSinglePageExport.isTimelineRoundOff,r.parent.timelineModule.topTier=r.helper.beforeSinglePageExport.topTier,r.parent.timelineModule.topTierCellWidth=r.helper.beforeSinglePageExport.topTierCellWidth,r.parent.timelineModule.topTierCollection=r.helper.beforeSinglePageExport.topTierCollection,r.parent.timelineModule.bottomTier=r.helper.beforeSinglePageExport.bottomTier,r.parent.timelineModule.bottomTierCellWidth=r.helper.beforeSinglePageExport.bottomTierCellWidth,r.parent.timelineModule.bottomTierCollection=r.helper.beforeSinglePageExport.bottomTierCollection,r.parent.timelineModule.totalTimelineWidth=r.helper.beforeSinglePageExport.totalTimelineWidth,r.parent.timelineModule.timelineStartDate=r.helper.beforeSinglePageExport.timelineStartDate,r.parent.timelineModule.timelineEndDate=r.helper.beforeSinglePageExport.timelineEndDate,r.parent.timelineModule.timelineRoundOffEndDate=r.helper.beforeSinglePageExport.timelineRoundOffEndDate,r.parent.perDayWidth=r.helper.beforeSinglePageExport.perDayWidth,r.parent.updatedConnectorLineCollection=r.helper.beforeSinglePageExport.updatedConnectorLineCollection),r.gantt.changeCloneProjectDates&&(r.parent.cloneProjectStartDate.setHours(0),r.gantt.changeCloneProjectDates=!1),a||(r.isBlob?r.blobPromise=r.pdfDocument.save():!t.isNullOrUndefined(i)&&i.fileName?r.pdfDocument.save(i.fileName):r.pdfDocument.save("Export.pdf"),r.pdfDocument.destroy()),r.pdfDocument})},e.prototype.processSectionExportProperties=function(e,i){if(t.isNullOrUndefined(i))this.gantt.ganttStyle=new jt(i.theme).style;else{var a=new g.PdfPageSettings;if(t.isNullOrUndefined(i.pageOrientation)||"Portrait"!==i.pageOrientation?a.orientation=g.PdfPageOrientation.Landscape:a.orientation=g.PdfPageOrientation.Portrait,t.isNullOrUndefined(i.pageSize)||(a.size=this.getPageSize(i.pageSize)),e.setPageSettings(a),t.isNullOrUndefined(i.ganttStyle))this.gantt.ganttStyle=new jt(i.theme).style;else{var r=new jt(i.theme).style;this.gantt.ganttStyle=t.extend({},r,i.ganttStyle,!0)}}},e.prototype.getPageSize=function(e){switch(e){case"Letter":return new g.SizeF(612,792);case"Note":return new g.SizeF(540,720);case"Legal":return new g.SizeF(612,1008);case"A0":return new g.SizeF(2380,3368);case"A1":return new g.SizeF(1684,2380);case"A2":return new g.SizeF(1190,1684);case"A3":return new g.SizeF(842,1190);case"A5":return new g.SizeF(421,595);case"A6":return new g.SizeF(297,421);case"A7":return new g.SizeF(210,297);case"A8":return new g.SizeF(148,210);case"A9":return new g.SizeF(105,148);case"B0":return new g.SizeF(2836,4008);case"B1":return new g.SizeF(2004,2836);case"B2":return new g.SizeF(1418,2004);case"B3":return new g.SizeF(1002,1418);case"B4":return new g.SizeF(709,1002);case"B5":return new g.SizeF(501,709);case"Archa":return new g.SizeF(648,864);case"Archb":return new g.SizeF(864,1296);case"Archc":return new g.SizeF(1296,1728);case"Archd":return new g.SizeF(1728,2592);case"Arche":return new g.SizeF(2592,3456);case"Flsa":return new g.SizeF(612,936);case"HalfLetter":return new g.SizeF(396,612);case"Letter11x17":return new g.SizeF(792,1224);case"Ledger":return new g.SizeF(1224,792);default:return new g.SizeF(595,842)}},e}(),vi=function(){function e(e){this.parent=e,this.bindTreeGridProperties()}return e.prototype.getModuleName=function(){return"virtualScroll"},e.prototype.bindTreeGridProperties=function(){this.parent.treeGrid.enableVirtualization=this.parent.enableVirtualization,n.TreeGrid.Inject(n.VirtualScroll)},e.prototype.getTopPosition=function(){var e,t=this.parent.ganttChartModule.scrollElement.querySelector(".e-virtualtable"),i=t.style.transform.split(",");if(i.length>1)e=i[1].trim().split(")")[0];else{var a=t.style.transform;e=a.substring(a.lastIndexOf("(")+1,a.lastIndexOf(")"))}return parseFloat(e)},e.prototype.destroy=function(){},e}();return ct.Inject(Mt,Ot,xt,Pt,Rt,St,Ut,It,Bt,At,Ht,Wt,Di,vi,Nt,Vt),e.AddDialogFieldSettings=oe,e.Column=ee,e.ColumnMenu=Wt,e.ContextMenu=Bt,e.CriticalPath=Nt,e.DayMarkers=Ut,e.DayWorkingTime=re,e.Dependency=st,e.Edit=St,e.EditDialogFieldSettings=he,e.EditSettings=ce,e.EventMarker=me,e.ExcelExport=At,e.Filter=Mt,e.FilterSettings=ve,e.Gantt=ct,e.Holiday=Pe,e.LabelSettings=Me,e.LoadingIndicator=et,e.PdfBorders=Gt,e.PdfExport=Di,e.PdfGanttTheme=jt,e.PdfPaddings=qt,e.PdfTreeGridCell=ei,e.PdfTreeGridCellCollection=ti,e.PdfTreeGridColumn=ni,e.PdfTreeGridColumnCollection=si,e.PdfTreeGridHeaderCollection=ri,e.PdfTreeGridLayoutFormat=Qt,e.PdfTreeGridLayoutResult=Kt,e.PdfTreeGridLayouter=Yt,e.PdfTreeGridRow=ii,e.PdfTreeGridRowCollection=ai,e.PdfTreeGridStyle=Zt,e.PdfTreeGridStyleBase=_t,e.Reorder=Pt,e.Resize=Rt,e.ResourceFields=Qe,e.RowDD=Ht,e.SearchSettings=we,e.Selection=Ot,e.SelectionSettings=Ie,e.Sort=xt,e.SortDescriptor=Ze,e.SortSettings=Xe,e.SplitterSettings=Ue,e.TaskFields=Ve,e.TemporaryDictionary=zt,e.TimelineSettings=He,e.TimelineTierSettings=We,e.Toolbar=It,e.TooltipSettings=Ge,e.UndoRedo=Vt,e.VirtualScroll=vi,e.WeekWorkingTime=at,e.formatString=S,e.getIndex=P,e.getSwapKey=D,e.getTaskData=w,e.getUid=M,e.getUniversalTime=k,e.isCountRequired=y,e.isEmptyObject=v,e.isRemoteData=b,e.isScheduledTask=m,e.keyPressed="key-pressed",e.load="load",e.parentsUntil=f,e.pixelToPoint=C,e.pointToPixel=R,e.queryCellInfo="queryCellInfo",e.rowDataBound="rowDataBound",e.toolbarClick="toolbarClick",e.updateDates=T,e}({},ej.base,ej.popups,ej.data,ej.grids,ej.treegrid,ej.dropdowns,ej.svgbase,ej.layouts,ej.navigations,ej.richtexteditor,ej.inputs,ej.buttons,ej.calendars,ej.pdfexport),this.ejs=ej;
//# sourceMappingURL=ej2-gantt.min.js.map