UNPKG

@syncfusion/ej2-gantt

Version:
10 lines 1.26 MB
/*!
*  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. 
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("SyncfusionBase"),require("SyncfusionPopups"),require("SyncfusionData"),require("SyncfusionGrids"),require("SyncfusionTreegrid"),require("SyncfusionDropdowns"),require("SyncfusionSvgBase"),require("SyncfusionLayouts"),require("SyncfusionNavigations"),require("SyncfusionRichtexteditor"),require("SyncfusionInputs"),require("SyncfusionButtons"),require("SyncfusionCalendars"),require("SyncfusionPdfExport")):"function"==typeof define&&define.amd?define(["SyncfusionBase","SyncfusionPopups","SyncfusionData","SyncfusionGrids","SyncfusionTreegrid","SyncfusionDropdowns","SyncfusionSvgBase","SyncfusionLayouts","SyncfusionNavigations","SyncfusionRichtexteditor","SyncfusionInputs","SyncfusionButtons","SyncfusionCalendars","SyncfusionPdfExport"],t):"object"==typeof exports?exports.SyncfusionGantt=t(require("SyncfusionBase"),require("SyncfusionPopups"),require("SyncfusionData"),require("SyncfusionGrids"),require("SyncfusionTreegrid"),require("SyncfusionDropdowns"),require("SyncfusionSvgBase"),require("SyncfusionLayouts"),require("SyncfusionNavigations"),require("SyncfusionRichtexteditor"),require("SyncfusionInputs"),require("SyncfusionButtons"),require("SyncfusionCalendars"),require("SyncfusionPdfExport")):e.SyncfusionGantt=t(e.SyncfusionBase,e.SyncfusionPopups,e.SyncfusionData,e.SyncfusionGrids,e.SyncfusionTreegrid,e.SyncfusionDropdowns,e.SyncfusionSvgBase,e.SyncfusionLayouts,e.SyncfusionNavigations,e.SyncfusionRichtexteditor,e.SyncfusionInputs,e.SyncfusionButtons,e.SyncfusionCalendars,e.SyncfusionPdfExport)}(self,(e,t,i,a,r,n,s,o,l,d,h,p,u,c)=>(()=>{"use strict";var g={766:t=>{t.exports=e},741:e=>{e.exports=p},570:e=>{e.exports=u},74:e=>{e.exports=i},778:e=>{e.exports=n},707:e=>{e.exports=a},323:e=>{e.exports=h},40:e=>{e.exports=o},215:e=>{e.exports=l},461:e=>{e.exports=c},197:e=>{e.exports=t},674:e=>{e.exports=d},727:e=>{e.exports=s},465:e=>{e.exports=r}},f={};function m(e){var t=f[e];if(void 0!==t)return t.exports;var i=f[e]={exports:{}};return g[e](i,i.exports,m),i.exports}m.d=(e,t)=>{for(var i in t)m.o(t,i)&&!m.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},m.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),m.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var y={};return(()=>{m.r(y),m.d(y,{AddDialogFieldSettings:()=>ot,Column:()=>Je,ColumnMenu:()=>$i,ConstraintType:()=>D,ContextMenu:()=>Ki,CriticalPath:()=>Zi,DayMarkers:()=>_i,DayWorkingTime:()=>rt,Dependency:()=>si,Edit:()=>Li,EditDialogFieldSettings:()=>ht,EditSettings:()=>ct,EventMarker:()=>mt,ExcelExport:()=>Qi,Filter:()=>Wi,FilterSettings:()=>vt,Gantt:()=>fi,Holiday:()=>Pt,LabelSettings:()=>Mt,LoadingIndicator:()=>ei,PdfBorders:()=>aa,PdfExport:()=>Ia,PdfGanttTheme:()=>ta,PdfHorizontalOverflowType:()=>w,PdfPaddings:()=>ra,PdfTreeGridCell:()=>ca,PdfTreeGridCellCollection:()=>ga,PdfTreeGridColumn:()=>Da,PdfTreeGridColumnCollection:()=>va,PdfTreeGridHeaderCollection:()=>ya,PdfTreeGridLayoutFormat:()=>ha,PdfTreeGridLayoutResult:()=>da,PdfTreeGridLayouter:()=>la,PdfTreeGridRow:()=>fa,PdfTreeGridRowCollection:()=>ma,PdfTreeGridStyle:()=>sa,PdfTreeGridStyleBase:()=>na,Reorder:()=>Vi,Resize:()=>Ai,ResourceFields:()=>Qt,RowDD:()=>Ji,SearchSettings:()=>wt,Selection:()=>ji,SelectionSettings:()=>It,Sort:()=>Hi,SortDescriptor:()=>Zt,SortSettings:()=>Xt,SplitterSettings:()=>Ut,TaskFields:()=>Vt,TemporaryDictionary:()=>ia,TimelineSettings:()=>Ht,TimelineTierSettings:()=>Wt,Toolbar:()=>zi,TooltipSettings:()=>qt,UndoRedo:()=>Yi,VirtualScroll:()=>Ea,WeekWorkingTime:()=>ai,formatString:()=>u,getIndex:()=>c,getSwapKey:()=>s,getTaskData:()=>h,getUid:()=>k,getUniversalTime:()=>l,isCountRequired:()=>n,isEmptyObject:()=>o,isRemoteData:()=>d,isScheduledTask:()=>r,keyPressed:()=>ki,load:()=>mi,parentsUntil:()=>a,pixelToPoint:()=>g,pointToPixel:()=>f,queryCellInfo:()=>Di,rowDataBound:()=>yi,toolbarClick:()=>vi,updateDates:()=>p});var e=m(766),t=m(197),i=m(74);function a(e,t,i){for(var a=e;a&&!(i?a.id===t:a.classList.contains(t));)a=a.parentElement;return a}function r(t){return(0,e.isNullOrUndefined)(t.startDate)&&(0,e.isNullOrUndefined)(t.endDate)&&(0,e.isNullOrUndefined)(t.duration)?null:!((0,e.isNullOrUndefined)(t.startDate)||(0,e.isNullOrUndefined)(t.endDate)||(0,e.isNullOrUndefined)(t.duration))}function n(e){return!(!e.dataSource||e.dataSource instanceof i.DataManager||!("result"in e.dataSource))}function s(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 o(t){return!(0,e.isNullOrUndefined)(t)&&"object"==typeof t&&0===Object.keys(t).length}function l(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 d(e){if(e instanceof i.DataManager){var t=e.adaptor;return t instanceof i.ODataAdaptor||t instanceof i.ODataV4Adaptor||t instanceof i.WebApiAdaptor||t instanceof i.WebMethodAdaptor||t instanceof i.CacheAdaptor||t instanceof i.RemoteSaveAdaptor||t instanceof i.UrlAdaptor}return!1}function h(t,i,a,r){if(a){for(var n=void 0,s=0;s<t.length;s++){n=o=i?t[parseInt(s.toString(),10)].taskData:(0,e.extend)({},t[parseInt(s.toString(),10)].taskData,{},!0)}return n}for(n=[],s=0;s<t.length;s++){!(0,e.isNullOrUndefined)(r)&&r.timezone&&p(t[s],r);var o=i?t[parseInt(s.toString(),10)].taskData:(0,e.extend)({},t[parseInt(s.toString(),10)].taskData,{},!0);n.push(o)}return n}function p(t,i){return t&&!(0,e.isNullOrUndefined)(t.ganttProperties)&&(t.taskData[i.taskFields.startDate]=i.dateValidationModule.remove(t.ganttProperties.startDate,i.timezone),null!==i.taskFields.endDate&&(t.taskData[i.taskFields.endDate]=i.dateValidationModule.remove(t.ganttProperties.endDate,i.timezone)),(i.taskFields.baselineEndDate||i.taskFields.baselineStartDate)&&(t.taskData[i.taskFields.baselineStartDate]=i.dateValidationModule.remove(t.ganttProperties.baselineStartDate,i.timezone),t.taskData[i.taskFields.baselineEndDate]=i.dateValidationModule.remove(t.ganttProperties.baselineEndDate,i.timezone))),null}function u(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 c(t,i,a,r){for(var n=-1,s=0;s<a.length;s++)if((0,e.getValue)(i,a[s])===(0,e.getValue)(i,t)&&(0,e.isNullOrUndefined)(r)||!(0,e.isNullOrUndefined)(r)&&(0,e.getValue)(i,a[s])===(0,e.getValue)(i,t)&&(0,e.getValue)(r,a[s])===(0,e.getValue)(r,t)){n=s;break}return n}function g(e){return 76*e/92}function f(e){return 92*e/76}var D,v=0;function k(){return v++}!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"}(D||(D={}));var b,w,T=function(){function t(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 t.prototype.isValidateNonWorkDays=function(t){return!(0,e.isNullOrUndefined)(t)&&t.isAutoSchedule&&(!this.parent.includeWeekend||this.parent.totalHolidayDates.length>0)||(0,e.isNullOrUndefined)(t)&&(!this.parent.includeWeekend||this.parent.totalHolidayDates.length>0)},t.prototype.checkStartDate=function(t,i,a,r,n){if((0,e.isNullOrUndefined)(t))return null;var s,o=new Date(t.getTime()),l=this.parent.getCurrentDayStartTime(o),d=this.parent.getCurrentDayEndTime(o),h=new Date(t.getTime()),p=this.getSecondsInDecimal(h);if(a=(0,e.isNullOrUndefined)(a)?!(0,e.isNullOrUndefined)(i)&&i.isMilestone:a,p<l&&(!a||r))this.setTime(l,h);else if(p<l&&a)this.setTime(l,h);else if(p===d&&(!i||!a)||p>d)h.setDate(h.getDate()+1),l=this.parent.getCurrentDayStartTime(h),this.setTime(l,h);else if(p>l&&p<d){var u=this.parent.workingTimeRanges;this.parent.weekWorkingTime.length>0&&(u=this.parent.getWorkingRange(h));for(var c=0;c<u.length;c++){var g=u[c];if(p>=g.to&&u[c+1]&&p<u[c+1].from){(p!==g.to||i&&a)&&p===g.to||this.setTime(u[c+1].from,h);break}}}if(!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)return new Date(h.getTime());do{s=new Date(h.getTime());var f=this.parent.totalHolidayDates.length;if(this.isValidateNonWorkDays(i)){l=this.parent.getCurrentDayStartTime(s),i&&(d=n?this.parent.getCurrentDayEndTime(i.baselineEndDate?i.baselineEndDate:s):this.parent.getCurrentDayEndTime(i.endDate?i.isAutoSchedule?i.endDate:i.autoEndDate:s));var m=!a||r?l:d;if(!this.parent.includeWeekend&&!n){var y=new Date(h.getTime());h=this.getNextWorkingDay(h),m=this.parent.getCurrentDayStartTime(h),y.getTime()===h.getTime()||a||this.setTime(m,h)}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),h.getTime()>=v.getTime()&&h.getTime()<k.getTime()&&(h.setDate(h.getDate()+1),m=this.parent.getCurrentDayStartTime(h),this.setTime(m,h))}}}while(s.getTime()!==h.getTime());return new Date(h.getTime())},t.prototype.getDateByConstraint=function(t,i,a,r){var n=t.ganttProperties?t.ganttProperties:t,s=new Date(n.constraintDate),o=this.parent.isLoad;if((0,e.isNullOrUndefined)(r)&&(r=!0),(!s||!i)&&r)return null;switch(s=this.parent.assignTimeToDate(s,this.parent.getCurrentDayStartTime(s)),n.constraintType){case D.AsSoonAsPossible:if(o)return i;n.constraintDate=null;var l=this.parent.getRecordByID(n.taskId).parentItem;return n.predecessor&&n.predecessor.length>0?this.parent.assignTimeToDate(i,this.parent.getCurrentDayStartTime(i)):l?this.parent.getRecordByID(l.taskId).ganttProperties.startDate:this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate));case D.AsLateAsPossible:if(o)return i;if(l=this.parent.getRecordByID(n.taskId).parentItem){var d=this.parent.dateValidationModule.checkEndDate(this.parent.getRecordByID(l.taskId).ganttProperties.endDate);return g=this.parent.dateValidationModule.getStartDate(d,n.duration,n.durationUnit,n)}d=this.parent.dateValidationModule.checkEndDate(new Date(this.parent.projectEndDate));return g=this.parent.dateValidationModule.getStartDate(d,n.duration,n.durationUnit,n);case D.MustStartOn:var h=s.getTime()!==n.startDate.getTime(),p=void 0;this.parent.editModule&&this.parent.editModule.dialogModule&&(p=this.parent.editModule.dialogModule.dialogConstraintValue);var u=(0,e.isNullOrUndefined)(p)||2===p||3===p;return h&&!o&&u&&(this.parent.constraintViolationType="MustStartOn"),p=null,o?this.parent.dateValidationModule.checkStartDate(new Date(s)):this.parent.assignTimeToDate(i,this.parent.getCurrentDayStartTime(i));case D.MustFinishOn:h=s.getTime()!==n.endDate.getTime();var c=new Date(s);c.setDate(c.getDate()+1);d=this.parent.dateValidationModule.checkEndDate(c);var g=this.parent.dateValidationModule.getStartDate(d,n.duration,n.durationUnit,n);return h&&!o&&(this.parent.constraintViolationType="MustFinishOn"),a?i:g;case D.StartNoEarlierThan:return s.getTime()<i.getTime()||!o?this.parent.assignTimeToDate(i,this.parent.getCurrentDayStartTime(i)):this.parent.dateValidationModule.checkStartDate(new Date(s));case D.StartNoLaterThan:return(h=s.getTime()!==n.startDate.getTime())&&!o&&(this.parent.constraintViolationType="StartNoLaterThan"),o?n.predecessor&&n.predecessor.length>0?i:this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate)):this.parent.assignTimeToDate(i,this.parent.getCurrentDayStartTime(i));case D.FinishNoEarlierThan:if(s.getTime()<i.getTime())return this.parent.assignTimeToDate(i,this.parent.getCurrentDayEndTime(i));var f=new Date(s);f.setDate(f.getDate()+1);d=this.parent.dateValidationModule.checkEndDate(f);return this.parent.dateValidationModule.getStartDate(d,n.duration,n.durationUnit,n);case D.FinishNoLaterThan:return(h=s.getTime()!==n.endDate.getTime())&&!o&&(this.parent.constraintViolationType="FinishNoLaterThan"),o?n.predecessor&&n.predecessor.length>0?i:this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate)):this.parent.assignTimeToDate(i,this.parent.getCurrentDayEndTime(i));default:return i}},t.prototype.checkEndDate=function(t,i,a,r){if((0,e.isNullOrUndefined)(t))return null;var n,s;if(this.parent.weekWorkingTime.length>0){var o=t;(!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(t)),n=this.parent.getStartTime(o),s=this.parent.getEndTime(o)}else n=this.parent.defaultStartTime,s=this.parent.defaultEndTime;var l,d=new Date(t.getTime()),h=this.getSecondsInDecimal(d);if(h>s)this.setTime(s,d);else if(h<=n&&86400!==s&&!a){var p=this.parent.taskFields;this.parent.editModule&&this.parent.editModule.editedRecord&&!this.parent.editModule.editedRecord[p.startDate]&&this.parent.editModule.editedRecord[p.endDate]?d.setDate(d.getDate()):d.setDate(d.getDate()-1),s=this.parent.getCurrentDayEndTime(d),this.setTime(s,d)}else if(h>n&&h<s)for(var u=0;u<this.parent.workingTimeRanges.length;u++){if(h>this.parent.workingTimeRanges[u].to&&this.parent.workingTimeRanges[u+1]&&h<=this.parent.workingTimeRanges[u+1].from){this.setTime(this.parent.workingTimeRanges[u].to,d);break}}if(!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)return(0,e.isNullOrUndefined)(d)||86400===this.parent.defaultEndTime||(s=this.parent.getCurrentDayEndTime(t),this.setTime(s,d)),new Date(d.getTime());do{l=new Date(d.getTime());var c=this.parent.totalHolidayDates.length;if(this.isValidateNonWorkDays(i)&&!r){if(!this.parent.includeWeekend){var g=new Date(d.getTime());d=this.getPreviousWorkingDay(d),s=this.parent.getCurrentDayEndTime(d),g.getTime()!==d.getTime()&&this.setTime(s,d)}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(d.getTime());D.setMinutes(d.getMilliseconds()-2),m.setHours(0,0,0,0),y.setHours(23,59,59,59),(d.getTime()>=m.getTime()&&d.getTime()<y.getTime()||D.getTime()>=m.getTime()&&D.getTime()<y.getTime())&&(d.setDate(d.getDate()-1),s=this.parent.getCurrentDayEndTime(d),d.getTime()===m.getTime()&&86400===s&&0===this.getSecondsInDecimal(d)||this.setTime(s,d))}}}while(l.getTime()!==d.getTime());return new Date(d.getTime())},t.prototype.checkBaselineStartDate=function(t,i){if((0,e.isNullOrUndefined)(t))return null;var a=this.parent.getCurrentDayStartTime(t),r=this.parent.getCurrentDayEndTime(i&&i.endDate?i.isAutoSchedule?i.endDate:i.autoEndDate:t),n=new Date(t.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},t.prototype.checkBaselineEndDate=function(t,i){if((0,e.isNullOrUndefined)(t))return null;var a=this.parent.getCurrentDayEndTime(t),r=this.parent.getCurrentDayStartTime(i&&i.startDate?i.isAutoSchedule?i.startDate:i.autoStartDate:t),n=new Date(t.getTime()),s=this.getSecondsInDecimal(n);if(s>a)this.setTime(a,n);else if(s<r&&!(0,e.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},t.prototype.calculateStartDate=function(t,i){var a=t.ganttProperties,r=null;i?((0,e.isNullOrUndefined)(a.baselineEndDate)||(0,e.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(t,"baselineStartDate")):((0,e.isNullOrUndefined)(a.endDate)||(0,e.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(t,"startDate"))},t.prototype.getFieldMappings=function(e){return{startdateField:e?"baselineStartDate":"startDate",enddateField:e?"baselineEndDate":"endDate",durationField:e?"baselineDuration":"duration"}},t.prototype.calculateEndDate=function(t,i){var a,r,n=t.ganttProperties,s=null,o=this.getFieldMappings(i),l=o.startdateField,d=o.enddateField,h=o.durationField;if((0,e.isNullOrUndefined)(n[l]))s=t[this.parent.taskFields[d]],(0,e.isNullOrUndefined)(s)||(r=this.parent.getCurrentDayEndTime(s),this.setTime(r,s)),this.parent.setRecordValue(d,s,n,!0);else{if(!(0,e.isNullOrUndefined)(n[d])&&(0,e.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(t,i)),!(0,e.isNullOrUndefined)(n[h])){var p=!i&&!(0,e.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(t,d)},t.prototype.totalDuration=function(e){for(var t=0,i=0;i<e.length;i++)t+=e[i].duration+e[i].offsetDuration;return t},t.prototype.calculateDuration=function(t,i){var a,r=t.ganttProperties;if(!i&&!(0,e.isNullOrUndefined)(r.segments)&&r.segments.length>0&&!(0,e.isNullOrUndefined)(this.parent.editModule.taskbarEditModule))a=this.parent.editModule.taskbarEditModule.sumOfDuration(r.segments);else if(i||(0,e.isNullOrUndefined)(this.parent.taskFields.milestone)||(0,e.isNullOrUndefined)(r.startDate)||(0,e.isNullOrUndefined)(r.endDate)||r.startDate.getTime()!==r.endDate.getTime()||!1!==t.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(!((0,e.isNullOrUndefined)(this.parent.editModule)||(0,e.isNullOrUndefined)(this.parent.editModule.cellEditModule)||this.parent.editModule.cellEditModule.isCellEdit||(0,e.isNullOrUndefined)(p))){if(!(0,e.isNullOrUndefined)(p.edit)&&!(0,e.isNullOrUndefined)(p.edit.read)){var u=this.parent.editModule.dialogModule.dialog;if(!(0,e.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];(0,e.isNullOrUndefined)(c)||c.value===a.toString()||(c.value=a.toString(),c.dataBind())}}(this.parent.taskFields.duration||this.parent.taskFields.baselineDuration)&&(this.parent.dataOperation.updateMappingData(t,h),this.parent.taskFields.durationUnit&&this.parent.dataOperation.updateMappingData(t,"durationUnit"))}},t.prototype.getNonworkingTime=function(t,i,a,r,n){r=!!(0,e.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(t,i),o=this.getNumberOfSeconds(t,i,r),l=!a||!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||n?0:this.getHolidaysCount(t,i),d=(o-86400*s-86400*l)/86400,h=this.getNonWorkingSecondsOnDate(t,i,a,n);return(this.parent.weekWorkingTime.length>0?this.nonWorkingSeconds(t,i,a,d):d*(86400-this.parent.secondsPerDay))+86400*s+86400*l+h},t.prototype.nonWorkingSeconds=function(t,i,a,r,n){var s=t.getTime()>i.getTime()?new Date(i.getTime()):new Date(t.getTime()),o=t.getTime()>i.getTime()?new Date(t.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||(0,e.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},t.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())},t.prototype.calculateDurationValue=function(e,t,i){return e&&"day"!==e?"minute"===e?t*(i/60):t*(i/3600):t},t.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},t.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},t.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},t.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},t.prototype.getProjectStartDate=function(t,i){if(!(0,e.isNullOrUndefined)(this.parent.cloneProjectStartDate)){"string"==typeof this.parent.cloneProjectStartDate&&(this.parent.cloneProjectStartDate=this.getDateFromFormat(this.parent.cloneProjectStartDate));var a=this.checkStartDate(this.parent.cloneProjectStartDate);return this.parent.cloneProjectStartDate=a,new Date(a.getTime())}if((0,e.isNullOrUndefined)(this.parent.projectStartDate)){if((0,e.isNullOrUndefined)(i))return null;var r=this.parent.flatData,n=void 0;r.length>0?n=r[0].ganttProperties.startDate:(n=new Date).setHours(0,0,0,0);for(var s=1;s<r.length;s++){var o=r[s].ganttProperties.startDate;(0,e.isNullOrUndefined)(o)||-1!==this.compareDates(o,n)||(n=o)}this.parent.cloneProjectStartDate=this.checkStartDate(n,t)}else{a=this.getDateFromFormat(this.parent.projectStartDate);this.parent.cloneProjectStartDate=this.checkStartDate(a)}return new Date(this.parent.cloneProjectStartDate.getTime())},t.prototype.getValidStartDate=function(t,i,a){var r=null,n=a?t.baselineStartDate:i?t.autoStartDate:t.startDate,s=a?t.baselineEndDate:i?t.autoEndDate:t.endDate,o=!t.isAutoSchedule&&t.autoDuration?t.autoDuration:t.duration;if((0,e.isNullOrUndefined)(n))if((0,e.isNullOrUndefined)(s)){if(!(0,e.isNullOrUndefined)(o)){var l=this.parent.getTaskByUniqueID(t.uniqueID);if(this.parent.allowUnscheduledTasks&&l&&l.parentItem&&(0,e.isNullOrUndefined)(n)&&(0,e.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(t)}}else{r=new Date(s.getTime());var h=this.parent.getCurrentDayStartTime(r);this.setTime(h,r)}else r=new Date(n.getTime());return r},t.prototype.getValidEndDate=function(t,i,a){var r=null,n=a?t.baselineStartDate:i?t.autoStartDate:t.startDate,s=a?t.baselineEndDate:i?t.autoEndDate:t.endDate,o=i?t.autoDuration:t.duration;if((0,e.isNullOrUndefined)(s))if((0,e.isNullOrUndefined)(n)){if(!(0,e.isNullOrUndefined)(o)){var l=this.getValidStartDate(t);l&&(r=this.getEndDate(l,o,t.durationUnit,t,!1))}}else if(t.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},t.prototype.getWorkingTime=function(t,i,a,r,n,s,o,l){if(!(0,e.isNullOrUndefined)(i.from)&&!(0,e.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(t,c)),n!==this[t.toLowerCase()+"TimeRangeLength"]-1&&""!==t||(this.parent.defaultEndTime=g,this.parent.weekWorkingTime.length>0&&this.assignEndTime(t,g)),n>0?""===t?(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[t.toLowerCase()+"NonWorkingHours"].push(this.parent[t.toLowerCase()+"NonWorkingHours"][this.parent[t.toLowerCase()+"NonWorkingHours"].length-1]+c-this.parent[t.toLowerCase()+"NonWorkingTimeRanges"][n-1].to),this.parent[t.toLowerCase()+"WorkingTimeRanges"][n-1].to<c&&this.parent[t.toLowerCase()+"NonWorkingTimeRanges"].push({from:this.parent[t.toLowerCase()+"WorkingTimeRanges"][n-1].to,to:c,isWorking:!1,interval:c-this.parent[t.toLowerCase()+"WorkingTimeRanges"][n-1].to})):""===t?(s.push(0),l.push({from:0,to:c,isWorking:!1,interval:c})):(this.parent[t.toLowerCase()+"NonWorkingHours"].push(0),this.parent[t.toLowerCase()+"NonWorkingTimeRanges"].push({from:0,to:c,isWorking:!1,interval:c})),""===t?(o.push({from:c,to:g}),l.push({from:c,to:g,isWorking:!0,interval:g-c})):(this.parent[t.toLowerCase()+"WorkingTimeRanges"].push({from:c,to:g}),this.parent[t.toLowerCase()+"NonWorkingTimeRanges"].push({from:c,to:g,isWorking:!0,interval:g-c}))}return r},t.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}},t.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}},t.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},t.prototype.getSecondsPerDay=function(){var t=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,t,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((0,e.isNullOrUndefined)(D)){var v=this.calculateWeekWorkTime(y,h,i,t,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,t,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}),t=w},t.prototype.getDurationValue=function(t){var i=null,a=null;if("string"==typeof t){var r=t.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!==(0,e.getValue)("minute",this.parent.durationUnitEditText).indexOf(n)?i="minute":-1!==(0,e.getValue)("hour",this.parent.durationUnitEditText).indexOf(n)?i="hour":-1!==(0,e.getValue)("day",this.parent.durationUnitEditText).indexOf(n)&&(i="day")}}else a=t,i=null;return{duration:a,durationUnit:i}},t.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},t.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},t.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},t.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},t.prototype.getHolidayDates=function(){for(var t=this.parent.holidays,i=[],a=0;a<t.length;a++){var r=this.getDateFromFormat(t[a].from),n=this.getDateFromFormat(t[a].to);if(!(0,e.isNullOrUndefined)(r)||!(0,e.isNullOrUndefined)(n))if((0,e.isNullOrUndefined)(r)||(0,e.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},t.prototype.isOnHolidayOrWeekEnd=function(t,i){if(i=(0,e.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(t.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),t.getTime()>=n.getTime()&&t.getTime()<s.getTime())return!0}return!1},t.prototype.getNonWorkingSecondsOnDate=function(t,i,a,r){var n,s,o=this.getSecondsInDecimal(t),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(t,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(t);for(var g=0;g<n.length;g++){o>=(f=n[g]).from&&o<=f.to&&(d=g)}s=this.parent.getNonWorkingRange(i);for(g=0;g<s.length;g++){l>=(f=s[g]).from&&l<=f.to&&(h=g)}}else{n=this.parent.nonWorkingTimeRanges,s=this.parent.nonWorkingTimeRanges;for(g=0;g<n.length;g++){var f;o>=(f=n[g]).from&&o<=f.to&&(d=g),l>=f.from&&l<=f.to&&(h=g)}}if(t.getDate()!==i.getDate()||t.getMonth()!==i.getMonth()||t.getFullYear()!==i.getFullYear()){if(u)p+=86400-o;else for(g=d;g<n.length;g++)(0,e.isNullOrUndefined)(n[g])||n[g].isWorking||(p+=g===d?n[g].to-o:n[g].interval);if(c)p+=l;else for(g=0;g<=h;g++)s[g].isWorking||(p+=g===h?l-s[g].from:s[g].interval)}else{if(d!==h)if(c)p+=l-o;else for(g=d;g<=h;g++)(0,e.isNullOrUndefined)(n[g])||n[g].isWorking||(p+=g===d?n[g].to-o:g===h?l-n[g].from:n[g].interval);else if(c)p+=l-o;else n[d].isWorking||(p=l-o)}return p},t.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},t.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)},t.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)},t.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()},t.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){var o=s-i;a.setTime(a.getTime()+60*o*1e3)}else if(s>=0){o=i-s;a.setTime(a.getTime()-60*o*1e3)}}},t.prototype.getSecondsInDecimal=function(e){return 60*e.getHours()*60+60*e.getMinutes()+e.getSeconds()+e.getMilliseconds()/1e3},t.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}},t.prototype.remove=function(t,i){return(0,e.isNullOrUndefined)(t)||(t=this.reverse(t,i,t.getTimezoneOffset())),t},t.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))},t.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))},t.prototype.getDateFromFormat=function(t,i){var a;if((0,e.isNullOrUndefined)(t))return null;if(t instanceof Date)a=new Date(t.getTime());else{var r=this.parent.globalize.parseDate(t,{format:this.parent.getDateFormat(),type:"dateTime"});a=(0,e.isNullOrUndefined)(r)&&!isNaN(new Date(t).getTime())?new Date(t):r}return!(0,e.isNullOrUndefined)(this.parent.timezone)&&i?this.convert(a,this.parent.timezone):a},t.prototype.compareDates=function(t,i){return(0,e.isNullOrUndefined)(t)||(0,e.isNullOrUndefined)(i)?!(0,e.isNullOrUndefined)(t)&&(0,e.isNullOrUndefined)(i)?1:(0,e.isNullOrUndefined)(t)&&!(0,e.isNullOrUndefined)(i)?-1:null:t.getTime()>i.getTime()?1:t.getTime()<i.getTime()?-1:0},t.prototype.getDurationString=function(t,i){var a="";if(!(0,e.isNullOrUndefined)(t)&&(a+=parseFloat(t.toFixed(2))+" ",!(0,e.isNullOrUndefined)(i))){var r=1!==t;"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},t.prototype.getWorkString=function(t,i){var a="";if(!(0,e.isNullOrUndefined)(t)&&(a+=parseFloat(t).toFixed(2)+" ",!(0,e.isNullOrUndefined)(i))){var r=1!==t;"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},t.prototype.calculateProjectDatesForValidatedTasks=function(t){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=(0,e.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},t.prototype.calculateProjectDates=function(t){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(t){(0,e.isNullOrUndefined)(t)||p.push(t)},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||t||this.parent.timelineModule.isZoomToFit){if((h.length>0&&this.parent.timelineModule.isZoomToFit&&this.parent.treeGrid.filterModule&&this.parent.treeGrid.filterModule.filteredResult.length>0?h:d).forEach(function(t){p=[];var a,r,n=t.ganttProperties;(0,e.isNullOrUndefined)(n.startDate)&&(0,e.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))});if(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=(0,e.isNullOrUndefined)(o)?this.getDateFromFormat(new Date):o:(o=(0,e.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())));t?((0,e.setValue)("minStartDate",o,t),(0,e.setValue)("maxEndDate",l,t)):(this.prevProjectStartDate=this.parent.cloneProjectStartDate,this.parent.cloneProjectStartDate=o&&(this.parent.timelineModule.isZoomToFit||(0,e.isNullOrUndefined)(n))?o:new Date(n.getTime()),this.parent.cloneProjectEndDate=l&&(this.parent.timelineModule.isZoomToFit||(0,e.isNullOrUndefined)(s))?l:new Date(s.getTime())),this.parent.isProjectDateUpdated=!0},t.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},t}(),S=(b=function(e,t){return b=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])},b(e,t)},function(e,t){function i(){this.constructor=e}b(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),P=function(t){function a(e){var i=t.call(this,e)||this;return i.customSegmentProperties=[],i.isBaseline=!1,i.uid=0,i.isTaskIDInteger=!0,i.recordIndex=0,i.taskIds=[],i.hierarchyData=[],i.addEventListener(),i}return S(a,t),a.prototype.addEventListener=function(){this.parent.on("beforeDataManipulate",this.checkDataBinding.bind(this))},a.prototype.checkDataBinding=function(t){var a=this;if(t&&(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=[]),(0,e.isNullOrUndefined)(this.parent.dataSource))this.parent.dataSource=[],this.parent.processTimeline(),this.parent.renderGantt(t);else if(this.parent.dataSource instanceof i.DataManager)this.initDataSource(t);else{if(this.parent.dataSource instanceof Object&&n(this.parent)){var r=(0,e.getValue)("result",this.parent.dataSource);this.dataArray=r}else this.dataArray=this.parent.dataSource;this.processTimeline(),this.cloneDataSource(),this.parent.renderGantt(t),this.parent.flatData.map(function(e){a.parent.chartRowsModule.updateSegment(e.ganttProperties.segments,e.ganttProperties.taskId)})}this.parent.flatData.map(function(e){a.parent.chartRowsModule.updateSegment(e.ganttProperties.segments,e.ganttProperties.taskId)})},a.prototype.processTimeline=function(){this.parent.processTimeline(),this.parent.enableValidation||(this.parent.dataOperation.calculateProjectDatesForValidatedTasks(),this.parent.timelineModule.validateTimelineProp())},a.prototype.initDataSource=function(e){var t=this,a=this.parent.query instanceof i.Query?this.parent.query:new i.Query;a.requiresCount();var r=this.parent.dataSource;this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?(this.processTimeline(),this.parent.renderGantt(e)):r.executeQuery(a).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})})},a.prototype.constructDataSource=function(t){for(var a,r=new i.DataManager(t).executeLocal((new i.Query).group(this.parent.taskFields.parentID)),n=[],s=0;s<r.length;s++){var o=r[s];!(0,e.isNullOrUndefined)(o.key)&&(a=this.taskIds.indexOf(o.key.toString()))>-1&&!(0,e.isNullOrUndefined)(o.key)?t[a][this.parent.taskFields.child]=o.items:(-1!==a||this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)&&n.push.apply(n,o.items)}this.hierarchyData=this.dataReorder(t,n)},a.prototype.cloneDataSource=function(){var t=this.parent.taskFields.id,a=this.parent.taskFields.parentID,r=[];if((0,e.isNullOrUndefined)(t)||(0,e.isNullOrUndefined)(a))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((0,e.extend)({},{},l,!0)),(0,e.isNullOrUndefined)(l[t])||this.taskIds.push(l[t].toString())}this.parent.taskFields.child||this.parent.setProperties({taskFields:{child:"Children"}},!0),(0,e.isNullOrUndefined)(s)?this.constructDataSource(n):(this.constructDataSource(this.dataArray),this.dataArray=s),r=this.hierarchyData}if(this.parent.taskFields.segmentId&&(this.segmentCollection=new i.DataManager(this.parent.segmentData).executeLocal((new i.Query).group(this.parent.taskFields.segmentId)),this.parent.taskFields.segments||(this.parent.taskFields.segments="Segments")),"ProjectView"!==this.parent.viewType){var d=(0,e.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)},a.prototype.constructResourceViewDataSource=function(e,t,i){for(var a=function(a){var n=t[a],s=null!==r.parent.taskFields.child?r.parent.taskFields.child:r.parent.taskFields.child="Children",o=n&&n[r.parent.taskFields.resourceInfo],l=r.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){r.isResourceString=!0;for(var d=o,h=0;h<e.length;h++)if(e[h][r.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[r.parent.taskFields.child]&&n[r.parent.taskFields.child].length&&r.constructResourceViewDataSource(e,n[r.parent.taskFields.child],i)},r=this,n=0;n<t.length;n++)a(n)},a.prototype.prepareDataSource=function(t){this.prepareRecordCollection(t,0),this.parent.initialLoadData=(0,e.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()},a.prototype.calculateSharedTaskUniqueIds=function(){for(var e=function(e){var i=[];if(i[0]=t.parent.getTaskIds()[e][0],i[1]=t.parent.getTaskIds()[e].slice(1),"R"!==i[0]){var a=[],r=[];t.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=this,i=0;i<this.parent.getTaskIds().length;i++)e(i)},a.prototype.prepareRecordCollection=function(t,i,a){for(var r=this,n=t.length,s=function(n){var s=t[n];if(!(0,e.isNullOrUndefined)(o.parent.taskFields.segmentId)){var l=o.segmentCollection.filter(function(e){return e.key===s[r.parent.taskFields.id]});l.length>0&&(s[o.parent.taskFields.segments]=l[0].items)}o.parent.taskFields.hasChildMapping&&s.parentUniqueID&&(a=o.parent.getTaskByUniqueID(s.parentUniqueID)),!(0,e.isNullOrUndefined)(o.parent.taskFields.constraintDate)&&!(0,e.isNullOrUndefined)(o.parent.taskFields.constraintType)&&(0,e.isNullOrUndefined)(s[o.parent.taskFields.constraintDate])&&(0,e.isNullOrUndefined)(s[o.parent.taskFields.constraintType])&&(s[o.parent.taskFields.constraintType]=0,s[o.parent.taskFields.constraintDate]=(0,e.isNullOrUndefined)(s[o.parent.taskFields.startDate])?s[o.parent.taskFields.endDate]:s[o.parent.taskFields.startDate]);var d=o.createRecord(s,i,a,!0);(!o.parent.enableValidation||!o.parent.autoCalculateDateScheduling||o.parent.isLoad&&o.parent.treeGrid.loadChildOnDemand&&o.parent.taskFields.hasChildMapping)&&o.updateTaskLeftWidth(d),d.index=o.recordIndex++,o.parent.ids[d.index]=d.ganttProperties.rowUniqueID,o.parent.flatData.push(d),o.parent.setTaskIds(d);var h=s[o.parent.taskFields.child]||s.taskData&&s.taskData[o.parent.taskFields.child];if("ResourceView"===o.parent.viewType&&(0,e.isNullOrUndefined)(h)&&(0,e.isNullOrUndefined)(d.parentItem)&&0===d.level){var p=d.ganttProperties,u=d;o.parent.setRecordValue(p.isAutoSchedule?"startDate":"autoStartDate",null,u.ganttProperties,!0),o.parent.setRecordValue(p.isAutoSchedule?"endDate":"autoEndDate",null,u.ganttProperties,!0);var c=u.ganttProperties;o.parent.setRecordValue("isMilestone",!1,c,!0),c.isAutoSchedule&&o.calculateDuration(u),o.updateWorkWithDuration(u);var g=c.work;o.parent.setRecordValue("work",g,c,!0),o.parent.setRecordValue("taskType","FixedDuration",c,!0),(0,e.isNullOrUndefined)(o.parent.taskFields.type)||o.updateMappingData(u,"type"),o.parent.setRecordValue("progress",Math.floor(0),c,!0),o.parent.setRecordValue("totalProgress",0,c,!0),o.parent.setRecordValue("totalDuration",0,c,!0),c.isAutoSchedule||(o.parent.setRecordValue("autoDuration",o.calculateAutoDuration(c),c,!0),o.updateAutoWidthLeft(u)),o.parent.allowParentDependency||o.resetDependency(u),o.updateWidthLeft(u),o.updateTaskData(u)}o.parent.taskFields.hasChildMapping&&(a=null),!(0,e.isNullOrUndefined)(h)&&h.length>0&&o.prepareRecordCollection(h,d.level+1,d)},o=this,l=0;l<n;l++)s(l)},a.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)}},a.prototype.getGanttUid=function(e){return e+this.uid++},a.prototype.createRecord=function(t,i,a,r){var s=this.parent.taskFields,o=this.parent.resourceFields,l=t[s.progress],d=null,h=null,p=t[s.notes];l=100<(l=l&&parseFloat(l.toString())?parseFloat(l.toString()):0)?100:l;var u,c,g=t[s.dependency],f=this.getDateFromFormat(t[s.baselineStartDate],!0),m=this.getDateFromFormat(t[s.baselineEndDate],!0);this.parent.loadChildOnDemand&&s.hasChildMapping&&!this.parent.enableVirtualization?(u=t,c=JSON.parse(JSON.stringify(t))):u={};var y={},D="Auto"===this.parent.taskMode||"Manual"!==this.parent.taskMode&&!0!==t[s.manual];(this.parent.setRecordValue("ganttProperties",y,u),t.ganttProperties&&t.ganttProperties.predecessor&&t.ganttProperties.predecessor.length>0&&this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.setRecordValue("predecessor",t.ganttProperties.predecessor,y,!0),(0,e.isNullOrUndefined)(t[s.id]))?(0,e.isNullOrUndefined)(t[o.id])||(d=t[o.id],h=(0,e.isNullOrUndefined)(t[o.name])&&"Unassigned Task"===t.resourceName?t.resourceName:t[o.name],this.addTaskData(u,t,!1)):("number"==typeof(d=t[s.id])||/^-?\d+$/.test(d)||(this.isTaskIDInteger=!1),h=t[s.name],!!(this.parent.loadChildOnDemand&&s.hasChildMapping&&t.taskData)?u.taskData=t.taskData:t.taskData&&t.ganttProperties?this.addTaskData(u,t.taskData,r):this.addTaskData(u,t,r));this.parent.setRecordValue("taskId",d,y,!0),this.parent.setRecordValue("taskName",h,y,!0),this.parent&&s.parentID&&this.parent.setRecordValue("parentId",t[s.parentID],y,!0),this.addCustomFieldValue(t,u),this.parent.setRecordValue("isAutoSchedule",D,y,!0),!this.parent.undoRedoModule||this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed?this.parent.setRecordValue("resourceInfo",this.setResourceInfo(t),y,!0):t.ganttProperties&&this.parent.setRecordValue("resourceInfo",t.ganttProperties.resourceInfo,y,!0),this.parent.setRecordValue("isMilestone",!1,y,!0),this.parent.setRecordValue("indicators",t[s.indicators],y,!0),this.updateResourceName(u),!(0,e.isNullOrUndefined)(t[s.child])&&t[s.child].length>0||t.taskData&&t.taskData[s.child]&&t.taskData[s.child].length>0?(this.parent.setRecordValue("hasChildRecords",!0,u),this.parent.setRecordValue("isMilestone",!1,y,!0),this.parent.allowParentDependency||this.resetDependency(u)):this.parent.loadChildOnDemand&&s.hasChildMapping&&u.taskData[s.hasChildMapping]?this.parent.setRecordValue("hasChildRecords",!0,u):this.parent.setRecordValue("hasChildRecords",!1,u);var v=t[s.constraintType];u.hasChildRecords?v&&0!==v&&4!==v&&7!==v&&(t[s.constraintType]=0):v&&(v<0||v>7)&&(t[s.constraintType]=0),this.parent.setRecordValue("constraintType",t[s.constraintType],y,!0),this.parent.setRecordValue("constraintDate",t[s.constraintDate],y,!0),r||(this.parent.setRecordValue("baselineStartDate",this.checkBaselineStartDate(f,y),y,!0),t[s.baselineEndDate]?this.parent.setRecordValue("baselineEndDate",t[s.baselineEndDate],y,!0):this.parent.setRecordValue("baselineEndDate",this.checkBaselineEndDate(m,y),y,!0)),this.calculateScheduledValues(u,t,r),this.calculateScheduledValuesforBaseline(u,t,r),this.parent.setRecordValue("progress",l,y,!0),this.parent.setRecordValue("totalProgress",l,y,!0),t.ganttProperties&&t.ganttProperties.predecessorsName&&this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed?this.parent.setRecordValue("predecessorsName",t.ganttProperties.predecessorsName,y,!0):this.parent.setRecordValue("predecessorsName",g,y,!0),this.parent.setRecordValue("notes",p,y,!0),this.parent.setRecordValue("cssClass",t[s.cssClass],y,!0),this.parent.setRecordValue("parentItem",this.getCloneParent(a),u),this.parent.loadChildOnDemand&&s.hasChildMapping&&this.parent.currentViewData.length>0&&this.parent.setRecordValue("parentItem",u.parentItem,this.parent.currentViewData[this.taskIds.indexOf(t[s.id].toString())]);var k=u.parentItem?u.parentItem.uniqueID:null;if(this.parent.setRecordValue("parentUniqueID",k,u),"ResourceView"!==this.parent.viewType||(0,e.isNullOrUndefined)(s.parentID)||(0,e.isNullOrUndefined)(u.parentItem)||this.parent.setRecordValue("parentId",u.parentItem.taskId,y,!0),this.parent.setRecordValue("level",i,u),t.ganttProperties&&this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed||this.parent.loadChildOnDemand&&s.hasChildMapping&&t.uniqueID?this.parent.setRecordValue("uniqueID",t.uniqueID,u):this.parent.setRecordValue("uniqueID",this.getGanttUid(this.parent.element.id+"_data_"),u),this.parent.setRecordValue("uniqueID",u.uniqueID,y,!0),this.parent.setRecordValue("childRecords",[],u),this.parent.dataSource instanceof Object&&n(this.parent)&&!(0,e.isNullOrUndefined)(s.child)&&this.parent.setRecordValue(s.child,[],u),u.hasChildRecords&&(this.parent.setRecordValue("autoStartDate",u.ganttProperties.startDate,y),this.parent.setRecordValue("autoEndDate",u.ganttProperties.endDate,y),this.parent.setRecordValue("autoDuration",u.ganttProperties.duration,y)),this.parent.setRecordValue("expanded",!u.hasChildRecords||!this.parent.collapseAllParentTasks,u),(0,e.isNullOrUndefined)(c)?this.updateExpandStateMappingValue(u,t):this.updateExpandStateMappingValue(u,c),r||(this.parent.setRecordValue("width",this.calculateWidth(u),y,!0),this.parent.setRecordValue("left",this.calculateLeft(y,u),y,!0),this.parent.setRecordValue("progressWidth",this.getProgressWidth(y.width,l),y,!0),y.baselineEndDate&&y.baselineStartDate&&(this.parent.setRecordValue("baselineLeft",this.calculateBaselineLeft(y),y,!0),this.parent.setRecordValue("baselineWidth",this.calculateBaselineWidth(y),y,!0))),(0,e.isNullOrUndefined)(s.work)&&this.updateWorkWithDuration(u),(0,e.isNullOrUndefined)(s.manual)||this.parent.dataOperation.updateMappingData(u,"manual"),this.updateTaskData(u),g&&this.parent.predecessorsCollection.push(u),(0,e.isNullOrUndefined)(a)||(a.childRecords.push(u),this.parent.dataSource instanceof Object&&n(this.parent)&&!(0,e.isNullOrUndefined)(this.parent.taskFields.child)&&a[this.parent.taskFields.child].push(u.taskData)),"ProjectView"===this.parent.viewType)this.parent.setRecordValue("rowUniqueID",y.taskId.toString(),y,!0);else{var b=u.uniqueID.replace(this.parent.element.id+"_data_","");this.parent.setRecordValue("rowUniqueID",b,u),this.parent.setRecordValue("rowUniqueID",b,y,!0),this.parent.setRecordValue("sharedTaskUniqueIds",[],y,!0)}return this.parent.allowUnscheduledTasks&&u.ganttProperties.startDate&&(u.ganttProperties.endDate||u.ganttProperties.duration)&&(this.parent.setRecordValue("segments",this.setSegmentsInfo(u,!0),y,!0),this.parent.dataOperation.updateMappingData(u,"segments"),r||this.updateWidthLeft(u)),this.parent.chartRowsModule.updateSegment(u.ganttProperties.segments,u.ganttProperties.taskId),u},a.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},a.prototype.setSegmentsInfo=function(t,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(!(0,e.isNullOrUndefined)(this.parent.taskFields.segments)&&(a=i?t.taskData[this.parent.taskFields.segments]:t.ganttProperties.segments,i||t.taskData[this.parent.taskFields.segments]&&t.taskData[this.parent.taskFields.segments].length>0&&t.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)}),!(0,e.isNullOrUndefined)(a)&&a.length>1)){this.sortSegmentsData(a,i,t.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,t.ganttProperties,!1),(0,e.isNullOrUndefined)(m)){if((f=this.getDateFromFormat(f))&&((0,e.isNullOrUndefined)(m)||""===String(m))){var y=void 0;y=this.parent.weekWorkingTime.length>0?this.parent.getEndTime(f):this.parent.defaultEndTime,0===f.getHours()&&86400!==y&&this.setTime(y,f)}if(f=this.checkEndDate(f,t.ganttProperties,!1),m=this.getDuration(g,f,t.ganttProperties.durationUnit,t.ganttProperties.isAutoSchedule,t.ganttProperties.isMilestone),(0,e.isNullOrUndefined)(s[u-1])||(d=(d+=this.getDuration(s[u-1].endDate,g,t.ganttProperties.durationUnit,t.ganttProperties.isAutoSchedule,t.ganttProperties.isMilestone))<1?1:d),n.duration){if((l=t.ganttProperties.duration-o-d)<=0)continue;m=u===a.length-1||l>0&&m>l?l:m,f=this.getEndDate(g,m,t.ganttProperties.durationUnit,t.ganttProperties,!1)}else if(!n.duration&&n.endDate&&f&&(m=this.getDuration(g,f,t.ganttProperties.durationUnit,t.ganttProperties.isAutoSchedule,t.ganttProperties.isMilestone),s.length>0&&f.getTime()<g.getTime()&&f.getTime()<=t.ganttProperties.endDate.getTime())){s[u-1].duration=this.getDuration(s[u-1].startDate,t.ganttProperties.endDate,t.ganttProperties.durationUnit,t.ganttProperties.isAutoSchedule,t.ganttProperties.isMilestone);continue}}else if(f=this.getEndDate(g,m,t.ganttProperties.durationUnit,t.ganttProperties,!1),n.duration){if((l=t.ganttProperties.duration-o)<=0)continue;m=u===a.length-1||l>0&&m>l?l:m,f=this.getEndDate(g,m,t.ganttProperties.durationUnit,t.ganttProperties,!1)}else if(!n.duration&&n.endDate&&f&&(f=!(0,e.isNullOrUndefined)(t.ganttProperties.endDate)&&f.getTime()>=t.ganttProperties.endDate.getTime()&&u===a.length-1?t.ganttProperties.endDate:f,m=this.getDuration(g,f,t.ganttProperties.durationUnit,t.ganttProperties.isAutoSchedule,t.ganttProperties.isMilestone),s.length>0&&f.getTime()<g.getTime()&&f.getTime()<=t.ganttProperties.endDate.getTime())){s[u-1].duration=this.getDuration(s[u-1].startDate,t.ganttProperties.endDate,t.ganttProperties.durationUnit,t.ganttProperties.isAutoSchedule,t.ganttProperties.isMilestone);continue}if(c={},!g||!f||!g||(0,e.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),(0,e.isNullOrUndefined)(s[u-1]))c.offsetDuration=0;else{var D=void 0;D=(0,e.isNullOrUndefined)(this.parent.timelineSettings.bottomTier)?t.ganttProperties.durationUnit:"Minutes"===this.parent.timelineSettings.bottomTier.unit?"minute":"Hour"===this.parent.timelineSettings.bottomTier.unit?"hour":t.ganttProperties.durationUnit;var v=this.getDuration(s[u-1].endDate,s[u].startDate,D,t.ganttProperties.isAutoSchedule,t.ganttProperties.isMilestone);if(c.offsetDuration=v,v<1){if(0===this.parent.weekWorkingTime.length)c.startDate=this.getEndDate(s[u-1].endDate,1,t.ganttProperties.durationUnit,t.ganttProperties,!1);else{var k=new Date(s[u-1].endDate.getTime());if(c.startDate=new Date(k.setHours(k.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));y=this.parent.getEndTime(s[u-1].endDate);this.getSecondsInDecimal(s[u-1].endDate)===y&&this.setTime(this.parent.getEndTime(c.startDate),c.startDate)}c.startDate=this.checkStartDate(c.startDate,t.ganttProperties,!1),c.endDate=this.getEndDate(c.startDate,c.duration,t.ganttProperties.durationUnit,t.ganttProperties,!1),c.endDate=!n.duration&&n.endDate&&c.endDate>t.ganttProperties.endDate?t.ganttProperties.endDate:c.endDate,c.offsetDuration=1}}var b=t[this.parent.taskFields.segments]?t[this.parent.taskFields.segments]:a;p.push(this.setSegmentTaskData(c,b[u]))}this.parent.setRecordValue("duration",o,t.ganttProperties,!0),(0,e.isNullOrUndefined)(s[s.length-1])||this.parent.setRecordValue("endDate",s[s.length-1].endDate,t.ganttProperties,!0),(0,e.isNullOrUndefined)(n.endDate)||(0,e.isNullOrUndefined)(s[s.length-1])||this.parent.setRecordValue(this.parent.taskFields.endDate,s[s.length-1].endDate,t,!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,t)}return s.length>1?(this.parent.setRecordValue("segments",s,t.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.segments,t.taskData[this.parent.taskFields.segments],t,!0)):s=null,s},a.prototype.setSegmentTaskData=function(t,i){var a=this.parent.taskFields,r=(0,e.extend)({},{},i,!0);return(0,e.isNullOrUndefined)(a.startDate)||(r[this.parent.taskFields.startDate]=t.startDate),(0,e.isNullOrUndefined)(a.endDate)||(r[this.parent.taskFields.endDate]=t.endDate),(0,e.isNullOrUndefined)(a.duration)||(r[this.parent.taskFields.duration]=Number(t.duration)),r},a.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},a.prototype.updateWorkWithDuration=function(t){if(this.parent.triggeredColumnName!==this.parent.taskFields.work||0===t.ganttProperties.duration||!(0,e.isNullOrUndefined)(t.ganttProperties.resourceInfo)&&0===t.ganttProperties.resourceInfo.length||t.hasChildRecords){var i,a=this.fetchResources(t),r=0;if(!(0,e.isNullOrUndefined)(a)&&a.length>0&&!t.hasChildRecords){var n=a.length,s=void 0,o=void 0,l=(this.parent.weekWorkingTime.length>0?this.parent.getSecondsPerDay(t.ganttProperties.startDate?t.ganttProperties.startDate:t.ganttProperties.endDate):this.parent.secondsPerDay)/3600,d=this.getDurationInDay(t.ganttProperties.duration,t.ganttProperties.durationUnit);for(s=0;s<n;s++)r+=(i=(o=a[s][this.parent.resourceFields.unit])>0?l*o/100:0)*d;"minute"===t.ganttProperties.workUnit&&(r*=60),"day"===t.ganttProperties.workUnit&&(r/=l),r%1!=0&&(r=parseFloat(r.toFixed(2)))}else!t.hasChildRecords&&!(0,e.isNullOrUndefined)(t.ganttProperties.work)&&!(0,e.isNullOrUndefined)(t.ganttProperties.duration)&&t.ganttProperties.duration>0&&(r=t.ganttProperties.work);if(t.childRecords&&t.childRecords.length>0&&this.parent.isOnEdit){for(var h=0,p=0;p<t.childRecords.length;p++)h+=t.childRecords[p].ganttProperties.work;r+=h}"FixedUnit"===t.ganttProperties.taskType&&0===i&&(r=0,this.parent.setRecordValue("duration",0,t.ganttProperties,!0),(0,e.isNullOrUndefined)(this.parent.taskFields.duration)||this.parent.setRecordValue(this.parent.taskFields.duration,0,t,!0)),this.parent.setRecordValue("work",r,t.ganttProperties,!0),(0,e.isNullOrUndefined)(this.parent.taskFields.work)||this.parent.isLoad||this.parent.dataOperation.updateMappingData(t,"work")}},a.prototype.getCloneParent=function(t){if((0,e.isNullOrUndefined)(t))return null;var i={};return i.uniqueID=t.uniqueID,i.expanded=t.expanded,i.level=t.level,i.index=t.index,i.taskId=t.ganttProperties.rowUniqueID,i},a.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)},a.prototype.addTaskData=function(t,a,r){var n=this,s=this.parent.taskFields,o=this.parent.dataSource;if(r)if(s.parentID||o instanceof i.DataManager&&o.dataSource.json&&o.dataSource.offline)if(s.parentID){var l=a[s.id],d=this.taskIds.indexOf(l.toString()),h=d>-1?this.dataArray[d]:{};if(!(0,e.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,t)}else this.parent.setRecordValue("taskData",a,t);else this.parent.setRecordValue("taskData",a,t);else this.parent.setRecordValue("taskData",a,t)},a.prototype.updateExpandStateMappingValue=function(t,i){var a,r=this.parent.taskFields.expandState,n=i[r];r&&t.hasChildRecords&&((0,e.isNullOrUndefined)(n)?(0,e.isNullOrUndefined)(n)&&!this.parent.collapseAllParentTasks?a=!0:(0,e.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,t),this.parent.setRecordValue(r,a,t),this.parent.setRecordValue("expanded",a,t))},a.prototype.setValidatedDates=function(t,i){var a=t.ganttProperties,r=this.parent.taskFields,n=i[r.duration],s=this.getDateFromFormat(i[r.startDate],!0),o=this.getDateFromFormat(i[r.endDate],!0);n=(0,e.isNullOrUndefined)(n)||""===n?null:n,this.parent.setRecordValue("startDate",new Date(s.getTime()),a,!0),(0,e.isNullOrUndefined)(n)||""===n?this.calculateDuration(t):this.updateDurationValue(n,a),this.parent.setRecordValue("endDate",new Date(o.getTime()),a,!0)},a.prototype.calculateScheduledValues=function(t,i,a){var r,n,s=this.parent.taskFields,o=t.ganttProperties,l=i[s.duration];l=(0,e.isNullOrUndefined)(l)||""===l?null:l,o.startDate&&o.endDate?(r=this.getDateFromFormat(o.startDate,!0),n=this.getDateFromFormat(o.endDate,!0)):(r=this.getDateFromFormat(i[s.startDate],!0),n=this.getDateFromFormat(i[s.endDate],!0));var d=s.segments?i[s.segments]||t.taskData[s.segments]:null,h=!!s.milestone&&!!i[s.milestone],p=i[s.durationUnit]?i[s.durationUnit]:"";this.parent.setRecordValue("durationUnit",this.validateDurationUnitMapping(p),o,!0);var u=(0,e.isNullOrUndefined)(i[s.work])?0:parseFloat(i[s.work]);this.parent.setRecordValue("workUnit",this.validateWorkUnitMapping(this.parent.workUnit),o,!0);var c=i[s.type]?i[s.type]:"",g=this.validateTaskTypeMapping(c);if(this.parent.setRecordValue("taskType",g,o,!0),i[this.parent.resourceFields.name]===this.parent.localeObj.getConstant("unassignedTask")&&this.parent.setRecordValue("taskType","FixedDuration",o,!0),a&&!this.parent.enableValidation&&r&&n)this.setValidatedDates(t,i);else{if(n||r||!(0,e.isNullOrUndefined)(l)&&""!==l){if(r)this.calculateDateFromStartDate(r,n,l,t,a);else if(n)this.calculateDateFromEndDate(n,l,t);else if(!(0,e.isNullOrUndefined)(l)&&""!==l){this.updateDurationValue(l,o);var f=this.parent.allowUnscheduledTasks?null:this.getProjectStartDate(o,a);this.parent.setRecordValue("startDate",f,o,!0),this.parent.allowUnscheduledTasks?this.parent.setRecordValue("endDate",null,o,!0):this.calculateEndDate(t)}}else{if(this.parent.allowUnscheduledTasks)return;this.parent.setRecordValue("duration",1,o,!0),this.parent.setRecordValue("startDate",this.getProjectStartDate(o,a),o,!0),this.calculateEndDate(t)}if(this.parent.taskFields.constraintDate&&this.parent.taskFields.constraintType&&!t[this.parent.taskFields.dependency]){this.parent.setRecordValue("startDate",this.getDateByConstraint(o,o.startDate),o,!0),this.calculateEndDate(t);var m=o.constraintType,y=o.startDate,D=o.endDate,v=this.parent.predecessorModule.getConstraintDate(m,y,D);this.parent.setRecordValue("constraintDate",v,o,!0)}}if((!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)&&((0,e.isNullOrUndefined)(t.ganttProperties.startDate)||(0,e.isNullOrUndefined)(this.parent.taskFields.startDate)||(t[this.parent.taskFields.startDate]=t.ganttProperties.startDate,t.taskData[this.parent.taskFields.startDate]=t.ganttProperties.startDate),(0,e.isNullOrUndefined)(t.ganttProperties.endDate)||(0,e.isNullOrUndefined)(this.parent.taskFields.endDate)||(t[this.parent.taskFields.endDate]=t.ganttProperties.endDate,t.taskData[this.parent.taskFields.endDate]=t.ganttProperties.endDate)),(0,e.isNullOrUndefined)(s.work))s.type&&o.taskType&&this.parent.dataOperation.updateMappingData(t,"type");else{var k=this.parent.taskFields.durationUnit&&i[s.durationUnit]?i[s.durationUnit]:this.parent.durationUnit;if(o.durationUnit=this.validateDurationUnitMapping(k),isNaN(u)||(0,e.isNullOrUndefined)(u))this.parent.setRecordValue("work",0,o,!0),this.parent.setRecordValue("duration",0,o,!0),this.parent.setRecordValue("isMilestone",!0,o,!0),(0,e.isNullOrUndefined)(this.parent.taskFields)||(0,e.isNullOrUndefined)(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!0,t,!0),this.parent.setRecordValue("endDate",o.startDate,o,!0);else{if(this.parent.setRecordValue("work",u,o,!0),!this.parent.undoRedoModule||this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed)switch(g){case"FixedDuration":((0,e.isNullOrUndefined)(t[this.parent.taskFields.resourceInfo])||(0,e.isNullOrUndefined)(t.ganttProperties.resourceInfo)||0===t.ganttProperties.resourceInfo.length)&&0!==o.duration||this.updateWorkWithDuration(t);break;case"FixedWork":((0,e.isNullOrUndefined)(t[this.parent.taskFields.resourceInfo])||(0,e.isNullOrUndefined)(t.ganttProperties.resourceInfo)||0===t.ganttProperties.resourceInfo.length)&&0!==o.work||this.updateDurationWithWork(t);break;case"FixedUnit":t.hasChildRecords||this.updateDurationWithWork(t)}(0,e.isNullOrUndefined)(s.type)||this.parent.dataOperation.updateMappingData(t,"type"),0===o.duration?(this.parent.setRecordValue("isMilestone",!0,o,!0),(0,e.isNullOrUndefined)(this.parent.taskFields)||(0,e.isNullOrUndefined)(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!0,t,!0),this.parent.setRecordValue("endDate",o.startDate,o,!0)):(0,e.isNullOrUndefined)(o.startDate)||(0,e.isNullOrUndefined)(o.duration)||(this.parent.setRecordValue("isMilestone",!1,o,!0),(0,e.isNullOrUndefined)(this.parent.taskFields)||(0,e.isNullOrUndefined)(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!1,t,!0),this.calculateEndDate(t))}this.parent.dataOperation.updateMappingData(t,"work")}(0,e.isNullOrUndefined)(d)||this.parent.setRecordValue("segments",this.setSegmentsInfo(t,!0),o,!0),0===o.duration&&(this.parent.setRecordValue("isMilestone",!0,o,!0),(0,e.isNullOrUndefined)(this.parent.taskFields)||(0,e.isNullOrUndefined)(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!0,t,!0),this.parent.setRecordValue("endDate",o.startDate,o,!0)),!(0,e.isNullOrUndefined)(h)&&h&&(this.parent.setRecordValue("duration",0,o,!0),this.parent.setRecordValue("isMilestone",!0,o,!0),(0,e.isNullOrUndefined)(this.parent.taskFields)||(0,e.isNullOrUndefined)(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!0,t,!0),this.parent.setRecordValue("endDate",o.startDate,o,!0))},a.prototype.calculateScheduledValuesforBaseline=function(t,i,a){var r=this.parent.taskFields,n=t.ganttProperties,s=i[r.baselineDuration];s=(0,e.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,t,a);else if(l)this.calculateDateFromEndDateforBaseline(l,s,t,!0);else if(!(0,e.isNullOrUndefined)(s)&&""!==s){this.updateDurationValue(s,n,!0);var d=this.getProjectStartDate(n,a);this.parent.setRecordValue("baselineStartDate",d,n,!0),this.calculateEndDate(t,!0)}},a.prototype.calculateDateFromStartDateforBaseline=function(t,i,a,r,n){var s=r.ganttProperties,o=!!(0===parseInt(a,10)||t&&i&&new Date(t.getTime())===new Date(i.getTime()))||null;if(this.parent.setRecordValue("baselineStartDate",this.checkStartDate(t,s,o,n,!0),s,!0),i||!(0,e.isNullOrUndefined)(a)&&""!==a)if((0,e.isNullOrUndefined)(a)||i)if((0,e.isNullOrUndefined)(i)||!(0,e.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()||!(0,e.isNullOrUndefined)(s.baselineStartDate)&&!(0,e.isNullOrUndefined)(s.startDate)&&s.baselineStartDate.getTime()===s.startDate.getTime()&&!(0,e.isNullOrUndefined)(i)&&!(0,e.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)},a.prototype.calculateDateFromEndDateforBaseline=function(t,i,a,r){var n,s=a.ganttProperties;n=this.parent.weekWorkingTime.length>0?this.parent.getEndTime(t):this.parent.defaultEndTime,0===t.getHours()&&86400!==n&&this.setTime(n,t);var o=0===parseInt(i,10)||null;this.parent.setRecordValue("baselineEndDate",this.checkEndDate(t,a.ganttProperties,o,!0),s,!0),(0,e.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)):(0,e.isNullOrUndefined)(i)||""===i||(this.updateDurationValue(i,s,r),this.parent.setRecordValue("baselineStartDate",this.getStartDate(s.endDate,s.duration,s.durationUnit,s,!0),s,!0))},a.prototype.updateDurationWithWork=function(t){var i=t.ganttProperties,a=this.fetchResources(t);if(!(0,e.isNullOrUndefined)(a)&&a.length>0){var r=(0,e.isNullOrUndefined)(a)?0:a.length,n=0,s=(this.parent.weekWorkingTime.length>0?this.parent.getSecondsPerDay(t.ganttProperties.startDate?t.ganttProperties.startDate:t.ganttProperties.endDate):this.parent.secondsPerDay)/3600,o=0,l=void 0,d=void 0;for(d=0;d<r;d++)n+=(l=a[d][this.parent.resourceFields.unit])>0?s*l/100:"FixedUnit"!==t.ganttProperties.taskType&&"FixedWork"!==i.taskType&&0!==i.duration?s:0;var h=this.getWorkInHour(i.work,i.workUnit);r>0&&n>0&&(o+=h/n),"FixedUnit"===i.taskType&&0===n&&(this.parent.setRecordValue("work",0,i,!0),this.parent.setRecordValue(this.parent.taskFields.work,0,t,!0)),"minute"===i.durationUnit&&(o=o*s*60),"hour"===i.durationUnit&&(o*=s),o%1!=0&&(o=parseFloat(o.toFixed(2))),(0,e.isNullOrUndefined)(i.duration)||this.parent.setRecordValue("duration",o,i,!0),this.parent.dataOperation.updateMappingData(t,"duration")}},a.prototype.updateUnitWithWork=function(t){var i=t.ganttProperties,a=this.fetchResources(t),r=(0,e.isNullOrUndefined)(a)?0:a.length,n=(this.parent.weekWorkingTime.length>0?this.parent.getSecondsPerDay(t.ganttProperties.startDate?t.ganttProperties.startDate:t.ganttProperties.endDate):this.parent.secondsPerDay)/3600;if(0!==r){var s=this.getDurationInDay(t.ganttProperties.duration,t.ganttProperties.durationUnit),o=this.getWorkInHour(i.work,i.workUnit),l=s>0?o/(s*n)*100:0,d=0===l?0:l>0?l/r:100;d%1!=0&&(d=parseFloat(d.toFixed(2)));for(var h=0;h<r;h++)a[h][this.parent.resourceFields.unit]=d,this.parent.isLoad||(0,e.isNullOrUndefined)(this.parent.editModule)||(0,e.isNullOrUndefined)(this.parent.editModule.dialogModule)||this.parent.editModule.dialogModule.isEdit||(0,e.isNullOrUndefined)(this.parent.editModule.cellEditModule)||this.parent.editModule.cellEditModule.isCellEdit||i.resourceInfo&&(i.resourceInfo[h][this.parent.resourceFields.unit]=d),this.parent.editModule&&this.parent.editModule.dialogModule&&!(0,e.isNullOrUndefined)(this.parent.editModule.dialogModule.ganttResources[h])&&(this.parent.editModule.dialogModule.ganttResources[h][this.parent.resourceFields.unit]=d);this.updateResourceName(t)}},a.prototype.calculateDateFromEndDate=function(t,i,a){var r,n=a.ganttProperties;r=this.parent.weekWorkingTime.length>0?this.parent.getEndTime(t):this.parent.defaultEndTime,0===t.getHours()&&86400!==r&&this.setTime(r,t);var s=0===parseInt(i,10)||null;this.parent.setRecordValue("endDate",this.checkEndDate(t,a.ganttProperties,s),n,!0),(0,e.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)):(0,e.isNullOrUndefined)(i)||""===i||(this.updateDurationValue(i,n),this.parent.setRecordValue("startDate",this.getStartDate(n.endDate,n.duration,n.durationUnit,n),n,!0))},a.prototype.calculateDateFromStartDate=function(t,i,a,r,n){var s=r.ganttProperties,o=!!(0===parseInt(a,10)||t&&i&&new Date(t.getTime())===new Date(i.getTime()))||null;if(this.parent.setRecordValue("startDate",this.checkStartDate(t,s,o,n),s,!0),this.parent.isTreeGridRendered&&r&&this.updateTaskData(r),i||!(0,e.isNullOrUndefined)(a)&&""!==a)if((0,e.isNullOrUndefined)(a)||i)if(i&&((0,e.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))},a.prototype.getProgressWidth=function(e,t){return e*t/100},a.prototype.calculateWidth=function(t,i){var a=t.ganttProperties,r=i?a.autoStartDate:a.startDate,n=i?a.autoEndDate:a.endDate;return(0,e.isNullOrUndefined)(r)&&(0,e.isNullOrUndefined)(n)&&(r=this.getValidStartDate(a,i),n=this.getValidEndDate(a,i)),(0,e.isNullOrUndefined)(r)||(0,e.isNullOrUndefined)(n)?3:!a.isMilestone||t.hasChildRecords&&!a.isAutoSchedule?this.getTaskWidth(r,n,a):0},a.prototype.getTaskbarHeight=function(){var e=this.parent.rowHeight,t=this.parent.taskbarHeight;return t<e?t:e},a.prototype.calculateLeft=function(t,i,a){var r=null,n=-300,s=a?t.autoStartDate:t.startDate,o=a?t.autoEndDate:t.endDate,l=a?t.autoDuration:t.duration,d=t.isMilestone;if(i&&this.parent.allowUnscheduledTasks&&(0,e.isNullOrUndefined)(s)&&(0,e.isNullOrUndefined)(o)&&!(0,e.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=!(0,e.isNullOrUndefined)(s)||!this.parent.allowUnscheduledTasks):r=this.getValidStartDate(t),(0,e.isNullOrUndefined)(r)||(n=this.getTaskLeft(r,d)),n},a.prototype.calculateAutoLeft=function(e){return this.getTaskLeft(e.autoStartDate,e.isMilestone)},a.prototype.calculateAutoDuration=function(e){return this.getDuration(e.autoStartDate,e.autoEndDate,e.durationUnit,!1,e.isMilestone)},a.prototype.calculateAutoWidth=function(e){return this.getTaskWidth(e.autoStartDate,e.autoEndDate)},a.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},a.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},a.prototype.getTaskWidth=function(t,i,a){var r=new Date(t.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),d=new Date(t.getTime()),h=0;if((0,e.isNullOrUndefined)(a)||"hour"!==a.durationUnit||(d=new Date(d.getTime()+60*a.duration*60*1e3)),(!(0,e.isNullOrUndefined)(a)&&"minute"===a.durationUnit||!(0,e.isNullOrUndefined)(a)&&"day"===a.durationUnit&&a.duration<1)&&(d=new Date(d.getTime()+60*a.duration*1e3)),this.isBaseline&&"Day"===s){var p=this.getDuration(r,n,"day",!0,!1);if(this.isBaseline=!1,p>0&&p<1)return p*this.parent.perDayWidth}if(this.parent.weekWorkingTime.length>0)for(var u=new Date(t.getTime()),c=t.getDate();c<=i.getDate();c++){var g=u.getDay(),f=void 0,m=this.parent.weekWorkingTime;switch(g){case 0:f="Sunday";break;case 1:f="Monday";break;case 2:f="Tuesday";break;case 3:f="Wednesday";break;case 4:f="Thursday";break;case 5:f="Friday";break;case 6:f="Saturday";break;default:f=""}for(var y=!0,D=0;D<m.length;D++)if(m[D][f]&&m[D][f].length>0){y=!1;for(var v=0;v<m[D][f].length;v++)h=h+m[D][f][v].to-m[D][f][v].from}if(y)for(var k=0;k<this.parent.dayWorkingTime.length;k++)h=h+this.parent.dayWorkingTime[k].to-this.parent.dayWorkingTime[k].from;u=new Date(u.setDate(u.getDate()+1)),this.parent.includeWeekend||(u=this.parent.dataOperation.getNextWorkingDay(u))}else for(D=0;D<this.parent.dayWorkingTime.length;D++)h=h+this.parent.dayWorkingTime[D].to-this.parent.dayWorkingTime[D].from;var b,w,T=d.getTime()-r.getTime();if(!(0,e.isNullOrUndefined)(a)&&"minute"===a.durationUnit&&a.duration<60*h||!(0,e.isNullOrUndefined)(a)&&"day"===a.durationUnit&&!(0,e.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)>=h||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&&(0,e.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;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,h),"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*h)*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),(l(n)-l(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},a.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)}},a.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},a.prototype.getTaskLeft=function(t,i,a){var r,n=!1,s=new Date(t.getTime());if("Day"===("None"!==this.parent.timelineModule.customTimelineSettings.bottomTier.unit?this.parent.timelineModule.customTimelineSettings.bottomTier.unit:this.parent.timelineModule.customTimelineSettings.topTier.unit)){var o=void 0,d=void 0;this.parent.weekWorkingTime.length>0?(o=this.parent.getStartTime(s),d=this.parent.getEndTime(s)):(o=this.parent.defaultStartTime,d=this.parent.defaultEndTime),this.getSecondsInDecimal(s)===o?s.setHours(0,0,0,0):i&&this.getSecondsInDecimal(s)===d?(s.setHours(24),n=!0):this.getSecondsInDecimal(s)===d&&this.parent.allowUnscheduledTasks&&(s.setHours(22),n=!0)}this.parent.enableTimelineVirtualization&&(this.parent.isLoad||a)&&!this.parent.timelineModule.performedTimeSpanAction&&(r=this.parent.enableTimelineVirtualization&&0!==this.parent.ganttChartModule.scrollObject.element.scrollLeft?this.parent.ganttChartModule.scrollObject.getTimelineLeft():null);var h=(0,e.isNullOrUndefined)(r)?new Date(this.parent.timelineModule.timelineStartDate):new Date(this.parent.timelineModule.dateByLeftValue(r).toString());if(h){var p=void 0;this.hasDSTTransition(t.getFullYear());if(this.hasDSTTransition(s.getFullYear()))return p=this.parent.timelineSettings.showWeekend?(l(s)-l(h))/6e4*(this.parent.perDayWidth/24)/60:this.calculateLeftValue(h,s);var u=void 0;if("Day"!==this.parent.timelineModule.bottomTier||this.getSecondsInDecimal(s)===this.parent.defaultStartTime||0===this.getSecondsInDecimal(s)||n||this.parent.isFromEventMarker)p=this.parent.timelineSettings.showWeekend?(s.getTime()-h.getTime())/864e5*this.parent.perDayWidth:this.calculateLeftValue(h,s);else{var c=new Date(t.getTime()),g=new Date(c.setHours(0,0,0,0));u=this.getDuration(g,t,"day",!0,!1)*this.parent.perDayWidth,s.setHours(0,0,0,0),p=this.parent.timelineSettings.showWeekend?(s.getTime()-h.getTime())/864e5*this.parent.perDayWidth:this.calculateLeftValue(h,s),this.getSecondsInDecimal(t)!==this.parent.defaultStartTime&&"Day"===this.parent.timelineModule.bottomTier&&(p+=u)}return p}return 0},a.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())?l(t)-l(e):t.getTime()-e.getTime())-24*a*60*60*1e3)/864e5*this.parent.perDayWidth},a.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},a.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},a.prototype.updateMappingData=function(t,i){var a=this.parent.columnMapping,r=t.ganttProperties;if(!(0,e.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(!(0,e.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?(t.taskData[this.parent.taskFields.resourceInfo]&&t.taskData[this.parent.taskFields.resourceInfo][0]&&(t.taskData[this.parent.taskFields.resourceInfo]=t.taskData[this.parent.taskFields.resourceInfo][0][s.name]),this.updateTaskDataResource(t)):this.updateTaskDataResource(t),this.parent.setRecordValue(a[i],l.join(","),t)}else"startDate"===i||"endDate"===i?this.setRecordDate(t,r[i],a[i]):"duration"===i?this.setRecordDuration(t,a[i]):"baselineStartDate"===i||"baselineEndDate"===i?this.setRecordDate(t,r[i],a[i]):"baselineDuration"===i?this.setRecordDuration(t,a[i],!0):"work"===i?(this.parent.setRecordValue("taskData."+a[i],r.work,t),this.parent.setRecordValue(a[i],r[i],t)):"type"===i?(this.parent.setRecordValue("taskData."+a[i],r.taskType,t),this.parent.setRecordValue(a[i],r.taskType,t)):"manual"===i?(this.parent.setRecordValue("taskData."+a[i],!r.isAutoSchedule,t),this.parent.setRecordValue(a[i],!r.isAutoSchedule,t)):"segments"===i?this.parent.setRecordValue("taskData."+this.parent.taskFields.segments,this.segmentTaskData(t),t):(this.parent.setRecordValue("taskData."+a[i],r[i],t),this.parent.setRecordValue(a[i],r[i],t))},a.prototype.segmentTaskData=function(t){var i=this,a=t.ganttProperties.segments,r=this.parent.taskFields;if((0,e.isNullOrUndefined)(a))return null;for(var n=(0,e.extend)([],[],t.taskData[r.segments],!0),s=0;s<a.length;s++)(this.parent.isEdit||this.parent.editModule&&this.parent.editModule.dialogModule&&(0,e.getValue)("isEdit",this.parent.editModule.dialogModule)||this.parent.contextMenuModule&&(0,e.getValue)("isEdit",this.parent.contextMenuModule))&&(n[s]={}),(0,e.isNullOrUndefined)(r.startDate)||(n[s][this.parent.taskFields.startDate]=a[s].startDate),(0,e.isNullOrUndefined)(r.endDate)||(n[s][this.parent.taskFields.endDate]=a[s].endDate),(0,e.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},a.prototype.updateTaskDataResource=function(t){var i=t.ganttProperties.resourceInfo,a=t.taskData[this.parent.taskFields.resourceInfo],r=this.parent.resourceFields;if((0,e.isNullOrUndefined)(a))t.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]=(0,e.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(!(0,e.isNullOrUndefined)(a))if("string"!=typeof a){for(var d=function(e){i.filter(function(t){t[r.id]===a[e][r.id]&&-1===l.indexOf(a[e])&&l.push(a[e])})},h=0;h<a.length;h++)d(h);this.parent.setRecordValue("taskData."+this.parent.taskFields.resourceInfo,l,t)}else this.parent.setRecordValue("taskData."+this.parent.taskFields.resourceInfo,a,t)}else this.parent.setRecordValue("taskData."+this.parent.taskFields.resourceInfo,[],t)},a.prototype.setRecordDate=function(t,i,a){var r="string"==typeof i?new Date(i):i;(0,e.isNullOrUndefined)(i)||(i=new Date(r.getTime())),this.parent.setRecordValue(a,i,t),(0,e.isNullOrUndefined)(i)||(i=new Date(r.getTime())),this.parent.isLoad||this.parent.isDynamicData||this.parent.setRecordValue("taskData."+a,i,t),this.parent.isDynamicData=!1},a.prototype.getDurationInDay=function(e,t){return"day"===t?e:"hour"===t?e/(this.parent.secondsPerDay/3600):e/(this.parent.secondsPerDay/60)},a.prototype.setRecordDuration=function(t,i,a){var r=a?t.ganttProperties.baselineDuration:t.ganttProperties.duration,n=t.ganttProperties.durationUnit;if((0,e.isNullOrUndefined)(r))this.parent.setRecordValue(i,r,t),this.parent.setRecordValue("taskData."+i,r,t);else{this.parent.setRecordValue(i,r,t);var s=(0,e.getValue)(i,t.taskData);isNaN(s)&&(0,e.isNullOrUndefined)(this.parent.taskFields.durationUnit)&&!(0,e.isNullOrUndefined)(s)?this.parent.setRecordValue("taskData."+i,this.getDurationString(r,n),t):"string"==typeof s?this.parent.setRecordValue("taskData."+i,r.toString(),t):this.parent.setRecordValue("taskData."+i,r,t)}this.parent.taskFields.durationUnit&&(t.taskData[this.parent.taskFields.durationUnit]=t.ganttProperties.durationUnit)},a.prototype.setDataSource=function(t){var i,a=[];Array.isArray(t)&&(i=t);for(var r=i.length,n=0;n<r;n++){var s=t[n];a.push(s),(0,e.isNullOrUndefined)(t[n][this.parent.taskFields.child])||this.setDataSource(t[n][this.parent.taskFields.child])}return a},a.prototype.setStartDate=function(t){var i=this;((0,e.isNullOrUndefined)(this.parent.taskFields.parentID)||(0,e.isNullOrUndefined)(this.parent.taskFields.id)?this.parent.dataSource:this.setDataSource(this.parent.dataSource)).map(function(a){t.ganttProperties.taskId===a[i.parent.taskFields.id]&&((0,e.isNullOrUndefined)(i.parent.taskFields.startDate)||(t[i.parent.taskFields.startDate]=a[i.parent.taskFields.startDate]),(0,e.isNullOrUndefined)(i.parent.taskFields.endDate)||(t[i.parent.taskFields.endDate]=a[i.parent.taskFields.endDate]))})},a.prototype.getWorkInHour=function(e,t){return"day"===t?e*(this.parent.secondsPerDay/3600):"minute"===t?e/60:e},a.prototype.updateTaskData=function(t){var i=this.parent.taskFields,a=t.ganttProperties;if(!(0,e.isNullOrUndefined)(t.taskData)){var r=t.taskData;if(i.id&&(this.parent.setRecordValue("taskData."+i.id,a.taskId,t),this.parent.setRecordValue(i.id,a.taskId,t)),i.name&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.name,a.taskName,t),this.parent.setRecordValue(i.name,a.taskName,t)),i.startDate&&this.setRecordDate(t,a.startDate,i.startDate),i.endDate&&this.setRecordDate(t,a.endDate,i.endDate),i.duration&&((0,e.isNullOrUndefined)(i.milestone)||!(0,e.isNullOrUndefined)(i.milestone)&&!t.taskData[i.milestone])&&this.setRecordDuration(t,i.duration),i.durationUnit&&(r[i.durationUnit]=a.durationUnit),i.progress&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.progress,a.progress,t),this.parent.setRecordValue(i.progress,a.progress,t)),i.baselineStartDate&&this.setRecordDate(t,a.baselineStartDate,i.baselineStartDate),i.baselineEndDate&&this.setRecordDate(t,a.baselineEndDate,i.baselineEndDate),i.baselineDuration&&this.setRecordDuration(t,i.baselineDuration,!0),i.notes&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.notes,a.notes,t),this.parent.setRecordValue(i.notes,a.notes,t)),i.cssClass&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.cssClass,a.cssClass,t),this.parent.setRecordValue(i.cssClass,a.cssClass,t)),i.indicators&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.indicators,a.indicators,t),this.parent.setRecordValue(i.indicators,a.indicators,t)),i.parentID){var n="ProjectView"===this.parent.viewType?a.parentId:r[i.parentID];this.parent.setRecordValue("taskData."+i.parentID,n,t),this.parent.setRecordValue(i.parentID,a.parentId,t)}i.work&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.work,a.work,t),this.parent.setRecordValue(i.work,a.work,t)),i.type&&(this.parent.setRecordValue("taskData."+i.type,a.taskType,t),this.parent.setRecordValue(i.type,a.taskType,t)),i.constraintDate&&this.setRecordDate(t,a.constraintDate,i.constraintDate),i.constraintType&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.constraintType,a.constraintType,t),this.parent.setRecordValue(i.constraintType,a.constraintType,t))}},a.prototype.setResourceInfo=function(t){var i,a,r=this;if((0,e.isNullOrUndefined)(t[this.parent.taskFields.resourceInfo]))return i;i=this.parent.isLoad?t[this.parent.taskFields.resourceInfo]:t.taskData&&this.parent.taskFields.resourceInfo in t.taskData?t.taskData[this.parent.taskFields.resourceInfo]:t[this.parent.taskFields.resourceInfo],a=(0,e.isNullOrUndefined)(this.parent.editModule)||(0,e.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=t[this.parent.taskFields.resourceInfo].split(",");if(h){a.forEach(function(e){h.includes(e[r.parent.resourceFields.name])&&d.push(e)});var p=(0,e.extend)({},d[0]);l.push(p),(0,e.isNullOrUndefined)(s)||(0,e.isNullOrUndefined)(i[s])||(p[s]=i[s]),(0,e.isNullOrUndefined)(o)||(0,e.isNullOrUndefined)(i[o])||(p[o]=i[o])}}else for(var u=function(t){var r=a.filter(function(e){return"object"==typeof i[t]&&i[t][n]===e[n]||i[t]===e[n]}),d=(0,e.extend)({},r[0]);l.push(d),(0,e.isNullOrUndefined)(s)||(0,e.isNullOrUndefined)(i[t][s])||(d[s]=i[t][s]),(0,e.isNullOrUndefined)(o)||(0,e.isNullOrUndefined)(i[t][o])||(d[o]=i[t][o])},c=0;c<i.length;c++)u(c);return this.updateResourceUnit(l),l},a.prototype.updateResourceUnit=function(t){var i=this.parent.resourceFields.unit;if(!(0,e.isNullOrUndefined)(i)){var a=t.length,r=void 0;for(r=0;r<a;r++)(0,e.isNullOrUndefined)(t[r][i])&&(t[r][i]=100)}},a.prototype.updateResourceName=function(t){var i=t.ganttProperties.resourceInfo,a=[],r=this.parent.taskFields;if(i&&i.length>0){var n=i.length;if("string"==typeof t.taskData[this.parent.taskFields.resourceInfo]){var s=o=t.taskData[this.parent.taskFields.resourceInfo];this.parent.setRecordValue("resourceNames",s,t.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.resourceInfo,s,t,!0),this.updateTaskDataResource(t)}else{var o=(0,e.extend)([],[],t.taskData[this.parent.taskFields.resourceInfo],!0);this.parent.setRecordValue("taskData."+this.parent.taskFields.resourceInfo,[],t);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+"%]"),(0,e.isNullOrUndefined)(h)||a.push(h),t.taskData){var u=r.resourceInfo;o[l]&&(o[parseInt(l.toString(),10)],1)?t.taskData[u].push(o[l]):t.taskData[u].push(d[this.parent.resourceFields.id])}}this.parent.setRecordValue("resourceNames",a.join(","),t.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.resourceInfo,a.join(","),t,!0),this.updateTaskDataResource(t)}}},a.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},a.prototype.validateDurationUnitMapping=function(t){var i=t;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":(0,e.isNullOrUndefined)(this.parent.durationUnit)||(i=this.parent.durationUnit.toLocaleLowerCase()),i},a.prototype.validateTaskTypeMapping=function(e){var t=e;return t="FixedDuration"===t?"FixedDuration":"FixedUnit"===t?"FixedUnit":"FixedWork"===t?"FixedWork":this.parent.taskType},a.prototype.validateWorkUnitMapping=function(e){var t=e;return t="minute"===t?"minute":"hour"===t?"hour":"day"===t?"day":this.parent.workUnit.toLocaleLowerCase()},a.prototype.updateDurationValue=function(t,i,a){var r=this.getDurationValue(t);a&&!isNaN((0,e.getValue)("duration",r))?this.parent.setRecordValue("baselineDuration",(0,e.getValue)("duration",r),i,!0):isNaN((0,e.getValue)("duration",r))||this.parent.setRecordValue("duration",(0,e.getValue)("duration",r),i,!0),(0,e.isNullOrUndefined)((0,e.getValue)("durationUnit",r))||this.parent.setRecordValue("durationUnit",(0,e.getValue)("durationUnit",r),i,!0)},a.prototype.reUpdateGanttData=function(){if(this.parent.flatData.length>0){var t=void 0,i=void 0;this.parent.secondsPerDay=this.getSecondsPerDay();for(var a=0;a<this.parent.flatData.length;a++)t=this.parent.flatData[a].taskData,i=this.parent.flatData[a],(0,e.isNullOrUndefined)(this.parent.taskFields.duration)||this.setRecordDuration(i,this.parent.taskFields.duration),this.parent.isLoad&&this.setStartDate(i),this.calculateScheduledValues(i,t,!1);this.updateGanttData()}},a.prototype._isInStartDateRange=function(e,t,i){var a=!1;return e.getTime()>=t.getTime()&&e.getTime()<i.getTime()&&(a=!0),a},a.prototype._isInEndDateRange=function(e,t,i){var a=!1;return e.getTime()>t.getTime()&&e.getTime()<=i.getTime()&&(a=!0),a},a.prototype.updateOverlappingValues=function(e){var t,i=this,a=e.childRecords,r=[];if(a.length<=1)e.ganttProperties.workTimelineRanges=[];else{a=this.setSortedChildTasks(e),this.updateOverlappingIndex(a);for(var n=function(e){var n=((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)}}),o=[];n.forEach(function(t){for(var r=new Date(t.startDate.getTime()),n=new Date(t.endDate.getTime()),s=0;s<e;s++){var l=a[s];(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,s={};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()?(s.from=t,s.to=n):r.getTime()===t.getTime()&&n.getTime()>a.getTime()?(s.from=t,s.to=a):r.getTime()>t.getTime()&&n.getTime()>=a.getTime()?(s.from=r,s.to=a):r.getTime()>t.getTime()&&n.getTime()<a.getTime()?(s.from=r,s.to=n):t.getTime()>=r.getTime()&&a.getTime()<=n.getTime()&&(s.from=t,s.to=a),s.from&&s.to&&o.push(s))})}}),r.push.apply(r,s.mergeRangeCollections(o))},s=this,o=1;o<a.length;o++)n(o);this.parent.setRecordValue("workTimelineRanges",this.mergeRangeCollections(r,!0),e.ganttProperties,!0),this.calculateRangeLeftWidth(e.ganttProperties.workTimelineRanges)}},a.prototype.updateOverlappingIndex=function(e){for(var t=0;t<e.length;t++)e[t].ganttProperties.eOverlapIndex=t},a.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)},a.prototype.mergeRangeCollections=function(e,t){for(var a,r,n,s,o=[],l={},d={},h=new i.DataManager(e).executeLocal((new i.Query).sortBy(this.parent.taskFields.startDate,"Ascending")),p=0;p<h.length;p++)0!==o.length||0!==p?(a=(l=o[o.length-1]).from,r=l.to,n=(d=h[p]).from,s=d.to,a.getTime()===n.getTime()&&r.getTime()>=s.getTime()||a.getTime()<n.getTime()&&r.getTime()>=s.getTime()||(a.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},a.prototype.setSortedChildTasks=function(e){return new i.DataManager(e.childRecords).executeLocal((new i.Query).sortBy(this.parent.taskFields.startDate,"Ascending"))},a.prototype.splitRangeCollection=function(e,t,i){var a;return"Week"===(a=this.parent.timelineModule.isSingleTier?"None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier:this.parent.timelineModule.bottomTier)||"Month"===a||"Year"===a?e:"Day"===a||0===this.parent.workingTimeRanges[0].from&&86400===this.parent.workingTimeRanges[0].to?this.getRangeWithWeek(e,t,i):this.getRangeWithDay(e,t,i)},a.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},a.prototype.splitRangeForDayMode=function(t,i,a){var r=i||"from",n=a||"to",s=new Date(t[r]),o=new Date(t[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));var y="task";p.getTime()<o.getTime()?(d={},t.task&&(d[y]=(0,e.extend)([],t.task)),d[r]=h,d[n]=p,d.isSplit=!0,l.push(d)):(d={},t.task&&(d[y]=(0,e.extend)([],t.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(t);return l},a.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},a.prototype.splitRangeForWeekMode=function(t,i,a){var r=i||"from",n=a||"to",s=new Date(t[r]),o=new Date(t[r]),l=new Date(t[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),t.task&&(p.task=(0,e.extend)([],t.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={},t.task&&(p.task=(0,e.extend)([],t.task,!0)),p[r]=s,p[n]=l,p.isSplit=!0,h.push(p)):h.push(t)}else h.push(t);return h},a.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)}},a.prototype.shouldProcessUpdateWidth=function(){return!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&Boolean(this.parent.taskFields.hasChildMapping)},a.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))},a.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)}},a.prototype.updateWidthLeft=function(t){var i=t.ganttProperties,a=0,r=0;if(!(0,e.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&&!(0,e.isNullOrUndefined)(i.startDate)&&!(0,e.isNullOrUndefined)(o.startDate)&&!(0,e.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,t)}if(o.width=this.getSplitTaskWidth(o.startDate,o.duration,t),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)}}var h=this.parent.dataOperation.getProgressWidth(a,i.progress),p=!0;for(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(t,"segments")}this.parent.setRecordValue("width",this.parent.dataOperation.calculateWidth(t),i,!0),this.parent.setRecordValue("left",this.parent.dataOperation.calculateLeft(i,t),i,!0),!(0,e.isNullOrUndefined)(i.segments)&&i.segments.length>0?this.parent.setRecordValue("progressWidth",r,i,!0):this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(i.isAutoSchedule||!t.hasChildRecords?i.width:i.autoWidth,i.progress),i,!0)},a.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)},a.prototype.getParentProgress=function(t){var i,a=0,r={};switch(i=this.parent.weekWorkingTime.length>0?this.parent.getSecondsPerDay(t.ganttProperties.startDate?t.ganttProperties.startDate:t.ganttProperties.endDate):this.parent.secondsPerDay,t.ganttProperties.durationUnit){case"hour":a=t.ganttProperties.duration/(i/3600);break;case"minute":a=t.ganttProperties.duration/(i/60);break;default:a=t.ganttProperties.duration}return t.hasChildRecords?((0,e.setValue)("totalProgress",t.ganttProperties.totalProgress,r),(0,e.setValue)("totalDuration",t.ganttProperties.totalDuration?t.ganttProperties.totalDuration:0,r)):((0,e.setValue)("totalProgress",t.ganttProperties.progress*a,r),(0,e.setValue)("totalDuration",a,r)),r},a.prototype.resetDependency=function(t){var i=this.parent.taskFields.dependency;if(!(0,e.isNullOrUndefined)(i)){var a=t.ganttProperties;this.parent.setRecordValue("predecessor",[],a,!0),this.parent.setRecordValue("predecessorsName",null,a,!0),this.parent.setRecordValue("taskData."+i,null,t),this.parent.setRecordValue(i,null,t)}},a.prototype.isUnscheduledTask=function(t,i){for(var a=0,r=null,n=0,s=["startDate","endDate","duration"];n<s.length;n++){var o=s[n];t&&t[o]&&(a++,r=o)}return 1===a||0===a&&!(0,e.isNullOrUndefined)(i)&&i.hasChildRecords?[!0,r]:[!1,null]},a.prototype.isFromManual=function(t){return!!(this.parent.allowUnscheduledTasks&&this.parent.editModule&&this.parent.oldRecords&&this.parent.oldRecords.length>0&&(0,e.isNullOrUndefined)(t.ganttProperties.startDate)&&(0,e.isNullOrUndefined)(t.ganttProperties.endDate)&&!(0,e.isNullOrUndefined)(t.ganttProperties.duration)&&!t.hasChildRecords&&t.parentItem&&("Manual"===this.parent.taskMode||"Custom"===this.parent.taskMode&&t[this.parent.taskFields.manual]))},a.prototype.updateParentItems=function(t,i){var a=this,n=i?t:this.parent.getParentTask(t);n=n||t;var s=!1,o=(0,e.isNullOrUndefined)(n)?null:n.ganttProperties,l=this.isUnscheduledTask(o,n),d=l[0];l[1];if(this.parent.autoCalculateDateScheduling&&!(this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)||"ResourceView"===this.parent.viewType){if(n&&n.childRecords&&n.childRecords.length>0){var h,p=o.isAutoSchedule?o.startDate:o.autoStartDate,u=o.isAutoSchedule?o.endDate:o.autoEndDate,c=n.childRecords,g=c.length,f=0,m=null,y=null,D=0,v=0,k=0,b=0,w=0;c.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=function(t){if(h=P.parent.loadChildOnDemand&&P.parent.taskFields.hasChildMapping?P.parent.currentViewData.filter(function(e){return e.ganttProperties.taskId===c[t][a.parent.taskFields.id]})[0]:c[t],P.parent.isOnDelete&&h.isDelete)return 1===g&&"ProjectView"===P.parent.viewType&&(s=!0),"continue";var i=void 0,l=void 0,p=P.isUnscheduledTask(h.ganttProperties),u=p[0],b=p[1],w=void 0;if(P.isFromManual(h)){var S=P.parent.oldRecords.filter(function(e){return e.ganttProperties.uniqueID===h.ganttProperties.uniqueID})[0];S&&(w=P.parent.getParentTask(S.parentItem))}var C=w||h,R=w?w.ganttProperties:o;if(i=u&&"startDate"!==b&&"endDate"!==b&&!d?o.startDate:P.getValidStartDate(C.ganttProperties),!n.hasChildRecords||R.isAutoSchedule||(0,e.isNullOrUndefined)(C.ganttProperties.autoStartDate)||(i=C.ganttProperties.autoStartDate),l=u&&"startDate"!==b&&"endDate"!==b&&!d?P.getEndDate(o.startDate,C.ganttProperties.duration,C.ganttProperties.durationUnit,C.ganttProperties,!1):P.getValidEndDate(C.ganttProperties),!n.hasChildRecords||R.isAutoSchedule||(0,e.isNullOrUndefined)(C.ganttProperties.autoEndDate)||(l=C.ganttProperties.autoEndDate),u&&"startDate"!==b&&"endDate"!==b){var M=P.getDateFromFormat(l),x=P.getDateFromFormat(i);M>y&&(y=M),x<m&&(m=x)}var O=T&&!u||(0,e.isNullOrUndefined)(T);if((0,e.isNullOrUndefined)(m)&&O&&(m=P.getDateFromFormat(i)),(0,e.isNullOrUndefined)(y)&&O&&(y=P.getDateFromFormat(l)),!(0,e.isNullOrUndefined)(l)&&y&&1===P.compareDates(l,y)&&(y=P.getDateFromFormat(l)),!(0,e.isNullOrUndefined)(i)&&m&&-1===P.compareDates(i,m)&&(m=P.getDateFromFormat(i)),!h.ganttProperties.isMilestone&&r(h.ganttProperties)){var I=P.getParentProgress(h);v+=(0,e.getValue)("totalProgress",I),f+=(0,e.getValue)("totalDuration",I),h[P.parent.taskFields.duration]<1&&(f=Number(f.toFixed(4)))}else D++;var E=h.ganttProperties.work;if("string"==typeof E){var F=parseFloat(E);isNaN(F)||(k+=F)}else"number"==typeof E&&(k+=E)},P=this,C=0;C<g;C++)S(C);if(!s){var R=this.parent.isOnDelete&&h.isDelete?g-D-1:g-D,M=R>0&&f>0?Number((v/f).toFixed(2)):0,x=n.ganttProperties,O=!(0!==R||!m||!y||m.getTime()!==y.getTime());0!==this.compareDates(p,m)&&(this.parent.setRecordValue(o.isAutoSchedule?"startDate":"autoStartDate",m,n.ganttProperties,!0),((0,e.isNullOrUndefined)(o.autoDuration)?0===o.duration:0===o.autoDuration)&&n.isManual&&O&&n.hasChildRecords&&n.ganttProperties.isAutoSchedule&&"TaskbarEditing"!==this.parent.editModule.taskbarEditModule.taskbarEditedArgs.action&&this.parent.setRecordValue("startDate",m,n.ganttProperties,!0)),0!==this.compareDates(u,y)&&(this.parent.setRecordValue(o.isAutoSchedule?"endDate":"autoEndDate",y,n.ganttProperties,!0),((0,e.isNullOrUndefined)(o.autoDuration)?0===o.duration:0===o.autoDuration)&&n.isManual&&O&&n.hasChildRecords&&n.ganttProperties.isAutoSchedule&&"TaskbarEditing"!==this.parent.editModule.taskbarEditModule.taskbarEditedArgs.action&&this.parent.setRecordValue("endDate",y,n.ganttProperties,!0)),this.parent.setRecordValue("isMilestone",O,x,!0),(0,e.isNullOrUndefined)(this.parent.taskFields.milestone)||(this.updateMappingData(n,"milestone"),this.parent.setRecordValue(this.parent.taskFields.milestone,O,n,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.milestone,O,n,!0)),x.isAutoSchedule&&(this.isFromManual(h)?(1===n.childRecords.length&&(n.ganttProperties.duration=h.ganttProperties.duration),this.calculateEndDate(n)):this.calculateDuration(n)),this.updateWorkWithDuration(n);var I=x.work;I=this.parent.isOnEdit?I:I+k,this.parent.setRecordValue("work",I,x,!0),this.parent.setRecordValue("taskType","FixedDuration",x,!0),(0,e.isNullOrUndefined)(this.parent.taskFields.type)||this.updateMappingData(n,"type"),this.parent.setRecordValue("progress",Math.floor(M),x,!0),this.parent.setRecordValue("totalProgress",v,x,!0),this.parent.setRecordValue("totalDuration",f,x,!0),this.parent.setRecordValue("autoDuration",x.duration,x,!0),x.isAutoSchedule||(this.parent.setRecordValue("autoDuration",this.calculateAutoDuration(x),x,!0),this.updateAutoWidthLeft(n)),this.parent.allowParentDependency||this.resetDependency(n),this.updateWidthLeft(n),this.updateTaskData(n)}}}else this.parent.setRecordValue("endDate",n.taskData[this.parent.taskFields.endDate],n.ganttProperties,!0);s&&1===n.childRecords.length&&0===n.ganttProperties.duration&&(this.parent.setRecordValue("isMilestone",!0,n.ganttProperties,!0),this.updateWidthLeft(n),this.updateTaskData(n));var E=(0,e.isNullOrUndefined)(n)?null:this.parent.getParentTask(n.parentItem);E&&((!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)&&"ResourceView"!==this.parent.viewType||this.updateParentItems(E)),s=!1},a}(T),C="e-gantt",R="e-gantt-single-timeline",M="e-chart-root-container",x="e-chart-rows-container",O="e-device",I="e-grid",E="e-timeline-header-container",F="e-timeline-header-table-container",U="e-timeline-header-table-body",N="e-left-label-container",L="e-left-label-inner-div",V="e-right-label-container",B="e-right-label-inner-div",A="e-taskbar-main-container",W="e-task-label",H="e-gantt-child-taskbar-inner-div",j="e-gantt-child-progressbar-inner-div",z="e-gantt-child-critical-taskbar-inner-div",q="e-gantt-child-critical-progressbar-inner-div",G="e-critical-milestone",_="e-baseline-bar",Z="e-baseline-gantt-milestone-container",X="e-chart-row-cell",Y="e-chart-row",K="e-gantt-multi-taskbar",Q="e-taskbar-left-resizer",$="e-taskbar-right-resizer",J="e-child-progress-resizer",ee="e-progressbar-handler",te="e-progressbar-handler-element",ie="e-progressbar-handler-after",ae="e-icon",re="e-gantt-milestone",ne="e-gantt-child-taskbar",se="e-gantt-child-progressbar",oe="e-manualparent-main-container",le="e-gantt-manualparenttaskbar",de="e-gantt-manualparent-milestone",he="e-gantt-child-manualtaskbar",pe="e-gantt-manualparenttaskbar-right",ue="e-gantt-parent-taskbar",ce="e-gantt-parent-progressbar",ge="e-gantt-unscheduled-task",fe="e-left-resize-gripper",me="e-right-resize-gripper",ye="e-progress-resize-gripper",De="e-label",ve="e-template-padding",ke="e-span",be="e-gantt-unscheduled-taskbar-left",we="e-gantt-unscheduled-taskbar-right",Te="e-connector-line-container",Se="e-connector-line",Pe="e-critical-line",Ce="e-critical-line-arrow",Re="e-connector-line-arrow",Me="e-connector-line-z-index",xe="e-connectorpoint-left",Oe="e-connectorpoint-right",Ie="e-connectorpoint-left-hover",Ee="e-connectorpoint-right-hover",Fe="e-right-connectorpoint-outer-div",Ue="e-connectorpoint-allow-block",Ne="e-gantt-tooltip",Le=".e-content",Ve=".e-gridform",Be="e-edit",Ae="e-active-parent-task",We="e-active-child-task",He="e-active-connected-task",je="e-predecessor-touch-mode",ze="e-rangecontainer",qe="e-rg-rangdiv",Ge="e-constraint-label",_e=function(){function t(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 t.prototype.addEventListeners=function(){this.parent.on("grid-scroll",this.gridScrollHandler,this),e.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)},t.prototype.removeEventListeners=function(){e.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)},t.prototype.gridScrollHandler=function(t){this.element.scrollTop=(0,e.getValue)("top",t),this.isFromTreeGrid=!0},t.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))},t.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},t.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)},t.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"}},t.prototype.updateTopPosition=function(){var t,i=this.parent.treeGrid.element.querySelector(".e-content").scrollTop;this.parent.virtualScrollModule&&this.parent.enableVirtualization?t=i-this.parent.virtualScrollModule.getTopPosition():t=i;if(!(0,e.isNullOrUndefined)(this.parent.dayMarkersModule)){var a=(0,e.getValue)("nonworkingDayRender.holidayContainer",this.parent.dayMarkersModule),r=(0,e.getValue)("nonworkingDayRender.weekendContainer",this.parent.dayMarkersModule),n=(0,e.getValue)("eventMarkerRender.eventMarkersContainer",this.parent.dayMarkersModule);a&&(a.style.top=(0,e.formatUnit)(t)),r&&(r.style.top=(0,e.formatUnit)(t)),n&&(n.style.top=(0,e.formatUnit)(t))}this.parent.chartVerticalLineContainer&&(this.parent.chartVerticalLineContainer.style.top=(0,e.formatUnit)(t))},t.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)},t.prototype.transformChange=function(){this.parent.ganttChartModule.virtualRender.adjustTable(),this.parent.ganttChartModule.scrollObject.updateTopPosition()},t.prototype.updateShimmer=function(){var e=this.parent;setTimeout(function(){e.showMaskRow()},0)},t.prototype.updateSpinner=function(){var e=this.parent;this.parent.showSpinner(),window.clearTimeout(this.isScrolling),this.isScrolling=setTimeout(function(){e.hideSpinner()},200)},t.prototype.onScroll=function(){var t=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,(0,e.isNullOrUndefined)(i.scrollDirection)||!0!==this.parent.enableVirtualization&&!0!==this.parent.enableTimelineVirtualization||!this.parent.isToolBarClick&&!(0,e.isNullOrUndefined)(this.parent.isToolBarClick)||(this.parent.isVirtualScroll=!0,(this.parent.showIndicator||(0,e.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(){t.removeShimmer()},0)):this.updateSpinner()),this.parent.isRowSelected=!1)),this.isSetScrollLeft=!1,this.parent.isToolBarClick=!0,i.requestType="scroll",this.parent.trigger("actionComplete",i)},t.prototype.setHeight=function(t){this.element.style.height=(0,e.formatUnit)(t)},t.prototype.setWidth=function(t){this.element.style.width=(0,e.formatUnit)(t)},t.prototype.setScrollTop=function(e){this.element.scrollTop=e,this.parent.treeGrid.element.querySelector(".e-content").scrollTop=e},t.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)},t.prototype.destroy=function(){this.removeEventListeners()},t}(),Ze=m(707),Xe=function(){function t(e){this.parent=e}return t.prototype.renderWrapper=function(){this.wrapper=(0,e.createElement)("div",{className:"e-virtualtable",styles:"position: absolute; transform: translate(0px, 0px);"}),this.parent.ganttChartModule.scrollElement.appendChild(this.wrapper),this.virtualTrack=(0,e.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)},t.prototype.appendChildElements=function(e){this.wrapper.appendChild(e)},t.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;if(""!==t)a=t.match(/translate.*\((.+)\)/)[1].split(", ")[0];else a=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},t}(),Ye=function(){function t(t){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=t,this.chartTimelineContainer=null,this.rangeViewContainer=(0,e.createElement)("div",{className:ze}),this.rangeViewContainer.setAttribute("role","button"),this.rangeViewContainer.setAttribute("aria-label","RangeContainer"),this.virtualRender=new Xe(this.parent),this.addEventListener()}return t.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)},t.prototype.renderChartContents=function(){this.parent.notify("refreshDayMarkers",{}),this.wireEvents()},t.prototype.renderChartContainer=function(){this.chartElement=(0,e.createElement)("div",{id:this.parent.element.id+"GanttChart",className:"e-gantt-chart"}),this.parent.chartPane.appendChild(this.chartElement),this.renderTimelineContainer(),this.renderBodyContainers()},t.prototype.renderInitialContents=function(){this.parent.timelineModule.createTimelineSeries()},t.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("."+ze);i&&(i.innerHTML=""),0===this.parent.treeGrid.grid.filterSettings.columns.length&&this.renderRangeContainer(this.parent.currentViewData)},t.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 t=0;t<this.parent.chartRowsModule.ganttChartTableBody.children.length;t++)if(this.parent.chartRowsModule.ganttChartTableBody.children[t].children[0].children[1].children[4])this.parent.chartRowsModule.ganttChartTableBody.children[t].children[0].children[1].children[1].setAttribute("tabindex","-1"),this.parent.chartRowsModule.ganttChartTableBody.children[t].children[0].children[1].children[2].setAttribute("tabindex","-1"),this.parent.chartRowsModule.ganttChartTableBody.children[t].children[0].children[1].children[4].setAttribute("tabindex","-1");else if("ProjectView"===this.parent.viewType){var i=this.parent.chartRowsModule.ganttChartTableBody.children[parseInt(t.toString(),10)].children[0].children[1].children[1];(0,e.isNullOrUndefined)(i)||this.parent.chartRowsModule.ganttChartTableBody.children[t].children[0].children[1].children[1].setAttribute("tabindex","-1")}else this.parent.chartRowsModule.ganttChartTableBody.children[parseInt(t.toString(),10)].children[0].children[1].children[0]&&this.parent.chartRowsModule.ganttChartTableBody.children[t].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||!(0,e.isNullOrUndefined)(this.parent.isVirtualScroll)&&this.parent.isVirtualScroll);this.parent.isLoad&&!r&&this.parent.notify("selectRowByIndex",{}),this.parent.timelineModule.isZoomedToFit&&this.parent.timelineModule.processZoomToFit()},t.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)},t.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},t.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},t.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))}},t.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)},t.prototype.calculateCollapsedRowHeight=function(e){return this.parent.rowHeight-e},t.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},t.prototype.calculateExpandedRowHeight=function(e,t,i){return(e+t)*this.parent.rowHeight-i},t.prototype.renderRange=function(t,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=(0,e.createElement)("div",{className:"rangeContainer"+i.ganttProperties.rowUniqueID,styles:"top:"+a+"px; position: absolute;"});if((0!==i.level||i.expanded||!(0,e.isNullOrUndefined)(i.parentItem)||this.parent.enableMultiTaskbar)&&(!(i.level>0&&i.expanded)||this.parent.getRecordByID(i.parentItem.taskId).expanded)){for(var d=0;d<t.length;d++){var h=void 0,p=this.parent.chartRowsModule.ganttChartTableBody.childNodes;if(this.parent.allowTaskbarOverlap||i.expanded||!this.parent.enableMultiTaskbar)h=this.getRangeHeight(i);else 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=(0,e.createElement)("div",{className:qe+" e-leftarc",styles:(this.parent.enableRtl?"right:":"left:")+(this.parent.enableRtl?t[d].left+t[d].width-5:t[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=(0,e.createElement)("div",{className:qe+" e-rightarc",styles:(this.parent.enableRtl?"right:":"left:")+(this.parent.enableRtl?t[d].left:t[d].left+t[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)}},t.prototype.renderTimelineContainer=function(){this.chartTimelineContainer=(0,e.createElement)("div",{className:E}),this.parent.enableRtl&&(this.chartTimelineContainer.style.borderLeftWidth="1px",this.chartTimelineContainer.style.borderRightWidth="0px"),this.chartTimelineContainer.setAttribute("role","presentation"),this.chartElement.appendChild(this.chartTimelineContainer)},t.prototype.renderBodyContainers=function(){this.chartBodyContainer=(0,e.createElement)("div",{className:M}),this.chartElement.appendChild(this.chartBodyContainer),this.scrollElement=(0,e.createElement)("div",{className:"e-chart-scroll-container e-content",styles:"position:relative;"}),this.chartBodyContainer.appendChild(this.scrollElement),this.chartBodyContent=(0,e.createElement)("div",{className:x,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 _e(this.parent);var t=0;(0,e.isNullOrUndefined)(this.parent.toolbarModule)||(0,e.isNullOrUndefined)(this.parent.toolbarModule.element)||(t=this.parent.toolbarModule.element.offsetHeight),this.scrollObject.setHeight(this.parent.ganttHeight-this.chartTimelineContainer.offsetHeight-t)},t.prototype.updateWidthAndHeight=function(){var t=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(t>=i.offsetHeight||"auto"===this.parent.height||i.offsetHeight-t<36)this.chartBodyContent.style.height=(0,e.formatUnit)(t);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?(0,e.formatUnit)(3*this.parent.element.offsetWidth):(0,e.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?(0,e.formatUnit)(3*this.parent.element.offsetWidth):(0,e.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=(0,e.formatUnit)(this.parent.timelineModule.totalTimelineWidth-r)}this.setVirtualHeight(),this.parent.notify("updateHeight",{}),this.parent.updateGridLineContainerHeight(),this.updateLastRowBottomWidth()},t.prototype.setVirtualHeight=function(){if(this.parent.virtualScrollModule&&this.parent.enableVirtualization){(0,e.getValue)("virtualTrack",this.parent.ganttChartModule.virtualRender).style.height=this.parent.treeGrid.element.getElementsByClassName("e-virtualtrack")[0].style.height;var t=(0,e.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;if("translate(0px)"===i&&navigator.userAgent.includes("Firefox")&&(i="translate(0px, 0px)"),""!==a)r=a.match(/translate.*\((.+)\)/)[1].split(", ")[0];else r=this.parent.ganttChartModule.scrollElement.getElementsByClassName("e-virtualtable")[0].style.transform.match(/translate.*\((.+)\)/)[1].split(", ")[0];var n=i.match(/translate.*\((.+)\)/)[1].split(", ")[1];t.style.transform="translate("+r+", "+n+")"}else t.style.transform=i}},t.prototype.updateLastRowBottomWidth=function(){if(this.parent.currentViewData.length>0&&"auto"!==this.parent.height){var t=this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.currentViewData:this.parent.expandedRecords,i=t[t.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")&&(0,e.removeClass)(n.querySelectorAll(".e-chart-row-cell.e-chart-row-border.e-lastrow"),"e-lastrow"),this.chartBodyContent.clientHeight<this.chartBodyContainer.clientHeight&&r){(0,e.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=(0,e.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"}}}},t.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))},t.prototype.ganttChartMouseDown=function(t){var i=!1;if("touchstart"===t.type&&t instanceof TouchEvent&&t.touches&&2===t.touches.length&&(this.initPinchDistance=this.calculatePinchDistance(t.touches[0],t.touches[1]),this.isPinching=!0),this.parent.allowTaskbarDragAndDrop&&this.parent.editModule&&this.parent.editSettings.allowTaskbarEditing&&!this.isPinching){var a=this.parent.editModule.taskbarEditModule.getTaskBarAction(t);if("ChildDrag"===a||"ParentDrag"===a||"MilestoneDrag"===a||"ManualParentDrag"===a){var r={cancel:i,data:this.getRecordByTaskBar(t.target),target:t.target,chartRow:(0,e.closest)(t.target,"tr")};this.parent.trigger("rowDragStartHelper",r),i=r.cancel}}if(!i&&!this.isPinching){3!==t.which&&this.parent.editSettings.allowTaskbarEditing&&(this.parent.notify("chartMouseDown",t),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!==t.button||this.parent.editSettings.allowEditing&&this.parent.treeGrid.element.getElementsByClassName("e-editedbatchcell").length>0&&this.parent.treeGrid.endEdit()}},t.prototype.calculatePinchDistance=function(e,t){var i=t.clientX-e.clientX,a=t.clientY-e.clientY;return Math.sqrt(i*i+a*a)},t.prototype.ganttChartMouseClick=function(e){this.parent.autoFocusTasks&&this.scrollToTarget(e),this.parent.notify("chartMouseClick",e)},t.prototype.ganttChartMouseUp=function(t){if("touchend"===t.type){this.initPinchDistance=null,this.isPinching=!1;var i=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-taskbar-resize-div");(0,e.isNullOrUndefined)(i)||i.remove();var a=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-clone-taskbar")||this.parent.chartPane.querySelector(".e-clone-taskbar");if(!(0,e.isNullOrUndefined)(a))a.parentElement.parentElement.remove();var r=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-gantt-false-line");(0,e.isNullOrUndefined)(r)||this.parent.editModule.taskbarEditModule.removeFalseLine(!0)}if(this.parent.editSettings.allowTaskbarEditing&&this.parent.notify("chartMouseUp",t),!this.parent.editSettings.allowEditing){var n=!1;if(this.parent.editSettings.allowTaskbarEditing&&(0,e.getValue)("editModule.taskbarEditModule.isMouseDragged",this.parent)&&(0,e.getValue)("editModule.taskbarEditModule.taskBarEditAction",this.parent)&&(n=!0),!n){var s=t.target,o=t.target.classList.contains(A)||(0,e.closest)(t.target,"."+A);!(0,e.closest)(s,".e-gantt-parent-taskbar")||this.parent.editSettings.allowEditing||this.parent.isAdaptive?!o&&this.parent.autoFocusTasks&&this.scrollToTarget(t):this.chartExpandCollapseRequest(t)}}},t.prototype.scrollToTarget=function(t){var i=(0,e.closest)(t.target,"tr");if(i&&this.parent.element.contains(i)&&(this.parent.element.querySelectorAll(".e-chart-rows-container")[0].contains(t.target)||this.parent.element.querySelectorAll(".e-gridcontent")[0].contains(t.target))&&this.parent.currentViewData.length>0){var a=(0,e.getValue)("rowIndex",(0,e.closest)(t.target,"tr")),r=this.parent.currentViewData[a].ganttProperties.startDate,n=this.parent.currentViewData[a].ganttProperties.left;if(!(0,e.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))}}},t.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)},t.prototype.mouseUp=function(t){"touchend"===t.type&&(this.initPinchDistance=null,this.isPinching=!1),(0,e.isNullOrUndefined)(this.parent.editModule)||(0,e.isNullOrUndefined)(this.parent.editModule.taskbarEditModule)||this.parent.editModule.taskbarEditModule.removeFalseLine(!1);var i=this.parent.element.querySelector(".e-taskbar-resize-div");if((0,e.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",t),this.isGanttElement=!1},t.prototype.documentMouseUp=function(t){if("touchend"===t.type&&(this.initPinchDistance=null,this.isPinching=!1,this.previousPinchDistance=0),this.isGanttElement=!0,(t.target.classList.contains("e-treegridexpand")||t.target.classList.contains("e-treegridcollapse"))&&!0===(0,e.getValue)("isEditCollapse",this.parent.treeGrid)&&(0,e.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!==t.which){var a=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-taskbar-resize-div");(0,e.isNullOrUndefined)(a)||a.remove();var r=this.parent.element.getElementsByClassName("e-clone-taskbar")[0];if(!(0,e.isNullOrUndefined)(r))r.parentElement.parentElement.remove();var n=!1;if(this.parent.editSettings.allowTaskbarEditing&&(0,e.getValue)("editModule.taskbarEditModule.isMouseDragged",this.parent)&&(0,e.getValue)("editModule.taskbarEditModule.taskBarEditAction",this.parent)&&(n=!0),this.parent.notify("chartMouseUp",t),this.parent.showActiveElement&&(this.parent.showIndicator=!0,this.focusedElement&&!t.target.classList.contains("e-split-bar")&&(this.focusedElement.tabIndex=0===this.focusedElement.tabIndex?-1:this.focusedElement.tabIndex,(0,e.removeClass)([this.focusedElement],"e-active-container"))),!n){var s=t.target,o=t.target.classList.contains(A)||(0,e.closest)(t.target,"."+A);(0,e.closest)(s,".e-gantt-parent-taskbar")&&!this.parent.editSettings.allowEditing?this.chartExpandCollapseRequest(t):!o&&this.parent.autoFocusTasks&&this.scrollToTarget(t)}if(this.parent.editModule&&this.parent.editModule.taskbarEditModule&&this.parent.editModule.taskbarEditModule.removeFalseLine(!0),!(0,e.isNullOrUndefined)(this.parent.onTaskbarClick)&&!n){s=t.target;var l=(0,e.closest)(s,".e-gantt-parent-taskbar,.e-gantt-child-taskbar,.e-gantt-milestone");l&&this.onTaskbarClick(t,s,l)}}},t.prototype.onTaskbarClick=function(t,i,a){var r,n=(0,e.closest)(i,"tr");(0,e.isNullOrUndefined)(n)||(r=(0,e.getValue)("rowIndex",n));var s={data:this.getRecordByTarget(t),taskbarElement:a,rowIndex:r,target:i};this.parent.trigger("onTaskbarClick",s)},t.prototype.ganttChartLeave=function(e){this.parent.editSettings.allowTaskbarEditing&&this.parent.notify("chartMouseLeave",e)},t.prototype.ganttChartMove=function(t){if("touchmove"===t.type&&!0===this.isPinching&&t instanceof TouchEvent&&t.touches&&2===t.touches.length){var i=this.calculatePinchDistance(t.touches[0],t.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"===t.type||"touchstart"===t.type||"touchend"===t.type?t.changedTouches[0].pageX:t.pageX)<=this.parent.getOffsetRect(this.parent.ganttChartModule.chartElement).left)return}this.parent.notify("chartMouseMove",t),!(0,e.isNullOrUndefined)(this.parent.taskFields.dependency)&&this.parent.connectorLineEditModule&&this.parent.connectorLineEditModule.updateConnectorLineEditElement(t)}},t.prototype.contextClick=function(t){if(this.parent.allowFiltering&&this.parent.filterModule&&this.parent.filterModule.closeFilterOnContextClick(t.srcElement),this.parent.allowTaskbarDragAndDrop){var i=this.parent.chartPane.querySelector(".e-clone-taskbar");if(!(0,e.isNullOrUndefined)(i))i.parentElement.parentElement.remove()}},t.prototype.mouseMoveHandler=function(t){if(!(0,e.isNullOrUndefined)(this.parent.onMouseMove)&&(this.parent.flatData.length||t.target.classList.contains("e-header-cell-label")||t.target.classList.contains("e-headercell"))){var i=t.target,a={originalEvent:t},r=(0,e.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,s=void 0,o=(0,e.closest)(i,".e-rowcell,.e-chart-row-cell"),l=(0,e.closest)(i,".e-rowcell,.e-headercell");if(o&&(s=this.parent.ganttChartModule.getRecordByTarget(t),a.data=s),l){var d=(0,e.getValue)("cellIndex",l);a.column=this.parent.treeGrid.columns[d]}if((0,e.closest)(i,".e-indicator-span")){var h=0,p=s.ganttProperties.indicators;if(p.length>1)for(h=0;h<p.length&&p[h].name!==r.innerText.trim();h++);a.indicator=p[h]}if((0,e.closest)(i,".e-connector-line-container"))(n={}).target=r,a.predecessor=this.parent.tooltipModule.getPredecessorTooltipData(n);if((0,e.closest)(i,".e-event-markers"))(n={}).target=r,a.eventMarkers=this.parent.tooltipModule.getMarkerTooltipData(n);i.classList.contains("e-header-cell-label")&&(a.date=new Date(i.dataset.content))}this.parent.trigger("onMouseMove",a)}},t.prototype.doubleClickHandler=function(t){var i=t.target,a=(0,e.closest)(i,"tr"),r=(0,e.getValue)("rowIndex",a),n=this.parent.ganttChartModule.getRecordByTarget(t);this.parent.editSettings.allowEditing&&this.parent.treeGrid.element.getElementsByClassName("e-editedbatchcell").length>0&&this.parent.treeGrid.endEdit(),this.parent.notify("chartDblClick",t);var s={row:a,rowData:n,rowIndex:r,target:i};this.recordDoubleClick(s)},t.prototype.recordDoubleClick=function(e){this.parent.trigger("recordDoubleClick",e)},t.prototype.getRecordByTarget=function(t){var i,a=(0,e.closest)(t.target,"div."+A);if((0,e.isNullOrUndefined)(a)){if(a=(0,e.closest)(t.target,"tr")){var r=(0,e.getValue)("rowIndex",(0,e.closest)(t.target,"tr"));i=this.parent.currentViewData[r]}}else{var n=a.getAttribute("rowUniqueId");i=this.parent.getRecordByID(n)}return i},t.prototype.getChartRows=function(){return null!==document.getElementById(this.parent.element.id+"GanttTaskTableBody")?document.getElementById(this.parent.element.id+"GanttTaskTableBody").querySelectorAll(".e-chart-row"):null},t.prototype.chartExpandCollapseRequest=function(t){if(!this.parent.enableMultiTaskbar){var i=t.target,a=(0,e.closest)(i,".e-gantt-parent-taskbar"),r=this.getRecordByTarget(t),n=(0,e.closest)(i,"tr"),s=(0,e.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)}},t.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)},t.prototype.collapseGanttRow=function(t){var i=this;this.parent.trigger("collapsing",t,function(t){i.isExpandCollapseFromChart&&!(0,e.getValue)("cancel",t)&&i.collapsedGanttRow(t),i.isExpandCollapseFromChart=!1})},t.prototype.collapsedGanttRow=function(t){var i,a=this;if(i=this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?this.parent.currentViewData.filter(function(e){return e.ganttProperties[a.parent.taskFields.id]===t.data[a.parent.taskFields.id]})[0]:(0,e.getValue)("data",t),(0,e.isNullOrUndefined)(t.gridRow)&&this.parent.enableVirtualization||(0,e.isNullOrUndefined)(t.chartRow))i&&(i.expanded=!1);else{if(this.isExpandCollapseFromChart){this.expandCollapseChartRows("collapse",(0,e.getValue)("chartRow",t),i,null);var r=this.parent.taskFields.id;if(this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping){var n=this.parent.treeGrid.getCurrentViewRecords().filter(function(e){return e[r]===t.data[r]})[0];this.parent.treeGrid.collapseRow((0,e.getValue)("gridRow",t),n)}else this.parent.treeGrid.collapseRow((0,e.getValue)("gridRow",t),i);this.isExpandCollapseFromChart=!1}else this.expandCollapseChartRows("collapse",(0,e.getValue)("chartRow",t),i,null);"ResourceView"!==this.parent.viewType&&"ProjectView"!==this.parent.viewType||this.renderMultiTaskbar(i),this.parent.enableVirtualization||this.parent.updateContentHeight(),this.updateWidthAndHeight(),this.reRenderConnectorLines(),(0,e.getValue)("chartRow",t).setAttribute("aria-expanded","false")}},t.prototype.expandGanttRow=function(t){var i=this;this.parent.trigger("expanding",t,function(t){i.isExpandCollapseFromChart&&!(0,e.getValue)("cancel",t)&&i.expandedGanttRow(t),i.isExpandCollapseFromChart=!1})},t.prototype.expandedGanttRow=function(t){var i,a=this;if(i=this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?this.parent.currentViewData.filter(function(e){return e.ganttProperties.taskId===t.data[a.parent.taskFields.id]})[0]:(0,e.getValue)("data",t),(0,e.isNullOrUndefined)(t.gridRow)&&this.parent.enableVirtualization||(0,e.isNullOrUndefined)(t.chartRow))i&&(i.expanded=!0);else{if(this.isExpandCollapseFromChart){this.expandCollapseChartRows("expand",(0,e.getValue)("chartRow",t),i,null);var r=this.parent.taskFields.id;if(this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping){var n=this.parent.treeGrid.getCurrentViewRecords().filter(function(e){return e[r]===t.data[r]})[0];this.parent.treeGrid.expandRow((0,e.getValue)("gridRow",t),n)}else this.parent.treeGrid.expandRow((0,e.getValue)("gridRow",t),i);this.isExpandCollapseFromChart=!1}else this.parent.isExpandCollapseLevelMethod||this.expandCollapseChartRows("expand",(0,e.getValue)("chartRow",t),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(),(0,e.getValue)("chartRow",t).setAttribute("aria-expanded","true")}},t.prototype.renderMultiTaskbar=function(e){this.parent.enableMultiTaskbar?this.parent.chartRowsModule.refreshRecords([e],!0):this.parent.showOverAllocation&&this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData)},t.prototype.expandCollapseChartRows=function(t,i,a,r){var n;if("expand"===t){n="table-row",r||(a.expanded=!0);for(var s=i.querySelectorAll(".e-row-collapse"),o=0;o<s.length;o++)(0,e.addClass)([s[o]],"e-row-expand"),(0,e.removeClass)([s[o]],"e-row-collapse")}else if("collapse"===t){n="none",r||(a.expanded=!1);for(s=i.querySelectorAll(".e-row-expand"),o=0;o<s.length;o++)(0,e.addClass)([s[o]],"e-row-collapse"),(0,e.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"===t||l[p].expanded||this.isExpandAll)&&this.expandCollapseChartRows(t,h[p],l[p],!0)}},t.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},t.prototype.expandAtLevel=function(e){this.parent.treeGrid.expandAtLevel(e)},t.prototype.collapseAtLevel=function(e){this.parent.enableVirtualization&&(this.parent.isExpandCollapseLevelMethod=!0),this.parent.treeGrid.collapseAtLevel(e)},t.prototype.wireEvents=function(){var t,i=this,a=e.Browser.isPointer,r=e.Browser.touchStartEvent,n=e.Browser.touchEndEvent,s=e.Browser.touchMoveEvent,o=a?"pointerleave":"mouseleave";(e.EventHandler.add(this.parent.chartPane,r,this.ganttChartMouseDown,this),e.EventHandler.add(this.parent.chartPane,o,this.ganttChartLeave,this),e.EventHandler.add(this.parent.chartPane,s,this.ganttChartMove,this),e.EventHandler.add(this.parent.chartPane,"wheel",this.onWheelZoom,this),this.parent.isAdaptive)&&(e.EventHandler.add(this.parent.chartRowsModule.ganttChartTableBody,"pointerdown",function(e){t?(clearTimeout(t),t=null,i.doubleClickHandler(e)):t=setTimeout(function(){t=null},200)},this),e.EventHandler.add(this.parent.chartPane,Ze.click,this.ganttChartMouseClick,this),e.EventHandler.add(this.parent.chartPane,n,this.ganttChartMouseUp,this));this.parent.isAdaptive||(e.EventHandler.add(this.parent.chartRowsModule.ganttChartTableBody,"dblclick",this.doubleClickHandler,this),e.EventHandler.add(this.parent.element,n,this.documentMouseUp,this),e.EventHandler.add(document,n,this.mouseUp,this)),e.EventHandler.add(this.parent.element,"mousemove",this.mouseMoveHandler,this),e.EventHandler.add(document.body,"contextmenu",this.contextClick,this),e.EventHandler.add(document,"mouseup",this.contextClick,this)},t.prototype.unWireEvents=function(){var t=e.Browser.isPointer,i=e.Browser.touchStartEvent,a=e.Browser.touchEndEvent,r=e.Browser.touchMoveEvent,n=t?"pointerleave":"mouseleave";(0,e.isNullOrUndefined)(this.parent.chartRowsModule.ganttChartTableBody)||e.EventHandler.remove(this.parent.chartRowsModule.ganttChartTableBody,i,this.ganttChartMouseDown),(0,e.isNullOrUndefined)(this.parent.chartPane)||(e.EventHandler.remove(this.parent.chartPane,n,this.ganttChartLeave),e.EventHandler.remove(this.parent.chartPane,r,this.ganttChartMove),e.EventHandler.remove(this.parent.chartPane,"wheel",this.onWheelZoom),e.EventHandler.remove(this.parent.chartPane,i,this.ganttChartMouseDown)),this.parent.isAdaptive&&((0,e.isNullOrUndefined)(this.parent.chartPane)||(e.EventHandler.remove(this.parent.chartPane,Ze.click,this.ganttChartMouseClick),e.EventHandler.remove(this.parent.chartPane,a,this.ganttChartMouseUp))),this.parent.isAdaptive||((0,e.isNullOrUndefined)(this.parent.element)||e.EventHandler.remove(this.parent.element,a,this.documentMouseUp),(0,e.isNullOrUndefined)(document)||e.EventHandler.remove(document,a,this.mouseUp)),(0,e.isNullOrUndefined)(this.parent.element)||e.EventHandler.remove(this.parent.element,"mousemove",this.mouseMoveHandler),(0,e.isNullOrUndefined)(document)||(e.EventHandler.remove(document,"mouseup",this.contextClick),(0,e.isNullOrUndefined)(document.body)||e.EventHandler.remove(document.body,"contextmenu",this.contextClick)),(0,e.isNullOrUndefined)(this.parent.chartRowsModule.ganttChartTableBody)||e.EventHandler.remove(this.parent.chartRowsModule.ganttChartTableBody,"dblclick",this.doubleClickHandler)},t.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)}},t.prototype.getRecordByTaskBar=function(e){return this.parent.flatData[this.getIndexByTaskBar(e)]},t.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},t.prototype.onTabAction=function(t){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?t.target.closest(".e-rowcell"):t.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"===t.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"===t.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(var l=document.getElementsByClassName("e-toolbar-item").length-1;l>0;l--)if(!document.getElementsByClassName("e-toolbar-item")[l].classList.contains("e-hidden")){s=document.getElementsByClassName("e-toolbar-item")[l],this.currentToolbarIndex=l;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"===t.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 d=-1!==this.currentToolbarIndex?"tab"===t.action?this.currentToolbarIndex+1:this.currentToolbarIndex-1:"shiftTab"===t.action?i.length-1:1,h=!1;if(-1!==d&&("shiftTab"===t.action||"tab"===t.action&&d<i.length))do{i[d].classList.contains("e-hidden")?"tab"===t.action?d++:d--:((s=i[d]).setAttribute("tabindex","-1"),s.querySelector(".e-btn")===r&&("tab"===t.action?d++:d--,s=i[d]),s.querySelector(".e-btn")&&s.querySelector(".e-btn").setAttribute("tabindex","0"),h=!0,this.currentToolbarIndex=d)}while(!h)}if("tab"===t.action&&!s&&this.currentToolbarIndex===i.length-1&&(r.classList.contains("e-toolbar-item")||r.classList.contains("e-input")||r.classList.contains("e-btn")))for(l=0;l<this.parent.treeGrid.columns.length;l++)if(this.parent.treeGrid.columns[l].visible){s=document.getElementsByClassName("e-columnheader")[0].childNodes[l];break}if("shiftTab"!==t.action||s||r.classList.contains("e-headercell")||(s=document.getElementsByClassName("e-timeline-header-container")[0]),"shiftTab"===t.action&&r.classList.contains("e-timeline-header-container"))for(l=this.parent.treeGrid.columns.length;l>0;l--)if(this.parent.treeGrid.columns[l-1].visible){s=document.getElementsByClassName("e-columnheader")[0].childNodes[l-1];break}if(this.tempNextElement=s,(0,e.isNullOrUndefined)(s)||(0,e.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){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"))&&t.preventDefault(),n&&r.classList.contains("e-rowdragdrop"))return void this.parent.treeGrid.grid.notify("key-pressed",t);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",t)):u===this.parent.taskFields.name||u===this.parent.taskFields.startDate?this.parent.treeGrid.grid.notify("key-pressed",t):(this.parent.treeGrid.grid.notify("key-pressed",t),a&&this.parent.treeGrid.editCell(this.focusedRowIndex,u)):this.parent.treeGrid.grid.notify("key-pressed",t)}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);var c=s;if(!(f=this.parent.currentViewData[r.parentElement.rowIndex]).hasChildRecords||this.parent.ganttColumns[parseInt(c.getAttribute("aria-colindex"),10)-1].field!==this.parent.taskFields.progress&&this.parent.ganttColumns[parseInt(c.getAttribute("aria-colindex"),10)-1].allowEditing||this.parent.ganttColumns[parseInt(c.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",t);else{var g=void 0;for(c=this.updateElement(c,g,n,a,f);!this.parent.ganttColumns[parseInt(c.getAttribute("aria-colindex"),10)-1].allowEditing;)c=this.getNextElement(c,n,a);c=this.updateElement(c,g,n,a,f)}}}else if(s&&!s.classList.contains("e-headercell")&&s.classList.contains("e-rowcell")&&!s.classList.contains("e-toolbar-item")){var f;c=s;if(!(f=this.parent.currentViewData[r.parentElement.rowIndex]).hasChildRecords||this.parent.ganttColumns[parseInt(c.getAttribute("aria-colindex"),10)-1].field!==this.parent.taskFields.progress&&this.parent.ganttColumns[parseInt(c.getAttribute("aria-colindex"),10)-1].allowEditing||this.parent.ganttColumns[parseInt(c.getAttribute("aria-colindex"),10)-1].field===this.parent.taskFields.id||!r.classList.contains("e-editedbatchcell"))if(parseInt(c.parentElement.getAttribute("aria-rowindex"),10)-1!=0&&parseInt(c.getAttribute("aria-colindex"),10)-1==0&&this.parent.ganttColumns[parseInt(c.getAttribute("aria-colindex"),10)-1].field===this.parent.taskFields.id&&r.classList.contains("e-editedbatchcell")){var m=r.parentElement.rowIndex,y=this.getNextRowElement(m,n,!0);if(c=this.getChildElement(y,n),!(p=this.parent.flatData[parseInt(y.getAttribute("aria-rowindex"),10)-1]).hasChildRecords||this.parent.ganttColumns[parseInt(c.getAttribute("aria-colindex"),10)-1].allowEditing&&this.parent.ganttColumns[parseInt(c.getAttribute("aria-colindex"),10)-1].field!==this.parent.taskFields.progress)this.parent.treeGrid.grid.notify("key-pressed",t);else{g=void 0;for(c=this.updateElement(c,g,n,a,p);!this.parent.ganttColumns[parseInt(c.getAttribute("aria-colindex"),10)-1].allowEditing;)c=this.getNextElement(c,n,a);c=this.updateElement(c,g,n,a,p)}}else this.parent.treeGrid.grid.notify("key-pressed",t);else{var g=void 0;for(c=this.updateElement(c,g,n,a,f);!this.parent.ganttColumns[parseInt(c.getAttribute("aria-colindex"),10)-1].allowEditing;)c=this.getNextElement(c,n,a);c=this.updateElement(c,g,n,a,f)}}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||(0,e.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",t);var D=(0,e.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){m=this.parent.enableVirtualization?this.parent.currentViewData[s.parentElement.rowIndex].index:s.parentElement.rowIndex;if(this.parent.selectionModule.selectRow(m),"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&&(0,e.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")&&t.preventDefault()):this.manageFocus(s,"add",!0);this.parent.focusModule.setActiveElement(s)}}}else this.manageFocus(r,"remove",!0)}},t.prototype.getNextElement=function(t,i,a){if(t.classList.contains("e-timeline-header-container")&&i){var r=this.getNextRowElement(-1,i,!0);return this.getChildElement(r,i)}var n=i?t.nextElementSibling:t.previousElementSibling;if(t.parentElement.classList.contains("e-taskbar-main-container")){if(this.parent.labelSettings.rightLabel&&i)return t.parentElement.nextElementSibling;if(!i&&this.parent.labelSettings.leftLabel)return t.parentElement.previousElementSibling}for(;n&&n.parentElement.classList.contains("e-row");){if(!n.matches(".e-hide")&&!n.matches(".e-rowdragdrop"))return n;n=i?n.nextElementSibling:n.previousElementSibling}if(!(0,e.isNullOrUndefined)(n)&&(n.classList.contains("e-taskbar-main-container")||n.classList.contains("e-right-connectorpoint-outer-div"))){var s=this.parent.currentViewData[this.focusedRowIndex];!(0,e.isNullOrUndefined)(s.ganttProperties.segments)&&s.ganttProperties.segments.length>0&&(n=n.classList.contains("e-right-connectorpoint-outer-div")?n.parentElement.nextElementSibling:n.getElementsByClassName("e-gantt-child-taskbar-inner-div")[0])}if(this.validateNextElement(n))return n;var o=-1;r=null;if(t.classList.contains("e-rowcell")&&a&&this.parent.editSettings.allowNextRowEdit)return o=t.parentElement.rowIndex,r=this.getNextRowElement(o,i,!0),this.getChildElement(r,i);if(t.classList.contains("e-rowcell"))if(o=t.parentElement.rowIndex,i){if(r=this.parent.getRowByIndex(o),this.parent.treeGrid.element.getElementsByClassName("e-editedbatchcell").length>0)return r=this.getNextRowElement(o,i,!0),this.getChildElement(r,i);if(this.validateNextElement(r,"e-left-label-container"))return r.getElementsByClassName("e-left-label-container")[0];if(this.validateNextElement(r,"e-taskbar-main-container"))return r.getElementsByClassName("e-taskbar-main-container")[0];if(this.validateNextElement(r,"e-right-label-container"))return r.getElementsByClassName("e-right-label-container")[0]}else{if(r=this.getNextRowElement(o,i,!1),this.validateNextElement(r,"e-right-label-container"))return r.getElementsByClassName("e-right-label-container")[0];if(this.validateNextElement(r,"e-taskbar-main-container"))return r.getElementsByClassName("e-taskbar-main-container")[0];if(this.validateNextElement(r,"e-left-label-container"))return r.getElementsByClassName("e-left-label-container")[0]}else if(t.parentElement.classList.contains("e-chart-row-cell")||t.parentElement.parentElement.classList.contains("e-chart-row-cell")){if(o=(0,e.closest)(t,".e-chart-row").rowIndex,i){if(!i&&this.parent.virtualScrollModule&&this.parent.enableVirtualization){var l=this.parent.currentViewData[o];o=this.parent.flatData.indexOf(l)}r=this.getNextRowElement(o,i,!0)}else r=this.parent.treeGrid.getRows()[o];return this.getChildElement(r,i)}return n=t,null},t.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},t.prototype.validateNextElement=function(t,i){if(t&&t.classList.contains("e-rowcell"))return!0;if(t&&i){var a=t.getElementsByClassName(i)[0];return!(!a||!a.hasChildNodes())}return!!t&&!((0,e.isNullOrUndefined)(t)||!t.hasChildNodes())},t.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},t.prototype.manageFocus=function(t,i,a,r){if(a){var n=null;if(t.classList.contains("e-left-label-container")||t.classList.contains("e-right-label-container"))n=t.getElementsByTagName("span")[0];else if(t.classList.contains("e-taskbar-main-container")||t.classList.contains("e-gantt-child-taskbar-inner-div")){var s=(0,e.closest)(t,".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":!(0,e.isNullOrUndefined)(o.ganttProperties.segments)&&o.ganttProperties.segments.length>0?"e-segmented-taskbar":"e-gantt-child-taskbar";n=t.getElementsByClassName(l)[0],(0,e.isNullOrUndefined)(n)&&(n=t)}(t.classList.contains("e-right-label-temp-container")||t.classList.contains("e-left-label-temp-container")||t.classList.contains("e-indicator-span")||t.classList.contains("e-timeline-header-container"))&&("add"===i?(t.setAttribute("tabIndex","0"),(0,e.addClass)([t],"e-active-container"),t.focus()):"downArrow"!==r&&"upArrow"!==r&&((0,e.removeClass)([t],"e-active-container"),t.setAttribute("tabIndex","-1"),t.blur())),"add"!==i||(0,e.isNullOrUndefined)(n)?(0,e.isNullOrUndefined)(n)||"downArrow"===r||"upArrow"===r||((0,e.removeClass)([n],"e-active-container"),t.setAttribute("tabIndex","-1"),t.blur()):(t.setAttribute("tabIndex","0"),(0,e.addClass)([n],"e-active-container"),t.focus(),this.focusedElement=n)}else"add"===i?(t.setAttribute("tabIndex","0"),(0,e.addClass)([t],["e-focused","e-focus"]),this.preventScrollIntoView||t.scrollIntoView({block:"nearest",inline:"nearest"}),this.preventScrollIntoView=!1,t.focus()):(t.setAttribute("tabIndex","-1"),(0,e.removeClass)([t],["e-focused","e-focus"]),t.blur())},t.prototype.getIndexByTaskBar=function(t){var i,a;if(i=t.classList.contains(A)?t:(0,e.closest)(t,"div."+A),(0,e.isNullOrUndefined)(i))i=(0,e.closest)(t,"tr."+Y),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},t.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,(0,e.isNullOrUndefined)(this.scrollObject)||(this.scrollObject.destroy(),this.scrollObject=null)},t}(),Ke=function(){return Ke=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Ke.apply(this,arguments)},Qe=function(){function t(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 t.prototype.initProperties=function(){this.timelineStartDate=null,this.timelineEndDate=null,this.totalTimelineWidth=0,this.customTimelineSettings=null,this.parent.isTimelineRoundOff=!this.isZoomToFit&&!!(0,e.isNullOrUndefined)(this.parent.projectStartDate),this.parent.enablePersistence&&this.parent.isLoad&&(this.parent.timelineSettings=this.parent.currentZoomingLevel)},t.prototype.validateTimelineProp=function(){this.roundOffDays(),this.processTimelineProperty(),this.timelineWidthCalculation()},t.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)"},t.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()},t.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",{})},t.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},t.prototype.updateUndoRedo=function(t){var i=t?"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:(0,e.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}},t.prototype.getZoomLevel=function(e,t){var i=e+(t?1:-1);return this.parent.zoomingLevels.find(function(e){return e.level===i})?i:e},t.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))},t.prototype.changeTimelineSettings=function(t){var i=this;this.isZoomToFit?this.isSingleTier="None"===this.customTimelineSettings.topTier.unit||"None"===this.customTimelineSettings.bottomTier.unit:this.isZoomIn||(this.isSingleTier="None"===t.topTier.unit||"None"===t.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 t[r]||(0,e.isNullOrUndefined)(t[r])?t[r]:Ke({},t[r]);else{var n="topTier"===r?"bottomTier":"topTier",s="bottomTier";"None"!==t[""+s].unit&&(i.customTimelineSettings[n]=Ke({},t[s]))}}),this.parent.isTimelineRoundOff=!this.isZoomToFit&&!!(0,e.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",(0,e.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",(0,e.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())},t.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 t,i={};this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.isUndoRedoItemPresent("ZoomToFit")&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),i.action="ZoomToFit",i.previousTimelineStartDate=(0,e.extend)([],[],[this.parent.cloneProjectStartDate],!0)[0],i.previousTimelineEndDate=(0,e.extend)([],[],[this.parent.cloneProjectEndDate],!0)[0],i.previousZoomingLevel=(0,e.extend)({},{},this.parent.currentZoomingLevel,!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=i),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)),(0,e.isNullOrUndefined)(this.parent.projectStartDate)&&(0,e.isNullOrUndefined)(this.parent.projectEndDate)&&this.parent.dataOperation.calculateProjectDates();var a=0;this.parent.timelineSettings.showWeekend||(a=this.calculateNonWorkingDaysBetweenDates(this.parent.cloneProjectStartDate,this.parent.cloneProjectEndDate)),t=(this.parent.cloneProjectEndDate.getTime()-this.parent.cloneProjectStartDate.getTime())/864e5,t-=a;var r,n,s,o=this.parent.ganttChartModule.chartElement.offsetWidth,l=o/t,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=(0,e.extend)({},{},r,!0);(0,e.isNullOrUndefined)(this.parent.projectStartDate)&&this.roundOffDateToZoom(this.parent.cloneProjectStartDate,!0,l,p.bottomTier.unit,r),(0,e.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=!!(0,e.isNullOrUndefined)(this.parent.projectStartDate)),this.isZoomToFit=!1}},t.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},t.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)},t.prototype.calculateNumberOfTimelineCells=function(e){var t,i=new Date(this.parent.cloneProjectStartDate.getTime()),a=new Date(this.parent.cloneProjectEndDate.getTime());this.parent.dateValidationModule.updateDateWithTimeZone(i,a);var r=0;this.parent.timelineSettings.showWeekend||(r=this.calculateNonWorkingDaysBetweenDates(this.parent.cloneProjectStartDate,this.parent.cloneProjectEndDate)),t=Math.abs((a.getTime()-i.getTime())/864e5),t-=r;var n=e.bottomTier.count,s=e.bottomTier.unit;return"Day"===s?t/n:"Week"===s?t/n/7:"Month"===s?t/n/28:"Year"===s?t/n/336:"Hour"===s?t*(24/n):t*(1440/n)},t.prototype.processTimelineUnit=function(){var e=["Year","Month","Week","Day","Hour","Minutes"];this.customTimelineSettings=this.customTimelineSettings?this.customTimelineSettings:this.extendFunction(this.parent.timelineSettings,["timelineViewMode","timelineUnitSize","weekStartDay","weekendBackground"],{topTier:["unit","format","count","formatter"],bottomTier:["unit","format","count","formatter"]}),-1===e.indexOf(this.customTimelineSettings.topTier.unit)&&-1===e.indexOf(this.customTimelineSettings.bottomTier.unit)?(this.customTimelineSettings.topTier.unit=-1!==e.indexOf(this.customTimelineSettings.timelineViewMode)?this.customTimelineSettings.timelineViewMode:"Week",this.customTimelineSettings.bottomTier.unit=5!==e.indexOf(this.customTimelineSettings.topTier.unit)?e[e.indexOf(this.customTimelineSettings.topTier.unit)+1]:"None"):-1!==e.indexOf(this.customTimelineSettings.topTier.unit)&&-1!==e.indexOf(this.customTimelineSettings.bottomTier.unit)&&e.indexOf(this.customTimelineSettings.topTier.unit)>e.indexOf(this.customTimelineSettings.bottomTier.unit)?this.customTimelineSettings.bottomTier.unit=this.customTimelineSettings.topTier.unit:(this.customTimelineSettings.topTier.unit=-1===e.indexOf(this.customTimelineSettings.topTier.unit)?"None":this.customTimelineSettings.topTier.unit,this.customTimelineSettings.bottomTier.unit=-1===e.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},t.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()},t.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}},t.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},t.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},t.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},t.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},t.prototype.updateTimelineHeaderHeight=function(){if(this.parent.timelineModule.isSingleTier?this.parent.element.classList.add(R):this.parent.element.classList.remove(R),this.previousIsSingleTier!==this.isSingleTier){var t=0;(0,e.isNullOrUndefined)(this.parent.toolbarModule)||(0,e.isNullOrUndefined)(this.parent.toolbarModule.element)||(t=this.parent.toolbarModule.element.offsetHeight),this.parent.ganttChartModule.scrollObject.setHeight(this.parent.ganttHeight-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight-t),this.parent.treeGrid.height=this.parent.ganttHeight-t-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight}},t.prototype.dateByLeftValue=function(t,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()+t*n):r=this.calculateDateExcludingNonWorkingDays(t,r),i&&!(0,e.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},t.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},t.prototype.createTimelineSeries=function(){var t,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(var h=0;h<l;h++){(r=(0,e.createElement)("table",{className:F,styles:"display: block;"})).setAttribute("role","none"),n=(0,e.createElement)("thead",{className:U,styles:"display:block; border-collapse:collapse"});var p=this.createTimelineTemplate(d);t=(0,e.createElement)("tr"),Array.from(p.childNodes).forEach(function(e){t.appendChild(e)}),i=(0,e.createElement)("td"),a=(0,e.createElement)("div",{styles:"width: 20px"}),s=(0,e.createElement)("div",{className:"e-virtualtable"}),o=(0,e.createElement)("div",{className:"e-virtualtrack"}),i.appendChild(a),t.appendChild(i),s.appendChild(t),n.appendChild(s),n.appendChild(o),r.appendChild(n),this.parent.ganttChartModule.chartTimelineContainer.appendChild(r),d="bottomTier",t=null,this.restrictRender=!1}this.timelineVirtualizationStyles()}else{for(h=0;h<l;h++){(r=(0,e.createElement)("table",{className:F,styles:"display: block;"})).setAttribute("role","none"),n=(0,e.createElement)("thead",{className:U,styles:"display:block; border-collapse:collapse"});p=this.createTimelineTemplate(d);t=(0,e.createElement)("tr"),Array.from(p.childNodes).forEach(function(e){t.appendChild(e)}),i=(0,e.createElement)("td"),a=(0,e.createElement)("div",{styles:"width: 20px"}),i.appendChild(a),t.appendChild(i),n.appendChild(t),r.appendChild(n),this.parent.ganttChartModule.chartTimelineContainer.appendChild(r),d="bottomTier",t=null}this.wholeTimelineWidth=this.totalTimelineWidth}},t.prototype.timelineVirtualizationStyles=function(){var t=0,i=this.wholeTimelineWidth;if(this.parent.enableTimelineVirtualization){t=this.parent.enableTimelineVirtualization&&!(0,e.isNullOrUndefined)(this.parent.ganttChartModule.scrollObject.element.scrollLeft)&&0!==this.parent.ganttChartModule.scrollObject.element.scrollLeft?this.parent.ganttChartModule.scrollObject.getTimelineLeft():0,this.parent.enableRtl&&(t=-t);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("+t+"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;(0,e.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("+t+"px, 0px)",(0,e.isNullOrUndefined)(s)||(s.style.transform="translate("+t+"px, 0px)")}var o=this.parent.element.querySelectorAll(".e-timeline-header-table-container")[0].querySelector(".e-virtualtrack"),l=void 0;(0,e.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")),(0,e.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).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())}},t.prototype.validateCount=function(t,i,a){var r,n=!(0,e.isNullOrUndefined)(i)&&parseInt(i.toString(),10)>0?parseInt(i.toString(),10):1,s=Math.abs(this.timelineRoundOffEndDate.getTime()-this.timelineStartDate.getTime());switch(t){case"Year":n=n<=(r=Math.round(s/864e5/336))?n:r>0?r:1,"None"!==this.topTier&&"bottomTier"===a&&(n=this.validateBottomTierCount(t,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(t,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(t,n));break;case"Day":n=n<=(r=Math.round(s/864e5))?n:r>0?r:1,"None"!==this.topTier&&"bottomTier"===a&&(n=this.validateBottomTierCount(t,n));break;case"Hour":n=n<=(r=Math.round(s/36e5))?n:r>0?r:1,"None"!==this.topTier&&"bottomTier"===a&&(n=this.validateBottomTierCount(t,n));break;case"Minutes":n=n<=(r=Math.round(s/6e4))?n:r>0?r:1,"None"!==this.topTier&&"bottomTier"===a&&(n=this.validateBottomTierCount(t,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},t.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},t.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},t.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},t.prototype.formatDateHeader=function(e,t,i){var a,r=new Date(t.getTime());""===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));return a},t.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},t.prototype.calculateIteration=function(e,t,i,a){var r;if(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()),"Hour"===i){var n=t.getHours();r=Math.ceil((24-n)/a)}else if("Minutes"===i){n=t.getHours();var s=t.getMinutes();r=Math.ceil((1440-(60*n+s))/a)}return this.increaseIteration&&(r+=1,this.increaseIteration=!1),{iterations:r,dummystartDate:e}},t.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(" ")}},t.prototype.customFormat=function(t,i,a,r,n){return(n="string"==typeof n?(0,e.getValue)(n,window):n)(t,i,a,r)},t.prototype.createTimelineTemplate=function(t){var i,a,r,n=!1,s=this.parent,o=(0,e.createElement)("th"),l="topTier"===t?s.timelineModule.customTimelineSettings.topTier.unit:s.timelineModule.customTimelineSettings.bottomTier.unit,d="topTier"===t?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&&!(0,e.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,t,c)){var w={};w.startDate=new Date(c.getTime());var T={};if("Month"!==l&&"Hour"!==l||"bottomTier"!==t||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,t,!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,t,!0,d,w),b=!0),o.appendChild(i);var I="topTier"===t?this.topTierCollection:this.bottomTierCollection;if(w.endDate=new Date(c.getTime()),this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.enableTimelineVirtualization?"topTier"===t?this.pdfExportTopTierCollection.push(w):this.pdfExportBottomTierCollection.push(w):I.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,t,!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 E=0,F=new Date(c);E<d;)F.setHours(0,0,0,0),F.setDate(F.getDate()+1),-1===this.parent.nonWorkingDayIndex.indexOf(F.getDay())&&E++;r=F.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,t,!0,d,w)),o.appendChild(i);I="topTier"===t?this.topTierCollection:this.bottomTierCollection;w.endDate=new Date(c.getTime()),this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.enableTimelineVirtualization?"topTier"===t?this.pdfExportTopTierCollection.push(w):this.pdfExportBottomTierCollection.push(w):I.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},t.prototype.isNonWorkingDayHeader=function(e,t,i){return("Day"===e||"Hour"===e||"Minutes"===e)&&-1!==this.parent.nonWorkingDayIndex.indexOf(i.getDay())},t.prototype.updateTimelineAfterZooming=function(t,i){var a,r,n,s,o=document.getElementsByClassName("e-chart-scroll-container e-content")[0];if(!(0,e.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()-t.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),s>=(n=l<d?r*a+17:r*a)){var h=s-n;if(this.parent.timelineSettings.showWeekend)h=Math.round(h/r),t.setDate(t.getDate()+h);else{for(var p=864e5,u=p/r,c=Math.floor(s*u/p),g=7-this.parent.nonWorkingDayIndex.length,f=c%g,m=7*Math.floor(c/g)+f,y=t.getDay();f>0;)y=(y+1)%7,-1===this.parent.nonWorkingDayIndex.indexOf(y)&&f--,m++;t.setDate(t.getDate()+m)}this.parent.timelineModule.timelineEndDate=t,i&&this.parent.updateProjectDates(this.timelineStartDate,this.timelineEndDate,this.parent.isTimelineRoundOff)}}},t.prototype.getTimelineRoundOffEndDate=function(t){var i="None"===this.topTier?this.bottomTier:this.topTier,a=new Date(t.toString());return this.parent.isTimelineRoundOff&&("Hour"===i?a.setMinutes(60):"Minutes"===i?a.setSeconds(60):a.setHours(24,0,0,0)),(0,e.isNullOrUndefined)(this.parent.projectEndDate)&&this.updateTimelineAfterZooming(a,!1),a},t.prototype.getIncrement=function(e,t,i,a,r){var n,s=new Date(e.getTime()),o=new Date(e.getTime()),d=!1,h=new Date(s);switch(i){case"Year":s=e,o=new Date(e.getFullYear()+(t-1),11,31);var p=l(e),u=this.resetToNextYear(e,t)-p;n=this.adjustForDST(s,o,u,o.getTime()-s.getTime()+864e5,r,!0);break;case"Month":s=e,o=new Date(e.getFullYear(),e.getMonth()+t,1);p=l(e);var c=this.resetToNextMonth(e,t)-p;n=this.adjustForDST(s,o,c,o.getTime()-s.getTime(),r,!0);break;case"Week":var g=this.parent.timelineModule.customTimelineSettings.weekStartDay,f=e.getDay()<g?g-e.getDay():6-e.getDay()+g;t=f>0?t-1:0,o.setHours(24,0,0,0),f=e.getDay()<g&&f>0?f-1:f,o.setDate(o.getDate()+(f+7*t));var m=this.resetToNextDay(e)+24*(f+7*t)*60*60*1e3-(p=l(e));n=this.adjustForDST(s,o,m,o.getTime()-s.getTime(),r,!0);break;case"Day":o.setHours(24,0,0,0);var y=this.resetToNextDay(s)+24*(t-1)*60*60*1e3-(p=l(s));n=o.getTime()-s.getTime()+864e5*(t-1),(k=new Date(s)).setTime(k.getTime()+n),n=this.adjustForDST(s,k,y,k.getTime()-s.getTime(),r,!0);break;case"Hour":o.setMinutes(60),o.setSeconds(0);var D=this.resetToNextHour(s)+60*(t-1)*60*1e3-(p=l(s));n=o.getTime()-s.getTime()+36e5*(t-1),(k=new Date(s)).setTime(k.getTime()+n),a&&12===t&&0!==s.getHours()&&k.setHours(0,0,0,0);var v=new Date(s);v.setHours(v.getHours()-t),-30===s.getTimezoneOffset()-v.getTimezoneOffset()&&(k.setMinutes(k.getMinutes()+30),this.inconsistenceDstApplied=!0),k.getHours()<h.getHours()+t&&(d=!0),n=this.adjustForDST(s,k,D,k.getTime()-s.getTime(),r,d);break;case"Minutes":o.setSeconds(60);var k,b=this.resetToNextMinute(s)+60*(t-1)*1e3-(p=l(s));n=o.getTime()-s.getTime()+6e4*(t-1),(k=new Date(s)).setTime(k.getTime()+n),k.getMinutes()<=h.getMinutes()&&(d=!0),n=this.adjustForDST(s,k,b,k.getTime()-s.getTime(),r,d)}return n},t.prototype.resetToNextYear=function(e,t){var i=e.getFullYear()+t;return Date.UTC(i,0,1,0,0,0,0)},t.prototype.resetToNextMonth=function(e,t){var i=e.getFullYear(),a=e.getMonth();return Date.UTC(i,a+t,1,0,0,0,0)},t.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)},t.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)},t.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)},t.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)},t.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()))},t.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)},t.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},t.prototype.getHeaterTemplateString=function(t,i,a,r,n,s,o,l){var d,h=null;(0,e.isNullOrUndefined)(this.parent.timelineTemplate)||(h=this.parent.chartRowsModule.templateCompiler(this.parent.timelineTemplate));var p,u="topTier"===a?this.parent.timelineModule.customTimelineSettings.topTier.format:this.parent.timelineModule.customTimelineSettings.bottomTier.format,c="topTier"===a?this.parent.timelineModule.customTimelineSettings.topTier.formatter:this.parent.timelineModule.customTimelineSettings.bottomTier.formatter,g=this.getIncrement(t,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 f=new Date(t),m=new Date(t),y=new Date(m.getTime()+g);y.setHours(0,0,0,0),g-=24*this.calculateNonWorkingDaysBetweenDates(f,y)*60*60*1e3}var D=p=Math.abs(g/864e5*this.parent.perDayWidth);p=r?this.calculateWidthBetweenTwoDate(i,t,this.timelineRoundOffEndDate,s,r):o&&"Hour"!==i?this.calculateWidthBetweenTwoDate(i,t,this.calculateQuarterEndDate(t,n)):p,this.isFirstLoop&&this.parent.isInDst(t)&&1===t.getHours()&&this.isDateAffectedByDST(t)&&(p+=this.parent.perDayWidth/24),this.isFirstLoop=!1;var v=this.isWeekendHeaderCell(i,a,t),k="topTier"===a?" e-gantt-top-cell-text":"";o&&20===t.getHours()&&12===n&&"bottomTier"===a&&"Hour"===this.parent.timelineModule.customTimelineSettings.bottomTier.unit&&t.setTime(t.getTime()-72e6);var b=new Date(t);if(this.parent.timelineSettings.showWeekend)b=new Date(t);else if(this.isWeekend(b))for(;-1!==this.parent.nonWorkingDayIndex.indexOf(b.getDay());)b.setDate(b.getDate()+1);var w,T=(0,e.isNullOrUndefined)(c)?this.parent.globalize.formatDate(b,{format:this.parent.getDateFormat()}):this.customFormat(b,u,a,i,c);if(w=this.applyDstHour?(0,e.isNullOrUndefined)(c)?this.formatDateHeader(u,b,l):this.customFormat(b,u,a,i,c):(0,e.isNullOrUndefined)(c)?this.formatDateHeader(u,b):this.customFormat(b,u,a,i,c),!(0,e.isNullOrUndefined)(h)){var S={date:T,tier:a,value:w},P=(d=h((0,e.extend)({},S),this.parent,"TimelineTemplate",this.parent.chartRowsModule.getTemplateID("TimelineTemplate"),!1,void 0,null,this.parent.root))[0];P instanceof HTMLElement&&(P.setAttribute("data-tier",a),P.setAttribute("date",T),P.setAttribute("value",w))}var C=this.parent.timelineModule.isSingleTier?"e-timeline-single-header-cell":"e-timeline-top-header-cell",R=v?" e-weekend-header-cell":"",M=(0,e.createElement)("th",{className:""+C+R,styles:"width:"+p+"px;"+(v&&this.customTimelineSettings.weekendBackground?"background-color:"+this.customTimelineSettings.weekendBackground+";":"")});M.tabIndex=-1,M.setAttribute("aria-label",this.parent.localeObj.getConstant("timelineCell")+" "+T);var x=(0,e.createElement)("div",{className:"e-header-cell-label"+k,styles:"width:"+(p-1)+"px;"});return x.title=this.parent.timelineSettings.showTooltip?T:"",x.textContent=w,x.setAttribute("data-tier",a),this.parent.isReact&&!(0,e.isNullOrUndefined)(d)&&d.length>0&&(d[0].style.width="100%",d[0].style.height="100%"),!(0,e.isNullOrUndefined)(h)&&!(0,e.isNullOrUndefined)(d)&&d.length>0?(0,e.append)(d,M):M.append(x),M.outerHTML,!this.isSingleTier&&"topTier"!==a||r?(this.isSingleTier||"topTier"===a)&&r&&(this.totalTimelineWidth=this.totalTimelineWidth-D+p):this.totalTimelineWidth=this.totalTimelineWidth+p,s.value=w,s.isWeekend=v,s.width=p,M},t.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},t.prototype.isWeekend=function(e){var t=e.getDay();return-1!==this.parent.nonWorkingDayIndex.indexOf(t)},t.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},t.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},t.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},t.prototype.roundOffDays=function(){var t=this.parent.cloneProjectStartDate,i=this.parent.cloneProjectEndDate,a="None"===this.topTier?this.bottomTier:this.topTier;if(this.parent.isTimelineRoundOff){if("Year"===a)t=new Date(t.getFullYear(),0,1),i=new Date(i.getFullYear(),11,31);else if("Month"===a)t=new Date(t.getFullYear(),t.getMonth(),1),i=new Date(i.getFullYear(),i.getMonth()+1,0);else if("Week"===a){var r=(0,e.isNullOrUndefined)(this.customTimelineSettings.weekStartDay)?0:this.parent.timelineModule.customTimelineSettings.weekStartDay,n=t.getDay()<r?t.getDate()-(7-r+t.getDay()):t.getDate()-t.getDay()+r;if(!this.parent.timelineSettings.showWeekend)for(;this.isWeekend(new Date(t.getFullYear(),t.getMonth(),n));)n++;t.setDate(n);var s=i.getDate()-i.getDay()+6+r;i.setDate(s)}"Hour"===a?t.setMinutes(0):"Minutes"===a?t.setSeconds(0):t.setHours(0,0,0,0)}this.timelineStartDate=t,this.timelineEndDate=i,this.timelineRoundOffEndDate=this.getTimelineRoundOffEndDate(this.timelineEndDate)},t.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},t.prototype.updateTimeLineOnEditing=function(t,a){if(t[0].length>=1)for(var r=0;r<t.length;r++){var n=t[parseInt(r.toString(),10)],s=n.filter(function(t){return!(0,e.isNullOrUndefined)(t.ganttProperties.startDate)}),o=n.filter(function(t){return!(0,e.isNullOrUndefined)(t.ganttProperties.endDate)}),l=s.length>0?new Date(i.DataUtil.aggregates.min(s,"ganttProperties.startDate")):null,d=s.length>0?new Date(i.DataUtil.aggregates.min(o,"ganttProperties.endDate")):null,h=o.length>0?new Date(i.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=(0,e.isNullOrUndefined)(l)?null:this.parent.dataOperation.getTaskLeft(l,!1),g=(0,e.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(i.DataUtil.aggregates.min(s,"ganttProperties.startDate")).setHours(0,0,0,0):null,k=new Date(this.timelineStartDate.getTime()).setHours(0,0,0,0);!(0,e.isNullOrUndefined)(c)&&!(0,e.isNullOrUndefined)(D)&&(D.taskBarEditAction&&"RightResizing"!==D.taskBarEditAction||(0,e.isNullOrUndefined)(D.taskBarEditAction))&&v<=k&&(c<this.bottomTierCellWidth||c<=f)?(y="prevTimeSpan",l=l>this.timelineStartDate?this.timelineStartDate:l):l=this.timelineStartDate,!(0,e.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,a,l,h):(0,e.isNullOrUndefined)(n[0].ganttProperties.segments)||this.parent.dataOperation.updateWidthLeft(n[0]),!(0,e.isNullOrUndefined)(l)&&!(0,e.isNullOrUndefined)(d)&&d<=l&&("CellEditing"===a||"DialogEditing"===a)&&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",a,l,h)):(0,e.isNullOrUndefined)(d)&&d<=l&&("CellEditing"===a||"DialogEditing"===a)&&this.parent.allowUnscheduledTasks&&1===t[0].length&&!(0,e.isNullOrUndefined)(t[0][0].ganttProperties.endDate)&&(0,e.isNullOrUndefined)(n[0].ganttProperties.startDate)&&n[0].ganttProperties.endDate<=this.timelineStartDate&&(l=new Date(Math.min(t[0][0].ganttProperties.endDate.getTime(),l.getTime())),this.performTimeSpanAction("prevTimeSpan",a,l,h));break}},t.prototype.performTimeSpanAction=function(t,i,a,r,n){n=(0,e.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"===t?(this.updateScheduleDatesByToolBar(n,"prevTimeSpan",a,r),this.updateScheduleDatesByToolBar(n,"nextTimeSpan",new Date(this.parent.cloneProjectStartDate.getTime()),r)):this.updateScheduleDatesByToolBar(n,t,a,r);var l=this.timeSpanActionEvent("actionBegin",t,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"===t&&"publicMethod"===i)this.parent.ganttChartModule.updateScrollLeft(0),this.parent.timelineModule.isZoomToFit=!1;else if("nextTimeSpan"===t&&"publicMethod"===i)this.parent.ganttChartModule.updateScrollLeft(this.parent.enableTimelineVirtualization?this.wholeTimelineWidth:this.totalTimelineWidth),this.parent.timelineModule.isZoomToFit=!1;else if("nextTimeSpan"===t&&"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",t,i)}},t.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},t}(),$e=m(465),Je=function(t){this.allowEditing=!0,this.allowReordering=!0,this.allowResizing=!0,this.allowSorting=!0,this.allowFiltering=!0,this.edit={},(0,e.merge)(this,t)},et=m(778),tt=function(){function t(t){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(t){i.parent.notify("columnMenuOpen",t),i.parent.trigger("columnMenuOpen",t),document.querySelector(".e-colmenu").addEventListener("mousemove",function(){var t=document.querySelector(".e-filter-popup"),a=document.querySelector(".e-filter-item");(0,e.isNullOrUndefined)(t)||a.classList.contains("e-focused")||(0,e.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=t,this.parent.treeGrid=new $e.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=(0,e.extend)([],[],this.parent.columns,!0)),this.validateGanttColumns(),this.parent.isLocaleChanged&&(this.parent.isLocaleChanged=!1),this.addEventListener()}return t.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)},t.prototype.renderReactTemplate=function(e){for(var t="portals",i=0,a=e;i<a.length;i++){var r=a[i];-1===this.parent[t].indexOf(r)&&this.parent[t].push(r)}this.parent.renderTemplates()},t.prototype.createContainer=function(){this.treeGridElement=(0,e.createElement)("div",{id:"treeGrid"+this.parent.element.id,className:"e-gantt-tree-grid"});var t=(0,e.createElement)("div",{className:"e-gantt-temp-header"});this.parent.treeGridPane.appendChild(this.treeGridElement),this.treeGridElement.appendChild(t),this.parent.treeGridPane.classList.add("e-temp-content")},t.prototype.renderTreeGrid=function(){this.composeProperties(),this.bindEvents();var t="root";this.parent.treeGrid[t]=this.parent[t]?this.parent[t]:this.parent,(0,e.setValue)("registeredTemplate",this.registeredTemplate,this.parent.treeGrid);(0,e.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()},t.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=(0,e.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&&n(this.parent)){this.parent.treeGrid.hasChildMapping="isParent";var t=(0,e.getValue)("count",this.parent.dataSource);this.parent.treeGrid.dataSource={result:this.parent.flatData,count:t}}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)},t.prototype.getContentDiv=function(){return this.treeGridElement.querySelector(".e-content")},t.prototype.getHeaderDiv=function(){return this.treeGridElement.querySelector(".e-headercontent")},t.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},t.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);")},t.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))},t.prototype.beforeDataBound=function(t){var i={result:t.result};this.parent.trigger("beforeDataBound",i),!(0,e.isNullOrUndefined)(this.parent.selectionModule)&&this.parent.selectionSettings&&this.parent.selectionSettings.persistSelection&&this.parent.selectionModule.getSelectedRowIndexes().length>0&&"sorting"===t.actionArgs.requestType&&(this.isPersist=!0),this.parent.updatedRecords=this.parent.virtualScrollModule&&this.parent.enableVirtualization?(0,e.getValue)("virtualScrollModule.visualData",this.parent.treeGrid):(0,e.getValue)("result",t);var a=t.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(t),(0,e.setValue)("contentModule.objectEqualityChecker",this.objectEqualityChecker,this.parent.treeGrid.grid),this.parent.isExpandPerformed=!1},t.prototype.dataBound=function(t){this.parent.isReact&&this.parent.clearTemplate(["TaskbarTemplate","ParentTaskbarTemplate","MilestoneTemplate","TaskLabelTemplate","RightLabelTemplate","LeftLabelTemplate"]),this.ensureScrollBar(),this.parent.treeDataBound(t),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,(0,e.isNullOrUndefined)(this.parent.selectionModule)||(0,e.isNullOrUndefined)(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()),this.prevCurrentView=(0,e.extend)([],[],this.parent.currentViewData,!0)},t.prototype.dataStateChange=function(t){t.action&&"refresh"===t.action.requestType&&(this.parent.treeGrid.dataSource={result:(0,e.getValue)("result",this.parent.treeGrid.dataSource),count:(0,e.getValue)("count",this.parent.treeGrid.dataSource)}),this.parent.trigger("dataStateChange",t)},t.prototype.collapsing=function(t){var i,a=(0,e.getValue)("data",t),r=a.length;if(!this.parent.ganttChartModule.isExpandCollapseFromChart)if((0,e.isNullOrUndefined)(r))i=this.createExpandCollapseArgs(t,null),this.parent.ganttChartModule.collapseGanttRow(i),(0,e.setValue)("cancel",(0,e.getValue)("cancel",i),t);else{for(var n=0;n<r;n++)i=this.createExpandCollapseArgs(t,a[n]),this.parent.ganttChartModule.collapseGanttRow(i);(0,e.setValue)("cancel",(0,e.getValue)("cancel",i),t)}},t.prototype.expanding=function(t){var i,a=(0,e.getValue)("data",t),r=a.length;if(!this.parent.ganttChartModule.isExpandCollapseFromChart)if((0,e.isNullOrUndefined)(r))i=this.createExpandCollapseArgs(t,null),this.parent.ganttChartModule.expandGanttRow(i),(0,e.setValue)("cancel",(0,e.getValue)("cancel",i),t);else{for(var n=0;n<r;n++)i=this.createExpandCollapseArgs(t,a[n]),this.parent.ganttChartModule.expandGanttRow(i);(0,e.setValue)("cancel",(0,e.getValue)("cancel",i),t)}},t.prototype.collapsed=function(t){var i=t.data,a=i&&i.expanded;if(this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping&&!this.parent.enableVirtualization&&!a&&(t.data[this.parent.taskFields.expandState]=!1),!this.parent.ganttChartModule.isExpandCollapseFromChart&&!this.parent.isExpandCollapseLevelMethod){var r=void 0,n=(0,e.getValue)("data",t),s=n.length;if((0,e.isNullOrUndefined)(s))r=this.createExpandCollapseArgs(t,null),this.parent.ganttChartModule.collapsedGanttRow(r);else for(var o=0;o<s;o++)r=this.createExpandCollapseArgs(t,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",t)},t.prototype.expanded=function(t){if(!this.parent.ganttChartModule.isExpandCollapseFromChart&&!this.parent.isExpandCollapseLevelMethod){var i=void 0,a=(0,e.getValue)("data",t),r=a.length;if((0,e.isNullOrUndefined)(r))i=this.createExpandCollapseArgs(t,null),this.parent.ganttChartModule.expandedGanttRow(i);else for(var n=0;n<r;n++)i=this.createExpandCollapseArgs(t,a[n]),this.parent.ganttChartModule.expandedGanttRow(i);this.parent.ganttChartModule.isExpandAll||!t.row||this.parent.allowTaskbarOverlap||(t.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",t),this.parent.isExpandPerformed=!0},t.prototype.actionBegin=function(t){if(!this.parent.undoRedoModule||"filtering"!==t.requestType&&"searching"!==t.requestType&&"sorting"!==t.requestType&&"filterAfterOpen"!==t.requestType||(this.parent.undoRedoModule.canUpdateIndex=!1),"filterchoicerequest"===t.requestType){var i=(0,e.getValue)("filterModel.dlg",t);i&&(i.style.display="none")}t&&"save"===t.type&&t.rowData&&t.rowData.ganttProperties&&(this.perviousStartDate=t.rowData.ganttProperties.startDate,this.perviousEndDate=t.rowData.ganttProperties.endDate),this.parent.notify("actionBegin",t),null!==(0,e.getValue)("doubleClickTarget",this.parent.treeGrid.editModule)&&(0,e.setValue)("doubleClickTarget",null,this.parent.treeGrid.editModule),this.parent.trigger("actionBegin",t),this.parent.trigger("cellSave",t),"virtualscroll"===t.requestType||"edit"===t.type||"beginEdit"===t.requestType||t.cancel||this.parent.showLoadingIndicator()},t.prototype.created=function(e){this.updateKeyConfigSettings()},t.prototype.actionFailure=function(e){this.parent.trigger("actionFailure",e)},t.prototype.createExpandCollapseArgs=function(t,i){var a=(0,e.getValue)("data",t).length;if((0,e.isNullOrUndefined)(a)){var r=(0,e.getValue)("data",t);return{data:r,gridRow:(0,e.getValue)("row",t),chartRow:this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(r)],cancel:!1}}return{data:i,gridRow:(0,e.getValue)("row",t),chartRow:this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(i)],cancel:!1}},t.prototype.treeActionComplete=function(t){var i,a=this,r=null,n=!1,s=(0,e.extend)({},t);"reorder"===(0,e.getValue)("requestType",t)&&(this.parent.undoRedoModule&&!this.parent.undoRedoModule.isFromUndoRedo&&this.parent.isUndoRedoItemPresent("ColumnReorder")&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),(h={action:"ColumnReorder"}).fromIndex=(0,e.extend)([],[],[t.fromIndex],!0)[0],h.toIndex=(0,e.extend)([],[],[t.toIndex],!0)[0],h.toColumn=(0,e.extend)([],[],[this.parent.treeGrid.columns[t.toIndex].field],!0)[0],h.fromColumn=(0,e.extend)([],[],[this.parent.treeGrid.columns[t.fromIndex].field],!0)[0],this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=h));"columnstate"===(0,e.getValue)("requestType",t)&&(this.parent.undoRedoModule&&!this.parent.undoRedoModule.isFromUndoRedo&&this.parent.isUndoRedoItemPresent("ColumnState")&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),(h={action:"ColumnState"}).showhideColumns=(0,e.extend)([],[],t.columns,!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=h));if("sorting"===(0,e.getValue)("requestType",t)){if(this.parent.undoRedoModule&&this.parent.isUndoRedoItemPresent("Sorting")){if(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(),(h={action:"Sorting",sortColumns:[]}).sortColumns=this.parent.undoRedoModule.previousSortedColumns,this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=h;this.parent.undoRedoModule.previousSortedColumns=this.parent.treeGrid.sortSettings.columns}this.parent.notify("updateModel",{}),(0,e.deleteObject)(s,"isFrozen")}else if("filtering"===(0,e.getValue)("requestType",t)){if(this.parent.undoRedoModule&&!this.parent.undoRedoModule.isFromUndoRedo&&this.parent.isUndoRedoItemPresent("Filtering"))this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),(h={action:"Filtering"}).filteredColumns=(0,e.extend)([],[],t.columns,!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=h;this.parent.notify("updateModel",{})}else if("save"===(0,e.getValue)("type",t)&&((r=(0,e.isNullOrUndefined)(t.column)?null:t.column.field)&&t.previousData===t.data[r]&&(n=!0),this.parent.editModule&&this.parent.editModule.cellEditModule)){var l=(0,e.getValue)("data",t);if((0,e.isNullOrUndefined)(l)||(0,e.isNullOrUndefined)(this.parent.getTaskByUniqueID(l.uniqueID))||(this.parent.getTaskByUniqueID(l.uniqueID).taskData[this.parent.taskFields.duration]=l.taskData[this.parent.taskFields.duration],(0,e.isNullOrUndefined)(l.taskData[this.parent.taskFields.resourceInfo])||(this.parent.getTaskByUniqueID(l.uniqueID).taskData[this.parent.taskFields.resourceInfo]=l.taskData[this.parent.taskFields.resourceInfo])),o(this.currentEditRow)&&t.column&&t.column.edit&&t.column.field===this.parent.taskFields.resourceInfo){var d=this.parent.taskFields.resourceInfo;this.currentEditRow=((i={})[d]=l.resources,i)}this.parent.editModule.cellEditModule.initiateCellEdit(t,this.currentEditRow),this.parent.editModule.cellEditModule.isCellEdit=!1,this.currentEditRow={}}if("filterAfterOpen"===(0,e.getValue)("requestType",t)&&this.parent.notify("actionComplete",t),"searching"===(0,e.getValue)("requestType",t)){if(this.parent.undoRedoModule&&this.parent.isUndoRedoItemPresent("Search")){var h;if(!this.parent.undoRedoModule.isFromUndoRedo)this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),(h={action:"Search"}).searchString=this.parent.undoRedoModule.searchString,this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=h;this.parent.undoRedoModule.searchString=this.parent.treeGrid.searchSettings.key}this.parent.notify("actionComplete",t)}if((0,e.isNullOrUndefined)(this.parent.toolbarModule)||(0,e.isNullOrUndefined)((0,e.getValue)("batchChanges",t))||this.parent.toolbarModule.refreshToolbarItems(),this.parent.isCancelled&&((0,e.setValue)("requestType","cancel",s),(0,e.setValue)("action","CellEditing",s),this.parent.isCancelled=!1),"refresh"===(0,e.getValue)("requestType",t)&&(0,e.isNullOrUndefined)((0,e.getValue)("type",t))&&this.parent.addDeleteRecord){if(-1!==this.parent.selectedRowIndex)if(this.parent.editModule.isAdded&&!(0,e.isNullOrUndefined)(this.parent.selectionModule)&&this.parent.selectionSettings&&this.parent.selectionSettings.persistSelection){var p=this.parent.selectionModule.selectedRowIndexes;if(p.length>1&&this.parent.selectionSettings.persistSelection)for(var u=0;u<p.length;u++){var c=this.parent.flatData[p[u].toString()];this.parent.selectRows(c)}}else this.parent.selectRow(this.parent.selectedRowIndex),this.parent.selectedRowIndex>this.parent.currentViewData.length-1&&(this.parent.selectedRowIndex=-1);else{if(!(0,e.isNullOrUndefined)(this.parent.selectionModule)&&this.parent.selectionSettings&&this.parent.selectionSettings.persistSelection&&this.parent.editModule&&!this.parent.editModule.isAdded){var g=this.parent.selectionModule.getSelectedRecords(),f=function(e){var t=g[e][m.parent.taskFields.id];m.parent.editModule.deletedRecord.some(function(e){return e.ganttProperties.taskId===t})&&g.splice(e,1)},m=this;for(u=g.length-1;u>=0;u--)f(u)}var y=0;(this.parent.enableVirtualization?this.parent.flatData:this.parent.currentViewData).map(function(t,i){(0,e.isNullOrUndefined)(a.parent.currentSelection)||t.ganttProperties.taskId!==a.parent.currentSelection[a.parent.taskFields.id]||("ResourceView"!==a.parent.viewType||t.ganttProperties.rowUniqueID!==a.parent.currentSelection.rowUniqueID)&&"ResourceView"===a.parent.viewType||(y=i)}),this.addedRecord=!0,this.parent.selectRow((0,e.isNullOrUndefined)(y)?0:y)}this.parent.isExpandPerformed||(this.parent.addDeleteRecord=!1),this.parent.isExpandPerformed=!1}if(this.parent.undoRedoModule&&(this.parent.undoRedoModule.isFromUndoRedo=!1),"refresh"===(0,e.getValue)("requestType",t)&&this.parent.initiateEditAction(!1),n||this.setCancelArgs||this.parent.trigger("actionComplete",s),this.parent.showOverAllocation&&!this.parent.allowTaskbarOverlap){for(u=0;u<this.parent.currentViewData.length;u++)this.parent.currentViewData[u].hasChildRecords&&!this.parent.currentViewData[u].expanded&&this.parent.chartRowsModule.updateDragDropRecords(this.parent.currentViewData[u]);this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData)}"save"!==t.type&&this.parent.hideLoadingIndicator()},t.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},t.prototype.wireEvents=function(){var t=this.parent.treeGrid.element.querySelector(".e-content");t&&e.EventHandler.add(t,"scroll",this.scrollHandler,this),this.parent.isAdaptive&&e.EventHandler.add(this.parent.treeGridPane,"click",this.treeGridClickHandler,this)},t.prototype.unWireEvents=function(){var t=this.parent.treeGrid.element&&this.parent.treeGrid.element.querySelector(".e-content");t&&e.EventHandler.remove(t,"scroll",this.scrollHandler),this.parent.isAdaptive&&e.EventHandler.remove(this.parent.treeGridPane,"click",this.treeGridClickHandler)},t.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()},t.prototype.validateGanttColumns=function(){var t=this.parent,i=t.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=function(i){var n={};"string"==typeof t.columns[i]?n.field=t.columns[i]:n=t.columns[i];var o=[];if(r.length>0&&(o=r.filter(function(e){return n.field===a[e]})),0===o.length)return n.field===s.parent.resourceFields.group||("WBSCode"!==n.field&&"WBSPredecessor"!==n.field&&s.parent.customColumns.push(n.field),n.headerText=n.headerText?n.headerText:n.field,n.width=n.width?n.width:150,"WBSCode"===n.field?n.allowEditing=!1:n.allowEditing=!!(0,e.isNullOrUndefined)(n.allowEditing)||n.allowEditing,"WBSCode"!==n.field&&"WBSPredecessor"!==n.field||(n.clipMode="EllipsisWithTooltip"),n.editType=n.editType?n.editType:"stringedit",n.type=n.type?n.type:"string","checkbox"===n.type&&(s.parent.selectionSettings.type="Multiple"),s.bindTreeGridColumnProperties(n,!0)),"continue";var l=r.indexOf(o[0]);r.splice(l,1),s.createTreeGridColumn(n,!0),s.parent.columnMapping[o[0]]=n.field},s=this,o=0;o<i;o++)n(o);for(var l=0;l<r.length;l++){var d={};(0,e.isNullOrUndefined)(a[r[l]])||(d.field=a[r[l]],this.createTreeGridColumn(d,0===i),this.parent.columnMapping[r[l]]=d.field)}if("ProjectView"!==this.parent.viewType){d={};this.composeUniqueIDColumn(d),this.createTreeGridColumn(d,!0)}},t.prototype.getLocalizedConstraintTypeText=function(e){return this.parent.localeObj.getConstant("constraintType"+e)},t.prototype.createTreeGridColumn=function(t,a){var r=this,n=this.parent.taskFields,s=this.parent.previousGanttColumns.filter(function(e){return t.field===e.field})[0];if(t.disableHtmlEncode=(0,e.isNullOrUndefined)(t.disableHtmlEncode)?this.parent.disableHtmlEncode:t.disableHtmlEncode,n.id!==t.field&&(t.clipMode=t.clipMode?t.clipMode:"EllipsisWithTooltip"),n.id===t.field)this.composeIDColumn(t);else if(n.name===t.field)this.parent.isLocaleChanged&&s?t.headerText=s.headerText?s.headerText:this.parent.localeObj.getConstant("name"):t.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("name"),t.width=t.width?t.width:150,t.editType=t.editType?t.editType:"stringedit",t.type=t.type?t.type:"string";else if(n.startDate===t.field)this.parent.isLocaleChanged&&s?t.headerText=s.headerText?s.headerText:this.parent.localeObj.getConstant("startDate"):t.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("startDate"),t.editType=t.editType?t.editType:-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit",t.format=t.format?t.format:{type:"date",format:this.parent.getDateFormat()},t.width=t.width?t.width:150,t.edit&&t.edit.params?t.edit.params.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent):t.edit?t.edit.params={renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}:t.edit={params:{renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}};else if(n.baselineStartDate===t.field||n.baselineEndDate===t.field){var o=n.baselineEndDate===t.field?"baselineEndDate":"baselineStartDate";t.width=t.width?t.width:150,this.parent.isLocaleChanged&&s?t.headerText=s.headerText?s.headerText:this.parent.localeObj.getConstant(o):t.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant(o),t.format=t.format?t.format:{type:"date",format:this.parent.getDateFormat()},t.editType=t.editType?t.editType:-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit"}else if(n.endDate===t.field)this.parent.isLocaleChanged&&s?t.headerText=s.headerText?s.headerText:this.parent.localeObj.getConstant("endDate"):t.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("endDate"),t.format=t.format?t.format:{type:"date",format:this.parent.getDateFormat()},t.editType=t.editType?t.editType:-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit",t.width=t.width?t.width:150,t.edit&&t.edit.params?t.edit.params.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent):t.edit?t.edit.params={renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}:t.edit={params:{renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}};else if(n.constraintDate===t.field)this.parent.isLocaleChanged&&s?t.headerText=s.headerText?s.headerText:this.parent.localeObj.getConstant("constraintDate"):t.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("constraintDate"),t.format=t.format?t.format:{type:"date",format:this.parent.getDateFormat()},t.editType=t.editType?t.editType:-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit",t.width=t.width?t.width:150,t.edit&&t.edit.params?t.edit.params.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent):t.edit?t.edit.params={renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}:t.edit={params:{renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}};else if(n.duration===t.field)t.width=t.width?t.width:150,this.parent.isLocaleChanged&&s?t.headerText=s.headerText?s.headerText:this.parent.localeObj.getConstant("duration"):t.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("duration"),t.valueAccessor=t.valueAccessor?t.valueAccessor:(0,e.isNullOrUndefined)(t.edit)||(0,e.isNullOrUndefined)(t.edit.read)?this.durationValueAccessor.bind(this):null,t.editType=t.editType?t.editType:"stringedit",t.type=t.type?t.type:"string";else if(n.progress===t.field)this.composeProgressColumn(t);else if(n.dependency===t.field)this.parent.isLocaleChanged&&s?t.headerText=s.headerText?s.headerText:this.parent.localeObj.getConstant("dependency"):t.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("dependency"),t.width=t.width?t.width:150,t.editType=t.editType?t.editType:"stringedit",t.type="string",t.allowFiltering=!1!==t.allowFiltering,t.valueAccessor=t.valueAccessor?t.valueAccessor:this.dependencyValueAccessor.bind(this),(0,e.isNullOrUndefined)(t.filter)&&"en-US"!==this.parent.locale&&(t.filter={ui:{create:function(t){var i=(0,e.createElement)("input",{className:"flm-input"});t.target.appendChild(i),r.dropInstance=new et.AutoComplete({dataSource:r.changeLocale(r.parent.treeGrid.grid.dataSource),fields:{text:r.parent.taskFields.dependency,value:r.parent.taskFields.dependency},placeholder:r.parent.localeObj.getConstant("enterValue"),popupHeight:"200px"}),r.dropInstance.appendTo(i)},write:function(e){r.dropInstance.value=e.filteredValue},read:function(e){e.fltrObj.filterByColumn(e.column.field,e.operator,r.changeDelocale(r.dropInstance.value))}}});else if(n.resourceInfo===t.field)this.composeResourceColumn(t);else if(n.notes===t.field){if(s&&this.parent.isLocaleChanged?t.headerText=s.headerText?s.headerText:this.parent.localeObj.getConstant("notes"):t.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("notes"),t.width=t.width?t.width:150,t.editType=t.editType?t.editType:"stringedit",!this.parent.showInlineNotes&&!t.template){t.template=(0,e.initializeCSPTemplate)(function(){return'<div class="e-ganttnotes-info">\n                            <span class="e-icons e-notes-info"></span>\n                        </div>'})}}else if(n.baselineDuration===t.field)t.width=t.width?t.width:150,this.parent.isLocaleChanged&&s?t.headerText=s.headerText?s.headerText:this.parent.localeObj.getConstant("baselineDuration"):t.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("baselineDuration"),t.valueAccessor=t.valueAccessor?t.valueAccessor:(0,e.isNullOrUndefined)(t.edit)||(0,e.isNullOrUndefined)(t.edit.read)?this.baselineDurationValueAccessor.bind(this):null,t.editType=t.editType?t.editType:"stringedit",t.type=t.type?t.type:"string";else if(n.work===t.field)s&&this.parent.isLocaleChanged?t.headerText=s.headerText?s.headerText:this.parent.localeObj.getConstant("work"):t.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("work"),t.width=t.width?t.width:150,t.valueAccessor=t.valueAccessor?t.valueAccessor:this.workValueAccessor.bind(this),t.editType=t.editType?t.editType:"numericedit";else if(n.type===t.field)s&&this.parent.isLocaleChanged?t.headerText=s.headerText?s.headerText:this.parent.localeObj.getConstant("taskType"):t.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("taskType"),t.width=t.width?t.width:150,t.editType="dropdownedit",t.valueAccessor=t.valueAccessor?t.valueAccessor:this.taskTypeValueAccessor.bind(this);else if(n.manual===t.field&&"Custom"===this.parent.taskMode)s&&this.parent.isLocaleChanged?t.headerText=s.headerText?s.headerText:this.parent.localeObj.getConstant("taskMode"):t.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("taskMode"),t.width=t.width?t.width:120,t.editType=t.editType?t.editType:"dropdownedit",t.valueAccessor=t.valueAccessor?t.valueAccessor:this.modeValueAccessor.bind(this),t.edit={params:{query:new i.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(n.constraintType===t.field){s&&this.parent.isLocaleChanged?t.headerText=s.headerText?s.headerText:this.parent.localeObj.getConstant("constraintType"):t.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("constraintType"),t.width=t.width?t.width:160,t.editType=t.editType?t.editType:"dropdownedit";var l=Object.keys(D).filter(function(e){return!isNaN(Number(D[e]))}).map(function(e){return{text:r.getLocalizedConstraintTypeText(e),value:D[e]}});t.valueAccessor=t.valueAccessor?t.valueAccessor:this.constraintTypeValueAccessor.bind(this),t.edit={params:{dataSource:l,fields:{text:"text",value:"value"},query:new i.Query}}}this.bindTreeGridColumnProperties(t,a)},t.prototype.changeLocale=function(t){var i=this,a=[];return t.map(function(e){return e.ganttProperties.predecessorsName}).map(function(t){if(!(0,e.isNullOrUndefined)(t)){var r="",n=t.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},t.prototype.changeDelocale=function(t){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(!(0,e.isNullOrUndefined)(t)){var s=t.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},t.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},t.prototype.getResourceIds=function(t){var i=(0,e.getValue)(this.parent.taskFields.resourceInfo,t.taskData),a=[];if((0,e.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},t.prototype.composeIDColumn=function(t){var i,a="ProjectView"===this.parent.viewType,r=this.parent.dataSource?this.parent.dataSource.length:0;if(t.isPrimaryKey=!!a,this.parent.isLocaleChanged){var n=this.parent.previousGanttColumns.filter(function(e){return t.field===e.field})[0];n&&(t.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("id"))}else t.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("id");t.width=t.width?t.width:100;for(var s=0;s<r;s++)if(!(0,e.isNullOrUndefined)(this.parent.dataSource[s][this.parent.taskFields.id])){i=this.parent.dataSource[s][this.parent.taskFields.id];break}"string"==typeof i||(0,e.isNullOrUndefined)(i)?("ResourceView"===this.parent.viewType?t.allowEditing=!!t.allowEditing&&t.allowEditing:t.allowEditing=!t.allowEditing||t.allowEditing,t.editType=t.editType?t.editType:"stringedit"):(t.allowEditing=!!t.allowEditing&&t.allowEditing,t.editType=t.editType?t.editType:"numericedit"),t.valueAccessor=a?null:this.idValueAccessor.bind(this)},t.prototype.composeUniqueIDColumn=function(e){e.field="rowUniqueID",e.isPrimaryKey=!0,e.headerText="UniqueID",e.allowEditing=!1,e.visible=!1},t.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"},t.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 Je(a)),t&&this.treeGridColumns.push(i)},t.prototype.durationValueAccessor=function(t,i,a){if(!(0,e.isNullOrUndefined)(i)&&!(0,e.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):""},t.prototype.dependencyValueAccessor=function(t,i,a){var r=this;if(i&&i.ganttProperties&&!(0,e.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""},t.prototype.resourceValueAccessor=function(t,i,a){var r=i.ganttProperties;return(0,e.isNullOrUndefined)(r)?"":r.resourceNames},t.prototype.workValueAccessor=function(t,i,a){var r=i.ganttProperties;return(0,e.isNullOrUndefined)(r)?"":this.parent.dataOperation.getWorkString(r.work,r.workUnit)},t.prototype.taskTypeValueAccessor=function(t,i,a){var r=i.ganttProperties;return(0,e.isNullOrUndefined)(r)?"":r.taskType},t.prototype.modeValueAccessor=function(e,t,i){return t[e]?"Manual":"Auto"},t.prototype.constraintTypeValueAccessor=function(e,t,i){var a=Object.keys(D).find(function(i){return D[i]===t[e]});return this.getLocalizedConstraintTypeText(a)},t.prototype.baselineDurationValueAccessor=function(t,i,a){if(!(0,e.isNullOrUndefined)(i)&&!(0,e.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):""},t.prototype.idValueAccessor=function(e,t,i){return 0===t.level?"R-"+t.ganttProperties.taskId:"T-"+t.ganttProperties.taskId},t.prototype.updateScrollTop=function(t){var i=(0,e.getValue)("top",t);this.treeGridElement.querySelector(".e-content").scrollTop=i,this.previousScroll.top=this.treeGridElement.querySelector(".e-content").scrollTop},t.prototype.treeGridClickHandler=function(e){this.parent.notify("treeGridClick",e)},t.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)},t.prototype.destroy=function(){this.removeEventListener(),this.unWireEvents(),this.parent.treeGrid.element&&this.parent.treeGrid.destroy()},t}(),it=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])},e(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)}}(),at=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},rt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return it(i,t),at([(0,e.Property)(null)],i.prototype,"from",void 0),at([(0,e.Property)(null)],i.prototype,"to",void 0),i}(e.ChildProperty),nt=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])},e(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)}}(),st=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},ot=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return nt(i,t),st([(0,e.Property)(null)],i.prototype,"type",void 0),st([(0,e.Property)(null)],i.prototype,"headerText",void 0),st([(0,e.Property)([])],i.prototype,"fields",void 0),st([(0,e.Property)({})],i.prototype,"additionalParams",void 0),i}(e.ChildProperty),lt=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])},e(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)}}(),dt=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},ht=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return lt(i,t),dt([(0,e.Property)(null)],i.prototype,"type",void 0),dt([(0,e.Property)(null)],i.prototype,"headerText",void 0),dt([(0,e.Property)([])],i.prototype,"fields",void 0),dt([(0,e.Property)({})],i.prototype,"additionalParams",void 0),i}(e.ChildProperty),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])},e(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(t){function i(){return null!==t&&t.apply(this,arguments)||this}return pt(i,t),ut([(0,e.Property)(!1)],i.prototype,"allowEditing",void 0),ut([(0,e.Property)(!1)],i.prototype,"allowAdding",void 0),ut([(0,e.Property)(!1)],i.prototype,"allowDeleting",void 0),ut([(0,e.Property)("Auto")],i.prototype,"mode",void 0),ut([(0,e.Property)("Top")],i.prototype,"newRowPosition",void 0),ut([(0,e.Property)(!1)],i.prototype,"showDeleteConfirmDialog",void 0),ut([(0,e.Property)(!1)],i.prototype,"allowTaskbarEditing",void 0),ut([(0,e.Property)(!1)],i.prototype,"allowNextRowEdit",void 0),i}(e.ChildProperty),gt=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])},e(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)}}(),ft=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},mt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return gt(i,t),ft([(0,e.Property)(null)],i.prototype,"day",void 0),ft([(0,e.Property)(null)],i.prototype,"label",void 0),ft([(0,e.Property)(null)],i.prototype,"cssClass",void 0),i}(e.ChildProperty),yt=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])},e(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)}}(),Dt=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},vt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return yt(i,t),Dt([(0,e.Collection)([],Ze.Predicate)],i.prototype,"columns",void 0),Dt([(0,e.Property)("Menu")],i.prototype,"type",void 0),Dt([(0,e.Property)()],i.prototype,"operators",void 0),Dt([(0,e.Property)(!1)],i.prototype,"ignoreAccent",void 0),Dt([(0,e.Property)("Parent")],i.prototype,"hierarchyMode",void 0),i}(e.ChildProperty),kt=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])},e(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)}}(),bt=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},wt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return kt(i,t),bt([(0,e.Property)([])],i.prototype,"fields",void 0),bt([(0,e.Property)(!1)],i.prototype,"ignoreCase",void 0),bt([(0,e.Property)("contains")],i.prototype,"operator",void 0),bt([(0,e.Property)("")],i.prototype,"key",void 0),bt([(0,e.Property)("Parent")],i.prototype,"hierarchyMode",void 0),i}(e.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])},e(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)}}(),St=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},Pt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Tt(i,t),St([(0,e.Property)(null)],i.prototype,"from",void 0),St([(0,e.Property)(null)],i.prototype,"to",void 0),St([(0,e.Property)(null)],i.prototype,"label",void 0),St([(0,e.Property)(null)],i.prototype,"cssClass",void 0),i}(e.ChildProperty),Ct=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])},e(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)}}(),Rt=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},Mt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Ct(i,t),Rt([(0,e.Property)(null)],i.prototype,"rightLabel",void 0),Rt([(0,e.Property)(null)],i.prototype,"leftLabel",void 0),Rt([(0,e.Property)(null)],i.prototype,"taskLabel",void 0),i}(e.ChildProperty),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])},e(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)}}(),Ot=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},It=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return xt(i,t),Ot([(0,e.Property)("Row")],i.prototype,"mode",void 0),Ot([(0,e.Property)("Flow")],i.prototype,"cellSelectionMode",void 0),Ot([(0,e.Property)("Single")],i.prototype,"type",void 0),Ot([(0,e.Property)(!1)],i.prototype,"persistSelection",void 0),Ot([(0,e.Property)(!1)],i.prototype,"enableToggle",void 0),i}(e.ChildProperty),Et=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])},e(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)}}(),Ft=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},Ut=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Et(i,t),Ft([(0,e.Property)(null)],i.prototype,"position",void 0),Ft([(0,e.Property)(-1)],i.prototype,"columnIndex",void 0),Ft([(0,e.Property)(4)],i.prototype,"separatorSize",void 0),Ft([(0,e.Property)(null)],i.prototype,"minimum",void 0),Ft([(0,e.Property)("Default")],i.prototype,"view",void 0),i}(e.ChildProperty),Nt=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])},e(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)}}(),Lt=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},Vt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Nt(i,t),Lt([(0,e.Property)(null)],i.prototype,"id",void 0),Lt([(0,e.Property)(null)],i.prototype,"name",void 0),Lt([(0,e.Property)(null)],i.prototype,"parentID",void 0),Lt([(0,e.Property)(null)],i.prototype,"hasChildMapping",void 0),Lt([(0,e.Property)(null)],i.prototype,"startDate",void 0),Lt([(0,e.Property)(null)],i.prototype,"endDate",void 0),Lt([(0,e.Property)(null)],i.prototype,"dependency",void 0),Lt([(0,e.Property)(null)],i.prototype,"progress",void 0),Lt([(0,e.Property)(null)],i.prototype,"child",void 0),Lt([(0,e.Property)(null)],i.prototype,"milestone",void 0),Lt([(0,e.Property)(null)],i.prototype,"duration",void 0),Lt([(0,e.Property)(null)],i.prototype,"durationUnit",void 0),Lt([(0,e.Property)(null)],i.prototype,"cssClass",void 0),Lt([(0,e.Property)(null)],i.prototype,"baselineStartDate",void 0),Lt([(0,e.Property)(null)],i.prototype,"baselineEndDate",void 0),Lt([(0,e.Property)(null)],i.prototype,"baselineDuration",void 0),Lt([(0,e.Property)(null)],i.prototype,"resourceInfo",void 0),Lt([(0,e.Property)(null)],i.prototype,"expandState",void 0),Lt([(0,e.Property)(null)],i.prototype,"indicators",void 0),Lt([(0,e.Property)(null)],i.prototype,"notes",void 0),Lt([(0,e.Property)(null)],i.prototype,"work",void 0),Lt([(0,e.Property)(null)],i.prototype,"manual",void 0),Lt([(0,e.Property)(null)],i.prototype,"type",void 0),Lt([(0,e.Property)(null)],i.prototype,"segments",void 0),Lt([(0,e.Property)(null)],i.prototype,"segmentId",void 0),Lt([(0,e.Property)(null)],i.prototype,"constraintType",void 0),Lt([(0,e.Property)(null)],i.prototype,"constraintDate",void 0),i}(e.ChildProperty),Bt=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])},e(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)}}(),At=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},Wt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Bt(i,t),At([(0,e.Property)("")],i.prototype,"format",void 0),At([(0,e.Property)("None")],i.prototype,"unit",void 0),At([(0,e.Property)(1)],i.prototype,"count",void 0),At([(0,e.Property)(null)],i.prototype,"formatter",void 0),i}(e.ChildProperty),Ht=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Bt(i,t),At([(0,e.Property)("Week")],i.prototype,"timelineViewMode",void 0),At([(0,e.Complex)({},Wt)],i.prototype,"topTier",void 0),At([(0,e.Complex)({},Wt)],i.prototype,"bottomTier",void 0),At([(0,e.Property)(33)],i.prototype,"timelineUnitSize",void 0),At([(0,e.Property)(0)],i.prototype,"weekStartDay",void 0),At([(0,e.Property)(null)],i.prototype,"weekendBackground",void 0),At([(0,e.Property)(!0)],i.prototype,"showTooltip",void 0),At([(0,e.Property)(!0)],i.prototype,"updateTimescaleView",void 0),At([(0,e.Property)(!0)],i.prototype,"showWeekend",void 0),i}(e.ChildProperty),jt=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])},e(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)}}(),zt=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},qt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return jt(i,t),zt([(0,e.Property)(!0)],i.prototype,"showTooltip",void 0),zt([(0,e.Property)()],i.prototype,"taskbar",void 0),zt([(0,e.Property)()],i.prototype,"baseline",void 0),zt([(0,e.Property)()],i.prototype,"connectorLine",void 0),zt([(0,e.Property)()],i.prototype,"editing",void 0),zt([(0,e.Property)()],i.prototype,"timeline",void 0),i}(e.ChildProperty),Gt=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])},e(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)}}(),_t=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},Zt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Gt(i,t),_t([(0,e.Property)()],i.prototype,"field",void 0),_t([(0,e.Property)()],i.prototype,"direction",void 0),i}(e.ChildProperty),Xt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Gt(i,t),_t([(0,e.Collection)([],Zt)],i.prototype,"columns",void 0),_t([(0,e.Property)(!0)],i.prototype,"allowUnsort",void 0),i}(e.ChildProperty),Yt=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])},e(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)}}(),Kt=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},Qt=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return Yt(i,t),Kt([(0,e.Property)(null)],i.prototype,"id",void 0),Kt([(0,e.Property)(null)],i.prototype,"name",void 0),Kt([(0,e.Property)(null)],i.prototype,"unit",void 0),Kt([(0,e.Property)(null)],i.prototype,"group",void 0),i}(e.ChildProperty),$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])},e(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,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},ei=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return $t(i,t),Jt([(0,e.Property)("Spinner")],i.prototype,"indicatorType",void 0),i}(e.ChildProperty),ti=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])},e(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)}}(),ii=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},ai=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return ti(i,t),ii([(0,e.Property)()],i.prototype,"dayOfWeek",void 0),ii([(0,e.Collection)([],rt)],i.prototype,"timeRange",void 0),i}(e.ChildProperty),ri=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])},e(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)}}(),ni=function(t){function a(e){var i=t.call(this,e)||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=e,i.initPublicProp(),i.addEventListener(),i}return ri(a,t),a.prototype.initPublicProp=function(){this.ganttChartTableBody=null},a.prototype.addEventListener=function(){this.parent.on("renderPanels",this.createChartTable,this),this.parent.on("dataReady",this.initiateTemplates,this),this.parent.on("destroy",this.destroy,this)},a.prototype.refreshChartByTimeline=function(){this.taskTable.style.width=(0,e.formatUnit)(this.parent.enableTimelineVirtualization?this.parent.timelineModule.wholeTimelineWidth:this.parent.timelineModule.totalTimelineWidth);var t=(0,e.getValue)("prevProjectStartDate",this.parent.dataOperation),i=!1;t&&(i=t.getTime()===this.parent.cloneProjectStartDate.getTime()),this.isUpdated=!!(this.parent.isFromOnPropertyChange&&i&&(0,e.getValue)("mutableData",this.parent.treeGrid.grid.contentModule)),this.refreshGanttRows(),this.isUpdated=!0},a.prototype.createChartTable=function(){this.taskTable=(0,e.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 t=(0,e.createElement)("colgroup"),i=(0,e.createElement)("col",{styles:"width:"+this.parent.timelineModule.totalTimelineWidth+"px;"});t.appendChild(i),this.taskTable.appendChild(t),this.ganttChartTableBody=(0,e.createElement)("tbody",{id:this.parent.element.id+"GanttTaskTableBody"}),this.taskTable.appendChild(this.ganttChartTableBody),this.parent.ganttChartModule.chartBodyContent.appendChild(this.taskTable)},a.prototype.initiateTemplates=function(){this.taskTable.style.width=(0,e.formatUnit)(this.parent.enableTimelineVirtualization?this.parent.timelineModule.wholeTimelineWidth:this.parent.timelineModule.totalTimelineWidth),this.initChartHelperPrivateVariable(),this.initializeChartTemplate()},a.prototype.renderChartRows=function(){this.createTaskbarTemplate(),this.parent.isGanttChartRendered=!0},a.prototype.getIndicatorNode=function(e){var t='<label class="'+De+' 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)},a.prototype.getIndicatorleft=function(e){return e=this.parent.dateValidationModule.getDateFromFormat(e),this.parent.dataOperation.getTaskLeft(e,!1)},a.prototype.getChildTaskbarNode=function(t,i){var a,r=null,n=this.templateData;if(a=this.parent.enableRtl?"right:":"left:",this.childTaskbarTemplateFunction)r=this.childTaskbarTemplateFunction((0,e.extend)({index:t},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="'+H+" "+ne+" "+(n.ganttProperties.isAutoSchedule?"":he)+'"style="width:'+n.ganttProperties.width+"px;height:"+this.taskBarHeight+'px; margin-top :-1px"></div>'),d=this.createDivElement('<div class="'+j+" "+se+" "+(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=(0,e.createElement)("div");if(this.taskLabelTemplateFunction&&!(0,e.isNullOrUndefined)(d)&&d.length>0){var p=this.taskLabelTemplateFunction((0,e.extend)({index:t},n),this.parent,"TaskLabelTemplate",this.getTemplateID("TaskLabelTemplate"),!1,void 0,d[0]);p&&p.length>0&&((0,e.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=e.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=e.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="'+W+'" 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="'+W+'" 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=!(0,e.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="'+j+" "+ne+" e-gantt-unscheduled-taskbar "+(n.ganttProperties.isAutoSchedule?"":he)+'"style="'+a+n.ganttProperties.left+"px; width:"+n.ganttProperties.width+"px; height:"+this.taskBarHeight+'px;"></div>':'<div class="'+j+" "+ne+" "+we+" "+(n.ganttProperties.isAutoSchedule?"":he)+'"style="'+a+n.ganttProperties.left+"px; height:"+this.taskBarHeight+'px;"></div>':'<div class="'+j+" "+ne+" "+be+" "+(n.ganttProperties.isAutoSchedule?"":he)+'"style="'+a+n.ganttProperties.left+"px; height:"+this.taskBarHeight+'px;"></div>';if(n.ganttProperties.segments&&n.ganttProperties.segments.length>0)c+=this.getSplitProgressResizerNode();if(n.ganttProperties.startDate&&n.ganttProperties.endDate&&n.ganttProperties.duration&&((0,e.isNullOrUndefined)(n.ganttProperties.segments)||!(0,e.isNullOrUndefined)(n.ganttProperties.segments)&&0===n.ganttProperties.segments.length)){if(""!==c&&!(0,e.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)}!(0,e.isNullOrUndefined)(l)&&l.length>0&&l[0].appendChild([].slice.call(d)[0]),r=l}else r=this.createDivElement(c)}return this.parent.enableRtl&&!(0,e.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},a.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";var s=0===a?"e-segment-first":a===e.ganttProperties.segments.length-1?"e-segment-last":"e-segment-inprogress";i+='<div class="'+H+" "+s+" "+ne+'  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="'+j+" "+se+' " 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="'+W+'" 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},a.prototype.getSplitTaskbarLeftResizerNode=function(){var t=!(0,e.isNullOrUndefined)(document.body.className)&&document.body.className.includes("e-bigger")?5:-2;return'<div class="'+Q+" "+ae+'" style="'+(this.parent.enableRtl?"right:":"left:")+t+"px;height:"+this.taskBarHeight+'px;z-index:1"></div>'},a.prototype.getSplitTaskbarRightResizerNode=function(t){var i=!(0,e.isNullOrUndefined)(document.body.className)&&document.body.className.includes("e-bigger")?-17:-10;return'<div class="'+$+" "+ae+'" style="'+(this.parent.enableRtl?"right:":"left:")+(t.width+i)+"px;height:"+this.taskBarHeight+'px;z-index:1"></div>'},a.prototype.getSplitProgressResizerNode=function(){var e=this.parent.enableRtl?this.templateData.ganttProperties.progressWidth+8:this.templateData.ganttProperties.progressWidth-6;return'<div class="'+J+'" style="'+(this.parent.enableRtl?"right:":"left:")+e+"px;margin-top:"+(this.taskBarHeight-4)+'px;"><div class="'+ee+'"><div class="'+te+'"></div><div class="'+ie+'"></div></div>'},a.prototype.getSegmentIndex=function(t,i){var a=-1,r=i.ganttProperties,n=r.segments;if(!(0,e.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(t.getTime()===r.startDate.getTime())this.dropSplit=!0,a=0;else if(t.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),t.getTime()>=l.startDate.getTime()&&t.getTime()<=l.endDate.getTime()&&(a=l.segmentIndex);this.parent.setRecordValue("segments",r.segments,r,!0)}}return-1===a&&(this.dropSplit=!0),a},a.prototype.mergeTask=function(t,i){var a=i.length,r=this.parent.taskFields,n=this.parent.flatData.filter(function(e){return e[r.id]===t?e:null})[0];if(this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed){var s={action:"MergeTaskbar"};if(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=(0,e.extend)([],[o],[],!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=s}}var l,d=n.ganttProperties.segments;i=i.sort(function(e,t){return t.firstSegmentIndex-e.firstSegmentIndex});for(var h=0;h<a;h++){var p=d[i[h].firstSegmentIndex],u=d[i[h].secondSegmentIndex],c=p.duration+u.duration,g=this.parent.dataOperation.getEndDate(p.startDate,c,n.ganttProperties.durationUnit,n.ganttProperties,!1),f={startDate:p.startDate,endDate:g,duration:c},m=i[h].firstSegmentIndex;d.splice(m,2,f),this.parent.setRecordValue("segments",d,n.ganttProperties,!0),this.parent.dataOperation.updateMappingData(n,"segments"),1===d.length?(this.parent.setRecordValue("endDate",g,n.ganttProperties,!0),this.parent.setRecordValue("EndDate",g,n,!0),this.parent.setRecordValue("segments",null,n.ganttProperties,!0),this.parent.dataOperation.updateMappingData(n,"segments")):n.ganttProperties.endDate!==d[d.length-1].endDate&&this.parent.setRecordValue("endDate",d[d.length-1].endDate,n.ganttProperties,!0)}(0,e.isNullOrUndefined)(n[r.segments])||(0,e.isNullOrUndefined)(n[r.segments][0])||(l=Object.keys(n[r.segments][0]));for(var y=[],D=0;D<d.length;D++)(0,e.isNullOrUndefined)(l)||y[D]||(y[D]={}),(0,e.isNullOrUndefined)(l)||-1===l.indexOf("StartDate")||(y[D][r.startDate]=d[D].startDate),(0,e.isNullOrUndefined)(l)||-1===l.indexOf("EndDate")||(y[D][r.endDate]=d[D].endDate),(0,e.isNullOrUndefined)(l)||-1===l.indexOf("Duration")||(y[D][r.duration]=d[D].duration);n[r.segments]=y,this.updateSegment(n.ganttProperties.segments,t),this.refreshChartAfterSegment(n,"mergeSegment")},a.prototype.updateSegment=function(t,i){var a=this;if(!(0,e.isNullOrUndefined)(this.parent.taskFields.segmentId)&&this.parent.segmentData.length>0)if((0,e.isNullOrUndefined)(t)){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<t.length;n++){var s={},o=t[n];s[this.parent.taskFields.segmentId]=i,(0,e.isNullOrUndefined)(this.parent.taskFields.startDate)||(s[this.parent.taskFields.startDate]=o.startDate),(0,e.isNullOrUndefined)(this.parent.taskFields.duration)||(s[this.parent.taskFields.duration]=o.duration),(0,e.isNullOrUndefined)(this.parent.taskFields.endDate)||(s[this.parent.taskFields.endDate]=o.endDate),r.push(s)}var l=this.parent.segmentData.filter(function(e){return!(i===e[a.parent.taskFields.segmentId])});for(n=0;n<r.length;n++)l.push(r[n]);this.parent.segmentData=l}},a.prototype.refreshChartAfterSegment=function(t,i){this.parent.setRecordValue("segments",this.parent.dataOperation.setSegmentsInfo(t,!1),t.ganttProperties,!0),this.parent.dataOperation.updateMappingData(t,"segments"),this.parent.dataOperation.updateWidthLeft(t),this.parent.dataOperation.updateParentItems(t),t.ganttProperties.sharedTaskUniqueIds&&t.ganttProperties.sharedTaskUniqueIds.length>1&&this.parent.editModule.updateSharedTask(t),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),t.parentItem&&this.parent.getParentTask(t.parentItem).ganttProperties.isAutoSchedule&&this.parent.isInPredecessorValidation&&this.parent.dataOperation.updateParentItems(t.parentItem),this.refreshRecords(this.parent.currentViewData)):this.refreshRecords(this.parent.currentViewData);var a=this.ganttChartTableBody.querySelectorAll("tr")[this.parent.currentViewData.indexOf(t)],r={requestType:i,rowData:t,modifiedRecords:this.parent.editedRecords,modifiedTaskData:h(this.parent.editedRecords,!0)};this.triggerQueryTaskbarInfoByIndex(a,t),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(),(0,e.setValue)("isEdit",!1,this.parent.contextMenuModule),(0,e.setValue)("isEdit",!1,this.parent)},a.prototype.splitTask=function(t,i){var a=this.parent.taskFields,r=i,n=this.parent.flatData.filter(function(e){return e[a.id]===t?e:null})[0];if(this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed){var s={action:"MergeTaskbar"};this.parent.isUndoRedoItemPresent("Edit")&&(this.parent.undoRedoModule.createUndoCollection(),s.modifiedRecords=(0,e.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((0,e.isNullOrUndefined)(i.length)||i.length<0){var h=this.parent.dataOperation.checkStartDate(r,o,!1);if(h.getTime()!==o.startDate.getTime()&&o.isAutoSchedule){if(!(0,e.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,t),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,t),this.refreshChartAfterSegment(n,"splitTask")},a.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},a.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===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},a.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")},a.prototype.calculateLeftValue=function(t){var i=this.parent.renderBaseline?.45:!(0,e.isNullOrUndefined)(document.body.className)&&document.body.className.includes("e-bigger")?.7:.62,a=Math.floor(this.parent.rowHeight*i);return!(0,e.isNullOrUndefined)(this.parent.taskbarHeight)&&this.parent.taskbarHeight<=a||(0,e.isNullOrUndefined)(this.parent.taskbarHeight)&&t<=36||t<=36?1:-1/12*(t-36)+1},a.prototype.getMilestoneNode=function(t,i){var a=null,r=this.templateData,n=this.parent.rowHeight,s=this.calculateLeftValue(n);if(this.milestoneTemplateFunction)a=this.milestoneTemplateFunction((0,e.extend)({index:t},r),this.parent,"MilestoneTemplate",this.getTemplateID("MilestoneTemplate"),!1,void 0,i[0],this.parent.treeGrid.root);else{var o='<div class="'+re+'" 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},a.prototype.getTaskBaselineNode=function(){var e=this.templateData,t='<div class="'+_+' " 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)},a.prototype.updateTaskBaselineNode=function(e){var t='<div class="'+_+' " 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)},a.prototype.getMilestoneBaselineNode=function(){var e=this.templateData,t=this.parent.renderBaseline?5:2,i='<div class="'+Z+'" 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)},a.prototype.getLeftLabelNode=function(t){var i=this.leftLabelContainer();""!==this.generateTaskLabelAriaLabel("left")&&i[0].setAttribute("aria-label",this.generateTaskLabelAriaLabel("left"));var a=null;if(this.leftTaskLabelTemplateFunction)a=this.leftTaskLabelTemplateFunction((0,e.extend)({index:t},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,L),this.parent.enableHtmlSanitizer&&"string"==typeof n&&(n="isCustomTemplate"===(n=e.SanitizeHtmlHelper.sanitize(n))?r:n,a=this.getLableText(n,L)))}return a&&a.length>0&&("null"===a[0].data&&(a[0].data=""),(0,e.append)(a,i[0])),this.parent.enableRtl&&(i[0].style.paddingLeft="25px",i[0].style.paddingRight="0px"),i},a.prototype.getLableText=function(t,i){var a=this.parent.renderBaseline?(this.parent.rowHeight-this.taskBarHeight)/2:this.taskBarMarginTop,r=(0,e.createElement)("div",{className:i,styles:"height:"+this.taskBarHeight+"px;margin-top:"+a+"px;"}),n=(0,e.createElement)("span",{className:De});n[this.parent.disableHtmlEncode?"textContent":"innerHTML"]=t,r.appendChild(n);var s=(0,e.createElement)("div");return s.appendChild(r),s.childNodes},a.prototype.getRightLabelNode=function(t){var i=this.rightLabelContainer();""!==this.generateTaskLabelAriaLabel("right")&&i[0].setAttribute("aria-label",this.generateTaskLabelAriaLabel("right"));var a=null;if(this.rightTaskLabelTemplateFunction)a=this.rightTaskLabelTemplateFunction((0,e.extend)({index:t},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,B),this.parent.enableHtmlSanitizer&&"string"==typeof n&&(n="isCustomTemplate"===(n=e.SanitizeHtmlHelper.sanitize(n))?r:n,a=this.getLableText(n,B)))}return a&&a.length>0&&("null"===a[0].data&&(a[0].data=""),(0,e.append)(a,i[0])),this.parent.enableRtl&&(i[0].style.marginLeft="0px",i[0].style.paddingRight="25px"),i},a.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="'+le+'" 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="'+le+" "+(e.ganttProperties.startDate?be:we)+'" 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="'+le+' 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="'+oe+'"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="'+de+'" 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)},a.prototype.getParentTaskbarNode=function(t,i){var a=null,r=this.templateData;if(this.parentTaskbarTemplateFunction&&0!==r.ganttProperties.autoDuration&&!r.ganttProperties.isMilestone)a=this.parentTaskbarTemplateFunction((0,e.extend)({index:t},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)+" "+ue+'" 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)+" "+ce+'" 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=(0,e.createElement)("div");if(this.taskLabelTemplateFunction){var p=this.taskLabelTemplateFunction((0,e.extend)({index:t},r),this.parent,"TaskLabelTemplate",this.getTemplateID("TaskLabelTemplate"),!1,void 0,d[0]);p&&p.length>0&&((0,e.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=e.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=e.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="'+W+'" 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="'+W+'" 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},a.prototype.getTableTrNode=function(t){var i,a,r=this,n=(0,e.createElement)("table"),s="Horizontal"===this.parent.gridLines||"Both"===this.parent.gridLines?"e-chart-row-border":"";this.parent.treeGridModule.isPersist?setTimeout(function(){(0,e.isNullOrUndefined)(r.parent.treeGrid.grid)||(0,e.isNullOrUndefined)(r.parent.treeGrid.grid.contentModule)||(0,e.isNullOrUndefined)(r.parent.treeGrid.grid.contentModule.getRows())||(a=r.parent.treeGrid.grid.contentModule.getRows()[t],i=a&&a.isSelected?"e-active":"")},0):(a=this.parent.treeGrid.grid.contentModule.getRows()[t],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),Y),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(X,s):d.classList.add(X),d.style.width=this.parent.timelineModule.totalTimelineWidth+"px",l.appendChild(d),o.appendChild(l),n.childNodes},a.prototype.initializeChartTemplate=function(){(0,e.isNullOrUndefined)(this.parent.parentTaskbarTemplate)||(this.parentTaskbarTemplateFunction=this.templateCompiler(this.parent.parentTaskbarTemplate)),!(0,e.isNullOrUndefined)(this.parent.labelSettings.leftLabel)&&this.isTemplate(this.parent.labelSettings.leftLabel)&&(this.leftTaskLabelTemplateFunction=this.templateCompiler(this.parent.labelSettings.leftLabel)),!(0,e.isNullOrUndefined)(this.parent.labelSettings.rightLabel)&&this.isTemplate(this.parent.labelSettings.rightLabel)&&(this.rightTaskLabelTemplateFunction=this.templateCompiler(this.parent.labelSettings.rightLabel)),!(0,e.isNullOrUndefined)(this.parent.labelSettings.taskLabel)&&this.isTemplate(this.parent.labelSettings.taskLabel)&&(this.taskLabelTemplateFunction=this.templateCompiler(this.parent.labelSettings.taskLabel)),(0,e.isNullOrUndefined)(this.parent.taskbarTemplate)||(this.childTaskbarTemplateFunction=this.templateCompiler(this.parent.taskbarTemplate)),(0,e.isNullOrUndefined)(this.parent.milestoneTemplate)||(this.milestoneTemplateFunction=this.templateCompiler(this.parent.milestoneTemplate))},a.prototype.createDivElement=function(e){var t=document.createElement("div");return this.parseTemplate(e).forEach(function(e){return t.appendChild(e)}),t.childNodes},a.prototype.parseTemplate=function(e){var t=this;return this.parseHtmlStringToElementTree(e).map(function(e){return t.constructElementFromNode(e)})},a.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},a.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},a.prototype.setAttributes=function(e,t){var i;for(t=t.replace(/style=([^"'\s][^ >]*)/g,'style="$1"');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)}},a.prototype.cleanStyleString=function(e){return e.split(";").map(function(e){return e.trim()}).filter(Boolean).join("; ")},a.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},a.prototype.getTemplateID=function(e){return this.parent.element.id+e},a.prototype.leftLabelContainer=function(){var e='<div class="'+(this.leftTaskLabelTemplateFunction?"e-left-label-container e-left-label-temp-container":N)+' " tabindex="-1" role="term" style="height:'+(this.parent.rowHeight-2)+"px;width:"+this.taskNameWidth(this.templateData)+'"></div>';return this.createDivElement(e)},a.prototype.taskbarContainer=function(){var e=this.templateData,t=!(!this.parent.editModule||!this.parent.editSettings.allowTaskbarEditing||"ParentResizing"!==this.parent.editModule.taskbarEditModule.taskBarEditAction),i='<div class="'+A+" "+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)},a.prototype.rightLabelContainer=function(){var e='<div class="'+(this.rightTaskLabelTemplateFunction?"e-right-label-container e-right-label-temp-container":V)+'"  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)},a.prototype.childTaskbarLeftResizer=function(){var t=!(0,e.isNullOrUndefined)(document.body.className)&&document.body.className.includes("e-bigger")?5:-2,i='<div class="'+Q+" "+ae+'"style="'+(this.parent.enableRtl?"right:":"left:")+t+"px;height:"+this.taskBarHeight+'px;z-index:1"></div>';return this.createDivElement(i)},a.prototype.childTaskbarRightResizer=function(){var t=!(0,e.isNullOrUndefined)(document.body.className)&&document.body.className.includes("e-bigger")?-17:-11,i='<div class="'+$+" "+ae+'"style="'+(this.parent.enableRtl?"right:":"left:")+(this.templateData.ganttProperties.width+t)+"px;height:"+this.taskBarHeight+'px;z-index:1"></div>';return this.createDivElement(i)},a.prototype.childTaskbarProgressResizer=function(){var e=this.parent.enableRtl?this.templateData.ganttProperties.progressWidth+8:this.templateData.ganttProperties.progressWidth-6,t='<div class="'+J+'"style="'+(this.parent.enableRtl?"right:":"left:")+e+"px;margin-top:"+(this.taskBarHeight-4)+'px;"><div class="'+ee+'"><div class="'+te+'"></div><div class="'+ie+'"></div></div>';return this.createDivElement(t)},a.prototype.getLeftPointNode=function(){var t,i=this.templateData,a=!(0,e.isNullOrUndefined)(document.body.className)&&document.body.className.includes("e-bigger")?12:0,r=!(0,e.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);t=!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;":t+";left:"+n+"px;")+'"><div class="'+(l?xe:"")+" "+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)},a.prototype.getRightPointNode=function(){var t,i=this.templateData,a=-(3+(!(0,e.isNullOrUndefined)(document.body.className)&&document.body.className.includes("e-bigger")?-12:0)),r=Math.floor(this.milesStoneRadius-this.connectorPointWidth/2);t=!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="'+Fe+'" style="'+(i.ganttProperties.isMilestone?"left:"+(!(0,e.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;"+t+";")+'"><div class="'+(n?Oe:"")+" "+this.parent.getUnscheduledTaskClass(i.ganttProperties)+'" style="width:'+this.connectorPointWidth+"px;height:"+this.connectorPointWidth+'px;">'+this.touchRightConnectorpoint+"</div></div>";return this.createDivElement(s)},a.prototype.getTaskLabel=function(t){var i=this.parent.ganttColumns.length,a=null;if((0,e.isNullOrUndefined)(t)||""===t)a="";else if(t===this.parent.taskFields.resourceInfo)a=this.getResourceName(this.templateData);else{for(var r=0;r<i;r++)if(t===this.parent.ganttColumns[r].field){a=this.getFieldValue(this.templateData[t]).toString();break}if((0,e.isNullOrUndefined)(a))return"isCustomTemplate"}return a},a.prototype.getExpandDisplayProp=function(e){return e=this.templateData,this.parent.getExpandStatus(e)?"table-row":"none"},a.prototype.getRowClassName=function(e){var t="gridrowtaskId",i=(e=this.templateData).parentItem;return i&&(t+=i.taskId.toString()),t+="level",t+=e.level.toString()},a.prototype.getBorderRadius=function(e){var t=(e=this.templateData).ganttProperties.width-e.ganttProperties.progressWidth;return t<=4?4-t:0},a.prototype.getSplitTaskBorderRadius=function(e){var t=e.width-e.progressWidth;return t<=4?4-t:0},a.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"},a.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},a.prototype.getExpandClass=function(e){return(e=this.templateData).expanded?"e-row-expand":!e.expanded&&e.hasChildRecords?"e-row-collapse":""},a.prototype.getFieldValue=function(t){return(0,e.isNullOrUndefined)(t)?"":t},a.prototype.getResourceName=function(t){t=this.templateData;var i=null;if(!(0,e.isNullOrUndefined)(t.ganttProperties.resourceInfo)){var a=t.ganttProperties.resourceInfo.length;if(a>0){for(var r=0;r<a;r++){var n=t.ganttProperties.resourceInfo[r][this.parent.resourceFields.name],s=t.ganttProperties.resourceInfo[r][this.parent.resourceFields.unit];100!==s&&(n+="["+s+"%]"),(0,e.isNullOrUndefined)(i)?i=n:i+=" , "+n}return i}return""}return""},a.prototype.initChartHelperPrivateVariable=function(){var t=this.parent.renderBaseline?.45:!(0,e.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=(0,e.isNullOrUndefined)(this.parent.rowHeight)?36:this.parent.rowHeight,this.baselineColor=(0,e.isNullOrUndefined)(this.parent.baselineColor)||""===this.parent.baselineColor?null:this.parent.baselineColor,this.taskBarHeight=(0,e.isNullOrUndefined)(this.parent.taskbarHeight)||this.parent.taskbarHeight>=this.parent.rowHeight?Math.floor(this.parent.rowHeight*t):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)},a.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()},a.prototype.createTaskbarTemplate=function(){var t,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((0,e.isNullOrUndefined)(p)||-1!==u||this.parent.isFromRenderBaseline){var c=this.getGanttChartRow(h,this.parent.currentViewData[h]);this.ganttChartTableBody.appendChild(c),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{var g=(0,e.createElement)("tbody",{id:this.parent.element.id+"GanttTaskTableBody"});for(d=0;d<this.parent.currentViewData.length;d++){var f=this.parent.currentViewData[d];!f.expanded&&this.parent.enableMultiTaskbar&&r.push(f);c=this.getGanttChartRow(d,f);f.hasChildRecords&&!f.expanded&&this.parent.enableMultiTaskbar&&!this.parent.allowTaskbarOverlap&&this.updateDragDropRecords(f,c),g.appendChild(c),this.parent.enableImmutableMode&&(this.refreshedTr.push(g.querySelectorAll("tr")[d]),this.refreshedData.push(this.parent.currentViewData[d])),this.parent.selectionModule&&this.parent.allowSelection&&this.parent.selectionModule.maintainSelectedRecords(parseInt(c.getAttribute("aria-rowindex"),10)-1)}(t=this.ganttChartTableBody).replaceChildren.apply(t,g.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()},a.prototype.getGanttChartRow=function(t,i){this.templateData=i;var a,r,n=this.getTableTrNode(t),s=this.getLeftLabelNode(t),o=this.taskbarContainer();if(o[0].setAttribute("aria-label",this.generateAriaLabel(this.templateData)),o[0].setAttribute("rowUniqueId",this.templateData.ganttProperties.rowUniqueID),a=this.getLeftPointNode(),(this.templateData.ganttProperties.isAutoSchedule&&"ProjectView"===this.parent.viewType||!this.templateData.hasChildRecords)&&o[0].appendChild([].slice.call(a)[0]),this.templateData.hasChildRecords){var l=void 0;if(!this.parent.enableMultiTaskbar||this.parent.enableMultiTaskbar&&this.templateData.expanded)l=this.getParentTaskbarNode(t,o);else{o=[];for(var d=0;d<this.templateData.childRecords.length;d++){this.templateData=this.templateData.childRecords[d];var h=this.taskbarContainer();h[0].setAttribute("aria-label",this.generateAriaLabel(this.templateData)),h[0].setAttribute("rowUniqueId",this.templateData.ganttProperties.rowUniqueID),this.parent.allowParentDependency?(a=this.getLeftPointNode(),!this.templateData.ganttProperties.isAutoSchedule&&this.templateData.hasChildRecords||h[0].appendChild([].slice.call(a)[0])):(a=this.getLeftPointNode(),h[0].appendChild([].slice.call(a)[0])),this.appendChildTaskbars(i,t,h,r,o)}}if(!this.templateData.ganttProperties.isAutoSchedule){var p=this.getManualTaskbar();if(!(0,e.isNullOrUndefined)(p[0])){if(this.parent.allowParentDependency){a=this.getLeftPointNode(),p[0].appendChild([].slice.call(a)[0]);var u=this.getRightPointNode();p[0].appendChild([].slice.call(u)[0])}o[0].appendChild([].slice.call(p)[0])}}if(0!==this.templateData.ganttProperties.autoDuration&&!this.templateData.ganttProperties.isMilestone&&l&&l.length>0)(0,e.append)(l,o[0]);else if(0===this.templateData.ganttProperties.duration&&this.templateData.ganttProperties.isMilestone&&this.templateData.ganttProperties.isAutoSchedule){var c=this.getMilestoneNode(t,o);c&&c.length>0&&(0,e.append)(c,o[0])}this.parent.renderBaseline&&this.templateData.ganttProperties.baselineStartDate&&this.templateData.ganttProperties.baselineEndDate&&(this.taskBaselineTemplateNode=this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.baselineEndDate.getTime()&&((0,e.isNullOrUndefined)(this.templateData.ganttProperties.baselineStartDate)||(0,e.isNullOrUndefined)(this.templateData.ganttProperties.startDate)||this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.startDate.getTime()||(0,e.isNullOrUndefined)(this.templateData.ganttProperties.baselineEndDate)||(0,e.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)?(r=this.getRightPointNode(),o[0].appendChild([].slice.call(r)[0])):this.parent.allowParentDependency||(r=this.getRightPointNode(),o[0].appendChild([].slice.call(r)[0])))}else this.appendChildTaskbars(i,t,o,r);var g=this.getRightLabelNode(t);if(this.parent.enableMultiTaskbar&&this.templateData.hasChildRecords&&!this.templateData.expanded){var f=(0,e.createElement)("div",{className:"e-collapse-parent"});n[0].childNodes[0].childNodes[0].appendChild(f);for(d=0;d<o.length;d++)(0,e.addClass)([o[d]],"collpse-parent-border"),n[0].childNodes[0].childNodes[0].childNodes[0].appendChild([].slice.call(o)[d]);n[0].childNodes[0].childNodes[0].appendChild([].slice.call(s)[0]),this.templateData.ganttProperties.indicators&&this.templateData.ganttProperties.indicators.length>0&&this.appendIndicators(t,n)}else n[0].childNodes[0].childNodes[0].appendChild([].slice.call(s)[0]),n[0].childNodes[0].childNodes[0].appendChild([].slice.call(o)[0]),this.templateData.ganttProperties.indicators&&this.templateData.ganttProperties.indicators.length>0&&this.appendIndicators(t,n),g&&g.length>0&&n[0].childNodes[0].childNodes[0].appendChild([].slice.call(g)[0]);(0,e.isNullOrUndefined)(this.taskBaselineTemplateNode)||n[0].childNodes[0].childNodes[0].appendChild([].slice.call(this.taskBaselineTemplateNode)[0]),this.taskBaselineTemplateNode=null;var m=n[0].childNodes[0];return this.setAriaRowIndex(i,m),m},a.prototype.setAriaRowIndex=function(t,i){var a,r=this,n=this.parent.treeGrid.getCurrentViewRecords(),s=this.parent.virtualScrollModule&&this.parent.enableVirtualization?(0,e.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(e){if(e.data[r.parent.taskFields.id]===t.ganttProperties.taskId)return e})[0];i.setAttribute("data-rowindex",o.index.toString()),i.setAttribute("aria-rowindex",(o.index+1).toString())}else a=s.indexOf(t),i.setAttribute("aria-rowindex",(a+1).toString())},a.prototype.triggerQueryTaskbarInfo=function(){if(this.parent.queryTaskbarInfo)for(var t,i,a=this.parent.enableImmutableMode?this.refreshedTr.length:this.ganttChartTableBody.querySelectorAll("tr").length,r=0;r<a;r++){t=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=!(0,e.isNullOrUndefined)(i.ganttProperties.segments)&&i.ganttProperties.segments.length;if(n>0)for(var s=0;s<n;s++){var o=t.getElementsByClassName("e-segmented-taskbar")[s];this.triggerQueryTaskbarInfoByIndex(o,i)}else t&&this.triggerQueryTaskbarInfoByIndex(t,i)}},a.prototype.appendIndicators=function(t,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)((0,e.extend)({index:t},this.templateData),this.parent,"indicatorLabelText");else{var o=(0,e.createElement)("Text");o.innerHTML=n[s].name,this.parent.enableHtmlSanitizer&&"string"==typeof n[s].name&&(n[s].name=e.SanitizeHtmlHelper.sanitize(n[s].name)),r=o.childNodes}a[0].appendChild([].slice.call(r)[0]),a[0].title=(0,e.isNullOrUndefined)(n[s].tooltip)?"":n[s].tooltip,i[0].childNodes[0].childNodes[0].appendChild([].slice.call(a)[0])}},a.prototype.appendChildTaskbars=function(t,i,a,n,s){if(this.templateData.ganttProperties.isMilestone){var o=this.getMilestoneNode(i,a);o&&o.length>0&&(0,e.append)(o,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()&&((0,e.isNullOrUndefined)(this.templateData.ganttProperties.baselineStartDate)||(0,e.isNullOrUndefined)(this.templateData.ganttProperties.startDate)||this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.startDate.getTime()||(0,e.isNullOrUndefined)(this.templateData.ganttProperties.baselineEndDate)||(0,e.isNullOrUndefined)(this.templateData.ganttProperties.endDate)||this.templateData.ganttProperties.baselineEndDate.getTime()!==this.templateData.ganttProperties.endDate.getTime()||!this.templateData.ganttProperties.isMilestone)?this.getTaskBaselineNode():this.getMilestoneBaselineNode()),s&&(s.push(a[0]),this.templateData=t)}else{var l=r(this.templateData.ganttProperties),d=null,h=null,p=null;if(!(0,e.isNullOrUndefined)(l)){(l||this.templateData.ganttProperties.duration)&&l&&((0,e.isNullOrUndefined)(this.templateData.ganttProperties.segments)||this.templateData.ganttProperties.segments.length<=0)&&(d=this.childTaskbarProgressResizer(),p=this.childTaskbarLeftResizer(),h=this.childTaskbarRightResizer());var u=this.getChildTaskbarNode(i,a);if(p&&a[0].appendChild([].slice.call(p)[0]),u&&u.length>0)if(this.templateData.ganttProperties.segments&&this.templateData.ganttProperties.segments.length>0){var c,g=this.templateData.ganttProperties.segments.length;c=this.createDivElement('<div class="e-gantt-split-container-line"></div>'),a[0].appendChild([].slice.call(c)[0]);for(var f=0;f<g;f++)(0,e.append)(u,a[0])}else(0,e.append)(u,a[0]);d&&a[0].appendChild([].slice.call(d)[0]),h&&a[0].appendChild([].slice.call(h)[0])}this.parent.renderBaseline&&this.templateData.ganttProperties.baselineStartDate&&this.templateData.ganttProperties.baselineEndDate&&(this.taskBaselineTemplateNode=this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.baselineEndDate.getTime()&&((0,e.isNullOrUndefined)(this.templateData.ganttProperties.baselineStartDate)||(0,e.isNullOrUndefined)(this.templateData.ganttProperties.startDate)||this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.startDate.getTime()||(0,e.isNullOrUndefined)(this.templateData.ganttProperties.baselineEndDate)||(0,e.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)?(n=this.getRightPointNode(),a[0].appendChild([].slice.call(n)[0])):this.parent.allowParentDependency||(n=this.getRightPointNode(),a[0].appendChild([].slice.call(n)[0])),s&&(s.push(a[0]),this.templateData=t)},a.prototype.customizeTaskbars=function(t,i,a){var r,n=this;t.ganttProperties.segments&&t.ganttProperties.segments.length>0&&i&&i.parentElement&&i.parentElement.parentElement&&i.parentElement.parentElement.parentElement&&(r=i.parentElement.parentElement.parentElement);var s={data:t,rowElement:i,taskbarElement:a,taskbarType:t.hasChildRecords?"ParentTask":t.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("."+_)?getComputedStyle(i.querySelector("."+_)).backgroundColor:null;else if(a){var l=a.querySelector(o[0]),d=a.querySelector(o[1]);s.taskbarBgColor=(0,e.isNullOrUndefined)(l)?null:a.classList.contains(ne)?getComputedStyle(a).backgroundColor:getComputedStyle(a.querySelector(o[0])).backgroundColor,s.taskbarBorderColor=(0,e.isNullOrUndefined)(l)?null:a.classList.contains(ne)?getComputedStyle(a).backgroundColor:getComputedStyle(a.querySelector(o[0])).outlineColor,s.progressBarBgColor=(0,e.isNullOrUndefined)(d)?null:a.classList.contains(se)?getComputedStyle(a).backgroundColor:getComputedStyle(a.querySelector(o[1])).backgroundColor,s.baselineColor=r?r.querySelector("."+_)?getComputedStyle(r.querySelector("."+_)).backgroundColor:null:i.querySelector("."+_)?getComputedStyle(i.querySelector("."+_)).backgroundColor:null,s.taskLabelColor=a.querySelector("."+W)?getComputedStyle(a.querySelector("."+W)).color:null}r?(s.rightLabelColor=r.querySelector("."+V)&&r.querySelector("."+V).querySelector("."+De)?getComputedStyle(r.querySelector("."+V).querySelector("."+De)).color:null,s.leftLabelColor=r.querySelector("."+N)&&r.querySelector("."+N).querySelector("."+De)?getComputedStyle(r.querySelector("."+N).querySelector("."+De)).color:null):(s.rightLabelColor=i.querySelector("."+V)&&i.querySelector("."+V).querySelector("."+De)?getComputedStyle(i.querySelector("."+V).querySelector("."+De)).color:null,s.leftLabelColor=i.querySelector("."+N)&&i.querySelector("."+N).querySelector("."+De)?getComputedStyle(i.querySelector("."+N).querySelector("."+De)).color:null),this.parent.trigger("queryTaskbarInfo",s,function(e){n.updateQueryTaskbarInfoArgs(e,undefined,undefined)})},a.prototype.triggerQueryTaskbarInfoByIndex=function(t,i){if(!(0,e.isNullOrUndefined)(t)){var a,r=i;if(!(0,e.isNullOrUndefined)(i.ganttProperties.segments)&&i.ganttProperties.segments.length>0)a=t,t&&this.customizeTaskbars(i,t,a);else if(this.parent.enableMultiTaskbar)for(var n=t.querySelectorAll("."+A),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()),t=(t=this.parent.getRowByID(o))||a.querySelector(".e-gantt-child-taskbar"),(0,e.isNullOrUndefined)(t)&&r.ganttProperties.isMilestone&&(t=a),t){var l=t.querySelectorAll(".e-segmented-taskbar");if(l&&l.length>0)for(var d=(t.querySelector('.e-taskbar-main-container[rowuniqueid="'+r.ganttProperties.rowUniqueID+'"]')||t).querySelectorAll(".e-segmented-taskbar"),h=0;h<d.length;h++)a=d[h],this.customizeTaskbars(r,d[h],a);else this.customizeTaskbars(r,t,a)}}else{var p=t.querySelector("."+A);t&&this.customizeTaskbars(r,t,p)}}},a.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("."+_)&&getComputedStyle(r.querySelector("."+_)).borderTopColor!==e.baselineColor&&(r.querySelector("."+_).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(ne)&&getComputedStyle(n).backgroundColor!==e.taskbarBgColor&&(n.style.backgroundColor=e.taskbarBgColor),n.classList.contains(ne)&&getComputedStyle(n).outlineColor!==e.taskbarBorderColor&&(n.style.outlineColor=e.taskbarBorderColor),n.classList.contains(se)&&getComputedStyle(n).backgroundColor!==e.progressBarBgColor&&(n.style.backgroundColor=e.progressBarBgColor),n.querySelector("."+W)&&getComputedStyle(n.querySelector("."+W)).color!==e.taskLabelColor&&(n.querySelector("."+W).style.color=e.taskLabelColor),a?a.querySelector("."+_)&&getComputedStyle(a.querySelector("."+_)).backgroundColor!==e.baselineColor&&(a.querySelector("."+_).style.backgroundColor=e.baselineColor):r.querySelector("."+_)&&getComputedStyle(r.querySelector("."+_)).backgroundColor!==e.baselineColor&&(r.querySelector("."+_).style.backgroundColor=e.baselineColor)),a?(a.querySelector("."+N)&&a.querySelector("."+N).querySelector("."+De)&&getComputedStyle(a.querySelector("."+N).querySelector("."+De)).color!==e.leftLabelColor&&(a.querySelector("."+N).querySelector("."+De).style.color=e.leftLabelColor),a.querySelector("."+V)&&a.querySelector("."+V).querySelector("."+De)&&getComputedStyle(a.querySelector("."+V).querySelector("."+De)).color!==e.rightLabelColor&&(a.querySelector("."+V).querySelector("."+De).style.color=e.rightLabelColor)):(r.querySelector("."+N)&&r.querySelector("."+N).querySelector("."+De)&&getComputedStyle(r.querySelector("."+N).querySelector("."+De)).color!==e.leftLabelColor&&(r.querySelector("."+N).querySelector("."+De).style.color=e.leftLabelColor),r.querySelector("."+V)&&r.querySelector("."+V).querySelector("."+De)&&getComputedStyle(r.querySelector("."+V).querySelector("."+De)).color!==e.rightLabelColor&&(r.querySelector("."+V).querySelector("."+De).style.color=e.rightLabelColor))},a.prototype.getClassName=function(e){var t=[];return t.push("."+("ParentTask"===e.taskbarType?ue:"ChildTask"===e.taskbarType?ne:re)),t.push("."+("ParentTask"===e.taskbarType?ce:"ChildTask"===e.taskbarType?se:Z)),t},a.prototype.templateCompiler=function(t){if(!(0,e.isNullOrUndefined)(t)&&""!==t)try{return"function"!=typeof t&&document.querySelectorAll(t).length?(0,e.compile)(document.querySelector(t).innerHTML.trim(),this.parent):(0,e.compile)(t,this.parent)}catch(i){return(0,e.compile)(t,this.parent)}return null},a.prototype.updateOverlapped=function(){for(var t=0;t<this.parent.treeGrid.parentData.length;t++)for(var i=this.parent.treeGrid.parentData[t].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):((0,e.isNullOrUndefined)(i[r].ganttProperties.eOverlapped)&&(i[r].ganttProperties.eOverlapped=!1),(0,e.isNullOrUndefined)(i[a].ganttProperties.eOverlapped)&&(i[a].ganttProperties.eOverlapped=!1))}},a.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"}},a.prototype.refreshRow=function(t,i,a){var r,n=this,s=this.ganttChartTableBody.childNodes[t];if(r=a?this.parent.previousFlatData[t]:this.parent.currentViewData[t],-1!==t&&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(t).style.height=this.parent.rowHeight+"px":s.style.height=this.parent.treeGrid.getRows()[t].style.height=this.parent.rowHeight+"px"),o.hasChildRecords&&!o.expanded&&this.parent.enableMultiTaskbar)s.replaceChild(this.getGanttChartRow(t,o).childNodes[0],s.childNodes[0]),this.parent.renderBaseline&&o.childRecords.forEach(function(t){(0,e.isNullOrUndefined)(t.ganttProperties.baselineStartDate&&t.ganttProperties.baselineEndDate)||s.childNodes[0].appendChild(n.updateTaskBaselineNode(t)[0])});else if(this.parent.allowTaskbarDragAndDrop&&!o.expanded)s.replaceWith(this.getGanttChartRow(t,o));else if(s.replaceChild(this.getGanttChartRow(t,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=!(0,e.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(),(0,e.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()[t].getAttribute("data-uid"));(0,e.isNullOrUndefined)(v)||(v.data=o)}},a.prototype.updateResourceTaskbarElement=function(t,i){var a=t.querySelector(".e-taskbar-main-container");"ProjectView"===this.parent.viewType&&t.querySelector(".e-collapse-parent")&&(a=t.querySelector(".e-collapse-parent")),null===t.querySelector(".e-collapse-parent")&&(0,e.addClass)([a],"collpse-parent-border");var r=t.querySelector("."+A).getAttribute("rowUniqueId"),n=this.parent.getRecordByID(r);if(!(0,e.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");(0,e.isNullOrUndefined)(l)||this.triggerQueryTaskbarInfoByIndex(l,n)}var d="";n&&!(0,e.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)},a.prototype.refreshRecords=function(e,t,a){if(this.parent.isGanttChartRendered){if(this.parent.renderTemplates(),this.parent.enableMultiTaskbar){e=new i.DataManager(e).executeLocal((new i.Query).sortBy("expanded","Descending"))}for(var r=0;r<e.length;r++){var n=void 0;n=a?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,a)}this.parent.ganttChartModule.updateLastRowBottomWidth()}},a.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))},a.prototype.destroy=function(){this.removeEventListener()},a.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},a.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)+" "},a.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},a.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},a}(T),si=function(){function t(e){this.parentRecord=[],this.parentIds=[],this.parentPredecessors=[],this.validatedParentIds=[],this.storeId=null,this.isChildRecordValidated=[],this.parent=e,this.dateValidateModule=this.parent.dateValidationModule}return t.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)}},t.prototype.ensurePredecessorCollectionHelper=function(t,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=(0,e.getValue)("from",o)?(0,e.getValue)("from",o):r[s],l.to=(0,e.getValue)("to",o)?(0,e.getValue)("to",o):i.rowUniqueID,l.type=(0,e.getValue)("type",o)?(0,e.getValue)("type",o):"FS";var d=(0,e.getValue)("offset",o);if((0,e.isNullOrUndefined)(d))l.offset=0,(0,e.isNullOrUndefined)(this.parent.durationUnit)||(l.offsetUnit=this.parent.durationUnit.toLocaleLowerCase());else if("string"==typeof d){var h=this.getOffsetDurationUnit((0,e.getValue)("offset",o));l.offset=h.duration,l.offsetUnit=h.durationUnit}else l.offset=parseFloat(d.toString()),(0,e.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,t,a),i,!0);this.parent.setRecordValue("predecessorsName",this.getPredecessorStringValue(t),i,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,i.predecessorsName,t),this.parent.setRecordValue(this.parent.taskFields.dependency,i.predecessorsName,t)},t.prototype.updateUnscheduledDependency=function(t){for(var i=this.parent.taskFields,a=(0,e.isNullOrUndefined)(t[i.dependency])?[]:t[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=(0,e.isNullOrUndefined)(s)?null:(0,e.extend)({},{},s.taskData,!0);if(!(0,e.isNullOrUndefined)(o)&&(0,e.isNullOrUndefined)(o[i.startDate])&&(0,e.isNullOrUndefined)(o[i.duration])&&(0,e.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)}}}},t.prototype.checkIsParent=function(e){var t=!1;return this.parent.connectorLineModule.getRecordByID(e).hasChildRecords&&(t=!0),t},t.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},t.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){if(this.getRootParent(t).uniqueID===e.uniqueID)return!1}}return!0},t.prototype.calculatePredecessor=function(t,i,a){var r=this;void 0===a&&(a=null);var n,s,o,l=t.toString(),d=[],h=[],p=[];l.split(",").forEach(function(t){var l,u,c,g=!1,f=!1,m=t.split("-");if(6===m.length&&(m[4]=m[4]+"-"+m[5],m.pop()),5===m.length&&m[4].length>=12&&(c=t.substring(0,36),/^[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}$/.test(c)&&(g=!0)),t.includes("-")){var y=t.lastIndexOf("-"),D=t.substring(y+1),v=t.replace(D,"").trim().match(/(FS|SS|SF|FF)-$/),k=(v?v[0]:"")+D;if(!/^(FS|SS|SF|FF)/.test(k)){var b=k.match(/(FS|SS|SF|FF)/);k=b?b[0]+k.slice(k.indexOf(b[0])+b[0].length):t}if(u=k,t.includes("-")&&/[A-Za-z]/.test(u)){var w=t.indexOf(u);-1!==w&&(l=t.substring(0,w)).includes("-")&&(f=!0)}}if(g){var T=void 0,S=void 0;1===(T=m[4].split("+")).length?h[0]=t:(S=T[1].length,h[0]=t.slice(0,-(S+1)),h[1]=T[1]),s="+",m[4].indexOf("-")>=0&&(1===(T=m[4].split("-")).length?h[0]=t:(S=T[1].length,h[0]=t.slice(0,-(S+1)),h[1]=T[1]),s="-")}else f&&l.includes("-")?h[0]=l:(h=t.split("+"),s="+",t.indexOf("-")>=0&&(h=t.split("-"),s="-"));n=[];var P="ResourceView"===r.parent.viewType?r.parent.getTaskIds():r.parent.ids;-1!==("ResourceView"===r.parent.viewType?P.indexOf("T"+h[0]):P.indexOf(h[0]))?n[0]=h[0]:-1===P.indexOf(h[0])?1===(n=h[0].split(" ")).length&&(-1!==n[0].indexOf(" ")?n=h[0].match(/(\d+|[A-z]+)/g):(n[0]=h[0].slice(0,-2),n[1]=h[0].slice(-2))):n[0]=h[0];var C="ResourceView"===r.parent.viewType?P.indexOf("T"+n[0]):P.indexOf(n[0]);if(n[0]&&-1!==C){if(n.length>1)if("FS"===(M=n[1].toUpperCase())||"FF"===M||"SF"===M||"SS"===M)o=M;else{var R="The provided dependency type, "+M+", is invalid. Please ensure that the Dependency Type is FS or FF or SS or SF";r.parent.trigger("actionFailure",{error:R}),o="FS"}else if(t.includes("-")&&/[A-Za-z]/.test(u)&&l.includes("-")){var M;(M=t.slice(-2).toString()).toUpperCase(),o="FS"===M||"FF"===M||"SF"===M||"SS"===M?M:"FS"}else o="FS";var x=h.length>1?s+""+h[1]:"0",O=r.getOffsetDurationUnit(x),I={from:n[0],type:o,isDrawn:!1,to:"ResourceView"===r.parent.viewType?i.ganttProperties.taskId.toString():i.ganttProperties.rowUniqueID.toString(),offsetUnit:O.durationUnit,offset:O.duration},E=r.checkIsParent(n[0]);if(r.parent.allowParentDependency){var F=null,U=null;"ProjectView"===r.parent.viewType&&!(0,e.isNullOrUndefined)(a)&&a.size>0?(F=a.get(I.from),U=a.get(I.to)):(F=r.parent.connectorLineModule.getRecordByID(I.from),U=r.parent.connectorLineModule.getRecordByID(I.to));U&&F?r.validateParentPredecessor(F,U)&&(d.push(I),-1===p.indexOf(F)&&F.hasChildRecords&&r.parent.editModule&&r.parent.editModule.cellEditModule&&r.parent.editModule.cellEditModule.isCellEdit&&p.push((0,e.extend)([],[],[F],!0)[0])):d.push(I),n.splice(0)}else E||d.push(I)}}),p.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=p);var u=[];return d.map(function(e){var t,i=e.from,a=e.to;t=d.filter(function(e){return e.from===i&&e.to===a}),-1===u.indexOf(t[t.length-1])&&u.push(t[t.length-1])}),u},t.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},t.prototype.getOffsetDurationUnit=function(t){var i,a=0;(0,e.isNullOrUndefined)(this.parent.durationUnit)||(i=this.parent.durationUnit.toLocaleLowerCase());var r=this.parent.durationUnitEditText;if("string"==typeof t){for(var n=t.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!==(0,e.getValue)("minute",r).indexOf(i)?i="minute":-1!==(0,e.getValue)("hour",r).indexOf(i)?i="hour":-1!==(0,e.getValue)("day",r).indexOf(i)?i="day":(0,e.isNullOrUndefined)(this.parent.durationUnit)||(i=this.parent.durationUnit.toLocaleLowerCase()))}else a=t,(0,e.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,(0,e.isNullOrUndefined)(this.parent.durationUnit)||(i=this.parent.durationUnit.toLocaleLowerCase())}return{duration:a,durationUnit:i}},t.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)))},t.prototype.updatePredecessorHelper=function(t,i,a){void 0===a&&(a=null);var r,n=t.ganttProperties.predecessor,s=n.length;i=(0,e.isNullOrUndefined)(i)?[]:i;for(var o=0;o<s;o++){var l=n[o];r="ProjectView"!==this.parent.viewType||(0,e.isNullOrUndefined)(a)?this.parent.connectorLineModule.getRecordByID(l.from):a.get(l.from);var d="ResourceView"===this.parent.viewType?t.ganttProperties.taskId:t.ganttProperties.rowUniqueID;if(l.from!==d.toString()&&r){var h=void 0;r.ganttProperties.predecessor?((h=(0,e.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))}}},t.prototype.traverseParents=function(e,t){this.parent.dataOperation.updateParentItems(e,t)},t.prototype.updatedRecordsDateByPredecessor=function(t){if(void 0===t&&(t=null),this.parent.autoCalculateDateScheduling&&!(this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)){var i=this.parent.flatData,a=i.length;if((0,e.isNullOrUndefined)(t)){t=new Map;for(var r=0,n=i;r<n.length;r++){var s=n[r];t.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,t),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?t.get(c.to):this.parent.connectorLineModule.getRecordByID(c.to))&&this.validatePredecessorDates(g,t)}if(l.parentItem){var f=l.parentItem.taskId,m=void 0;(m="ProjectView"===this.parent.viewType?t.get(f):this.parent.getRecordByID(f))&&this.traverseParents(m,!0)}}}}},t.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)}},t.prototype.validatePredecessorDates=function(t,i){if(void 0===i&&(i=null),t.ganttProperties.predecessor){var a=t.ganttProperties.predecessor,r=void 0,n=void 0,s=null,o="ResourceView"===this.parent.viewType?t.ganttProperties.taskId.toString():t.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||(0,e.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;(0,e.isNullOrUndefined)(s)?(h=this.parent.editModule.taskbarEditModule.previousIds.indexOf(d.to),s=this.parent.editModule.taskbarEditModule.previousFlatData[h]):(0,e.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(t)&&(t.hasChildRecords||s.hasChildRecords)&&this.parentPredecessors.push(t),(s.ganttProperties.isAutoSchedule||this.parent.validateManualTasksOnLinking)&&this.validateChildGanttRecord(n,s,i)}}},t.prototype.getConstraintDate=function(e,t,i){switch(e){case D.AsSoonAsPossible:case D.AsLateAsPossible:return null;case D.MustStartOn:case D.StartNoEarlierThan:return t;case D.MustFinishOn:case D.FinishNoEarlierThan:case D.StartNoLaterThan:case D.FinishNoLaterThan:return i;default:return null}},t.prototype.validateChildGanttRecord=function(t,i,a){if(void 0===a&&(a=null),!(-1!==this.parent.editedPredecessorRecords.indexOf(i)||t&&(0,e.isNullOrUndefined)(r(t.ganttProperties))||i&&(0,e.isNullOrUndefined)(r(i.ganttProperties)))&&this.parent.isInPredecessorValidation&&(i.ganttProperties.isAutoSchedule||this.parent.validateManualTasksOnLinking)){var n=i.ganttProperties,s="ResourceView"===this.parent.viewType?n.taskId.toString():n.rowUniqueID.toString(),o=n.predecessor.filter(function(e){return e.to===s?e:null}),l=this.getPredecessorDate(i,o,a,!0);this.parent.setRecordValue("startDate",l,n,!0),this.parent.dataOperation.updateMappingData(i,"startDate"),this.parent.taskFields.constraintDate&&this.parent.taskFields.constraintType&&this.parent.updateOffsetOnTaskbarEdit&&this.parent.connectorLineEditModule.calculateOffset(i);var d=i.ganttProperties.segments;if(((0,e.isNullOrUndefined)(d)||!(0,e.isNullOrUndefined)(d)&&0===d.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 h=n.constraintType,p=n.startDate,u=n.endDate,c=this.getConstraintDate(h,p,u);this.parent.setRecordValue("constraintDate",c,n,!0),this.parent.dataOperation.updateMappingData(i,"constraintDate")}}},t.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()})},t.prototype.getPredecessorDate=function(t,i,a,r){var n,s,o,l;void 0===a&&(a=null);var d=this.filterPredecessorsByTarget(i,t,this.parent.viewType),h=!(0,e.isNullOrUndefined)(this.parent.taskFields.constraintDate)&&!(0,e.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||(0,e.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||(0,e.isNullOrUndefined)(l)&&(0,e.isNullOrUndefined)(o)||(l=(0,e.isNullOrUndefined)(l)?this.getRecord(o,l,c):l,o=(0,e.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(t.ganttProperties,n,r,d.length>0)),n},t.prototype.getValidatedStartDate=function(t,i,a){var r,n,s=a.type,o=a.offset;switch(s){case"FS":r=this.dateValidateModule.getValidEndDate(i),t.isMilestone&&0===o||(r=this.dateValidateModule.checkStartDate(r,t)),0!==o&&(r=this.updateDateByOffset(r,a,t)),n=t.isMilestone?r:this.dateValidateModule.checkStartDate(r,t);break;case"FF":case"SF":if(r="FF"===s?this.dateValidateModule.getValidEndDate(i):this.dateValidateModule.getValidStartDate(i),0!==o&&(r=this.updateDateByOffset(r,a,t)),!t.isMilestone){var l=new Date(r);l.setDate(l.getDate()-1),r=this.parent.allowUnscheduledTasks&&(0,e.isNullOrUndefined)(t.endDate)&&(0,e.isNullOrUndefined)(t.duration)?this.dateValidateModule.checkStartDate(r,t):this.dateValidateModule.checkEndDate(r,t)}if(t.segments&&0!==t.segments.length){var d=this.dateValidateModule.getDuration(t.startDate,t.endDate,t.durationUnit,t.isAutoSchedule,t.isMilestone);n=this.dateValidateModule.getStartDate(r,d,t.durationUnit,t)}else n=this.dateValidateModule.getStartDate(r,t.duration,t.durationUnit,t);break;case"SS":r=this.dateValidateModule.getValidStartDate(i),0!==o&&(r=this.updateDateByOffset(r,a,t)),n=t.isMilestone?r:this.dateValidateModule.checkStartDate(r,t)}return n},t.prototype.updateDateByOffset=function(t,i,a){var r,n=i.offset,s=i.offsetUnit;return n<0&&!(0,e.isNullOrUndefined)(t)?r=this.dateValidateModule.getStartDate(this.dateValidateModule.checkEndDate(t,a),-1*n,s,a,!0):((0,e.isNullOrUndefined)(t)||(r=this.dateValidateModule.getEndDate(t,n,s,a,!1)),a.isMilestone||(r=this.dateValidateModule.checkStartDate(r,a))),r},t.prototype.createConnectorLinesCollection=function(t){var i=t||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&&!(0,e.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=!(0,e.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=(0,e.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)}},t.prototype.addPredecessorsCollection=function(t,i,a){var r,n,s,o,l;if(void 0===i&&(i=null),void 0===a&&(a=0),t)for(r=t.length,n=0;n<r;n++){var d="from",h="to";if((s=t[n])[d]===s[h])break;"ProjectView"!==this.parent.viewType||(0,e.isNullOrUndefined)(i)?(o=this.parent.connectorLineModule.getRecordByID(s[d]),l=this.parent.connectorLineModule.getRecordByID(s[h])):(o=i.get(s[d]),l=i.get(s[h]));var p=!0;(o&&o.hasChildRecords&&!o.expanded||l&&l.hasChildRecords&&!l.expanded)&&!this.parent.allowTaskbarOverlap&&"ProjectView"===this.parent.viewType&&(p=!1),p&&this.parent.connectorLineModule.expandedRecords&&-1!==this.parent.connectorLineModule.expandedRecords.indexOf(o)&&-1!==this.parent.connectorLineModule.expandedRecords.indexOf(l)&&this.updateConnectorLineObject(o,l,s,a)}},t.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},t.prototype.shouldUpdatePredecessor=function(t,i,a,r,n){if((0,e.isNullOrUndefined)(i)||(0,e.isNullOrUndefined)(i.ganttProperties)||(0,e.isNullOrUndefined)(i.ganttProperties.taskId)||(0,e.isNullOrUndefined)(t)||(0,e.isNullOrUndefined)(t.ganttProperties))return!1;if(!n&&(0,e.isNullOrUndefined)(a)&&(0,e.isNullOrUndefined)(r))return!0;var s=t.ganttProperties.predecessor;if((0,e.isNullOrUndefined)(s)||!Array.isArray(s))return!1;var o=s.find(function(e){return e.to===i.ganttProperties.taskId.toString()});if((0,e.isNullOrUndefined)(o))return!1;var l=o.type,d=t.ganttProperties,h=i.ganttProperties;if((0,e.isNullOrUndefined)(d)||(0,e.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}},t.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))},t.prototype.validatePredecessor=function(t,i,a){if(this.parent.isInPredecessorValidation&&t.ganttProperties.predecessor){var r=this.parent.editModule.taskbarEditModule,n=void 0;r&&(n=r.taskBarEditRecord);for(var s=t.ganttProperties.predecessor,o=void 0,l=null,d=void 0,h=void 0,p="ResourceView"===this.parent.viewType?t.ganttProperties.taskId.toString():t.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||(0,e.isNullOrUndefined)(l)&&(0,e.isNullOrUndefined)(o)||(l=(0,e.isNullOrUndefined)(l)?this.getRecord(o,l,d):l,o=(0,e.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?t.ganttProperties.taskId:t.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||(0,e.isNullOrUndefined)(l)&&(0,e.isNullOrUndefined)(o)||(l=(0,e.isNullOrUndefined)(l)?this.getRecord(o,l,h):l,o=(0,e.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(var D=0;D<l.childRecords.length;D++){var v=l.childRecords[D].ganttProperties;if(-1!==this.isChildRecordValidated.indexOf(v.taskId))return;if(this.isChildRecordValidated.push(v.taskId),v.predecessor&&v.predecessor.length>0)for(var k=0;k<v.predecessor.length;k++){var b=void 0;(b=v.predecessor[k].to!==l.ganttProperties.taskId.toString()?this.parent.flatData[this.parent.ids.indexOf(v.predecessor[k].to)]:this.parent.flatData[this.parent.ids.indexOf(v.predecessor[k].from)])&&(this.validatePredecessor(b,[],""),b.hasChildRecords&&this.parent.editModule.editedRecord.hasChildRecords&&this.updateChildItems(b),this.isValidatedParentTaskID=b.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 w="ResourceView"===this.parent.viewType?this.parent.getTaskIds():this.parent.ids;this.storeId=JSON.parse(JSON.stringify(w)),this.parent.editModule.isFirstCall=!1}if(this.storeId){var T=void 0,S=l[this.parent.taskFields.id].toString();if("ResourceView"===this.parent.viewType){var P="T"+S;T=this.storeId.includes(P)?this.storeId.indexOf(P):-1}else T=this.storeId.indexOf(S);-1!==T&&(this.storeId=this.storeId.slice(0,T).concat(this.storeId.slice(T+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 C=!0;if(l&&l.hasChildRecords&&-1!==this.validatedParentIds.indexOf(l.ganttProperties.taskId.toString())&&(C=!1),C)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 R=this.parent.getParentTask(l.parentItem);T=this.storeId&&-1!==this.storeId.indexOf(R[this.parent.taskFields.id].toString())?this.storeId.indexOf(R[this.parent.taskFields.id].toString()):-1;if(R.ganttProperties.predecessor&&R.ganttProperties.predecessor.length>0&&-1!==T)for(D=0;D<R.ganttProperties.predecessor.length;D++){if(R.ganttProperties.predecessor[D].to!==R.ganttProperties.taskId.toString())(b=this.parent.flatData[this.parent.ids.indexOf(R.ganttProperties.predecessor[D].to)])&&b.parentItem&&this.validateChildGanttRecord(l,b)}}}else l&&l.hasChildRecords&&this.isValidatedParentTaskID!==l.ganttProperties.taskId&&!n&&(this.updateChildItems(l),this.isValidatedParentTaskID=l.ganttProperties.taskId)}},t.prototype.updateChildItems=function(t){var i=this;if(t.childRecords.length>0&&this.validatedChildItems&&this.validatedChildItems.length>0){if(!!t.childRecords.some(function(e){return i.validatedChildItems.includes(e)}))return}var a,n=this.parent.previousRecords[t.uniqueID];(0,e.isNullOrUndefined)(n)||(0,e.isNullOrUndefined)(n)&&!(0,e.isNullOrUndefined)(n.ganttProperties)?a=new Date(t.ganttProperties.startDate.getTime()):(0,e.isNullOrUndefined)(n.ganttProperties.startDate)||(a=new Date(n.ganttProperties.startDate.getTime()));var s,o,l,d,h,p=t.ganttProperties.startDate,u=[];if(this.getUpdatableChildRecords(t,u),0!==u.length){!(0,e.isNullOrUndefined)(a)&&!(0,e.isNullOrUndefined)(p)&&a.getTime()>p.getTime()?(s=this.parent.dateValidationModule.checkStartDate(p),o=this.parent.dateValidationModule.checkEndDate(a,t.ganttProperties),d=!1):(s=this.parent.dateValidationModule.checkStartDate(a),o=this.parent.dateValidationModule.checkEndDate(p,t.ganttProperties),d=!0),h=!(0,e.isNullOrUndefined)(s)&&!(0,e.isNullOrUndefined)(o)&&s.getTime()>=o.getTime()?0:this.parent.dateValidationModule.getDuration(s,o,"minute",!0,!1);for(var c=0;c<u.length;c++)if(u[c].ganttProperties.isAutoSchedule)if(h>0){var g=r(u[c].ganttProperties)||u[c].ganttProperties.startDate?u[c].ganttProperties.startDate:u[c].ganttProperties.endDate?u[c].ganttProperties.endDate:new Date(a.toString());l=d?this.parent.dateValidationModule.getEndDate(this.parent.dateValidationModule.checkStartDate(g,u[c].ganttProperties,u[c].ganttProperties.isMilestone),h,"minute",u[c].ganttProperties,!1):this.parent.dateValidationModule.getStartDate(this.parent.dateValidationModule.checkEndDate(g,u[c].ganttProperties),h,"minute",u[c].ganttProperties),this.calculateDateByRoundOffDuration(u[c],l),this.parent.isOnEdit&&-1===this.validatedChildItems.indexOf(u[c])&&this.validatedChildItems.push(u[c])}else(0,e.isNullOrUndefined)(n)&&(l=a,u[c].ganttProperties.startDate.getTime()<=l.getTime()&&this.calculateDateByRoundOffDuration(u[c],l),this.parent.isOnEdit&&-1===this.validatedChildItems.indexOf(u[c])&&this.validatedChildItems.push(u[c]));u.length&&this.parent.dataOperation.updateParentItems(t,!0)}},t.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))},t.prototype.calculateDateByRoundOffDuration=function(t,i){var a=t,r=a.ganttProperties,n=new Date(i.getTime());if(!(0,e.isNullOrUndefined)(r.endDate)&&(0,e.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),(0,e.isNullOrUndefined)(r.duration)||this.parent.dateValidationModule.calculateEndDate(a);this.parent.dataOperation.updateWidthLeft(t),this.parent.dataOperation.updateTaskData(a)},t.prototype.getRecord=function(t,i,a){var r,n;return(0,e.isNullOrUndefined)(i)?(r=this.parent.editModule.taskbarEditModule.previousIds.indexOf(a.to),n=this.parent.editModule.taskbarEditModule.previousFlatData[r]):(0,e.isNullOrUndefined)(t)&&(r=this.parent.editModule.taskbarEditModule.previousIds.indexOf(a.from),n=this.parent.editModule.taskbarEditModule.previousFlatData[r]),n},t.prototype.getValidPredecessor=function(t){var i=this,a=[];if(!(0,e.isNullOrUndefined)(t)){var r=t.ganttProperties.predecessor;r&&r.length>0&&(a=r.filter(function(e){var a="ResourceView"===i.parent.viewType?t.ganttProperties.taskId:t.ganttProperties.rowUniqueID;return e.from!==a.toString()}))}return a},t}(),oi=m(727),li=function(){function t(t){this.transform="",this.connectorLinePath="",this.arrowPath="",this.taskLineValue=0,this.expandedRecords=[],this.parent=t,this.dependencyViewContainer=(0,e.createElement)("div",{className:"e-gantt-dependency-view-container"}),Object.assign(this.dependencyViewContainer.style,{width:"100%",height:"100%",zIndex:2,position:"absolute",pointerEvents:"none"}),this.renderer=new oi.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 t.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},t.prototype.initPublicProp=function(){this.lineColor=this.parent.connectorLineBackground,this.lineStroke=this.parent.connectorLineWidth>4?4:this.parent.connectorLineWidth,this.createConnectorLineTooltipTable()},t.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},t.prototype.createConnectorLineObject=function(t,i,a,n){void 0===n&&(n=0);var s,o,l,d={};if(s=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,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 h=this.parent.flatData.filter(function(e){return e.ganttProperties.taskId.toString()===t.ganttProperties.taskId.toString()})[0],p=this.parent.flatData.filter(function(e){return e.ganttProperties.taskId.toString()===i.ganttProperties.taskId.toString()})[0];o=h.index,l=p.index}else o=s.indexOf(t),l=s.indexOf(i);var u,c=t.ganttProperties,g=i.ganttProperties;if(u=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,d.parentIndexInCurrentView=u.indexOf(t),d.childIndexInCurrentView=u.indexOf(i),!(this.parent.virtualScrollModule&&this.parent.enableVirtualization)&&(-1===d.parentIndexInCurrentView||-1===d.childIndexInCurrentView)||-1===d.parentIndexInCurrentView&&-1===d.childIndexInCurrentView)return null;if(d.parentLeft=c.isMilestone?c.left-this.parent.chartRowsModule.milestoneHeight/2:c.left,d.childLeft=g.isMilestone?g.left-this.parent.chartRowsModule.milestoneHeight/2:g.left,d.parentWidth=0===c.width||c.isMilestone?Math.floor(this.parent.chartRowsModule.milestoneHeight):c.width,d.childWidth=0===g.width||g.isMilestone?Math.floor(this.parent.chartRowsModule.milestoneHeight):g.width,d.parentIndex=o,d.childIndex=l,0===n){var f=this.parent.ganttChartModule.getChartRows();d.rowHeight=!(0,e.isNullOrUndefined)(f)&&f[0]&&f[0].offsetHeight}else d.rowHeight=n;d.type=a.type;var m="ResourceView"===this.parent.viewType?c.taskId:c.rowUniqueID,y="ResourceView"===this.parent.viewType?g.taskId:g.rowUniqueID;return d.connectorLineId="parent"+m+"child"+y,d.milestoneParent=!!c.isMilestone,d.milestoneChild=!!g.isMilestone,d.parentEndPoint=d.parentLeft+d.parentWidth,d.childEndPoint=d.childLeft+d.childWidth,(0,e.isNullOrUndefined)(r(c))||(0,e.isNullOrUndefined)(r(g))?null:d},t.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")},t.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},t.prototype.getHeightValue=function(){return this.parent.showOverAllocation&&this.parent.allowTaskbarOverlap,this.parentRowIndexHeight>this.childRowIndexHeight?this.parentRowIndexHeight-this.childRowIndexHeight:this.childRowIndexHeight-this.parentRowIndexHeight},t.prototype.getInnerElementWidthSSType2=function(e){return e.parentLeft===e.childLeft?10:e.childLeft-e.parentLeft},t.prototype.getInnerElementLeftSSType2=function(e){return e.parentLeft===e.childLeft?e.parentLeft-20:e.parentLeft-10},t.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},t.prototype.calculateAdjustments=function(t,i,a){var r=this.parent.renderBaseline?.45:!(0,e.isNullOrUndefined)(document.body.className)&&document.body.className.includes("e-bigger")?.7:.62,n=Math.floor(this.parent.rowHeight*r);return(0,e.isNullOrUndefined)(this.parent.taskbarHeight)&&t<=36||!(0,e.isNullOrUndefined)(this.parent.taskbarHeight)&&this.parent.taskbarHeight<=n||!i||t<=36?{adjustY1:0,adjustX:0,adjustY2:0,adjustZ:0}:{adjustY1:(t-36)/("FSType2"===a||"FSType3"===a||"FSType4"===a||"SSType1"===a||"SSType2"===a||"SSType4"===a||"SFType2"===a?12:24),adjustX:-(t-36)/4,adjustZ:-2*(t-36)/24}},t.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":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"FSType3":case"FFType2":case"SFType2":case"SSType2":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}},t.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++)}}},t.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;if(this.parent.showOverAllocation&&!this.parent.allowTaskbarOverlap){for(var g=0;g<this.parent.currentViewData.length;g++)"none"!==this.parent.getRowByIndex(g).style.display&&c<e.parentIndex&&(c++,this.parent.getRowByIndex(g).offsetHeight);c=0;for(var f=0;f<this.parent.currentViewData.length;f++)"none"!==this.parent.getRowByIndex(f).style.display&&c<e.childIndex&&(c++,u+=this.parent.getRowByIndex(f).offsetHeight)}var m=this.parent.connectorLineModule.expandedRecords;if(m[e.parentIndex]&&m[e.childIndex]&&this.parent.allowParentDependency){var y=m[e.parentIndex].hasChildRecords,D=m[e.childIndex].hasChildRecords,v=m[e.parentIndex].ganttProperties.isAutoSchedule,k=m[e.childIndex].ganttProperties.isAutoSchedule,b=!0;(y&&v&&!D||D&&k&&!y||y&&v&&k&&D||!y&&!D)&&(b=!1),b&&(y&&!v&&D&&!k?p=-11:y&&!v&&D&&!k||(e.childIndex>e.parentIndex?!y&&D?h=-11:(h=11,p=-11):y&&!D?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&&v&&!k||e.childIndex<e.parentIndex&&!v&&k)&&(p=0,h=-11),o+=p)}var w=this.getParentPosition(e);if(w){var T=this.getParentPosition(e),S=this.parent.rowHeight,P=this.calculateAdjustments(S,n,T);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:Te}),this.connectorPath=this.renderer.drawPath({class:Se,d:this.connectorLinePath,fill:"transparent","stroke-width":this.lineStroke}),this.arrowlinePath=this.renderer.drawPath({d:this.arrowPath,class:Re});var C=this.lineColor&&!this.parent.enableCriticalPath?this.lineColor:"";this.connectorPath.style.stroke=C,this.arrowlinePath.style.fill=C,this.groupObject.appendChild(this.connectorPath),this.groupObject.appendChild(this.arrowlinePath);var R=this.shouldAdjustForBaseline(e,w);if("FSType1"===w&&(this.taskLineValue=e.milestoneChild?1:0,this.x1=e.parentEndPoint+(e.milestoneParent||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-R)+" L "+(this.x1+this.x2+P.adjustZ)+" "+(this.y1-R)+" L "+(this.x1+this.x2+P.adjustZ)+" "+(this.y1+this.y2+P.adjustY1)+" L "+(this.x1+this.x2+12+P.adjustX)+" "+(this.y1+this.y2+P.adjustY1),this.arrowPath="M "+(this.x1+this.x2+20+P.adjustX)+" "+(this.y1+this.y2+P.adjustY1)+" L "+(this.x1+this.x2+12+P.adjustX)+" "+(this.y1+this.y2-(4+this.lineStroke)+P.adjustY1)+" L "+(this.x1+this.x2+12+P.adjustX)+" "+(this.y1+this.y2+4+P.adjustY1)+" Z"),"FSType2"===w&&(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:u,this.connectorLinePath="M "+(this.x1+this.x2)+" "+(this.y1-R)+"  L "+(this.x1+this.x3)+" "+(this.y1-R)+" L "+(this.x1+this.x3)+" "+this.y4+" L "+(this.x1+this.x4+P.adjustZ)+" "+this.y4+" L "+(this.x1+this.x4+P.adjustZ)+" "+(this.y1+this.y2+this.y3+P.adjustY1)+" L "+(this.x1+this.x4+12+P.adjustX)+" "+(this.y1+this.y2+this.y3+P.adjustY1),this.arrowPath="M "+(this.x1+this.x4+20+P.adjustX)+" "+(this.y1+this.y2+this.y3+P.adjustY1)+" L "+(this.x1+this.x4+12+P.adjustX)+" "+(this.y1+this.y2+this.y3-(4+this.lineStroke)+P.adjustY1)+" L "+(this.x1+this.x4+12+P.adjustX)+" "+(this.y1+this.y2+this.y3+4+this.lineStroke+P.adjustY1)+" Z"),"FSType3"===w&&(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-R+P.adjustY1)+" L "+this.x1+" "+(this.y1-R+P.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+P.adjustX)+" "+(this.y1-R+P.adjustY1)+" L "+(this.x1+12+P.adjustX)+" "+(this.y1-(4+this.lineStroke)-R+P.adjustY1)+" L "+(this.x1+12+P.adjustX)+" "+(this.y1+4+this.lineStroke-R+P.adjustY1)+" Z"),"FSType4"===w&&(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+P.adjustY1)+" L "+(this.x1+this.x2)+" "+(this.y1+P.adjustY1)+" L "+(this.x1+this.x2)+" "+(this.y2-R)+" L "+this.x1+" "+(this.y2-R),this.arrowPath="M "+(this.x1+this.x2+20+P.adjustX)+" "+(this.y1+P.adjustY1)+" L "+(this.x1+this.x2+12+P.adjustX)+" "+(this.y1-(4+this.lineStroke)+P.adjustY1)+" L "+(this.x1+this.x2+12+P.adjustX)+" "+(this.y1+4+this.lineStroke+P.adjustY1)+" Z"),"SSType4"===w){var M=0!==P.adjustX?P.adjustX+2:P.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+M)+" "+this.y1+" L "+this.x1+" "+this.y1+" L "+this.x1+" "+(this.y2-R)+" L "+(this.x1+10)+" "+(this.y2-R),this.arrowPath="M "+(this.x1+this.x2+8+M)+" "+this.y1+" L "+(this.x1+this.x2+M)+" "+(this.y1-(4+this.lineStroke))+" L "+(this.x1+this.x2+M)+" "+(this.y1+4+this.lineStroke)+" Z"}if("SSType3"===w&&(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+P.adjustX)+" "+this.y1+" L "+this.x1+" "+this.y1+" L "+this.x1+" "+(this.y2-R)+" L "+(this.x1+this.x2)+" "+(this.y2-R),this.arrowPath="M "+(this.x1+20+P.adjustX)+" "+this.y1+" L "+(this.x1+12+P.adjustX)+" "+(this.y1-(4+this.lineStroke))+" L "+(this.x1+12+P.adjustX)+" "+(this.y1+4+this.lineStroke)+" Z"),"SSType2"===w){M=0!==P.adjustX?P.adjustX+2:P.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+P.adjustY1-R)+" L "+(this.x1+i+M)+" "+(this.y2+P.adjustY1-R),this.arrowPath="M "+(this.x1+i+8+M)+" "+(this.y2+P.adjustY1-R)+" L "+(this.x1+i+M)+" "+(this.y2-(4+this.lineStroke)+P.adjustY1-R)+" L "+(this.x1+i+M)+" "+(this.y2+4+this.lineStroke+P.adjustY1-R)+" Z"}if("SSType1"===w&&(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+P.adjustY1-R)+" L "+(this.x1+12+P.adjustX)+" "+(this.y2+P.adjustY1-R),this.arrowPath="M "+(this.x1+20+P.adjustX)+" "+(this.y2+P.adjustY1-R)+" L "+(this.x1+12+P.adjustX)+" "+(this.y2-(4+this.lineStroke)+P.adjustY1-R)+" L "+(this.x1+12+P.adjustX)+" "+(this.y2+4+this.lineStroke+P.adjustY1-R)+" Z"),"FFType1"===w){M=0!==P.adjustX?P.adjustX+11:P.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+P.adjustY1-R)+" L "+(this.x1+this.x4)+" "+(this.y1+this.y2+P.adjustY1-R),this.arrowPath="M "+(this.x1+M)+" "+(this.y1+this.y2+P.adjustY1-R)+" L "+(this.x1+8+M)+" "+(this.y1+this.y2-(4+this.lineStroke)+P.adjustY1-R)+" L "+(this.x1+8+M)+" "+(this.y1+this.y2+4+this.lineStroke+P.adjustY1-R)+" Z"}if("FFType2"===w){M=0!==P.adjustX?P.adjustX+11:P.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;var x=this.parent.renderBaseline?0:M;this.connectorLinePath="M "+this.x1+" "+this.y1+" L "+this.x2+" "+this.y1+" L "+this.x2+" "+(this.y1+this.y2+P.adjustY1-R)+" L "+this.x3+" "+(this.y1+this.y2+P.adjustY1-R),this.arrowPath="M "+(this.x3-8+x)+" "+(this.y1+this.y2+P.adjustY1-R)+" L "+(this.x3+x)+" "+(this.y1+this.y2-(4+this.lineStroke)+P.adjustY1-R)+" L "+(this.x3+x)+" "+(this.y1+this.y2+4+this.lineStroke+P.adjustY1-R)+" Z"}if("FFType3"===w){M=0!==P.adjustX?P.adjustX+11:P.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-R)+" L "+this.x4+" "+(this.y1+this.y2-R),this.arrowPath="M "+(this.x1+M)+" "+this.y1+" L "+(this.x1+8+M)+" "+(this.y1-(4+this.lineStroke))+" L "+(this.x1+8+M)+" "+(this.y1+4+this.lineStroke)+" Z"}if("FFType4"===w){M=0!==P.adjustX?P.adjustX+11:P.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:M;this.connectorLinePath="M "+this.x2+" "+this.y1+" L "+this.x3+" "+this.y1+" L "+this.x3+" "+(this.y1+this.y2-R)+" L "+this.x1+" "+(this.y1+this.y2-R),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"===w){M=0!==P.adjustX?P.adjustX+11:P.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:M;this.connectorLinePath="M "+this.x2+" "+(this.y1-P.adjustY1)+" L "+this.x3+" "+(this.y1-P.adjustY1)+" L "+this.x3+" "+this.y4+" L "+this.x1+" "+this.y4+" L "+this.x1+" "+(this.y2+this.y3-R)+" L "+(this.x1+11)+" "+(this.y2+this.y3-R),this.arrowPath="M "+(this.x2-8+x)+" "+(this.y1-P.adjustY1)+" L "+(this.x2+x)+" "+(this.y1-(4+this.lineStroke)-P.adjustY1)+" L "+(this.x2+x)+" "+(this.y1+4+this.lineStroke-P.adjustY1)+" Z"}if("SFType3"===w){M=0!==P.adjustX?P.adjustX+11:P.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-R)+" L "+(this.x3+this.point1)+" "+(this.y2-R),this.arrowPath="M "+(this.x2-8+M)+" "+this.y1+" L "+(this.x2+M)+" "+(this.y1-(4+this.lineStroke))+" L "+(this.x2+M)+" "+(this.y1+4+this.lineStroke)+" Z"}if("SFType1"===w){M=0!==P.adjustX?P.adjustX+11:P.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;x=this.parent.renderBaseline?0:M;this.connectorLinePath="M "+(this.x1+11)+" "+(this.y1-R)+" L "+this.x1+" "+(this.y1-R)+" L "+this.x1+" "+this.y3+" L "+(this.x1+this.x2)+" "+this.y3+" L "+(this.x1+this.x2)+" "+(this.y2+this.point2+P.adjustY1)+" L "+(this.x1+this.x3)+" "+(this.y2+this.point2+P.adjustY1),this.arrowPath="M "+(this.x1+this.x3-8+x)+" "+(this.y2+this.point2+P.adjustY1)+" L "+(this.x1+this.x3+x)+" "+(this.y2+this.point2-(4+this.lineStroke)+P.adjustY1)+" L "+(this.x1+this.x3+x)+" "+(this.y2+this.point2+4+this.lineStroke+P.adjustY1)+" Z"}if("SFType2"===w){M=0!==P.adjustX?P.adjustX+11:P.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+P.adjustY1-R)+" L "+(this.x1+8)+" "+(this.y2+P.adjustY1-R),this.arrowPath="M "+(this.x1+M)+" "+(this.y2+P.adjustY1-R)+" L "+(this.x1+8+M)+" "+(this.y2-(4+this.lineStroke)+P.adjustY1-R)+" L "+(this.x1+8+M)+" "+(this.y2+4+this.lineStroke+P.adjustY1-R)+" Z"}this.connectorPath.setAttribute("d",this.connectorLinePath),this.arrowlinePath.setAttribute("d",this.arrowPath)}return this.groupObject},t.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}},t.prototype.createConnectorLineTooltipTable=function(){this.tooltipTable=(0,e.createElement)("table",{className:".e-tooltiptable",styles:"margin-top:0px",attrs:{cellspacing:"2px",cellpadding:"2px"}});var t=(0,e.createElement)("tbody");t.innerHTML="",this.tooltipTable.appendChild(t)},t.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},t.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},t.prototype.getRecordByID=function(t){return(0,e.isNullOrUndefined)(t)?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(e){return e.ganttProperties.taskId.toString()===t.toString()})[0]:"ResourceView"===this.parent.viewType?this.parent.flatData[this.parent.getTaskIds().indexOf("T"+t.toString())]:this.parent.getRecordByID(t)},t.prototype.removePreviousConnectorLines=function(t){for(var i,a=(i=!0===(0,e.isObject)(t))?Object.keys(t).length:t.length,r=Object.keys(t),n=0;n<a;n++){var s=void 0;if(i)s=t[r[n]];else s=t[n];var o=s.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)}}},t.prototype.removeConnectorLineById=function(t){var i=this.parent.connectorLineModule.dependencyViewContainer.querySelector("#ConnectorLine"+t.replace(/([.])/g,"\\$1"));(0,e.isNullOrUndefined)(i)||(0,e.remove)(i)},t}(),di=m(40),hi=function(){function t(e){this.isSplitterResized=!1,this.parent=e,this.parent.on("destroy",this.destroy,this)}return t.prototype.renderSplitter=function(){var t=this,a=this.calculateSplitterPosition(this.parent.splitterSettings);this.parent.splitterElement=(0,e.createElement)("div",{className:"e-gantt-splitter"}),this.parent.treeGridPane=(0,e.createElement)("div",{className:"e-gantt-tree-grid-pane"}),this.parent.chartPane=(0,e.createElement)("div",{className:"e-gantt-chart-pane"}),(0,e.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 di.Splitter({height:null,width:this.parent.ganttWidth.toString(),enableRtl:this.parent.enableRtl,separatorSize:this.parent.splitterSettings.separatorSize,paneSettings:[{resizable:!0,size:a,min:this.getSpliterPositionInPercentage(this.parent.splitterSettings.minimum)},{resizable:!0}],orientation:"Horizontal",resizeStart:function(e){t.parent.contextMenuModule&&t.parent.contextMenuModule.isOpen&&t.parent.contextMenuModule.contextMenu.close();var a=e.pane[0],r=e.pane[1];t.splitterPreviousPositionGrid=a.scrollWidth+1+"px",t.splitterPreviousPositionChart=r.scrollWidth+1+"px";var n=new i.Deferred;return t.parent.trigger("splitterResizeStart",e,function(e){n.resolve(e)}),n},resizing:function(e){t.parent.trigger("splitterResizing",e),t.parent.timelineModule.isZoomToFit&&t.parent.timelineModule.updateTimelineAfterZooming(t.parent.timelineModule.timelineEndDate,!0)},resizeStop:function(a){t.parent.calculateDimensions(),t.isSplitterResized=!0;var r=a.pane[0];t.splitterPreviousPositionGrid=r.scrollWidth+1+"px",t.splitterObject.paneSettings[0].size=t.getSpliterPositionInPercentage(t.splitterPreviousPositionGrid),t.parent.splitterSettings.position=t.splitterObject.paneSettings[0].size;var n=new i.Deferred;return t.parent.trigger("splitterResized",a,function(i){!0===i.cancel&&(t.splitterObject.paneSettings[0].size=null,t.splitterObject.paneSettings[0].size=t.getSpliterPositionInPercentage(t.splitterPreviousPositionGrid),t.parent.splitterSettings.position=t.splitterObject.paneSettings[0].size,t.splitterObject.paneSettings[1].size=null,t.splitterObject.paneSettings[1].size=t.getSpliterPositionInPercentage(t.splitterPreviousPositionChart)),(0,e.isNullOrUndefined)(t.parent.projectEndDate)&&t.parent.timelineModule.updateTimelineAfterZooming(t.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(a.replace("%","")),s=Math.min(100,Math.max(0,n));r.setAttribute("aria-valuenow",s.toString())}},t.prototype.calculateSplitterPosition=function(t){if(!(0,e.isNullOrUndefined)(this.splitterObject)&&this.parent.enablePersistence)return this.splitterObject.paneSettings[0].size;if("Grid"===t.view)return this.parent.enableRtl?"0%":"100%";if("Chart"===t.view)return this.parent.enableRtl?"100%":"0%";if((0,e.isNullOrUndefined)(t.position)||""===t.position){if(!(0,e.isNullOrUndefined)(t.columnIndex)&&t.columnIndex>=0)return 150*t.columnIndex<this.parent.ganttWidth||!this.parent.element.classList.contains("e-device")?this.getSpliterPositionInPercentage(this.getTotalColumnWidthByIndex(t.columnIndex).toString()+"px"):this.getSpliterPositionInPercentage(130*t.columnIndex+"px");var i=this.parent.ganttWidth-250+"px";return this.parent.enableRtl?this.getSpliterPositionInPercentage(i):this.getSpliterPositionInPercentage("250px")}return this.getSpliterPositionInPercentage(t.position)},t.prototype.getSpliterPositionInPercentage=function(t){var i=(0,e.isNullOrUndefined)(t)||""===t?null:t;if(!(0,e.isNullOrUndefined)(i))if(-1!==t.indexOf("px")){var a=parseInt(t,10);i=a/this.parent.ganttWidth*100<=100?a/this.parent.ganttWidth*100+"%":"25%"}else{if(this.parent.enableRtl)i=100-parseFloat(t)+"%";else i=-1===t.indexOf("%")?t+"%":t}return i},t.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(var r=0;r<e;r++)t+=parseInt(a[r].width,10);t=i-t}else for(r=0;r<e;r++)t+=parseInt(a[r].width,10);return t},t.prototype.updateSplitterPosition=function(){this.splitterObject.separatorSize=this.parent.splitterSettings.separatorSize;var t=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=t),this.isSplitterResized=!1,(0,e.isNullOrUndefined)(this.parent.projectEndDate)&&this.parent.timelineModule.updateTimelineAfterZooming(this.parent.timelineModule.timelineEndDate,!0)},t.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))},t.prototype.destroy=function(){this.splitterObject.destroy(),this.parent.off("destroy",this.destroy)},t}(),pi=function(){function r(e){this.parent=e,this.createTooltip(),this.parent.on("destroy",this.destroy,this)}return r.prototype.createTooltip=function(){this.toolTipObj=new t.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=Ne,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)},r.prototype.tooltipBeforeRender=function(t){var r=this.parent;if(r.isOnEdit)t.cancel=!0;else{var n,s,o=(0,e.closest)(t.target,"div."+A);n=(0,e.isNullOrUndefined)(o)?a(t.target,X):t.target;var l={data:{},args:t,cancel:!1,content:""};if(t.target.classList.contains("e-header-cell-label"))if(r.timelineSettings.showTooltip){var d=t.target.getAttribute("data-tier"),h={date:t.target.title,value:(0,e.isNullOrUndefined)(r.timelineTemplate)?t.target.textContent:t.target.getAttribute("value"),tier:d},p=r.tooltipSettings.timeline?r.tooltipModule.templateCompiler(r.tooltipSettings.timeline,r,(0,e.extend)({},h),"TooltipTaskbarTemplate"):null,u=document.createElement("div");p?((0,e.append)(p,u),l.content=this.toolTipObj.content=u):l.content=this.toolTipObj.content=r.tooltipModule.getTooltipContent("timeline",s,r,t)}else t.cancel=!0;else if(r.tooltipSettings.showTooltip)if(n&&(l.data=r.ganttChartModule.getRecordByTaskBar(n),s=l.data),t.target.classList.contains("e-gantt-child-taskbar")||t.target.classList.contains("e-gantt-parent-taskbar")||t.target.classList.contains("e-gantt-milestone")||t.target.classList.contains("e-gantt-unscheduled-taskbar")||t.target.classList.contains("e-taskbar-left-resizer")||t.target.classList.contains("e-taskbar-right-resizer")||t.target.classList.contains("e-gantt-manualparenttaskbar")&&r.tooltipSettings.taskbar){var c=void 0;r.tooltipSettings.taskbar&&(c=r.tooltipModule.templateCompiler(r.tooltipSettings.taskbar,r,s,"TooltipTaskbarTemplate"));u=document.createElement("div");c&&(0,e.append)(c,u),l.content=this.toolTipObj.content=c?u:s?r.tooltipModule.getTooltipContent(s.ganttProperties.isMilestone?"milestone":"taskbar",s,r,t):""}else if(t.target.classList.contains("e-baseline-bar")||t.target.classList.contains("e-baseline-gantt-milestone-container")){var g=void 0;r.tooltipSettings.baseline&&(g=r.tooltipModule.templateCompiler(r.tooltipSettings.baseline,r,s,"TooltipBaselineTemplate"));var f=document.createElement("div");g&&(0,e.append)(g,f),l.content=this.toolTipObj.content=g?f:s?r.tooltipModule.getTooltipContent(s.ganttProperties.isMilestone?"milestone":"baseline",s,r,t):""}else if(t.target.classList.contains("e-event-markers"))l.content=this.toolTipObj.content=r.tooltipModule.getTooltipContent("marker",s,r,t);else if(t.target.classList.contains("e-connector-line-container")){var m=void 0;r.tooltipModule.predecessorTooltipData=r.tooltipModule.getPredecessorTooltipData(t),l.data=this.predecessorTooltipData,r.tooltipSettings.connectorLine&&(m=r.tooltipModule.templateCompiler(r.tooltipSettings.connectorLine,r,r.tooltipModule.predecessorTooltipData,"TooltipConnectorLineTemplate")),l.content=this.toolTipObj.content=m?m[0]:r.tooltipModule.getTooltipContent("connectorLine",s,r,t)}else if(t.target.classList.contains("e-indicator-span"))l.content=this.toolTipObj.content=r.tooltipModule.getTooltipContent("indicator",s,r,t),(0,e.isNullOrUndefined)(l.content)&&(t.cancel=!0);else if(t.target.classList.contains("e-notes-info")){var y=this.parent.ganttChartModule.getRecordByTarget(t.event);l.content=this.toolTipObj.content=y.ganttProperties.notes,(0,e.isNullOrUndefined)(l.content)&&(t.cancel=!0)}else t.target.classList.contains("e-gantt-manualparenttaskbar")?(l.content=this.toolTipObj.content=r.tooltipModule.getTooltipContent("manualtaskbar",s,r,t),(0,e.isNullOrUndefined)(l.content)&&(t.cancel=!0)):t.target.classList.contains("e-gantt-manualparent-milestone")&&(l.content=this.toolTipObj.content=r.tooltipModule.getTooltipContent("manualmilestone",s,r,t),(0,e.isNullOrUndefined)(l.content)&&(t.cancel=!0));else t.cancel=!0;if(!1===t.cancel){var D=new i.Deferred;return r.trigger("beforeTooltipRender",l,function(e){D.resolve(e),e.cancel&&(t.cancel=!0)}),this.toolTipObj.content=l.content,this.parent.isAdaptive||"mouseover"!==t.event.type||(this.currentTarget=t.target,e.EventHandler.add(this.currentTarget,"mousemove",this.mouseMoveHandler.bind(this))),this.parent.renderTemplates(),D}}},r.prototype.tooltipCloseHandler=function(t){this.tooltipMouseEvent=null,this.parent.isAdaptive||(0,e.isNullOrUndefined)(this.currentTarget)||e.EventHandler.remove(this.currentTarget,"mousemove",this.mouseMoveHandler),this.currentTarget=null},r.prototype.mouseMoveHandler=function(e){this.tooltipMouseEvent=e},r.prototype.updateTooltipPosition=function(t){t.element.style.visibility="visible";var i=this.parent.element.closest('[style*="zoom"]');if((0,e.isNullOrUndefined)(i)){if((0,e.isNullOrUndefined)(this.tooltipMouseEvent)||t.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+t.element.offsetWidth+10)for(;s<o+t.element.offsetWidth+10;)o=s-t.element.offsetWidth-10,t.element.style.left=o+"px";else o+=10,t.element.style.left=o+"px";t.event.clientY>t.element.offsetHeight?(window.innerHeight<t.element.offsetHeight+l&&(l=l-t.element.offsetHeight-10),n<l+t.element.offsetHeight+20?l=l-t.element.offsetHeight-10:l+=10):l+=10,t.element.style.top=l+"px"}},r.prototype.getPointorPosition=function(t){var i,a;return(0,e.isNullOrUndefined)((0,e.getValue)("pageX",t))&&(0,e.isNullOrUndefined)((0,e.getValue)("pageY",t))?(0,e.isNullOrUndefined)((0,e.getValue)("clientX",t))&&(0,e.isNullOrUndefined)((0,e.getValue)("clientY",t))||(i=(0,e.getValue)("clientX",t)+document.body.scrollLeft+document.documentElement.scrollLeft,a=(0,e.getValue)("clientY",t)+document.body.scrollTop+document.documentElement.scrollTop):(i=(0,e.getValue)("pageX",t),a=(0,e.getValue)("pageY",t)),{x:i,y:a}},r.prototype.getTooltipContent=function(t,i,a,r){var n,s,o;if(i){var l=(s=i.ganttProperties).taskName;this.parent.enableHtmlSanitizer&&"string"==typeof l&&(l=e.SanitizeHtmlHelper.sanitize(l)),o=(0,e.isNullOrUndefined)(l)?"":'<tr class = "e-gantt-tooltip-rowcell"><td colspan="3">'+(this.parent.disableHtmlEncode?l.replace(/</g,"&lt;").replace(/>/g,"&gt;"):l)+"</td></tr>"}switch(t){case"milestone":var d=void 0;r.target.className.includes("e-baseline-gantt-milestone-container")&&!(0,e.isNullOrUndefined)(s.baselineStartDate)?d=s.baselineStartDate:(0,e.isNullOrUndefined)(s.startDate)||(d=s.startDate);var h=this.parent.getFormatedDate(d,this.parent.getDateFormat());this.parent.enableHtmlSanitizer&&"string"==typeof h&&(h=e.SanitizeHtmlHelper.sanitize(h));var p=(0,e.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=(0,e.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?e.SanitizeHtmlHelper.sanitize(g):g,f="string"==typeof f?e.SanitizeHtmlHelper.sanitize(f):f,m=e.SanitizeHtmlHelper.sanitize(m));var D=s.startDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant(c?"startDate":"subTasksStartDate")+"</td><td class="+ve+'>:</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="+ve+'>:</td><td class = "e-gantt-tooltip-value">'+f+"</td></tr>":"",k=(0,e.isNullOrUndefined)(s.duration)?"":'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("duration")+"</td><td class="+ve+'>:</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="+ve+">:</td><td>"+y+"</td></tr>";u=function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+o+D+v+k+b+"</tbody></table>"};n=(0,e.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=e.SanitizeHtmlHelper.sanitize(w),T=e.SanitizeHtmlHelper.sanitize(T),S=e.SanitizeHtmlHelper.sanitize(S));u=function(){var t=this.parent.taskFields,i=s.baselineStartDate&&!(0,e.isNullOrUndefined)(t.baselineStartDate)?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("baselineStartDate")+"</td><td class="+ve+'>:</td><td class = "e-gantt-tooltip-value"> '+w+"</td></tr>":"",a=s.baselineEndDate&&!(0,e.isNullOrUndefined)(t.baselineEndDate)?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("baselineEndDate")+"</td><td class="+ve+'>:</td><td class = "e-gantt-tooltip-value">'+T+"</td></tr>":"",r=(0,e.isNullOrUndefined)(s.baselineDuration)||(0,e.isNullOrUndefined)(t.baselineDuration)?"":'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("baselineDuration")+"</td><td class="+ve+'>:</td><td class = "e-gantt-tooltip-value"> '+S+"</td></tr>";return'<table class = "e-gantt-tooltiptable"><tbody>'+o+i+a+r+"</tbody></table>"};n=(0,e.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=e.SanitizeHtmlHelper.sanitize(R),C=e.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,"&lt;").replace(/>/g,"&gt;"):R)+"</td></tr></tbody></table>"};n=(0,e.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=e.SanitizeHtmlHelper.sanitize(M),x=e.SanitizeHtmlHelper.sanitize(x),O=e.SanitizeHtmlHelper.sanitize(O),I=e.SanitizeHtmlHelper.sanitize(I),E=e.SanitizeHtmlHelper.sanitize(E),F=e.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,"&lt;").replace(/>/g,"&gt;"):M)+" ("+(this.parent.disableHtmlEncode&&"string"==typeof x?x.replace(/</g,"&lt;").replace(/>/g,"&gt;"):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,"&lt;").replace(/>/g,"&gt;"):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=(0,e.initializeCSPTemplate)(u,this);break;case"indicator":if(r.target.title.length){var U=r.target.title;this.parent.enableHtmlSanitizer&&"string"==typeof U&&(U=e.SanitizeHtmlHelper.sanitize(U));u=function(){return'<table class = "e-gantt-tooltiptable"><tbody><tr>'+U+"</tr></tbody></table>"};n=(0,e.initializeCSPTemplate)(u)}break;case"timeline":var N=r.target.title;this.parent.enableHtmlSanitizer&&"string"==typeof N&&(N=e.SanitizeHtmlHelper.sanitize(N));u=function(){return'<table class = "e-gantt-tooltiptable"><tbody><tr>'+N+"</tr></tbody></table>"};n=(0,e.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=e.SanitizeHtmlHelper.sanitize(L),V=e.SanitizeHtmlHelper.sanitize(V),B=e.SanitizeHtmlHelper.sanitize(B),A=e.SanitizeHtmlHelper.sanitize(A),W=e.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>",G='<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+G+j+z+"</tbody></table>"};n=(0,e.initializeCSPTemplate)(u);break;case"manualmilestone":var _=this.parent.getFormatedDate(s.autoStartDate,this.parent.getDateFormat()),Z=this.parent.getFormatedDate(s.autoEndDate,this.parent.getDateFormat()),X=this.parent.getFormatedDate(s.startDate,this.parent.getDateFormat());this.parent.enableHtmlSanitizer&&(_=e.SanitizeHtmlHelper.sanitize(_),Z=e.SanitizeHtmlHelper.sanitize(Z),X=e.SanitizeHtmlHelper.sanitize(X));var Y='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksStartDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+_+"</td></tr>",K='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksEndDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+Z+"</td></tr>",Q='<tr><td class = "e-gantt-tooltip-label"> Date</td><td>:</td><td class = "e-gantt-tooltip-value">'+X+"</tr>";u=function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+o+Q+Y+K+"</tbody></table>"};n=(0,e.initializeCSPTemplate)(u)}return n},r.prototype.getMarkerTooltipData=function(e){var t=e.target.id.match(/\d+/g);return this.parent.eventMarkers[Number(t)]},r.prototype.getPredecessorTooltipData=function(t){var i=t.target.id;this.parent.enableHtmlSanitizer&&"string"==typeof i&&(i=e.SanitizeHtmlHelper.sanitize(i));var a,r,n=i.match(/ConnectorLineparent(.*)child(.*)/);n.shift(),"ResourceView"===this.parent.viewType?(a=this.parent.flatData[this.parent.getTaskIds().indexOf("T"+n[0])],r=this.parent.flatData[this.parent.getTaskIds().indexOf("T"+n[1])]):(a=this.parent.flatData[this.parent.ids.indexOf(n[0])],r=this.parent.flatData[this.parent.ids.indexOf(n[1])]);var s=a.ganttProperties.predecessor.filter(function(e){return e.to===n[1]});return{fromId:"ResourceView"===this.parent.viewType?a.ganttProperties.taskId:a.ganttProperties.rowUniqueID,toId:"ResourceView"===this.parent.viewType?r.ganttProperties.taskId:r.ganttProperties.rowUniqueID,fromName:a.ganttProperties.taskName,toName:r.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)}},r.prototype.templateCompiler=function(t,i,a,r){var n=i.chartRowsModule.templateCompiler(t),s=i.chartRowsModule.getTemplateID(r);return n((0,e.extend)({index:0},a),i,r,s,!0)},r.prototype.destroy=function(){this.toolTipObj.destroy()},r}(),ui=function(){function t(e){this.isFromKeyboardAction=!1,this.parent=e,this.activeElement=null,this.previousActiveElement=null}return t.prototype.getActiveElement=function(e){return e?this.previousActiveElement:this.activeElement},t.prototype.setActiveElement=function(e){this.previousActiveElement=this.activeElement,this.activeElement=e},t.prototype.onKeyPress=function(t){var i=this.parent,a=t.target,r=i.getExpandedRecords(i.currentViewData);!(0,e.isNullOrUndefined)(this.parent.focusModule.getActiveElement())||"expandAll"!==t.action&&"collapseAll"!==t.action||this.parent.element.querySelector(".e-treegrid").focus();!this.parent.isEdit&&!(0,e.isNullOrUndefined)(a)&&a.closest(".e-headercell")&&"Enter"===t.key&&this.parent.sortModule&&this.parent.allowSorting&&(t.action="enter",this.parent.treeGrid.grid.notify("key-pressed",t));var n=this.parent.focusModule.getActiveElement();if("home"!==t.action&&"end"!==t.action&&"downArrow"!==t.action&&"upArrow"!==t.action&&"delete"!==t.action&&"rightArrow"!==t.action&&"leftArrow"!==t.action&&"focusTask"!==t.action&&"focusSearch"!==t.action&&"expandAll"!==t.action&&"collapseAll"!==t.action&&"undo"!==t.action&&"redo"!==t.action&&"selectAll"!==t.action||(0,e.isNullOrUndefined)(i.editModule)||(0,e.isNullOrUndefined)(i.editModule.cellEditModule)||!0!==i.editModule.cellEditModule.isCellEdit)switch(i.isAdaptive&&("addRowDialog"!==t.action&&"editRowDialog"!==t.action&&"delete"!==t.action&&"addRow"!==t.action||i.selectionModule&&"Multiple"===i.selectionSettings.type&&(i.selectionModule.hidePopUp(),document.getElementsByClassName("e-gridpopup")[0].style.display="none")),t.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":(m=i.element.querySelector("#"+i.element.id+"_searchbar"))&&m.parentElement.classList.contains("e-input-focus")&&i.selectionModule.clearSelection(),i.element.classList.contains("e-scroll-disabled")||(this.upDownKeyNavigate(t),(0,e.isNullOrUndefined)(n)||(0,e.isNullOrUndefined)(n.closest(".e-chart-row"))||i.ganttChartModule.manageFocus(this.getActiveElement(),"remove",!0,t.action),i.selectionSettings&&"Both"===i.selectionSettings.mode&&t.target instanceof HTMLElement&&t.target.classList.contains("e-cellselectionbackground")&&t.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(t);break;case"saveRequest":if(!(0,e.isNullOrUndefined)(i.editModule)&&!(0,e.isNullOrUndefined)(i.editModule.cellEditModule)&&i.editModule.cellEditModule.isCellEdit){var o=i.editModule.cellEditModule.editedColumn;if(o.field===i.columnMapping.duration&&!(0,e.isNullOrUndefined)(o.edit)&&!(0,e.isNullOrUndefined)(o.edit.read)){var l=t.target.ej2_instances[0],d=t.target.value,h=void 0;o.field===i.columnMapping.duration&&((0,e.isNullOrUndefined)(o.edit)||(0,e.isNullOrUndefined)(o.edit.read)||(h=o.edit.read()),d!==h.toString()&&(l.value=d,l.dataBind()))}if(i.editModule.dialogModule.dialogObj&&(0,e.getValue)("dialogOpen",i.editModule.dialogModule.dialogObj))return;i.treeGrid.grid.saveCell(),i.element.querySelector(".e-treegrid").focus()}if(!(0,e.isNullOrUndefined)(n)&&!(0,e.isNullOrUndefined)(n.closest(".e-chart-row"))){var p=t.target,u=n.querySelector(".e-gantt-parent-taskbar,.e-gantt-child-taskbar,.e-gantt-milestone");u&&this.parent.ganttChartModule.onTaskbarClick(t,p,u)}break;case"escape":(0,e.isNullOrUndefined)(i.editModule)||(0,e.isNullOrUndefined)(i.editModule.cellEditModule)||(i.editModule.cellEditModule.isCellEdit=!1,(0,e.isNullOrUndefined)(i.toolbarModule)||i.toolbarModule.refreshToolbarItems());break;case"addRow":if(i.editModule&&i.editModule.cellEditModule&&i.editModule.cellEditModule.isCellEdit)t.stopPropagation();else if((0,e.isNullOrUndefined)(document.getElementById(this.parent.element.id+"_dialog"))){t.preventDefault(),i.addRecord(void 0,this.parent.editSettings.newRowPosition,this.parent.selectedRowIndex),i.element.focus()}break;case"addRowDialog":if(t.preventDefault(),i.editModule&&i.editModule.dialogModule&&i.editSettings.allowAdding){if(i.editModule.dialogModule.dialogObj&&(0,e.getValue)("dialogOpen",i.editModule.dialogModule.dialogObj))return;i.editModule.dialogModule.openAddDialog()}break;case"editRowDialog":if(t.preventDefault(),i.element.querySelector(".e-treegrid").focus(),i.editModule&&i.editModule.dialogModule&&i.editSettings.allowEditing){if(i.editModule.dialogModule.dialogObj&&(0,e.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)&&((0,e.isNullOrUndefined)(t.target)||"INPUT"!==t.target.tagName)&&i.editModule.startDeleteAction();break;case"focusTask":t.preventDefault();var c=void 0;if(i.selectionModule){var g=i.currentViewData;if("Cell"===i.selectionSettings.mode||(0,e.isNullOrUndefined)(g[i.selectedRowIndex])){if("Cell"===i.selectionSettings.mode&&i.selectionModule.getSelectedRowCellIndexes().length>0){var f=i.selectionModule.getSelectedRowCellIndexes();c=g[f[f.length-1].rowIndex].ganttProperties.rowUniqueID}}else c=i.currentViewData[i.selectedRowIndex].ganttProperties.rowUniqueID}c&&i.scrollToTask(c.toString());break;case"focusSearch":var m;if(i.element.querySelector("#"+i.element.id+"_searchbar"))(m=i.element.querySelector("#"+i.element.id+"_searchbar")).setAttribute("tabIndex","-1"),m.focus();break;case"tab":case"shiftTab":i.element.classList.contains("e-scroll-disabled")||i.ganttChartModule.onTabAction(t);break;case"contextMenu":var y=document.getElementById(this.parent.element.id+"_contextmenu").ej2_instances[0],D=this.parent.getOffsetRect(t.target),v=D.top+D.height/2,k=D.left+D.width/2;this.setActiveElement(t.target),y.open(v,k),t.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":t.preventDefault();var b=[].slice.call(this.parent.ganttChartModule.chartBodyContent.querySelector("tbody").children);if(b.length>0){var w=parseInt(b[0].getAttribute("aria-rowindex"),10)-1,T=parseInt(b[b.length-1].getAttribute("aria-rowindex"),10)-1;(0,e.isNullOrUndefined)(w)||(w=Number(w)),(0,e.isNullOrUndefined)(T)||(T=Number(T)),(0,e.isNullOrUndefined)(w)||(0,e.isNullOrUndefined)(T)||this.parent.selectionModule.selectRowsByRange(w,T)}break;default:var S={requestType:"keyPressed",action:t.action,keyEvent:t};i.trigger("actionComplete",S)}},t.prototype.upDownKeyNavigate=function(t){t.preventDefault();var i,a=this.parent;if(i=("downArrow"===t.action||"upArrow"===t.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){var r=void 0;r=("downArrow"===t.action||"upArrow"===t.action)&&this.parent.selectionModule&&this.parent.allowSelection&&this.parent.virtualScrollModule&&this.parent.enableVirtualization?a.flatData[a.selectedRowIndex]:a.currentViewData[a.selectedRowIndex];var n=a.element.querySelector(".e-focused");n&&(0,e.removeClass)([n],"e-focused");var s=i.indexOf(r),o="downArrow"===t.action?i[s+1]:i[s-1],l=this.parent.args;document.activeElement!==l&&(("downArrow"===t.action||"upArrow"===t.action)&&this.parent.selectionModule&&this.parent.allowSelection&&this.parent.virtualScrollModule&&this.parent.enableVirtualization?a.selectionModule.selectRow(a.flatData.indexOf(o),!1,!0):a.selectionModule.selectRow(a.currentViewData.indexOf(o),!1,!0))}else if("Cell"===a.selectionSettings.mode&&a.selectionModule.getSelectedRowCellIndexes().length>0){var d=a.selectionModule.getSelectedRowCellIndexes(),h=d[d.length-1],p=h.cellIndexes[h.cellIndexes.length-1],u=(r=a.currentViewData[h.rowIndex],s=i.indexOf(r),o="downArrow"===t.action?i[s+1]:i[s-1],{rowIndex:a.currentViewData.indexOf(o),cellIndex:p});a.selectionModule.selectCell(u)}this.parent.ganttChartModule.focusedRowIndex=this.parent.selectedRowIndex}},t.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)}},t}(),ci=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])},e(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)}}(),gi=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},fi=function(a){function r(t,i){var r=a.call(this,t,i)||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=[],(0,e.setValue)("mergePersistData",r.mergePersistGanttData,r),r}return ci(r,a),r.prototype.getModuleName=function(){return"gantt"},r.prototype.preRender=function(){this.initProperties()},r.prototype.getCurrentDayStartTime=function(e){return this.weekWorkingTime.length>0?this.getStartTime(e):this.defaultStartTime},r.prototype.getCurrentDayEndTime=function(e){return this.weekWorkingTime.length>0?this.getEndTime(e):this.defaultEndTime},r.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},r.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},r.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},r.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},r.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},r.prototype.showLoadingIndicator=function(){(0,e.isNullOrUndefined)(this.loadingIndicator)||"Shimmer"!==this.loadingIndicator.indicatorType?this.showSpinner():this.showMaskRow()},r.prototype.hideLoadingIndicator=function(){(0,e.isNullOrUndefined)(this.loadingIndicator)||"Shimmer"!==this.loadingIndicator.indicatorType?this.hideSpinner():this.hideMaskRow()},r.prototype.initProperties=function(){this.globalize=new e.Internationalization(this.locale),this.isAdaptive=e.Browser.isDevice,this.flatData=[],this.currentViewData=[],this.updatedRecords=[],this.ids=[],this.ganttColumns=[],this.updateOffsetOnTaskbarEdit=!1===this.UpdateOffsetOnTaskbarEdit?this.UpdateOffsetOnTaskbarEdit:this.updateOffsetOnTaskbarEdit,this.localeObj=new e.L10n(this.getModuleName(),this.getDefaultLocale(),this.locale),this.dataOperation=new P(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 Ye(this),this.timelineModule=new Qe(this),this.chartRowsModule=new ni(this),this.treeGridModule=new tt(this),this.dateValidationModule=new T(this),this.predecessorModule=new si(this),this.connectorLineModule=new li(this),this.splitterModule=new hi(this),this.tooltipModule=new pi(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 ui(this),0===this.zoomingLevels.length&&this.setProperties({zoomingLevels:this.getZoomingLevels()},!0),this.resourceFieldsMapping(),(0,e.isNullOrUndefined)(this.resourceFields.unit)&&this.setProperties({resourceFields:{unit:"unit"}},!0),this.taskIds=[]},r.prototype.isUndoRedoItemPresent=function(e){return!(!this.undoRedoModule||!this.undoRedoActions||-1===this.undoRedoActions.indexOf(e))},r.prototype.getDateFormat=function(){return(0,e.isNullOrUndefined)(this.dateFormat)?this.globalize.getDatePattern({skeleton:"yMd"}):this.dateFormat},r.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())},r.prototype.isInDst=function(e){return e.getTimezoneOffset()<this.getDefaultTZOffset()},r.prototype.resourceFieldsMapping=function(){var t=this.resourceFields;t.id=(0,e.isNullOrUndefined)(t.id)?this.resourceIDMapping:t.id,t.name=(0,e.isNullOrUndefined)(t.name)?this.resourceNameMapping:t.name},r.prototype.validateDimentionValue=function(t){return(0,e.isNullOrUndefined)(t)?null:"string"==typeof t&&"auto"!==t&&-1===t.indexOf("%")?-1===t.indexOf("px")?t+"px":t:"number"==typeof t?t+"px":t.toString()},r.prototype.calculateDimensions=function(){var t=this.validateDimentionValue(this.height),i=this.validateDimentionValue(this.width);(0,e.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),t&&(this.element.style.height=t),t||a||(this.element.style.height="auto"),i||r||(this.element.style.width="auto"),this.ganttHeight=this.element.offsetHeight,this.ganttWidth=this.element.offsetWidth},r.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"),(0,t.createSpinner)({target:this.element},this.createElement),this.trigger("load",{}),this.element.classList.add(C),this.isAdaptive?this.element.classList.add(O):this.element.classList.remove(O),this.calculateDimensions(),(0,e.isNullOrUndefined)(this.toolbarModule)||this.renderToolbar(),this.splitterModule.renderSplitter(),this.notify("renderPanels",null),this.actionFailures(),this.showLoadingIndicator(),this.dataMap&&this.dataMap.clear(),this.dataOperation.checkDataBinding()},r.prototype.actionFailures=function(){var t=[],a=/^[a-zA-Z\s/]+$/,r=!0,n=this.taskFields.properties;Object.keys(n).forEach(function(e){null!==n[e]&&(r=!1,!0)});for(var s,o,l,d,h,p=!0,u=0;u<this.columns.length;u++)if(this.columns[u].isPrimaryKey){p=!1;break}function c(t,i,a,r){var n;(0,e.isNullOrUndefined)(a)||(n=a.filter(function(e){return e.prototype.getModuleName()===t})),i&&!(0,e.isNullOrUndefined)(n)&&0===n.length&&r.push("Module "+t+" is not available in Gantt component! You either misspelled the module name or forgot to load it!")}if(r&&t.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||t.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 i.DataManager&&(0,e.isNullOrUndefined)(this.taskFields.hasChildMapping)&&t.push("hasChildMapping property is not configured for load-on-demand. Please ensure its properly configured in the Gantt Task Fields!"),(0,e.isNullOrUndefined)(this.timelineSettings.topTier.format)||""===this.timelineSettings.topTier.format||a.test(this.timelineSettings.topTier.format)||t.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!"),(0,e.isNullOrUndefined)(this.timelineSettings.bottomTier.format)||""===this.timelineSettings.bottomTier.format||a.test(this.timelineSettings.bottomTier.format)||t.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!"),p&&"ResourceView"!==this.viewType&&t.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||t.push("Day is not configured properly in event markers.Please ensure that the day in event markers is properly configured!")}),c("sort",this.allowSorting,this.injectedModules,t),(this.editSettings.allowAdding||this.editSettings.allowDeleting||this.editSettings.allowEditing||this.editSettings.allowNextRowEdit||this.editSettings.allowTaskbarEditing||this.editSettings.mode||this.editSettings.newRowPosition||this.editSettings.showDeleteConfirmDialog)&&(s=!0),c("edit",s,this.injectedModules,t),c("reorder",this.allowReordering,this.injectedModules,t),c("excelExport",this.allowExcelExport,this.injectedModules,t),(this.allowRowDragAndDrop||this.allowTaskbarDragAndDrop)&&(o=!0),c("rowDragAndDrop",o,this.injectedModules,t),c("criticalPath",this.enableCriticalPath,this.injectedModules,t),c("undoRedo",this.enableUndoRedo,this.injectedModules,t),c("resize",this.allowResizing,this.injectedModules,t),this.toolbar&&this.toolbar.length>0&&(l=!0),c("toolbar",l,this.injectedModules,t),(this.allowFiltering||this.toolbar&&-1!==this.toolbar.indexOf("Search"))&&(d=!0),c("filter",d,this.injectedModules,t),c("selection",this.allowSelection,this.injectedModules,t),(this.highlightWeekends||this.holidays&&this.holidays.length>0||this.eventMarkers&&this.eventMarkers.length>0)&&(h=!0),c("dayMarkers",h,this.injectedModules,t),c("contextMenu",this.enableContextMenu,this.injectedModules,t),c("columnMenu",this.showColumnMenu,this.injectedModules,t),c("pdfExport",this.allowPdfExport,this.injectedModules,t),c("virtualScroll",this.enableVirtualization,this.injectedModules,t),t.length>0){var g={error:{}};t.forEach(function(e,t){g.error[parseInt(t,10)]=e}),this.trigger("actionFailure",g)}},r.prototype.hideMaskRow=function(){var t=this.element.querySelectorAll(".e-masked-table").length;if(!(0,e.isNullOrUndefined)(this.contentMaskTable)&&(0!==t||this.contentMaskTable)){var i=this.contentMaskTable;(0,e.remove)(i),this.contentMaskTable=null}if(t=this.element.querySelectorAll(".e-masked-table").length,!(0,e.isNullOrUndefined)(this.headerMaskTable)&&(0!==t||this.headerMaskTable)){i=this.headerMaskTable;(0,e.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("."+F).length)for(var a=0;a<this.singleTier;a++)(0,e.isNullOrUndefined)(this.element.querySelectorAll("."+F)[parseInt(a.toString(),10)])||(this.element.querySelectorAll("."+F)[parseInt(a.toString(),10)].style.visibility="visible");(0,e.isNullOrUndefined)(this.element.querySelector("."+E))||(this.element.querySelector("."+E).style.position="relative"),(0,e.isNullOrUndefined)(this.element.getElementsByClassName(x)[0])||(this.element.getElementsByClassName(x)[0].style.visibility="visible")},r.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){var i=t;if(this.renderBackGround(i),this.ganttChartModule.scrollObject.isSetScrollLeft){if(0!==this.element.querySelectorAll("."+F).length){this.singleTier=this.timelineModule.isSingleTier?1:2;for(var a=0;a<this.singleTier;a++)this.element.querySelectorAll("."+F)[parseInt(a.toString(),10)].style.visibility="hidden"}0===this.singleTier&&(this.singleTier=2)}this.element.getElementsByClassName(x)[0].style.visibility="hidden",this.contentMaskTable=this.contentMaskTable=this.createMaskTable(i)}if(e&&this.ganttChartModule.scrollObject.isSetScrollLeft){this.element.querySelector("."+E).style.position="static";i=e;this.renderHeaderBackground(i),this.headerMaskTable=this.headerMaskTable=this.createMaskTable(i)}}},r.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(",")},r.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},r.prototype.updateWBSCodes=function(e,t,i,a){var r,n=this.getParentTask(e.parentItem),s=(i.get(n)||0)+1;(i.set(n,s),n)?r=t.get(n)+"."+s:r=""+s;return t.set(e,r),a||(e.WBSCode=r.toString(),e.ganttProperties.wbsCode=r.toString()),{wbsMap:t,siblingCountMap:i}},r.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"},r.prototype.generateWBSCodes=function(e){for(var t=new Map,i=[],a=new Map,r=0,n=e;r<n.length;r++){var s=n[r];if(this.enableAutoWbsUpdate||this.isLoad){var o=this.updateWBSCodes(s,t,a);t=o.wbsMap,a=o.siblingCountMap}else if(!s.ganttProperties.wbsCode){var l=void 0;if(s.parentItem){var d=this.getParentTask(s.parentItem);l=d.ganttProperties.wbsCode,l=this.getMaxRootWBSCode(d.childRecords,d)}else l=this.getMaxRootWBSCode(this.treeGrid.parentData);s.WBSCode=l,s.ganttProperties.wbsCode=l}s[this.taskFields.dependency]?i.push(s):(s.WBSPredecessor=null,s.ganttProperties.wbsPredecessor=null)}for(var h=0,p=i;h<p.length;h++){s=p[h];this.updateWBSPredecessor(s)}},r.prototype.renderHeaderBackground=function(t){var i=t;if(!!(0,e.closest)(i,"."+E)){for(var a=this.createElement("div",{className:"e-table-background"}),r=0,n=Math.round(t.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)}},r.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},r.prototype.renderBackGround=function(t){var i=t;if(!!(0,e.closest)(i,"."+M)){for(var a=this.createElement("div",{className:"e-table-background"}),r=0,n=Math.round(t.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)}},r.prototype.createMaskTable=function(t){var i,a=t,r=t.getBoundingClientRect().height,n=!!(0,e.closest)(a,"."+E);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=t.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=t.getBoundingClientRect().height+"px",a.insertBefore(i,a.firstChild);return i},r.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},r.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(var a=0;a<i;a++)t.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"}));for(a=0;a<t.childNodes.length-1;a++)t.childNodes[parseInt(a.toString(),10)].style.width="166px";var r=[].slice.call(t.childNodes);for(a=0;a<r.length;a++){var n=r[parseInt(a.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},r.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},r.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(var a=0;a<i;a++)t.appendChild(this.createElement("td",{className:"e-masked-cell e-rowcell"}))}else t.appendChild(this.createElement("td",{className:"e-masked-cell e-rowcell"}));var r=[].slice.call(t.childNodes);for(a=0;a<r.length;a++){var n=r[parseInt(a.toString(),10)];switch(this.columnLoop){case 1:0===a?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===a?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===a?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},r.prototype.showSpinner=function(){(0,t.showSpinner)(this.element)},r.prototype.hideSpinner=function(){(0,t.hideSpinner)(this.element)},r.prototype.processTimeline=function(){this.timelineModule.processTimelineUnit(),this.timelineModule.calculateZoomingLevelsPerDayWidth()},r.prototype.renderGantt=function(t){t&&(this.isFromOnPropertyChange=t),this.enableValidation&&(this.dataOperation.calculateProjectDates(),this.timelineModule.validateTimelineProp());var i=this.flatData,a=new Map;if(null!=i)for(var r=0,s=i;r<s.length;r++){var o=s[r];a.set(o.ganttProperties.rowUniqueID.toString(),o)}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()),t){if(this.dataSource instanceof Object&&n(this)){var l=(0,e.getValue)("count",this.dataSource);this.treeGrid.dataSource={result:this.flatData,count:l}}else this.treeGrid.setProperties({dataSource:this.flatData},!1);(0,e.isNullOrUndefined)(this.selectionModule)||this.treeGrid.setProperties({selectedRowIndex:this.selectedRowIndex},!1)}else{this.treeGridPane.classList.remove("e-temp-content"),(0,e.isNullOrUndefined)(this.treeGridPane.querySelector(".e-gantt-temp-header"))||(0,e.remove)(this.treeGridPane.querySelector(".e-gantt-temp-header")),this.notify("dataReady",{}),this.enableContextMenu&&this.notify("initiate-contextMenu",{});var d=!(0,e.isNullOrUndefined)(document.body.className)&&document.body.className.includes("e-bigger")&&36===this.rowHeight?46:this.rowHeight;this.rowHeight=(0,e.isNullOrUndefined)(this.rowHeight)?36:d,this.renderTreeGrid(),this.wireEvents(),this.notify("initPredessorDialog",{})}this.isFromOnPropertyChange||this.splitterModule.updateSplitterPosition(),"Vertical"!==this.gridLines&&"Both"!==this.gridLines||this.dayMarkersModule||this.renderChartVerticalLines()},r.prototype.removeCriticalPathStyles=function(){var t=this.ganttChartModule.chartElement;(0,e.removeClass)(t.querySelectorAll(".e-gantt-child-taskbar-inner-div"),z),(0,e.removeClass)(t.querySelectorAll(".e-gantt-child-progressbar-inner-div"),q),(0,e.removeClass)(t.querySelectorAll(".e-critical-milestone"),G),(0,e.removeClass)(this.element.querySelectorAll(".e-connector-line"),Pe),(0,e.removeClass)(this.element.querySelectorAll(".e-connector-line-arrow"),Ce)},r.prototype.wireEvents=function(){this.allowKeyboard&&(this.keyboardModule=new e.KeyboardEvents(this.element,{keyAction:this.keyActionHandler.bind(this),keyConfigs:this.keyConfig,eventName:"keydown"})),e.EventHandler.add(window,"resize",this.windowResize,this),e.EventHandler.add(document.body,"keydown",this.keyDownHandler,this)},r.prototype.unwireEvents=function(){this.keyboardModule&&(this.keyboardModule.destroy(),this.keyboardModule=null),e.EventHandler.remove(window,"resize",this.windowResize),e.EventHandler.remove(document.body,"keydown",this.keyDownHandler)},r.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))},r.prototype.windowResize=function(){var t=this;if(!(0,e.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(){t.timelineModule.processZoomToFit()},0)}this.dayMarkersModule&&this.dayMarkersModule.eventMarkerRender&&this.dayMarkersModule.eventMarkerRender.updateContainerHeight(),this.enableTimelineVirtualization&&this.timelineModule.refreshTimeline()},r.prototype.keyActionHandler=function(t){if(this.enableContextMenu&&this.contextMenuModule&&("downArrow"===t.action||"upArrow"===t.action)&&document.getElementById(this.element.id+"_contextmenu")&&this.args){var i=this.args;(0,e.isNullOrUndefined)(i)||i.focus()}t.target&&("downArrow"===t.action||"upArrow"===t.action)&&t.target===this.element.querySelector(".e-rowcell")||t.target&&"escape"===t.action&&this.treeGrid.grid.columnMenuModule&&"block"===this.treeGrid.grid.columnMenuModule.columnMenu.element.style.display?this.treeGrid.grid.notify("key-pressed",t):this.focusModule.onKeyPress(t)},r.prototype.updateRowHeightInConnectorLine=function(t){if(t&&t.length){var i=!(0,e.isNullOrUndefined)(this.ganttChartModule)&&this.ganttChartModule.getChartRows()[0]&&this.ganttChartModule.getChartRows()[0].getBoundingClientRect().height;if(i&&!isNaN(i))for(var a=0;a<t.length;a++)t[a].rowHeight=i}},r.prototype.renderToolbar=function(){(0,e.isNullOrUndefined)(this.toolbarModule)||(this.toolbarModule.renderToolbar(),this.toolbarModule.refreshToolbarItems())},r.prototype.renderTreeGrid=function(){this.treeGridModule.renderTreeGrid()},r.prototype.updateCurrentViewData=function(){var t=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(e){if(e.data[t.taskFields.id]===t.flatData[0].ganttProperties.taskId)return e})[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,(0,e.isNullOrUndefined)(this.treeGrid.virtualScrollModule)||(this.treeGrid.virtualScrollModule.visualData=this.flatData,this.updatedRecords=this.flatData)}},r.prototype.getRecordFromFlatdata=function(e){for(var t=[],i=0;i<e.length;i++)t.push(this.getTaskByUniqueID(e[i].uniqueID));return t},r.prototype.updateContentHeight=function(t){if(this.allowTaskbarOverlap||this.ganttChartModule.isCollapseAll||this.ganttChartModule.isExpandAll||this.isLoad)if(this.virtualScrollModule&&this.enableVirtualization&&!(0,e.isNullOrUndefined)(t)){var i=(0,e.getValue)("result.length",t);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=(0,e.isNullOrUndefined)(this.ganttChartModule)||(0,e.isNullOrUndefined)(this.ganttChartModule.getChartRows())?null:this.ganttChartModule.getChartRows()[0];r=!(0,e.isNullOrUndefined)(n)&&n.offsetHeight>0?n.offsetHeight:this.rowHeight,this.contentHeight=a.length*r}},r.prototype.getExpandStatus=function(t){var i=this.getParentTask(t.parentItem);return!!(0,e.isNullOrUndefined)(i)||!1!==i.expanded&&(!i.parentItem||!1!==this.getParentTask(i.parentItem).expanded&&this.getExpandStatus(this.getParentTask(i.parentItem)))},r.prototype.getExpandedRecords=function(t){var i=this;if((0,e.isNullOrUndefined)(t))return[];var a=t.filter(function(e){return!0===i.getExpandStatus(e)});return this.expandedRecords=a,a},r.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}]},r.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"},r.prototype.displayHalfValue=function(e){var t=e.getMonth();return t>=0&&t<=5?"H1":"H2"},r.prototype.getFormatedDate=function(t,i){return(0,e.isNullOrUndefined)(t)?null:((0,e.isNullOrUndefined)(i)&&(i=this.getDateFormat()),this.globalize.formatDate(t,{format:i}))},r.prototype.getDurationString=function(e,t){return this.dateValidationModule.getDurationString(e,t)},r.prototype.getWorkString=function(e,t){return this.dateValidationModule.getWorkString(e,t)},r.prototype.updateTreeColumns=function(){var t,i,a=this.treeGrid.grid.getColumns();-1!==this.treeColumnIndex&&this.columns[this.treeColumnIndex]&&!(0,e.isNullOrUndefined)(this.columns[this.treeColumnIndex].template)&&(t=this.columns[this.treeColumnIndex].template);for(var r=0;r<a.length;r++){i={};for(var n=0;n<this.columns.length;n++)if(this.columns[n].field===a[r].field){for(var s=0,o=Object.keys(this.columns[n]);s<o.length;s++){var l=o[s];(0,e.isUndefined)(this.columns[n][l])||(i[l]=a[r][l]),i.visible=a[r].visible,i.width=a[r].width}this.columns[n]=i,"checkbox"===this.columns[n].type||(0,e.isNullOrUndefined)(t)||""===t||(this.columns[n].template=t)}}this.columns.length>0&&this.treeGrid.setProperties({columns:this.columns},!0)},r.prototype.treeDataBound=function(t){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"),(0,e.isNullOrUndefined)(this.toolbarModule)||(0,e.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(R):this.element.classList.remove(R);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(),(0,e.setValue)("isGanttCreated",!0,t),this.renderComplete()}}else this.getCurrentRecords(t);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=(0,e.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",t)},r.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())},r.prototype.onPropertyChanged=function(t,i){for(var a=!1,r=0,s=Object.keys(t);r<s.length;r++){var o=s[r];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:t});break;case"columnMenuItems":this.treeGrid.grid.columnMenuItems=(0,Ze.getActualProperties)(this.columnMenuItems);break;case"eventMarkers":case"highlightWeekends":this.notify("ui-update",{module:"day-markers",properties:t});break;case"sortSettings":this.treeGrid.sortSettings=(0,Ze.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":(0,e.isNullOrUndefined)(t.filterSettings)&&(this.filterSettings.columns=[]),this.treeGrid.filterSettings=(0,Ze.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=(0,Ze.getActualProperties)(this.selectionSettings),this.treeGrid.grid.selectionSettings.enableToggle=this.selectionSettings.enableToggle,this.treeGrid.dataBind();break;case"searchSettings":void 0!==t.searchSettings.key&&(this.treeGrid.grid.searchSettings=(0,Ze.getActualProperties)(this.searchSettings),this.treeGrid.grid.dataBind()),this.treeGrid.searchSettings=(0,Ze.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:t})),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,(0,e.isNullOrUndefined)(this.editModule)||this.editModule.reUpdateEditModules(),(0,e.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":(0,e.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&&n(this)){this.treeGrid.hasChildMapping="isParent";var d=(0,e.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&&!(0,e.isNullOrUndefined)(t.taskFields.child))return;"allowTaskbarDragAndDrop"!==o&&(a=!0);break;case"validateManualTasksOnLinking":this.validateManualTasksOnLinking=t.validateManualTasksOnLinking;break;case"showOverAllocation":this.updateOverAllocationCotainer()}}a&&(this.isLoad&&this.contentMaskTable&&(this.contentMaskTable=null),this.refresh())},r.prototype.updateOverAllocationCotainer=function(){if(this.showOverAllocation)this.ganttChartModule.renderOverAllocationContainer();else{var e=this.element.querySelector("."+ze);e&&(e.innerHTML="")}},r.prototype.getPersistData=function(){for(var t=["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=0;a<t.length;a++)for(var r=this[t[a]],n=0,s=i[t[a]];!(0,e.isNullOrUndefined)(s)&&n<s.length;n++){delete r[s[n]]}return this.ignoreInArrays(["filter","edit","filterBarTemplate","headerTemplate","template","commandTemplate","commands","dataSource"],this.columns),this.addOnPersist(t)},r.prototype.ignoreInArrays=function(e,t){for(var i=0;i<t.length;i++)this.ignoreInColumn(e,t[i])},r.prototype.ignoreInColumn=function(e,t){for(var i=0;i<e.length;i++)delete t[e[i]],t.filter={}},r.prototype.destroy=function(){this.notify("destroy",{}),this.unwireEvents(),(0,e.isNullOrUndefined)(this.validationDialogElement)||this.validationDialogElement.isDestroyed||this.validationDialogElement.destroy();for(var t=["ganttChartModule","timelineModule","chartRowsModule","treeGridModule","ganttDataUpdatesModule","dateValidationModule","tooltipModule"],i=0;i<t.length;i++)this[t[i]]&&(this[t[i]]=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(),(0,e.isNullOrUndefined)(this.dayMarkersModule)||((0,e.isNullOrUndefined)(this.dayMarkersModule.eventMarkerRender)||(0,e.isNullOrUndefined)(this.dayMarkersModule.eventMarkerRender.eventMarkersContainer)||(this.dayMarkersModule.eventMarkerRender.eventMarkersContainer=null),(0,e.isNullOrUndefined)(this.dayMarkersModule.nonworkingDayRender)||((0,e.isNullOrUndefined)(this.dayMarkersModule.nonworkingDayRender.nonworkingContainer)||(this.dayMarkersModule.nonworkingDayRender.nonworkingContainer=null),(0,e.isNullOrUndefined)(this.dayMarkersModule.nonworkingDayRender.weekendContainer)||(this.dayMarkersModule.nonworkingDayRender.weekendContainer=null),(0,e.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,a.prototype.destroy.call(this),this.chartVerticalLineContainer=null,this.element.innerHTML="",(0,e.removeClass)([this.element],C),this.element.innerHTML="",this.isTreeGridRendered=!1,this.resetTemplates(),this.dataOperation.uid=null},r.prototype.getTaskbarHeight=function(){return this.chartRowsModule.taskBarHeight},r.prototype.requiredModules=function(){var e=[];return this.isDestroyed||(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},r.prototype.sortColumn=function(e,t,i){this.sortModule&&this.allowSorting&&this.sortModule.sortColumn(e,t,i)},r.prototype.mergePersistGanttData=function(){this.treeGrid||(this.treeGrid=new $e.TreeGrid);this.treeGrid.grid.mergePersistGridData.apply(this)},r.prototype.mergeColumns=function(e,t){this.treeGrid.grid.mergeColumns.apply(this,[e,t])},r.prototype.setFrozenCount=function(){this.treeGrid.grid.setFrozenCount.apply(this)},r.prototype.splitFrozenCount=function(e){this.treeGrid.grid.splitFrozenCount.apply(this,[e])},r.prototype.isFrozenGrid=function(){return this.treeGrid.grid.isFrozenGrid()},r.prototype.clearSorting=function(){this.sortModule.clearSorting()},r.prototype.renderChartGridLines=function(){var t="e-chart-row-border",i=this.chartVerticalLineContainer,a=document.getElementById(this.element.id+"GanttTaskTableBody").querySelectorAll("td");if("Vertical"===this.gridLines){if((0,e.isNullOrUndefined)(i)?this.renderChartVerticalLines():"none"===window.getComputedStyle(i).display&&(i.style.display="block"),a&&a.length>0&&a[0].classList.contains(t))for(var r=0;r<a.length;r++)(0,e.removeClass)([a[r]],t)}else if("Horizontal"===this.gridLines){if((0,e.isNullOrUndefined)(i)||(i.style.display="none"),a&&a.length>0&&!a[0].classList.contains(t))for(r=0;r<a.length;r++)(0,e.addClass)([a[r]],t)}else if("Both"===this.gridLines){if((0,e.isNullOrUndefined)(i)?this.renderChartVerticalLines():"none"===window.getComputedStyle(i).display&&(i.style.display="block"),a&&a.length>0&&!a[0].classList.contains(t))for(r=0;r<a.length;r++)(0,e.addClass)([a[r]],t)}else if("None"===this.gridLines&&((0,e.isNullOrUndefined)(i)||"none"===window.getComputedStyle(i).display||(i.style.display="none"),a&&a.length>0&&a[0].classList.contains(t)))for(r=0;r<a.length;r++)(0,e.removeClass)([a[r]],t)},r.prototype.updateGridLineContainerHeight=function(){this.chartVerticalLineContainer&&(this.chartVerticalLineContainer.style.height=(0,e.formatUnit)(this.getContentHeight()))},r.prototype.getContentHeight=function(){var e=this.ganttChartModule.scrollElement.offsetHeight-16,t=this.ganttChartModule.chartBodyContent.offsetHeight;return t<e?t:e},r.prototype.reUpdateDimention=function(t){var i=0;if(this.calculateDimensions(),(0,e.isNullOrUndefined)(this.toolbarModule)||(0,e.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(),(0,e.isNullOrUndefined)(this.chartVerticalLineContainer)||(this.chartVerticalLineContainer.style.height=this.ganttHeight+"px"),!(0,e.isNullOrUndefined)(this.dayMarkersModule)){var a=(0,e.getValue)("nonworkingDayRender.holidayContainer",this.dayMarkersModule),r=(0,e.getValue)("nonworkingDayRender.weekendContainer",this.dayMarkersModule),n=(0,e.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"===t&&(this.splitterModule.splitterObject.width=this.ganttWidth.toString()),this.ganttChartModule.scrollObject.setHeight(this.ganttHeight-this.ganttChartModule.chartTimelineContainer.offsetHeight-i)},r.prototype.renderChartVerticalLines=function(){this.element.contains(this.chartVerticalLineContainer)||(this.chartVerticalLineContainer=(0,e.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 t=this.element.getElementsByClassName("e-timeline-header-table-container")[1];(0,e.isNullOrUndefined)(t)&&(t=this.element.getElementsByClassName("e-timeline-header-table-container")[0]);for(var i,a=t.getElementsByTagName("th"),r=a.length,n=0,s=(0,e.createElement)("div"),o=0;o<r;o++){n=0===o?-1:n+parseFloat(i),i=a[o].style.width;var l=(0,e.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)},r.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"}},r.prototype.removeSortColumn=function(e){this.sortModule.removeSortColumn(e)},r.prototype.actionBeginTask=function(t){this.trigger("actionBegin",t),(0,e.getValue)("cancel",t)||this.showLoadingIndicator()},r.prototype.scrollToDate=function(e){var t=this.dateValidationModule.getDateFromFormat(e),i=this.dataOperation.getTaskLeft(t,!1);this.ganttChartModule.updateScrollLeft(i)},r.prototype.scrollToTask=function(e){if(-1!==this.ids.indexOf(e)){var t=this.flatData[this.ids.indexOf(e)].ganttProperties.left;this.ganttChartModule.updateScrollLeft(t)}},r.prototype.updateChartScrollOffset=function(t,i){(0,e.isNullOrUndefined)(t)||(t=this.ganttChartModule.scrollElement.scrollWidth<=t?this.ganttChartModule.scrollElement.scrollWidth:t,this.ganttChartModule.scrollObject.setScrollLeft(t,this.enableRtl?-1:0)),(0,e.isNullOrUndefined)(i)||(i=this.ganttChartModule.scrollElement.scrollHeight<=i?this.ganttChartModule.scrollElement.scrollHeight:i,this.ganttChartModule.scrollObject.setScrollTop(i))},r.prototype.getParentTask=function(t){if((0,e.isNullOrUndefined)(t))return null;if(!this.autoCalculateDateScheduling&&this.dataMap&&this.dataMap.size>0&&!this.taskFields.hasChildMapping&&this.isLoad){var i=this.dataMap.get(t.uniqueID);if(i)return i}else{var a=this.flatData.find(function(e){return t.uniqueID===e.uniqueID});if(a)return a}return null},r.prototype.getRootParent=function(e,t){return e.level===t?e:this.getRootParent(this.getParentTask(e.parentItem),t)},r.prototype.filterByColumn=function(e,t,i,a,r,n){this.treeGrid.filterByColumn(e,t,i,a,r,n)},r.prototype.excelExport=function(e,t,i,a){return this.excelExportModule?this.treeGrid.excelExport(e,t,i,a):null},r.prototype.csvExport=function(e,t,i,a){return this.excelExportModule?this.treeGrid.csvExport(e,t,i,a):null},r.prototype.pdfExport=function(e,t,i,a){return this.pdfExportModule?this.pdfExportModule.export(e,t,i,a):null},r.prototype.clearFiltering=function(e){this.treeGrid.grid.clearFiltering(e)},r.prototype.removeFilteredColsByField=function(e){this.treeGrid.removeFilteredColsByField(e,!1)},r.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)}},r.prototype.previousTimeSpan=function(t){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={action:"PreviousTimeSpan"};i.previousTimelineStartDate=(0,e.extend)([],[],[this.timelineModule.timelineStartDate],!0)[0],i.previousTimelineEndDate=(0,e.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()),t)},r.prototype.nextTimeSpan=function(t){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={action:"NextTimeSpan"};i.previousTimelineStartDate=(0,e.extend)([],[],[this.timelineModule.timelineStartDate],!0)[0],i.previousTimelineEndDate=(0,e.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()),t)},r.prototype.updateProjectDates=function(t,i,a,r){if(this.timelineModule.totalTimelineWidth=0,this.cloneProjectStartDate=t,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=(0,e.formatUnit)(this.timelineModule.totalTimelineWidth-s)}else this.ganttChartModule.chartBodyContent.style.width=(0,e.formatUnit)(this.timelineModule.totalTimelineWidth);this.ganttChartModule.updateLastRowBottomWidth(),this.taskFields.dependency&&this.ganttChartModule.reRenderConnectorLines(),"beforeAdd"!==r&&this.notify("selectRowByIndex",{})}},r.prototype.splitTask=function(e,t){this.isEdit=!0,this.chartRowsModule.splitTask(e,t)},r.prototype.mergeTask=function(e,t){this.chartRowsModule.mergeTask(e,t)},r.prototype.reorderColumns=function(e,t){this.treeGrid.reorderColumns(e,t)},r.prototype.initiateEditAction=function(e){this.isOnEdit=e,this.previousRecords={},this.editedRecords=[]},r.prototype.setRecordValue=function(t,i,a,r){if(i=(0,e.isUndefined)(i)?null:i,!(!this.isOnEdit&&!this.isOnDelete)){this.makeCloneData(t,a,r);var n=r?a:a.ganttProperties,s=n.rowUniqueID,o=this.getRecordByID(s),l=!1;if(l=!(!(0,e.isNullOrUndefined)(i)&&((0,e.isNullOrUndefined)(i)||(0,e.isNullOrUndefined)(a[""+t])||(i instanceof Date?i.getTime()===a[""+t].getTime():a[""+t]===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((0,e.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)}}(0,e.setValue)(t,i,a)},r.prototype.makeCloneData=function(t,i,a){var r,n,s,o=(0,e.getValue)(t,i);if(a&&(t="ganttProperties."+t),(0,e.isNullOrUndefined)(this.previousRecords[i.uniqueID])){this.previousRecords[i.uniqueID]={}}r=this.previousRecords[i.uniqueID],n=(0,e.getValue)(t,r),(0,e.isUndefined)(n)&&(s=o instanceof Date?new Date(o.getTime()):(0,e.isObjectArray)(o)?(0,e.extend)([],o,[],!0):(0,e.isObject)(o)?(0,e.extend)({},{},o,!0):o,(0,e.isUndefined)(s)?(0,e.setValue)(t,null,r):(0,e.setValue)(t,s,r))},r.prototype.closeGanttActions=function(){this.editModule&&(this.editModule.cellEditModule&&this.editModule.cellEditModule.isCellEdit?(this.treeGrid.closeEdit(),this.editModule.cellEditModule.isCellEdit=!1,(0,e.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()))},r.prototype.getTaskByUniqueID=function(e){var t=this.flatData.filter(function(t){return t.uniqueID===e});return t.length>0?t[0]:null},r.prototype.getRecordByID=function(t){return(0,e.isNullOrUndefined)(t)?null:this.flatData[this.ids.indexOf(t.toString())]},r.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()},r.prototype.expandByIndex=function(e){if("number"==typeof e){var t=this.contructExpandCollapseArgs(null,e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.expandGanttRow(t)}else for(var i=0;i<e.length;i++)if("number"==typeof e[i]){var a=e[i];t=this.contructExpandCollapseArgs(null,a);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.expandGanttRow(t)}},r.prototype.expandByID=function(e){this.enableVirtualization&&(this.isExpandPerformed=!0);var t=this.contructExpandCollapseArgs(e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.expandGanttRow(t)},r.prototype.collapseByIndex=function(e){var t=this.contructExpandCollapseArgs(null,e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.collapseGanttRow(t)},r.prototype.collapseByID=function(e){var t=this.contructExpandCollapseArgs(e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.collapseGanttRow(t)},r.prototype.addRecord=function(t,i,a){if(this.editModule&&this.editSettings.allowAdding){if("ResourceView"===this.viewType){this.editModule.addRowPosition=i,this.editModule.addRowIndex=a;var r=void 0;(0,e.isNullOrUndefined)(t)||(r=this.undoRedoModule&&this.undoRedoModule.isUndoRedoPerformed?t.ganttProperties.resourceInfo:t[this.taskFields.resourceInfo]);var n=void 0,s=void 0;if(!(0,e.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(t,i,a);else if(l){var d="Above"===i||"Below"===i?i:"Child";"Child"===d?this.editModule.addRecord(t,d,this.getTaskIds().indexOf("R"+n)):this.editModule.addRecord(t,d,this.flatData.indexOf(l))}else this.editModule.addRecord(t,"Child",this.getTaskIds().indexOf("R"+n))}else this.editModule.addRecord(t,"Bottom")}else this.undoRedoModule&&this.undoRedoModule.isUndoRedoPerformed?this.editModule.addRecord(t,i,a):this.editModule.addRecord(t,"Bottom");this.editModule.addRowPosition=null,this.editModule.addRowIndex=null}else this.editModule.addRecord(t,i,a),"Bottom"===i&&(this.selectedRowIndex=a);"Above"!==i&&"Below"!==i&&"Child"!==i||(this.currentSelection=(0,e.isNullOrUndefined)(t)?this.currentSelection:t)}},r.prototype.updateRecordByID=function(e){this.editModule&&this.editSettings.allowEditing&&(this.updateDuration=!0,this.editModule.updateRecordByID(e),this.updateDuration=!1)},r.prototype.getCurrentViewData=function(){return this.treeGrid.getCurrentViewRecords().map(function(e){return e.taskData})},r.prototype.autoFitColumns=function(e){this.treeGrid.autoFitColumns(e)},r.prototype.getTaskInfo=function(t){var i=this.getRecordByID(t),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&&((0,e.isNullOrUndefined)(r.baselineLeft)||(a.baselineLeft=r.baselineLeft),(0,e.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},r.prototype.updateTaskId=function(e,t){this.editModule&&this.editSettings.allowEditing&&this.editModule.updateTaskId(e,t)},r.prototype.expandAtLevel=function(e){this.enableVirtualization&&(this.isExpandCollapseLevelMethod=!0),this.ganttChartModule.expandAtLevel(e)},r.prototype.indent=function(){this.editModule&&this.editSettings.allowEditing&&this.editModule.indent()},r.prototype.outdent=function(){this.editModule&&this.editSettings.allowEditing&&this.editModule.outdent()},r.prototype.getUndoActions=function(){return this.undoRedoModule?this.undoRedoModule.getUndoCollection:[]},r.prototype.getRedoActions=function(){return this.undoRedoModule?this.undoRedoModule.getRedoCollection:[]},r.prototype.clearUndoCollection=function(){this.undoRedoModule&&(this.undoRedoModule.getUndoCollection=[],this.toolbarModule&&this.toolbarModule.enableItems([this.controlId+"_undo"],!1))},r.prototype.clearRedoCollection=function(){this.undoRedoModule&&(this.undoRedoModule.getRedoCollection=[],this.toolbarModule&&this.toolbarModule.enableItems([this.controlId+"_redo"],!1))},r.prototype.undo=function(){this.undoRedoModule&&this.undoRedoModule.undoAction()},r.prototype.redo=function(){this.undoRedoModule&&this.undoRedoModule.redoAction()},r.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)}},r.prototype.getCriticalTasks=function(){return!(0,e.isNullOrUndefined)(this.criticalPathModule)&&this.enableCriticalPath?this.criticalPathModule.getCriticalTasks():null},r.prototype.zoomIn=function(){this.timelineModule.processZooming(!0)},r.prototype.zoomOut=function(){this.timelineModule.processZooming(!1)},r.prototype.fitToProject=function(){this.timelineModule.processZoomToFit(),this.ganttChartModule.updateScrollLeft(0)},r.prototype.reorderRows=function(e,t,i){this.rowDragAndDropModule.reorderRows(e,t,i)},r.prototype.updateRecordByIndex=function(t,i){if(this.editModule&&this.editSettings.allowEditing){var a=this.taskFields,r=this.updatedRecords.length>0?(0,e.isNullOrUndefined)(this.updatedRecords[t])?null:this.updatedRecords[t]:null;(0,e.isNullOrUndefined)(r)||(i[a.id]=r[a.id],this.editModule.updateRecordByID(i))}},r.prototype.addPredecessor=function(t,i){if(this.connectorLineModule){var a=this.connectorLineModule.getRecordByID(t.toString());this.editModule&&!(0,e.isNullOrUndefined)(a)&&this.editSettings.allowTaskbarEditing&&this.connectorLineEditModule.addPredecessor(a,i)}},r.prototype.removePredecessor=function(t){if(this.connectorLineModule){var i=this.connectorLineModule.getRecordByID(t.toString());this.editModule&&!(0,e.isNullOrUndefined)(i)&&this.editSettings.allowTaskbarEditing&&this.connectorLineEditModule.removePredecessor(i)}},r.prototype.updatePredecessor=function(t,i){if(this.connectorLineModule){var a=this.connectorLineModule.getRecordByID(t.toString());this.editModule&&!(0,e.isNullOrUndefined)(a)&&this.editSettings.allowTaskbarEditing&&this.connectorLineEditModule.updatePredecessor(a,i)}},r.prototype.openAddDialog=function(){this.editModule&&this.editModule.dialogModule&&this.editSettings.allowAdding&&this.editModule.dialogModule.openAddDialog()},r.prototype.openEditDialog=function(e){this.editModule&&this.editModule.dialogModule&&this.editSettings.allowEditing&&this.editModule.dialogModule.openEditDialog(e)},r.prototype.contructExpandCollapseArgs=function(t,i){var a,r,n;if((0,e.isNullOrUndefined)(i)&&t)r=this.getRecordByID(t.toString()),a=this.getRowByID(t),(0,e.isNullOrUndefined)(a)||(n=(0,e.getValue)("rowIndex",a));else if(!(0,e.isNullOrUndefined)(i)){a=this.getRowByIndex(i);var s=this.focusModule.isFromKeyboardAction;n=s?(0,e.getValue)("rowIndex",a):i,r=s?this.currentViewData[n]:this.flatData[n]}return{data:r,gridRow:this.treeGrid.getRows()[n],chartRow:a,cancel:!1}},r.prototype.getRowByIndex=function(t){try{var i=this.element.querySelectorAll(".e-chart-row");return(0,e.isNullOrUndefined)(t)?null:i[t]}catch(e){return null}},r.prototype.getRowByID=function(e){var t,i=this,a=this.getRecordByID(e.toString());return-1!==(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))?this.getRowByIndex(t):null},r.prototype.getUnscheduledTaskClass=function(t){return(0,e.isNullOrUndefined)(t.startDate)&&(0,e.isNullOrUndefined)(t.endDate)&&(0,e.isNullOrUndefined)(t.duration)||(0,e.isNullOrUndefined)(t.startDate)||(0,e.isNullOrUndefined)(t.endDate)||(0,e.isNullOrUndefined)(t.duration)?" "+ge:""},r.prototype.isUnscheduledTask=function(t){return!!((0,e.isNullOrUndefined)(t.startDate)||(0,e.isNullOrUndefined)(t.endDate)||(0,e.isNullOrUndefined)(t.duration))},r.prototype.createGanttPopUpElement=function(){var t=this.createElement("div",{className:"e-ganttpopup",styles:"display:none;"}),i=this.createElement("div",{className:"e-content",attrs:{tabIndex:"-1"}});(0,e.append)([i,this.createElement("div",{className:"e-uptail e-tail"})],t),i.appendChild(this.createElement("span")),(0,e.append)([i,this.createElement("div",{className:"e-downtail e-tail"})],t),document.getElementById(this.element.id+"GanttChart").appendChild(t)},r.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},r.prototype.search=function(e){this.filterModule&&(this.searchSettings.key=e,this.dataBind())},r.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}},r.prototype.expandAll=function(){this.ganttChartModule.expandCollapseAll("expand")},r.prototype.updateDataSource=function(t,i){if(this.isDynamicData=!0,!(0,e.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=t},r.prototype.collapseAll=function(){this.ganttChartModule.expandCollapseAll("collapse")},r.prototype.getGridColumns=function(){return this.treeGrid.getColumns()},r.prototype.getColumnByField=function(e,t){var i=t.filter(function(t){return t.field===e});return i.length>0?i[0]:null},r.prototype.getGanttColumns=function(){return this.ganttColumns},r.prototype.showColumn=function(e,t){this.treeGrid.showColumns(e,t),this.updateTreeColumns()},r.prototype.hideColumn=function(e,t){this.treeGrid.hideColumns(e,t),this.updateTreeColumns()},r.prototype.setScrollTop=function(e){this.ganttChartModule.scrollObject.setScrollTop(e)},r.prototype.cancelEdit=function(){this.isCancelled=!0,this.closeGanttActions()},r.prototype.selectCell=function(e,t){this.selectionModule&&this.selectionModule.selectCell(e,t)},r.prototype.selectCells=function(e){this.selectionModule&&this.selectionModule.selectCells(e)},r.prototype.selectRow=function(e,t){this.selectionModule&&this.selectionModule.selectRow(e,t)},r.prototype.selectRows=function(e){this.selectionModule&&this.selectionModule.selectRows(e)},r.prototype.deleteRecord=function(e){this.editModule&&this.editModule.deleteRecord(e)},r.prototype.enableItems=function(e,t){this.toolbarModule&&this.toolbarModule.enableItems(e,t)},r.prototype.clearSelection=function(){this.selectionModule&&this.selectionModule.clearSelection()},r.prototype.updateDataArgs=function(t){if(!Array.isArray(t.data)){var i=[];i.push(t.data),(0,e.setValue)("data",i,t)}return t},r.prototype.convertToMilestone=function(t){var i=this.getRecordByID(t);if(!(0,e.isNullOrUndefined)(i)){var a=(0,e.extend)({},{},i.taskData,!0),r=this.taskFields;if(a[r.startDate]&&this.setRecordValue(r.startDate,i.ganttProperties.startDate,a,!0),(0,e.isNullOrUndefined)(r.duration)?(a[r.startDate]=new Date(i.ganttProperties.startDate),a[r.endDate]=new Date(i.ganttProperties.endDate)):a[r.duration]=0,(0,e.isNullOrUndefined)(r.milestone)||!1===a[r.milestone]&&(a[r.milestone]=!0),(0,e.isNullOrUndefined)(r.progress)||(a[r.progress]=0),!(0,e.isNullOrUndefined)(r.child)&&a[r.child]&&(a[r.child]=[]),!(0,e.isNullOrUndefined)(r.parentID)&&a[r.parentID]&&(a[r.parentID]=null),(0,e.isNullOrUndefined)(r.segments)||(a[r.segments]=null),"FixedWork"===((0,e.isNullOrUndefined)(i.ganttProperties.taskType)?this.taskType:i.ganttProperties.taskType)&&((0,e.isNullOrUndefined)(a[r.work])?i.ganttProperties.work=0:a[r.work]=0),!(0,e.isNullOrUndefined)(this.contextMenuModule)&&this.contextMenuModule.isOpen&&"Milestone"===this.contextMenuModule.item){(0,e.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)}},r.prototype.changeTaskMode=function(t){if(this.undoRedoModule&&!this.undoRedoModule.isUndoRedoPerformed){this.undoRedoModule.redoEnabled&&this.undoRedoModule.disableRedo(),this.undoRedoModule.createUndoCollection();var i={action:"TaskMode"};i.modifiedRecords=(0,e.extend)([],[t],[],!0),this.undoRedoModule.getUndoCollection[this.undoRedoModule.getUndoCollection.length-1]=i}var a=this.taskFields,r=this.getRecordByID(t[a.id]),n=r.ganttProperties;this.isOnEdit=!0,this.setRecordValue("isAutoSchedule",!n.isAutoSchedule,n,!0),(0,e.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)},r.prototype.getTaskIds=function(){return this.taskIds},r.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)}},r.prototype.renderTemplates=function(){this.isReact&&this.renderReactTemplates()},r.prototype.resetTemplates=function(){this.isReact&&this.clearTemplate(["TaskbarTemplate","ParentTaskbarTemplate","MilestoneTemplate","TaskLabelTemplate","RightLabelTemplate","LeftLabelTemplate","TooltipTaskbarTemplate","TooltipBaselineTemplate","TooltipConnectorLineTemplate","TimelineTemplate"])},gi([(0,e.Property)(!0)],r.prototype,"allowKeyboard",void 0),gi([(0,e.Property)(!1)],r.prototype,"enableImmutableMode",void 0),gi([(0,e.Property)(!0)],r.prototype,"allowParentDependency",void 0),gi([(0,e.Property)(!0)],r.prototype,"enableHtmlSanitizer",void 0),gi([(0,e.Property)(!0)],r.prototype,"disableHtmlEncode",void 0),gi([(0,e.Complex)({},ei)],r.prototype,"loadingIndicator",void 0),gi([(0,e.Property)(!0)],r.prototype,"enableVirtualMaskRow",void 0),gi([(0,e.Property)(!0)],r.prototype,"loadChildOnDemand",void 0),gi([(0,e.Property)(!0)],r.prototype,"updateOffsetOnTaskbarEdit",void 0),gi([(0,e.Property)(!0)],r.prototype,"UpdateOffsetOnTaskbarEdit",void 0),gi([(0,e.Property)(!0)],r.prototype,"autoCalculateDateScheduling",void 0),gi([(0,e.Property)(!0)],r.prototype,"autoFocusTasks",void 0),gi([(0,e.Property)(!1)],r.prototype,"enableAdaptiveUI",void 0),gi([(0,e.Property)(!1)],r.prototype,"enableWBS",void 0),gi([(0,e.Property)(!1)],r.prototype,"enableAutoWbsUpdate",void 0),gi([(0,e.Property)(!0)],r.prototype,"allowSelection",void 0),gi([(0,e.Property)(!1)],r.prototype,"allowSorting",void 0),gi([(0,e.Property)(!0)],r.prototype,"enablePredecessorValidation",void 0),gi([(0,e.Property)(!1)],r.prototype,"showColumnMenu",void 0),gi([(0,e.Property)()],r.prototype,"columnMenuItems",void 0),gi([(0,e.Property)(["Sorting","Add","ColumnReorder","ColumnResize","ColumnState","Delete","Edit","Filtering","Indent","Outdent","NextTimeSpan","PreviousTimeSpan","RowDragAndDrop","TaskbarDragAndDrop","Search","ZoomIn","ZoomOut","ZoomToFit"])],r.prototype,"undoRedoActions",void 0),gi([(0,e.Property)()],r.prototype,"timezone",void 0),gi([(0,e.Property)(!1)],r.prototype,"collapseAllParentTasks",void 0),gi([(0,e.Property)(!1)],r.prototype,"highlightWeekends",void 0),gi([(0,e.Property)(0)],r.prototype,"treeColumnIndex",void 0),gi([(0,e.Property)([])],r.prototype,"dataSource",void 0),gi([(0,e.Property)("day")],r.prototype,"durationUnit",void 0),gi([(0,e.Property)(null)],r.prototype,"query",void 0),gi([(0,e.Property)(null)],r.prototype,"dateFormat",void 0),gi([(0,e.Property)("auto")],r.prototype,"height",void 0),gi([(0,e.Property)(!1)],r.prototype,"renderBaseline",void 0),gi([(0,e.Property)(!1)],r.prototype,"allowTaskbarDragAndDrop",void 0),gi([(0,e.Property)(!0)],r.prototype,"allowTaskbarOverlap",void 0),gi([(0,e.Property)("Horizontal")],r.prototype,"gridLines",void 0),gi([(0,e.Complex)({},Mt)],r.prototype,"labelSettings",void 0),gi([(0,e.Property)(null)],r.prototype,"taskbarTemplate",void 0),gi([(0,e.Property)(null)],r.prototype,"parentTaskbarTemplate",void 0),gi([(0,e.Property)(null)],r.prototype,"timelineTemplate",void 0),gi([(0,e.Property)(null)],r.prototype,"milestoneTemplate",void 0),gi([(0,e.Property)()],r.prototype,"baselineColor",void 0),gi([(0,e.Property)("auto")],r.prototype,"width",void 0),gi([(0,e.Property)(!1)],r.prototype,"enableVirtualization",void 0),gi([(0,e.Property)(!1)],r.prototype,"enableTimelineVirtualization",void 0),gi([(0,e.Property)()],r.prototype,"toolbar",void 0),gi([(0,e.Property)(["Monday","Tuesday","Wednesday","Thursday","Friday"])],r.prototype,"workWeek",void 0),gi([(0,e.Property)(!1)],r.prototype,"includeWeekend",void 0),gi([(0,e.Property)(!1)],r.prototype,"allowUnscheduledTasks",void 0),gi([(0,e.Property)(!1)],r.prototype,"showInlineNotes",void 0),gi([(0,e.Property)(36)],r.prototype,"rowHeight",void 0),gi([(0,e.Property)(null)],r.prototype,"taskbarHeight",void 0),gi([(0,e.Property)(null)],r.prototype,"projectStartDate",void 0),gi([(0,e.Property)(null)],r.prototype,"projectEndDate",void 0),gi([(0,e.Property)(null)],r.prototype,"resourceIDMapping",void 0),gi([(0,e.Property)(null)],r.prototype,"resourceNameMapping",void 0),gi([(0,e.Property)([])],r.prototype,"resources",void 0),gi([(0,e.Property)([])],r.prototype,"segmentData",void 0),gi([(0,e.Property)(null)],r.prototype,"connectorLineBackground",void 0),gi([(0,e.Property)(1)],r.prototype,"connectorLineWidth",void 0),gi([(0,e.Property)([])],r.prototype,"columns",void 0),gi([(0,e.Property)([])],r.prototype,"addDialogFields",void 0),gi([(0,e.Property)([])],r.prototype,"editDialogFields",void 0),gi([(0,e.Property)(-1)],r.prototype,"selectedRowIndex",void 0),gi([(0,e.Property)("hour")],r.prototype,"workUnit",void 0),gi([(0,e.Property)("FixedUnit")],r.prototype,"taskType",void 0),gi([(0,e.Property)("ProjectView")],r.prototype,"viewType",void 0),gi([(0,e.Collection)([{from:8,to:12},{from:13,to:17}],rt)],r.prototype,"dayWorkingTime",void 0),gi([(0,e.Collection)([],ai)],r.prototype,"weekWorkingTime",void 0),gi([(0,e.Collection)([],Pt)],r.prototype,"holidays",void 0),gi([(0,e.Collection)([],mt)],r.prototype,"eventMarkers",void 0),gi([(0,e.Complex)({},Vt)],r.prototype,"taskFields",void 0),gi([(0,e.Complex)({},Qt)],r.prototype,"resourceFields",void 0),gi([(0,e.Complex)({},Ht)],r.prototype,"timelineSettings",void 0),gi([(0,e.Property)([])],r.prototype,"zoomingLevels",void 0),gi([(0,e.Complex)({},Xt)],r.prototype,"sortSettings",void 0),gi([(0,e.Complex)({},ct)],r.prototype,"editSettings",void 0),gi([(0,e.Complex)({},qt)],r.prototype,"tooltipSettings",void 0),gi([(0,e.Complex)({},It)],r.prototype,"selectionSettings",void 0),gi([(0,e.Property)(!1)],r.prototype,"allowFiltering",void 0),gi([(0,e.Property)(!1)],r.prototype,"allowExcelExport",void 0),gi([(0,e.Property)(!1)],r.prototype,"allowRowDragAndDrop",void 0),gi([(0,e.Property)(!1)],r.prototype,"allowReordering",void 0),gi([(0,e.Property)(!1)],r.prototype,"readOnly",void 0),gi([(0,e.Property)(!1)],r.prototype,"allowResizing",void 0),gi([(0,e.Property)(!1)],r.prototype,"enableContextMenu",void 0),gi([(0,e.Property)(!1)],r.prototype,"enableCriticalPath",void 0),gi([(0,e.Property)(!1)],r.prototype,"enableUndoRedo",void 0),gi([(0,e.Property)(10)],r.prototype,"undoRedoStepsCount",void 0),gi([(0,e.Property)()],r.prototype,"contextMenuItems",void 0),gi([(0,e.Property)(!1)],r.prototype,"allowPdfExport",void 0),gi([(0,e.Property)(!1)],r.prototype,"validateManualTasksOnLinking",void 0),gi([(0,e.Property)(!1)],r.prototype,"enableMultiTaskbar",void 0),gi([(0,e.Property)(!1)],r.prototype,"showOverAllocation",void 0),gi([(0,e.Property)("Auto")],r.prototype,"taskMode",void 0),gi([(0,e.Complex)({},vt)],r.prototype,"filterSettings",void 0),gi([(0,e.Complex)({},wt)],r.prototype,"searchSettings",void 0),gi([(0,e.Complex)({},Ut)],r.prototype,"splitterSettings",void 0),gi([(0,e.Event)()],r.prototype,"queryTaskbarInfo",void 0),gi([(0,e.Event)()],r.prototype,"beforeExcelExport",void 0),gi([(0,e.Event)()],r.prototype,"excelExportComplete",void 0),gi([(0,e.Event)()],r.prototype,"excelQueryCellInfo",void 0),gi([(0,e.Event)()],r.prototype,"excelHeaderQueryCellInfo",void 0),gi([(0,e.Event)()],r.prototype,"rowDrag",void 0),gi([(0,e.Event)()],r.prototype,"rowDragStart",void 0),gi([(0,e.Event)()],r.prototype,"rowDragStartHelper",void 0),gi([(0,e.Event)()],r.prototype,"rowDrop",void 0),gi([(0,e.Event)()],r.prototype,"collapsing",void 0),gi([(0,e.Event)()],r.prototype,"collapsed",void 0),gi([(0,e.Event)()],r.prototype,"expanding",void 0),gi([(0,e.Event)()],r.prototype,"expanded",void 0),gi([(0,e.Event)()],r.prototype,"actionBegin",void 0),gi([(0,e.Event)()],r.prototype,"cellSave",void 0),gi([(0,e.Event)()],r.prototype,"actionComplete",void 0),gi([(0,e.Event)()],r.prototype,"actionFailure",void 0),gi([(0,e.Event)()],r.prototype,"dataStateChange",void 0),gi([(0,e.Event)()],r.prototype,"taskbarEdited",void 0),gi([(0,e.Event)()],r.prototype,"endEdit",void 0),gi([(0,e.Event)()],r.prototype,"cellEdit",void 0),gi([(0,e.Event)()],r.prototype,"load",void 0),gi([(0,e.Event)()],r.prototype,"created",void 0),gi([(0,e.Event)()],r.prototype,"destroyed",void 0),gi([(0,e.Event)()],r.prototype,"taskbarEditing",void 0),gi([(0,e.Event)()],r.prototype,"dataBound",void 0),gi([(0,e.Event)()],r.prototype,"beforeDataBound",void 0),gi([(0,e.Event)()],r.prototype,"resizeStart",void 0),gi([(0,e.Event)()],r.prototype,"resizing",void 0),gi([(0,e.Event)()],r.prototype,"resizeStop",void 0),gi([(0,e.Event)()],r.prototype,"splitterResizeStart",void 0),gi([(0,e.Event)()],r.prototype,"splitterResizing",void 0),gi([(0,e.Event)()],r.prototype,"splitterResized",void 0),gi([(0,e.Event)()],r.prototype,"columnDragStart",void 0),gi([(0,e.Event)()],r.prototype,"columnDrag",void 0),gi([(0,e.Event)()],r.prototype,"columnDrop",void 0),gi([(0,e.Event)()],r.prototype,"beforeTooltipRender",void 0),gi([(0,e.Event)()],r.prototype,"rowSelecting",void 0),gi([(0,e.Event)()],r.prototype,"rowSelected",void 0),gi([(0,e.Event)()],r.prototype,"rowDeselecting",void 0),gi([(0,e.Event)()],r.prototype,"rowDeselected",void 0),gi([(0,e.Event)()],r.prototype,"cellSelecting",void 0),gi([(0,e.Event)()],r.prototype,"cellSelected",void 0),gi([(0,e.Event)()],r.prototype,"cellDeselecting",void 0),gi([(0,e.Event)()],r.prototype,"cellDeselected",void 0),gi([(0,e.Event)()],r.prototype,"queryCellInfo",void 0),gi([(0,e.Event)()],r.prototype,"headerCellInfo",void 0),gi([(0,e.Event)()],r.prototype,"rowDataBound",void 0),gi([(0,e.Event)()],r.prototype,"columnMenuOpen",void 0),gi([(0,e.Event)()],r.prototype,"toolbarClick",void 0),gi([(0,e.Event)()],r.prototype,"columnMenuClick",void 0),gi([(0,e.Event)()],r.prototype,"contextMenuOpen",void 0),gi([(0,e.Event)()],r.prototype,"contextMenuClick",void 0),gi([(0,e.Event)()],r.prototype,"onTaskbarClick",void 0),gi([(0,e.Event)()],r.prototype,"recordDoubleClick",void 0),gi([(0,e.Event)()],r.prototype,"onMouseMove",void 0),gi([(0,e.Event)()],r.prototype,"beforePdfExport",void 0),gi([(0,e.Event)()],r.prototype,"pdfExportComplete",void 0),gi([(0,e.Event)()],r.prototype,"pdfQueryCellInfo",void 0),gi([(0,e.Event)()],r.prototype,"pdfQueryTaskbarInfo",void 0),gi([(0,e.Event)()],r.prototype,"pdfQueryTimelineCellInfo",void 0),gi([(0,e.Event)()],r.prototype,"pdfColumnHeaderQueryCellInfo",void 0),r=gi([e.NotifyPropertyChanges],r)}(e.Component);!function(e){e[e.NextPage=0]="NextPage",e[e.LastPage=1]="LastPage"}(w||(w={}));var mi="load",yi="rowDataBound",Di="queryCellInfo",vi="toolbarClick",ki="key-pressed",bi=function(){function t(e){this.isCellEdit=!1,this.isResourceCellEdited=!1,this.parent=e,this.bindTreeGridProperties()}return t.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&&$e.TreeGrid.Inject($e.Edit)},t.prototype.ensureEditCell=function(t){var a=this,r=t.rowData,n=t.columnName;this.editedColumn=this.parent.getColumnByField(n,this.parent.ganttColumns);var s=this.parent.taskFields;if(this.parent.readOnly)t.cancel=!0;else if("Dialog"!==this.parent.editSettings.mode){if(t.columnObject&&t.columnObject.field===this.parent.taskFields.constraintType&&t.columnObject.edit&&t.columnObject.edit.params&&Array.isArray(t.columnObject.edit.params.dataSource)){var o=Object.keys(D).filter(function(e){return!isNaN(Number(D[e]))}).map(function(e){return{text:a.parent.treeGridModule.getLocalizedConstraintTypeText(e),value:D[e]}});if(t.rowData&&t.rowData.hasChildRecords){var l=this.parent.treeGridModule.getLocalizedConstraintTypeText("AsSoonAsPossible"),d=this.parent.treeGridModule.getLocalizedConstraintTypeText("StartNoEarlierThan"),h=this.parent.treeGridModule.getLocalizedConstraintTypeText("FinishNoLaterThan");t.columnObject.edit.params.dataSource=o.filter(function(e){return e.text===l||e.text===d||e.text===h})}else t.columnObject.edit.params.dataSource=o}if(!r.hasChildRecords||this.parent.allowParentDependency||(n!==s.endDate||((0,e.isNullOrUndefined)(r[s.manual])||!1!==r[s.manual])&&"Auto"!==this.parent.taskMode)&&n!==s.duration&&n!==s.dependency&&n!==s.progress&&n!==s.work&&n!==s.type&&"taskType"!==n){var p=new i.Deferred,u=this.parent;return this.currentEditedRowData=t.rowData,this.parent.trigger("cellEdit",t,function(i){if(i.columnName===u.taskFields.progress&&i.rowData.hasChildRecords&&(i.cancel=!0),!t.rowData.ganttProperties.isAutoSchedule){var n=a.parent.taskFields;-1!==[n.constraintDate,n.constraintType].indexOf(t.columnObject.field)&&(i.cancel=!0)}0===r.level&&"ResourceView"===a.parent.viewType&&(i.cancel=!0),p.resolve(i),i.cancel||(i.columnName===a.parent.taskFields.notes||"WBSPredecessor"===i.columnName?a.openNotesEditor(i):(a.isCellEdit=!0,(0,e.isNullOrUndefined)(a.parent.toolbarModule)||a.parent.toolbarModule.refreshToolbarItems()))}),p}(n===s.dependency&&!this.parent.allowParentDependency||n!==s.dependency)&&(t.cancel=!0)}else t.cancel=!0},t.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");if(-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)},t.prototype.initiateCellEdit=function(t,i){var a=!0;if("actionComplete"===t.name&&t.previousData===t.data[t.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={action:"CellEditing"};r.editedColumn=t.column.field,r.modifiedRecords=[],this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=r}var n=(0,e.getValue)("column",t),s=(0,e.getValue)("data",t),o={action:"CellEditing"};o.data=this.parent.getTaskByUniqueID(s.uniqueID);var l=(0,e.getValue)("previousData",t),d=this.parent.taskFields.baselineEndDate===n.field||this.parent.taskFields.baselineStartDate===n.field,h=this.parent.allowUnscheduledTasks&&!d||!(0,e.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((0,e.isNullOrUndefined)(s))this.parent.editModule.endEditAction(t);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,t.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,t.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||(0,e.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,(0,e.isNullOrUndefined)(this.parent.editModule.cellEditModule.editedColumn)||(this.parent.editModule.cellEditModule.editedColumn=null),(0,e.isNullOrUndefined)(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},t.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)},t.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)},t.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)},t.prototype.updateGanttDataProperties=function(t,i,a){var r=t.data,n=r.ganttProperties,s=this.parent.dateValidationModule.getFieldMappings(a),o=s.startdateField,l=s.enddateField,d=s.durationField;(0,e.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]||!(0,e.isNullOrUndefined)(n[d])?(this.parent.setRecordValue(o,new Date(i.getTime()),n,!0),(!a||a&&!(0,e.isNullOrUndefined)(this.parent.taskFields.baselineDuration))&&this.parent.dateValidationModule.calculateEndDate(r,a)):(0,e.isNullOrUndefined)(n[l])&&(0,e.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(t.data),this.parent.dataOperation.updateMappingData(r,o),this.parent.dataOperation.updateMappingData(r,l),this.parent.dataOperation.updateMappingData(r,d)},t.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)},t.prototype.constraintEdited=function(t){var i=t.data,a=t.data.ganttProperties,r=t.data[this.parent.taskFields.startDate],n=t.data[this.parent.taskFields.constraintDate],s=t.data[this.parent.taskFields.constraintType];if(r=r?new Date(r.getTime()):null,(0,e.isNullOrUndefined)(n)){var o=i[this.parent.taskFields.startDate],l=i[this.parent.taskFields.endDate];switch(s){case D.MustStartOn:case D.StartNoEarlierThan:case D.StartNoLaterThan:(0,e.isNullOrUndefined)(o)||(this.parent.setRecordValue("constraintDate",new Date(o.getTime()),a,!0),n=a.constraintDate);break;case D.MustFinishOn:case D.FinishNoEarlierThan:case D.FinishNoLaterThan:(0,e.isNullOrUndefined)(l)||(this.parent.setRecordValue("constraintDate",new Date(l.getTime()),a,!0),n=a.constraintDate)}}else this.parent.setRecordValue("constraintDate",new Date(n.getTime()),a,!0);if(this.parent.setRecordValue("constraintType",s,a,!0),a.predecessor&&a.constraintType===D.AsSoonAsPossible){var d=this.parent.predecessorModule.getPredecessorDate(t.data,a.predecessor);d&&(r=d)}else r=a.constraintType===D.StartNoEarlierThan||a.constraintType===D.MustStartOn||a.constraintType===D.MustFinishOn?this.parent.dateValidationModule.getDateByConstraint(i,n):this.parent.dateValidationModule.getDateByConstraint(i,r);this.updateGanttDataProperties(t,r),this.parent.dataOperation.updateMappingData(i,"constraintDate"),this.updateEditedRecord(t)},t.prototype.validateEndDateWithSegments=function(t){for(var i=[],a=t.segments,r=0;r<a.length;r++){var n=a[parseInt(r.toString(),10)],s=n.endDate;s=!(0,e.isNullOrUndefined)(t.endDate)&&s.getTime()<t.endDate.getTime()&&r!==a.length-1?s:t.endDate,n.duration=this.parent.dataOperation.getDuration(n.startDate,s,t.durationUnit,t.isAutoSchedule,t.isMilestone),a.length>0&&s.getTime()<n.startDate.getTime()&&s.getTime()<=t.endDate.getTime()?a[r-1].duration=this.parent.dataOperation.getDuration(a[r-1].startDate,t.endDate,t.durationUnit,t.isAutoSchedule,t.isMilestone):i.push(n)}return i},t.prototype.endDateEdited=function(t,i){var a=t.data.ganttProperties,r=t.data[this.parent.taskFields.endDate];if(r=r?new Date(r.getTime()):null,(0,e.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),!(0,e.isNullOrUndefined)(a.startDate)&&(0,e.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)):!(0,e.isNullOrUndefined)(a.duration)&&(0,e.isNullOrUndefined)(a.startDate)&&this.parent.setRecordValue("startDate",this.parent.dateValidationModule.getStartDate(a.endDate,a.duration,a.durationUnit,a),a,!0),(0,e.isNullOrUndefined)(a.segments)||(a.segments=this.validateEndDateWithSegments(a)),this.compareDatesFromRecord(a)<=0?this.parent.dateValidationModule.calculateDuration(t.data):this.parent.editModule.revertCellEdit(t),this.updateDates(t),this.parent.setRecordValue("isMilestone",0===a.duration,a,!0),a.isMilestone&&this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(a.startDate,a),a,!0)}!(0,e.isNullOrUndefined)(t.data.ganttProperties.segments)&&t.data.ganttProperties.segments.length>0&&(this.parent.setRecordValue("segments",this.parent.dataOperation.setSegmentsInfo(t.data,!1),t.data.ganttProperties,!0),this.parent.dataOperation.updateMappingData(t.data,"segments")),this.parent.dataOperation.updateWidthLeft(t.data),this.parent.dataOperation.updateMappingData(t.data,"startDate"),this.parent.dataOperation.updateMappingData(t.data,"endDate"),this.parent.dataOperation.updateMappingData(t.data,"duration"),this.parent.editModule.updateResourceRelatedFields(t.data,"endDate"),this.updateEditedRecord(t)},t.prototype.endDateEditedforBaseline=function(t,i){var a=t.data.ganttProperties,r=t.data[this.parent.taskFields.baselineEndDate];if(r=r?new Date(r.getTime()):null,(0,e.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),!(0,e.isNullOrUndefined)(a.baselineStartDate)&&(0,e.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)):!(0,e.isNullOrUndefined)(a.baselineDuration)&&(0,e.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(t.data,!0):this.parent.editModule.revertCellEdit(t),this.updateDatesforBaseline(t)}this.parent.dataOperation.updateWidthLeft(t.data),this.parent.dataOperation.updateMappingData(t.data,"baselineStartDate"),this.parent.dataOperation.updateMappingData(t.data,"baselineEndDate"),this.parent.dataOperation.updateMappingData(t.data,"baselineDuration"),this.updateEditedRecord(t)},t.prototype.durationEdited=function(e,t){var i=t?"baselineDuration":"duration";if(/^[^\d.-]+$/.test(e.data[this.parent.taskFields[i]])){var a="The provided value for the "+this.parent.taskFields[i]+" field is invalid. Please ensure the "+this.parent.taskFields[i]+" field contains only valid numeric values.";this.parent.trigger("actionFailure",{error:a})}var r=e.data.ganttProperties;!t&&parseInt(e.data[this.parent.taskFields.duration],10)<0?e.data[this.parent.taskFields.duration]=r.duration:t&&parseInt(e.data[this.parent.taskFields.baselineDuration],10)<0&&(e.data[this.parent.taskFields.baselineDuration]=r.baselineDuration);var n=e.data[this.parent.taskFields[i]];this.parent.dataOperation.updateDurationValue(n,r,t),t?this.updateDatesforBaseline(e):(this.updateDates(e),this.parent.editModule.updateResourceRelatedFields(e.data,"duration")),this.updateEditedRecord(e)},t.prototype.updateDates=function(t){var i=t.data.ganttProperties,a=this.parent.dateValidationModule.getDateFromFormat(i.endDate),r=this.parent.dateValidationModule.getDateFromFormat(i.startDate),n=i.duration;(0,e.isNullOrUndefined)(n)?(this.parent.setRecordValue("isMilestone",!1,i,!0),null!==t.data[this.parent.taskFields.duration]&&this.parent.setRecordValue("endDate",null,i,!0)):((0,e.isNullOrUndefined)(r)&&!(0,e.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),(0,e.isNullOrUndefined)(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!1,t.data,!0),this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(i.startDate,i),i,!0)),!(0,e.isNullOrUndefined)(i.segments)&&i.segments.length>0&&(this.parent.setRecordValue("segments",this.parent.dataOperation.setSegmentsInfo(t.data,!1),i,!0),this.parent.dataOperation.updateMappingData(t.data,"segments")),this.parent.setRecordValue("isMilestone",0===i.duration,i,!0),this.parent.dateValidationModule.calculateEndDate(t.data)),this.parent.dataOperation.updateWidthLeft(t.data),this.parent.dataOperation.updateMappingData(t.data,"endDate"),this.parent.dataOperation.updateMappingData(t.data,"startDate"),this.parent.dataOperation.updateMappingData(t.data,"duration")},t.prototype.updateDatesforBaseline=function(t){var i=t.data.ganttProperties,a=this.parent.dateValidationModule.getDateFromFormat(i.baselineEndDate),r=this.parent.dateValidationModule.getDateFromFormat(i.baselineStartDate),n=i.baselineDuration;(0,e.isNullOrUndefined)(r)&&!(0,e.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(t.data,!0),this.parent.dataOperation.updateWidthLeft(t.data),this.parent.dataOperation.updateMappingData(t.data,"baselineEndDate"),this.parent.dataOperation.updateMappingData(t.data,"baselineStartDate"),this.parent.dataOperation.updateMappingData(t.data,"baselineDuration")},t.prototype.progressEdited=function(t){var i=t.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],t.data),i.ganttProperties.isAutoSchedule||this.parent.setRecordValue("autoWidth",this.parent.dataOperation.calculateWidth(i,!1),i.ganttProperties,!0),!(0,e.isNullOrUndefined)(t.data.ganttProperties.segments)&&t.data.ganttProperties.segments.length>0&&!(0,e.isNullOrUndefined)(this.parent.editModule.taskbarEditModule)&&this.parent.editModule.taskbarEditModule.updateSegmentProgress(t.data.ganttProperties),!t.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(t)},t.prototype.resourceEdited=function(t,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=function(t){if(o){var i=o.length;for(p=0;p<i;p++){if(o[p][r.id]===n[t]){l=p;break}l=-1}}if((0,e.isNullOrUndefined)(l)||-1===l){var a=h.filter(function(e){return n[t]===e[r.id]}),s=(0,e.extend)({},a[0]);s[r.unit]=100,d.push(s)}else d.push(o[parseInt(l.toString(),10)])},c=0;c<s;c++)u(c);t.data.ganttProperties.resourceInfo=d,this.parent.dataOperation.updateMappingData(t.data,"resourceInfo"),this.parent.editModule.updateResourceRelatedFields(t.data,"resource"),"ResourceView"===this.parent.viewType&&(this.parent.editModule.dialogModule.isResourceUpdate=!0,this.parent.editModule.dialogModule.previousResource=o),this.updateDates(t),this.updateEditedRecord(t)}},t.prototype.dependencyEdited=function(t,i){if(/[!@#$%^&*()_=[\]{};:<>|./?-]/.test(t.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(t.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(!(0,e.isNullOrUndefined)(t.data[this.parent.taskFields.dependency])){var d=t.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(t.data,l,t)||this.parent.editModule.revertCellEdit(i)},t.prototype.workEdited=function(t){var i=t.data.ganttProperties;(t.data[this.parent.taskFields.work]<0||(0,e.isNullOrUndefined)(t.data[this.parent.taskFields.work]))&&(t.data[this.parent.taskFields.work]=0),this.parent.updateDuration=!0;var a=t.data[this.parent.taskFields.work];this.parent.setRecordValue("work",a,i,!0),this.parent.editModule.updateResourceRelatedFields(t.data,"work"),this.updateDates(t),this.updateEditedRecord(t),this.parent.updateDuration=!1},t.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)},t.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)},t.prototype.updateEditedRecord=function(e){this.parent.editModule.initiateUpdateAction(e)},t.prototype.destroy=function(){this.parent.editModule.cellEditModule=void 0},t}(),wi=function(){function i(e,t){this.parent=e,this.taskbarEdit=t}return i.prototype.createTooltip=function(e,i,a){var r=this;this.toolTipObj=new t.Tooltip({opensOn:e,position:"TopRight",enableRtl:this.parent.enableRtl,mouseTrail:i,cssClass:Ne,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)},i.prototype.updateTooltipPosition=function(t){t.element.style.visibility="visible";var i=this.parent.element.closest('[style*="zoom"]');if((0,e.isNullOrUndefined)(i)){var a=this.parent.getOffsetRect(this.parent.chartPane).left+this.parent.chartPane.offsetWidth,r=t.element.offsetLeft;if(a<r+t.element.offsetWidth&&(r+=a-(r+t.element.offsetWidth)),t.element.style.left=r+"px",t.element.style.visibility="visible",t.target&&this.parent.tooltipSettings.editing){var n=t.target.getBoundingClientRect().top+window.scrollY,s=void 0;s=t.target.classList.contains("e-connectorpoint-left")||t.target.classList.contains("e-connectorpoint-right")?n-t.element.offsetHeight-14:n-t.element.offsetHeight-8,this.toolTipHeight=t.element.style.top=s+"px"}}},i.prototype.showHideTaskbarEditTooltip=function(t,i){t&&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("."+xe)):"ConnectorPointRightDrag"===this.taskbarEdit.connectorSecondAction?this.toolTipObj.open(this.taskbarEdit.connectorSecondElement.querySelector("."+Oe)):this.toolTipObj.open(this.taskbarEdit.taskBarEditElement)):(0,e.isNullOrUndefined)(this.toolTipObj)||(this.toolTipObj.destroy(),this.toolTipObj=null)},i.prototype.updateTooltip=function(t){var i=this.taskbarEdit.taskBarEditRecord.ganttProperties,a=(0,e.isNullOrUndefined)(t)||-1===t?i.width:i.segments[t].width,r=(0,e.isNullOrUndefined)(t)||-1===t?i.progressWidth:i.segments[t].progressWidth,n=(0,e.isNullOrUndefined)(t)||-1===t?i.left:i.left+i.segments[t].left;if(!(0,e.isNullOrUndefined)(this.toolTipObj))if("ConnectorPointLeftDrag"===this.taskbarEdit.taskBarEditAction||"ConnectorPointRightDrag"===this.taskbarEdit.taskBarEditAction)this.toolTipObj.content=this.getTooltipText(t),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(t),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[t])}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)}},i.prototype.getTooltipText=function(t){var i="",a=this.parent.globalize,r=this.taskbarEdit.taskBarEditRecord.ganttProperties;if(!(0,e.isNullOrUndefined)(r.segments)&&r.segments.length>0&&-1!==t&&"ProgressResizing"!==this.taskbarEdit.taskBarEditAction&&(r=r.segments[t]),this.parent.tooltipSettings.editing){var n=this.parent.tooltipModule.templateCompiler(this.parent.tooltipSettings.editing,this.parent,this.taskbarEdit.taskBarEditRecord,"TooltipEditingTemplate");(0,e.getValue)("tooltipEle",this.toolTipObj)&&this.parent.renderTemplates(),i=n[0]}else{var s=void 0,o=void 0,l=void 0;switch((0,e.isNullOrUndefined)(r)||(0,e.isNullOrUndefined)(r.startDate)||(s='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("startDate")+"</td><td class="+ve+'>:</td><td class = "e-gantt-tooltip-value">'+a.formatDate(r.startDate,{format:this.parent.getDateFormat()})+"</td></tr>"),(0,e.isNullOrUndefined)(r)||(0,e.isNullOrUndefined)(r.endDate)||(o='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("endDate")+"</td><td class="+ve+'>:</td><td class = "e-gantt-tooltip-value">'+a.formatDate(r.endDate,{format:this.parent.getDateFormat()})+"</td></tr>"),(0,e.isNullOrUndefined)(r)||(0,e.isNullOrUndefined)(r.duration)||(l='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("duration")+"</td><td class="+ve+'>:</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="+ve+'>:</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="";(0,e.isNullOrUndefined)(this.taskbarEdit.taskBarEditRecord.ganttProperties.startDate)||(h=s),(0,e.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,(0,e.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){return(0,e.initializeCSPTemplate)(function(){return i})}return i},i}(),Ti=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])},e(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)}}(),Si=function(){return Si=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Si.apply(this,arguments)},Pi=function(t){function i(e){var i=t.call(this,e)||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=e,i.initPublicProp(),i.wireEvents(),i.editTooltip=new wi(i.parent,i),i}return Ti(i,t),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=a(this.getElementByPosition(e),A);(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(t){if(this.parent.editSettings.allowTaskbarEditing){var i=this.getElementByPosition(t),r=a(i,A);this.parent.selectionModule&&this.parent.selectionModule.enableSelectMultiTouch?this.tapPointOnFocus&&this.updateTaskBarEditElement(t):this.tapPointOnFocus&&!(0,e.isNullOrUndefined)(this.taskBarEditElement)&&r&&r.innerHTML!==this.taskBarEditElement.innerHTML?(this.connectorSecondRecord=this.parent.ganttChartModule.getRecordByTaskBar(r),this.connectorSecondAction="ConnectorPointLeftDrag",this.connectorSecondElement=r,this.fromPredecessorText="Finish",this.validateConnectorPoint()&&this.taskBarEditingAction(t,!0),this.showHideActivePredecessors(!1),this.initPublicProp()):i.classList.contains(Ie)?(this.canDrag=!1,this.multipleSelectionEnabled(),this.showHideTaskBarEditingElements(i,this.taskBarEditElement),this.tapPointOnFocus=!0,this.taskBarEditAction="ConnectorPointLeftDrag",this.connectorSecondRecord=this.taskBarEditRecord,this.taskBarEditingAction(t,!1)):i.classList.contains(Ee)?(this.canDrag=!1,this.multipleSelectionEnabled(),this.showHideTaskBarEditingElements(i,this.taskBarEditElement),this.tapPointOnFocus=!0,this.taskBarEditAction="ConnectorPointRightDrag",this.connectorSecondRecord=this.taskBarEditRecord,this.taskBarEditingAction(t,!1)):(this.tapPointOnFocus&&(this.showHideActivePredecessors(!1),this.showHideTaskBarEditingElements(r,this.taskBarEditElement)),this.updateTaskBarEditElement(t))}},i.prototype.showHideActivePredecessors=function(t){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,t)}var o=this.parent.ganttChartModule.chartBodyContainer;t?((0,e.addClass)([this.taskBarEditElement],[We]),(0,e.addClass)([o],[je])):((0,e.removeClass)([this.taskBarEditElement],[We]),(0,e.removeClass)([o],[je])),this.touchEdit=t,(0,e.isNullOrUndefined)(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},i.prototype.applyActiveColor=function(t,i,a){var r=("ProjectView"===this.parent.viewType?this.taskBarEditRecord.ganttProperties.taskId.toString():this.taskBarEditRecord.ganttProperties.rowUniqueID.toString())===t?this.parent.connectorLineModule.getRecordByID(i):this.parent.connectorLineModule.getRecordByID(t),n=this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(r)];if(!(0,e.isNullOrUndefined)(n)){var s=n.querySelector("."+A),o=this.parent.element.querySelector("#ConnectorLineparent"+t+"child"+i);a?((0,e.addClass)([s],[He]),o&&(0,e.addClass)([o],[He])):((0,e.removeClass)([s],[He]),o&&(0,e.removeClass)([o],[He]))}},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(t){var i,r,n=this.getElementByPosition(t);if(n.classList.contains(pe)||n.classList.contains(oe)||n.classList.contains(le))r=a(n,oe);else if(n.classList.contains(de))r=a(n,de);else{if(r=a(n,A),!(0,e.isNullOrUndefined)(r)&&!n.classList.contains("e-connectorpoint-left")&&!n.classList.contains("e-connectorpoint-right"))if((l=this.parent.ganttChartModule.getRecordByTaskBar(r))&&l.ganttProperties&&!(0,e.isNullOrUndefined)(l.ganttProperties.segments)&&l.ganttProperties.segments.length>0)if(n.classList.contains("e-progressbar-handler-after")){for(var s=0;s<l.ganttProperties.segments.length;s++)if(l.ganttProperties.segments[s].showProgress){r=r.querySelectorAll(".e-segmented-taskbar")[s];break}}else r=a(n,H)}if(this.parent.editSettings.allowTaskbarEditing&&r){this.showHideTaskBarEditingElements(r,this.editElement),this.editElement=r,this.realTaskbarElement=this.editElement;var o=this.editElement.getAttribute("data-segment-index");if((0,e.isNullOrUndefined)(o)?this.segmentIndex=-1:this.segmentIndex=Number(o),this.taskBarEditRecord=this.parent.ganttChartModule.getRecordByTaskBar(this.editElement),"mousedown"===t.type||"touchstart"===t.type||"click"===t.type){this.taskBarEditAction=this.getTaskBarAction(t);var l,d=this.editElement.getAttribute("data-segment-index"),h=(l=this.parent.ganttChartModule.getRecordByTaskBar(r)).ganttProperties,p=this.editElement.parentElement.offsetLeft;this.currentData=l;var u=(0,e.createElement)("div",{styles:"height:100%;border-style:dashed;border-bottom:none;border-top:none;border-width:1px;position:absolute;z-index:10000"});(0,e.addClass)([u],"e-taskbar-resize-div"),u.style.setProperty("width",h.width+"px");var c=this.editElement.getAttribute("data-segment-index");!(0,e.isNullOrUndefined)(h.segments)&&this.parent.allowTaskbarDragAndDrop&&"LeftResizing"!==this.taskBarEditAction&&"RightResizing"!==this.taskBarEditAction&&"ProgressResizing"!==this.taskBarEditAction?u.style.setProperty("left",(0,e.isNullOrUndefined)(h.segments)?h.left+"px":p+"px"):u.style.setProperty("left",!(0,e.isNullOrUndefined)(h.segments)&&h.segments.length>1?p+h.segments[Number(c)].left+"px":h.left+"px");var g=this.parent.createElement("table"),f=this.parent.createElement("tbody");f.appendChild(u),g.appendChild(f);var m=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-clone-taskbar"),y=null;if(i="ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||(0,e.isNullOrUndefined)(d)||(0,e.isNullOrUndefined)(d)||0!==Number(d)?-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((0,e.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||(0,e.isNullOrUndefined)(d)||(0,e.isNullOrUndefined)(d)||0!==Number(d))this.cloneTaskbarElement=i;else{var b=i.getElementsByClassName("e-segmented-taskbar");this.cloneTaskbarElement=b[Number(d)]}if(this.taskBarEditElement=this.cloneTaskbarElement,this.taskbarElement=y,this.taskbarResizer=g,this.currentIndex=d,this.roundOffDuration=!0,"ConnectorPointLeftDrag"!==this.taskBarEditAction&&"ConnectorPointRightDrag"!==this.taskBarEditAction||!(0,e.isNullOrUndefined)(this.parent.taskFields.dependency)||(this.taskBarEditAction=null),this.updateMouseDownProperties(t),"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);(0,e.isNullOrUndefined)(w)||w.expanded||(this.prevZIndex=this.taskBarEditElement.style.zIndex,this.taskBarEditElement.style.zIndex="1000",this.taskBarEditElement.querySelector(".e-gantt-child-taskbar")&&(0,e.addClass)([this.taskBarEditElement.querySelector(".e-gantt-child-taskbar")],"e-collapsed-taskbar-drag"))}}}}else this.parent.isAdaptive?(this.taskBarEditElement&&this.showHideTaskBarEditingElements(r,this.editElement),this.initPublicProp()):this.showHideTaskBarEditingElements(r,this.editElement)},i.prototype.showHideTaskBarEditingElements=function(t,i,a){i=i||this.editElement;var r=!!this.parent.taskFields.progress,n=!0;if(!this.parent.readOnly){var s=t?this.parent.ganttChartModule.getRecordByTaskBar(t):i?this.parent.ganttChartModule.getRecordByTaskBar(i):null;if(this.parent.enableMultiTaskbar&&t){var o=this.parent.getParentTask(s.parentItem);(0,e.isNullOrUndefined)(o)||o.expanded||(n=!1,s&&s.ganttProperties.segments&&s.ganttProperties.segments.length>0?(0,e.addClass)([t.parentElement],[K]):(0,e.addClass)([t],[K]))}if(t){if(t.querySelector("."+Q)){if((0,e.addClass)([t.querySelector("."+Q)],[fe]),(0,e.addClass)([t.querySelector("."+$)],[me]),r){var l=s&&s.ganttProperties.segments&&s.ganttProperties.segments.length>0?t.parentElement.querySelector("."+J):t.querySelector("."+J);(0,e.isNullOrUndefined)(l)||((0,e.addClass)([l],[ye]),l.style.top="3px")}}else if(this.parent.isAdaptive&&r){this.parent.ganttChartModule.getRecordByTaskBar(t).hasChildRecords&&(0,e.addClass)([t],[Ae])}if((0,e.addClass)(this.parent.ganttChartModule.scrollElement.querySelectorAll("."+Te),[Me]),!(0,e.isNullOrUndefined)(this.parent.taskFields.dependency)&&(t.querySelector("."+xe)||t.parentElement.querySelector("."+xe))&&n){var d=(0,e.isNullOrUndefined)(t.querySelector("."+xe))?t.parentElement:t;(0,e.isNullOrUndefined)(d.querySelector("."+xe))||(0,e.addClass)([d.querySelector("."+xe)],[Ie]),(0,e.isNullOrUndefined)(d.querySelector("."+Oe))||(0,e.addClass)([d.querySelector("."+Oe)],[Ee])}}else a||(0,e.removeClass)(this.parent.ganttChartModule.scrollElement.querySelectorAll("."+Te),[Me]);if(i&&t!==i){if(i.querySelector("."+Q))(0,e.removeClass)([i.querySelector("."+Q)],[fe]),(0,e.removeClass)([i.querySelector("."+$)],[me]),(l=s&&s.ganttProperties.segments&&s.ganttProperties.segments.length>0?i.parentElement:i)&&l.querySelector("."+J)&&(0,e.removeClass)([l.querySelector("."+J)],[ye]);if((0,e.isNullOrUndefined)(this.parent.taskFields.dependency)||!i.querySelector("."+xe)&&!i.parentElement.querySelector("."+xe)){if(this.parent.isAdaptive){var h=this.parent.ganttChartModule.getRecordByTaskBar(i);h&&h.hasChildRecords&&(0,e.removeClass)([i],[Ae])}}else{var p=(d=(0,e.isNullOrUndefined)(i.querySelector("."+xe))?i.parentElement:i).querySelector("."+xe),u=d.querySelector("."+Oe);p&&(0,e.removeClass)([p],[Ie]),u&&(0,e.removeClass)([u],[Ee])}this.editElement=null}}},i.prototype.getTaskBarAction=function(t){var i=this.getElementByPosition(t),a=this.taskBarEditRecord,r="";return i.classList.contains(Q)?r="LeftResizing":i.classList.contains($)?r="RightResizing":(i.classList.contains(J)||(0,e.closest)(i,"."+J))&&this.parent.taskFields.progress?r="ProgressResizing":i.classList.contains(xe)?r="ConnectorPointLeftDrag":i.classList.contains(Oe)?r="ConnectorPointRightDrag":i.classList.contains(pe)?r="ParentResizing":i.classList.contains(le)||i.classList.contains(oe)||i.classList.contains(de)?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 t=document.getElementsByClassName("e-clone-taskbar")[0];if(!document.querySelectorAll(".e-errorelem").length){var i=document.createElement("div");(0,e.classList)(i,["e-errorcontainer"],[]),(0,e.classList)(i,["e-icons","e-errorelem"],[]),this.taskBarEditRecord.ganttProperties.segments&&this.taskBarEditRecord.ganttProperties.segments.length>0&&(i.style.paddingTop=this.parent.taskbarHeight+"px"),t.appendChild(i)}},i.prototype.removeErrorElem=function(){var e=document.querySelector(".e-errorelem");e&&e.remove()},i.prototype.ensurePosition=function(t,i){var a=this;t.filter(function(t){if(t.hasChildRecords&&!(0,e.isNullOrUndefined)(t.childRecords)){if(-1!==t.childRecords.indexOf(i))return a.parent.rowDragAndDropModule.dropPosition="Invalid",void a.addErrorElem();a.ensurePosition(t.childRecords,i)}})},i.prototype.mouseMoveAction=function(t){var i=this;if(this.parent.isAdaptive){if(!this.canDrag)return;this.multipleSelectionEnabled()}var r=this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer),n=this.getCoordinate(t);this.parent.enableRtl?this.mouseMoveX=Math.abs(n.pageX-(r.left+Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left))):this.mouseMoveX=n.pageX-r.left+this.parent.ganttChartModule.scrollObject.previousScroll.left,this.mouseMoveY=n.pageY-r.top+this.parent.ganttChartModule.scrollObject.previousScroll.top,this.dragMouseLeave=!1;var s=!1;if("ChildDrag"===this.taskBarEditAction||"ParentDrag"===this.taskBarEditAction||"ManualParentDrag"===this.taskBarEditAction||"MilestoneDrag"===this.taskBarEditAction){var o=void 0;if(this.parent.enableVirtualization){var l=this.parent.currentViewData.indexOf(this.taskBarEditRecord);o=this.parent.getRowByIndex(l)}else o=this.parent.getRowByIndex(this.taskBarEditRecord.index);var d={cancel:s,cloneElement:this.taskbarElement,data:this.taskBarEditRecord,target:t.target,rows:o};this.parent.trigger("rowDrag",d),s=d.cancel}if(s||this.isMouseDragCheck(),this.isMouseDragged&&this.taskBarEditAction){if(t.preventDefault(),!((0,e.isNullOrUndefined)(this.taskbarElement)||(0,e.isNullOrUndefined)(this.editElement)||"ConnectorPointRightDrag"===this.taskBarEditAction||"ConnectorPointLeftDrag"===this.taskBarEditAction||"ResourceView"===this.parent.viewType&&this.currentData.hasChildRecords)){var h=this.editElement.parentElement;if(this.parent.enableTimelineVirtualization&&this.parent.timelineModule.wholeTimelineWidth>3*this.parent.element.offsetWidth?h.style.setProperty("position","relative"):h.style.setProperty("position","absolute"),"ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||(0,e.isNullOrUndefined)(this.currentIndex)||(0,e.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):h.appendChild(this.taskbarElement):(this.taskbarElement.childNodes[0].childNodes[0].style.setProperty("top",h.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):h.parentElement.appendChild(this.taskbarElement)),"ProgressResizing"!==this.taskBarEditAction)if(this.parent.enableTimelineVirtualization&&this.parent.timelineModule.wholeTimelineWidth>3*this.parent.element.offsetWidth)this.parent.ganttChartModule.chartBodyContainer.querySelectorAll(".e-chart-scroll-container")[0].appendChild(this.taskbarResizer);else this.parent.ganttChartModule.chartBodyContainer.querySelectorAll(".e-chart-rows-container")[0].appendChild(this.taskbarResizer)}if(this.parent.allowTaskbarDragAndDrop&&("ChildDrag"===this.taskBarEditAction||"ParentDrag"===this.taskBarEditAction||"MilestoneDrag"===this.taskBarEditAction||"ManualParentDrag"===this.taskBarEditAction)){var p=this.parent.getOffsetRect(this.taskBarEditElement),u=!(0,e.isNullOrUndefined)(document.body.className)&&document.body.className.includes("e-bigger")?12:0,c=3+this.parent.chartRowsModule.connectorPointWidth+u,g=void 0;g=this.parent.enableRtl?Math.abs(p.left+c+1):Math.abs(p.left-c-1),this.isClonedElement||this.parent.enableRtl||(g-=this.parent.ganttChartModule.scrollElement.scrollLeft,this.isClonedElement=!0);var f=0;this.parent.rowDragAndDropModule.dropPosition=void 0;var m=void 0,y=void 0;y="touchmove"===t.type||"touchstart"===t.type||"touchend"===t.type?t.changedTouches[0].pageY:t.y,this.parent.enableRtl?(m=document.elementFromPoint(this.parent.ganttChartModule.chartBodyContainer.offsetWidth,y)).classList.contains("e-taskbar-resize-div")&&(m=document.elementFromPoint(this.parent.ganttChartModule.chartBodyContainer.offsetWidth-m.offsetWidth,y)):m=document.elementFromPoint(g,y);var D,v=void 0;if(this.parent.enableVirtualization){if(!this.draggedTreeGridRowElement)v=(h=this.editElement.parentElement).parentElement,this.draggedTreeGridRowElement=v,this.draggedTreeGridRowHeight=this.draggedTreeGridRowElement.offsetHeight}else if(v=this.parent.treeGrid.getRows()[this.parent.flatData.indexOf(this.taskBarEditRecord)],this.draggedTreeGridRowElement=v,this.parent.enableMultiTaskbar)if(this.taskBarEditRecord.parentItem&&!(0,e.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 k=this.parent.getRecordByID(this.taskBarEditRecord.parentItem.taskId);k.parentItem;)k=this.parent.getRecordByID(k.parentItem.taskId),this.draggedTreeGridRowHeight=this.parent.getRowByID(k.TaskID).offsetHeight}else{h=this.editElement.parentElement;this.draggedTreeGridRowElement=h.parentElement,this.draggedTreeGridRowHeight=this.draggedTreeGridRowElement.offsetHeight}else this.draggedTreeGridRowHeight=this.draggedTreeGridRowElement.offsetHeight;if(m&&(D=(0,e.closest)(m,"tr."+Y)),D){var b=void 0;b=this.parent.enableVirtualization?this.parent.treeGrid.getRows().filter(function(e){return parseInt(e.getAttribute("aria-rowindex"),10)-1==parseInt(D.getAttribute("aria-rowindex"),10)-1})[0]:this.parent.treeGrid.getRows()[parseInt(D.getAttribute("aria-rowindex"),10)-1],this.removeFirstBorder(b),this.removeLastBorder(b),((0,e.isNullOrUndefined)(b)||b.getAttribute("data-uid")!==this.draggedTreeGridRowElement.getAttribute("data-uid"))&&a(m,"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;(0,e.isNullOrUndefined)(b)||(f=b.offsetTop-R);var M=((T=this.parent.enableVirtualization?this.parent.getOffsetRect(b).top:f+C)+this.draggedTreeGridRowHeight-T)/3,x=T+M,O=x+M,I=O+M,E="mousemove"===t.type?t.pageY:(0,e.isNullOrUndefined)(t.changedTouches)?null:t.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){l=this.parent.treeGrid.getRows().indexOf(b);L=this.parent.getRowByIndex(l)}else L=this.parent.getRowByIndex(parseInt(b.getAttribute("aria-rowindex"),10)-1);var V=(0,e.getValue)("rowIndex",L),B=this.parent.currentViewData[V],A=!0;"ResourceView"!==this.parent.viewType||this.taskBarEditRecord.hasChildRecords||B.hasChildRecords||(0,e.isNullOrUndefined)(B.parentItem)||this.taskBarEditRecord.parentItem.taskId!==B.parentItem.taskId||(A=!1),B&&this.ensurePosition([this.taskBarEditRecord],B),A&&(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 W={cancel:!1,requestType:"taskbarediting",taskBarEditAction:this.taskBarEditAction,data:this.taskBarEditRecord};-1!==this.segmentIndex&&(W.requestType="mergeSegment"),this.parent.trigger("actionBegin",W,function(e){if(("ConnectorPointRightDrag"===W.taskBarEditAction||"ConnectorPointLeftDrag"===W.taskBarEditAction||"LeftResizing"===W.taskBarEditAction||"RightResizing"===W.taskBarEditAction||"ProgressResizing"===W.taskBarEditAction||"ChildDrag"===W.taskBarEditAction||"ParentDrag"===W.taskBarEditAction||"MilestoneDrag"===W.taskBarEditAction||"ManualParentDrag"===W.taskBarEditAction||"ParentResizing"===W.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.parent.editModule.createArray)&&(i.isDragged=!0,a.modifiedRecords=[],a.action=W.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===e.cancel?(i.parent.showIndicator&&i.parent.showLoadingIndicator(),i.taskBarEditingAction(t,!1)):i.editTooltip.updateTooltip(i.segmentIndex)})}else this.parent.isAdaptive||this.taskBarEditAction||this.updateTaskBarEditElement(t)},i.prototype.taskBarEditingAction=function(t,i){var r=this,n={},s=this.parent.ganttChartModule.getIndexByTaskBar(this.taskBarEditElement);if(null!==this.taskBarEditRecord){if(n.editingFields=this.taskBarEditRecord.ganttProperties,n.data=this.taskBarEditRecord,"ResourceView"===this.parent.viewType&&0===n.data.level)return;n.recordIndex=s,n.taskBarEditAction=this.taskBarEditAction,n.roundOffDuration=this.roundOffDuration,n.cancel=!1,n.previousData=this.previousItem,n.segmentIndex=this.segmentIndex,this.roundOffDuration=n.roundOffDuration,this.targetElement=n.target=this.cloneTaskbarElement,this.updateMouseMoveProperties(t),this.oldData||(this.oldData=(0,e.extend)([],[],[this.taskBarEditRecord],!0)[0]);var o=-1!==this.segmentIndex?this.segmentIndex:null;if("ProgressResizing"===this.taskBarEditAction){if(this.mainElement=a(this.taskBarEditElement,A),this.taskBarEditRecord.ganttProperties.segments&&this.taskBarEditRecord.ganttProperties.segments.length>0){o=-1;for(var l=0;l<this.taskBarEditRecord.ganttProperties.segments.length;l++){var d=document.getElementsByClassName("e-child-progress-resizer e-progress-resize-gripper")[0].style,h=this.parent.enableRtl?parseInt(d.right,10)-8:parseInt(d.left,10)+8;h<this.taskBarEditRecord.ganttProperties.segments[l].width&&0===l&&(o=l),this.taskBarEditRecord.ganttProperties.segments[l+1]&&h<this.taskBarEditRecord.ganttProperties.segments[l+1].width+this.taskBarEditRecord.ganttProperties.segments[l+1].left&&h>this.taskBarEditRecord.ganttProperties.segments[l+1].left&&(o=l+1)}}this.performProgressResize(t,o)}else"LeftResizing"===this.taskBarEditAction?this.enableLeftResizing(t):"RightResizing"===this.taskBarEditAction||"ParentResizing"===this.taskBarEditAction?this.enableRightResizing(t):"ParentDrag"===this.taskBarEditAction||"ChildDrag"===this.taskBarEditAction||"MilestoneDrag"===this.taskBarEditAction||"ManualParentDrag"===this.taskBarEditAction?this.enableDragging(t):"ConnectorPointLeftDrag"!==this.taskBarEditAction&&"ConnectorPointRightDrag"!==this.taskBarEditAction||(this.updateConnectorLineSecondProperties(t),this.triggerDependencyEvent(t),this.drawFalseLine());if(this.parent.allowTaskbarDragAndDrop&&"LeftResizing"!==this.taskBarEditAction&&"RightResizing"!==this.taskBarEditAction&&"ProgressResizing"!==this.taskBarEditAction){var p=this.parent.getOffsetRect(this.parent.chartPane),u=this.getCoordinate(t),c={top:u.pageY,left:u.pageX},g={left:Math.abs(c.left-p.left),top:c.top-p.top};if("ResourceView"===this.parent.viewType&&this.parent.enableMultiTaskbar){var f=this.parent.getRecordByID(this.taskBarEditRecord.parentItem.taskId);if(!this.parent.allowTaskbarOverlap&&this.taskBarEditRecord.parentItem&&!f.expanded){var m=0;if(parseInt(this.editElement.style.marginTop,10)>this.parent.rowHeight){for(l=0;l<f.childRecords.length&&f.childRecords[l].ganttProperties.taskId!==this.taskBarEditRecord.ganttProperties.taskId;l++)m+=this.parent.rowHeight;g.top=g.top-m}}}this.topValue=g.top;var y=void 0;y="touchmove"===t.type||"touchstart"===t.type||"touchend"===t.type?t.changedTouches[0].pageX:t.pageX,this.parent.enableRtl?this.leftValue=g.left-Math.abs(y-this.parent.getOffsetRect(this.taskBarEditElement).left)-(0!==this.previousLeftValue?y-this.previousLeftValue:0):this.leftValue=g.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=o,this.setItemPosition(),this.updateEditedItem(),this.tooltipValue="touchmove"===t.type||"touchstart"===t.type||"touchend"===t.type?t.changedTouches[0].pageX:t.pageX,this.taskBarEditRecord.ganttProperties.segments&&-1===o||this.editTooltip.updateTooltip(o),i&&this.taskBarEditedAction(t),this.parent.trigger("taskbarEditing",n,function(t){if(!0!==t.cancel&&2!==t.data.ganttProperties.constraintType&&3!==t.data.ganttProperties.constraintType&&-1!==["ChildDrag","ParentDrag","MilestoneDrag","LeftResizing","RightResizing"].indexOf(t.taskBarEditAction)&&(n.data.ganttProperties.constraintType=4,n.data.ganttProperties.constraintDate=n.data.ganttProperties.startDate),("ChildDrag"===t.taskBarEditAction||"ParentDrag"===t.taskBarEditAction||"MilestoneDrag"===t.taskBarEditAction)&&(2===t.data.ganttProperties.constraintType||3===t.data.ganttProperties.constraintType)||"LeftResizing"===t.taskBarEditAction&&2===t.data.ganttProperties.constraintType||"RightResizing"===t.taskBarEditAction&&3===t.data.ganttProperties.constraintType){var i=r.parent.predecessorModule.filterPredecessorsByTarget(n.data.ganttProperties.predecessor,n.data,r.parent.viewType),a=t.data.ganttProperties.predecessor&&t.data.ganttProperties.predecessor.length>0;a&&0===i.length&&(a=!1),a||(t.cancel=!0)}t.cancel&&null!==r.taskBarEditRecord&&(r.tapPointOnFocus=!1,(0,e.merge)(r.taskBarEditRecord.ganttProperties,t.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(t){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 Si({},e)}),s=n[this.segmentIndex];this.mouseDownX>this.mouseMoveX?(r=(0,e.isNullOrUndefined)(this.previousMouseMove)?this.mouseDownX-this.mouseMoveX:this.previousMouseMove-this.mouseMoveX,this.previousMouseMove=this.mouseMoveX,s.left=s.left-r):(r=(0,e.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(t){var i=this.taskBarEditRecord.ganttProperties.segments.map(function(e){return Si({},e)}),a=i[this.segmentIndex],r=0;if(this.mouseDownX>this.mouseMoveX)if(this.mouseMoveX<t.left+a.width+a.left){if(r=(0,e.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(t.left+a.left<t.left+n.left+n.width){var s=t.left+n.left+n.width-(t.left+a.left);a.width-=s,a.left=a.left+s}}}else if(a.left<=0&&0===this.segmentIndex){this.parent.setRecordValue("left",t.left-r,t,!0),this.parent.setRecordValue("width",t.width+r,t,!0),a.width=a.width+r;for(var o=1;o<t.segments.length;o++){var l=i[o];l.left=l.left+r}}}else this.mouseMoveX>t.left+a.width+a.left&&(r=(0,e.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<t.left+a.width+a.left-this.parent.perDayWidth)if(r=(0,e.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",t.left+r,t,!0),this.parent.setRecordValue("width",t.width-r,t,!0),a.width=a.width-r;for(o=1;o<t.segments.length;o++){var d=i[o];d.left=d.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<t.left+a.left+a.width&&a.width>this.parent.perDayWidth)if(r=(0,e.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",t.width-r,t,!0),this.parent.setRecordValue("left",t.left+r,t,!0),a.width=a.width-r;for(o=1;o<t.segments.length;o++){var h=i[o];h.left=h.left-r}}else a.left=a.left+r,a.width=a.width-r;this.parent.setRecordValue("segments",i,t,!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(t){t.width<=3?(this.parent.setRecordValue("width",3,t,!0),this.parent.setRecordValue("isMilestone",!0,t,!0),(0,e.isNullOrUndefined)(this.taskBarEditRecord[this.parent.taskFields.milestone])||this.parent.setRecordValue(this.parent.taskFields.milestone,!0,this.taskBarEditRecord,!0)):(this.parent.setRecordValue("width",t.width,t,!0),this.parent.setRecordValue("isMilestone",!1,t,!0),(0,e.isNullOrUndefined)(this.taskBarEditRecord[this.parent.taskFields.milestone])||this.parent.setRecordValue(this.parent.taskFields.milestone,!1,this.taskBarEditRecord,!0))},i.prototype.enableRightResizing=function(t){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 Si({},e)}),n=r[this.segmentIndex];if(this.mouseDownX>this.mouseMoveX){if(this.mouseMoveX>i.left+n.left&&this.mouseDownX-this.mouseMoveX>3)a=(0,e.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=(0,e.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;(0,e.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(t,i)},i.prototype.updateEditedItem=function(){var t,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?(t=this.getRoundOffStartLeft(n,this.roundOffDuration),i=this.getDateByLeft(t),(0,e.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)&&(0,e.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){t=this.getRoundOffEndLeft(n,this.roundOffDuration);var d=this.getDateByLeft(t);(0,e.isNullOrUndefined)(n.startDate)&&(r=this.parent.dateValidationModule.getValidStartDate(n),this.parent.setRecordValue("startDate",r,n,!0));var h=(0,e.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)}(0,e.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(t){if((0,e.isNullOrUndefined)(t.ganttProperties)||(0,e.isNullOrUndefined)(t.ganttProperties.predecessor))return{isValid:!0};var i=t.ganttProperties.predecessor,a=this.extractEndDates(i).maxEndDate;return(a=this.parent.predecessorModule.getPredecessorDate(t,i,null))?{isValid:((0,e.isNullOrUndefined)(t.ganttProperties.startDate)?t.ganttProperties.endDate:t.ganttProperties.startDate).getTime()>=a.getTime(),maxDate:a}:{isValid:!0}},i.prototype.updateChildDrag=function(t){var i,a=this.getRoundOffStartLeft(t,this.roundOffDuration),r=this.getDateByLeft(a,t.isMilestone,t);0===this.segmentIndex?(this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(r,t,null),t,!0),t.segments[0].startDate=r,t.segments[0].endDate=this.parent.dataOperation.getEndDate(t.segments[0].startDate,t.segments[0].duration,t.durationUnit,t,!1),this.parent.setRecordValue("segments",t.segments,t,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments"),this.parent.chartRowsModule.incrementSegments(t.segments,0,this.taskBarEditRecord),this.parent.setRecordValue("endDate",t.segments[t.segments.length-1].endDate,t,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.segments,t.segments,this.taskBarEditRecord,!0)):!(0,e.isNullOrUndefined)(t.endDate)&&(0,e.isNullOrUndefined)(t.startDate)?(i=this.parent.dateValidationModule.checkStartDate(r,t,null),i=this.parent.dateValidationModule.checkEndDate(i,this.taskBarEditRecord.ganttProperties),this.parent.setRecordValue("endDate",i,t,!0)):(this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(r,t,null),t,!0),(0,e.isNullOrUndefined)(t.duration)||this.parent.dateValidationModule.calculateEndDate(this.taskBarEditRecord))},i.prototype.updateSplitLeftResize=function(t){var i=t.segments[this.segmentIndex],a=0===this.segmentIndex?this.getRoundOffStartLeft(t,this.roundOffDuration):this.getRoundOffStartLeft(i,this.roundOffDuration),r=this.getDateByLeft(a),n=this.parent.dataOperation.checkStartDate(r,t,!1),s=this.parent.dataOperation.getDuration(n,i.endDate,t.durationUnit,t.isAutoSchedule,t.isMilestone);if(i.startDate=new Date(n.getTime()),i.duration=s,this.parent.setRecordValue("duration",this.sumOfDuration(t.segments),t,!0),0===this.segmentIndex&&this.parent.setRecordValue("startDate",i.startDate,t,!0),this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord,"duration"),!(0,e.isNullOrUndefined)(t.segments[this.segmentIndex-1])){var o=this.parent.dataOperation.getDuration(t.segments[this.segmentIndex-1].endDate,t.segments[this.segmentIndex].startDate,t.durationUnit,t.isAutoSchedule,t.isMilestone);i.offsetDuration=o}this.parent.setRecordValue("segments",t.segments,t,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")},i.prototype.updateSplitRightResizing=function(t){var i=t.segments[this.segmentIndex],a=this.getRoundOffEndLeft(t,this.roundOffDuration),r=this.getDateByLeft(a),n=this.parent.dataOperation.checkEndDate(r,t,!1),s=this.parent.dataOperation.getDuration(i.startDate,n,t.durationUnit,t.isAutoSchedule,t.isMilestone);if(i.endDate=new Date(n.getTime()),i.duration=s,!(0,e.isNullOrUndefined)(t.segments[this.segmentIndex+1])){var o=t.segments[this.segmentIndex+1],l=this.parent.dataOperation.getDuration(t.segments[this.segmentIndex].endDate,o.startDate,t.durationUnit,t.isAutoSchedule,t.isMilestone);i.offsetDuration=l}this.parent.setRecordValue("segments",t.segments,t,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments"),this.parent.setRecordValue("duration",this.sumOfDuration(t.segments),t,!0),this.parent.setRecordValue("endDate",t.segments[t.segments.length-1].endDate,t,!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(t){var i=t.segments[this.segmentIndex],a=this.parent.taskFields,r=this.getRoundOffStartLeft(i,this.roundOffDuration),n=this.getDateByLeft(r);n=this.parent.dateValidationModule.checkStartDate(n,t,null),i.startDate=n;var s=this.parent.dataOperation.getEndDate(i.startDate,i.duration,t.durationUnit,t,!1);if(t.segments[this.segmentIndex+1]&&s.getTime()>t.segments[this.segmentIndex+1].startDate.getTime()?i.endDate=t.segments[this.segmentIndex+1].startDate:i.endDate=s,i.duration=this.parent.dataOperation.getDuration(i.startDate,i.endDate,t.durationUnit,t.isAutoSchedule,t.isMilestone),this.parent.setRecordValue("duration",this.sumOfDuration(t.segments),t,!0),this.parent.setRecordValue("endDate",t.segments[t.segments.length-1].endDate,t,!0),(0,e.isNullOrUndefined)(a.endDate)||this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"endDate"),!(0,e.isNullOrUndefined)(t.segments[this.segmentIndex-1])){var o=this.parent.dataOperation.getDuration(t.segments[this.segmentIndex-1].endDate,t.segments[this.segmentIndex].startDate,t.durationUnit,t.isAutoSchedule,t.isMilestone);1!==i.startDate.getDay()||0!==o||this.parent.includeWeekend||(o=1),i.offsetDuration=o}if(!(0,e.isNullOrUndefined)(t.segments[this.segmentIndex+1])){var l=t.segments[this.segmentIndex+1];o=this.parent.dataOperation.getDuration(t.segments[this.segmentIndex].endDate,l.startDate,t.durationUnit,t.isAutoSchedule,t.isMilestone);1!==l.startDate.getDay()||0!==o||this.parent.includeWeekend||(o=1),l.offsetDuration=o}this.parent.setRecordValue("segments",t.segments,t,!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(t,i){var a=((0,e.isNullOrUndefined)(t),t.left);-1!==this.segmentIndex&&(0,e.isNullOrUndefined)(t.segments)&&(a=t.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,(0,e.isNullOrUndefined)(t)?t.isMilestone:null,t),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(t,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()+t*n):r=s=this.parent.timelineModule.calculateDateExcludingNonWorkingDays(t,r),this.parent.timelineSettings.showWeekend?this.parent.isInDst(s)?r.setTime(r.getTime()+(t-this.parent.perDayWidth/24)*n):r.setTime(r.getTime()+t*n):r=s,i&&!(0,e.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(!(0,e.isNullOrUndefined)(this.editElement)){var t=this.editElement.parentElement;this.parent.allowTaskbarDragAndDrop&&"ChildDrag"===this.taskBarEditAction?t.style.position=null:this.parent.enableTimelineVirtualization&&this.parent.timelineModule.wholeTimelineWidth>3*this.parent.element.offsetWidth?t.style.setProperty("position","relative"):t.style.setProperty("position","absolute")}var i,r=this.taskBarEditRecord.ganttProperties,n=this.parent.enableRtl?"right":"left",s=(0,e.isNullOrUndefined)(r.segments)?null:r.segments[this.segmentIndex],o="MilestoneDrag"===this.taskBarEditAction||r.isMilestone?this.parent.chartRowsModule.milestoneHeight:r.width,l=this.parent.isAdaptive?o-2:o-10;(0,e.isNullOrUndefined)(s)||(l=this.parent.isAdaptive?s.width-2:s.width-10),this.taskBarEditElement.style.setProperty("opacity",".75"),i=this.parent.allowTaskbarDragAndDrop&&!r.isAutoSchedule&&this.taskBarEditRecord.hasChildRecords||this.taskBarEditElement.classList.contains(A)?this.taskBarEditElement:"ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||0!==this.segmentIndex?(0,e.closest)(this.taskBarEditElement,"tr."+Y).querySelector("."+A):this.taskBarEditElement.parentElement;var d=!(!this.taskBarEditElement.classList.contains("e-segmented-taskbar")&&!this.taskBarEditElement.querySelector(".e-segmented-taskbar")),h=this.taskBarEditElement.querySelector("."+se),p=this.taskBarEditElement.querySelector("."+ne),u=d?a(this.taskBarEditElement,A).querySelector("."+J):this.taskBarEditElement.querySelector("."+J),c=this.taskBarEditElement.querySelector("."+$),g=this.taskBarEditElement.querySelector("."+ue),f=this.taskBarEditElement.querySelector("."+ce),m=this.taskBarEditElement.querySelector("."+Fe),y=i.querySelector("."+Fe),D=this.taskBarEditElement,v=this.taskBarEditElement.querySelector("."+le),k=(this.taskBarEditElement.querySelector("."+pe),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(!d||(0,e.isNullOrUndefined)(r.segments)||"RightResizing"!==this.taskBarEditAction&&0===this.segmentIndex||((0,e.isNullOrUndefined)(k)||(!this.parent.allowTaskbarDragAndDrop||this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&"ChildDrag"!==this.taskBarEditAction&&"ParentDrag"!==this.taskBarEditAction)&&(k.style.width=s.width+"px"),this.taskBarEditElement.style.width=s.width+"px",this.parent.enableRtl?this.taskBarEditElement.style.right=s.left+"px":(this.taskBarEditElement.style.left=s.left+"px",(0,e.isNullOrUndefined)(k)||(!this.parent.allowTaskbarDragAndDrop||this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&"ChildDrag"!==this.taskBarEditAction&&"ParentDrag"!==this.taskBarEditAction)&&(k.style.left=s.left+this.editElement.parentElement.offsetLeft+"px"))),i.style.setProperty(n,(this.parent.allowTaskbarDragAndDrop?this.leftValue:r.left)+"px"),i.style.width=o+"px",d&&y&&(y.style.left=(this.parent.isAdaptive?o+10:o+2)+"px"),this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&"LeftResizing"!==this.taskBarEditAction&&"RightResizing"!==this.taskBarEditAction&&"ProgressResizing"!==this.taskBarEditAction){var b=this.parent.taskbarHeight/2;i.style.setProperty("top",this.topValue+b+"px"),i.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<r.segments.length;T++){var S=r.segments[T],P=w[T];P.style.width=S.width+"px",1===r.segments.length?(k.style.width=S.width+"px",k.style.setProperty(n,r.left+"px")):(0===T&&(k.style.width=S.width+"px",k.style.setProperty(n,S.left+r.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=o+"px",k.style.setProperty(n,r.left+"px"),i.style.setProperty("opacity",".75"))}if(m&&(this.parent.enableRtl?m.style.left=(this.parent.isAdaptive?o+10:o-2)+"px":m.style.left=(this.parent.isAdaptive?o+10:o+2)+"px"),m&&"LeftResizing"===this.taskBarEditAction&&(m.style.left=o-2+"px"),u&&h&&("LeftResizing"===this.taskBarEditAction||"RightResizing"===this.taskBarEditAction||"ChildDrag"===this.taskBarEditAction||"ParentDrag"===this.taskBarEditAction)&&(u.style.display="none",h.style.display="none"),m&&"ProgressResizing"===this.taskBarEditAction&&(m.style.display="none"),"MilestoneDrag"===this.taskBarEditAction||r.isMilestone)i.style.setProperty(n,(this.parent.allowTaskbarDragAndDrop?this.leftValue:r.left-o/2)+"px"),k.style.setProperty(n,r.left-o/2+"px"),k.style.width=o+"px";else if("ProgressResizing"===this.taskBarEditAction)if(-1===this.segmentIndex){if(p.style.setProperty(n,r.left+r.progressWidth-10+"px"),!(0,e.isNullOrUndefined)(h)){h.style.width=r.progressWidth+"px",h.style.borderBottomRightRadius=this.progressBorderRadius+"px",h.style.borderTopRightRadius=this.progressBorderRadius+"px";var C=this.parent.enableRtl?r.progressWidth+8:r.progressWidth-8;u.style.setProperty(n,C+"px")}}else{this.updateSegmentProgress(this.taskBarEditRecord.ganttProperties);for(var R=i.querySelectorAll(".e-gantt-child-progressbar"),M=0;M<R.length;M++)r.segments[M]&&r.segments[M].progressWidth&&this.segmentIndex!==M&&(R[M].style.display="block",R[M].style.width=r.segments[M].progressWidth+"px");h.style.width=r.segments[this.segmentIndex].progressWidth+"px",h.style.borderBottomRightRadius=this.progressBorderRadius+"px",h.style.borderTopRightRadius=this.progressBorderRadius+"px";var x=this.parent.enableRtl?this.progressValue+8:this.progressValue-8;u.style.setProperty(n,x+"px")}else"RightResizing"!==this.taskBarEditAction||(0,e.isNullOrUndefined)(p)?"ParentDrag"===this.taskBarEditAction?(k.style.setProperty(n,r.left+"px"),k.style.width=o+"px",k.style.width=r.width+"px",(0,e.isNullOrUndefined)(g)||(g.style.width=o+"px",k.style.width=r.width+"px"),(0,e.isNullOrUndefined)(h)||(0,e.isNullOrUndefined)(f)||(f.style.width=r.progressWidth+"px")):"ParentResizing"===this.taskBarEditAction?(k.style.width=r.width+"px",k.style.setProperty(n,r.left+"px"),D.style.setProperty("width",r.width+"px"),v.style.setProperty("width",r.width+"px"),this.editElement.parentElement.style.setProperty("width",r.width+"px")):"ManualParentDrag"===this.taskBarEditAction?(k.style.width=r.width+"px",k.style.setProperty(n,r.left+"px"),D.style.setProperty(n,r.left-r.autoLeft+"px"),this.parent.allowTaskbarDragAndDrop&&(D.style.setProperty(n,this.leftValue+"px"),D.style.setProperty("top",this.topValue+"px"),D.style.zIndex="4")):((0,e.isNullOrUndefined)(p)||d||(p.style.width=r.width+"px",p.style.left=r.left+"px",this.taskBarEditElement.style.width=r.width+"px",this.taskBarEditElement.style.left=(this.parent.allowTaskbarDragAndDrop?this.leftValue:r.left)+"px",k.style.setProperty(n,r.left+"px"),k.style.width=r.width+"px"),(0,e.isNullOrUndefined)(h)||(c.style.setProperty(n,l+"px"),h.style.width=r.progressWidth+"px",(0,e.isNullOrUndefined)(u)||u.style.setProperty(n,r.progressWidth-10+"px")),d&&(c.style.setProperty(n,l+"px"),h.style.width=s.width+"px",(0,e.isNullOrUndefined)(u)||u.style.setProperty(n,s.width-10+"px"))):(k.style.width=o+"px",p.style.width=o+"px",(0,e.isNullOrUndefined)(h)||(h.style.width=r.progressWidth+"px",c.style.setProperty(n,l+"px"),(0,e.isNullOrUndefined)(u)||u.style.setProperty(n,r.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(t){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"===t.type||"touchstart"===t.type||"touchend"===t.type){var a=this.getCoordinate(t);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=!(0,e.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,t.y)}else this.droppedTarget=document.elementFromPoint(t.x,t.y);this.droppedTarget&&this.droppedTarget.classList.contains("e-span-label")&&(this.droppedTarget=document.elementFromPoint(t.x+this.droppedTarget.offsetWidth,t.y))}this.previousIds=this.parent.ids.slice(),this.previousFlatData=this.parent.flatData.slice(),this.taskBarEditedAction(t),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&&!(0,e.isNullOrUndefined)(this.taskBarEditElement)&&((0,e.isNullOrUndefined)(this.taskBarEditElement.querySelector(".e-gantt-child-taskbar"))||this.taskBarEditElement.querySelector(".e-gantt-child-taskbar").classList.contains("e-collapsed-taskbar-drag")&&((0,e.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(t){var i={},a=this.mouseDownX,r=this.mouseDownY,n=this.taskBarEditRecord,s=this.parent.ganttChartModule.getIndexByTaskBar(this.taskBarEditElement),o=this.mouseMoveX,l=this.getCoordinate(t).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((0,e.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];if(0!==s)if(o.left<=n)r=n-o.left;else r=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(t){var i=(0,e.extend)({},t),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((0,e.isNullOrUndefined)(this.droppedTarget)||(l=(0,e.closest)(this.droppedTarget,"tr."+Y)),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||(0,e.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||(0,e.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),(0,e.isNullOrUndefined)(r.segments)||this.updateSegmentProgress(r)}}else{var D=i.data.ganttProperties.segments;if(!(0,e.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=(0,e.isNullOrUndefined)(w)?this.parent.cloneProjectEndDate:new Date(w.startDate.getTime()),S=(0,e.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()&&!(0,e.isNullOrUndefined)(b)&&!(0,e.isNullOrUndefined)(v)){var R=[{firstSegmentIndex:b.segmentIndex,secondSegmentIndex:v.segmentIndex}];this.parent.chartRowsModule.mergeTask(k.taskId,R)}else if(C.getTime()>=T.getTime()&&this.segmentIndex!==D.length-1){R=[{firstSegmentIndex:v.segmentIndex,secondSegmentIndex:w.segmentIndex}];this.parent.chartRowsModule.mergeTask(k.taskId,R)}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 M=D.length-2;M>=0;M--){var x=Si({},D[M]);if(!(0,e.isNullOrUndefined)(x)){var O=new Date(x.endDate);O.setDate(O.getDate()-x.offsetDuration),x.endDate=O,x.startDate=this.parent.dataOperation.getStartDate(x.endDate,x.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)){R=[{firstSegmentIndex:v.segmentIndex,secondSegmentIndex:w.segmentIndex}];this.parent.chartRowsModule.mergeTask(k.taskId,R)}else if(P.getTime()>=S.getTime()&&!(0,e.isNullOrUndefined)(b)&&!(0,e.isNullOrUndefined)(v)&&!this.parent.includeWeekend&&0===this.parent.dataOperation.getDuration(this.parent.dataOperation.checkEndDate(P,r,!1),S,r.durationUnit,!1,!1)){R=[{firstSegmentIndex:b.segmentIndex,secondSegmentIndex:v.segmentIndex}];this.parent.chartRowsModule.mergeTask(k.taskId,R)}}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 t,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;(0,e.isNullOrUndefined)(document.querySelectorAll(".e-chart-row")[0])||(d=document.querySelectorAll(".e-chart-row")[0].offsetWidth),"ConnectorPointLeftDrag"===this.taskBarEditAction&&(t=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&&(t=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=(0,e.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=t+"px",this.falseLine.style.transformOrigin="100% 0%"):(this.falseLine.style.right="auto",this.falseLine.style.left=t+"px",this.falseLine.style.transformOrigin="0% 100%"),this.parent.ganttChartModule.chartBodyContainer.appendChild(this.falseLine)},i.prototype.removeFalseLine=function(t){this.falseLine&&((0,e.remove)(this.falseLine),this.falseLine=null,t&&(this.elementOffsetLeft=0,this.elementOffsetTop=0,this.elementOffsetWidth=0,this.elementOffsetHeight=0,(0,e.removeClass)(this.parent.ganttChartModule.scrollElement.querySelectorAll("."+Te),[Me])))},i.prototype.updateConnectorLineSecondProperties=function(t){var i=this.getElementByPosition(t),r=a(i,A),n=document.body.className.includes("e-bigger");this.connectorSecondAction=null;var s=0;if(a(i,xe)?(this.connectorSecondAction="ConnectorPointLeftDrag",this.toPredecessorText="Start"):a(i,Oe)?(this.connectorSecondAction="ConnectorPointRightDrag",this.toPredecessorText="Finish"):(this.connectorSecondAction=null,this.toPredecessorText=null),this.taskBarEditElement!==r&&this.taskBarEditElement!==this.highlightedSecondElement){if(this.parent.virtualScrollModule&&this.parent.enableVirtualization)s=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-(n?10:0),this.elementOffsetTop=this.realTaskbarElement.parentElement.offsetTop+this.realTaskbarElement.offsetHeight/3-5+this.taskBarEditElement.children[0].offsetTop+s):(this.elementOffsetLeft=this.realTaskbarElement.offsetLeft-(n?10:0),this.elementOffsetTop=this.realTaskbarElement.parentElement.offsetTop+this.realTaskbarElement.offsetHeight/3+s),this.elementOffsetWidth=this.realTaskbarElement.offsetWidth+(n?20:0),this.elementOffsetHeight=this.realTaskbarElement.offsetHeight),this.showHideTaskBarEditingElements(r,this.highlightedSecondElement,!0)}(0,e.isNullOrUndefined)(this.connectorSecondAction)&&!(0,e.isNullOrUndefined)(this.connectorSecondElement)&&(!this.connectorSecondRecord.hasChildRecords||this.connectorSecondRecord.hasChildRecords&&this.parent.allowParentDependency)&&(this.editTooltip.showHideTaskbarEditTooltip(!1,this.segmentIndex),(0,e.removeClass)([this.connectorSecondElement.querySelector("."+xe)],[Ue]),(0,e.removeClass)([this.connectorSecondElement.querySelector("."+Oe)],[Ue])),this.connectorSecondElement=this.connectorSecondAction?r:null,this.highlightedSecondElement=r,this.connectorSecondRecord=(0,e.isNullOrUndefined)(this.connectorSecondElement)?null:this.parent.ganttChartModule.getRecordByTaskBar(this.connectorSecondElement)},i.prototype.triggerDependencyEvent=function(t,i){var a,r=this.parent.element.closest('[style*="zoom"]');if(r){var n=parseFloat(getComputedStyle(r).zoom);a=t.pageY/n}var s,o,l=this.taskBarEditRecord.ganttProperties,d=this.connectorSecondRecord?this.connectorSecondRecord.ganttProperties:null,h=this.getElementByPosition(t),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")),(0,e.isNullOrUndefined)(d))this.drawPredecessor=!1;else{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),(0,e.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),!(0,e.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),!(0,e.isNullOrUndefined)(this.parent.connectorLineModule.tooltipTable.parentElement)&&!(0,e.isNullOrUndefined)(this.parent.connectorLineModule.tooltipTable.parentElement.parentElement)){var y=this.parent.connectorLineModule.tooltipTable.parentElement.parentElement,D=(0,e.isNullOrUndefined)(a)?t.pageY:a;y.offsetTop+y.offsetHeight>D&&(y.style.top=t.pageY-y.offsetHeight-20+"px")}}this.drawPredecessor=!0}else this.parent.isAdaptive?(h.classList.contains(xe)||h.classList.contains(Oe))&&this.showHideActivePredecessors(!0):(0,e.addClass)([p],[Ue]),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}(T),Ci=m(215),Ri=m(674),Mi=m(323),xi=m(741),Oi=m(570),Ii=function(){return Ii=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Ii.apply(this,arguments)},Ei=function(){function a(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:xi.CheckBox,dropdownedit:et.DropDownList,datepickeredit:Oi.DatePicker,datetimepickeredit:Oi.DateTimePicker,maskededit:Mi.MaskedTextBox,numericedit:Mi.NumericTextBox,stringedit:Mi.TextBox,defaultedit:Mi.TextBox},this.processDialogFields(),this.wireEvents()}return a.prototype.wireEvents=function(){this.parent.on("chartDblClick",this.dblClickHandler,this)},a.prototype.dblClickHandler=function(t){var i=this.parent.ganttChartModule.getRecordByTarget(t);!(0,e.isNullOrUndefined)(i)&&this.parent.editModule&&this.parent.editSettings.allowEditing&&this.openEditDialog(i)},a.prototype.processDialogFields=function(){(0,e.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),(0,e.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)},a.prototype.validateDialogFields=function(t){for(var i=[],a=0,r=0;r<t.length;r++){var n=(0,Ze.getActualProperties)(t[r]);"General"!==n.type||!(0,e.isNullOrUndefined)(n.fields)&&0!==n.fields.length||(n.fields=this.getGeneralColumnFields()),"Advanced"!==n.type||!(0,e.isNullOrUndefined)(n.fields)&&0!==n.fields.length||(n.fields=this.getAdvancedColumnFields()),"Dependency"===n.type&&(0,e.isNullOrUndefined)(this.parent.taskFields.dependency)||"Resources"===n.type&&(0,e.isNullOrUndefined)(this.parent.taskFields.resourceInfo)||"Notes"===n.type&&(0,e.isNullOrUndefined)(this.parent.taskFields.notes)||("Custom"!==n.type||!(0,e.isNullOrUndefined)(n.fields)&&0!==n.fields.length||(a+=1,n.fields=this.getCustomColumnFields()),a>1||i.push(n))}return i},a.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},a.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},a.prototype.getCustomColumnFields=function(){for(var e=[],t=0;t<this.parent.customColumns.length;t++)e.push(this.parent.customColumns[t]);return e},a.prototype.getDefaultDialogFields=function(){var t=[],i={},a=this.parent.taskFields,r=this.parent.columnMapping;return 0!==Object.keys(r).length&&(i.type="General",t.push(i)),(0,e.isNullOrUndefined)((0,e.getValue)("dependency",r))||(i={},!1!==this.parent.columnByField[r.dependency.valueOf()].visible&&(i.type="Dependency"),t.push(i)),(0,e.isNullOrUndefined)((0,e.getValue)("resourceInfo",r))||(i={},!1!==this.parent.columnByField[r.resourceInfo.valueOf()].visible&&(i.type="Resources"),t.push(i)),(0,e.isNullOrUndefined)((0,e.getValue)("constraintType",r))||(0,e.isNullOrUndefined)((0,e.getValue)("constraintDate",r))||((i={}).type="Advanced",t.push(i)),(0,e.isNullOrUndefined)((0,e.getValue)("notes",r))||(i={},!1!==this.parent.columnByField[r.notes.valueOf()].visible&&(i.type="Notes"),t.push(i)),(0,e.isNullOrUndefined)((0,e.getValue)("segments",a))||((i={}).type="Segments",t.push(i)),this.parent.customColumns.length>0&&((i={}).type="Custom",t.push(i)),t},a.prototype.openAddDialog=function(){this.isEdit=!1,this.editedRecord=this.composeAddRecord(),this.isFromAddDialog=!0,this.createDialog()},a.prototype.getMinimumStartDate=function(){var t=i.DataUtil.aggregates.min(this.parent.flatData,"ganttProperties.startDate");return t=(0,e.isNullOrUndefined)(t)?new Date(this.parent.timelineModule.timelineStartDate.getTime()):new Date(t.getTime()),t=this.parent.dateValidationModule.checkStartDate(t),new Date(t.getTime())},a.prototype.composeAddRecord=function(){for(var t={ganttProperties:{}},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?(t[s]=r,t.ganttProperties.rowUniqueID=t[s]):i[n].field===a.startDate?((0,e.isNullOrUndefined)(t[a.endDate])?t[s]=this.getMinimumStartDate():t[s]=new Date(t[a.endDate]),this.parent.timezone&&(t[s]=this.parent.dateValidationModule.remove(t[s],this.parent.timezone)),t.ganttProperties.startDate=new Date(t[s])):i[n].field===a.endDate?((0,e.isNullOrUndefined)(t[a.startDate])?t[s]=this.getMinimumStartDate():t[s]=new Date(t[a.startDate]),this.parent.timezone&&(t[s]=this.parent.dateValidationModule.remove(t[s],this.parent.timezone)),t.ganttProperties.endDate=new Date(t[s])):i[n].field===a.duration?(t[s]=1,t.ganttProperties.duration=t[s],t.ganttProperties.durationUnit=this.parent.durationUnit.toLocaleLowerCase()):i[n].field===a.name?(t[s]=this.localeObj.getConstant("addDialogTitle")+" "+r,t.ganttProperties.taskName=t[s]):i[n].field===a.progress?(t[s]=0,t.ganttProperties.progress=t[s]):i[n].field===a.work?(t[s]=0,t.ganttProperties.work=t[s]):i[n].field===a.type?(t[s]=this.parent.taskType,t.ganttProperties.taskType=t[s]):t[this.parent.ganttColumns[n].field]=""}return t.ganttProperties.isAutoSchedule="Auto"===this.parent.taskMode||"Manual"!==this.parent.taskMode&&!0!==t[a.manual],t},a.prototype.openToolbarEditDialog=function(){var t=this.parent;if(t.editModule&&t.editSettings.allowEditing){t.selectionModule&&this.parent.ganttChartModule.focusedRowIndex>-1&&t.selectionModule.selectRow(this.parent.ganttChartModule.focusedRowIndex,!1,!1);var i=t.selectionModule?"Row"!==t.selectionSettings.mode&&"Both"!==t.selectionSettings.mode||1!==t.selectionModule.selectedRowIndexes.length?"Cell"===t.selectionSettings.mode&&1===t.selectionModule.getSelectedRowCellIndexes().length?t.updatedRecords[t.selectionModule.getSelectedRowCellIndexes()[0].rowIndex].ganttProperties.rowUniqueID:null:t.updatedRecords[t.selectionModule.selectedRowIndexes[0]].ganttProperties.rowUniqueID:null;(0,e.isNullOrUndefined)(i)||this.openEditDialog(i)}},a.prototype.openEditDialog=function(t){var i=this.parent;(0,e.isNullOrUndefined)(t)||((0,e.isNullOrUndefined)(t.ganttProperties)||("string"==typeof t.ganttProperties.taskId?this.numericOrString="stringedit":this.numericOrString="numericedit"),(0,e.isNullOrUndefined)(t.ganttProperties)&&!(0,e.isNullOrUndefined)(t)&&(isNaN(Number(t))||"stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType?this.numericOrString="stringedit":this.numericOrString="numericedit")),"object"!=typeof t||(0,e.isNullOrUndefined)(t)?(0,e.isNullOrUndefined)(t)?i.selectedRowIndex>-1&&(this.rowData=i.currentViewData[i.selectedRowIndex],this.rowIndex=i.selectedRowIndex):(this.rowIndex=i.ids.indexOf(t.toString()),this.rowIndex>-1&&(this.rowData=i.flatData[this.rowIndex])):(this.rowIndex=this.parent.currentViewData.indexOf(t),this.rowIndex>-1&&(this.rowData=t)),this.isEdit=!0,"ResourceView"===this.parent.viewType&&0===this.rowData.level||0!==Object.keys(this.rowData).length&&(this.editedRecord=(0,e.extend)({},{},this.rowData,!0),this.isFromEditDialog=!0,this.createDialog())},a.prototype.createDialog=function(){var t=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=(0,e.getValue)("element",i),r=a.querySelector("#"+t.parent.element.id+"GeneralTabContainer");r&&r.scrollHeight>r.offsetHeight&&r.classList.add("e-scroll"),0===t.tabObj.selectedItem&&t.tabObj.select(0),t.parent.isAdaptive&&(a.style.maxHeight="none"),t.parent.focusModule&&t.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)},a.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)if(!this.formObj.validate())return void(t.style.pointerEvents="");if(this.storeDependencyTab||"Dependency"===this.firstOccuringTab){var i=void 0;if("Dependency"===this.firstOccuringTab)i=e.target.closest("#"+this.parent.element.id+"_dialog").querySelector(".e-gridform");else i=this.storeDependencyTab.querySelector(".e-gridform");if(i)if(!i.ej2_instances[0].validate())return void(t.style.pointerEvents="")}if(this.storeResourceTab||"Resources"===this.firstOccuringTab){var a=void 0;if("Resources"===this.firstOccuringTab)a=e.target.closest("#"+this.parent.element.id+"_dialog").querySelector(".e-gridform");else a=this.storeResourceTab.querySelector(".e-gridform");if(a)if(!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"}},a.prototype.dialogClose=function(){this.dialog&&this.resetValues(),(0,e.isNullOrUndefined)(this.parent.focusModule)||(0,e.isNullOrUndefined)(this.parent.focusModule.getActiveElement(!0))||this.parent.focusModule.getActiveElement(!0).focus()},a.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(),(0,e.remove)(this.dialog))},a.prototype.destroyDialogInnerElements=function(){for(var t=this.parent,i=this.beforeOpenArgs.tabModel.items,a=0;a<i.length;a++){var r=i[a].content,n=r.getAttribute("id");if(!(0,e.isNullOrUndefined)(n)||""!==n)if("General"===(n=(n=n.replace(t.element.id,"")).replace("TabContainer","")))this.destroyCustomField(r);else if("Dependency"===n){r.ej2_instances[0].destroy()}else if("Notes"===n){r.ej2_instances[0].destroy()}else if("Resources"===n){r.ej2_instances[0].destroy()}else-1!==n.indexOf("Custom")&&this.destroyCustomField(r)}},a.prototype.destroyCustomField=function(t){for(var i=t.childNodes,a=this.parent,r=0;r<i.length;r++){var n=i[r],s=n.querySelector('input[id^="'+a.element.id+'"]');if(s){var o=s.id.replace(a.element.id,""),l=n.querySelector("#"+a.element.id+o).ej2_instances[0];if(!(0,e.isNullOrUndefined)(l)){var d=a.columnByField[o];if((0,e.isNullOrUndefined)(d)||(0,e.isNullOrUndefined)(d.edit)||(0,e.isNullOrUndefined)(d.edit.destroy)||!(0,e.isNullOrUndefined)(d.edit.params))l.destroy();else{var h=d.edit.destroy;"string"==typeof h?(h=(0,Ze.getObject)(h,window))():d.edit.destroy()}}}}},a.prototype.destroy=function(){this.resetValues(),this.parent.isDestroyed||(this.parent.off("chartDblClick",this.dblClickHandler),this.parent.editModule.dialogModule=void 0)},a.prototype.getEditFields=function(){return this.isEdit?this.updatedEditFields:this.updatedAddFields},a.prototype.createTab=function(i,a){var r,n=this,s=this.parent,o={},l=[],d=this.getEditFields(),h=s.taskFields,p=d.length;o.items=l,o.locale=this.parent.locale,o.enableRtl=this.parent.enableRtl,this.beforeOpenArgs.tabModel=o;var u=0;if(p>0)for(var c=0;c<p;c++){var g=d[c],f={};if("General"===g.type){if(0===Object.keys(s.columnMapping).length)continue;(0,e.isNullOrUndefined)(g.headerText)&&(g.headerText=this.localeObj.getConstant("generalTab")),f.content="General",this.beforeOpenArgs[f.content]=this.getFieldsModel(g.fields)}else if("Segments"===g.type){if((0,e.isNullOrUndefined)(h.segments))continue;(0,e.isNullOrUndefined)(g.headerText)&&(g.headerText=this.localeObj.getConstant("segments")),f.content="Segments",this.beforeOpenArgs[f.content]=this.getSegmentsModel(g.fields)}else if("Dependency"===g.type){if((0,e.isNullOrUndefined)(h.dependency))continue;(0,e.isNullOrUndefined)(g.headerText)&&(g.headerText=this.localeObj.getConstant("dependency")),f.content="Dependency",this.beforeOpenArgs[f.content]=this.getPredecessorModel(g.fields)}else if("Resources"===g.type){if((0,e.isNullOrUndefined)(h.resourceInfo))continue;(0,e.isNullOrUndefined)(g.headerText)&&(g.headerText=this.localeObj.getConstant("resourceName")),f.content="Resources",this.beforeOpenArgs[f.content]=this.getResourcesModel(g.fields)}else if("Notes"===g.type){if((0,e.isNullOrUndefined)(h.notes))continue;(0,e.isNullOrUndefined)(g.headerText)&&(g.headerText=this.localeObj.getConstant("notes")),f.content="Notes",this.beforeOpenArgs[f.content]=this.getNotesModel(g.fields)}else if("Advanced"===g.type)(0,e.isNullOrUndefined)(g.headerText)&&(g.headerText=this.localeObj.getConstant("advancedTab")),f.content="Advanced",this.beforeOpenArgs[f.content]=this.getAdvancedModel(g.fields);else{if((0,e.isNullOrUndefined)(g.fields)||0===g.fields.length)continue;(0,e.isNullOrUndefined)(g.headerText)&&(g.headerText=this.localeObj.getConstant("customTab")),f.content="Custom"+u++,this.beforeOpenArgs[f.content]=this.getFieldsModel(g.fields)}f.header={text:g.headerText},l.push(f)}this.beforeOpenArgs.requestType=this.isEdit?"beforeOpenEditDialog":"beforeOpenAddDialog",this.parent.trigger("actionBegin",this.beforeOpenArgs,function(e){if(e.cancel)e.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 Ci.Tab(o),n.tabObj.isStringTemplate=!0,r=n.parent.createElement("div",{id:s.element.id+"_Tab"}),n.tabObj.appendTo(r),i.content=r,n.dialog=a,n.dialogObj=new t.Dialog(i),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()})}})},a.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;"Resources"!==(t=this.parent.editDialogFields[0].type)&&"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(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},a.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},a.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)})},a.prototype.createFormObj=function(e,t){var i=this;return new Mi.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)}}})},a.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)},a.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))},a.prototype.getElemTable=function(e){var t=e.parentElement;return t?t.querySelector(".e-tooltip-wrap"):null},a.prototype.validationComplete=function(e){var t=this.getElemTable(e.element);t&&("failure"===e.status?t.style.display="":t.style.display="none")},a.prototype.tabSelectedEvent=function(t){var i=this.parent,a=t.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;(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=t.selectedContent),a===i.element.id+"ResourcesTabContainer"&&(this.storeResourceTab=t.selectedContent),a===i.element.id+"Custom0TabContainer")&&(this.parent.treeGrid.grid.getColumns().some(function(e){return e.validationRules})&&this.changeFormObj(t.selectedContent));a===i.element.id+"GeneralTabContainer"&&(this.parent.treeGrid.grid.getColumns().some(function(e){return e.validationRules})&&this.changeFormObj(t.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"&&((0,e.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))},a.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"},a.prototype.getFieldsModel=function(t){for(var i={},a=this.parent.columnByField,r=0;r<t.length;r++)if(t[r]!==this.parent.taskFields.dependency&&t[r]!==this.parent.taskFields.resourceInfo&&t[r]!==this.parent.taskFields.notes&&t[r]!==this.parent.taskFields.constraintDate&&t[r]!==this.parent.taskFields.constraintType&&!(0,e.isNullOrUndefined)(a[t[r]])){var n=t[r];this.createInputModel(a[n],i)}return i},a.prototype.getAdvancedModel=function(t){for(var i={},a=this.parent.columnByField,r=0;r<t.length;r++){var n=t[r];(0,e.isNullOrUndefined)(a[n])||n!==this.parent.taskFields.constraintDate&&n!==this.parent.taskFields.constraintType||this.createInputModel(a[n],i)}return i},a.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)},a.prototype.createInputModel=function(t,i){var a=this,r=this.parent,n=this.parent.locale,s=this.parent.taskFields,o={placeholder:t.headerText,floatLabelType:"Auto"};if((0,e.isNullOrUndefined)(this.parent.taskFields.id)||(0,e.isNullOrUndefined)(this.parent.columnMapping.id)||(0,e.isNullOrUndefined)(this.numericOrString)||s.id===t.field&&(t.editType=this.numericOrString),t.editTemplate){var l=this.parent.currentViewData.indexOf(this.rowData),d=this.parent.chartRowsModule.templateCompiler(t.editTemplate)((0,e.extend)({index:l},this.editedRecord),this.parent,"EditTemplate",this.parent.chartRowsModule.getTemplateID("EditTemplate"),!1,void 0,null,this.parent.treeGrid.root);i[t.field]=d}else switch(t.editType){case"booleanedit":var h={label:t.headerText,locale:n,enableRtl:this.parent.enableRtl};i[t.field]=h;break;case"defaultedit":case"stringedit":var p=o;p.enableRtl=this.parent.enableRtl,t.field!==r.columnMapping.duration&&t.field!==r.columnMapping.id&&t.field!==r.columnMapping.startDate&&t.field!==r.columnMapping.endDate&&t.field!==r.columnMapping.baselineDuration||(p.change=function(e){a.isTriggered?a.parent.triggeredColumnName="":(t.field!==a.parent.taskFields.duration&&t.field!==a.parent.taskFields.work&&t.field!==a.parent.taskFields.baselineDuration||a.isTriggered||(a.isTriggered=!0,a.parent.triggeredColumnName=t.field),a.validateScheduleFields(e,t,r))}),i[t.field]=o;break;case"numericedit":var u=o;u.enableRtl=this.parent.enableRtl,s.progress===t.field&&(u.min=0,u.max=100),u.change=function(e){a.isTriggered?a.parent.triggeredColumnName="":(t.field!==a.parent.taskFields.duration&&t.field!==a.parent.taskFields.work||a.isTriggered||(a.isTriggered=!0,a.parent.triggeredColumnName=t.field),a.validateScheduleFields(e,t,r))},i[t.field]=u;break;case"datepickeredit":var c=o;if(c.format=this.parent.getDateFormat(),c.enableRtl=this.parent.enableRtl,c.strictMode=!0,c.firstDayOfWeek=r.timelineModule.customTimelineSettings.weekStartDay,t.field===r.columnMapping.startDate||t.field===r.columnMapping.endDate||t.field===r.columnMapping.constraintDate||t.field===r.columnMapping.baselineStartDate||t.field===r.columnMapping.baselineEndDate)t.field===r.columnMapping.baselineStartDate||t.field===r.columnMapping.baselineEndDate||(c.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent)),c.change=function(e){t.field!==s.constraintDate?a.validateScheduleFields(e,t,r):a.processAndValidateScheduleDates(r,s)};i[t.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,t.field===r.columnMapping.startDate||t.field===r.columnMapping.endDate||t.field===r.columnMapping.baselineStartDate||t.field===r.columnMapping.baselineEndDate)t.field===r.columnMapping.baselineStartDate||t.field===r.columnMapping.baselineEndDate||(g.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent)),g.change=function(e){t.field!==s.constraintDate?a.validateScheduleFields(e,t,r):a.processAndValidateScheduleDates(r,s)};i[t.field]=g;break;case"dropdownedit":if(t.field===r.columnMapping.type||t.field===r.columnMapping.manual||t.field===r.columnMapping.constraintType){o.dataSource=[{ID:1,Value:"FixedUnit"},{ID:2,Value:"FixedWork"},{ID:3,Value:"FixedDuration"}],o.fields={value:"Value"};var f=o;f.enableRtl=this.parent.enableRtl,f.change=function(e){t.field===s.manual&&(a.editedRecord.ganttProperties.isAutoSchedule=!e.value),t.field!==s.constraintType?a.validateScheduleFields(e,t,r):(a.dialogConstraintValue=Number(e.value),a.processAndValidateScheduleDates(r,s))}}i[t.field]=o;break;case"maskededit":i[t.field]=o}return(0,e.isNullOrUndefined)(t.edit)||(0,e.isNullOrUndefined)(t.edit.params)||(0,e.extend)(i[t.field],t.edit.params),i},a.prototype.setConstraintDateBasedOnType=function(e,t,i,a,r){if(!e&&i)switch(t){case D.StartNoEarlierThan:case D.StartNoLaterThan:case D.MustStartOn:i.value=new Date(a);break;case D.FinishNoEarlierThan:case D.FinishNoLaterThan:case D.MustFinishOn:i.value=new Date(r)}},a.prototype.alignDateWithConstraint=function(e,t,i,a){var r=e?e.ej2_instances[0].value:this.editedRecord.ganttProperties.constraintDate,n=t?t.ej2_instances[0].value:this.editedRecord.ganttProperties.constraintType,s=i?i.ej2_instances[0].value:this.editedRecord.ganttProperties.startDate,o=a?a.ej2_instances[0].value:this.editedRecord.ganttProperties.endDate;!r&&n!==D.AsSoonAsPossible&&n!==D.AsLateAsPossible&&e&&this.setConstraintDateBasedOnType(r,n,e.ej2_instances[0],s,o);var l=new Date(s),d=new Date(o),h=this.parent.assignTimeToDate(r,this.parent.getCurrentDayStartTime(r)),p=this.parent.predecessorModule.filterPredecessorsByTarget(this.editedRecord.ganttProperties.predecessor,this.editedRecord,this.parent.viewType);switch(n){case D.MustStartOn:h=r=this.parent.dateValidationModule.checkStartDate(new Date(h)),l.getTime()!==h.getTime()&&i&&(i.ej2_instances[0].value=r);break;case D.MustFinishOn:h.setDate(h.getDate()+1),h=r=this.parent.dateValidationModule.checkEndDate(new Date(h)),d.getTime()!==h.getTime()&&(r=this.parent.dateValidationModule.getStartDate(r,this.editedRecord.ganttProperties.duration,this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties),i&&(i.ej2_instances[0].value=r));break;case D.StartNoEarlierThan:h=r=this.parent.dateValidationModule.checkStartDate(new Date(h)),i&&(i.ej2_instances[0].value=r);break;case D.StartNoLaterThan:if(this.editedRecord.ganttProperties.predecessor&&this.editedRecord.ganttProperties.predecessor.length>0&&0!==p.length){var u=this.parent.editModule.taskbarEditModule.isValidDependency(this.editedRecord);i&&(i.ej2_instances[0].value=u.maxDate)}else this.editedRecord.parentItem?i&&(i.ej2_instances[0].value=this.parent.getRecordByID(this.editedRecord.parentItem.taskId).ganttProperties.startDate):i&&(i.ej2_instances[0].value=this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate)));break;case D.FinishNoEarlierThan:h.setDate(h.getDate()+1),h=r=this.parent.dateValidationModule.checkEndDate(new Date(h)),d.getTime()!==h.getTime()&&(r=this.parent.dateValidationModule.getStartDate(r,this.editedRecord.ganttProperties.duration,this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties),i&&(i.ej2_instances[0].value=r));break;case D.FinishNoLaterThan:if(this.editedRecord.ganttProperties.predecessor&&this.editedRecord.ganttProperties.predecessor.length>0&&0!==p.length){u=this.parent.editModule.taskbarEditModule.isValidDependency(this.editedRecord);i&&(i.ej2_instances[0].value=u.maxDate)}else this.editedRecord.parentItem?i&&(i.ej2_instances[0].value=this.parent.getRecordByID(this.editedRecord.parentItem.taskId).ganttProperties.startDate):i&&(i.ej2_instances[0].value=this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate)));break;case D.AsSoonAsPossible:if(this.editedRecord.ganttProperties.predecessor&&this.editedRecord.ganttProperties.predecessor.length>0&&0!==p.length)(u=this.parent.editModule.taskbarEditModule.isValidDependency(this.editedRecord)).maxDate&&i&&(i.ej2_instances[0].value=u.maxDate);else this.editedRecord.parentItem?i&&(i.ej2_instances[0].value=this.parent.getRecordByID(this.editedRecord.parentItem.taskId).ganttProperties.startDate):i&&(i.ej2_instances[0].value=this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate)));e&&(e.ej2_instances[0].value=null);break;case D.AsLateAsPossible:if(this.editedRecord.parentItem){var c=this.parent.dateValidationModule.checkEndDate(this.parent.getRecordByID(this.editedRecord.parentItem.taskId).ganttProperties.endDate),g=this.parent.dateValidationModule.getStartDate(c,this.editedRecord.ganttProperties.duration,this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties);i&&(i.ej2_instances[0].value=g)}else{c=this.parent.dateValidationModule.checkEndDate(new Date(this.parent.projectEndDate));var f=this.parent.dateValidationModule.getStartDate(c,this.editedRecord.ganttProperties.duration,this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties);i&&(i.ej2_instances[0].value=f)}e&&(e.ej2_instances[0].value=null)}},a.prototype.validateScheduleFields=function(t,i,a){var r,n;(0,e.isNullOrUndefined)(a.editModule.dialogModule.dialog)||(n=a.editModule.dialogModule.dialog);var s,o=null,l=a.editModule.dialogModule.editedRecord,d=null,h=null,p="ResourceView"===this.parent.viewType?this.parent.getTaskIds():this.parent.ids,u=this.parent.viewType;if((0,e.isNullOrUndefined)(t.element)?(0,e.isNullOrUndefined)(t.container)?(0,e.isNullOrUndefined)(t.event)||(0,e.isNullOrUndefined)(t.event.path)||(0,e.isNullOrUndefined)(t.event.path)[1]||(o=(s=t.event.path[1]).querySelector("input").getAttribute("id"),s=s.querySelector("#"+o)):(o=(s=t.container).querySelector("input").getAttribute("id"),s=s.querySelector("#"+o)):o=(s=t.element).getAttribute("id"),(0,e.isNullOrUndefined)(s))d=t.value,h=i.field;else if(d="datetimepickeredit"===i.editType?t.value:s.value,h=o.replace(a.element.id,""),"stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType){var c={rules:(r={},r[this.parent.taskFields.id]={required:!0,minLength:[function(e){return"ResourceView"===u?-1===p.indexOf("T"+e.value)&&-1===p.indexOf("R"+e.value):-1===p.indexOf(e.value)},"ID is already present, please enter new value"]},r)};new Mi.FormValidator("#"+this.parent.element.id+"GeneralTabContainer",c)}if(0===h.search("Segments"))return h=h.replace("SegmentsTabContainer",""),this.validateSegmentFields(a,h,d,t),this.isTriggered=!1,!0;var g=!1;this.parent.taskFields.baselineDuration!==h&&this.parent.taskFields.baselineStartDate!==h&&this.parent.taskFields.baselineEndDate!==h||(g=!0),this.validateScheduleValuesByCurrentField(h,d,this.editedRecord,g);var f=l.ganttProperties,m=this.parent.dateValidationModule.getFieldMappings(g),y=m.startdateField,D=m.enddateField,v=m.durationField,k=a.taskFields;return(0,e.isNullOrUndefined)(k.startDate||!(0,e.isNullOrUndefined)(k.baselineStartDate))||k[y]===h||this.updateScheduleFields(n,f,y),k[D]===h&&!(0,e.isNullOrUndefined)(f[y])&&!(0,e.isNullOrUndefined)(t.value)&&f[y].getTime()>t.value&&this.updateScheduleFields(n,f,D),(0,e.isNullOrUndefined)(k[D])||k[D]===h||(this.updateScheduleFields(n,f,D),this.parent.taskFields.constraintType&&this.updateScheduleFields(n,f,"constraintDate")),(!(0,e.isNullOrUndefined)(k[v])&&k[v]!==h||f[v]>=0)&&this.updateScheduleFields(n,f,v),(0,e.isNullOrUndefined)(k.work)||k.work===h&&"FixedWork"===f.taskType||this.updateScheduleFields(n,f,"work"),this.dialogEditValidationFlag=!1,this.isTriggered=!1,g=!1,!0},a.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},a.prototype.updateScheduleFields=function(t,i,a){var r,n=this.parent,s=n.element.id,o=(0,e.getValue)(a,n.columnMapping),l=n.columnByField[o],d=this.parent.taskFields;if(l)if("stringedit"===l.editType){if(p=t.querySelector("#"+s+o)){var h=p.ej2_instances[0];h&&(r=(0,e.isNullOrUndefined)(l.edit)||(0,e.isNullOrUndefined)(l.edit.read)?(0,e.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;if((p=t.querySelector("#"+s+o))||(p=this.getConstraintDateElement(s,o,d)),p){var u=(l.editType,p.ej2_instances[0]);u&&(r=i[a],((0,e.isNullOrUndefined)(u.value)&&!(0,e.isNullOrUndefined)(r)||(0,e.isNullOrUndefined)(r)&&!(0,e.isNullOrUndefined)(u.value)||u.value!==r&&!(0,e.isNullOrUndefined)(u.value)&&!(0,e.isNullOrUndefined)(r)&&u.value.toString()!==r.toString())&&(u.value=r,u.dataBind()))}}else if("numericedit"===l.editType){var c=t.querySelector("#"+s+o).ej2_instances[0];r=i[a],(0,e.isNullOrUndefined)(r)||c.value===r||(c.value=r,c.dataBind())}},a.prototype.validateDuration=function(t,i){var a=t.ganttProperties;if(!this.dialogEditValidationFlag){if(i||(0,e.isNullOrUndefined)(a.startDate)||r(a)||!(0,e.isNullOrUndefined)(a.duration))if(i||!r(a)&&(0,e.isNullOrUndefined)(a.startDate))if(i&&!(0,e.isNullOrUndefined)(a.baselineStartDate)){if(0!==t.ganttProperties.baselineDuration){n=this.parent.dateValidationModule.checkStartDate(a.baselineStartDate,void 0,void 0,void 0,!0);this.parent.setRecordValue("baselineStartDate",n,a,!0),this.parent.taskFields.baselineStartDate&&this.parent.dataOperation.updateMappingData(t,"baselineStartDate")}this.parent.dateValidationModule.calculateEndDate(t,i)}else(r(a)||(0,e.isNullOrUndefined)(a.endDate))&&(0,e.isNullOrUndefined)(a.endDate)?(0,e.isNullOrUndefined)(a.baselineEndDate)&&this.parent.dateValidationModule.calculateStartDate(t,i):this.parent.dateValidationModule.calculateStartDate(t,i);else{if(t.ganttProperties.isMilestone&&0!==t.ganttProperties.duration){var n=this.parent.dateValidationModule.checkStartDate(a.startDate);this.parent.setRecordValue("startDate",n,a,!0),this.parent.taskFields.startDate&&this.parent.dataOperation.updateMappingData(t,"startDate")}this.parent.dateValidationModule.calculateEndDate(t)}else this.parent.setRecordValue("endDate",null,a,!0),this.parent.setRecordValue("isMilestone",!1,a,!0);if(!i){var s=0===a.duration;this.parent.setRecordValue("isMilestone",s,a,!0)}this.dialogEditValidationFlag=!0}},a.prototype.validateStartDate=function(t,i){var a=t.ganttProperties,n=this.parent.taskFields,s=this.parent.dateValidationModule.getFieldMappings(i),o=s.startdateField,l=s.enddateField,d=s.durationField;this.dialogEditValidationFlag||((0,e.isNullOrUndefined)(a[o])?(this.parent.setRecordValue(d,null,a,!0),i||(this.parent.setRecordValue("isMilestone",!1,a,!0),this.parent.allowUnscheduledTasks&&(0,e.isNullOrUndefined)(n.endDate)&&this.parent.setRecordValue("endDate",null,a,!0))):r(a)||i?(0,e.isNullOrUndefined)(n[d])?this.parent.dateValidationModule.calculateDuration(t,i):((0,e.isNullOrUndefined)(n[l]),this.parent.dateValidationModule.calculateEndDate(t,i)):(0,e.isNullOrUndefined)(a.endDate)?(0,e.isNullOrUndefined)(a.duration)||this.parent.dateValidationModule.calculateEndDate(t):this.parent.dateValidationModule.calculateDuration(t),this.dialogEditValidationFlag=!0)},a.prototype.validateEndDate=function(t,i){var a=t.ganttProperties,n=this.parent.taskFields;if(!this.dialogEditValidationFlag){var s=this.parent.dateValidationModule.getFieldMappings(i),o=s.startdateField,l=s.enddateField,d=s.durationField;(0,e.isNullOrUndefined)(a[l])?(this.parent.setRecordValue(d,null,a,!0),i||this.parent.setRecordValue("isMilestone",!1,a,!0)):r(a)||i?(0,e.isNullOrUndefined)(n[d])?this.parent.dateValidationModule.calculateDuration(t,i):(0,e.isNullOrUndefined)(a[o])?this.parent.dateValidationModule.calculateStartDate(t,i):(i||!(0,e.isNullOrUndefined)(a.segments)&&a.segments.length>0&&(a.segments=this.parent.editModule.cellEditModule.validateEndDateWithSegments(a)),this.parent.dateValidationModule.calculateDuration(t,i)):(0,e.isNullOrUndefined)(a[d])?(0,e.isNullOrUndefined)(a[o])||this.parent.dateValidationModule.calculateDuration(t,i):this.parent.dateValidationModule.calculateStartDate(t,i),this.dialogEditValidationFlag=!0}},a.prototype.updateConstraintDate=function(e,t){var i=e.constraintType;i===D.StartNoEarlierThan||i===D.StartNoLaterThan?this.parent.setRecordValue("constraintDate",e.startDate,e,!0):i!==D.FinishNoEarlierThan&&i!==D.FinishNoLaterThan||this.parent.setRecordValue("constraintDate",e.endDate,e,!0),this.parent.dataOperation.updateMappingData(t,"constraintDate")},a.prototype.validateScheduleValuesByCurrentField=function(t,i,a,r){var n=this.parent,s=a.ganttProperties,o=n.taskFields;if(o.duration===t||o.baselineDuration===t){var l=!(0,e.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){if(n.dataOperation.updateDurationValue(i,s,r),this.parent.setRecordValue(p,i,a),this.parent.setRecordValue("taskData."+p,s[f],a),!r&&s.isMilestone&&!(0,e.isNullOrUndefined)(this.parent.editModule.cellEditModule))(k={}).data=a,this.parent.editModule.cellEditModule.updateDates(k);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===t||o.baselineStartDate===t)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===t||o.baselineEndDate===t){var v=this.parent.dateValidationModule.getFieldMappings(r);c=v.startdateField,g=v.enddateField,f=v.durationField;if(""!==i){var k,b=this.parent.dateValidationModule.getDateFromFormat(i),w=this.parent.getCurrentDayEndTime(b);if(0===b.getHours()&&86400!==w&&this.parent.dateValidationModule.setTime(w,b),!(0,e.isNullOrUndefined)(s[c])&&!(0,e.isNullOrUndefined)(s[g])&&!(0,e.isNullOrUndefined)(b)&&s[c].getTime()>b.getTime()&&(b=s[g]),b=this.parent.dateValidationModule.checkEndDate(b,s,void 0,r),((0,e.isNullOrUndefined)(s[c])||b.getTime()>=s[c].getTime())&&this.parent.setRecordValue(g,b,s,!0),this.validateEndDate(a,r),!r&&s.isMilestone&&!(0,e.isNullOrUndefined)(this.parent.editModule.cellEditModule))(k={}).data=a,this.parent.editModule.cellEditModule.updateDates(k)}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===t&&((0,e.isNullOrUndefined)(i)||""===i||(this.parent.setRecordValue("work",i,s,!0),this.parent.editModule.updateResourceRelatedFields(a,"work"),this.validateDuration(a))),t===o.type&&(this.parent.setRecordValue("taskType",i,s,!0),i&&"FixedDuration"===i&&0===s.duration&&this.parent.editModule.updateResourceRelatedFields(a,"work")),o.manual===t&&this.parent.editModule.updateTaskScheduleModes(a),!0},a.prototype.getSegmentsModel=function(t){var i=this,a=this.parent.taskFields;((0,e.isNullOrUndefined)(t)||0===t.length)&&(t=[],(0,e.isNullOrUndefined)(a.startDate)||t.push(this.parent.taskFields.startDate),(0,e.isNullOrUndefined)(a.endDate)||t.push(this.parent.taskFields.endDate),(0,e.isNullOrUndefined)(a.duration)||t.push(this.parent.taskFields.duration),(0,e.isNullOrUndefined)(a.id)||t.push(this.parent.taskFields.id));var 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=function(a){var r={},s="General";switch(t[a]){case o.parent.taskFields.id:r={field:t[a],visible:!1,isPrimaryKey:!0},n.push(r);break;case o.parent.taskFields.startDate:case o.parent.taskFields.endDate:r={field:t[a],headerText:o.localeObj.getConstant(t[a]===o.parent.taskFields.startDate?"startDate":"endDate"),editType:"stringedit",width:"200px",edit:{write:function(r){var n;if((0,e.isNullOrUndefined)(i.beforeOpenArgs[s])||(0,e.isNullOrUndefined)(i.beforeOpenArgs[s][t[a]])){var o=i.getGeneralColumnFields();n=i.getFieldsModel(o)[t[a]]}else n=i.beforeOpenArgs[s][t[a]];var l=r.rowData[r.column.field];(0,e.setValue)("value",l,n),new i.inputs[i.parent.columnByField[t[a]].editType](n).appendTo(r.element)},read:function(e){return e.ej2_instances[0].value}},format:o.parent.getDateFormat()},t[a]===o.parent.taskFields.startDate&&(r.validationRules={required:!0}),n.push(r);break;case o.parent.taskFields.duration:r={field:t[a],headerText:o.localeObj.getConstant(t[a].toLocaleLowerCase()),editType:"stringedit",width:"100px",edit:{write:function(r){var n;if((0,e.isNullOrUndefined)(i.beforeOpenArgs[s])||(0,e.isNullOrUndefined)(i.beforeOpenArgs[s][t[a]])){var o=i.getGeneralColumnFields();n=i.getFieldsModel(o)[t[a]]}else n=i.beforeOpenArgs[s][t[a]];n.floatLabelType="Never";var l=r.rowData[r.column.field];(0,e.isNullOrUndefined)(l)?(0,e.setValue)("value",null,n):(0,e.setValue)("value",l,n),(0,e.setValue)("value",l,n),new Mi.TextBox(n).appendTo(r.element)},read:function(e){return e.ej2_instances[0].value.toString()}}},n.push(r)}},o=this,l=0;l<t.length;l++)s(l);return r.columns=n,r.height=this.parent.isAdaptive||this.parent.enableAdaptiveUI?"100%":"153px",r},a.prototype.getGridColumnByField=function(e,t){for(var i,a=0;a<t.length;a++)t[a].field===e&&(i=t[a]);return i},a.prototype.updateSegmentField=function(t,i,a){var r,n=this.parent.editModule.dialogModule.dialog,s=(0,e.getValue)("Segments",this.beforeOpenArgs),o=this.getGridColumnByField(t,s.columns),l=this.parent.element.id,d=a[t];("stringedit"===o.editType||"datepickeredit"===o.editType)&&(r=n.querySelector("#"+l+"SegmentsTabContainer"+t).ej2_instances[0]),(0,e.isNullOrUndefined)(r.value)||(0,e.isNullOrUndefined)(d)||r.value.toString()===d.toString()||(r.value=d,r.dataBind())},a.prototype.validateSegmentFields=function(t,i,a,r){var n=this.parent.taskFields;if(!(0,e.isNullOrUndefined)(n.duration)&&n.duration.toLowerCase()===i.toLowerCase()&&!(0,e.isNullOrUndefined)(a)&&""!==a){this.selectedSegment[n.duration]=Number(a);var s=t.dataOperation.getEndDate(this.selectedSegment[n.startDate],Number(a),this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties,!1);s=t.dataOperation.checkEndDate(s,this.editedRecord.ganttProperties,!1),this.selectedSegment[n.endDate]=s}if(!(0,e.isNullOrUndefined)(n.startDate)&&n.startDate.toLowerCase()===i.toLowerCase()&&""!==a){var o=this.parent.dateValidationModule.getDateFromFormat(a);o=this.parent.dateValidationModule.checkStartDate(o),this.selectedSegment[n.startDate]=o,(0,e.isNullOrUndefined)(n.endDate)||(this.selectedSegment.endDate=this.parent.dataOperation.getEndDate(o,this.selectedSegment[n.duration],this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties,!1))}if(!(0,e.isNullOrUndefined)(n.endDate)&&n.endDate.toLowerCase()===i.toLowerCase()&&""!==a){s=this.parent.dateValidationModule.getDateFromFormat(a);var l=this.parent.getCurrentDayEndTime(s);0===s.getHours()&&86400!==l&&this.parent.dateValidationModule.setTime(l,s),s=this.parent.dateValidationModule.checkEndDate(s,this.editedRecord.ganttProperties),this.selectedSegment[n.endDate]=s,this.selectedSegment[n.duration]=this.parent.dataOperation.getDuration(this.selectedSegment[n.startDate],this.selectedSegment[n.endDate],this.editedRecord.ganttProperties.durationUnit,!0,!1,!0)}(0,e.isNullOrUndefined)(n.startDate)||this.updateSegmentField(n.startDate,r,this.selectedSegment),(0,e.isNullOrUndefined)(n.endDate)||this.updateSegmentField(n.endDate,r,this.selectedSegment),(0,e.isNullOrUndefined)(n.duration)||this.updateSegmentField(n.duration,r,this.selectedSegment)},a.prototype.getPredecessorModel=function(t){((0,e.isNullOrUndefined)(t)||0===t.length)&&(t=["ID","Name","Type","Offset","UniqueId"]);var 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<t.length;r++){var n={};"id"===t[r].toLowerCase()?(n={field:"id",headerText:this.localeObj.getConstant("id"),allowEditing:!1,width:"70px"},a.push(n)):"name"===t[r].toLowerCase()?(n={field:"name",headerText:this.localeObj.getConstant("name"),editType:"stringedit",width:"250px",validationRules:{required:!0}},a.push(n)):"type"===t[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"===t[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"===t[r].toLowerCase()&&(n={field:"uniqueId",isPrimaryKey:!0,visible:!1,defaultValue:k().toString()},a.push(n))}return i.columns=a,i.height=this.parent.isAdaptive||this.parent.enableAdaptiveUI?"100%":"153px",i},a.prototype.getResourcesModel=function(t){var i=this.parent.resourceFields;((0,e.isNullOrUndefined)(t)||0===t.length)&&(t=[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<t.length;n++){var s={};t[n]===i.id?(s={field:i.id,headerText:this.localeObj.getConstant("id"),isPrimaryKey:!0,width:"100px",allowEditing:!1},r.push(s)):t[n]===i.name?(s={field:i.name,headerText:this.localeObj.getConstant("name"),allowEditing:!1},r.push(s)):t[n]===i.unit?(s={field:i.unit,headerText:this.localeObj.getConstant("unit"),editType:"numericedit",edit:{params:{min:0}}},r.push(s)):t[n]!==i.group||(0,e.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},a.prototype.getNotesModel=function(t){return((0,e.isNullOrUndefined)(t)||0===t.length)&&(t=["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:t},height:this.parent.isAdaptive||this.parent.enableAdaptiveUI?"100%":"auto",locale:this.parent.locale}},a.prototype.createDivElement=function(t,i){return(0,e.createElement)("div",{className:t,id:i})},a.prototype.createFormElement=function(t,i){return(0,e.createElement)("form",{className:t,id:i})},a.prototype.createInputElement=function(t,i,a,r){return(0,e.createElement)(r||"input",{className:t,attrs:{type:"text",id:i,name:a,title:a}})},a.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)))}},a.prototype.segmentGridActionBegin=function(t){var i,a,r=this.parent.taskFields,n=this.beforeOpenArgs.Segments;if("add"===t.requestType||"beginEdit"===t.requestType||"save"===t.requestType){var s=n.dataSource,o=(0,e.getValue)("rowData",t),l=this.beforeOpenArgs.rowData.ganttProperties.startDate;if(!(0,e.isNullOrUndefined)(l)&&"add"===t.requestType){var d={},h=(0,e.getValue)(this.parent.taskFields.startDate,o),p=this.parent.taskFields.endDate?(0,e.getValue)(this.parent.taskFields.endDate,o):null,u=void 0;(0,e.isNullOrUndefined)(this.parent.taskFields.duration)||(u=(0,e.getValue)(this.parent.taskFields.duration,o));var c=!(0,e.isNullOrUndefined)(s)&&s.length>0?(0,e.isNullOrUndefined)(r.endDate)||(0,e.isNullOrUndefined)(s[0][r.endDate])?new Date((0,e.getValue)(r.startDate,s[0]).getTime()):new Date((0,e.getValue)(r.endDate,s[0]).getTime()):!(0,e.isNullOrUndefined)(this.beforeOpenArgs.rowData.ganttProperties.startDate)&&new Date(this.beforeOpenArgs.rowData.ganttProperties.startDate.getTime());c.setHours(0,0,0,0),!(0,e.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=!(0,e.isNullOrUndefined)(r.endDate)&&!(0,e.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),(0,e.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),t.rowData=d}if("save"===t.requestType){for(var m=n.dataSource,y=this.parent.taskFields.id,D=m.length;m.some(function(e){return e[y]===D});)D++;(0,e.isNullOrUndefined)(t.data[y])&&(t.data[y]=D,t.rowData[y]=D)}this.selectedSegment=t.rowData}},a.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},a.prototype.setInjected=function(t,i,a,r,n,s,o){if(!(0,e.isNullOrUndefined)(t)&&!(0,e.isNullOrUndefined)(t.additionalParams))for(var l in i=t.additionalParams)if(Object.prototype.hasOwnProperty.call(i,l))switch(l){case"allowFiltering":a.Inject(Ze.Filter);break;case"allowSorting":a.Inject(Ze.Sort);break;case"allowPaging":a.Inject(Ze.Page);break;case"allowGrouping":a.Inject(Ze.Group);break;case"editSettings":a.Inject(Ze.Edit);break;case"aggregates":a.Inject(Ze.Aggregate);break;case"showColumnChooser":a.Inject(Ze.ColumnChooser);break;case"showColumnMenu":a.Inject(Ze.ColumnMenu);break;case"contextMenuItems":a.Inject(Ze.ContextMenu);break;case"allowResizing":a.Inject(Ze.Resize);break;case"allowReordering":a.Inject(Ze.Reorder);break;case"detailTemplate":a.Inject(Ze.DetailRow);break;case"allowRowDragAndDrop":a.Inject(Ze.RowDD);break;case"searchSettings":a.Inject(Ze.Search);break;case"selectionSettings":a.Inject(Selection);break;case"enableVirtualization":a.Inject($e.VirtualScroll);break;case"toolbar":i.toolbar.map(function(e){switch(e){case"Search":a.Inject(Ze.Search);break;case"Print":a.Inject(Ze.Print);break;case"PdfExport":a.Inject(Ze.PdfExport);break;case"ExcelExport":a.Inject(Ze.ExcelExport)}}),s.toolbar,a.Inject(Ze.Toolbar);break;case"columns":s.columns}},a.prototype.renderSegmentsTab=function(t){var i=this,a=this.parent,r=this.beforeOpenArgs[t];r.enableAdaptiveUI=this.parent.enableAdaptiveUI;var n=this.beforeOpenArgs.rowData,s=[];this.isEdit&&(s=(0,e.isNullOrUndefined)(n.taskData[this.parent.taskFields.segments])?[]:n.taskData[this.parent.taskFields.segments]),s.map(function(t,a){(0,e.isNullOrUndefined)(t[i.parent.taskFields.id])&&(t[i.parent.taskFields.id]=a)}),r.dataSource=s,r.actionBegin=this.segmentGridActionBegin.bind(this);var o,l,d=this.getDialogTabIndex("Segments");this.isEdit?this.isEdit&&(o=this.parent.editDialogFields[d]):o=this.parent.addDialogFields[d];var h=[],p=[];(0,e.isNullOrUndefined)(o)||(0,e.isNullOrUndefined)(o.additionalParams)||(l=o.additionalParams),this.setInjected(o,l,Ze.Grid,undefined,h,r,p),Ze.Grid.Inject(Ze.Edit,Ze.Page,Ze.Toolbar,Ze.ForeignKey),(r=Ii({},r,l)).toolbar=h.concat(r.toolbar);var u=this.updateColumns(p,r.columns);r.columns=u;var c=new Ze.Grid(r),g=this.createDivElement("",a.element.id+""+t+"TabContainer");return c.appendTo(g),g},a.prototype.renderGeneralTab=function(t,i){var a,r,n,s=this.parent,o=[],l=this.beforeOpenArgs[t];a=i?this.createDivElement("e-edit-form-row",s.element.id+""+t+"TabContainer"):this.createFormElement("e-edit-form-row",s.element.id+""+t+"TabContainer"),this.parent.enableAdaptiveUI&&(a.style.height="100%",(r=(0,e.createElement)("table",{className:"e-table"})).style.width="100%",n=(0,e.createElement)("tbody"));for(var d=a.id,h=function(e){if(!1===p.parent.columnByField[e].visible||"WBSCode"===e||"WBSPredecessor"===e)return"continue";var t=p.parent.columnByField[e],i=l[e],r=void 0;if(t.editTemplate){var s=p.createDivElement("e-edit-form-column");i.forEach(function(e){return s.appendChild(e)}),r=s}else r=p.renderInputElements(i,t);p.parent.enableAdaptiveUI?n.appendChild(r):a.appendChild(r),o.push(e)},p=this,u=0,c=Object.keys(l);u<c.length;u++){h(c[u])}this.parent.enableAdaptiveUI&&(r.appendChild(n),a.appendChild(r)),d!==a.id&&(a.id=d);var g=this.getDialogTabIndex("General"),f=[];if(this.isEdit||(0,e.isNullOrUndefined)(this.parent.addDialogFields[g])||(0,e.isNullOrUndefined)(this.parent.addDialogFields[g].fields)?!this.isEdit||(0,e.isNullOrUndefined)(this.parent.editDialogFields[g])||(0,e.isNullOrUndefined)(this.parent.editDialogFields[g].fields)||(f=this.parent.editDialogFields[g].fields):f=this.parent.addDialogFields[g].fields,!(0,e.isNullOrUndefined)(f)){var m=f.filter(function(e){return!o.includes(e)});if(!(0,e.isNullOrUndefined)(m))for(var y=m,D=0;D<=y.length-1;D++){var v=document.getElementById(y[D]);if(!(0,e.isNullOrUndefined)(v)){var k=v.innerHTML,b=(0,e.createElement)("div");b.innerHTML=k,a.appendChild(b.children[0])}}}return a},a.prototype.renderAdvancedTab=function(t,i){var a,r,n,s=this.parent,o=[],l=this.beforeOpenArgs[t];a=i?this.createDivElement("e-edit-form-row",s.element.id+""+t+"TabContainer"):this.createFormElement("e-edit-form-row",s.element.id+""+t+"TabContainer"),this.parent.enableAdaptiveUI&&(a.style.height="100%",(r=(0,e.createElement)("table",{className:"e-table"})).style.width="100%",n=(0,e.createElement)("tbody"));for(var d=a.id,h=function(e){if(!1===p.parent.columnByField[e].visible)return"continue";var t=p.parent.columnByField[e],i=l[e],r=void 0;if(t.editTemplate){var s=p.createDivElement("e-edit-form-column");i.forEach(function(e){return s.appendChild(e)}),r=s}else r=p.renderInputElements(i,t);p.parent.enableAdaptiveUI?n.appendChild(r):a.appendChild(r),o.push(e)},p=this,u=0,c=Object.keys(l);u<c.length;u++){h(c[u])}this.parent.enableAdaptiveUI&&(r.appendChild(n),a.appendChild(r)),d!==a.id&&(a.id=d);var g=this.getDialogTabIndex("Advanced"),f=[];if(this.isEdit||(0,e.isNullOrUndefined)(this.parent.addDialogFields[g])||(0,e.isNullOrUndefined)(this.parent.addDialogFields[g].fields)?!this.isEdit||(0,e.isNullOrUndefined)(this.parent.editDialogFields[g])||(0,e.isNullOrUndefined)(this.parent.editDialogFields[g].fields)||(f=this.parent.editDialogFields[g].fields):f=this.parent.addDialogFields[g].fields,!(0,e.isNullOrUndefined)(f)){var m=f.filter(function(e){return!o.includes(e)});if(!(0,e.isNullOrUndefined)(m))for(var y=m,D=0;D<=y.length-1;D++){var v=document.getElementById(y[D]);if(!(0,e.isNullOrUndefined)(v)){var k=v.innerHTML,b=(0,e.createElement)("div");b.innerHTML=k,a.appendChild(b.children[0])}}}return a},a.prototype.isCheckIsDisabled=function(t){var i,a=!1;if(!1===t.allowEditing||t.isPrimaryKey||this.parent.readOnly)if(-1!==this.parent.customColumns.indexOf(t.field))a=!0;else if(t.field===this.parent.taskFields.baselineStartDate||t.field===this.parent.taskFields.baselineEndDate||t.field===this.parent.taskFields.work||t.field===this.parent.taskFields.type||t.field===this.parent.taskFields.id||t.field===this.parent.taskFields.name||t.field===this.parent.taskFields.duration||t.field===this.parent.taskFields.progress||t.field===this.parent.taskFields.startDate||t.field===this.parent.taskFields.endDate){for(var r=0;r<this.parent.currentViewData.length;r++)if(!(0,e.isNullOrUndefined)(this.parent.currentViewData[r].ganttProperties.taskId)){i=this.parent.currentViewData[r].ganttProperties.taskId;break}a="string"!=typeof i}if(this.isEdit&&(t.field===this.parent.taskFields.id&&(a=!0),this.editedRecord.hasChildRecords&&(t.field===this.parent.taskFields.endDate&&(!(0,e.isNullOrUndefined)(this.editedRecord[this.parent.taskFields.manual])&&!1===this.editedRecord[this.parent.taskFields.manual]||"Auto"===this.parent.taskMode)||t.field===this.parent.taskFields.duration||t.field===this.parent.taskFields.progress||t.field===this.parent.taskFields.work||t.field===this.parent.taskFields.type)&&(a=!0)),!this.editedRecord.ganttProperties.isAutoSchedule){var n=this.parent.taskFields;-1!==[n.constraintDate,n.constraintType].indexOf(t.field)&&(a=!0)}return a},a.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},a.prototype.renderPredecessorTab=function(t){var a=this,r=this.parent,n=this.beforeOpenArgs[t],s=this.parent.columnByField[this.parent.taskFields.dependency];(!1===s.allowEditing||s.isPrimaryKey||this.parent.readOnly)&&(n.editSettings.allowEditing=!1,n.editSettings.allowAdding=!1,n.editSettings.allowDeleting=!1);var o,l=this.beforeOpenArgs.rowData,d=[];this.taskNameCollection(),this.isEdit&&(d=this.predecessorEditCollection(l),this.updatePredecessorDropDownData(l)),l[this.parent.taskFields.dependency]&&(o=l[this.parent.taskFields.dependency].split(",").length),0!==this.preTableCollection.length&&this.preTableCollection.length!==o||(n.editSettings.allowAdding=!1),n.actionComplete=this.gridActionComplete.bind(this),n.dataSource=d,n.enableAdaptiveUI=this.parent.enableAdaptiveUI,n.enableRtl=this.parent.enableRtl,n.locale=this.parent.locale,n.actionBegin=this.gridActionBegin.bind(this),n.columns[1].edit={write:function(t){"add"===(0,e.getValue)("requestType",t)&&(0,e.setValue)("rowData.uniqueId",k(),t);new et.ComboBox({dataSource:new i.DataManager(a.idCollection),popupHeight:"180px",allowCustom:!1,enableRtl:a.parent.enableRtl,fields:{value:"text"},value:t.rowData.name,change:function(t){var i=(0,e.closest)(t.element,"tr").querySelector("#"+a.parent.element.id+"DependencyTabContainerid");i&&((0,e.isNullOrUndefined)(t.itemData)||(0,e.isNullOrUndefined)(t.item)?i.value="":i.value=t.itemData.id)},autofill:!0}).appendTo(t.element)},read:function(e){return e.ej2_instances[0].value}};var h,p=this.getDialogTabIndex("Dependency");this.isEdit?this.isEdit&&(h=this.parent.editDialogFields[p]):h=this.parent.addDialogFields[p];var u,c=[],g=[];(0,e.isNullOrUndefined)(h)||(0,e.isNullOrUndefined)(h.additionalParams)||(u=h.additionalParams),this.setInjected(h,u,Ze.Grid,undefined,c,n,g),Ze.Grid.Inject(Ze.Edit,Ze.Page,Ze.Toolbar,Ze.ForeignKey),(n=Ii({},n,u)).toolbar=n.toolbar.concat(c);var f=this.updateColumns(g,n.columns);n.columns=f;var m=new Ze.Grid(n),y=this.createDivElement("e-dependent-div",r.element.id+""+t+"TabContainer");return m.appendTo(y),y},a.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},a.prototype.gridActionBegin=function(t){var i=this,a=this.beforeOpenArgs.Dependency;if("add"===t.requestType||"beginEdit"===t.requestType){var r="add"!==t.requestType;this.idCollection=(0,e.extend)([],[],this.preTableCollection,!0);for(var n=a.dataSource,s=function(a){o.idCollection.forEach(function(s,o){if(s.id===(0,e.getValue)("id",n[a])){var l=(0,e.getValue)("rowData",t);if(r&&(0,e.getValue)("id",l)===s.id)return;i.idCollection.splice(i.idCollection.indexOf(s),1)}})},o=this,l=0;l<=n.length;l++)s(l)}},a.prototype.gridActionComplete=function(t){if("save"===t.requestType){var i=this.parent.editModule.dialogModule.dialog.querySelector("#"+this.parent.element.id+"DependencyTabContainer");if(!(0,e.isNullOrUndefined)(i)&&!(0,e.isNullOrUndefined)(t.rows)&&t.rows.length===this.preTableCollection.length){var a=i.ej2_instances[0];a&&(a.editSettings.allowAdding=!1)}}},a.prototype.updateResourceCollection=function(t,i){if(!(0,e.isNullOrUndefined)(t.data)&&Object.keys(t.data).length){var a=document.querySelector("#"+i).ej2_instances[0];if(!(0,e.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];(0,e.isNullOrUndefined)(o.taskData)||(0,e.isNullOrUndefined)(o.taskData[this.parent.resourceFields.unit])||(0,e.isNullOrUndefined)(t.data[this.parent.resourceFields.unit])||o.taskData[this.parent.resourceFields.id]!==t.data[this.parent.resourceFields.id]||(o.taskData[this.parent.resourceFields.unit]=t.data[this.parent.resourceFields.unit]),s.push(r[n].taskData)}this.ganttResources=(0,e.extend)([],s)}else this.ganttResources=[]}else this.ganttResources=[]},a.prototype.renderResourceTab=function(t){var i=this,a=this.parent,r=a.resourceFields,n=this.beforeOpenArgs.rowData;("beforeOpenEditDialog"===this.beforeOpenArgs.requestType&&!(0,e.isNullOrUndefined)(this.editedRecord[this.parent.taskFields.resourceInfo])||"beforeOpenAddDialog"===this.beforeOpenArgs.requestType&&!(0,e.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),n.ganttProperties,!0);var s=n.ganttProperties.resourceInfo,o=this.beforeOpenArgs[t];o.enableAdaptiveUI=this.parent.enableAdaptiveUI,o.enableRtl=this.parent.enableRtl,o.locale=this.parent.locale;var l=a.element.id+""+t+"TabContainer",d=[];if(d=(0,e.extend)([],[],a.resources,!0),this.parent.dataOperation.updateResourceUnit(d),!(0,e.isNullOrUndefined)(s)){var h=void 0,p=s.length,u=void 0,c=d.length;for(h=0;h<p;h++)for(u=0;u<c;u++)s[h][r.id]===d[u][r.id]&&(d[u][r.unit]=s[h][r.unit])}o.dataSource=d;var g=n.ganttProperties.resourceInfo;if(this.isEdit&&!(0,e.isNullOrUndefined)(g))for(var f=0;f<g.length;f++)this.ganttResources.push(g[f]);else if(!this.isEdit&&!(0,e.isNullOrUndefined)(g))for(f=0;f<g.length;f++)this.ganttResources.push(g[f]);o.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)},o.rowSelected=function(e){i.updateResourceCollection(e,l),i.currentResources=i.ganttResources},o.rowDeselected=function(e){i.updateResourceCollection(e,l),i.currentResources=i.ganttResources};var m,y,D=this.createDivElement("e-resource-div",l),v=this.getDialogTabIndex("Resources");this.isEdit?this.isEdit&&(m=this.parent.editDialogFields[v]):m=this.parent.addDialogFields[v];var k,b=[];if(!(0,e.isNullOrUndefined)(m)&&!(0,e.isNullOrUndefined)(m.additionalParams))for(var f in y=m.additionalParams)if(Object.prototype.hasOwnProperty.call(y,f))switch(f){case"allowFiltering":$e.TreeGrid.Inject($e.Filter);break;case"allowSorting":$e.TreeGrid.Inject($e.Sort);break;case"allowPaging":$e.TreeGrid.Inject($e.Page);break;case"editSettings":$e.TreeGrid.Inject($e.Edit);break;case"aggregates":case"showColumnChooser":$e.TreeGrid.Inject($e.Aggregate);break;case"showColumnMenu":$e.TreeGrid.Inject(Ze.ColumnMenu);break;case"contextMenuItems":$e.TreeGrid.Inject(Ze.ContextMenu);break;case"allowResizing":$e.TreeGrid.Inject($e.Resize);break;case"allowReordering":$e.TreeGrid.Inject($e.Reorder);break;case"detailTemplate":$e.TreeGrid.Inject(Ze.DetailRow);break;case"allowRowDragAndDrop":$e.TreeGrid.Inject($e.RowDD);break;case"searchSettings":$e.TreeGrid.Inject(Ze.Search);break;case"selectionSettings":$e.TreeGrid.Inject($e.Selection);break;case"toolbar":(k=y.toolbar).map(function(e){switch(e){case"Search":$e.TreeGrid.Inject(Ze.Search);break;case"Print":$e.TreeGrid.Inject(Ze.Print);break;case"PdfExport":$e.TreeGrid.Inject(Ze.PdfExport);break;case"ExcelExport":$e.TreeGrid.Inject(Ze.ExcelExport)}}),(0,e.isNullOrUndefined)(k)||(o.toolbar=[],o.toolbar=o.toolbar.concat(k)),$e.TreeGrid.Inject($e.Toolbar);break;case"enableVirtualization":$e.TreeGrid.Inject($e.VirtualScroll);break;case"columns":b=o.columns}$e.TreeGrid.Inject($e.Selection,$e.Filter,$e.Edit,$e.VirtualScroll,$e.Toolbar),o=Ii({},o,y);var w=this.updateColumns(b,o.columns);o.columns=w;var T=!1;o.showColumnMenu&&(T=o.showColumnMenu,o.showColumnMenu=!1);var S=new $e.TreeGrid(o),P=this.parent.columnByField[this.parent.taskFields.resourceInfo];return(!1===P.allowEditing||P.isPrimaryKey||this.parent.readOnly)&&(S.allowSelection=!1,S.allowFiltering=!1,S.editSettings.allowEditing=!1),S.dataBound=function(){if(T&&(S.showColumnMenu=!0),i.parent.editDialogFields.length>=1&&"Resources"===i.parent.editDialogFields[0].type){var e=i.parent.element.id+"ResourcesTabContainer";i.resourceSelection(e)}},S.appendTo(D),D},a.prototype.resourceSelection=function(t){var i=this,a=document.querySelector("#"+t).ej2_instances[0];this.parent.triggeredColumnName="";var r=a.getCurrentViewRecords(),n=this.ganttResources;n&&n.length>0&&r.forEach(function(t,r){for(var s=0;s<n.length;s++)t.taskData[i.parent.resourceFields.id]!==n[s][i.parent.resourceFields.id]||(0,e.isNullOrUndefined)(a.selectionModule)||-1!==a.getSelectedRowIndexes().indexOf(r)||a.selectRow(r)})},a.prototype.renderCustomTab=function(e,t){return this.renderGeneralTab(e,t)},a.prototype.renderNotesTab=function(t){var i=this.parent,a=this.beforeOpenArgs[t];a.enableHtmlSanitizer=this.parent.enableHtmlSanitizer;var r,n,s=this.editedRecord.ganttProperties,o=this.createDivElement("",i.element.id+""+t+"TabContainer"),l=this.getDialogTabIndex("Notes"),d=[];if(this.isEdit?this.isEdit&&(r=this.parent.editDialogFields[l]):r=this.parent.addDialogFields[l],!(0,e.isNullOrUndefined)(r)&&!(0,e.isNullOrUndefined)(r.additionalParams))for(var h in n=r.additionalParams)if(Object.prototype.hasOwnProperty.call(n,h))switch(h){case"toolbarSettings":for(var p=0;p<n.toolbarSettings.items.length;p++){var u=n.toolbarSettings.items[p];if(u)switch(u){case"Image":Ri.RichTextEditor.Inject(Ri.Image);break;case"CreateTable":Ri.RichTextEditor.Inject(Ri.Table);break;case"EmojiPicker":Ri.RichTextEditor.Inject(Ri.EmojiPicker);break;case"FileManager":Ri.RichTextEditor.Inject(Ri.FileManager);break;case"FormatPainter":Ri.RichTextEditor.Inject(Ri.FormatPainter)}}(0,e.isNullOrUndefined)(n.toolbarSettings.items)||(d=a.toolbarSettings.items),Ri.RichTextEditor.Inject(Ri.Toolbar);break;case"editorMode":Ri.RichTextEditor.Inject(Ri.MarkdownEditor)}Ri.RichTextEditor.Inject(Ri.Toolbar,Ri.Link,Ri.HtmlEditor,Ri.QuickToolbar,Ri.Count,Ri.Table),a.value=s.notes;var c=this.parent.columnByField[this.parent.taskFields.notes];return(!1===c.allowEditing||c.isPrimaryKey||this.parent.readOnly)&&(a.enabled=!1),(a=Ii({},a,n)).toolbarSettings.items=d.concat(a.toolbarSettings.items),new Ri.RichTextEditor(a).appendTo(o),o},a.prototype.renderInputElements=function(t,i){var a,r,n,s=this,o=this.parent.element.id,l=this.editedRecord,d=this.createDivElement("e-edit-form-column");this.parent.enableAdaptiveUI&&(r=(0,e.createElement)("tr"),n=(0,e.createElement)("td"),d.style.width="100%");var h={column:i,data:l};if((0,e.isNullOrUndefined)(i.edit)||(0,e.isNullOrUndefined)(i.edit.create)||!(0,e.isNullOrUndefined)(i.edit.params))a=this.createInputElement("",o+""+i.field,i.field),d.appendChild(a);else{var p=i.edit.create;(a="string"==typeof p?(p=(0,Ze.getObject)(p,window))(h):i.edit.create(h)).className="",a.setAttribute("type","text"),a.setAttribute("id",o+""+i.field),a.setAttribute("name",i.field),a.setAttribute("title",i.field),d.appendChild(a)}if(t.enabled=(0,e.isNullOrUndefined)(t.enabled)?!this.isCheckIsDisabled(i):t.enabled,i.field===this.parent.taskFields.constraintType&&l.hasChildRecords){var u=this.parent.treeGridModule.getLocalizedConstraintTypeText("AsSoonAsPossible"),c=this.parent.treeGridModule.getLocalizedConstraintTypeText("StartNoEarlierThan"),g=this.parent.treeGridModule.getLocalizedConstraintTypeText("FinishNoLaterThan");t.dataSource=t.dataSource.filter(function(e){var t=e.text;return t===u||t===c||t===g})}if(i.field===this.parent.taskFields.duration)if((0,e.isNullOrUndefined)(i.valueAccessor)){if((0,e.isNullOrUndefined)(i.edit)){var f=l.ganttProperties;t.value=this.parent.dataOperation.getDurationString(f.duration,f.durationUnit)}}else if("string"==typeof i.valueAccessor){var m=(0,Ze.getObject)(i.valueAccessor,window);t.value=m(i.field,l,i)}else t.value=i.valueAccessor(i.field,l,i);else if(i.field===this.parent.taskFields.baselineDuration)if((0,e.isNullOrUndefined)(i.valueAccessor)){if((0,e.isNullOrUndefined)(i.edit)){f=l.ganttProperties;t.value=this.parent.dataOperation.getDurationString(f.baselineDuration,f.durationUnit)}}else if("string"==typeof i.valueAccessor){m=(0,Ze.getObject)(i.valueAccessor,window);t.value=m(i.field,l,i)}else t.value=i.valueAccessor(i.field,l,i);else"booleanedit"===i.editType?!0===l[i.field]?t.checked=!0:t.checked=!1:this.parent.taskFields[i.field]||"numericedit"!==i.editType||""!==l[i.field]&&0!==l[i.field]?t.value=l[i.field]:t.value=0;if((0,e.isNullOrUndefined)(i.edit)||(0,e.isNullOrUndefined)(i.edit.write)||!(0,e.isNullOrUndefined)(i.edit.params)){(D=new this.inputs[i.editType](t)).appendTo(a)}else{var y=i.edit.write,D=void 0;D="string"==typeof y?(y=(0,Ze.getObject)(y,window))({column:i,rowData:l,element:a}):i.edit.write({column:i,rowData:l,element:a}),i.field===this.parent.taskFields.duration&&(D.change=function(e){s.validateScheduleFields(e,i,s.parent)})}return this.parent.enableAdaptiveUI?(n.appendChild(d),r.appendChild(n),r):d},a.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)}},a.prototype.predecessorEditCollection=function(t){var i=[],a=t.ganttProperties;if(this.isEdit&&!(0,e.isNullOrUndefined)(this.parent.taskFields.dependency)&&!(0,e.isNullOrUndefined)(t)&&!(0,e.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=k(),i.push(l)}}return i},a.prototype.updatePredecessorDropDownData=function(e){var t,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)},a.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,n=e.to;(r=t.indexOf(n))>-1&&(t.splice(r,1),i.splice(r,1));for(var o=a.parent.connectorLineModule.getRecordByID(n),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))}})}},a.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]}]},a.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 t={action:"DialogEdit",modifiedRecords:[]};if(this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=t,"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(var a=0;a<this.rowData.ganttProperties.resourceInfo.length;a++)if(this.ganttResources[a][this.parent.resourceFields.id]!==this.rowData.ganttProperties.resourceInfo[a][this.parent.resourceFields.id]){i=!0;break}}else this.ganttResources.length>0&&(i=!0);if(i){var r={deletedIndexes:[]},n="T"+this.rowData.ganttProperties.taskId,s=[];this.parent.taskIds.reduce(function(e,t){if(t===n)if(0===this.ganttResources.length)s.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===s.indexOf(this.parent.flatData[this.parent.taskIds.indexOf(t)])&&s.push(this.parent.flatData[this.parent.taskIds.indexOf(t)])}.bind(this),[]),this.parent.undoRedoModule.findPosition((0,e.extend)([],[],s,!0),r,"deletedIndexes"),this.indexes?this.indexes.deletedIndexes[this.indexes.deletedIndexes.length]=r.deletedIndexes[0]:this.indexes=r}}}this.parent.updateDuration=!0;var o=this.parent,l=this.beforeOpenArgs.tabModel.items;for(a=0;a<l.length;a++){var d=l[a].content,h=d.getAttribute("id");(0,e.isNullOrUndefined)(h)&&""===h||("General"===(h=(h=h.replace(o.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=(0,e.extend)({},this.addedRecord,!0);if(u[this.parent.taskFields.resourceInfo].length)for(a=0;a<u[this.parent.taskFields.resourceInfo].length;a++){h=u[this.parent.taskFields.resourceInfo][a].toString();var 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},a.prototype.compareObjects=function(t,i){return!(0,e.isNullOrUndefined)(t)&&t.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})},a.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},a.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)},a.prototype.updateGeneralTab=function(t,i){var a=this.parent,r=t.childNodes,n={};this.isEdit||(n=this.addedRecord);for(var s=0;s<r.length;s++){var o=r[s],l=o.querySelector('input[id^="'+a.element.id+'"]')||o.querySelector('textarea[id^="'+a.element.id+'"]'),d=Array.from(o.children).find(function(e){return e.classList.contains("e-richtexteditor")});if(d&&(l=d),l){var h=l.id.replace(a.element.id,""),p=o.querySelector("#"+a.element.id+h).ej2_instances[0];if("stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType&&h===this.parent.taskFields.id){var u=p.value.toString();p.value=u}var c=a.columnByField[h];if((h===this.parent.taskFields.duration||this.parent.taskFields.baselineDuration?parseInt(this.rowData[h],10)!==parseInt(p.value,10):this.rowData[h]!==p.value)&&(this.disableUndo=!0),(0,e.isNullOrUndefined)(c)||(0,e.isNullOrUndefined)(c.edit)||(0,e.isNullOrUndefined)(c.edit.read)||!(0,e.isNullOrUndefined)(c.edit.params))if((0,e.isNullOrUndefined)(c)||"booleanedit"!==c.editType){if(h===this.parent.taskFields.duration||h===this.parent.taskFields.baselineDuration){var g=parseFloat(String(p.value));n[h]=g}else if(this.parent.weekWorkingTime.length>0&&p.value&&(h===this.parent.taskFields.startDate||h===this.parent.taskFields.baselineStartDate)){var f=h===this.parent.taskFields.startDate?this.beforeOpenArgs.rowData.ganttProperties.startDate:this.beforeOpenArgs.rowData.ganttProperties.baselineStartDate;if(this.parent.getStartTime(f)/3600===f.getHours()){var m=this.parent.getStartTime(p.value);this.parent.dataOperation.setTime(m,p.value),n[h]=p.value}else n[h]=p.value}else n[h]=p.value;this.parent.enableHtmlSanitizer&&"string"==typeof p.value&&(p.value=e.SanitizeHtmlHelper.sanitize(p.value),n[h]=p.value)}else l instanceof HTMLInputElement&&!0===l.checked?n[h]=!0:n[h]=!1;else{var y=c.edit.read;"string"==typeof y?(y=(0,Ze.getObject)(y,window),n[h]=y(l,p.value)):n[h]=c.edit.read(l,p.value)}}}this.isEdit&&(i||this.updateScheduleProperties(this.editedRecord,this.rowData),a.editModule.validateUpdateValues(n,this.rowData,!0))},a.prototype.updateAdvancedTab=function(e){for(var t=this.parent,i=e.childNodes,a=this.isEdit?this.rowData:this.addedRecord,r=0;r<i.length;r++){var n=i[r],s=n.querySelector('input[id^="'+t.element.id+'"]'),o=Array.from(n.children).find(function(e){return e.classList.contains("e-richtexteditor")});if(o&&(s=o),s){var l=s.id.replace(t.element.id,""),d=n.querySelector("#"+t.element.id+l).ej2_instances[0],h=t.columnByField[l];if(this.rowData[l]!==d.value&&(this.disableUndo=!0),h&&h.edit&&!h.edit.params){var p=h.edit.read;"string"==typeof p&&(p=(0,Ze.getObject)(p,window)),a[l]=p(s,d.value)}else a[l]=s.ej2_instances[0].value}}this.isEdit&&t.editModule.validateUpdateValues(a,this.rowData,!0)},a.prototype.updateScheduleProperties=function(t,i){this.parent.setRecordValue("startDate",t.ganttProperties.startDate,i.ganttProperties,!0),this.parent.setRecordValue("endDate",t.ganttProperties.endDate,i.ganttProperties,!0),this.parent.setRecordValue("duration",t.ganttProperties.duration,i.ganttProperties,!0),this.parent.setRecordValue("baselineDuration",t.ganttProperties.baselineDuration,i.ganttProperties,!0),this.parent.setRecordValue("baselineStartDate",t.ganttProperties.baselineStartDate,i.ganttProperties,!0),this.parent.setRecordValue("baselineEndDate",t.ganttProperties.baselineEndDate,i.ganttProperties,!0),this.parent.setRecordValue("durationUnit",t.ganttProperties.durationUnit,i.ganttProperties,!0),this.parent.setRecordValue("work",t.ganttProperties.work,i.ganttProperties,!0),this.parent.setRecordValue("type",t.ganttProperties.taskType,i.ganttProperties,!0),this.parent.setRecordValue("taskType",t.ganttProperties.taskType,i.ganttProperties,!0),this.parent.setRecordValue("resourceNames",t.ganttProperties.resourceNames,i.ganttProperties,!0),this.parent.setRecordValue("resourceInfo",t.ganttProperties.resourceInfo,i.ganttProperties,!0),(0,e.isNullOrUndefined)(this.parent.taskFields.startDate)||this.parent.dataOperation.updateMappingData(i,"startDate"),(0,e.isNullOrUndefined)(this.parent.taskFields.endDate)||this.parent.dataOperation.updateMappingData(i,"endDate"),(0,e.isNullOrUndefined)(this.parent.taskFields.duration)||(this.parent.dataOperation.updateMappingData(i,"duration"),this.parent.setRecordValue("durationUnit",t.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)),(0,e.isNullOrUndefined)(this.parent.taskFields.baselineDuration)||this.parent.dataOperation.updateMappingData(i,"baselineDuration"),(0,e.isNullOrUndefined)(this.parent.taskFields.work)||this.parent.dataOperation.updateMappingData(this.rowData,"work"),(0,e.isNullOrUndefined)(this.parent.taskFields.manual)||this.parent.dataOperation.updateMappingData(this.rowData,"manual"),(0,e.isNullOrUndefined)(this.parent.taskFields.type)||this.parent.dataOperation.updateMappingData(this.rowData,"type"),(0,e.isNullOrUndefined)(this.parent.taskFields.resourceInfo)||this.parent.dataOperation.updateMappingData(this.rowData,"resourceInfo")},a.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[]},a.prototype.updatePredecessorTab=function(t){var i=t.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(((0,e.isNullOrUndefined)(h.id)||h.id!==p[0]&&!(0,e.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&&((0,e.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(","):""},a.prototype.updateResourceTab=function(t){var i=this,a=t.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||(0,e.isNullOrUndefined)(this.rowData.ganttProperties)||(JSON.stringify(this.ganttResources)!==JSON.stringify(this.rowData.ganttProperties.resourceInfo)?(this.isResourceUpdate=!0,this.previousResource=(0,e.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||(0,e.isNullOrUndefined)(this.rowData.ganttProperties.resourceInfo)&&r.length>0)&&(this.disableUndo=!0),!this.disableUndo)for(var 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(s=0;s<r.length;s++)n.push(r[s][this.parent.resourceFields.id]),this.isAddNewResource=!0;this.addedRecord[this.parent.taskFields.resourceInfo]=n}},a.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()},a.prototype.updateCustomTab=function(e){this.updateGeneralTab(e,!0)},a}(),Fi=function(){return Fi=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Fi.apply(this,arguments)},Ui=function(){function i(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 i.prototype.updateConnectorLineEditElement=function(t){var i=this.getConnectorLineHoverElement(t.target);(0,e.getValue)("editModule.taskbarEditModule.taskBarEditAction",this.parent)||this.highlightConnectorLineElements(i)},i.prototype.getConnectorLineHoverElement=function(e){var t=a(e,Se),i=a(e,Re),r=a(e,Pe),n=a(e,Ce);return t||i||r||n?a(e,Te):null},i.prototype.highlightConnectorLineElements=function(e){e?e!==this.connectorLineElement&&(this.removeHighlight(),this.addHighlight(e)):this.removeHighlight()},i.prototype.addHighlight=function(e){this.connectorLineElement=e;var t=e.querySelector("."+Se);t&&t.setAttribute("stroke-width",(this.parent.connectorLineModule.lineStroke+1).toString())},i.prototype.removeHighlight=function(){if(this.connectorLineElement){var e=this.connectorLineElement.querySelector("."+Se);e&&e.setAttribute("stroke-width",this.parent.connectorLineModule.lineStroke.toString()),this.connectorLineElement=null}},i.prototype.getEditedConnectorLineString=function(t){for(var i,a,r,n,s=new Set,o=document.createDocumentFragment(),l=0;l<t.length;l++)if(i=t[l].ganttProperties.predecessor)for(var d=0;d<i.length;d++){var h=i[d],p="from",u="parent"+h[p]+"child"+h.to;if(this.parent.connectorLineModule.removeConnectorLineById(u),a=this.parent.connectorLineModule.getRecordByID(h[p]),r=this.parent.connectorLineModule.getRecordByID(h.to),(!this.parent.allowParentDependency&&(a&&a.expanded||r&&r.expanded)||this.parent.allowParentDependency&&(a||r))&&(n=this.parent.predecessorModule.updateConnectorLineObject(a,r,h),!(0,e.isNullOrUndefined)(n)&&!s.has(n.connectorLineId))){var c=this.parent.connectorLineModule.getConnectorLineTemplate(n);s.add(n.connectorLineId),o.appendChild(c)}}return o},i.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)},i.prototype.idFromPredecessor=function(t){for(var i=t.split(","),a=[],r=[],n=[],s=0;s<i.length;s++){var o=[],l=void 0,d=!1,h=void 0,p=!1,u=i[s].split("-"),c=void 0;if(6===u.length&&(u[4]=u[4]+"-"+u[5],u.pop()),5===u.length&&u[4].length>=12&&(c=i[s].substring(0,36),/^[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}$/.test(c)&&(p=!0)),i[s].includes("-")){if(i[s].includes("-")&&(i[s].includes("days")||i[s].includes("day"))){var g=i[s].split(/-(?=\d)/);g.length>0&&(h=g[g.length-1])}if(i[s].includes("-")&&/[A-Za-z]/.test(h)){var f=i[s].indexOf(h);-1!==f&&(l=i[s].substring(0,f-1)).includes("-")&&(d=!0)}}if(p){var m=void 0,y=void 0;1===(m=u[4].split("+")).length?r[0]=i[s]:(y=m[1].length,r[0]=i[s].slice(0,-(y+1)),r[1]=m[1]),u[4].indexOf("-")>=0&&(1===(m=u[4].split("-")).length?r[0]=i[s]:(y=m[1].length,r[0]=i[s].slice(0,-(y+1)),r[1]=m[1]))}else d&&l.includes("-")?r[0]=l:(r=i[s].split("+"),i[s].indexOf("-")>=0&&(r=i[s].split("-")));if(!(0,e.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},i.prototype.predecessorValidation=function(t,i){for(var a,r,n=i.rowUniqueID,s=0;s<t.length;s++){a=t[s];var o=[];t.slice(0).splice(s,1);for(var l=function(){var t=[];return-1!==o.indexOf(a)?"break":(0,e.isNullOrUndefined)(d.parent.connectorLineModule.getRecordByID(a))?{value:!1}:(r=d.parent.connectorLineModule.getRecordByID(a).ganttProperties,!(0,e.isNullOrUndefined)(r.predecessor)&&r.predecessor.length>0&&r.predecessor.forEach(function(e){r.rowUniqueID.toString()!==e.from&&t.push(e.from.toString())}),n.toString()===r.rowUniqueID.toString()||-1!==t.indexOf(n.toString())?{value:!1}:(o.push(a),!(0,e.isNullOrUndefined)(r.predecessor)&&r.predecessor.length>0?void(a=r.predecessor[0].from):"break"))},d=this;null!==a;){var h=l();if("object"==typeof h)return h.value;if("break"===h)break}}return!0},i.prototype.validatePredecessorRelation=function(t,i){var a,r,n=!0,s="ResourceView"===this.parent.viewType?t.ganttProperties.taskId:t.ganttProperties.rowUniqueID;if(!(0,e.isNullOrUndefined)(i)&&i.length>0){a=this.idFromPredecessor(i);for(var o=function(i){if(l.parent.allowParentDependency){if(parseInt(a[a.length-1],10)!==t[l.parent.taskFields.id]){var o=l.parent.ids.indexOf(a[a.length-1]),d=l.parent.currentViewData[o];d&&t&&(n=l.parent.predecessorModule.validateParentPredecessor(d,t))}}else if(!l.checkParentRelation(t,a))return{value:!1};var h=a.slice(0),p=[],u=!0;if(h.forEach(function(e){-1===p.indexOf(e)?p.push(e):u=!1}),!u)return{value:!1};r=a[i];var c=[];a.slice(0).splice(i,1);for(var g=function(){var i,a,n=[];if(-1!==c.indexOf(r))return"break";if((0,e.isNullOrUndefined)(l.parent.connectorLineModule.getRecordByID(r.toString())))return{value:!1};if(a=l.parent.connectorLineModule.getRecordByID(r.toString()).ganttProperties,!(0,e.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(c.push(r),(0,e.isNullOrUndefined)(a.predecessor)||!(a.predecessor.length>0))return"break";var o=void 0;return n.length>1?o=l.predecessorValidation(n,t.ganttProperties):1===n.length&&(r=a.predecessor[i].from),!1===o?{value:!1}:void 0};null!==r;){var f=g();if("object"==typeof f)return f;if("break"===f)break}},l=this,d=0;d<a.length;d++){var h=o(d);if("object"==typeof h)return h.value}}return n},i.prototype.addPredecessor=function(t,i){var a=(0,e.isNullOrUndefined)(t.ganttProperties.predecessorsName)||""===t.ganttProperties.predecessorsName?i:t.ganttProperties.predecessorsName+","+i;this.updatePredecessorHelper(t,a)},i.prototype.removePredecessor=function(e){this.isPublicDependencyDelete=!0,this.updatePredecessorHelper(e,null)},i.prototype.updatePredecessor=function(e,t,i){return this.updatePredecessorHelper(e,t,i)},i.prototype.updatePredecessorHelper=function(t,i,a){if((0,e.isUndefined)(i)||this.validatePredecessorRelation(t,i)){this.parent.isOnEdit=!0;var r=[];(0,e.isNullOrUndefined)(i)||""===i||(r=this.parent.predecessorModule.calculatePredecessor(i,t)),this.parent.setRecordValue("predecessor",r,t.ganttProperties,!0);var n=this.parent.predecessorModule.getPredecessorStringValue(t);this.parent.setRecordValue("predecessorsName",n,t.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,n,t),this.parent.setRecordValue(this.parent.taskFields.dependency,n,t);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=t,this.parent.editModule.initiateUpdateAction(s),!0}t.taskData[this.parent.taskFields.dependency]&&(t.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},i.prototype.checkParentRelation=function(e,t){var i=e;if(i&&i.parentItem&&-1!==t.indexOf(i.parentItem.taskId.toString()))return!1;for(var a=function(e){var i=r.parent.currentViewData.filter(function(i){return i&&i.ganttProperties.rowUniqueID.toString()===t[e].toString()});if(i[0]&&i[0].hasChildRecords)return{value:!1}},r=this,n=0;n<t.length;n++){var s=a(n);if("object"==typeof s)return s.value}return!0},i.prototype.initPredecessorValidationDialog=function(){if(this.parent.taskFields.dependency&&this.parent.isInPredecessorValidation){var t=(0,e.createElement)("div",{id:this.parent.element.id+"_dialogValidationRule"});this.parent.element.appendChild(t),this.renderValidationDialog()}},i.prototype.renderValidationDialog=function(){var e=this.parent.taskFields,i=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 t.Dialog({header:i,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},i.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()},i.prototype.validationDialogCancelButton=function(){this.parent.constraintViolationType="",this.parent.currentEditedArgs.validateMode.respectLink=!0,this.applyPredecessorOption(),this.parent.validationDialogElement.hide()},i.prototype.validationDialogClose=function(t){this.parent.constraintViolationType="",(0,e.getValue)("isInteracted",t)&&(this.parent.currentEditedArgs.validateMode.respectLink=!0,this.applyPredecessorOption())},i.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){a!==e.from||(i=e.to)})}this.parent.editModule.updateEditedTask(e.editEventArgs);var r=[];this.processPredecessor(i,r),r=[]}},i.prototype.compareArrays=function(e,t){return e.length===t.length&&JSON.stringify(e)===JSON.stringify(t)},i.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))})}}},i.prototype.checkChildRecords=function(t){var i=[],a=t.ganttProperties.taskId,r=t.ganttProperties.predecessor;if((0,e.isNullOrUndefined)(r))this.validationPredecessor=r;else{for(var n=0;n<r.length;n++){var s=r[n];s.to.toString()===a.toString()&&i.push(s)}this.validationPredecessor=i}if((0,e.isNullOrUndefined)(this.validationPredecessor)||this.removePredecessors(t,this.validationPredecessor),t.childRecords.length>0)for(n=0;n<t.childRecords.length;n++){var o=t.childRecords[n];this.validationPredecessor=o.ganttProperties.predecessor,(0,e.isNullOrUndefined)(this.validationPredecessor)||this.removePredecessors(o,this.validationPredecessor),o.childRecords.length>0&&this.checkChildRecords(o)}else if(!(0,e.isNullOrUndefined)(t.parentItem)){var l=this.parent.getRecordByID(t.parentItem.taskId);this.validationPredecessor=l.ganttProperties.predecessor,this.removePredecessors(l,this.validationPredecessor)}},i.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]})},i.prototype.getOffsetForPredecessor=function(t,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(t.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,t.offsetUnit,!0,!1),this.parent.durationUnit===t.offsetUnit&&(i.ganttProperties.startDate&&(0,e.isNullOrUndefined)(i.ganttProperties.endDate)||(0,e.isNullOrUndefined)(i.ganttProperties.startDate)&&i.ganttProperties.endDate)&&(o-=1),r=l?-o:o)}return r},i.prototype.calculateOffset=function(t,i){var a=this;if(this.parent.autoCalculateDateScheduling&&!(this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)&&t&&null!==r(t.ganttProperties)){var n=(0,e.extend)([],t.ganttProperties.predecessor,[],!0),s=this.parent.predecessorModule.getValidPredecessor(t);if(s.length>0){this.cumulativePredecessorChanges=n;for(var o=function(i){var a=s[parseInt(i.toString(),10)],r=l.parent.connectorLineModule.getRecordByID(a.from);l.parent.undoRedoModule&&l.parent.undoRedoModule.isUndoRedoPerformed&&"ProjectView"===l.parent.viewType&&(0===r.ganttProperties.predecessor.filter(function(e){return e.from===s[i].from&&e.to===s[i].to}).length&&r.ganttProperties.predecessor.push(s[i]));var o=l.getOffsetForPredecessor(a,r,t),d=c(a,"from",n,"to");-1!==d&&(n[d].offset=o);var h=(0,e.extend)([],r.ganttProperties.predecessor,[],!0),p=c(a,"from",h,"to");-1!==p&&(h[p].offset=o),l.parent.setRecordValue("predecessor",h,r.ganttProperties,!0)},l=this,d=0;d<s.length;d++)o(d)}else{var h=t.ganttProperties.predecessor;h&&h.length>0&&h.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",n,t.ganttProperties,!0);else if(0===s.length&&(this.cumulativePredecessorChanges=[]),n&&n.length>0&&this.cumulativePredecessorChanges&&this.cumulativePredecessorChanges.length>0){var p=n.map(function(e){var t=a.cumulativePredecessorChanges.find(function(t){return a.compareObjects(t,e)});return t?Fi({},t):null}).filter(function(e){return null!==e});this.parent.setRecordValue("predecessor",p,t.ganttProperties,!0)}var u=this.parent.predecessorModule.getPredecessorStringValue(t);if(this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,u,t),this.parent.setRecordValue(this.parent.taskFields.dependency,u,t),this.parent.setRecordValue("predecessorsName",u,t.ganttProperties,!0),-1===this.validatedOffsetIds.indexOf(t.ganttProperties.taskId.toString())&&this.validatedOffsetIds.push(t.ganttProperties.taskId.toString()),t.hasChildRecords)for(d=0;d<t.childRecords.length;d++)-1===this.validatedOffsetIds.indexOf(t.childRecords[d].ganttProperties.taskId.toString())&&t.childRecords[d].ganttProperties.predecessor&&t.childRecords[d].ganttProperties.predecessor.length>0&&this.calculateOffset(t.childRecords[d]);else if(t.parentItem)for(var g=t.parentItem;g;){var f=this.parent.getRecordByID(g.taskId),m=f.ganttProperties.taskId.toString();if(-1===this.validatedOffsetIds.indexOf(m)&&f.ganttProperties.predecessor&&f.ganttProperties.predecessor.length>0){this.calculateOffset(f);break}g=f.parentItem}}},i.prototype.removePredecessors=function(t,i){var a=(0,e.extend)([],[],t.ganttProperties.predecessor,!0);if(!(0,e.isNullOrUndefined)(i)){for(var r=i.length,n=0;n<r;n++){var s=this.parent.connectorLineModule.getRecordByID(i[n].from),o=(0,e.extend)([],[],s.ganttProperties.predecessor,!0),l=c(i[n],"from",a,"to");a.splice(l,1);var d=c(i[parseInt(n.toString(),10)],"from",o,"to");o.splice(d,1),this.parent.setRecordValue("predecessor",o,s.ganttProperties,!0)}if(a.length!==t.ganttProperties.predecessor.length){this.parent.setRecordValue("predecessor",a,t.ganttProperties,!0);var h=this.parent.predecessorModule.getPredecessorStringValue(t);this.parent.setRecordValue("predecessorsName",h,t.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,h,t),this.parent.setRecordValue(this.parent.taskFields.dependency,h,t)}}},i.prototype.formatViolationType=function(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2")},i.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()},i.prototype.validationDialogTemplate=function(t){var i=this.parent.element.id,a=(0,e.createElement)("div",{className:"e-ValidationContent"}),r=(0,e.getValue)("task",t),n=(0,e.getValue)("parentTask",t),s=(0,e.getValue)("violationType",t),o=r.ganttProperties.taskName,l=(0,e.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=u(p,h));var c='<div id="'+i+'_ValidationText">'+p+"</div>",g=this.parent.localeObj.getConstant("cancelLink"),f=u(this.parent.localeObj.getConstant("removeLink"),[o,d]),m=u(this.parent.localeObj.getConstant("removeConstraint"),[s=this.formatViolationType(s),o]),y=u(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 xi.RadioButton({label:g,name:"ValidationRule",value:"cancel",checked:!0,cssClass:Ge}).appendTo(v),k&&new xi.RadioButton({label:f,name:"ValidationRule",value:"removeLink",cssClass:Ge}).appendTo(k),b&&new xi.RadioButton({label:m,name:"ValidationRule",value:"removeConstraint",cssClass:Ge}).appendTo(b),w&&new xi.RadioButton({label:y,name:"ValidationRule",value:"preserveLink",cssClass:Ge}).appendTo(w),a.querySelectorAll(".e-radio-wrapper").forEach(function(e){e.style.padding="6px",e.querySelector("span").style.fontWeight="normal"}),a},i.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()},i.prototype.constraintValidationDialogTemplate=function(t){var i=this.parent.element.id,a=t.parentRecord,r=t.record,n=t.predecessorLink,s=t.violationType,o=(0,e.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=u(h,[s=this.formatViolationType(s),l]),f=u(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 xi.RadioButton({label:g,name:"ValidationRule",value:"removeConstraint",checked:!0,cssClass:Ge}).appendTo(y),void 0!==n){var D=o.querySelector("#"+i+"_RemoveDependency");D&&new xi.RadioButton({label:f,name:"ValidationRule",value:"removeDependency",cssClass:Ge}).appendTo(D)}var v=o.querySelector("#"+i+"_CancelChange");return v&&new xi.RadioButton({label:c,name:"ValidationRule",value:"cancelChange",cssClass:Ge}).appendTo(v),o.querySelectorAll(".e-radio-wrapper").forEach(function(e){e.style.padding="6px",e.querySelector("span").style.fontWeight="normal"}),o},i.prototype.validateTypes=function(t,i){var a,r,n,s,o=this.parent.predecessorModule.getValidPredecessor(t);this.validationPredecessor=[];var l=this.parent.predecessorModule.getPredecessorDate(t,o,null,!0);n=i?i.ganttProperties:t.ganttProperties;for(var d=this.parent.allowUnscheduledTasks&&(0,e.isNullOrUndefined)(l)?n.endDate:this.dateValidateModule.getEndDate(l,n.duration,n.durationUnit,n,!1),h=0;h<o.length;h++){a=this.parent.connectorLineModule.getRecordByID(o[h].from);var p=null;if("FS"===o[h].type)(0!==(g=this.parent.dateValidationModule.getDuration(l,n.startDate,this.parent.durationUnit,n.isAutoSchedule,n.isMilestone,!0))||0===g&&!1===this.parent.updateOffsetOnTaskbarEdit)&&(n.startDate<l?(this.validationPredecessor.push(o[parseInt(h.toString(),10)]),p="taskBeforePredecessor_FS"):n.startDate>l&&(this.validationPredecessor.push(o[parseInt(h.toString(),10)]),p="taskAfterPredecessor_FS"));else if("SS"===o[h].type){var u=new Date(n.endDate),c=new Date(l);n.startDate<l?(this.validationPredecessor.push(o[parseInt(h.toString(),10)]),p="taskBeforePredecessor_SS"):n.startDate>l?(this.validationPredecessor.push(o[parseInt(h.toString(),10)]),p="taskAfterPredecessor_SS"):this.parent.allowUnscheduledTasks&&(0,e.isNullOrUndefined)(n.startDate)&&(0,e.isNullOrUndefined)(n.duration)&&u.setHours(0,0,0,0)<c.setHours(0,0,0,0)?(this.validationPredecessor.push(o[parseInt(h.toString(),10)]),p="taskBeforePredecessor_SS"):this.parent.allowUnscheduledTasks&&(0,e.isNullOrUndefined)(n.startDate)&&(0,e.isNullOrUndefined)(n.duration)&&u.setHours(0,0,0,0)>c.setHours(0,0,0,0)&&(this.validationPredecessor.push(o[parseInt(h.toString(),10)]),p="taskAfterPredecessor_SS")}else if("FF"===o[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(o[parseInt(h.toString(),10)]),p="taskBeforePredecessor_FF"):d>a.ganttProperties.endDate&&(this.validationPredecessor.push(o[parseInt(h.toString(),10)]),p="taskAfterPredecessor_FF"))}else if("SF"===o[h].type){var g;(0!==(g=this.parent.dateValidationModule.getDuration(a.ganttProperties.startDate,d,this.parent.durationUnit,a.ganttProperties.isAutoSchedule,a.ganttProperties.isMilestone,!0))||0===g&&!1===this.parent.updateOffsetOnTaskbarEdit)&&(d<a.ganttProperties.startDate?(this.validationPredecessor.push(o[parseInt(h.toString(),10)]),p="taskBeforePredecessor_SF"):d>=a.ganttProperties.startDate&&(this.validationPredecessor.push(o[parseInt(h.toString(),10)]),p="taskAfterPredecessor_SF"))}!(0,e.isNullOrUndefined)(p)&&(0,e.isNullOrUndefined)(s)&&(r=a,s=p)}return{parentTask:r,task:t,violationType:s}},i.prototype.addRemovePredecessor=function(t){var i=this.parent.previousRecords[t.uniqueID],a=(0,e.isNullOrUndefined)(t.ganttProperties.predecessor)?t.ganttProperties.predecessor:t.ganttProperties.predecessor.slice();if(i&&i.ganttProperties&&i.ganttProperties.hasOwnProperty("predecessor")){var r=i.ganttProperties.predecessor;if(!(0,e.isNullOrUndefined)(r))for(var n=function(i){var a=s.parent.connectorLineModule.getRecordByID(r[parseInt(i.toString(),10)].from);if(a===t){0===t.ganttProperties.predecessor.filter(function(e){return r[i].from===e.from&&r[i].to===e.to}).length&&(t.parentItem&&s.parent.taskFields.dependency&&t.ganttProperties.predecessor&&s.parent.allowParentDependency?r[i].from!==t.parentItem.taskId&&r[i].to!==t.parentItem.taskId&&t.ganttProperties.predecessor.push(r[parseInt(i.toString(),10)]):t.ganttProperties.predecessor.push(r[parseInt(i.toString(),10)]))}else{var n=(0,e.extend)([],[],a.ganttProperties.predecessor,!0),o=c(r[parseInt(i.toString(),10)],"from",n,"to");-1!==o&&(n.splice(o,1),s.parent.setRecordValue("predecessor",n,a.ganttProperties,!0))}},s=this,o=0;o<r.length;o++)n(o);if(!(0,e.isNullOrUndefined)(a))for(var l=function(t){var i=d.parent.connectorLineModule.getRecordByID(a[parseInt(t.toString(),10)].from),r=(0,e.extend)([],[],i.ganttProperties.predecessor,!0);0===r.filter(function(e){return a[t].from===e.from&&a[t].to===e.to}).length&&(r.push(a[parseInt(t.toString(),10)]),d.parent.setRecordValue("predecessor",r,i.ganttProperties,!0))},d=this,h=0;h<a.length;h++)l(h)}},i.prototype.removePredecessorByIndex=function(t,i){if(this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed){this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection();var a={action:"DeleteDependency"};a.modifiedRecords=(0,e.extend)([],[t],[],!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=a}var r=t.ganttProperties.predecessor,n=r.splice(i,1),s=this.parent.connectorLineModule.getRecordByID(n[0].from).ganttProperties.predecessor,o=c(n[0],"from",s,"to");s.splice(o,1);var l=this.parent.predecessorModule.getPredecessorStringValue(t);r.push(n[0]),this.parent.connectorLineEditModule.updatePredecessor(t,l)},i.prototype.renderPredecessorDeleteConfirmDialog=function(){this.confirmPredecessorDialog=new t.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 i=(0,e.createElement)("div",{id:this.parent.element.id+"_deletePredecessorConfirmDialog"});this.parent.element.appendChild(i),this.confirmPredecessorDialog.isStringTemplate=!0,this.confirmPredecessorDialog.appendTo(i)},i.prototype.confirmCloseDialog=function(){this.confirmPredecessorDialog.destroy()},i.prototype.confirmOkDeleteButton=function(){this.removePredecessorByIndex(this.childRecord,this.predecessorIndex),this.confirmPredecessorDialog.destroy()},i}(),Ni=function(){return Ni=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Ni.apply(this,arguments)},Li=function(){function a(t){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=t,this.parent.predecessorModule.validatedChildItems=[],this.parent.editSettings.allowEditing&&"Auto"===this.parent.editSettings.mode&&(this.cellEditModule=new bi(this.parent)),this.parent.taskFields.dependency&&(this.parent.connectorLineEditModule=new Ui(this.parent)),(this.parent.editSettings.allowAdding||this.parent.editSettings.allowEditing&&("Dialog"===this.parent.editSettings.mode||"Auto"===this.parent.editSettings.mode))&&(this.dialogModule=new Ei(this.parent)),this.parent.editSettings.allowTaskbarEditing&&(this.taskbarEditModule=new Pi(this.parent)),this.parent.editSettings.allowDeleting){var i=(0,e.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&&$e.TreeGrid.Inject($e.Edit),this.updateDefaultColumnEditors()}return a.prototype.getModuleName=function(){return"edit"},a.prototype.updateDefaultColumnEditors=function(){for(var t=[this.parent.taskFields.id,this.parent.taskFields.progress,this.parent.taskFields.resourceInfo,this.parent.taskFields.type,"taskType"],i=0;i<t.length;i++)if(!(0,e.isNullOrUndefined)(t[i])&&t[i].length>0){var a=this.parent.getColumnByField(t[parseInt(i.toString(),10)],this.parent.treeGridModule.treeGridColumns);a&&(a.field===this.parent.taskFields.id?this.updateIDColumnEditParams(a):a.field===this.parent.taskFields.progress&&(0,e.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))}},a.prototype.updateIDColumnEditParams=function(e){var t={min:0,decimals:0,enableRtl:this.parent.enableRtl,validateDecimalOnType:!0,format:"n0",showSpinButton:!1};this.updateEditParams(e,t)},a.prototype.updateProgessColumnEditParams=function(e){var t={min:0,enableRtl:this.parent.enableRtl,decimals:0,validateDecimalOnType:!0,max:100,format:"n0"};this.updateEditParams(e,t)},a.prototype.updateEditParams=function(t,i){(0,e.isNullOrUndefined)(t.edit)?(t.edit={},t.edit.params={}):(0,e.isNullOrUndefined)(t.edit.params)&&(t.edit.params={}),(0,e.extend)(i,t.edit.params),t.edit.params=i,this.parent.getColumnByField(t.field,this.parent.ganttColumns).edit=t.edit},a.prototype.updateResourceColumnEditor=function(t){if(this.parent.treeGridModule.currentEditRow={},this.parent.editSettings.allowEditing&&(0,e.isNullOrUndefined)(t.edit)&&"Auto"===this.parent.editSettings.mode){t.editType="dropdownedit",t.edit=this.getResourceEditor();var i=this.parent.getColumnByField(t.field,this.parent.ganttColumns);i.editType="dropdownedit",i.edit=t.edit}},a.prototype.getResourceEditor=function(){var t,a=this,r=this.parent.resourceFields,n={};return et.MultiSelect.Inject(et.CheckBoxSelection),n.write=function(e){a.parent.treeGridModule.currentEditRow={},(t=new et.MultiSelect({dataSource:new i.DataManager(a.parent.resources),fields:{text:r.name,value:r.id},enableRtl:a.parent.enableRtl,mode:"CheckBox",showDropDownIcon:!0,popupHeight:"350px",delimiterChar:",",value:a.parent.treeGridModule.getResourceIds(e.rowData)})).appendTo(e.element)},n.read=function(t){var i=t.ej2_instances[0].value,n=[];(0,e.isNullOrUndefined)(i)&&(i=[]);for(var s=0;s<i.length;s++)for(var o=0;o<a.parent.resources.length;o++)if(a.parent.resources[o][r.id]===i[s]){n.push(a.parent.resources[o][r.name]);break}return a.parent.treeGridModule.currentEditRow[a.parent.taskFields.resourceInfo]=i,n.join(",")},n.destroy=function(){t&&t.destroy()},n},a.prototype.updateTaskTypeColumnEditor=function(t){if(this.parent.editSettings.allowEditing&&(0,e.isNullOrUndefined)(t.edit)&&"Auto"===this.parent.editSettings.mode){t.editType="dropdownedit",t.edit=this.getTaskTypeEditor();var i=this.parent.getColumnByField(t.field,this.parent.ganttColumns);i.editType="dropdownedit",i.edit=t.edit}},a.prototype.getTaskTypeEditor=function(){var t,a=this,r={},n=[{ID:1,Value:"FixedUnit"},{ID:2,Value:"FixedWork"},{ID:3,Value:"FixedDuration"}];return r.write=function(r){a.parent.treeGridModule.currentEditRow={},(t=new et.DropDownList({dataSource:new i.DataManager(n),enableRtl:a.parent.enableRtl,fields:{value:"Value"},popupHeight:"350px",value:(0,e.getValue)("taskType",r.rowData.ganttProperties)})).appendTo(r.element)},r.read=function(e){var t=e.ej2_instances[0].value,i=a.parent.taskFields.type||"taskType";return a.parent.treeGridModule.currentEditRow[i]=t,t},r.destroy=function(){t&&t.destroy()},r},a.prototype.reUpdateEditModules=function(){var t=this.parent.editSettings;if(t.allowEditing?(this.parent.editModule.cellEditModule&&"Dialog"===t.mode?(this.cellEditModule.destroy(),this.parent.treeGrid.recordDoubleClick=this.recordDoubleClick.bind(this)):(0,e.isNullOrUndefined)(this.parent.editModule.cellEditModule)&&"Auto"===t.mode&&(this.cellEditModule=new bi(this.parent)),this.parent.editModule.dialogModule&&"Auto"===t.mode?this.parent.treeGrid.recordDoubleClick=void 0:(0,e.isNullOrUndefined)(this.parent.editModule.dialogModule)&&(this.dialogModule=new Ei(this.parent))):(this.cellEditModule&&this.cellEditModule.destroy(),this.dialogModule&&this.dialogModule.destroy()),t.allowDeleting&&t.showDeleteConfirmDialog){if((0,e.isNullOrUndefined)(this.confirmDialog)){var i=(0,e.createElement)("div",{id:this.parent.element.id+"_deleteConfirmDialog"});this.parent.element.appendChild(i),this.renderDeleteConfirmDialog()}}else t.allowDeleting&&t.showDeleteConfirmDialog||this.confirmDialog&&!this.confirmDialog.isDestroyed&&this.confirmDialog.destroy();t.allowTaskbarEditing?(0,e.isNullOrUndefined)(this.parent.editModule.taskbarEditModule)&&(this.taskbarEditModule=new Pi(this.parent)):this.taskbarEditModule&&this.taskbarEditModule.destroy()},a.prototype.recordDoubleClick=function(t){if(this.parent.editSettings.allowEditing&&"Dialog"===this.parent.editSettings.mode){var i=void 0;if(t.row){var a=(0,e.getValue)("rowIndex",t.row);i=this.parent.currentViewData[a]}(0,e.isNullOrUndefined)(i)||this.dialogModule.openEditDialog(i)}this.parent.ganttChartModule.recordDoubleClick(t)},a.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()},a.prototype.updateRecordByID=function(t){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((0,e.isNullOrUndefined)(t)||(0,e.isNullOrUndefined)(t[a.id]))return;var r="ResourceView"===this.parent.viewType?this.parent.flatData[this.parent.getTaskIds().indexOf((t.hasChildRecords?"R":"T")+t[a.id])]:this.parent.getRecordByID(t[a.id]);if((0,e.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=(0,e.extend)([],[r],[],!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=n}if(!(0,e.isNullOrUndefined)(this.parent.editModule)&&r){if(this.parent.isOnEdit=!0,this.validateUpdateValues(t,r,!0),this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed){if("ProjectView"===this.parent.viewType&&t.ganttProperties.predecessor&&r.ganttProperties.predecessor)for(var s=function(e){var a=r.ganttProperties.predecessor.filter(function(a){a.from===t.ganttProperties.predecessor[e].from&&a.to===t.ganttProperties.predecessor[e].to&&t.ganttProperties.predecessor[e].offset!==a.offset&&(i.parent.flatData[i.parent.ids.indexOf(a.to)].ganttProperties.predecessor.filter(function(i){return i.from===t.ganttProperties.predecessor[e].from&&i.to===t.ganttProperties.predecessor[e].to})[0].offset=t.ganttProperties.predecessor[e].offset);return a.from!==t.ganttProperties.predecessor[e].from&&a.from!==t.ganttProperties.predecessor[e].to});if(a.length>0){for(var n=0;n<a.length;n++)for(var s=o.parent.flatData[o.parent.ids.indexOf(a[n].from)],l=0;l<s.ganttProperties.predecessor.length;l++)if(s.ganttProperties.predecessor[l].from===a[n].from&&s.ganttProperties.predecessor[l].to===a[n].to){s.ganttProperties.predecessor.splice(l,1);break}return"break"}},o=this,l=0;l<t.ganttProperties.predecessor.length;l++){if("break"===s(l))break}else if(!t.ganttProperties.predecessor&&r.ganttProperties.predecessor)for(l=0;l<r.ganttProperties.predecessor.length;l++){var d=void 0;d=r.ganttProperties.taskId.toString()===r.ganttProperties.predecessor[l].from?r.ganttProperties.predecessor[l].to:r.ganttProperties.predecessor[l].from;var h=this.parent.flatData[this.parent.ids.indexOf(d)];if(!(0,e.isNullOrUndefined)(h)&&!(0,e.isNullOrUndefined)(h.ganttProperties)&&!(0,e.isNullOrUndefined)(h.ganttProperties.predecessor))for(var p=0;p<h.ganttProperties.predecessor.length;p++)h.ganttProperties.predecessor[p].from===r.ganttProperties.predecessor[l].from&&h.ganttProperties.predecessor[p].to===r.ganttProperties.predecessor[l].to&&h.ganttProperties.predecessor.splice(p,1)}r.ganttProperties.resourceInfo=t.ganttProperties.resourceInfo,r[this.parent.taskFields.resourceInfo]=t[this.parent.taskFields.resourceInfo],r.taskData[this.parent.taskFields.resourceInfo]=t.taskData[this.parent.taskFields.resourceInfo],this.parent.setRecordValue("predecessorsName",t.ganttProperties.predecessorsName,r.ganttProperties,!0),this.parent.taskFields.dependency&&this.parent.setRecordValue(this.parent.taskFields.dependency,t[this.parent.taskFields.dependency],r),this.parent.setRecordValue("predecessor",t.ganttProperties.predecessor,r.ganttProperties,!0)}t[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 u=Object.keys(t);if(-1===u.indexOf(a.startDate)&&-1===u.indexOf(a.endDate)&&-1===u.indexOf(a.duration)||this.parent.dataOperation.calculateScheduledValues(r,r.taskData,!1),-1!==u.indexOf(a.baselineDuration)&&this.parent.dataOperation.calculateScheduledValuesforBaseline(r,r.taskData,!1),this.parent.dataOperation.updateWidthLeft(r),(0,e.isUndefined)(t[this.parent.taskFields.dependency])||t[this.parent.taskFields.dependency]===r.ganttProperties.predecessorsName){var c={};c.data=r,"ResourceView"===this.parent.viewType&&(c.action="methodUpdate"),this.parent.editModule.initiateUpdateAction(c)}else this.parent.connectorLineEditModule.updatePredecessor(r,t[this.parent.taskFields.dependency])}}},a.prototype.validateUpdateValues=function(t,i,a){for(var r=this.parent,n=r.taskFields,o=s(r.columnMapping),l=[],d=!1,h=0,p=Object.keys(t);h<p.length;h++){var u=p[h];if(n.startDate===u||n.endDate===u||n.duration===u||n.baselineDuration===u){var c=n.baselineDuration===u;if((0,e.isNullOrUndefined)(t[""+u])&&!r.allowUnscheduledTasks)continue;var g=i.ganttProperties,f=n.duration===u||n.baselineDuration===u;if(a){if(f)r.dataOperation.updateDurationValue(t[u],g,c),!c&&g.duration>0&&g.isMilestone&&this.parent.setRecordValue("isMilestone",!1,g,!0);else{var m="string"==typeof t[u]?new Date(t[u]):t[u];u===n.endDate&&(0,e.isNullOrUndefined)(g.startDate)&&((0,e.isNullOrUndefined)(t[n.duration])||""===t[n.duration]||Number.isNaN(t[n.duration]))&&(m=this.parent.editModule.dialogModule.isFromEditDialog?i.ganttProperties.endDate:t[n.endDate]),r.setRecordValue(o[u],m,g,!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,o[u])}else l.push(u),d=!0}else if(n.resourceInfo===u){var y=r.dataOperation.setResourceInfo(t);"ResourceView"===this.parent.viewType&&(JSON.stringify(y)!==JSON.stringify(i.ganttProperties.resourceInfo)?(this.parent.editModule.dialogModule.isResourceUpdate=!0,this.parent.editModule.dialogModule.previousResource=(0,e.isNullOrUndefined)(i.ganttProperties.resourceInfo)?[]:i.ganttProperties.resourceInfo.slice()):this.parent.editModule.dialogModule.isResourceUpdate=!1),this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed||(i.ganttProperties.resourceInfo=y),r.dataOperation.updateMappingData(i,"resourceInfo")}else if(n.dependency===u);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(u)){var D=r.columnByField[u],v=t[u];(0,e.isNullOrUndefined)(D)||"datepickeredit"!==D.editType&&"datetimepickeredit"!==D.editType||(v=r.dataOperation.getDateFromFormat(v));var k=o[u];switch(u){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",!(0,e.isNullOrUndefined)(n.duration)){var b=i.ganttProperties,w=t[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",t&&!(0,e.isNullOrUndefined)(t[n.segments])&&t[n.segments].length>0&&t.ganttProperties&&t.ganttProperties.segments)){this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&(i.ganttProperties.segments=t.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(!(0,e.isNullOrUndefined)(k)){var C=[];if("segments"===k&&v&&v.length>0&&!(0,e.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&&(0,e.isNullOrUndefined)(v))&&r.setRecordValue(k,v,i.ganttProperties,!0)}if((u===n.baselineStartDate||u===n.baselineEndDate)&&i.ganttProperties.baselineStartDate&&i.ganttProperties.baselineEndDate){g=i.ganttProperties;r.setRecordValue("baselineStartDate",r.dataOperation.checkBaselineStartDate(g.baselineStartDate,g),g,!0);var x=this.parent.getCurrentDayEndTime(g.baselineEndDate);g.baselineEndDate&&0===g.baselineEndDate.getHours()&&86400!==x&&r.dataOperation.setTime(x,g.baselineEndDate),(g.baselineStartDate&&g.baselineEndDate&&g.baselineStartDate.getTime()>g.baselineEndDate.getTime()||!(0,e.isNullOrUndefined)(g.baselineStartDate)&&!(0,e.isNullOrUndefined)(g.startDate)&&g.baselineStartDate.getTime()===g.startDate.getTime()&&!(0,e.isNullOrUndefined)(g.baselineEndDate)&&!(0,e.isNullOrUndefined)(g.endDate)&&g.baselineEndDate.toLocaleDateString()===g.endDate.toLocaleDateString()&&g.isMilestone)&&(g.baselineEndDate=g.baselineStartDate),r.setRecordValue("baselineEndDate",r.dataOperation.checkBaselineEndDate(g.baselineEndDate),g,!0),r.setRecordValue("baselineLeft",r.dataOperation.calculateBaselineLeft(g),g,!0),r.setRecordValue("baselineWidth",r.dataOperation.calculateBaselineWidth(g),g,!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."+u,v,i),u===n.segments&&t&&!(0,e.isNullOrUndefined)(t[n.segments])&&t[n.segments].length>0&&(this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&t.ganttProperties&&t.ganttProperties.segments&&(i.ganttProperties.segments=t.ganttProperties.segments),r.dataOperation.setSegmentsInfo(i,!0)),r.setRecordValue(u,v,i)}else if(n.indicators===u){v=t[u];r.setRecordValue("indicators",v,i.ganttProperties,!0),r.setRecordValue("taskData."+u,v,i),r.setRecordValue(u,v,i)}else if(n.work===u)r.setRecordValue("work",t[u],i.ganttProperties,!0),this.parent.dataOperation.updateMappingData(i,"work"),this.parent.dataOperation.updateMappingData(i,"duration"),this.parent.dataOperation.updateMappingData(i,"endDate");else if(u===n.type){v=t[u];r.setRecordValue("taskType",v,i.ganttProperties,!0),r.setRecordValue(u,v,i),r.setRecordValue("taskData."+u,v,i)}else if(u===n.expandState){v=t[u];this.parent.setRecordValue("taskData."+u,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(u)){D=r.columnByField[u],v=t[u];(0,e.isNullOrUndefined)(D.edit)&&("datepickeredit"!==D.editType&&"datetimepickeredit"!==D.editType||(v=r.dataOperation.getDateFromFormat(v))),r.setRecordValue("taskData."+u,v,i),r.setRecordValue(u,v,i)}else n.manual===u&&(r.setRecordValue("isAutoSchedule",!t[u],i.ganttProperties,!0),this.parent.setRecordValue(u,t[u],i),this.updateTaskScheduleModes(i))}d&&this.validateScheduleValues(l,i,t)},a.prototype.updateResourceRelatedFields=function(t,i){var a=t.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:t.ganttProperties.resourceInfo;if((0,e.isNullOrUndefined)(o))(0,e.isNullOrUndefined)(o)&&"FixedDuration"===n&&0===a.duration&&this.parent.dataOperation.updateWorkWithDuration(t);else switch(n){case"FixedUnit":if((0,e.isNullOrUndefined)(r[a.uniqueID])||(0,e.isNullOrUndefined)(r[a.uniqueID].ganttProperties)||null!==r[a.uniqueID].ganttProperties.resourceNames&&""!==r[a.uniqueID].ganttProperties.resourceNames||this.parent.dataOperation.updateWorkWithDuration(t),0===o.length)return;s&&o.length?"resource"===i||"work"===i?this.parent.dataOperation.updateDurationWithWork(t):"duration"!==i&&"endDate"!==i||(this.parent.dataOperation.updateWorkWithDuration(t),0===a.duration&&this.parent.setRecordValue("isMilestone",!0,a,!0)):s||"work"!==i?this.parent.dataOperation.updateWorkWithDuration(t):this.parent.dataOperation.updateUnitWithWork(t);break;case"FixedWork":if(0===o.length)return;s?"duration"===i||"endDate"===i?(this.parent.dataOperation.updateUnitWithWork(t),0===a.duration&&this.parent.setRecordValue("isMilestone",!0,a,!0)):this.parent.dataOperation.updateDurationWithWork(t):"work"===i?this.parent.dataOperation.updateUnitWithWork(t):this.parent.dataOperation.updateWorkWithDuration(t);break;case"FixedDuration":if(0===o.length)return void this.parent.dataOperation.updateWorkWithDuration(t);o.length&&"work"===i&&"work"===i?this.parent.dataOperation.updateUnitWithWork(t):this.parent.dataOperation.updateWorkWithDuration(t)}},a.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)},a.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))},a.prototype.isTaskbarMoved=function(t){var i=!1,a=t.ganttProperties,r=this.parent.previousRecords&&this.parent.previousRecords[t.uniqueID];if(r&&r.ganttProperties){var n=(0,e.getValue)("ganttProperties.startDate",r),s=(0,e.getValue)("ganttProperties.endDate",r),o=(0,e.getValue)("ganttProperties.duration",r),l=(0,e.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")||((0,e.isNullOrUndefined)(n)&&!(0,e.isNullOrUndefined)(a.startDate)||(0,e.isNullOrUndefined)(s)&&!(0,e.isNullOrUndefined)(a.endDate)||(0,e.isNullOrUndefined)(a.startDate)&&!(0,e.isNullOrUndefined)(n)||(0,e.isNullOrUndefined)(a.endDate)&&!(0,e.isNullOrUndefined)(s)||n&&n.getTime()!==a.startDate.getTime()||s&&s.getTime()!==a.endDate.getTime()||!(0,e.isNullOrUndefined)(o)&&o!==a.duration||!(0,e.isNullOrUndefined)(o)&&o===a.duration&&l!==a.durationUnit)&&(i=!0)}return i},a.prototype.removeImmediateParentDependency=function(t,i){if(!Array.isArray(t))return[];for(var a=[],r=0;r<t.length;r++){var n=t[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=!(0,e.isNullOrUndefined)(u)&&!(0,e.isNullOrUndefined)(d)&&u.toString()===d.toString(),f=!(0,e.isNullOrUndefined)(c)&&!(0,e.isNullOrUndefined)(l)&&c.toString()===l.toString();g||f||a.push(n)}else a.push(n)}return a},a.prototype.isPredecessorUpdated=function(t){var i=!1,a=this.parent.previousRecords[t.uniqueID];if(a&&a.ganttProperties&&a.ganttProperties.hasOwnProperty("predecessor"))if(t.ganttProperties.predecessorsName===a.ganttProperties.predecessorsName||""===t.ganttProperties.predecessorsName&&(0,e.isNullOrUndefined)(a.ganttProperties.predecessorsName)){var r=this.removeImmediateParentDependency(a.ganttProperties.predecessor,this.parent);this.parent.setRecordValue("predecessor",r,t.ganttProperties,!0)}else i=!0;return i},a.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},a.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])})},a.prototype.shouldShowDialog=function(e,t){return!!t&&("MustStartOn"===e?!t.respectMustStartOn:"MustFinishOn"===e?!t.respectMustFinishOn:"StartNoLaterThan"===e?!t.respectStartNoLaterThan:"FinishNoLaterThan"===e&&!t.respectFinishNoLaterThan)},a.prototype.initiateUpdateAction=function(t){var i,a,r=this.isCheckPredecessor(t.data);if((0,e.isNullOrUndefined)(t.data.parentItem)||r){if(t.data.childRecords.length>0&&!r&&!(r=this.isCheckPredecessor(t.data))&&this.isTaskbarMoved(t.data))for(var n=0;n<t.data.childRecords.length;n++)this.parent.predecessorModule.getValidPredecessor(t.data.childRecords[n]).length>0&&(a=n,r=!0)}else i=this.parent.getRecordByID(t.data.parentItem.taskId),r=!!(this.isTaskbarMoved(t.data)&&this.parent.predecessorModule.getValidPredecessor(i).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(t.data)),this.predecessorUpdated=this.isPredecessorUpdated(t.data),this.predecessorUpdated&&(this.parent.isConnectorLineUpdate=!0,this.parent.connectorLineEditModule.addRemovePredecessor(t.data));var s={};if(!r||!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)this.taskbarMoved&&(this.parent.isConnectorLineUpdate=!0),this.updateEditedTask(t);else{s=(0,e.isNullOrUndefined)(i)?(0,e.isNullOrUndefined)(a)?this.parent.connectorLineEditModule.validateTypes(t.data):this.parent.connectorLineEditModule.validateTypes(t.data.childRecords[a],t.data):this.parent.connectorLineEditModule.validateTypes(i,t.data),this.parent.isConnectorLineUpdate=!0;var o=this.parent.predecessorModule.filterPredecessorsByTarget(t.data.ganttProperties.predecessor,t.data,this.parent.viewType),l=t&&t.data&&t.data.ganttProperties?t.data.ganttProperties.constraintType:null,d=!(0,e.isNullOrUndefined)((0,e.getValue)("violationType",s))||l===D.MustStartOn||l===D.MustFinishOn;if(d&&(0,e.isNullOrUndefined)((0,e.getValue)("violationType",s))){var h=t.data.ganttProperties.predecessor,p=null,u=t.data.ganttProperties.taskId;for(n=0;n<h.length;n++){var c=h[n];if(c.to.toString()===u.toString()){p=c;break}}if(p){var g=this.parent.connectorLineModule.getRecordByID(p.from);s.parentTask=g}}if(!d||0===o.length&&t.data.ganttProperties.predecessor)this.updateEditedTask(t);else{var f=void 0;this.parent.taskFields.constraintDate&&this.parent.taskFields.constraintType?(this.taskViolation=this.parent.constraintViolationType,this.parent.constraintViolationType="PredecessorLink",f=this.validateConstraintViolation(t)):f=this.validateTaskEvent(t);var m=this.shouldShowDialog(this.taskViolation,f.validateMode),y=null;if(this.parent&&this.parent.editModule&&this.parent.editModule.taskbarEditModule&&"function"==typeof this.parent.editModule.taskbarEditModule.isValidDependency&&(y=this.parent.editModule.taskbarEditModule.isValidDependency(t.data)),y){var v=y.isValid;m||((!1===this.parent.updateOffsetOnTaskbarEdit&&!1===v&&!1===f.validateMode.respectLink||(f.data.ganttProperties.constraintType===D.MustStartOn||f.data.ganttProperties.constraintType===D.MustFinishOn)&&!1===f.validateMode.respectLink)&&(f.validateMode.respectLink=!0),!1===this.parent.updateOffsetOnTaskbarEdit&&!1===v&&!1===f.validateMode.respectLink&&(f.validateMode.respectLink=!0),f.data.ganttProperties.constraintType!==D.MustStartOn&&f.data.ganttProperties.constraintType!==D.MustFinishOn||(f.validateMode.respectLink=!0))}!1===f.validateMode.preserveLinkWithEditing&&!1===f.validateMode.removeLink&&!1===f.validateMode.respectLink||m?(this.violationArgs={matchedModifiedTask:t.data,args:t},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(t.data,[],"")),this.parent.connectorLineEditModule.applyPredecessorOption())}}},a.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},a.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},a.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},a.prototype.validateChildPredecessors=function(){for(var e=this,t=function(t){var a=i.parent.predecessorModule.validatedChildItems[t];a.ganttProperties.predecessor&&a.ganttProperties.predecessor.length>0&&(i.parent.editedPredecessorRecords.some(function(t){return t[e.parent.taskFields.id]===a[e.parent.taskFields.id]})||i.parent.editedPredecessorRecords.push(a),i.isValidatedEditedRecord||(i.isFirstCall=!0),i.parent.predecessorModule.validatePredecessor(a,[],""))},i=this,a=0;a<this.parent.predecessorModule.validatedChildItems.length;a++)t(a)},a.prototype.updateEditedTask=function(t){var i=t.data;if(this.editedRecord=i,!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||this.updateParentChildRecord(i),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(),i.ganttProperties.predecessor&&(this.parent.isMileStoneEdited=i.ganttProperties.isMilestone,this.taskbarMoved&&this.parent.editedPredecessorRecords.push(i),this.isValidatedEditedRecord||(this.isFirstCall=!0,"DialogEditing"===t.action&&(this.isDialogEditing=!0),this.parent.predecessorModule.validatePredecessor(i,[],""),this.parent.predecessorModule.isChildRecordValidated=[]),this.isValidatedEditedRecord=!1),this.parent.predecessorModule.isValidatedParentTaskID="",this.parent.allowParentDependency&&this.parent.predecessorModule.isValidatedParentTaskID!==i.ganttProperties.taskId&&i.hasChildRecords&&this.parent.previousRecords[i.uniqueID].ganttProperties.startDate&&"TaskbarEditing"!==t.action&&(!i.hasChildRecords||i.hasChildRecords&&i.ganttProperties.isAutoSchedule)&&(this.parent.predecessorModule.updateChildItems(i),this.validateChildPredecessors()),this.parent.predecessorModule.isValidatedParentTaskID="",this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed)for(var a=0;a<i.childRecords.length;a++)i.childRecords[a].ganttProperties.predecessor&&this.parent.predecessorModule.validatePredecessor(i.childRecords[a],[],"");this.updateParentItemOnEditing(),this.parent.dataOperation.updateParentItems(i,!0)}if(i.parentItem){!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||this.parent.dataOperation.updateParentItems(i,!0);var r=this.parent.getRecordByID(i.parentItem.taskId);(0,e.isNullOrUndefined)(r)||r.ganttProperties.predecessorsName||(this.isFirstCall=!0,this.parent.predecessorModule.validatePredecessor(r,[],""),this.updateParentItemOnEditing())}if(this.parent.updateOffsetOnTaskbarEdit&&this.parent.connectorLineEditModule&&t.data&&(this.parent.connectorLineEditModule.validatedOffsetIds=[],this.parent.connectorLineEditModule.calculateOffset(t.data)),this.parent.predecessorModule.validatedParentIds=[],(0,e.isNullOrUndefined)(this.dialogModule)||this.dialogModule&&!this.dialogModule.isFromDialogPredecessor){var n=t.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=[D.MustStartOn,D.MustFinishOn,D.StartNoLaterThan,D.FinishNoLaterThan];if(h&&p&&n&&s){var c=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"};for(a=0;a<n.length;a++){if("break"===c(a))break}}else if(s){for(a=0;a<s.length;a++){var g=s[a];if(-1!==u.indexOf(g.ganttProperties.constraintType)){o=g;break}}if(o&&o.ganttProperties&&o.ganttProperties.predecessor){n=o.ganttProperties.predecessor;var f=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"};for(a=0;a<n.length;a++){if("break"===f(a))break}}}var m=t.data.ganttProperties.taskId,y=this.parent.validationDialogElement?this.parent.validationDialogElement.element:null,v=!1;if(y&&(v=!y.ej2_instances[0].dialogOpen),v&&o&&o.ganttProperties.taskId!==m){this.violationArgs={matchedModifiedTask:o,matchedModifiedTaskIndex:l,args:t,matchedParedRecord:d};var k=o,b=d||t.data;if((0,e.isNullOrUndefined)(this.parent.constraintViolationType)){var w=o.ganttProperties.constraintType;w===D.MustStartOn?this.parent.constraintViolationType="MustStartOn":w===D.MustFinishOn?this.parent.constraintViolationType="MustFinishOn":w===D.StartNoLaterThan?this.parent.constraintViolationType="StartNoLaterThan":w===D.FinishNoLaterThan&&(this.parent.constraintViolationType="FinishNoLaterThan")}var T=this.parent.editModule.validateConstraintViolation(t);if(T.violationType){var S=T.validateMode;this.shouldShowDialog(T.violationType,S)?this.parent.connectorLineEditModule.openConstraintValidationDialog({violationType:T.violationType,parentRecord:b,record:k,predecessorLink:n}):(T.validateMode.respectLink=!0,this.parent.connectorLineEditModule.applyPredecessorOption())}else this.initiateSaveAction(t)}else this.initiateSaveAction(t)}},a.prototype.updateParentItemOnEditing=function(){for(var t=this,i=(0,e.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(e){e.ganttProperties.predecessor&&e.ganttProperties.predecessor.length>0&&t.parent.predecessorModule.validatePredecessor(e,[],"")});for(a=0;a<i.length;a++)this.parent.dataOperation.updateParentItems(i[a]);(0,e.setValue)("parentRecord",[],this.parent.predecessorModule),(0,e.setValue)("parentIds",[],this.parent.predecessorModule)},a.prototype.updateParentChildRecord=function(t){var i=t;!i.hasChildRecords||!this.taskbarMoved||!1!==i[this.parent.taskFields.manual]&&"Auto"!==this.parent.taskMode||(0,e.isNullOrUndefined)(this.parent.editModule.cellEditModule)||this.parent.editModule.cellEditModule.isResourceCellEdited||this.parent.predecessorModule.updateChildItems(i),(0,e.isNullOrUndefined)(this.parent.editModule.cellEditModule)||(this.parent.editModule.cellEditModule.isResourceCellEdited=!1)},a.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)}},a.prototype.updateParentProgress=function(t){var i=0,a=this.parent.getParentTask(t),n=a.childRecords,s=n?n.length:0,o=0,l=0,d=0,h={};if(n){for(var p=0;p<s;p++)n[p].ganttProperties.isMilestone&&!n[p].hasChildRecords||!r(n[p].ganttProperties)?l+=1:(h=this.parent.dataOperation.getParentProgress(n[p]),o+=(0,e.getValue)("totalProgress",h),d+=(0,e.getValue)("totalDuration",h));i=s-l>0?Math.round(o/d):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",o,a.ganttProperties,!0),this.parent.setRecordValue("totalDuration",d,a.ganttProperties,!0)}this.parent.dataOperation.updateTaskData(a),a.parentItem&&this.updateParentProgress(a.parentItem)},a.prototype.revertCellEdit=function(e){this.parent.editModule.reUpdatePreviousRecords(!1,!0),this.resetEditProperties()},a.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}}}},a.prototype.copyTaskData=function(t,i){(0,e.isNullOrUndefined)(i)||(0,e.extend)(t,i)},a.prototype.updateScheduleDatesOnEditing=function(e){},a.prototype.initiateSaveAction=function(t){var a=this,r={requestType:"beforeSave"};r.data=t.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,(0,e.isNullOrUndefined)(t.target)||(r.target=t.target),r.modifiedTaskData=h(this.parent.editedRecords,!0),"DrawConnectorLine"!==t.action&&"DeleteConnectorLine"!==t.action||(r.action=t.action,"DeleteConnectorLine"===t.action&&(this.parent.connectorLineEditModule.isPublicDependencyDelete=!1,this.parent.contextMenuModule&&(this.parent.contextMenuModule.isCntxtMenuDependencyDelete=!1)));var n=this.parent,s=Ni({},r.data.ganttProperties.baselineStartDate),o=Ni({},r.data.ganttProperties.baselineEndDate),l=r.data.ganttProperties.progress,p=JSON.parse(JSON.stringify(r.data.ganttProperties));this.parent.trigger("actionBegin",r,function(u){a.parent.treeGridModule.setCancelArgs=u.cancel,s===u.data.ganttProperties.baselineStartDate&&o===u.data.ganttProperties.baselineEndDate||(n.setRecordValue("baselineLeft",n.dataOperation.calculateBaselineLeft(u.data.ganttProperties),u.data.ganttProperties,!0),n.setRecordValue("baselineWidth",n.dataOperation.calculateBaselineWidth(u.data.ganttProperties),u.data.ganttProperties,!0)),a.parent.autoCalculateDateScheduling&&p!==u.data.ganttProperties&&!(0,e.isNullOrUndefined)(u.data.parentItem)&&(a.updateParentItemOnEditing(),a.parent.dataOperation.updateParentItems(u.data,!0));var c=u.data.ganttProperties,g=c.startDate,f=c.endDate,m=(c.segments,c.durationUnit),y=c.isAutoSchedule,D=c.isMilestone,v=a.parent.treeGridModule.perviousStartDate,k=a.parent.treeGridModule.perviousEndDate;if(((0,e.isNullOrUndefined)(c.segments)||0===c.segments.length)&&(!(0,e.isNullOrUndefined)(v)&&v.getTime()!==(!(0,e.isNullOrUndefined)(g)&&g.getTime())||!(0,e.isNullOrUndefined)(k)&&k.getTime()!==(!(0,e.isNullOrUndefined)(f)&&f.getTime()))){var b=a.parent.dateValidationModule.getDuration(g,f,m,y,D,!0);0!==b&&(c.isMilestone=!1,c.duration=b)}if(a.parent.dataOperation.updateWidthLeft(u.data),!(0,e.isNullOrUndefined)(a.parent.taskFields.progress)&&l!==u.data.ganttProperties.progress){var w=u.data.ganttProperties.isAutoSchedule?u.data.ganttProperties.width:u.data.ganttProperties.autoWidth;a.parent.setRecordValue("progressWidth",a.parent.dataOperation.getProgressWidth(w,u.data.ganttProperties.progress),u.data.ganttProperties,!0)}if(a.parent.chartRowsModule.updateSegment(u.data.ganttProperties.segments,u.data.ganttProperties.taskId),u.cancel)a.reUpdatePreviousRecords(),a.parent.chartRowsModule.refreshRecords([t.data]),a.resetEditProperties(r);else{if(a.parent.showLoadingIndicator(),u.modifiedRecords)for(var T=0;T<u.modifiedRecords.length;T++)a.parent.enableWBS&&a.parent.updateWBSPredecessor(u.modifiedRecords[T]),a.parent.dataOperation.updateTaskData(u.modifiedRecords[T]);if(u.modifiedTaskData=h(u.modifiedRecords,null,null,a.parent),d(a.parent.dataSource)){var S=a.parent.dataSource,P={changedRecords:u.modifiedTaskData},C=a.parent.query instanceof i.Query?a.parent.query:new i.Query,R=null,M=S.adaptor;if(M instanceof i.WebApiAdaptor&&M instanceof i.ODataAdaptor&&!S.dataSource.batchUrl){R=S.update(a.parent.taskFields.id,P.changedRecords,null,C)}else R=S.saveChanges(P,a.parent.taskFields.id,null,C);R.then(function(e){return a.dmSuccess(e,t)}).catch(function(e){return a.dmFailure(e,t)})}else a.saveSuccess(t);a.parent.enableVirtualization&&a.parent.enableTimelineVirtualization&&a.parent.ganttChartModule.setVirtualHeight(),a.parent.undoRedoModule&&(a.parent.previousFlatData=(0,e.extend)([],a.parent.flatData,[],!0))}}),this.parent.ganttChartModule.reRenderConnectorLines()},a.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)])}},a.prototype.dmSuccess=function(e,t){this.updateEditedFields(e),this.saveSuccess(t)},a.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])},a.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})},a.prototype.updateSharedTask=function(t){for(var i=t.ganttProperties.sharedTaskUniqueIds,a=0;a<i.length;a++){var r=this.parent.flatData[this.parent.ids.indexOf(i[a].toString())];r&&r.uniqueID!==t.uniqueID&&(this.updateGanttProperties(t,r),this.parent.setRecordValue("taskData",t.taskData,r,!0),this.parent.dataOperation.updateTaskData(r),this.parent.dataOperation.updateResourceName(r),(0,e.isNullOrUndefined)(r.parentItem)||this.parent.dataOperation.updateParentItems(r.parentItem))}},a.prototype.saveSuccess=function(t){var i={};if(this.parent.timelineSettings.updateTimescaleView){var a=this.parent.editedRecords;this.parent.timelineModule.updateTimeLineOnEditing([a],t.action)}if("ResourceView"===this.parent.viewType){"TaskbarEditing"===t.action||"DrawConnectorLine"===t.action||"DeleteConnectorLine"===t.action?this.updateSharedTask(t.data):"DialogEditing"!==t.action&&"CellEditing"!==t.action&&"methodUpdate"!==t.action||(this.parent.editModule.dialogModule.isResourceUpdate?(this.updateResoures(this.parent.editModule.dialogModule.previousResource,t.data.ganttProperties.resourceInfo,t.data),this.updateSharedTask(t.data),this.isTreeGridRefresh=!0):this.updateSharedTask(t.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()||((0,e.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)&&!(0,e.isNullOrUndefined)(this.parent.connectorLineEditModule)&&(this.parent.updatedConnectorLineCollection=[],this.parent.connectorLineIds=[],this.parent.connectorLineEditModule.refreshEditedRecordConnectorLine(this.parent.editedRecords),this.updateScheduleDatesOnEditing(t))),!this.parent.editSettings.allowTaskbarEditing||this.parent.editSettings.allowTaskbarEditing&&!this.taskbarEditModule.dependencyCancel?(i.requestType="save",i.data=t.data,i.modifiedRecords=this.parent.editedRecords,i.modifiedTaskData=h(this.parent.editedRecords,null,null,this.parent),!this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&"middleSegment"!==this.parent.rowDragAndDropModule.dropPosition&&this.updateRowIndex(),(0,e.isNullOrUndefined)(t.action)||(0,e.setValue)("action",t.action,i),"TaskbarEditing"===t.action&&(i.taskBarEditAction=t.taskBarEditAction),this.endEditAction(t),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=[]},a.prototype.updateResoures=function(t,i,a){var r=this.parent.flatData,n=i?i.length:0,s=t?t.length:0;if(0!==n||0!==s){for(var o=0;o<n;o++){var l=[];if("NaN"===(f=parseInt(i[o][this.parent.resourceFields.id],10).toString())&&(f=i[o][this.parent.resourceFields.id]),!(0,e.isNullOrUndefined)(t))for(var d=0;d<t.length;d++){var h=parseInt(t[d][this.parent.resourceFields.id],10).toString();if("NaN"===h&&(h=t[d][this.parent.resourceFields.id]),h===f){l.push(d);break}}if(0===l.length){var p=r[this.parent.getTaskIds().indexOf("R"+f)];p&&this.addNewRecord(a,p)}else{var u=parseInt(l[0].toString(),10);"NaN"===u.toString()&&(u=l[0].toString()),t.splice(u,1)}}var c=t?t.length:0;for(o=0;o<c;o++){var g=a.ganttProperties.taskId,f=t[o][this.parent.resourceFields.id],m=r[this.parent.getTaskIds().indexOf("R"+f)];if(!(0,e.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}},a.prototype.checkWithUnassignedTask=function(t){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((0,e.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;t.index=l,t.level=o.level+1,this.addNewRecord(t,o),this.parent.dataSource.push(t.taskData)}else this.addNewRecord(t,i),this.isFlatDataHaveUnAsignedTask=!0;var d=this.parent.currentViewData.filter(function(e){return e.ganttProperties.taskId===t.ganttProperties.taskId&&e.hasChildRecords===t.hasChildRecords})[0];t.parentItem=d.parentItem,t.parentUniqueID=d.parentUniqueID},a.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")},a.prototype.addNewRecord=function(t,i){var a=null;a=(0,e.extend)({},{},t,!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),t.ganttProperties.sharedTaskUniqueIds.push(r),a.ganttProperties.sharedTaskUniqueIds=t.ganttProperties.sharedTaskUniqueIds,this.addRecordAsChild(i,a)},a.prototype.removeChildRecord=function(e){var t=this.parent,a=[];a=this.parent.dataSource instanceof i.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),a.splice(u,1),this.parent.flatData.splice(p,1),this.parent.ids.splice(p,1),this.parent.getTaskIds().splice(p,1))}var f=a.indexOf(n);if(!t.taskFields.parentID){var m=this.parent.editModule.getChildCount(n,0);a.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))}},a.prototype.addRecordAsChild=function(t,i){var a,r,n=this.parent,s=this.parent.flatData.indexOf(t),o=this.parent.editModule.getChildCount(t,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(var p=0;p<t.childRecords.length;p++)if("T"+t.childRecords[p].ganttProperties.taskId===this.dialogModule.indexes.deletedIndexes[d].id){r="above"===this.dialogModule.indexes.deletedIndexes[d].position?p:p+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 u=this.parent.getTaskByUniqueID(i.parentItem.uniqueID);a=u.index+u.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(p=0;p<this.parent.undoRedoModule.currentAction.deletedRecordsDetails.length;p++)if(this.parent.undoRedoModule.currentAction.deletedRecordsDetails[p].data.ganttProperties.taskId===i.ganttProperties.taskId){l.index?r=(a=this.parent.undoRedoModule.currentAction.deletedRecordsDetails[p].data.index)-l.index-1:(a=(0,e.isNullOrUndefined)(o)||0===o?s+1:o+s+1,r=0);break}}else if(!(0,e.isNullOrUndefined)(this.addRowIndex)&&this.addRowPosition&&t.childRecords&&"Child"!==this.addRowPosition){var c=t.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=(0,e.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),t.hasChildRecords||(this.parent.setRecordValue("hasChildRecords",!0,t),this.parent.setRecordValue("expanded",!0,t),t.childRecords.length||(t.childRecords=[],!n.taskFields.parentID&&(0,e.isNullOrUndefined)(t.taskData[this.parent.taskFields.child])&&(t.taskData[this.parent.taskFields.child]=[]))),r>=0?t.childRecords.splice(r,0,i):t.childRecords.splice(t.childRecords.length,0,i),(0,e.isNullOrUndefined)(i)||this.parent.taskFields.parentID||(0,e.isNullOrUndefined)(t.taskData[this.parent.taskFields.child])||t.taskData[this.parent.taskFields.child].splice(t.childRecords.length,0,i.taskData),(0,e.isNullOrUndefined)(i.parentItem)||this.updateParentRecords.push(t)},a.prototype.resetEditProperties=function(t){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,(0,e.isNullOrUndefined)(this.dialogModule)||!(0,e.isNullOrUndefined)(t)&&((0,e.isNullOrUndefined)(t)||"beforeSave"!==t.requestType||t.cancel)||(this.dialogModule.dialog&&!this.dialogModule.dialogObj.isDestroyed&&this.dialogModule.dialogObj.hide(),this.dialogModule.dialogClose()),this.parent.hideSpinner(),this.parent.initiateEditAction(!1)},a.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())},a.prototype.saveFailed=function(e){this.reUpdatePreviousRecords(),this.parent.hideSpinner()},a.prototype.renderDeleteConfirmDialog=function(){var e=new t.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},a.prototype.closeConfirmDialog=function(){this.confirmDialog.hide()},a.prototype.confirmDeleteOkButton=function(){this.deleteSelectedItems(),this.confirmDialog.hide(),this.parent.element.querySelector(".e-treegrid").focus()},a.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()))},a.prototype.deleteResourceRecords=function(t){for(var i=this,a=[],r=function(r){if(t[r].parentItem)if(1===t[r].ganttProperties.sharedTaskUniqueIds.length){for(var s=t[r],o=s.ganttProperties.sharedTaskUniqueIds,l=0;l<o.length;l++)-1!==n.parent.ids.indexOf(o[l].toString())?a.push(n.parent.flatData[n.parent.ids.indexOf(o[l].toString())]):n.parent.undoRedoModule&&n.parent.undoRedoModule.isUndoRedoPerformed&&n.parent.undoRedoModule.currentAction&&"Delete"===n.parent.undoRedoModule.currentAction.action&&a.push(n.parent.flatData[n.parent.taskIds.indexOf("T"+t[r].ganttProperties.taskId)]);-1!==n.parent.ids.indexOf(s.ganttProperties.rowUniqueID)&&-1===a.indexOf(n.parent.flatData[n.parent.ids.indexOf(s.ganttProperties.rowUniqueID)])&&a.push(n.parent.flatData[n.parent.ids.indexOf(s.ganttProperties.rowUniqueID)])}else t[r].ganttProperties.sharedTaskUniqueIds.length>1&&t.forEach(function(e){e.ganttProperties.sharedTaskUniqueIds.forEach(function(e){a.push(i.parent.getTaskByUniqueID(i.parent.element.id+"_data_"+e))})});else{var d=n.parent.flatData.filter(function(e){return e.ganttProperties.taskId===t[r].ganttProperties.taskId&&e.hasChildRecords})[0];(0,e.isNullOrUndefined)(d)||a.push(d)}},n=this,s=0;s<t.length;s++)r(s);this.deleteRow(a)},a.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)},a.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)}},a.prototype.deleteRecord=function(t){this.isFromDeleteMethod=!0;var i=typeof t;switch(this.targetedRecords=[],i){case"number":case"string":var a=t.toString();"ResourceView"===this.parent.viewType?(0,e.isNullOrUndefined)(a)||-1===this.parent.getTaskIds().indexOf("T"+a)||this.targetedRecords.push(this.parent.flatData[this.parent.getTaskIds().indexOf("T"+a)]):(0,e.isNullOrUndefined)(a)||-1===this.parent.ids.indexOf(a)||this.targetedRecords.push(this.parent.getRecordByID(a));break;case"object":Array.isArray(t)?this.updateTargetedRecords(t):this.targetedRecords.push(t.valueOf())}this.startDeleteAction()},a.prototype.updateTargetedRecords=function(t){if(t.length)if("object"===typeof t[0])this.targetedRecords=t;else for(var i=0;i<t.length;i++){var a=t[i].toString();"ResourceView"===this.parent.viewType?(0,e.isNullOrUndefined)(a)||-1===this.parent.getTaskIds().indexOf("T"+a)||this.targetedRecords.push(this.parent.flatData[this.parent.getTaskIds().indexOf("T"+a)]):(0,e.isNullOrUndefined)(a)||-1===this.parent.ids.indexOf(a)||this.targetedRecords.push(this.parent.getRecordByID(a))}},a.prototype.deleteRow=function(t){var i=this,a=t&&t.length?t: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||t.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={action:"Delete",deletedRecordsDetails:[]};this.parent.undoRedoModule.findPosition((0,e.extend)([],[],a,!0),r,"deletedRecordsDetails"),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=r}for(var n=function(t){var i=a[t];if(-1!==s.deletedTaskDetails.indexOf(i))return"continue";var r=[i];if("ResourceView"===s.parent.viewType&&s.parent.undoRedoModule&&s.parent.undoRedoModule.isUndoRedoPerformed&&a[t].ganttProperties.resourceInfo&&a[t].ganttProperties.resourceInfo.length>1&&(r=[],!a[t].hasChildRecords)){var n="T"+a[t].ganttProperties.taskId;s.parent.taskIds.reduce(function(e,t){e===n&&r.push(this.parent.flatData[t])}.bind(s),[])}for(var o=0;o<r.length;o++){var l=s.parent.getParentTask(r[o].parentItem);if(r[o].parentItem){var d=void 0;if(!(0,e.isNullOrUndefined)(l))(1===(d=l.childRecords).length?d:d.filter(function(e){return!e.isDelete})).length>0&&s.parent.dataOperation.updateParentItems(r[o].parentItem)}var h=r[o].ganttProperties.predecessor,p=!0;"ResourceView"===s.parent.viewType&&l&&l.ganttProperties.taskName!==s.parent.localeObj.getConstant("unassignedTask")&&(p=!1),h&&h.length&&p&&s.removePredecessorOnDelete(r[o]),s.deletedTaskDetails.push(r[o]),r[o].hasChildRecords&&s.deleteChildRecords(r[o])}},s=this,o=0;o<a.length;o++)n(o);this.parent.selectionModule&&this.parent.allowSelection&&this.parent.selectionModule.clearSelection();var l={};l.deletedRecordCollection=this.deletedTaskDetails,l.updatedRecordCollection=this.parent.editedRecords,l.cancel=!1,l.action="delete",this.initiateDeleteAction(l),this.parent.isOnDelete=!1}(0,e.isNullOrUndefined)(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},a.prototype.removePredecessorOnDelete=function(t){for(var i=this,a=t.ganttProperties.predecessor,r=function(r){var s=a[r],o="ResourceView"===n.parent.viewType?t.ganttProperties.taskId:t.ganttProperties.rowUniqueID,l=n.parent.rowDragAndDropModule&&"middleSegment"===n.parent.rowDragAndDropModule.dropPosition||n.dropPosition&&"middleSegment"===n.dropPosition,d=t.hasChildRecords&&t.childRecords.some(function(e){return s.to.toString()===e[i.parent.taskFields.id].toString()}),h=t.hasChildRecords&&t.childRecords.some(function(e){return s.from.toString()===e[i.parent.taskFields.id].toString()});if(s.from.toString()===o.toString()&&(d&&l||n.parent.isOnDelete)){var p=n.parent.connectorLineModule.getRecordByID(s.to.toString());if(!(0,e.isNullOrUndefined)(p)){for(var u=(0,e.extend)([],[],p.ganttProperties.predecessor,!0),c=void 0,g=0;g<u.length;g++){var f="ResourceView"===n.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),n.updatePredecessorValues(p,u)}}else if(s.to.toString()===o.toString()&&(h&&l||n.parent.isOnDelete)){var m=n.parent.connectorLineModule.getRecordByID(s.from.toString());if(!(0,e.isNullOrUndefined)(m)){var y=(0,e.extend)([],[],m.ganttProperties.predecessor,!0);for(c=void 0,g=0;g<y.length;g++){var D="ResourceView"===n.parent.viewType?m.ganttProperties.taskId:m.ganttProperties.rowUniqueID;if(y[g].from.toString()===D.toString()&&y[g].to.toString()===o.toString()){c=g;break}}(t.uniqueID===m.parentUniqueID||t.parentUniqueID===m.uniqueID||n.parent.isOnDelete)&&(y.splice(c,1),n.updatePredecessorValues(m,y))}}},n=this,s=0;s<a.length;s++)r(s)},a.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)},a.prototype.updateTaskId=function(t,i){if(!this.parent.readOnly){var a="number"==typeof t?t.toString():t,r="number"==typeof i?i.toString():i,n=this.parent.ids;if(!(0,e.isNullOrUndefined)(a)&&!(0,e.isNullOrUndefined)(r)){var s=n.indexOf(a),o=n.indexOf(r);if(-1===s||o>-1)return;var l=this.parent.flatData[s];if((0,e.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&&!(0,e.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()}}},a.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)},a.prototype.deleteChildRecords=function(t){for(var i=this,a=t.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),!(0,e.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)}}},a.prototype.removeFromDataSource=function(e){var t;t=this.parent.dataSource instanceof i.DataManager?this.parent.dataSource.dataSource.json:this.parent.dataSource,this.removeData(t,e),this.isBreakLoop=!1},a.prototype.removeData=function(t,i){for(var a=0;a<t.length&&!this.isBreakLoop;a++)if(-1!==i.indexOf((0,e.getValue)(this.parent.taskFields.id,t[a]).toString())){if(t[a][this.parent.taskFields.child]){var r=t[a][this.parent.taskFields.child];this.removeData(r,i)}if(i.splice(i.indexOf((0,e.getValue)(this.parent.taskFields.id,t[a]).toString()),1),t.splice(a,1),0===i.length){this.isBreakLoop=!0;break}}else if(t[a][this.parent.taskFields.child]){r=t[a][this.parent.taskFields.child];this.removeData(r,i)}},a.prototype.initiateDeleteAction=function(e){var t=this;this.parent.showSpinner();var a={requestType:"beforeDelete"};a.data=e.deletedRecordCollection,a.modifiedRecords=e.updatedRecordCollection,a.modifiedTaskData=h(e.updatedRecordCollection,null,null,this.parent),this.parent.trigger("actionBegin",a,function(a){if(a.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(),d(t.parent.dataSource)){var s=t.parent.dataSource;t.parent.timezone&&a.modifiedRecords.forEach(function(e){p(e,t.parent)});var o={deletedRecords:h(a.data,null,null,t.parent),changedRecords:a.modifiedTaskData},l=s.adaptor,u=t.parent.query instanceof i.Query?t.parent.query:new i.Query;if(l instanceof i.WebApiAdaptor&&l instanceof i.ODataAdaptor&&!s.dataSource.batchUrl){for(var c="deletedRecords",g=null,f=0;f<o[c].length;f++)g=s.remove(t.parent.taskFields.id,o[c][f],null,u);g.then(function(){for(var i="changedRecords",a=function(e){o.deletedRecords.some(function(a){return a[t.parent.taskFields.id]===o[i][e].taskId})&&o[i].splice(e,1)},r=o[i].length-1;r>=0;r--)a(r);s.update(t.parent.taskFields.id,o[i],null,u).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,u).then(function(){return t.deleteSuccess(e)}).catch(function(i){return t.dmFailure(i,e)})}}else t.deleteSuccess(e)})},a.prototype.deleteSuccess=function(t){for(var i=this,a=this.parent.flatData,r=this.parent.currentViewData,n=[],s=0;s<t.deletedRecordCollection.length;s++)if("ProjectView"===this.parent.viewType){var o=this.parent.getRecordByID(t.deletedRecordCollection[s].ganttProperties.taskId);(0,e.isNullOrUndefined)(o)||n.push(o)}else{var l=t.deletedRecordCollection[s].hasChildRecords,d=t.deletedRecordCollection[s].ganttProperties.taskName===this.parent.localeObj.getConstant("unassignedTask"),p=!t.deletedRecordCollection[s].expanded;if(l&&d&&p)return this.parent.hideLoadingIndicator(),this.deletedTaskDetails=[],void this.parent.initiateEditAction(!1);t.deletedRecordCollection[s].hasChildRecords?"R"+t.deletedRecordCollection[s].ganttProperties.taskId:"T"+t.deletedRecordCollection[s].ganttProperties.taskId,n.push(this.parent.getTaskByUniqueID(t.deletedRecordCollection[s].uniqueID))}var u=[];if(n.length>0){var c=void 0;o=void 0;if(this.parent.enableVirtualization?(c=this.parent.flatData.indexOf(n[n.length-1]),this.parent.staticSelectedRowIndex=this.parent.selectedRowIndex=c,o=this.parent.flatData[this.parent.selectedRowIndex+1],this.parent.isCollapseAll||(this.parent.staticSelectedRowIndex=c-(n.length-1))):(c=this.parent.currentViewData.indexOf(n[n.length-1]),this.parent.staticSelectedRowIndex=this.parent.selectedRowIndex=c,o=this.parent.currentViewData[this.parent.selectedRowIndex+1]),(0,e.isNullOrUndefined)(o)){var g=this.parent.selectedRowIndex-1;g>=0&&(this.parent.currentSelection=this.parent.enableVirtualization?this.parent.flatData[g]:this.parent.currentViewData[g])}else this.parent.currentSelection=o}this.deletedRecord=n;for(s=0;s<n.length;s++){var f=n[s],m=void 0,y=void 0,D=void 0;"ResourceView"===this.parent.viewType?f.hasChildRecords?(m=this.parent.taskIds.indexOf("R"+f.ganttProperties.taskId.toString()),y=this.parent.taskIds.indexOf("R"+f.ganttProperties.taskId.toString())):(m=this.parent.taskIds.indexOf("T"+f.ganttProperties.taskId.toString()),y=this.parent.taskIds.indexOf("T"+f.ganttProperties.taskId.toString())):(m=r.indexOf(f),y=a.indexOf(f),this.parent.editModule&&this.parent.editModule.updateParentRecords&&this.parent.editModule.updateParentRecords.length>0&&(D=this.parent.editModule.updateParentRecords.indexOf(f)));var v=this.parent.treeGrid.parentData.indexOf(f),k=(0,e.getValue)("dataOperation.dataArray",this.parent),b=k.indexOf(f.taskData),w=void 0;if(-1!==m&&r.splice(m,1),-1!==y&&a.splice(y,1),-1!==b&&k.splice(b,1),"number"==typeof D&&-1!==D&&this.parent.editModule.updateParentRecords.splice(D,1),!(0,e.isNullOrUndefined)(f)){if(u.push(f.ganttProperties.taskId.toString()),-1!==y&&(this.parent.ids.splice(y,1),"ResourceView"===this.parent.viewType&&(this.parent.getTaskIds().splice(y,1),f.hasChildRecords||(f.ganttProperties.resourceInfo=null,delete f.ganttProperties.resourceNames,f[this.parent.taskFields.resourceInfo]=null,f.ganttProperties.sharedTaskUniqueIds=[],delete f.taskData[this.parent.taskFields.resourceInfo]))),0===f.level&&-1!==v&&this.parent.treeGrid.parentData.splice(v,1),f.parentItem){var T=this.parent.getParentTask(f.parentItem);if(T){var S=T.childRecords;-1!==(w=S.indexOf(f))&&S.splice(w,1),S.length||this.parent.setRecordValue("hasChildRecords",!1,T)}}this.updateTreeGridUniqueID(f,"delete")}}u.length>0&&this.removeFromDataSource(u),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=t.deletedRecordCollection,P.modifiedRecords=t.updatedRecordCollection,P.modifiedTaskData=h(t.updatedRecordCollection,null,null,this.parent),(0,e.setValue)("action",t.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))){var C=P.data.filter(function(e){return!e.hasChildRecords}),R=function(e){var t=M.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=M.parent.getParentTask(C[e].parentItem);r&&r.ganttProperties.taskName!==M.parent.localeObj.getConstant("unassignedTask")&&0===a.length?M.checkWithUnassignedTask(C[e]):r||a&&0!==a.length||M.checkWithUnassignedTask(C[e]),t=M.parent.flatData.filter(function(e){return e.ganttProperties.taskName===i.parent.localeObj.getConstant("unassignedTask")})[0];var n=M.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]&&M.parent.dataOperation.updateParentItems(n[0])},M=this;for(s=0;s<C.length;s++)R(s)}this.parent.trigger("actionComplete",P),this.deletedTaskDetails=[],this.parent.initiateEditAction(!1),this.parent.hideLoadingIndicator(),this.parent.treeGrid.closeEdit()},a.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.toString():e},a.prototype.prepareNewlyAddedData=function(t,i){var a,r,n=this.parent.taskFields,s=this.parent.ids;if(t[n.id]&&(-1!==s.indexOf(t[n.id].toString())?t[n.id]=null:(r="string"==typeof t[n.id]?t[n.id]:parseInt(t[n.id],10),t[n.id]=(0,e.isNullOrUndefined)(r)?null:r)),t[n.id]||(a=this.getNewTaskId(),t[n.id]=a),this.parent.allowUnscheduledTasks||t[n.startDate]||(t[n.startDate]=this.parent.projectStartDate),!this.parent.allowUnscheduledTasks&&n.duration&&(0,e.isNullOrUndefined)(t[n.duration])&&(t[n.endDate]||(t[n.duration]="5")),n.progress&&(t[n.progress]=t[n.progress]?t[n.progress]>100?100:t[n.progress]:0),!this.parent.allowUnscheduledTasks&&!t[n.endDate]&&n.endDate&&!t[n.duration]){var o=this.parent.dataOperation.getDateFromFormat(this.parent.projectStartDate);(0,e.isNullOrUndefined)(o)||(o.setDate(o.getDate()+4),t[n.endDate]=this.parent.getFormatedDate(o,this.parent.getDateFormat()))}},a.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)},a.prototype.updateNewlyAddedDataBeforeAjax=function(t,i,a,r,n){var s=this.parent.dataOperation.createRecord(t,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(!(0,e.isNullOrUndefined)(r)){this.parent.setRecordValue("parentItem",this.parent.dataOperation.getCloneParent(r),s);var o=s.parentItem?s.parentItem.index:null;this.parent.setRecordValue("parentIndex",o,s);var l=s.parentItem?s.parentItem.uniqueID:null;this.parent.setRecordValue("parentUniqueID",l,s),(0,e.isNullOrUndefined)(this.parent.taskFields.id)||(0,e.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(t.hasChildRecords){for(var d=[],h=this.parent.undoRedoModule.currentAction.deletedRecordsDetails,p=0;p<t.childRecords.length;p++)this.add(t.childRecords[p],d);for(var u=0;u<h.length;u++)if(t.ganttProperties.taskId===h[u].data.ganttProperties.taskId){"child"===h[u].position?a="Child":"below"===h[u].position?a="Below":"above"===h[u].position&&(a="Above"),this.backUpAndPushNewlyAddedRecord(s,a,r);for(p=0;p<d.length;p++)"ProjectView"===this.parent.viewType?d[p].parentItem.taskId===s.ganttProperties.taskId&&(d[p].parentItem.index=s.index,d[p].parentItem.taskId=s.ganttProperties.taskId,d[p].parentItem.uniqueID=s.ganttProperties.uniqueID,d[p].parentUniqueID=s.ganttProperties.uniqueID):(d[p].parentItem.index=s.index,d[p].parentItem.taskId=s.ganttProperties.rowUniqueID,d[p].parentItem.uniqueID=s.ganttProperties.uniqueID,d[p].parentUniqueID=s.ganttProperties.uniqueID);break}this.addRowSelectedItem=s,s.taskData[this.parent.taskFields.child]=[];for(var c=0;c<d.length;c++){this.parent.isOnEdit=!1;var g=this.parent.dataOperation.createRecord(d[c],d[c].level);if(0===g.childRecords.length&&g.taskData[this.parent.taskFields.child]&&(g.taskData[this.parent.taskFields.child]=[]),r=this.parent.getRecordByID(d[c].parentItem.taskId),!(0,e.isNullOrUndefined)(r)){this.parent.setRecordValue("parentItem",this.parent.dataOperation.getCloneParent(r),g);o=g.parentItem?g.parentItem.index:null;this.parent.setRecordValue("parentIndex",o,g);l=g.parentItem?g.parentItem.uniqueID:null;this.parent.setRecordValue("parentUniqueID",l,g),(0,e.isNullOrUndefined)(this.parent.taskFields.id)||(0,e.isNullOrUndefined)(this.parent.taskFields.parentID)||!g.parentItem||("ProjectView"===this.parent.viewType&&this.parent.setRecordValue(this.parent.taskFields.parentID,g.parentItem.taskId,g.taskData,!0),this.parent.setRecordValue("parentId",g.parentItem.taskId,g.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.parentID,g.parentItem.taskId,g,!0))}this.parent.isOnEdit=!0,g.parentItem&&(a=0===r.childRecords.length?"Child":"Below"),this.parent.getParentTask(g.parentItem).childRecords.length>0&&(this.addRowSelectedItem=this.parent.getParentTask(g.parentItem).childRecords[this.parent.getParentTask(g.parentItem).childRecords.length-1]),this.backUpAndPushNewlyAddedRecord(g,a,r);for(p=0;p<d.length;p++)"ProjectView"===this.parent.viewType?d[p].parentItem.taskId===g.ganttProperties.taskId&&(d[p].parentItem.index=g.index,d[p].parentItem.taskId=g.ganttProperties.taskId,d[p].parentItem.uniqueID=g.ganttProperties.uniqueID,d[p].parentUniqueID=g.ganttProperties.uniqueID):(d[p].parentItem.index=s.index,d[p].parentItem.taskId=s.ganttProperties.rowUniqueID,d[p].parentItem.uniqueID=s.ganttProperties.uniqueID,d[p].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(p=0;p<s.childRecords.length;p++)this.processPredecessors(s.childRecords[p],f)}return s.parentItem&&this.parent.getParentTask(s.parentItem).ganttProperties.isAutoSchedule&&this.parent.dataOperation.updateParentItems(s.parentItem),this.parent.isOnEdit=!1,s},a.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},a.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},a.prototype.updatePredecessorOnIndentOutdent=function(t){for(var i,a,r,n=t.ganttProperties.predecessor.length,s=t.ganttProperties,o=s.predecessor,l=0;l<n;l++){var d=this.parent.getRecordByID(o[l].from),h=this.parent.getRecordByID(o[l].to);if(!(r=this.parent.predecessorModule.validateParentPredecessor(d,h))||!this.parent.allowParentDependency)if(o[l].to===s.rowUniqueID.toString()){i=this.parent.getRecordByID(o[l].from),a=c(o[l],"from",i.ganttProperties.predecessor,"to");var p=(0,e.extend)([],i.ganttProperties.predecessor,[],!0);p.splice(a,1),this.parent.setRecordValue("predecessor",p,i.ganttProperties,!0)}else if(o[l].from===s.rowUniqueID.toString()){var u=(i=this.parent.getRecordByID(o[l].to)).ganttProperties.predecessorsName.toString().split(","),g=o[l].from+o[l].type,f=u.indexOf(g);u.splice(f,1),this.parent.setRecordValue("predecessorsName",u.join(","),i.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.dependency,u.join(","),i),a=c(o[l],"from",i.ganttProperties.predecessor,"to");var m=(0,e.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",[],t.ganttProperties,!0),this.parent.setRecordValue("predecessorsName","",t.ganttProperties,!0))},a.prototype.backUpAndPushNewlyAddedRecord=function(t,i,a){var r,n,s,o,l=this.parent.flatData,d=this.parent.currentViewData,h=this.parent.ids;switch(i){case"Top":l.splice(0,0,t),d.splice(0,0,t),h.splice(0,0,t.ganttProperties.rowUniqueID.toString());break;case"Bottom":if(l.push(t),d.push(t),h.push(t.ganttProperties.rowUniqueID.toString()),"ResourceView"===this.parent.viewType){var p=0===t.level?"R"+t.ganttProperties.taskId:"T"+t.ganttProperties.taskId;this.parent.getTaskIds().push(p)}break;case"Above":n=l.indexOf(this.addRowSelectedItem),s=d.indexOf(this.addRowSelectedItem),this.recordCollectionUpdate(o,n,s,t,a,i);break;case"Below":if(r=l.indexOf(this.addRowSelectedItem),this.addRowSelectedItem.hasChildRecords)n=r+this.getChildCount(this.addRowSelectedItem,0)+1,s=d.indexOf(this.addRowSelectedItem)+this.getVisibleChildRecordCount(this.addRowSelectedItem,0,d)+1;else n=r+1,s=d.indexOf(this.addRowSelectedItem)+1;this.recordCollectionUpdate(NaN,n,s,t,a,i);break;case"Child":if(r=l.indexOf(this.addRowSelectedItem),this.addRowSelectedItem.hasChildRecords)n=r+this.getChildCount(this.addRowSelectedItem,0)+1,this.addRowSelectedItem.expanded||this.parent.enableMultiTaskbar||this.parent.expandByID(this.addRowSelectedItem.ganttProperties.rowUniqueID),s=d.indexOf(this.addRowSelectedItem)+this.getVisibleChildRecordCount(this.addRowSelectedItem,0,d)+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=d.indexOf(this.addRowSelectedItem)+1,this.addRowSelectedItem.ganttProperties.predecessor&&this.updatePredecessorOnIndentOutdent(this.addRowSelectedItem),(0,e.isNullOrUndefined)(this.addRowSelectedItem.ganttProperties.segments)||(this.addRowSelectedItem.ganttProperties.segments=null);this.recordCollectionUpdate(NaN,n,s,t,a,i)}this.newlyAddedRecordBackup=t},a.prototype.recordCollectionUpdate=function(t,a,r,n,s,o){var l=this.parent.flatData,d=this.parent.currentViewData,h=this.parent.ids;if(l.splice(a,0,n),d.splice(r,0,n),h.splice(a,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(a,0,p)}if(!(0,e.isNullOrUndefined)(s)&&(t="Above"===o?s.childRecords.indexOf(this.addRowSelectedItem):"Below"===o?s.childRecords.indexOf(this.addRowSelectedItem)+1:s.childRecords.length,s.childRecords.splice(t,0,n),this.parent.taskFields.child||(this.parent.taskFields.child="Children"),this.parent.dataSource instanceof i.DataManager&&(0,e.isNullOrUndefined)(s.taskData[this.parent.taskFields.parentID])||!(0,e.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(t,0,n.taskData):s.taskData[u].push(n.taskData):(s.taskData[u]=[],s.taskData[u].push(n.taskData)),this.isNewRecordAdded=!0}},a.prototype.constructTaskAddedEventArgs=function(e,t,i){var a={};if(a.action=a.requestType=i,e.length>1){a.data=[],a.newTaskData=[],a.recordIndex=[];for(var r=0;r<e.length;r++)a.data[r]=e[r],a.newTaskData[r]=h([e[r]],a.data[r],a,this.parent),a.recordIndex[r]=e[r].index}else if(1===e.length)for(r=0;r<e.length;r++)a.data=e[r],a.newTaskData=h([e[r]],a.data,a,this.parent),a.recordIndex=e[r].index;return a.modifiedRecords=t,a.modifiedTaskData=h(t,null,null,this.parent),a},a.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()},a.prototype.refreshRecordInImmutableMode=function(t,i){if(!i&&!(0,e.isNullOrUndefined)(t))for(var a=t[0].index+1;a<this.parent.currentViewData.length&&t[0].level<this.parent.currentViewData[a].level;a++)this.parent.modifiedRecords.push(this.parent.currentViewData[a]);var r=function(e){var t=n.parent.modifiedRecords[e],i=n.parent.rowDragAndDropModule&&n.parent.allowRowDragAndDrop?1:0,a=n.parent.taskFields.id,r=n.parent.currentViewData.findIndex(function(e){return e[a]===t[a]});if(n.parent.treeGrid.getRows()[r]){var s=n.parent.treeGrid.grid.getRowObjectFromUID(n.parent.treeGrid.grid.getDataRows()[r].getAttribute("data-uid"));n.parent.treeGrid.renderModule.cellRender({data:s.data,cell:n.parent.treeGrid.getRows()[r].cells[n.parent.treeColumnIndex+i],column:n.parent.treeGrid.grid.getColumns()[n.parent.treeColumnIndex],requestType:"rowDragAndDrop"}),n.parent.treeGrid.renderModule.RowModifier({data:t,row:n.parent.treeGrid.getRows()[r],rowHeight:n.parent.rowHeight})}},n=this;for(a=0;a<this.parent.modifiedRecords.length;a++)r(a)},a.prototype.updateRealDataSource=function(t,a){var r=this.parent.taskFields,s=n(this.parent)?(0,e.getValue)("result",this.parent.dataSource):this.parent.dataSource;this.parent.dataSource instanceof i.DataManager&&(s=this.parent.dataSource.dataSource.json);for(var o=0;o<t.length;o++)((0,e.isNullOrUndefined)(a)||(0,e.isNullOrUndefined)(this.addRowSelectedItem))&&(a="Bottom"===a?"Bottom":"Top"),"Top"===a?s.splice(0,0,t[o].taskData):"Bottom"===a?s.push(t[o].taskData):(0,e.isNullOrUndefined)(r.id)||(0,e.isNullOrUndefined)(r.parentID)||"Child"!==a?(this.isNewRecordAdded||this.addDataInRealDataSource(s,t[o].taskData,a),this.isNewRecordAdded=!1):s.push(t[o].taskData),this.isBreakLoop=!1},a.prototype.addDataInRealDataSource=function(t,i,a){for(var r=0;r<t.length;r++){var n=this.parent.taskFields.child;if(this.isBreakLoop)break;if((0,e.getValue)(this.parent.taskFields.id,t[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<t.length;o++)if(t[o][this.parent.taskFields.id]===this.parent.rowDragAndDropModule.droppedRecord.ganttProperties.taskId){s=o;break}"Above"===a?s?t.splice(s,0,i):t.splice(r,0,i):"Below"===a?s?t.splice(s+1,0,i):t.splice(r+1,0,i):"Child"===a&&(t[r][n]&&t[r][n].length>0||(t[r][n]=[]),t[r][n].push(i)),this.isBreakLoop=!0;break}if(t[r][n]){var l=t[r][n];this.addDataInRealDataSource(l,i,a)}}},a.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])},a.prototype.addNewUndoCollection=function(t,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")){t.action="Add";for(var a=i.data.length>0?(0,e.extend)([],[],i.data,!0):[i.data],r=[],n=function(e){r=s.parent.flatData.filter(function(t){return a[e].index===t.index&&a[e].ganttProperties.taskId===t.ganttProperties.taskId})},s=this,o=0;o<a.length;o++)n(o);t.addedRecords=(0,e.extend)([],[],r,!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=t}},a.prototype.addRecord=function(t,a,r){var s=this,o=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 l=[];if((0,e.isNullOrUndefined)(t))this.validateTaskPosition(t,a,r,l);else if(t instanceof Array)if(this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed){var h=t,p=r;"ResourceView"===this.parent.viewType&&("below"===t[0].position?a="Below":"above"===t[0].position?a="Above":"child"===t[0].position&&(a="Child"),p=this.parent.taskIds.indexOf(t[0].id.toString()),h=t[0].data),this.validateTaskPosition(h,a,p,l)}else for(var u=0;u<t.length;u++)this.validateTaskPosition(t[u],a,r,l);else{if("object"!=typeof t)return;this.validateTaskPosition(t,a,r,l)}var c={};c=this.constructTaskAddedEventArgs(l,this.parent.editedRecords,"beforeAdd"),(0,e.isNullOrUndefined)(a)||(c.rowPosition=a),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",c,function(t){s.parent.previousRecords={};var r,h=s.parent.taskFields;if(r="ResourceView"===s.parent.viewType?t.data.childRecords.length>0?s.parent.flatData[s.parent.getTaskIds().indexOf("R"+t.data[h.id])]:s.parent.flatData[s.parent.getTaskIds().indexOf("T"+t.data[h.id])]:s.parent.getRecordByID(t.data[h.id]),(0,e.isNullOrUndefined)(r)||(s.validateUpdateValues(t.newTaskData,r,!0),s.parent.dateValidationModule.calculateEndDate(r),s.parent.dataOperation.updateWidthLeft(r),s.parent.dataOperation.updateParentItems(r)),!(0,e.isNullOrUndefined)(t.data[""+o])&&t.data[o]!==t.data.ganttProperties.taskId){for(var p=0,u=Object.keys(s.parent.ids);p<u.length;p++){var c=u[p];if(s.parent.ids[c]===t.data.ganttProperties.taskId.toString()){s.parent.ids[c]=t.data[o].toString();break}}t.data.ganttProperties.taskId=t.data[o],t.newTaskData[o]=t.data[o],t.data.ganttProperties.rowUniqueID=t.data[o].toString()}if(t.cancel)s.removeAddedRecord(),s.reUpdatePreviousRecords(),s._resetProperties();else{s.parent.showLoadingIndicator();if(d(s.parent.dataSource)){var g=s.parent.dataSource,f={addedRecords:[t.newTaskData],changedRecords:t.modifiedTaskData},m=s.parent.query instanceof i.Query?s.parent.query:new i.Query,y=g.adaptor;if(!(y instanceof i.WebApiAdaptor||y instanceof i.ODataAdaptor||y instanceof i.ODataV4Adaptor)||g.dataSource.batchUrl){var D=t.data.ganttProperties.taskId;g.saveChanges(f,s.parent.taskFields.id,null,m).then(function(i){if(i.addedRecords[0][s.parent.taskFields.id].toString()!==t.data.ganttProperties.taskId){var a=s.parent.ids.indexOf(D);if(t.data.ganttProperties.taskId=i.addedRecords[0][s.parent.taskFields.id].toString(),t.newTaskData[o]=i.addedRecords[0][s.parent.taskFields.id].toString(),t.data.ganttProperties.rowUniqueID=i.addedRecords[0][s.parent.taskFields.id].toString(),s.parent.ids.some(function(e){return e===i.addedRecords[0][s.parent.taskFields.id].toString()})){var r="The provided ID value "+i.addedRecords[0][s.parent.taskFields.id]+" already exists. Please provide a unique ID value.";s.parent.trigger("actionFailure",{error:r})}else-1!==a?s.parent.ids.splice(a,1,i.addedRecords[0][s.parent.taskFields.id].toString()):s.parent.ids.push(i.addedRecords[0][s.parent.taskFields.id].toString())}var n=t.data.ganttProperties.taskId.toString();if(s.parent.taskFields.id&&!(0,e.isNullOrUndefined)(i.addedRecords[0][s.parent.taskFields.id])&&i.addedRecords[0][s.parent.taskFields.id].toString()===n){s.parent.setRecordValue("taskId",i.addedRecords[0][s.parent.taskFields.id],t.data.ganttProperties,!0),s.parent.setRecordValue("taskData",i.addedRecords[0],t.data),s.parent.setRecordValue(s.parent.taskFields.id,i.addedRecords[0][s.parent.taskFields.id],t.data),s.parent.setRecordValue("rowUniqueID",i.addedRecords[0][s.parent.taskFields.id].toString(),t.data.ganttProperties,!0),s.updateClientDataFromServer(i,t);var d=s.parent.ids.indexOf(n);-1!==d&&(s.parent.ids[d]=i.addedRecords[0][s.parent.taskFields.id].toString())}s.updateNewRecord(l,t)}).catch(function(e){s.removeAddedRecord(),s.dmFailure(e,t),s._resetProperties()})}else{g.insert(f.addedRecords,null,m).then(function(i){var a;a=(0,e.isNullOrUndefined)(i[0])?f.addedRecords[0]:i[0],l.forEach(function(t){(0,e.isNullOrUndefined)(t)||(s.updateEditedRecordFields(a,t),s.parent.dataOperation.updateTaskData(t))}),s.updateNewRecord(l,t)}).catch(function(e){s.removeAddedRecord(),s.dmFailure(e,t),s._resetProperties()})}}else{if("ProjectView"===s.parent.viewType){if("Top"===a||"Bottom"===a||"Above"===a||"Below"===a||"Child"===a||(0,e.isNullOrUndefined)(a)&&!t.data.parentItem)if(t.data instanceof Array)s.updateRealDataSource(t.data,a);else{var v=[];v.push(t.data),s.updateRealDataSource(v,a),s.parent.currentSelection=l[0]}}else(n(s.parent)?(0,e.getValue)("result",s.parent.dataSource):s.parent.dataSource).push(t.data.taskData);if(0===l.level&&s.parent.treeGrid.parentData.splice(0,0,l),s.updateTreeGridUniqueID(l,"add"),"ResourceView"===s.parent.viewType&&s.parent.undoRedoModule&&s.parent.undoRedoModule.currentAction){var k=!1;if(t.data.hasChildRecords)k=!0;else if(t.data.parentItem)s.parent.getTaskByUniqueID(t.data.parentItem.uniqueID).ganttProperties.taskName!==s.parent.localeObj.getConstant("unassignedTask")&&(k=!0);if(-1!==s.parent.taskIds.indexOf("R0")&&s.parent.undoRedoModule&&s.parent.undoRedoModule.isUndoRedoPerformed&&"Delete"===s.parent.undoRedoModule.currentAction.action&&k){var b=s.parent.flatData[s.parent.taskIds.indexOf("R0")],w=b.childRecords.filter(function(e){return e.ganttProperties.taskId===t.data.ganttProperties.taskId});t.data.hasChildRecords&&(w=t.data.childRecords);for(var T=function(e){if(1===b.childRecords.length)s.parent.flatData.splice(s.parent.taskIds.indexOf("R0"),2),s.parent.ids.splice(s.parent.taskIds.indexOf("R0"),2),s.parent.taskIds.splice(s.parent.taskIds.indexOf("R0"),2);else{var t=s.parent.taskIds.indexOf("T"+w[e].ganttProperties.taskId),i="T"+w[e].ganttProperties.taskId,a=s.parent.taskIds.reduce(function(e,t,a){return t===i&&e.push(a),e},[]);t=a[a.length-1],s.parent.taskIds.splice(t,1),s.parent.flatData.splice(t,1),s.parent.ids.splice(t,1)}},S=0;S<w.length;S++)T(S);if(b&&"ResourceView"===s.parent.viewType)s.parent.flatData[s.parent.taskIds.indexOf("R0")+1]||(s.parent.flatData.splice(s.parent.taskIds.indexOf("R0"),1),s.parent.ids.splice(s.parent.taskIds.indexOf("R0"),1),s.parent.taskIds.splice(s.parent.taskIds.indexOf("R0"),1))}}s.refreshNewlyAddedRecord(t,l),"ResourceView"===s.parent.viewType&&s.parent.taskFields.work&&r&&s.parent.dataOperation.updateParentItems(r,!0),s.addNewUndoCollection({},t),s._resetProperties()}s.parent.isOnAdded=!1}})}},a.prototype.createNewRecord=function(){for(var t={},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?t[s]=r:i[n].field===a.startDate?((0,e.isNullOrUndefined)(t[a.endDate])?t[s]=this.parent.editModule.dialogModule.getMinimumStartDate():t[s]=new Date(t[a.endDate]),this.parent.timezone&&(t[s]=this.parent.dateValidationModule.remove(t[s],this.parent.timezone))):i[n].field===a.endDate?((0,e.isNullOrUndefined)(t[a.startDate])?t[s]=this.parent.editModule.dialogModule.getMinimumStartDate():t[s]=new Date(t[a.startDate]),this.parent.timezone&&(t[s]=this.parent.dateValidationModule.remove(t[s],this.parent.timezone))):i[n].field===a.duration?t[s]=1:i[n].field===a.name?t[s]=this.parent.editModule.dialogModule.localeObj.getConstant("addDialogTitle")+" "+r:i[n].field===a.progress||i[n].field===a.work?t[s]=0:i[n].field===a.type||"taskType"===i[n].field?t[s]=this.parent.taskType:i[n].field===a.milestone?t[s]=null:t[this.parent.ganttColumns[n].field]=""}return t},a.prototype.validateTaskPosition=function(t,i,a,r){var n=(0,e.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=(0,e.isNullOrUndefined)(n)?null:this.parent.updatedRecords[n],i=(0,e.isNullOrUndefined)(i)?this.parent.editSettings.newRowPosition:i,t=(0,e.isNullOrUndefined)(t)?this.createNewRecord():t,(((0,e.isNullOrUndefined)(n)||n<0||(0,e.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(t,i);var l=this.updateNewlyAddedDataBeforeAjax(t,o,i,s,a);r.push(l)},a.prototype.updateRowIndex=function(){for(var t=this.parent.currentViewData,i=t.length,a=0;a<i;a++){var r=a;if(t[a].index=r,t[a].parentItem&&t[a].parentItem.taskId){var n=this.parent.getRecordByID(t[a].parentItem.taskId);(0,e.isNullOrUndefined)(n)||(0,e.isNullOrUndefined)(n.index)||(0,e.isNullOrUndefined)(n.level)||(t[a].parentItem.index=n.index,t[a].parentItem.level=n.level)}}},a.prototype.updateNewRecord=function(t,i){var a=this;t.forEach(function(t){0===t.level&&(a.parent.treeGrid.parentData.splice(0,0,t),(0,e.getValue)("dataOperation.dataArray",a.parent).splice(0,0,t.taskData));a.updateTreeGridUniqueID(t,"add")}),this.updateTreeGridUniqueID(t,"add"),this.refreshNewlyAddedRecord(i,t);this.addNewUndoCollection({},i),this._resetProperties()},a.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)},a.prototype.updateTreeGridUniqueID=function(t,i){"add"===i?(0,e.setValue)("uniqueIDCollection."+t.uniqueID,t,this.parent.treeGrid):"delete"===i&&(0,e.deleteObject)((0,e.getValue)("uniqueIDCollection",this.parent.treeGrid),t.uniqueID)},a.prototype.refreshNewlyAddedRecord=function(t,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(t.data)),this.parent.timelineSettings.updateTimescaleView){var r=[];t.modifiedRecords.length>0?(r=t.data.length>0?(0,e.extend)([],[],t.data,!0):[t.data]).push.apply(r,t.modifiedRecords):r=t.data.length>0?(0,e.extend)([],[],t.data,!0):[t.data],this.parent.timelineModule.updateTimeLineOnEditing([r],t.action)}if(this.addSuccess(t),t=this.constructTaskAddedEventArgs(i,t.modifiedRecords,"add"),this.updateRowIndex(),this.parent.trigger("actionComplete",t),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(t.data[n].ganttProperties.sharedTaskUniqueIds.push(t.data[n].ganttProperties.rowUniqueID),t.data[n].ganttProperties.resourceInfo){var s=(0,e.extend)([],[],t.data[n].ganttProperties.resourceInfo,!0);s.splice(0,1),this.updateResoures([],s,t.data[n])}else(!this.parent.undoRedoModule||this.parent.undoRedoModule&&!t.data[n].hasChildRecords&&this.parent.undoRedoModule.isUndoRedoPerformed||!this.parent.undoRedoModule.isUndoRedoPerformed)&&(this.removeChildRecord(t.data[n]),this.parent.editModule.checkWithUnassignedTask(t.data[n]));for(var o=0;o<this.updateParentRecords.length;o++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[o]);this.updateParentRecords=[]}else{t.data.ganttProperties.sharedTaskUniqueIds.push(t.data.ganttProperties.rowUniqueID);var l=t.data,d=l.ganttProperties,h=l.childRecords,p=this.parent.undoRedoModule,u=function(t,i){if(t&&t.length>1){var r=(0,e.extend)([],[],t,!0);r.splice(0,1),p&&p.isUndoRedoPerformed&&(a.parent.editModule.addRowIndex=void 0),a.updateResoures([],r,i)}};d.resourceInfo&&d.resourceInfo.length?u(d.resourceInfo,l):h.length>0&&h[0].ganttProperties.resourceInfo&&h[0].ganttProperties.resourceInfo.length?u(h[0].ganttProperties.resourceInfo,t.data.childRecords[0]):(!this.parent.undoRedoModule||this.parent.undoRedoModule&&!t.data.hasChildRecords&&this.parent.undoRedoModule.isUndoRedoPerformed||!this.parent.undoRedoModule.isUndoRedoPerformed)&&(this.removeChildRecord(t.data),this.parent.editModule.checkWithUnassignedTask(t.data));for(o=0;o<this.updateParentRecords.length;o++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[o]);this.updateParentRecords=[]}},a.prototype.removeAddedRecord=function(){var t=this.parent.flatData,i=this.parent.currentViewData,a=this.parent.ids,r=t.indexOf(this.newlyAddedRecordBackup),n=i.indexOf(this.newlyAddedRecordBackup),s=a.indexOf(this.newlyAddedRecordBackup.ganttProperties.rowUniqueID.toString());if((0,e.deleteObject)(this.parent.previousRecords,t[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)}t.splice(r,1),i.splice(n,1),a.splice(s,1)},a.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)},a.prototype.indent=function(){var t,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&&((0,e.isNullOrUndefined)(this.parent.updatedRecords[i])||this.parent.updatedRecords[i].level-r.level!==1)&&(t=r.level-n.level===0?this.parent.selectionModule.getSelectedRowIndexes()[0]-1:this.getPrevRecordIndex(),this.indentOutdentRow([this.parent.selectionModule.getSelectedRowIndexes()[0]],t,"child"))},a.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")}},a.prototype.indentOutdentRow=function(e,t,i){var a=this;e[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){e.cancel?a.parent.hideLoadingIndicator():(a.parent.showLoadingIndicator(),a.reArrangeRows(o,true))})},a.prototype.reArrangeRows=function(t,i){var a=this;if(this.dropPosition=t.dropPosition,this.parent.oldRecords=[],this.parent.oldRecords=(0,e.extend)([],[],t.data,!0),"Invalid"!==t.dropPosition&&this.parent.editModule){var r=this.parent,n=void 0;this.droppedRecord=r.updatedRecords[t.dropIndex];var s="middleSegment"===t.dropPosition?"Indent":"Outdent";if(this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.isUndoRedoItemPresent(s))(g={}).action=s,g.modifiedRecord=[],g.selectedRowIndexes=(0,e.extend)([],[],this.parent.selectionModule.selectedRowIndexes,!0),this.parent.undoRedoModule.findPosition((0,e.extend)([],[],[t.data],!0)[0],g,"modifiedRecord"),g.droppedRecord=(0,e.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;t.data[0]?o=t.data:o.push(t.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,f=g=this.parent.getParentTask(l.parentItem).childRecords,m=f.indexOf(l)+1;f.splice(m,0,n)}}"middleSegment"===this.dropPosition&&this.dropMiddle(u),(0,e.isNullOrUndefined)(n.parentItem&&-1!==this.updateParentRecords.indexOf(n.parentItem))||this.updateParentRecords.push(this.parent.getTaskByUniqueID(n.parentItem.uniqueID))}if((0,e.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(!(0,e.isNullOrUndefined)(l.ganttProperties.predecessor))for(var v=l.ganttProperties.predecessor.length-1;v>=0;v--)if(!(0,e.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),(0,e.isNullOrUndefined)(l.taskData[this.parent.taskFields.milestone])||!0===l.taskData[this.parent.taskFields.milestone]&&(l.taskData[this.parent.taskFields.milestone]=!1))}for(var 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(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(t)},a.prototype.refreshRecord=function(e,t){var a=this;if(d(this.parent.dataSource)){var r=this.parent.dataSource,n={changedRecords:h(this.parent.editedRecords,null,null,this.parent)},s=this.parent.query instanceof i.Query?this.parent.query:new i.Query,o=null,l=r.adaptor;if(l instanceof i.WebApiAdaptor&&l instanceof i.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(i){return a.indentSuccess(i,e,t)}).catch(function(e){return a.indentFailure(e)})}else this.indentOutdentSuccess(e,t)},a.prototype.indentSuccess=function(e,t,i){this.updateEditedFields(e),this.indentOutdentSuccess(t,i)},a.prototype.indentFailure=function(e){this.parent.trigger("actionFailure",{error:e})},a.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++)p(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)},a.prototype.refreshDataSource=function(){var t,a,r=this.draggedRecord,n=this.droppedRecord,s=this.parent;if((t=this.parent.dataSource instanceof i.DataManager?(0,e.getValue)("dataOperation.dataArray",this.parent):s.dataSource).length>0&&!(0,e.isNullOrUndefined)(n)&&!n.parentItem){for(var o=0;o<Object.keys(t).length;o++)t[o][this.parent.taskFields.child]===n.taskData[this.parent.taskFields.child]&&(a=o);"topSegment"===this.dropPosition?this.parent.taskFields.parentID||t.splice(a,0,r.taskData):"bottomSegment"===this.dropPosition&&(this.parent.taskFields.parentID||t.splice(a+1,0,r.taskData))}else if(!this.parent.taskFields.parentID&&!(0,e.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))},a.prototype.deleteDragRow=function(){this.parent.dataSource instanceof i.DataManager?this.ganttData=(0,e.getValue)("dataOperation.dataArray",this.parent):this.ganttData=n(this.parent)?(0,e.getValue)("result",this.parent.dataSource):this.parent.dataSource,this.treeGridData=n(this.parent)?(0,e.getValue)("result",this.parent.treeGrid.dataSource):this.parent.treeGrid.dataSource;var t=this.parent.getTaskByUniqueID(this.draggedRecord.uniqueID);this.removeRecords(t)},a.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])}},a.prototype.dropMiddle=function(t){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=(0,e.isNullOrUndefined)(i)||0===i?t+1:i+t+1),"middleSegment"===this.dropPosition){if(this.droppedRecord.ganttProperties.isAutoSchedule&&!(0,e.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)}(0,e.isNullOrUndefined)(this.draggedRecord.parentItem&&-1!==this.updateParentRecords.indexOf(this.draggedRecord.parentItem))&&this.updateParentRecords.push(this.draggedRecord.parentItem)}},a.prototype.updateChildRecordLevel=function(e,t){var i,a;if(t++,!e.hasChildRecords)return 0;i=e.childRecords.length;for(var r=0;r<i;r++){a=e.childRecords[r];var n=void 0;if(e.parentItem){n=this.parent.treeGrid.uniqueIDCollection[e.parentItem.uniqueID]}a.level=e.parentItem?n.level+t:e.level+1,a.hasChildRecords&&(t--,t=this.updateChildRecordLevel(a,t))}return t},a.prototype.updateChildRecord=function(e,t,i){var a,r,n=this.parent;if(!e.hasChildRecords)return 0;r=e.childRecords.length;for(var s=0;s<r;s++)a=e.childRecords[s],t++,n.flatData.splice(t,0,a),this.parent.ids.splice(t,0,a.ganttProperties.rowUniqueID.toString()),n.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(t,0,a.taskData),a.hasChildRecords&&(t=this.updateChildRecord(a,t));return t},a.prototype.removeRecords=function(t){var a,r=this.parent;a=this.parent.dataSource instanceof i.DataManager?(0,e.getValue)("dataOperation.dataArray",this.parent):this.parent.dataSource;var n=t;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=a.length>0?a: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){a.length>0&&a.splice(d,1);var u=void 0;for(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))}},a.prototype.removeChildItem=function(t){for(var a,r,n=0;n<t.childRecords.length;n++){a=t.childRecords[n];var s=void 0;s=this.parent.dataSource instanceof i.DataManager?(0,e.getValue)("dataOperation.dataArray",this.parent):this.parent.dataSource;for(var o=0;o<s.length;o++)s[o][this.parent.taskFields.id]===a.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]===a.taskData[this.parent.taskFields.id]&&(l=d);this.treeGridData.splice(l,1),this.parent.ids.splice(l,1)}a.hasChildRecords&&this.removeChildItem(a)}},a.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)},a.prototype.recordLevel=function(){var t=this.parent,i=this.draggedRecord,a=this.droppedRecord,r=t.taskFields.child;if(a.hasChildRecords||(a.hasChildRecords=!0,a.childRecords.length||(a.childRecords=[],!t.taskFields.parentID&&(0,e.isNullOrUndefined)(a.taskData[r])&&(a.taskData[r]=[]))),"middleSegment"===this.dropPosition){var n=(0,e.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),(0,e.isNullOrUndefined)(i)||t.taskFields.parentID||(0,e.isNullOrUndefined)(a.taskData[r])||a.taskData[t.taskFields.child].splice(a.childRecords.length,0,i.taskData),!(0,e.isNullOrUndefined)(a.ganttProperties.segments)&&a.ganttProperties.segments.length>0&&(a.ganttProperties.segments=null,a.taskData[t.taskFields.segments]=null),i.hasChildRecords){i.level=a.level+1,this.updateChildRecordLevel(i,1)}else i.level=a.level+1;a.expanded=!0}},a}(),Vi=function(){function e(e){this.parent=e,$e.TreeGrid.Inject($e.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}(),Bi=function(){return Bi=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Bi.apply(this,arguments)},Ai=function(){function e(e){this.parent=e,$e.TreeGrid.Inject($e.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={action:"ColumnResize"};i.resizedColumn=Bi({},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}(),Wi=function(){function t(e){this.parent=e,$e.TreeGrid.Inject($e.Filter),this.parent.treeGrid.allowFiltering=this.parent.allowFiltering,this.updateCustomFilters(),this.parent.treeGrid.filterSettings=(0,Ze.getActualProperties)(this.parent.filterSettings),this.addEventListener()}return t.prototype.getModuleName=function(){return"filter"},t.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])}},t.prototype.updateModel=function(){this.parent.filterSettings=this.parent.treeGrid.filterSettings},t.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)},t.prototype.wireEvents=function(t){e.EventHandler.add(document.getElementById(t),"click",this.mouseClickHandler,this)},t.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:{})},t.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},t.prototype.mouseClickHandler=function(t){(0,e.closest)(t.target,".e-excelfilter")&&this.parent.treeGrid.grid.notify("click",t)},t.prototype.unWireEvents=function(){e.EventHandler.remove(this.parent.element,"click",this.mouseClickHandler)},t.prototype.getDatePickerFilter=function(t){var i,a=this,r=this.parent,n=t===r.taskFields.startDate||t===r.taskFields.baselineStartDate?r.defaultStartTime:r.defaultEndTime;return{create:function(t){var r=(0,Ze.getCustomDateFormat)(t.column.format,t.column.type),n=(0,e.createElement)("input",{className:"flm-input"});t.target.appendChild(n),(i=new Oi.DatePicker({placeholder:a.parent.localeObj.getConstant("enterValue"),format:r})).enableRtl=a.parent.enableRtl,i.appendTo(n)},write:function(e){i.value=e.filteredValue},read:function(e){i.value&&i.value.setSeconds(n),e.fltrObj.filterByColumn(e.column.field,e.operator,i.value)}}},t.prototype.getDateTimePickerFilter=function(){var t,i=this;return{create:function(a){var r=(0,Ze.getCustomDateFormat)(a.column.format,a.column.type),n=(0,e.createElement)("input",{className:"flm-input"});a.target.appendChild(n),(t=new Oi.DateTimePicker({placeholder:i.parent.localeObj.getConstant("enterValue"),format:r})).enableRtl=i.parent.enableRtl,t.appendTo(n)},write:function(e){t.value=e.filteredValue},read:function(e){e.fltrObj.filterByColumn(e.column.field,e.operator,t.value)}}},t.prototype.getDurationFilter=function(){var t,i=this,a=this.parent,r="";return{create:function(a){var r=(0,e.createElement)("input",{className:"e-input"});r.setAttribute("placeholder",i.parent.localeObj.getConstant("enterValue")),a.target.appendChild(r),(t=new Mi.TextBox).enableRtl=i.parent.enableRtl,t.appendTo(r)},write:function(e){t.value=e.filteredValue?r:""},read:function(n){var s=i.parent.dataOperation.getDurationValue(t.value),o=(0,e.getValue)("duration",s),l=(0,e.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}}},t.prototype.columnMenuOpen=function(t){this.filterMenuElement&&document.body.contains(this.filterMenuElement)&&(0,e.remove)(this.filterMenuElement),this.filterMenuElement=null},t.prototype.actionBegin=function(e){},t.prototype.closeFilterOnContextClick=function(t){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=(0,e.closest)(t,"#"+this.parent.element.id)||t.querySelector("#"+this.parent.element.id);(this.filterMenuElement.contains(t)||(0,e.isNullOrUndefined)(r))&&(this.filterMenuElement.contains(t)||this.parent.enableAdaptiveUI||!(0,e.isNullOrUndefined)(i)||!(0,e.isNullOrUndefined)(a)||"DIV"!==t.nodeName&&"HTML"!==t.nodeName&&"SPAN"!==t.nodeName&&"BUTTON"!==t.nodeName||t.classList.contains("e-dropdownbase"))||((0,e.remove)(this.filterMenuElement),this.parent.treeGrid.grid.notify("filter-menu-close",{isOpen:!1}),this.filterMenuElement=null)}},t.prototype.actionComplete=function(t){if((0,e.isNullOrUndefined)(t.filterModel)||(0,e.isNullOrUndefined)(t.filterModel.dialogObj)||(0,e.isNullOrUndefined)(t.filterModel.dialogObj.element)||"Excel"===this.parent.filterSettings.type&&this.wireEvents(t.filterModel.dialogObj.element.id),t.requestType===Ze.filterAfterOpen){"Menu"===this.parent.treeGrid.filterSettings.type?this.filterMenuElement=(0,e.getValue)("filterModel.dlgObj.element",t):this.filterMenuElement=(0,e.getValue)("filterModel.dialogObj.element",t),this.updateFilterMenuPosition(this.filterMenuElement,t);var i=this.parent.taskFields.id,a=this.parent.taskFields.dependency,r=this.parent.taskFields.resourceInfo,n=this.parent.treeGrid.grid.filterModule,s=(0,e.getValue)("values",n);if(t.columnName===a&&(0,e.isNullOrUndefined)((0,e.getValue)(a,s))||t.columnName===r&&(0,e.isNullOrUndefined)((0,e.getValue)(r,s))){var o=this.filterMenuElement.querySelector(".e-dropdownlist"),l=void 0;(0,e.isNullOrUndefined)(o)||((l=(0,e.getValue)("ej2_instances[0]",o)).index=2,l.dataBind())}else if(t.columnName===i&&(0,e.isNullOrUndefined)((0,e.getValue)(i,s))&&"Menu"===this.parent.treeGrid.filterSettings.type){o=this.filterMenuElement.querySelector(".e-flmenu-input"),l=(0,e.getValue)("ej2_instances[0]",o);!(0,e.isNullOrUndefined)(l)&&(0,e.isNullOrUndefined)(this.parent.columnByField[t.columnName].format)&&(l.format="n")}}},t.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"},t.prototype.updateFilterMenuPosition=function(t,i){var a;if((0,e.addClass)([t],"e-gantt"),this.parent.enableAdaptiveUI||document.querySelector("#"+this.parent.controlId).appendChild(t),t.style.display="block",this.parent.showColumnMenu){if(a=document.querySelector("#treeGrid"+this.parent.controlId+"_gridcontrol_colmenu_Filter"))if(t.style.zIndex=a.parentElement.style.zIndex,"Menu"===this.parent.treeGrid.filterSettings.type)this.setPosition(a,(0,e.getValue)("filterModel.dlgObj.element",i));else{var r=(0,e.getValue)("filterModel.dialogObj.element",i);r&&(r.style.visibility="hidden"),this.setPosition(a,r)}}else a=this.parent.treeGrid.grid.getColumnHeaderByField(i.columnName).querySelector(".e-filtermenudiv"),"Menu"===this.parent.treeGrid.filterSettings.type?(0,Ze.getFilterMenuPostion)(a,(0,e.getValue)("filterModel.dlgObj",i)):(0,Ze.getFilterMenuPostion)(a,(0,e.getValue)("filterModel.dialogObj",i));(t.style.visibility="visible","Menu"===this.parent.treeGrid.filterSettings.type&&t.querySelector(".e-valid-input").focus(),"Excel"===this.parent.treeGrid.filterSettings.type)&&document.querySelector(".e-searchinput").focus()},t.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))},t.prototype.destroy=function(){this.removeEventListener(),this.unWireEvents()},t}(),Hi=function(){function e(e){this.parent=e,$e.TreeGrid.Inject($e.Sort),this.parent.treeGrid.allowSorting=this.parent.allowSorting,this.parent.treeGrid.sortSettings=(0,Ze.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}(),ji=function(){function t(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=(0,Ze.getActualProperties)(this.parent.selectionSettings),this.wireEvents()}return t.prototype.getModuleName=function(){return"selection"},t.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)},t.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)},t.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)},t.prototype.rowSelecting=function(t){this.parent.isGanttChartRendered?(t.isCtrlPressed=this.isMultiCtrlRequest||t.isCtrlPressed,t.isShiftPressed=this.isMultiShiftRequest||t.isShiftPressed,t.target=this.actualTarget,(0,e.isNullOrUndefined)(t.foreignKeyData)||0!==Object.keys(t.foreignKeyData).length||delete t.foreignKeyData,this.parent.selectionSettings&&this.parent.selectionSettings.persistSelection&&(this.parent.treeGrid.grid.selectionModule.checkSelectAllClicked=!0),this.parent.trigger("rowSelecting",t),(this.isMultiShiftRequest||this.isMultiCtrlRequest)&&(this.isMultiShiftRequest=this.isMultiCtrlRequest=!1)):t.cancel=!0},t.prototype.rowSelected=function(t){var i="rowIndexes",a="Multiple"!==this.parent.selectionSettings.type||(0,e.isNullOrUndefined)(t[i])?[t.rowIndex]:t[i];if(this.addRemoveClass(a,t.name),this.selectedRowIndexes=(0,e.extend)([],this.getSelectedRowIndexes(),[],!0),this.parent.setProperties({selectedRowIndex:this.parent.treeGrid.grid.selectedRowIndex},!0),this.isMultiShiftRequest&&(this.selectedRowIndexes=a),this.parent.autoFocusTasks)if(this.parent.enableTimelineVirtualization&&(this.parent.isRowSelected=!0),t.data&&!(0,e.isNullOrUndefined)(t.data.length))for(var r=0;r<t.data.length;r++)this.parent.ganttChartModule.updateScrollLeft(t.data[r].ganttProperties.left);else this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping&&(0,e.isNullOrUndefined)((0,e.getValue)("data.ganttProperties.left",t))&&(t.data=this.parent.getRecordByID(t.data.taskId)),this.parent.ganttChartModule.updateScrollLeft((0,e.getValue)("data.ganttProperties.left",t));if(t.target=this.actualTarget,(0,e.isNullOrUndefined)(t.foreignKeyData)||0!==Object.keys(t.foreignKeyData).length||delete t.foreignKeyData,this.prevRowIndex=t.rowIndex,(0,e.isNullOrUndefined)(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems(t),!(0,e.isNullOrUndefined)(this.parent.focusModule.previousActiveElement)){var n=this.parent.focusModule.previousActiveElement;(0,e.removeClass)([n],"e-focused"),(0,e.removeClass)([n],"e-focus")}this.parent.trigger("rowSelected",t)},t.prototype.rowDeselecting=function(e){e.target=this.actualTarget,e.isInteracted=this.isInteracted,this.parent.trigger("rowDeselecting",e)},t.prototype.rowDeselected=function(t){var i,a;if(0!==this.multipleIndexes.length)i=this.multipleIndexes;else if((0,e.isNullOrUndefined)(t.rowIndexes))i=[t.rowIndex];else{for(var r=0;r<t.rowIndexes.length;r++)t.rowIndexes[r]===t.rowIndex&&(a=!0);i=a?t.rowIndexes:[t.rowIndex]}this.addRemoveClass(i),this.selectedRowIndexes=(0,e.extend)([],this.getSelectedRowIndexes(),[],!0),this.parent.setProperties({selectedRowIndex:-1},!0),1===this.selectedRowIndexes.length&&this.parent.setProperties({selectedRowIndex:this.selectedRowIndexes[0]},!0),(0,e.isNullOrUndefined)(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems(),"Multiple"===this.parent.selectionSettings.type&&this.parent.isAdaptive&&0===this.selectedRowIndexes.length&&this.hidePopUp(),t.target=this.actualTarget,t.isInteracted=this.isInteracted,this.parent.trigger("rowDeselected",t),this.isInteracted=!1,this.multipleIndexes=[]},t.prototype.cellSelecting=function(e){var t=new i.Deferred;return this.parent.trigger("cellSelecting",e,function(e){t.resolve(e)}),t},t.prototype.cellSelected=function(t){this.parent.trigger("cellSelected",t),(0,e.isNullOrUndefined)(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},t.prototype.cellDeselecting=function(e){this.parent.trigger("cellDeselecting",e)},t.prototype.cellDeselected=function(t){this.parent.trigger("cellDeselected",t),(0,e.isNullOrUndefined)(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},t.prototype.selectCell=function(e,t){this.parent.treeGrid.selectCell(e,t)},t.prototype.selectCells=function(e){this.parent.treeGrid.grid.selectCells(e)},t.prototype.selectRow=function(t,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)&&(t=this.parent.getExpandedRecords(this.parent.flatData).indexOf(this.parent.flatData[t]),this.parent.treeGridModule.addedRecord=!1,this.parent.editModule&&(this.parent.editModule.isAdded=!1));var n,s=r.filter(function(e){return parseInt(e.getAttribute("aria-rowindex"),10)-1===t})[0];-1===t||(0,e.isNullOrUndefined)(s)&&!this.parent.enableVirtualization||"Cell"===this.parent.selectionSettings.mode||(this.parent.showActiveElement&&!(0,e.isNullOrUndefined)(a)&&!a||this.isFromChart?(this.isFromChart&&(this.isFromChart=!1),this.parent.treeGrid.grid.selectionModule.preventFocus=!0):this.parent.treeGrid.grid.selectionModule.preventFocus=!1,(0,e.isNullOrUndefined)(this.selectedClass)||this.selectedClass!==s||i||(n=!0),!0!==n&&this.parent.treeGrid.selectRow(t,i),this.parent.treeGrid.grid.selectionModule.preventFocus=!0!==this.parent.treeGrid.grid.selectionModule.preventFocus&&this.parent.treeGrid.grid.selectionModule.preventFocus,this.prevRowIndex=t,this.selectedClass=s)},t.prototype.selectRows=function(t){!(0,e.isNullOrUndefined)(t)&&t.length>0&&this.parent.treeGrid.selectRows(t)},t.prototype.getSelectedRowIndexes=function(){return this.parent.treeGrid.getSelectedRowIndexes()},t.prototype.getSelectedRowCellIndexes=function(){return this.parent.treeGrid.getSelectedRowCellIndexes()},t.prototype.getSelectedRecords=function(){if(this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping){for(var e=[],t=this.parent.selectionModule.getSelectedRowIndexes(),i=function(i){var r=a.parent.currentViewData.filter(function(e){return e.index===t[i]})[0];e.push(r)},a=this,r=0;r<t.length;r++)i(r);return e}return this.parent.treeGrid.getSelectedRecords()},t.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},t.prototype.getSelectedRows=function(){return this.parent.treeGrid.getSelectedRows()},t.prototype.clearSelection=function(){this.addRemoveClass(this.selectedRowIndexes),this.parent.treeGrid.clearSelection(),this.parent.selectedRowIndex=-1,this.selectedRowIndexes=[],this.selectedClass=null,(0,e.isNullOrUndefined)(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems(),this.isInteracted=!1},t.prototype.highlightSelectedRows=function(t,i){if(this.isMultiCtrlRequest=t.ctrlKey||this.enableSelectMultiTouch,this.isMultiShiftRequest=t.shiftKey,this.actualTarget=t.target,this.isInteracted=!0,this.isSelectionFromChart=i,i){var a=(0,e.closest)(t.target,"tr.e-chart-row"),r=parseInt(a.getAttribute("aria-rowindex"),10)-1,n=this.parent.selectionSettings.enableToggle;if("Single"===this.parent.selectionSettings.type||!this.isMultiCtrlRequest&&!this.isMultiShiftRequest)this.parent.selectionSettings.persistSelection&&this.addRemoveClass(this.selectedRowIndexes,t.name),(!this.parent.allowTaskbarDragAndDrop||this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&!this.parent.rowDragAndDropModule.draggedRecord)&&(this.isFromChart=!0,this.selectRow(r,n));else if(this.isMultiShiftRequest)this.selectRowsByRange((0,e.isNullOrUndefined)(this.prevRowIndex)?r:this.prevRowIndex,r);else(0,e.setValue)("isMultiCtrlRequest",!0,this.parent.treeGrid.grid.selectionModule),this.parent.treeGrid.grid.selectionModule.addRowsToSelection([r]),this.selectedRowIndexes.indexOf(r)>-1&&this.addRemoveClass([r],t.name)}},t.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},t.prototype.selectRowsByRange=function(e,t){this.isSelectionFromChart=!0,this.getselectedrowsIndex(e,t),this.selectRows(this.selectedRowIndexes)},t.prototype.addRemoveClass=function(t,i){"number"==typeof t&&(t=[t]);for(var a=[].slice.call(this.parent.ganttChartModule.chartBodyContent.querySelector("tbody").children),r=function(r){var s=a.filter(function(e){return parseInt(e.getAttribute("aria-rowindex"),10)-1===t[parseInt(r.toString(),10)]})[0];if(!(0,e.isNullOrUndefined)(s)){var o=!1,l=n.getSelectedRowIndexes().indexOf(t[parseInt(r.toString(),10)]),d=n.getSelectedRecords().length;n.parent.selectionSettings.persistSelection&&n.parent.selectionSettings.enableToggle&&!(0,e.isNullOrUndefined)(i)&&"Multiple"!==n.parent.selectionSettings.type&&d>0&&(o=!0),n.parent.selectionSettings.enableToggle&&n.parent.selectionSettings.persistSelection&&l>-1&&"Single"===n.parent.selectionSettings.type&&o||l>-1&&!(0,e.isNullOrUndefined)(i)&&"Multiple"===n.parent.selectionSettings.type?n.addClass(s):(0,e.isNullOrUndefined)(i)?n.removeClass(s):l>-1&&n.addClass(s),n.parent.selectionSettings.enableToggle&&l>-1&&("Single"===n.parent.selectionSettings.type||!n.isMultiCtrlRequest&&!n.isMultiShiftRequest)&&n.parent.selectionSettings.persistSelection&&"chartMouseUp"===i&&n.isSelectionFromChart&&n.removeClass(s)}},n=this,s=0;s<t.length;s++)r(s)},t.prototype.addClass=function(t){(0,e.addClass)([t],"e-active"),t.setAttribute("aria-selected","true")},t.prototype.removeClass=function(t){(0,e.removeClass)([t],"e-active"),t.removeAttribute("aria-selected")},t.prototype.showPopup=function(e){this.isSelectionFromChart?((0,Ze.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()},t.prototype.hidePopUp=function(){this.openPopup?(document.getElementsByClassName("e-ganttpopup")[0].style.display="none",this.openPopup=!1):document.getElementsByClassName("e-gridpopup")[0].style.display="none"},t.prototype.popUpClickHandler=function(t){var i=t.target,a=this.parent.treeGrid.grid,r=(0,e.closest)(i,".e-ganttpopup")?(0,e.closest)(i,".e-ganttpopup"):(0,e.closest)(i,".e-gridpopup");if(r){var n=r.querySelector(".e-rowselect");(0,e.closest)(i,".e-ganttpopup")&&!n.classList.contains("e-spanclicked")?(this.enableSelectMultiTouch=!0,n.classList.add("e-spanclicked")):(0,e.closest)(i,".e-gridpopup")&&n.classList.contains("e-spanclicked")?(this.openPopup=!0,this.enableSelectMultiTouch=!0):(this.hidePopUp(),this.enableSelectMultiTouch=!1,(0,e.closest)(i,".e-ganttpopup")&&n.classList.remove("e-spanclicked"))}else if("Multiple"===this.parent.selectionSettings.type&&this.parent.isAdaptive){(0,e.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&&(0,e.setValue)("enableSelectMultiTouch",this.enableSelectMultiTouch,a.selectionModule)},t.prototype.mouseUpHandler=function(t){var i=!1,a=document.querySelectorAll(".e-drag-item"),r=null;if(t.target.closest(".e-rowcell")?r=t.target:t.target.closest(".e-chart-row")&&(r=t.target.closest(".e-left-label-container")||t.target.closest(".e-taskbar-main-container")||t.target.closest(".e-right-label-container")),this.parent.focusModule&&this.parent.focusModule.setActiveElement(r),this.parent.editModule&&this.parent.editSettings.allowTaskbarEditing&&this.parent.editModule.taskbarEditModule){var n=this.parent.editModule.taskbarEditModule;(n.isMouseDragged||n.tapPointOnFocus)&&(i=!0)}if(!i&&this.parent.element.contains(t.target)&&1!==a.length){var s=(0,Ze.parentsUntil)(t.target,"e-chart-row"),o=t.target,l=o.classList.contains("e-rowcell")||o.closest("td.e-rowcell")&&o.closest("td.e-rowcell").classList.contains("e-rowcell")||o.classList.contains("e-row")||o.parentElement&&o.parentElement.classList.contains("e-checkbox-wrapper")||o.classList.contains("e-treegridexpand")||o.classList.contains("e-treegridcollapse")||!(0,e.isNullOrUndefined)(s);this.popUpClickHandler(t),"Cell"!==this.parent.selectionSettings.mode&&l?((0,e.closest)(t.target,"tr.e-chart-row")?(this.parent.enableVirtualization&&(this.parent.treeGrid.grid.selectionModule.isInteracted=!0),this.parent.treeGrid.isFromChartSide=!0,this.highlightSelectedRows(t,!0)):(this.parent.treeGrid.isFromChartSide=!1,this.highlightSelectedRows(t,!1)),"Multiple"===this.parent.selectionSettings.type&&this.parent.isAdaptive&&(this.selectedRowIndexes.length>0?this.showPopup(t):this.hidePopUp())):this.isSelectionFromChart=!1}},t.prototype.maintainSelectedRecords=function(e){this.parent.selectionModule.getSelectedRowIndexes().indexOf(e)>-1&&this.addRemoveClass([e])},t.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))},t}(),zi=function(){function t(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 t.prototype.getModuleName=function(){return"toolbar"},t.prototype.renderToolbar=function(){if((this.parent.toolbar||[]).length>0){this.element=(0,e.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 t=0,i=["Add","Edit","Update","Delete","Cancel","ExpandAll","CollapseAll","PrevTimeSpan","NextTimeSpan","ZoomIn","ZoomOut","ZoomToFit","ExcelExport","CsvExport","PdfExport","Indent","Outdent","CriticalPath","Undo","Redo"];t<i.length;t++){var a=i[t],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()}},t.prototype.addReactToolbarPortals=function(e){this.parent.isReact&&e&&(this.parent.portals=this.parent.portals.concat(e),this.parent.renderTemplates())},t.prototype.createToolbar=function(){var t=this.getItems();this.toolbar=new Ci.Toolbar({items:t,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&&(0,e.addClass)([i],I),a&&(0,e.addClass)([a],I);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 Mi.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)},t.prototype.getSearchBarElement=function(){var t=this,i=(0,e.createElement)("div",{className:"e-adaptive-searchbar",styles:"display: none"}),a=(0,e.createElement)("input",{attrs:{type:"text"},id:this.parent.element.id+"_searchbar"}),r=(0,e.createElement)("span",{className:"e-backarrowspan e-icons"});return r.onclick=function(){i.style.display="none",t.element.childNodes[1].style.display="block"},i.appendChild(r),i.appendChild(a),i},t.prototype.wireEvent=function(){this.searchElement&&(e.EventHandler.add(this.searchElement,"keyup",this.keyUpHandler,this),e.EventHandler.add(this.searchElement,"focus",this.focusHandler,this),e.EventHandler.add(this.searchElement,"blur",this.blurHandler,this))},t.prototype.propertyChanged=function(t){(0,e.getValue)("module",t)===this.getModuleName()&&this.parent.toolbar&&(this.element&&this.element.parentNode&&(0,e.remove)(this.element),this.renderToolbar(),this.refreshToolbarItems())},t.prototype.unWireEvent=function(){this.searchElement&&(e.EventHandler.remove(this.searchElement,"keyup",this.keyUpHandler),e.EventHandler.remove(this.searchElement,"focus",this.focusHandler),e.EventHandler.remove(this.searchElement,"blur",this.blurHandler),this.searchElement=null),this.parent.isDestroyed||this.parent.off("ui-toolbarupdate",this.propertyChanged)},t.prototype.keyUpHandler=function(e){13===e.keyCode&&this.parent.searchSettings.key!==this.searchElement.value&&(this.parent.searchSettings.key=this.searchElement.value,this.parent.dataBind())},t.prototype.focusHandler=function(e){e.target.parentElement.classList.add("e-input-focus")},t.prototype.blurHandler=function(e){e.target.parentElement.classList.remove("e-input-focus")},t.prototype.updateSearchTextBox=function(){this.searchElement&&this.searchElement.value!==this.parent.searchSettings.key&&(this.searchElement.value=this.parent.searchSettings.key)},t.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},t.prototype.getItem=function(t){var i=this.predefinedItems[t.text],a=i?(0,e.extend)(i,i,t):t;return a.align||(a.align=this.parent.isAdaptive?"Right":"Left"),a},t.prototype.getItemObject=function(e){return this.predefinedItems[e]||{text:e,id:this.id+"_"+e}},t.prototype.toolbarClickHandler=function(t){var i=this,a=this.parent,r=this.id;this.parent.isToolBarClick=!1,(0,e.extend)(t,{cancel:!1}),a.trigger(vi,t,function(n){if(!n.cancel)switch(t.item.properties.id!==i.parent.element.id+"_pdfexport"&&t.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")),!(0,e.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((0,e.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()}})},t.prototype.zoomIn=function(){this.parent.timelineModule.processZooming(!0),this.parent.timelineModule.isZooming=!1},t.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},t.prototype.zoomOut=function(){this.parent.timelineModule.processZooming(!1),this.parent.timelineModule.isZooming=!1},t.prototype.refreshToolbarItems=function(t){var i,a=this.parent,r=[],n=[],s=a.editSettings,o=this.id,l=a.selectedRowIndex;if(this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)for(var d=0;d<a.updatedRecords.length;d++)if(a.updatedRecords[d].index===l){l=d;break}var h=!1;a.selectionModule&&(1!==a.selectionModule.getSelectedRecords().length&&1!==a.selectionModule.getSelectedRowCellIndexes().length||(h=!0)),a.selectionModule&&"Multiple"===a.selectionSettings.type&&a.selectionModule.selectedRowIndexes.length>1&&(h=!1);var p=!1;if(a.selectionModule&&a.selectionSettings.persistSelection){var u=a.selectionModule.getSelectedRecords().length;if(a.selectionSettings.persistSelection&&1===u)for(d=0;d<u;d++){-1===(w=a.currentViewData.indexOf(a.selectionModule.getSelectedRecords()[d]))&&(p=!0)}p&&(h=!1)}var c=this.toolbar?this.toolbar.items:[],g=[o+"_add",o+"_edit",o+"_delete",o+"_update",o+"_cancel",o+"_indent",o+"_outdent"],f="ResourceView"===this.parent.viewType&&0!==(0,e.getValue)("data.level",t)||"ProjectView"===this.parent.viewType;if((0,e.isNullOrUndefined)(this.parent.editModule))n.push(o+"_delete"),n.push(o+"_add"),n.push(o+"_edit"),n.push(o+"_update"),n.push(o+"_cancel"),n.push(o+"_indent"),n.push(o+"_outdent");else{var m=!!a.editModule.taskbarEditModule&&a.editModule.taskbarEditModule.touchEdit,y=a.flatData&&a.flatData.length;s.allowAdding&&!m?r.push(o+"_add"):n.push(o+"_add"),s.allowEditing&&f&&y&&h&&!m?r.push(o+"_edit"):n.push(o+"_edit"),s.allowEditing&&0!==l&&-1!==l&&y&&h&&"ResourceView"!==this.parent.viewType?(0,e.isNullOrUndefined)(a.updatedRecords[l])||0!==a.updatedRecords[l].level||!y||m?(i=a.updatedRecords[l-1],(0,e.isNullOrUndefined)(a.updatedRecords[l])||a.updatedRecords[l].level-i.level!==1||-1===l?-1!==l&&(r.push(o+"_indent"),r.push(o+"_outdent")):(n.push(o+"_indent"),r.push(o+"_outdent"))):(r.push(o+"_indent"),n.push(o+"_outdent")):(n.push(o+"_indent"),n.push(o+"_outdent"));var D=!!a.selectionModule&&(a.selectionModule.getSelectedRecords().length>0||a.selectionModule.getSelectedRowCellIndexes().length>0);if(a.selectionModule&&a.selectionSettings.persistSelection){p&&(D=!1);var v=(u=a.selectionModule.getSelectedRecords()).length;if(a.selectionSettings.persistSelection&&v>1)for(d=0;d<v;d++){if((w=a.currentViewData.indexOf(u[d]))>-1){D=!0;break}D=!1}}if(s.allowDeleting&&y&&D&&!m?r.push(o+"_delete"):n.push(o+"_delete"),"Auto"===a.editSettings.mode&&!(0,e.isNullOrUndefined)(a.editModule.cellEditModule)&&a.editModule.cellEditModule.isCellEdit){(r=[]).push(o+"_update",o+"_cancel"),n=[];for(var k=0;k<c.length;k++)c[k].id!==o+"_update"&&c[k].id!==o+"_cancel"&&-1!==g.indexOf(c[k].id)&&n.push(c[k].id)}else{n.push(o+"_update",o+"_cancel");for(k=0;k<c.length;k++)-1===r.indexOf(c[k].id)&&-1===n.indexOf(c[k].id)&&r.push(c[k].id)}}for(var b=0;b<r.length;b++){var w=void 0;for(k=0;k<c.length;k++)if(c[k].id===r[b]){w=k;break}c.length>0&&!(0,e.isNullOrUndefined)(c[w])&&c[w].properties.visible&&this.toolbar.hideItem(w,!1)}for(var T=0;T<n.length;T++){for(w=void 0,k=0;k<c.length;k++)if(c[k].id===n[T]){w=k;break}c.length>0&&this.toolbar.hideItem(w,!0)}},t.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)}},t.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(),(0,e.remove)(this.element))},t}(),qi=function(){function t(e){this.weekendWidthUpdated=!1,this.parent=e,this.nonworkingContainer=null,this.holidayContainer=null,this.weekendContainer=null}return t.prototype.createNonworkingContainer=function(){this.parent.ganttChartModule.chartBodyContent.contains(this.nonworkingContainer)||(this.nonworkingContainer=(0,e.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))},t.prototype.renderHolidays=function(){var t=this;if(this.parent.holidays&&this.parent.holidays.length>0){this.createNonworkingContainer(),this.nonworkingContainer.contains(this.holidayContainer)||(this.holidayContainer=(0,e.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(e){t.holidayContainer.appendChild(e.cloneNode(!0))})}else this.holidayContainer&&this.holidayContainer.parentNode&&((0,e.remove)(this.holidayContainer),this.nonworkingContainer&&0===this.nonworkingContainer.childNodes.length&&(0,e.remove)(this.nonworkingContainer))},t.prototype.getHolidaysElement=function(){var t,i,a=(0,e.createElement)("div"),r=this.parent.contentHeight,n=0;(0,e.isNullOrUndefined)(this.parent.toolbarModule)||(0,e.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?(t=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[o].from),(i=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[o].to)).setDate(i.getDate()+1),t.setHours(0,0,0,0),i.setHours(0,0,0,0)):this.parent.holidays[o].from?(t=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[o].from)).setHours(0,0,0,0):this.parent.holidays[o].to&&(t=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(t,i):this.parent.perDayWidth,d=this.parent.dataOperation.getTaskLeft(t,!1,!0),h=this.parent.enableRtl?"right:"+d+"px;":"left:"+d+"px;",p=(0,e.createElement)("div",{className:"e-holiday",styles:h+" width:"+l+"px; height:100%;"}),u=s<r?s/2:r/2,c=(0,e.createElement)("span",{className:ke,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]=e.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},t.prototype.renderWeekends=function(){var t=this;if(this.parent.highlightWeekends&&this.parent.timelineSettings.showWeekend){this.createNonworkingContainer(),this.nonworkingContainer.contains(this.weekendContainer)||(this.weekendContainer=(0,e.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(e){t.weekendContainer.appendChild(e.cloneNode(!0))})}else this.weekendContainer&&((0,e.remove)(this.weekendContainer),this.weekendContainer=null,this.nonworkingContainer&&0===this.nonworkingContainer.childNodes.length&&((0,e.remove)(this.nonworkingContainer),this.nonworkingContainer=null))},t.prototype.getWeekendElements=function(){var t=(0,e.createElement)("div"),i=this.parent.enableTimelineVirtualization&&0!==this.parent.ganttChartModule.scrollObject.element.scrollLeft?this.parent.ganttChartModule.scrollObject.getTimelineLeft():null,a=this.parent.enableTimelineVirtualization&&!(0,e.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=(0,e.createElement)("div",{className:"e-weekend",styles:D+" width:"+h+"px;height:100%;"});t.appendChild(v)}a.setDate(a.getDate()+1),a.setHours(0,0,0,0)}while(a<r);return t},t.prototype.updateHolidayLabelHeight=function(){var t=this.parent.getContentHeight(),i=document.getElementById(this.parent.element.id),a=0;(0,e.isNullOrUndefined)(this.parent.toolbarModule)||(0,e.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<t?r/2:t/2,s=this.holidayContainer.querySelectorAll("."+ke),o=0;o<s.length;o++)s[o].style.top=(0,e.formatUnit)(n)},t.prototype.updateContainerHeight=function(){var t=this.parent.getContentHeight();this.holidayContainer&&(this.holidayContainer.style.height=(0,e.formatUnit)(t),this.updateHolidayLabelHeight()),this.weekendContainer&&(this.weekendContainer.style.height=(0,e.formatUnit)(t))},t.prototype.removeContainers=function(){this.holidayContainer&&(0,e.remove)(this.holidayContainer),this.weekendContainer&&((0,e.remove)(this.weekendContainer),this.weekendContainer=null),this.nonworkingContainer&&((0,e.remove)(this.nonworkingContainer),this.nonworkingContainer=null)},t}(),Gi=function(){function t(e){this.parent=e,this.eventMarkersContainer=null}return t.prototype.renderEventMarkers=function(){this.parent.eventMarkers&&this.parent.eventMarkers.length>0?(this.parent.ganttChartModule.chartBodyContent.contains(this.eventMarkersContainer)||(this.eventMarkersContainer=(0,e.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()},t.prototype.removeContainer=function(){this.eventMarkersContainer&&((0,e.remove)(this.eventMarkersContainer),this.eventMarkersContainer=null)},t.prototype.getEventMarkersElements=function(t){for(var i,a,r,n,s=[],o=0;o<this.parent.eventMarkers.length;o++)if(!(0,e.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=(0,e.createElement)("div",{className:"e-event-markers",styles:l+"  height:100%;",id:"stripline"+o}),this.parent.eventMarkers[o].label){r=(0,e.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]=e.SanitizeHtmlHelper.sanitize(r[d])),this.parent.enableRtl?r.style.right="5px":r.style.left="5px",a.appendChild(r),n=(0,e.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),t.appendChild(a)}this.parent.eventMarkerColloction=s},t.prototype.updateContainerHeight=function(){this.eventMarkersContainer&&(this.eventMarkersContainer.style.height=(0,e.formatUnit)(this.parent.getContentHeight()))},t}(),_i=function(){function t(e){this.parent=e,this.nonworkingDayRender=new qi(this.parent),this.eventMarkerRender=new Gi(this.parent),this.wireEvents()}return t.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)},t.prototype.propertyChanged=function(t){for(var i=Object.keys((0,e.getValue)("properties",t)),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()}}},t.prototype.refreshMarkers=function(){this.nonworkingDayRender.renderWeekends(),this.nonworkingDayRender.renderHolidays(),"Vertical"!==this.parent.gridLines&&"Both"!==this.parent.gridLines||this.parent.renderChartVerticalLines(),this.eventMarkerRender.renderEventMarkers()},t.prototype.updateHeight=function(){this.nonworkingDayRender.updateContainerHeight(),this.eventMarkerRender.updateContainerHeight(),this.parent.ganttChartModule.scrollObject.updateTopPosition()},t.prototype.getModuleName=function(){return"dayMarkers"},t.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))},t}(),Zi=function(){function t(e){this.validatedids=[],this.resourceCollectionIds=[],this.criticalTasks=[],this.parent=e}return t.prototype.getCriticalTasks=function(){return this.criticalTasks},t.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,r=this.parent.treeGrid.parentData,n=r[0].ganttProperties.endDate,s=0,o=[],l=[],d=[],h=0,p=[],u=[],c=[],g=[],f=[];this.criticalTasks=[],r[0].ganttProperties.autoEndDate>r[0].ganttProperties.endDate&&!r[0].ganttProperties.isAutoSchedule&&(n=r[0].ganttProperties.autoEndDate);for(var m=1;m<r.length;m++)r[m].ganttProperties.endDate>=n&&(n=r[m].ganttProperties.endDate),r[m].ganttProperties.isAutoSchedule||r[m].ganttProperties.autoEndDate>=n&&(n=r[m].ganttProperties.autoEndDate);this.maxEndDate=n;for(var y=0;y<i.length;y++)i[y].isCritical=!1,i[y].ganttProperties.isCritical=!1,s=this.parent.dataOperation.getDuration(i[y].ganttProperties.endDate,n,i[y].ganttProperties.durationUnit,i[y].ganttProperties.isAutoSchedule,i[y].ganttProperties.isMilestone),i[y].slack=s+" "+i[y].ganttProperties.durationUnit,i[y].ganttProperties.slack=s+" "+i[y].ganttProperties.durationUnit,i[y].ganttProperties.endDate>=n&&o.push(i[y].ganttProperties.taskId),i[y].ganttProperties.predecessor&&0!==i[y].ganttProperties.predecessor.length&&(l.push(i[y]),d.push(i[y].ganttProperties.taskId));if("ResourceView"===this.parent.viewType)for(m=0;m<this.parent.taskIds.length;m++)this.resourceCollectionIds[m]=this.parent.taskIds[m].slice(1);for(var D=function(e){if(-1===d.indexOf(o[e])){if("ProjectView"===v.parent.viewType)h=t.indexOf(o[e].toString());else for(var a=v.parent.currentViewData.filter(function(t){return parseInt(t.ganttProperties.taskId,10)===o[e]}),r=0;r<a.length;r++)!a[r].hasChildRecords&&a[r].ganttProperties.endDate>=v.maxEndDate&&(h=a[r].index);i[h].ganttProperties.progress<100&&(i[h].isCritical=!0,i[h].ganttProperties.isCritical=!0),i[h].slack="0 "+i[h].ganttProperties.durationUnit,p.push(o[e])}else u.push(o[e])},v=this,k=0;k<o.length;k++)D(k);for(var b=l.length,w=[],T=0;T<b;T++){for(var S=-1,P=-1,C=-1,R=-1,M=T,x=l[T].ganttProperties.predecessor,O=l[T].ganttProperties.predecessor.length,I=l[T].ganttProperties.taskId,E=0;E<O;E++)(isNaN(Number(x[E].from))||"string"==typeof I?(isNaN(Number(x[E].from)),x[E].from):parseInt(x[E].from,10))===I&&(-1===S?x[E].offset?(S=x[E].to+":"+x[E].offset+x[E].offsetUnit,C=x[E].type):(S=x[E].to,C=x[E].type):x[E].offset?(S=S+","+x[E].to+":"+x[E].offset+x[E].offsetUnit,C=C+","+x[E].type):(S=S+","+x[E].to,C=C+","+x[E].type)),(isNaN(Number(x[E].to))||"string"==typeof I?(isNaN(Number(x[E].to)),x[E].to):parseInt(x[E].to,10))===I&&(-1===P?x[E].offset?(P=x[E].from+":"+x[E].offset+x[E].offsetUnit,R=x[E].type):(P=x[E].from,R=x[E].type):x[E].offset?(P=P+","+x[E].from+":"+x[E].offset+x[E].offsetUnit,R=R+","+x[E].type):(P=P+","+x[E].from,R=R+","+x[E].type));-1===P&&(P=null,R=null),-1===S&&(S=null,C=null),c.push({from:P,fromPredecessor:R,taskid:I,to:S,toPredecessor:C,currentIndex:M,slack:null,enddate:null}),g.push(I)}for(var F=c.length,U=0,N=void 0,L=0;L<F;L++)if(!c[L].to){N=c[L].taskid,U="ProjectView"===this.parent.viewType?t.indexOf(N.toString()):this.resourceCollectionIds.indexOf(N.toString());var V=i[U].ganttProperties;s=this.parent.dataOperation.getDuration(V.endDate,n,"minute",V.isAutoSchedule,V.isMilestone),c[L].slack=s,c[L].fs=-1,c[L].enddate=V.endDate,w.push({fromdata:c[L].from,todateID:c[L].taskid,fromDataPredecessor:c[L].fromPredecessor})}var B={};for(k=0;k<w.length;k++)f.push(w[k]),this.slackCalculation(f,c,g,n,i,t,B);a=this.finalCriticalPath(c,p,i,t,n),this.validatedids=[],this.criticalPathCollection=a,this.detailPredecessorCollection=c,this.predecessorCollectionTaskIds=g}if(!1===e&&this.parent.flatData.length>0){var A=void 0;this.parent.enableCriticalPath=!1;for(L=0;L<this.criticalPathCollection.length;L++)A=t.indexOf(this.criticalPathCollection[L].toString()),i[A].isCritical=!1;this.criticalPathCollection=[],this.detailPredecessorCollection=[],this.predecessorCollectionTaskIds=[]}},t.prototype.slackCalculation=function(t,i,a,r,n,s,o){var l=t[0].fromdata.split(","),d=t[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(t[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(t[0].todateID.toString())):(p=this.resourceCollectionIds.indexOf(D[0].toString()),u=this.resourceCollectionIds.indexOf(t[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),(0,e.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),(0,e.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]),((0,e.isNullOrUndefined)(i[h].slack)||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]),(0,e.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?(0,e.isNullOrUndefined)(i[h].slack)?(D.length<=1?(0,e.isNullOrUndefined)(i[c].to)?(g=this.getSlackDuration(w.endDate,r,"minute",n[p]),i[h].slack=g):(0,e.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?((0,e.isNullOrUndefined)(i[c].to)?g=this.getSlackDuration(w.endDate,r,"minute",n[p]):(0,e.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&&((0,e.isNullOrUndefined)(i[c].to)?i[h].slack=g:(0,e.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]),((0,e.isNullOrUndefined)(i[h].slack)||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)}}},t.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)},t.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)))}},t.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(var h=l.length-1;h>=0;h--){var p=void 0;p="ProjectView"===this.parent.viewType?this.parent.ids.indexOf(l[h].to):this.resourceCollectionIds.indexOf(l[h].to);var u=void 0,c=i[n].ganttProperties;-1!==p&&("FS"===l[h].type?l[h].to!==c.taskId.toString()&&(l[h].to!==c.taskId.toString()||"ResourceView"===this.parent.viewType?u=this.parent.dataOperation.getDuration(c.endDate,i[p].ganttProperties.startDate,c.durationUnit,c.isAutoSchedule,c.isMilestone):-1!==(p=this.parent.ids.indexOf(l[h].from))&&0===(u=this.parent.dataOperation.getDuration(i[p].ganttProperties.endDate,c.startDate,c.durationUnit,c.isAutoSchedule,c.isMilestone))&&n!==p&&i[n].slack===d&&(i[p].slack=i[n].slack,i[p].ganttProperties.slack=i[n].slack),-1!==p&&(0===u&&n!==p&&i[n].slack!==d?(i[n].slack=i[p].slack,i[n].ganttProperties.slack=i[p].slack):0!==u&&n!==p&&i[p].isCritical&&(i[n].slack=u+" "+i[n].ganttProperties.durationUnit,i[n].ganttProperties.slack=u+" "+i[n].ganttProperties.durationUnit))):u="SF"===l[h].type?this.parent.dataOperation.getDuration(c.startDate,i[p].ganttProperties.endDate,c.durationUnit,c.isAutoSchedule,c.isMilestone):"SS"===l[h].type?this.parent.dataOperation.getDuration(c.startDate,i[p].ganttProperties.startDate,c.durationUnit,c.isAutoSchedule,c.isMilestone):this.parent.dataOperation.getDuration(c.endDate,i[p].ganttProperties.endDate,c.durationUnit,c.isAutoSchedule,c.isMilestone),("number"==typeof i[n][this.parent.taskFields.id]?parseInt(l[h].from,10):l[h].from)===i[n][this.parent.taskFields.id]&&i[p].slack===d&&u<=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(h=0;h<t.length;h++)-1!==(n="ProjectView"===this.parent.viewType?a.indexOf(t[h].toString()):this.resourceCollectionIds.indexOf(t[h].toString()))&&i[n].ganttProperties.progress<100&&(this.criticalTasks.push(i[n]),-1===s.indexOf(t[h])&&(s=s.concat(t[h])));return s},t.prototype.criticalConnectorLine=function(t,i,a,r){this.parent.removeCriticalPathStyles();for(var n=function(i){var a;if("ProjectView"===s.parent.viewType)a=s.parent.flatData[s.parent.ids.indexOf(t[i].toString())];else for(var r=s.parent.flatData.filter(function(e){return e.ganttProperties.taskId.toString()===t[i].toString()}),n=0;n<r.length;n++)(r[n].ganttProperties.isCritical||r[n].ganttProperties.endDate>=s.maxEndDate)&&(a=r[n]);var o=s.parent.currentViewData.indexOf(a),l=s.parent.getRowByIndex(o),d=void 0,h=s.parent.taskFields;if(a&&a.parentItem){var p=s.parent.currentViewData.filter(function(e){return a.parentItem.uniqueID===e.uniqueID}),u=s.parent.flatData.indexOf(p[0]),c=s.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&&(0,e.addClass)(g[f].querySelectorAll(".e-gantt-child-taskbar-inner-div"),z)}d=s.parent.allowUnscheduledTasks&&a&&!a[h.startDate]&&!a[h.endDate]&&a[h.duration]?"e-gantt-critical-unscheduled-taskbar":q,l&&("ProjectView"===s.parent.viewType||"ResourceView"===s.parent.viewType&&!a.hasChildRecords)&&(l.getElementsByClassName("e-gantt-milestone")[0]&&(0,e.addClass)(l.querySelectorAll(".e-gantt-milestone"),G),l.getElementsByClassName("e-gantt-child-taskbar-inner-div").length>0&&(0,e.addClass)(l.querySelectorAll(".e-gantt-child-taskbar-inner-div"),z),l.getElementsByClassName("e-gantt-child-progressbar-inner-div").length>0&&(0,e.addClass)(l.querySelectorAll(".e-gantt-child-progressbar-inner-div"),d))},s=this,o=0;o<t.length;o++)n(o);if(0!==i.length){var l=0,d=void 0,h=[],p=void 0,u=void 0;for(o=0;o<this.criticalPathCollection.length;o++)if(d=i[l=r.indexOf(this.criticalPathCollection[o])],-1!==l&&d.to){h=d.to.split(",");for(var c=0;c<h.length;c++)if(u=h[c].split("+"),h[c].indexOf("-")>=0&&(u=h[c].split("-")),p=u[0].replace(":",""),"number"==typeof t[c]&&(p=parseInt(u[0],10)),-1!==t.indexOf(p)){var g=String(d.taskid),f=String(p);this.parent.element.querySelectorAll("#ConnectorLineparent"+g.replace(/([.])/g,"\\$1")+"child"+f.replace(/([.])/g,"\\$1")).length>0&&((0,e.addClass)(this.parent.element.querySelectorAll("#ConnectorLineparent"+g.replace(/([.])/g,"\\$1")+"child"+f.replace(/([.])/g,"\\$1"))[0].querySelectorAll(".e-connector-line"),Pe),(0,e.addClass)(this.parent.element.querySelectorAll("#ConnectorLineparent"+g.replace(/([.])/g,"\\$1")+"child"+f.replace(/([.])/g,"\\$1"))[0].querySelectorAll(".e-connector-line-arrow"),Ce))}}}},t.prototype.getModuleName=function(){return"criticalPath"},t.prototype.destroy=function(){!this.parent.enableCriticalPath&&this.parent.criticalPathModule&&(this.parent.criticalPathModule=void 0)},t}(),Xi=function(){return Xi=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Xi.apply(this,arguments)},Yi=function(){function t(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 t.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},t.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))},t.prototype.undoAction=function(){var t=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=(0,e.extend)({},{},this.parent.currentZoomingLevel,!0);else if("NextTimeSpan"===i.action||"PreviousTimeSpan"===i.action)a.action=i.action,a.previousTimelineStartDate=(0,e.extend)([],[this.parent.timelineModule.timelineStartDate],[],!0)[0],a.previousTimelineEndDate=(0,e.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=Xi({},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=(0,e.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((0,e.extend)([],[],[this.parent.getRecordByID(i.afterDrop.data[n].ganttProperties.taskId)],!0)[0]):s.data.push((0,e.extend)([],[],[this.parent.flatData[this.getResourceViewRowIndex(i.afterDrop.data[n])]],!0)[0]);s.dropRecord=(0,e.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=(0,e.extend)([],[],[this.parent.flatData[this.parent.ids.indexOf(i.droppedRecord.ganttProperties.taskId.toString())]],!0)[0],a.modifiedRecord=[],this.findPosition((0,e.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((0,e.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"),(0,e.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(e){var i=t.parent.connectorLineModule.getRecordByID(e.to);if(i){i.ganttProperties.predecessor.push(e);var a=t.parent.predecessorModule.getPredecessorStringValue(i);i.ganttProperties.predecessorsName=a}}),this.parent.addRecord(i.deletedRecordsDetails[n].data,y,m)}else if("Add"===i.action){var v=(0,e.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&&!(0,e.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=(0,e.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)},t.prototype.redoAction=function(){if(this.getRedoCollection.length>0){var t=this.getRedoCollection[this.getRedoCollection.length-1],i={};if("ZoomIn"===t.action||"ZoomOut"===t.action||"ZoomToFit"===t.action)i.action=t.action,i.previousZoomingLevel=(0,e.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"===t.action||"PreviousTimeSpan"===t.action)i.action=t.action,i.previousTimelineStartDate=(0,e.extend)([],[this.parent.timelineModule.timelineStartDate],[],!0)[0],i.previousTimelineEndDate=(0,e.extend)([],[this.parent.timelineModule.timelineEndDate],[],!0)[0];else if("Sorting"===t.action)i.action="Sorting",i.sortColumns=(0,e.extend)([],this.parent.sortSettings.columns,[],!0);else if("Filtering"===t.action)i.action="Filtering",i.filteredColumns=t.filteredColumns;else if("ColumnReorder"===t.action)i.action=t.action,i.toColumn=t.fromColumn,i.fromColumn=t.toColumn,i.fromIndex=t.toIndex,i.toIndex=t.fromIndex;else if("Search"===t.action)i.action=t.action,i.searchString=(0,e.extend)([],[this.parent.searchSettings.key],[],!0)[0];else if("ColumnState"===t.action)i.action=t.action,i.showhideColumns=t.showhideColumns;else if("ColumnResize"===t.action)i.action=t.action,i.resizedColumn=Xi({},this.parent.treeGrid.columns[t.resizedColumn.index]);else if("RowDragAndDrop"===t.action||"TaskbarDragAndDrop"===t.action){for(var a=[],r=0;r<t.beforeDrop.length;r++)"ProjectView"===this.parent.viewType?a.push(this.parent.getRecordByID(t.beforeDrop[r].data.ganttProperties.taskId)):a.push(this.parent.flatData[this.getResourceViewRowIndex(t.beforeDrop[r].data)]);i.action=t.action,i.beforeDrop=[];var n={},s=void 0;t.afterDrop.dropRecord&&(s=(0,e.extend)([],[],[this.parent.getRecordByID(t.afterDrop.dropRecord.ganttProperties.taskId)],!0)[0]),n.data=[];for(r=0;r<t.afterDrop.data.length;r++)"ProjectView"===this.parent.viewType?n.data.push((0,e.extend)([],[],[this.parent.getRecordByID(t.afterDrop.data[r].ganttProperties.taskId)],!0)[0]):void 0!==t.afterDrop.data[r]&&n.data.push((0,e.extend)([],[],[this.parent.flatData[this.getResourceViewRowIndex(t.afterDrop.data[r])]],!0)[0]);n.dropRecord=(0,e.extend)([],[],[s],!0)[0],n.dropPosition=t.afterDrop.dropPosition,i.afterDrop=n,this.findPosition(a,i,"beforeDrop")}else if("Indent"===t.action||"Outdent"===t.action)i.selectedRowIndexes=t.selectedRowIndexes,i.droppedRecord=(0,e.extend)([],[],[this.parent.flatData[this.parent.ids.indexOf(t.droppedRecord.ganttProperties.taskId.toString())]],!0)[0],i.modifiedRecord=[],this.findPosition((0,e.extend)([],[],[this.parent.flatData[this.parent.ids.indexOf(t.modifiedRecord[0].data.ganttProperties.taskId.toString())]],!0),i,"modifiedRecord"),i.action=t.action;else if("Delete"===t.action)i.action="Delete",i.deletedRecordsDetails=[],this.findPosition((0,e.extend)([],[],t.deleteRecords,!0),i,"deletedRecordsDetails");else if("Add"===t.action)i.action="Add",i.addedRecords=[t.deletedRecordsDetails[0].data];else{i.action=t.action,i.modifiedRecords=[];for(r=0;r<t.modifiedRecords.length;r++){var o=this.findTaskRowIndex(t.modifiedRecords[r].ganttProperties.taskId.toString());i.modifiedRecords.push((0,e.extend)([],[this.parent.flatData[o]],[],!0)[0])}}if(this.getUndoCollection.push(i),this.isUndoRedoPerformed=!0,this.currentAction=t,"ZoomIn"===t.action||"ZoomOut"===t.action||"ZoomToFit"===t.action)"ZoomToFit"===t.action?this.parent.fitToProject():(this.parent.timelineSettings.timelineViewMode=t.previousZoomingLevel.timelineViewMode,this.parent.timelineSettings.timelineUnitSize=t.previousZoomingLevel.timelineUnitSize,this.parent.timelineSettings.updateTimescaleView=t.previousZoomingLevel.updateTimescaleView,this.parent.timelineSettings.topTier.unit=t.previousZoomingLevel.topTier.unit,this.parent.timelineSettings.topTier.count=t.previousZoomingLevel.topTier.count,this.parent.timelineSettings.topTier.format=t.previousZoomingLevel.topTier.format,this.parent.timelineSettings.bottomTier.unit=t.previousZoomingLevel.bottomTier.unit,this.parent.timelineSettings.bottomTier.count=t.previousZoomingLevel.bottomTier.count,this.parent.timelineSettings.bottomTier.format=t.previousZoomingLevel.bottomTier.format,this.parent.timelineSettings.weekStartDay=t.previousZoomingLevel.weekStartDay,this.parent.timelineSettings.weekendBackground=t.previousZoomingLevel.weekendBackground,this.isZoomingUndoRedoProgress=!0),this.isUndoRedoPerformed=!1;else if("NextTimeSpan"===t.action||"PreviousTimeSpan"===t.action)this.parent.updateProjectDates(t.previousTimelineStartDate,t.previousTimelineEndDate,!1),this.isUndoRedoPerformed=!1;else if("Sorting"===t.action)if(this.isFromUndoRedo=!0,this.sortedColumnsLength=0,0===t.sortColumns.length)this.parent.clearSorting();else for(r=0;r<t.sortColumns.length;r++)this.parent.treeGrid.sortByColumn(t.sortColumns[r].field,t.sortColumns[r].direction,t.sortColumns.length>1);else if("ColumnState"===t.action){this.isFromUndoRedo=!0;for(r=0;r<t.showhideColumns.length;r++)t.showhideColumns[r].visible?this.parent.hideColumn(t.showhideColumns[r].field,"field"):this.parent.showColumn(t.showhideColumns[r].field,"field");this.isUndoRedoPerformed=!1}else if("Filtering"===t.action)for(var l=0;l<t.filteredColumns.length;l++)this.isFromUndoRedo=!0,this.parent.filterByColumn(t.filteredColumns[l].field,t.filteredColumns[l].operator,t.filteredColumns[l].value,t.filteredColumns[l].predicate,t.filteredColumns[l].matchCase,t.filteredColumns[l].ignoreAccent);else if("ColumnReorder"===t.action){this.isFromUndoRedo=!0;var d=this.parent.treeGrid.columns[t.fromIndex].field,h=this.parent.treeGrid.columns[t.toIndex].field;this.parent.reorderColumns(d,h)}else if("Search"===t.action)this.isFromUndoRedo=!0,this.parent.search(t.searchString);else if("ColumnResize"===t.action)this.parent.treeGrid.columns[t.resizedColumn.index].width=t.resizedColumn.width,this.parent.treeGrid.refreshColumns();else if("RowDragAndDrop"===t.action||"TaskbarDragAndDrop"===t.action)for(r=0;r<t.beforeDrop.length;r++){var p=this.findTaskRowIndex(t.beforeDrop[r].data.ganttProperties.taskId.toString()),u=this.findTaskRowIndex(t.beforeDrop[r].id.toString());this.parent.reorderRows([p],u,t.beforeDrop[r].position)}else if("Indent"===t.action||"Outdent"===t.action)this.parent.selectRow(t.selectedRowIndexes[0]),"Indent"===t.action&&this.parent.indent(),"Outdent"===t.action&&this.parent.outdent();else if("Delete"===t.action){var c=(0,e.extend)([],[this.parent.editSettings.showDeleteConfirmDialog],[],!0)[0];this.parent.editSettings.showDeleteConfirmDialog=!1,this.parent.deleteRecord(t.deleteRecords),this.parent.editSettings.showDeleteConfirmDialog=c}else if("Add"===t.action)if("ResourceView"===this.parent.viewType&&t.deletedRecordsDetails.length>1)this.parent.editModule.addRecord((0,e.extend)([],[],t.deletedRecordsDetails,!0));else for(r=0;r<t.deletedRecordsDetails.length;r++){var g=this.findTaskRowIndex(t.deletedRecordsDetails[r].id.toString()),f=void 0;"above"===t.deletedRecordsDetails[r].position&&(f="Above"),"below"===t.deletedRecordsDetails[r].position&&(f="Below"),"child"===t.deletedRecordsDetails[r].position&&(f="Child"),"bottom"===t.deletedRecordsDetails[r].position&&(f="Bottom"),this.parent.editModule.addRecord(t.deletedRecordsDetails[r].data,f,g)}else this.parent.updateRecordByID(t.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))}},t.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})},t.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},t.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++)},t.prototype.disableRedo=function(){this.redoEnabled=!1,this.getRedoCollection=[],this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_redo"],!1)},t.prototype.findPosition=function(t,i,a){for(var r=function(r){var s={};if(s.data=t[r],"ProjectView"===n.parent.viewType)if(!t[r].hasChildRecords&&t[r].parentItem)if((p=n.parent.getRecordByID(t[r].parentItem.taskId)).childRecords.length>1){var o=n.parent.ids.indexOf(t[r].ganttProperties.taskId.toString());if((w=n.parent.flatData[o-1]).parentItem&&w.parentItem.taskId.toString()===p.ganttProperties.taskId.toString())s.position="below",s.id=(0,e.extend)([],[n.parent.flatData[n.parent.ids.indexOf(t[r].ganttProperties.taskId.toString())-1].ganttProperties.taskId],[],!0)[0];else{s.position="above";var l=n.parent.flatData[n.parent.ids.indexOf(t[r].ganttProperties.taskId.toString())+1],d=n.parent.ids.indexOf(t[r].ganttProperties.taskId.toString())+1,h=r;do{!(P=t[h+1])||P&&l.ganttProperties.taskId.toString()!==P.ganttProperties.taskId.toString()?l&&l.parentItem?s.id=(0,e.extend)([],[l.ganttProperties.taskId],[],!0)[0]:(s.id=(0,e.extend)([],[t[r].parentItem.taskId],[],!0)[0],s.position="child"):(h++,d++,l=n.parent.flatData[d])}while(!s.id)}}else s.position="child",s.id=(0,e.extend)([],[p.ganttProperties.taskId],[],!0)[0];else if(t[r].hasChildRecords||t[r].parentItem){if(t[r].hasChildRecords&&!t[r].parentItem){for(m=void 0,l=void 0,y=void 0,D=0;D<n.parent.treeGrid.parentData.length;D++)if(n.parent.treeGrid.parentData[D].ganttProperties.taskId.toString()===t[r].ganttProperties.taskId.toString()){m=D,l=n.parent.treeGrid.parentData[D+1],y=D+1;break}if(-1!==m)if(0===m){s.position="above";h=r;do{!(P=t[h+1])||P&&l.ganttProperties.taskId.toString()!==P.ganttProperties.taskId.toString()?(l||(l=n.parent.treeGrid.parentData[m]),s.id=(0,e.extend)([],[l.ganttProperties.taskId],[],!0)[0]):(h++,y++,l=n.parent.treeGrid.parentData[y])}while(!s.id)}else s.position="below",s.id=(0,e.extend)([],[n.parent.treeGrid.parentData[m-1].ganttProperties.taskId],[],!0)[0]}else if(t[r].hasChildRecords&&t[r].parentItem){var p,u=(p=n.parent.getRecordByID(t[r].parentItem.taskId)).childRecords,c=u.length,g=t[r].ganttProperties.taskId.toString();if(1===c)s.position="child",s.id=(0,e.extend)([],[p.ganttProperties.taskId],[],!0)[0];else{var f=u.findIndex(function(e){return e.ganttProperties.taskId.toString()===g});-1!==f&&(0===f?(s.position="above",s.id=u[1].ganttProperties.taskId):(s.position="below",s.id=u[f-1].ganttProperties.taskId))}}}else{n.parent.ids.indexOf(t[r].ganttProperties.taskId.toString())===n.parent.ids.length-1?s.position="below":s.position="above";for(var m=void 0,l=void 0,y=void 0,D=0;D<n.parent.treeGrid.parentData.length;D++)if(n.parent.treeGrid.parentData[D].ganttProperties.taskId.toString()===t[r].ganttProperties.taskId.toString()){m=D,l=n.parent.treeGrid.parentData[D+1],y=D+1;break}var h=r;do{!(P=t[h+1])||P&&l.ganttProperties.taskId.toString()!==P.ganttProperties.taskId.toString()?(l||(l=n.parent.treeGrid.parentData[m-1])||(l=n.parent.treeGrid.parentData[m]),s.id=(0,e.extend)([],[l.ganttProperties.taskId],[],!0)[0]):(h++,y++,l=n.parent.treeGrid.parentData[y])}while(!s.id)}else if(t[r].parentItem){var v=void 0;if(1===(v=t[r].parentItem.index?n.parent.flatData[t[r].parentItem.index]:n.parent.flatData[n.parent.ids.indexOf(t[r].parentItem.taskId)]).childRecords.length)s.position="child",s.id="R"+v.ganttProperties.taskId,"deletedIndexes"===a&&(s.position="child",s.index=v.index);else{for(var k=void 0,b=0;b<v.childRecords.length;b++)if(v.childRecords[b].ganttProperties.taskId.toString()===t[r].ganttProperties.taskId.toString()){k=b;break}var w;if((w=v.childRecords[k-1])&&w.parentItem&&w.parentUniqueID===v.uniqueID)s.position="below",s.id=(0,e.extend)([],["T"+n.parent.flatData[n.parent.taskIds.indexOf("T"+t[r].ganttProperties.taskId.toString())-1].ganttProperties.taskId],[],!0)[0],"deletedIndexes"===a&&(s.index=n.parent.taskIds.indexOf("T"+t[r].ganttProperties.taskId.toString())-1);else{d=void 0;if(k!==v.childRecords.length-1){s.position="above",0===k&&v.childRecords[1]?d=v.childRecords[1].index:v.childRecords[k-1]&&(d=v.childRecords[k-1].index);l=n.parent.flatData[d],o=d,h=r;do{!(P=t[h+1])||P&&l.ganttProperties.taskId.toString()!==P.ganttProperties.taskId.toString()?l&&l.parentItem?(s.id=(0,e.extend)([],["T"+l.ganttProperties.taskId],[],!0)[0],"deletedIndexes"===a&&(s.index=(0,e.extend)([],[l.index],[],!0)[0],0===k&&v.childRecords[1].ganttProperties.taskId===l.ganttProperties.taskId&&(s.index=s.index-1))):(s.id=(0,e.extend)([],["R"+t[r].parentItem.taskId],[],!0)[0],s.position="child","deletedIndexes"===a&&(s.index=t[r].parentItem.index)):(h++,o++,l=n.parent.flatData[o])}while(!s.id)}else k===v.childRecords.length-1?s.position="below":s.position="above",s.id="T"+v.childRecords[k-1].ganttProperties.taskId,"deletedIndexes"===a&&(s.index=v.childRecords[k-1].index)}}}else{var T=n.parent.treeGrid.parentData.filter(function(e){return e.ganttProperties.taskId===t[r].ganttProperties.taskId})[0],S=n.parent.treeGrid.parentData.indexOf(T);if(0===S){s.position="above";for(l=void 0,y=void 0,D=0;D<n.parent.treeGrid.parentData.length;D++)if(n.parent.treeGrid.parentData[D].ganttProperties.taskId===t[r].ganttProperties.taskId){l=n.parent.treeGrid.parentData[D+1],y=D+1;break}h=r;do{var P;!(P=t[h+1])||P&&l.ganttProperties.taskId!==P.ganttProperties.taskId?(s.id="R"+l.ganttProperties.taskId,"deletedIndexes"===a&&(s.index=l.index)):(h++,y++,l=n.parent.treeGrid.parentData[y])}while(!s.id)}else s.position="below",s.id="R"+n.parent.treeGrid.parentData[S-1].ganttProperties.taskId,"deletedIndexes"===a&&(s.index=n.parent.treeGrid.parentData[S-1].index)}if("deletedIndexes"===a){var C=n.parent.getTaskByUniqueID(s.data.parentUniqueID);if(0===n.parent.editModule.dialogModule.ganttResources.length&&-1===i[a].indexOf(s))i[a].push(s);else for(b=0;b<n.parent.editModule.dialogModule.ganttResources.length;b++)n.parent.editModule.dialogModule.ganttResources[b][n.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=this,s=0;s<t.length;s++)r(s)},t.prototype.getModuleName=function(){return"undoRedo"},t.prototype.destroy=function(){!this.parent.enableUndoRedo&&this.parent.undoRedoModule&&(this.parent.undoRedoModule=void 0)},t}(),Ki=function(){function t(t){var i=this;this.segmentIndex=-1,this.isCntxtMenuDependencyDelete=!1,this.headerContextMenuClick=function(t){var a=(0,e.closest)(t.event.target,".e-row"),r=(0,e.closest)(t.event.target,".e-chart-row");(0,e.isNullOrUndefined)(a)&&(0,e.isNullOrUndefined)(r)&&(t.type="Header",i.parent.trigger("contextMenuClick",t))},this.headerContextMenuOpen=function(t){var a=(0,e.closest)(t.event.target,".e-row"),r=(0,e.closest)(t.event.target,".e-chart-row");(0,e.isNullOrUndefined)(a)&&(0,e.isNullOrUndefined)(r)?(t.type="Header",i.parent.trigger("contextMenuOpen",t)):t.cancel=!0},this.parent=t,this.ganttID=t.element.id,$e.TreeGrid.Inject($e.ContextMenu),this.parent.treeGrid.contextMenuClick=this.headerContextMenuClick.bind(this),this.parent.treeGrid.contextMenuOpen=this.headerContextMenuOpen.bind(this),this.addEventListener(),this.resetItems()}return t.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))},t.prototype.reRenderContextMenu=function(t){t.module===this.getModuleName()&&t.enable&&(this.contextMenu&&(this.contextMenu.destroy(),(0,e.remove)(this.element)),this.resetItems(),this.render())},t.prototype.render=function(){this.element=this.parent.createElement("ul",{id:this.ganttID+"_contextmenu",className:I}),this.parent.element.appendChild(this.element);var e="#"+this.ganttID;this.contextMenu=new Ci.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},t.prototype.contextMenuItemClick=function(t){var i,a,r;this.item=this.getKeyFromId(t.item.id);var n=(0,e.getValue)("parentObj",t.item),s=-1;switch(t.type="Content",t.rowData=this.rowData,this.parent.trigger("contextMenuClick",t),n&&!(0,e.isNullOrUndefined)(n.id)&&"DeleteDependency"===this.getKeyFromId(n.id)&&(s=n.items.indexOf(t.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":(0,e.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((0,e.isNullOrUndefined)(this.rowData))0===this.parent.flatData.length&&this.parent.addRecord();else if(i=this.item,(a=(0,e.extend)({},{},this.rowData.taskData,!0))[(r=this.parent.taskFields).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),(0,e.isNullOrUndefined)(r.dependency)||(a[r.dependency]=null),!(0,e.isNullOrUndefined)(r.child)&&a[r.child]&&delete a[r.child],!(0,e.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((0,e.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(!(0,e.isNullOrUndefined)(this.rowData)){if(a=(0,e.extend)({},{},this.rowData.taskData,!0),r=this.parent.taskFields,(0,e.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)}(0,e.isNullOrUndefined)(a[r.milestone])||!0===a[r.milestone]&&(a[r.milestone]=!1);var f=(0,e.isNullOrUndefined)(this.rowData.ganttProperties.taskType)?this.parent.taskType:this.rowData.ganttProperties.taskType;"FixedWork"!==f&&"FixedUnit"!==f||(this.parent.dataOperation.updateWorkWithDuration(this.rowData),(0,e.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(t)}},t.prototype.splitTaskCall=function(t){var i=this;this.isEdit=!0;var a=this.parent.taskFields,r=this.getClickedDate(t.element);(0,e.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))})},t.prototype.mergeCall=function(t){var i=this;this.isEdit=!0;var a=this.parent.taskFields,r=this.rowData.ganttProperties.segments,n=[{firstSegmentIndex:"Right"===t?this.segmentIndex:r[this.segmentIndex-1].segmentIndex,secondSegmentIndex:"Left"===t?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(t){!1===t.cancel&&((0,e.isNullOrUndefined)(i.parent.loadingIndicator)||"Shimmer"!==i.parent.loadingIndicator.indicatorType?i.parent.showSpinner():i.parent.showMaskRow(),i.parent.chartRowsModule.mergeTask(i.rowData[a.id],n))})},t.prototype.getClickedDate=function(t){var i,a,r;if(this.parent.enableRtl){var n=this.parent.element.getBoundingClientRect(),s=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,o=document.documentElement.clientLeft||document.body.clientLeft||0;i=n.left+s-o}else i=this.parent.getOffsetRect(this.parent.element).left;this.parent.enableRtl?(a=Math.abs(i+this.parent.ganttChartModule.chartElement.offsetWidth-this.rowData.ganttProperties.left-this.parent.ganttChartModule.scrollElement.scrollLeft),r=Math.abs(this.clickedPosition-a)):(a=i+this.parent.ganttChartModule.chartElement.offsetLeft+this.rowData.ganttProperties.left-this.parent.ganttChartModule.scrollElement.scrollLeft,r=this.clickedPosition-a);var l=Math.ceil(r/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(r*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,D=this.rowData.ganttProperties.startDate;return(0,e.isNullOrUndefined)(this.parent.timelineSettings.bottomTier)||"Hour"!==this.parent.timelineSettings.bottomTier.unit||(l=Math.ceil(r/this.parent.timelineSettings.timelineUnitSize),l-=1),(0,e.isNullOrUndefined)(this.parent.timelineSettings.bottomTier)||"Minutes"!==this.parent.timelineSettings.bottomTier.unit&&"Hour"!==this.parent.timelineSettings.bottomTier.unit?y=this.parent.dataOperation.getEndDate(D,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(r/this.parent.timelineSettings.timelineUnitSize),l-=1,y=this.parent.dataOperation.getEndDate(D,l,this.parent.timelineSettings.bottomTier.unit.toLocaleLowerCase(),this.rowData,!1)),y},t.prototype.contextMenuBeforeOpen=function(t){var a=this,r=t.event?t.event.target:this.parent.focusModule?this.parent.ganttChartModule.targetElement:this.parent.focusModule.getActiveElement();!(0,e.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(),(0,e.isNullOrUndefined)(t.element)||t.element.id!==this.parent.element.id+"_contextmenu"||(this.clickedPosition=(0,e.getValue)("event",t).clientX);var n=(0,e.closest)(r,".e-gantt-child-taskbar");n&&(this.targetElement=t.target=n),t.gridRow=(0,e.closest)(r,".e-row"),t.chartRow=(0,e.closest)(r,".e-chart-row");var s=(0,e.closest)(r,".e-gantt");if(!(0,e.closest)(r,Ve)&&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),((0,e.isNullOrUndefined)(t.gridRow)&&(0,e.isNullOrUndefined)(t.chartRow)||0===this.contentMenuItems.length)&&(((0,e.isNullOrUndefined)(t.parentItem)||(0,e.isNullOrUndefined)(s))&&(0,e.isNullOrUndefined)((0,e.closest)(r,".e-content"))?t.cancel=!0:t.cancel=!1),!t.cancel){var o=-1;t.gridRow?o=parseInt(t.gridRow.getAttribute("aria-rowindex"),0)-1:t.chartRow&&(o=parseInt(t.chartRow.getAttribute("aria-rowindex"),0)-1),this.parent.selectionModule&&this.parent.allowSelection&&!t.parentItem&&!(0,e.isNullOrUndefined)(t.chartRow)&&this.parent.selectionModule.selectRow(o),t.parentItem||(this.rowData=this.parent.ganttChartModule.getRecordByTarget(t.event));for(var l=0,d=t.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(t.rowData=this.rowData,t.type="Content",t.disableItems=this.disableItems,t.hideItems=this.hideItems,t.hideChildItems=[],!(0,e.isNullOrUndefined)(t.rowData)&&0===t.rowData.level&&"ResourceView"===this.parent.viewType)return void(t.cancel=!0);var p=new i.Deferred;return this.parent.trigger("contextMenuOpen",t,function(e){p.resolve(e),a.hideItems=e.hideItems,a.disableItems=e.disableItems,e.parentItem||e.hideItems.length!==e.items.length||(a.revertItemStatus(),e.cancel=!0),a.hideItems.length>0&&a.contextMenu.hideItems(a.hideItems),a.disableItems.length>0&&a.contextMenu.enableItems(a.disableItems,!1),t.hideChildItems.length>0&&a.contextMenu.hideItems(t.hideChildItems)}),p}},t.prototype.updateItemStatus=function(t,i,a){var r=this.getKeyFromId(t.id),n=(0,e.closest)(i,Ve),s=[],o=(0,e.closest)(i,".e-gantt-child-taskbar")||(0,e.closest)(i,"e-taskbar-right-resizer")||(0,e.closest)(i,"e-taskbar-left-resizer");if(n)"Save"!==r&&"Cancel"!==r&&this.hideItems.push(t.text);else switch(r){case"TaskInformation":this.parent.editSettings.allowEditing&&this.parent.editModule||this.updateItemVisibility(t.text),0===this.parent.flatData.length&&this.hideItems.push(t.text);break;case"Add":this.parent.editSettings.allowAdding&&this.parent.editModule||this.updateItemVisibility(t.text);break;case"Save":case"Cancel":this.hideItems.push(t.text);break;case"Convert":!(0,e.isNullOrUndefined)(this.rowData)&&this.rowData.hasChildRecords?this.hideItems.push(t.text):this.parent.editSettings.allowEditing&&this.parent.editModule?((0,e.isNullOrUndefined)(this.rowData)||this.rowData.ganttProperties.isMilestone?s.push(this.createItemModel(Le,"ToTask",this.getLocale("toTask"))):s.push(this.createItemModel(Le,"ToMilestone",this.getLocale("toMilestone"))),t.items=s):this.updateItemVisibility(t.text),0===this.parent.flatData.length&&this.hideItems.push(t.text);break;case"DeleteDependency":var l=this.getPredecessorsItems();(0,e.isNullOrUndefined)(this.rowData)||!this.rowData.hasChildRecords||this.parent.allowParentDependency?this.parent.editSettings.allowDeleting&&0!==l.length&&this.parent.editModule?l.length>0&&(t.items=l):this.updateItemVisibility(t.text):this.hideItems.push(t.text);break;case"DeleteTask":this.parent.editSettings.allowDeleting&&this.parent.editModule||this.updateItemVisibility(t.text),0===this.parent.flatData.length&&this.hideItems.push(t.text);break;case"TaskMode":"Custom"!==this.parent.taskMode?this.updateItemVisibility(t.text):(this.rowData.ganttProperties.isAutoSchedule?s.push(this.createItemModel(Le,"Manual",this.getLocale("manual"))):s.push(this.createItemModel(Le,"Auto",this.getLocale("auto"))),t.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(t.text)}else this.hideItems.push(t.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(t.text)}else this.hideItems.push(t.text);break;case"SplitTask":var g=!1,f=!1,m=this.parent.taskFields;(0,e.isNullOrUndefined)(this.parent.timelineSettings.bottomTier)||(g="Minutes"===this.parent.timelineSettings.bottomTier.unit,f="Hour"===this.parent.timelineSettings.bottomTier.unit),(this.parent.readOnly||!o||(0,e.isNullOrUndefined)(m.segments)||this.parent.updatedRecords[Number(a)].hasChildRecords||this.parent.updatedRecords[Number(a)].ganttProperties.duration<2&&!g&&!f)&&this.updateItemVisibility(t.text);break;case"MergeTask":this.parent.readOnly||!o?this.updateItemVisibility(t.text):this.mergeItemVisiblity(i,t)}},t.prototype.mergeItemVisiblity=function(t,i){var a=[],r=this.parent.taskFields,n=this.getClickedDate(t);this.segmentIndex=this.parent.chartRowsModule.getSegmentIndex(n,this.rowData);var s=this.rowData.ganttProperties.segments;!(0,e.isNullOrUndefined)(s)&&s.length>0?(0,e.isNullOrUndefined)(r.segments)&&-1===this.segmentIndex?this.updateItemVisibility(i.text):(0===this.segmentIndex?a.push(this.createItemModel(Le,"Right",this.getLocale("right"))):(this.segmentIndex===s.length-1||a.push(this.createItemModel(Le,"Right",this.getLocale("right"))),a.push(this.createItemModel(Le,"Left",this.getLocale("left")))),i.items=a):this.hideItems.push(i.text)},t.prototype.updateItemVisibility=function(t){!!(0,e.isNullOrUndefined)(this.parent.contextMenuItems)?this.hideItems.push(t):this.disableItems.push(t)},t.prototype.contextMenuOpen=function(t){this.isOpen=!0;var i=this.parent.args=t.element.querySelectorAll("li:not(.e-menu-hide):not(.e-disabled)")[0];(0,e.isNullOrUndefined)(i)||(0,e.addClass)([i],"e-focused")},t.prototype.getMenuItems=function(){for(var t=0,i=(0,e.isNullOrUndefined)(this.parent.contextMenuItems)?this.getDefaultItems():this.parent.contextMenuItems;t<i.length;t++){var a=i[t];"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},t.prototype.createItemModel=function(e,t,i,a){return{text:i,id:this.generateID(t),target:e,iconCss:a?"e-icons "+a:null}},t.prototype.getLocale=function(e){return this.parent.localeObj.getConstant(e)},t.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(Le,e,this.getLocale("taskInformation"),this.getIconCSS(Be,t));break;case"Indent":i=this.createItemModel(Le,e,this.getLocale("indent"),this.getIconCSS("e-indent",t));break;case"Outdent":i=this.createItemModel(Le,e,this.getLocale("outdent"),this.getIconCSS("e-outdent",t));break;case"Save":i=this.createItemModel(Be,e,this.getLocale("save"),this.getIconCSS("e-save",t));break;case"Cancel":i=this.createItemModel(Be,e,this.getLocale("cancel"),this.getIconCSS("e-cancel",t));break;case"Add":(i=this.createItemModel(Le,e,this.getLocale("add"),this.getIconCSS("e-add",t))).items=[],i.items.push(this.createItemModel(Le,"Above",this.getLocale("above"),this.getIconCSS("e-add-above",t))),i.items.push(this.createItemModel(Le,"Below",this.getLocale("below"),this.getIconCSS("e-add-below",t))),"ResourceView"!==this.parent.viewType&&i.items.push(this.createItemModel(Le,"Child",this.getLocale("child"))),i.items.push(this.createItemModel(Le,"Milestone",this.getLocale("milestone")));break;case"DeleteTask":i=this.createItemModel(Le,e,this.getLocale("deleteTask"),this.getIconCSS("e-delete",t));break;case"DeleteDependency":(i=this.createItemModel(Le,e,this.getLocale("deleteDependency"))).items=[],i.items.push({});break;case"Convert":(i=this.createItemModel(Le,e,this.getLocale("convert"))).items=[],i.items.push({});break;case"TaskMode":(i=this.createItemModel(Le,e,this.getLocale("changeScheduleMode"))).items=[],i.items.push({});break;case"SplitTask":i=this.createItemModel(Le,e,this.getLocale("splitTask"));break;case"MergeTask":(i=this.createItemModel(Le,e,this.getLocale("mergeTask"))).items=[],i.items.push({})}i&&this.contentMenuItems.push(i)},t.prototype.getIconCSS=function(t,i){return(0,e.isNullOrUndefined)(i)?t:i},t.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(Le,l,o),t.push(e)}return t},t.prototype.getDefaultItems=function(){return["AutoFitAll","AutoFit","TaskInformation","DeleteTask","Save","Cancel","SortAscending","SortDescending","Add","DeleteDependency","Convert","TaskMode","Indent","Outdent","SplitTask","MergeTask"]},t.prototype.getModuleName=function(){return"contextMenu"},t.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))},t.prototype.contextMenuOnClose=function(e){e.items.length>0&&e.items[0].parentObj instanceof Ci.ContextMenu&&this.revertItemStatus()},t.prototype.revertItemStatus=function(){this.contextMenu.showItems(this.hideItems),this.contextMenu.enableItems(this.disableItems),this.hideItems=[],this.disableItems=[],this.isOpen=!1},t.prototype.resetItems=function(){this.hideItems=[],this.disableItems=[],this.headerMenuItems=[],this.contentMenuItems=[],this.item=null},t.prototype.generateID=function(e){return this.ganttID+"_contextMenu_"+e},t.prototype.getKeyFromId=function(e){var t=this.ganttID+"_contextMenu_";return e.indexOf(t)>-1?e.replace(t,""):"Custom"},t.prototype.destroy=function(){this.contextMenu.destroy(),(0,e.remove)(this.element),this.removeEventListener(),this.contextMenu=null,this.element=null},t}(),Qi=function(){function t(e){this.parent=e,$e.TreeGrid.Inject($e.ExcelExport),this.parent.treeGrid.allowExcelExport=this.parent.allowExcelExport,this.bindEvents()}return t.prototype.getModuleName=function(){return"excelExport"},t.prototype.destroy=function(){},t.prototype.bindEvents=function(){var t=this;this.parent.treeGrid.beforeExcelExport=function(i){t.parent.trigger("beforeExcelExport",i),(0,e.isNullOrUndefined)(t.parent.loadingIndicator)||"Shimmer"!==t.parent.loadingIndicator.indicatorType?t.parent.showSpinner():t.parent.showMaskRow()},this.parent.treeGrid.excelQueryCellInfo=function(e){t.parent.trigger("excelQueryCellInfo",e)},this.parent.treeGrid.excelHeaderQueryCellInfo=function(e){t.parent.trigger("excelHeaderQueryCellInfo",e)},this.parent.treeGrid.excelExportComplete=function(i){t.parent.trigger("excelExportComplete",i),(0,e.isNullOrUndefined)(t.parent.loadingIndicator)||"Shimmer"!==t.parent.loadingIndicator.indicatorType?t.parent.hideSpinner():t.parent.hideMaskRow()}},t}(),$i=function(){function e(e){$e.TreeGrid.Inject($e.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}(),Ji=function(){function t(e){this.isTest=!1,this.updateParentRecords=[],this.isaddtoBottom=!1,this.updateCollection={},this.isSharedTask=!1,this.canDrop=!0,this.parent=e,$e.TreeGrid.Inject($e.RowDD),this.parent.treeGrid.allowRowDragAndDrop=this.parent.allowRowDragAndDrop,this.bindEvents()}return t.prototype.getModuleName=function(){return"rowDragAndDrop"},t.prototype.destroy=function(){},t.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)},t.prototype.rowDragStart=function(e){this.parent.trigger("rowDragStart",e),this.parent.element.style.position="relative"},t.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)}}},t.prototype.removeErrorElem=function(){var e=document.querySelector(".e-errorelem");e&&e.remove()},t.prototype.rowDrag=function(t){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&&(0,e.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=t.originalEvent.event.touches[0].clientX-l,n=t.originalEvent.event.touches[0].clientY-o):(r=(0,e.getValue)("event",t.originalEvent).clientX-l,n=(0,e.getValue)("event",t.originalEvent).clientY-o),s.style.left=r+20+"px",s.style.top=n+20+"px",this.parent.trigger("rowDrag",t)},t.prototype.rowDragStartHelper=function(e){this.parent.trigger("rowDragStartHelper",e),this.parent.readOnly&&(e.cancel=!0)},t.prototype.rowDrop=function(t){if(this.parent.isAdaptive){var i=document.querySelector(".e-ganttdrag");i&&i.remove()}var a=(0,e.closest)(t.target,".e-row");this.parent.oldRecords=(0,e.extend)([],[],t.data,!0);var r=a?parseInt(a.getAttribute("aria-rowindex"),10)-1:t.dropIndex;t.dropIndex=r,t.dropRecord=this.parent.updatedRecords[t.dropIndex],this.parent.trigger("rowDrop",t),"ResourceView"!==this.parent.viewType||this.validPosition(t,t.dropRecord)||(t.cancel=!0),t.cancel||(t.requestType="beforeDrop",this.parent.trigger("actionBegin",t),t.cancel?this.parent.hideLoadingIndicator():(this.parent.showLoadingIndicator(),this.dropRows(t,!0),t.cancel=!0))},t.prototype.validPosition=function(t,i){var a=i.level,r=(0,e.getValue)("level",t.data[0]),n=t.data[0];return this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&(n=this.parent.currentViewData[this.parent.undoRedoModule.getResourceViewRowIndex(n)]),!("middleSegment"===t.dropPosition&&(1===a||0===r)||"middleSegment"!==t.dropPosition&&(0===r&&1===a||1===r&&0===a)||(0,e.getValue)("parentItem",n)&&i.uniqueID===(0,e.getValue)("parentItem",n).uniqueID)},t.prototype.dropRows=function(t,i){if(!this.parent.readOnly){if(this.dropPosition=t.dropPosition,"Invalid"!==t.dropPosition&&this.parent.editModule){var a=this.parent;if(this.droppedRecord=a.updatedRecords[t.dropIndex],"ResourceView"===this.parent.viewType&&!this.validPosition(t,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()),!t.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=function(e){r.push(s.parent.flatData.filter(function(i){return t.data[e].ganttProperties.taskId===i.ganttProperties.taskId})[0])},s=this,o=0;o<t.data.length;o++)n(o);var l=(0,e.extend)([],[],r,!0),d={};t.name?d.action="RowDragAndDrop":d.action="TaskbarDragAndDrop",d.beforeDrop=[];var h={};h.dropRecord=(0,e.extend)([],[],[t.dropRecord?t.dropRecord:this.droppedRecord],!0)[0],h.data=(0,e.extend)([],[],t.data,!0),"middleSegment"===t.dropPosition?h.dropPosition="child":"topSegment"===t.dropPosition?h.dropPosition="above":"bottomSegment"===t.dropPosition&&(h.dropPosition="below"),d.afterDrop=h,this.parent.undoRedoModule.findPosition(l,d,"beforeDrop"),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=d}this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!0)}var p=void 0,u=[],c=this.droppedRecord;t.data[0]?u=t.data:u.push(t.data);var g=0,f=u.length,m=function(t){if(y.parent.isOnEdit=!0,p=u[t],y.draggedRecord=p,"Invalid"!==y.dropPosition){if("ResourceView"===y.parent.viewType&&(y.checkisSharedTask(),0!==y.draggedRecord.level&&(y.previousParent=y.draggedRecord.parentItem.uniqueID)),y.isSharedTask)return{value:void 0};i&&y.deleteDragRow();var r=y.treeGridData.indexOf(c);if("topSegment"===y.dropPosition&&y.dropAtTop(r),"bottomSegment"===y.dropPosition&&!y.isSharedTask){if(c.hasChildRecords){if(g=y.parent.editModule.getChildCount(c,0),y.parent.taskFields.parentID&&y.ganttData.length>0&&y.ganttData.splice(r+g+1,0,y.draggedRecord.taskData),y.treeGridData.splice(r+g+1,0,y.draggedRecord),y.parent.ids.splice(r+g+1,0,y.draggedRecord.ganttProperties.rowUniqueID.toString()),"ResourceView"===y.parent.viewType){var n=0===y.draggedRecord.level?"R"+y.draggedRecord.ganttProperties.taskId:"T"+y.draggedRecord.ganttProperties.taskId;y.parent.getTaskIds().splice(r+g+1,0,n)}}else if(y.parent.taskFields.parentID&&y.ganttData.length>0&&y.ganttData.splice(r+1,0,y.draggedRecord.taskData),y.treeGridData.splice(r+1,0,y.draggedRecord),y.parent.ids.splice(r+1,0,y.draggedRecord.ganttProperties.rowUniqueID.toString()),"ResourceView"===y.parent.viewType){var s=0===y.draggedRecord.level?"R"+y.draggedRecord.ganttProperties.taskId:"T"+y.draggedRecord.ganttProperties.taskId;y.parent.getTaskIds().splice(r+1,0,s)}if(y.parent.setRecordValue("parentItem",y.treeGridData[r].parentItem,p),y.parent.setRecordValue("parentUniqueID",y.treeGridData[r].parentUniqueID,p),y.parent.setRecordValue("level",y.treeGridData[r].level,p),p.hasChildRecords){y.updateChildRecordLevel(p,1),y.updateChildRecord(p,r+g+1)}if(c.parentItem){var o=y.parent.getParentTask(c.parentItem).childRecords,l=o.indexOf(c)+1;o.splice(l,0,p)}}if("middleSegment"===y.dropPosition&&(y.dropMiddle(r),c.childRecords.length>0&&(delete c.ganttProperties.segments,delete c.taskData[y.parent.taskFields.segments])),0!==y.treeGridData.length){for(var d=0;d<y.treeGridData.length;d++)if(y.treeGridData[parseInt(d.toString(),10)].index=d,!(0,e.isNullOrUndefined)(y.treeGridData[parseInt(d.toString(),10)].parentItem)){var h=(0,e.getValue)("uniqueIDCollection."+y.treeGridData[parseInt(d.toString(),10)].parentUniqueID,y.parent.treeGrid);y.treeGridData[parseInt(d.toString(),10)].parentItem.index=h.index}y.parent.undoRedoModule&&(y.parent.undoRedoModule.canUpdateIndex=!1)}(0,e.isNullOrUndefined)(p.parentItem&&-1!==y.updateParentRecords.indexOf(p.parentItem))||y.updateParentRecords.push(p.parentItem)}if(!y.parent.enableVirtualization){var f=a.flatData,m=void 0,D=void 0,v=y.parent.dataSource,k=y.parent.taskFields.id;if(p.index<c.index){m=p.index;for(var b=function(e){var t=y.parent.currentViewData.filter(function(t){return t[k]===v[e][k]})[0];if(t&&t.index>c.index)return D=t.index,"break"},w=0;w<v.length;w++){if("break"===b(w))break}}else{m=c.index;for(var T=function(e){var t=y.parent.currentViewData.filter(function(t){return t[k]===v[e][k]})[0];if(t&&t.index>p.index)return D=t.index,"break"},S=0;S<v.length;S++){if("break"===T(S))break}}for(var P=function(t){if(!(0,e.isNullOrUndefined)(f[t])&&(f[t].index=t,!(0,e.isNullOrUndefined)(f[t].parentItem))){var i=f.filter(function(e){return e.uniqueID===f[t].parentUniqueID})[0];f[t].parentItem.index=i.index}},C=m;C<=D;C++)P(C)}a.rowDragAndDropModule.refreshDataSource()},y=this;for(o=0;o<f;o++){var D=m(o);if("object"==typeof D)return D.value}if("middleSegment"===this.dropPosition){if(c.ganttProperties.predecessor)for(var v=c.ganttProperties.predecessor.length,k=0;k<v;k++)if(c.ganttProperties.predecessor&&c.ganttProperties.predecessor[k]){var b=this.parent.getRecordByID(c.ganttProperties.predecessor[k].from),w=this.parent.getRecordByID(c.ganttProperties.predecessor[k].to),T=this.parent.predecessorModule.validateParentPredecessor(b,w);if(c.ganttProperties.predecessor&&(!T||!this.parent.allowParentDependency)&&(this.parent.editModule.removePredecessorOnDelete(c),c.ganttProperties.predecessor.splice(0,1),c.ganttProperties.predecessorsName)){var S=c.ganttProperties.predecessorsName.split(",");for(o=0;o<S.length;o++)-1!==S[o].indexOf(p.ganttProperties.taskId+"")&&S.splice(o,1);var P=S.join();c.ganttProperties.predecessorsName=P,c[this.parent.taskFields.dependency]=P,c.taskData[this.parent.taskFields.dependency]=P}}c.ganttProperties.isMilestone&&(this.parent.setRecordValue("isMilestone",!1,c.ganttProperties,!0),(0,e.isNullOrUndefined)(c.taskData[this.parent.taskFields.milestone])||!0===c.taskData[this.parent.taskFields.milestone]&&(c.taskData[this.parent.taskFields.milestone]=!1))}if("ResourceView"===this.parent.viewType&&!this.isSharedTask){var C=void 0;C="middleSegment"===this.dropPosition?this.droppedRecord.uniqueID:this.droppedRecord.parentItem?this.droppedRecord.parentItem.uniqueID:this.droppedRecord.uniqueID;var R=this.parent.getTaskByUniqueID(C),M={};M[this.parent.taskFields.resourceInfo]=[],M[this.parent.taskFields.resourceInfo].push(R.ganttProperties.taskId),this.removeExistingResources();var x=this.parent.dataOperation.setResourceInfo(M),O=this.draggedRecord;(0,e.isNullOrUndefined)(O.ganttProperties.resourceInfo)&&(O.ganttProperties.resourceInfo=[]),"Unassigned Task"===R.ganttProperties.taskName?(O.ganttProperties.resourceInfo=[],O.ganttProperties.sharedTaskUniqueIds=[O.ganttProperties.rowUniqueID]):O.ganttProperties.resourceInfo.push(x[0]),this.updateCurrentTask(O),"Unassigned Task"===R.ganttProperties.taskName?this.deleteSharedResourceTask():this.updateSharedResourceTask()}if(this.parent.taskFields.dependency&&this.parent.allowParentDependency){var I,E=void 0;E=p.parentItem?this.parent.flatData[this.parent.ids.indexOf(p.parentItem.taskId)]:p,I=c.parentItem?this.parent.flatData[this.parent.ids.indexOf(c.parentItem.taskId)]:c;var F=void 0;if(I.uniqueID===E.uniqueID||E.parentItem&&I.uniqueID===this.parent.flatData[this.parent.ids.indexOf(E.parentItem.taskId)].uniqueID){F=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(I.ganttProperties.taskId,10)||parseInt(e.ganttProperties.predecessor[t].from,10)===parseInt(I.ganttProperties.taskId,10);return null});var U=[];for(o=0;o<F.length;o++){if(U=[],F[o].ganttProperties.predecessor)for(var N=0;N<F[o].ganttProperties.predecessor.length;N++)parseInt(F[o].ganttProperties.taskId,10)!==parseInt(F[o].ganttProperties.predecessor[N].from,10)?U.push(F[o].ganttProperties.predecessor[N].from):U.push(F[o].ganttProperties.predecessor[N].to);for(var L=function(e){var t=U[e].replace(/\D/g,""),i=V.parent.currentViewData.filter(function(e){return parseInt(e.ganttProperties.taskId,10)===parseInt(t,10)});V.parent.predecessorModule.validateParentPredecessor(F[o],i[0])||(V.parent.dataOperation.resetDependency(F[o]),V.parent.dataOperation.resetDependency(i[0]))},V=this,B=0;B<U.length;B++)L(B)}}}for(B=0;B<this.updateParentRecords.length;B++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[B]);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 A=this.parent.flatData[this.parent.ids.indexOf(this.parent.undoRedoModule.currentAction.afterDrop.dropRecord.ganttProperties.taskId.toString())];this.parent.editModule.taskbarEditModule.taskBarEditRecord=A,this.parent.editModule.taskbarEditModule.taskBarEditAction="ChildDrag",this.parent.predecessorModule.validatePredecessor(A,[],""),this.parent.editModule.taskbarEditModule.taskBarEditAction=null}this.updateParentRecords=[],this.parent.isOnEdit=!1}(0,e.isNullOrUndefined)(this.parent.editModule)||this.parent.editModule.refreshRecord(t,!0),(!this.parent.undoRedoModule||this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed)&&(this.parent.previousFlatData=(0,e.extend)([],[],this.parent.flatData,!0))}this.parent.oldRecords=[]},t.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)},t.prototype.deleteSharedResourceTask=function(){for(var t=0;t<this.parent.getTaskIds().length;t++)this.parent.getTaskIds()[t]==="T"+this.draggedRecord.ganttProperties.taskId&&("Unassigned Task"!==this.parent.getTaskByUniqueID(this.parent.flatData[t].parentItem.uniqueID).ganttProperties.taskName&&this.removeRecords(this.parent.flatData[t]),(0,e.isNullOrUndefined)(this.parent.flatData[parseInt(t.toString(),10)].parentItem&&-1!==this.updateParentRecords.indexOf(this.parent.flatData[parseInt(t.toString(),10)].parentItem))||this.updateParentRecords.push(this.parent.flatData[t].parentItem))},t.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}},t.prototype.updateSharedResourceTask=function(){for(var t=0;t<this.parent.getTaskIds().length;t++)this.parent.getTaskIds()[t]==="T"+this.draggedRecord.ganttProperties.taskId&&(this.parent.editModule.updateGanttProperties(this.draggedRecord,this.parent.flatData[t]),this.parent.dataOperation.updateTaskData(this.parent.flatData[t]),(0,e.isNullOrUndefined)(this.parent.flatData[parseInt(t.toString(),10)].parentItem&&-1!==this.updateParentRecords.indexOf(this.parent.flatData[parseInt(t.toString(),10)].parentItem))||this.updateParentRecords.push(this.parent.flatData[t].parentItem))},t.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},t.prototype.removeResourceInfo=function(t){var i=this.parent.getTaskByUniqueID(this.draggedRecord.parentItem.uniqueID);if(t.ganttProperties.resourceInfo&&t.ganttProperties.resourceInfo.length>1){var a=this._getExistingTaskWithID(t),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),(0,e.isNullOrUndefined)(r.parentItem&&-1!==this.updateParentRecords.indexOf(r.parentItem))||this.updateParentRecords.push(r.parentItem);break}}},t.prototype.refreshDataSource=function(){var t,a,r=this.draggedRecord,n=this.droppedRecord,s=this.parent,o=this.parent.taskFields;if((t=this.parent.dataSource instanceof i.DataManager?(0,e.getValue)("dataOperation.dataArray",this.parent):s.dataSource).length>0&&!(0,e.isNullOrUndefined)(n)&&!n.parentItem){for(var l=0;l<Object.keys(t).length;l++)(0,e.isNullOrUndefined)(n.taskData[o.child])||t[l][o.child]!==n.taskData[o.child]?(0,e.isNullOrUndefined)(n.taskData[o.child])&&n.taskData[o.id]===t[l][o.id]&&(a=l):a=l;"topSegment"===this.dropPosition?this.parent.taskFields.parentID||t.splice(a,0,r.taskData):"bottomSegment"===this.dropPosition&&(this.parent.taskFields.parentID||t.splice(a+1,0,r.taskData))}else if(!this.parent.taskFields.parentID&&!(0,e.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}},t.prototype.dropMiddle=function(t){var i=this.parent,a=this.parent.editModule.getChildCount(this.droppedRecord,0),r=(0,e.isNullOrUndefined)(a)||0===a?t+1:a+t+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(),(0,e.isNullOrUndefined)(this.draggedRecord.parentItem&&-1!==this.updateParentRecords.indexOf(this.draggedRecord.parentItem))&&this.updateParentRecords.push(this.draggedRecord.parentItem)}},t.prototype.recordLevel=function(){var t=this.parent,i=this.draggedRecord,a=this.droppedRecord,r=t.taskFields.child;if(a.hasChildRecords||(a.hasChildRecords=!0,a.childRecords.length||(a.childRecords=[],!t.taskFields.parentID&&(0,e.isNullOrUndefined)(a.taskData[r])&&(a.taskData[r]=[]))),"middleSegment"===this.dropPosition){var n=(0,e.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),(0,e.isNullOrUndefined)(i)||t.taskFields.parentID||(0,e.isNullOrUndefined)(a.taskData[r])||a.taskData[t.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)}},t.prototype.deleteDragRow=function(){var t;if(this.treeGridData=n(this.parent)?(0,e.getValue)("result",this.parent.treeGrid.dataSource):this.parent.treeGrid.dataSource,this.parent.dataSource instanceof i.DataManager?this.ganttData=(0,e.getValue)("dataOperation.dataArray",this.parent):this.ganttData=n(this.parent)?(0,e.getValue)("result",this.parent.dataSource):this.parent.dataSource,this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed)if("ProjectView"===this.parent.viewType)t=this.parent.flatData[this.parent.ids.indexOf(this.draggedRecord.ganttProperties.taskId.toString())];else{var a=this.draggedRecord.hasChildRecords?"R":"T";t=this.parent.flatData[this.parent.taskIds.indexOf(a+this.draggedRecord.ganttProperties.taskId)]}else t=this.parent.getTaskByUniqueID(this.draggedRecord.uniqueID);this.removeRecords(t)},t.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)},t.prototype.dropAtTop=function(t){var i=this.parent;if(!this.isSharedTask){if(i.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(t,0,this.draggedRecord.taskData),this.treeGridData.splice(t,0,this.draggedRecord),this.parent.ids.splice(t,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(t,0,a)}if(this.draggedRecord.hasChildRecords){this.updateChildRecord(this.draggedRecord,t),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)}(0,e.isNullOrUndefined)(this.draggedRecord.parentItem&&-1!==this.updateParentRecords.indexOf(this.draggedRecord.parentItem))||this.updateParentRecords.push(this.draggedRecord.parentItem)}},t.prototype.updateChildRecordLevel=function(e,t){var i,a;if(t++,!e.hasChildRecords)return 0;i=e.childRecords.length;for(var r=0;r<i;r++){a=e.childRecords[r];var n=void 0;if(e.parentItem){n=this.parent.treeGrid.uniqueIDCollection[e.parentItem.uniqueID]}a.level=e.parentItem?n.level+t:e.level+1,this.parent.setRecordValue("level",a.level,a),a.hasChildRecords&&(t--,t=this.updateChildRecordLevel(a,t))}return t},t.prototype.updateChildRecord=function(e,t,i){var a,r,n=this.parent;if(!e.hasChildRecords)return 0;r=e.childRecords.length;for(var s=0;s<r;s++){if(a=e.childRecords[s],t++,n.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)}n.taskFields.parentID&&n.dataSource.length>0&&this.ganttData.splice(t,0,a.taskData),a.hasChildRecords&&(t=this.updateChildRecord(a,t))}return t},t.prototype.removeRecords=function(t){var a,r=this.parent;a=this.parent.dataSource instanceof i.DataManager?(0,e.getValue)("dataOperation.dataArray",this.parent):this.parent.dataSource;var n=t,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=a.length>0&&"ResourceView"!==this.parent.viewType?a: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){a.length>0&&a.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)}},t.prototype.removeChildItem=function(t){for(var a,r,n=0;n<t.childRecords.length;n++){a=t.childRecords[n];var s=void 0;s=this.parent.dataSource instanceof i.DataManager?(0,e.getValue)("dataOperation.dataArray",this.parent):this.parent.dataSource;for(var o=0;o<s.length;o++)s[o][this.parent.taskFields.id]===a.taskData[this.parent.taskFields.id]&&(r=o);if(-1!==r){s.length>0&&s.splice(r,1);var l=this.treeGridData.indexOf(a);this.treeGridData.splice(l,1),this.parent.ids.splice(l,1),"ResourceView"===this.parent.viewType&&this.parent.getTaskIds().splice(r,1)}a.hasChildRecords&&this.removeChildItem(a)}},t.prototype.reorderRows=function(t,i,a){if(!this.parent.readOnly){if(t[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=(0,e.extend)([],[],[this.parent.undoRedoModule.currentAction],!0)[0]);for(var n=[],s=0;s<t.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[t[s]];var o={data:n,dropIndex:i,dropPosition:this.dropPosition};this.dropRows(o,!0)}},t}(),ea=m(461),ta=function(){function e(e){this.theme=e,this.ganttStyle={},this.setTheme(this.ganttStyle,this.theme),this.ganttStyle.eventMarker.lineStyle.dashStyle=ea.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 ea.PdfColor(0,0,0),e.columnHeader.fontColor.gray=.2,e.columnHeader.backgroundColor=new ea.PdfColor(255,255,255),e.columnHeader.borderColor=new ea.PdfColor(234,234,234),e.columnHeader.format.lineAlignment=1,e.columnHeader.format.alignment=0,e.fontFamily=ea.PdfFontFamily.Helvetica,e.cell.fontSize=9.5,e.cell.backgroundColor=new ea.PdfColor(255,255,255),e.cell.borderColor=new ea.PdfColor(234,234,234),e.cell.fontColor=new ea.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 ea.PdfColor(235,235,235),e.timeline.fontSize=9.5,e.timeline.fontStyle=0,e.timeline.backgroundColor=new ea.PdfColor(252,252,252),e.timeline.fontColor=new ea.PdfColor(40,40,39),e.chartGridLineColor=new ea.PdfColor(235,235,235),e.timeline.borderColor=new ea.PdfColor(235,235,235),e.eventMarker.label.backgroundColor=new ea.PdfColor(100,253,191),e.eventMarker.label.fontColor=new ea.PdfColor(33,33,33),e.eventMarker.lineStyle=new ea.PdfPen(new ea.PdfColor(227,22,91)),e.eventMarker.lineStyle.dashStyle=ea.PdfDashStyle.Dash,e.holiday.backgroundColor=new ea.PdfColor(238,238,238),t){case"Bootstrap":e.taskbar.taskColor=new ea.PdfColor(49,122,185),e.taskbar.progressColor=new ea.PdfColor(33,82,125),e.taskbar.criticalTaskColor=new ea.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new ea.PdfColor(255,85,85),e.taskbar.baselineColor=new ea.PdfColor(240,173,78),e.taskbar.baselineBorderColor=new ea.PdfColor(240,173,78),e.criticalConnectorLineColor=new ea.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new ea.PdfColor(255,85,85),e.taskbar.parentTaskColor=new ea.PdfColor(119,119,119),e.taskbar.parentProgressColor=new ea.PdfColor(85,85,85),e.taskbar.taskBorderColor=new ea.PdfColor(33,82,125),e.taskbar.parentTaskBorderColor=new ea.PdfColor(85,85,85),e.taskbar.milestoneColor=new ea.PdfColor(85,85,85),e.footer.fontColor=new ea.PdfColor(0,0,0),e.footer.fontColor.gray=.2,e.connectorLineColor=new ea.PdfColor(33,82,125),e.footer.backgroundColor=new ea.PdfColor(255,255,255),e.taskbar.progressFontColor=new ea.PdfColor(255,255,255),e.label.fontColor=new ea.PdfColor(0,0,0),e.taskbar.splitLineBackground=new ea.PdfColor(51,51,51),e.taskbar.unscheduledTaskBarColor=new ea.PdfColor(49,122,185),e.taskbar.manualParentBackground=new ea.PdfColor(119,119,119),e.taskbar.manualParentProgress=new ea.PdfColor(85,85,85),e.taskbar.manualChildBackground=new ea.PdfColor(117,56,201),e.taskbar.manualChildProgress=new ea.PdfColor(87,42,150),e.taskbar.manualLineColor=new ea.PdfColor(152,154,156),e.taskbar.manualParentBorder=new ea.PdfColor(85,85,85),e.taskbar.manualChildBorder=new ea.PdfColor(87,42,150),e.eventMarker.label.backgroundColor=new ea.PdfColor(138,109,59),e.eventMarker.label.fontColor=new ea.PdfColor(252,248,227),e.eventMarker.lineStyle=new ea.PdfPen(new ea.PdfColor(49,122,185)),e.holiday.backgroundColor=new ea.PdfColor(238,238,238);break;case"Bootstrap 4":e.taskbar.taskColor=new ea.PdfColor(0,123,255),e.taskbar.progressColor=new ea.PdfColor(0,86,179),e.taskbar.criticalTaskColor=new ea.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new ea.PdfColor(255,85,85),e.taskbar.baselineColor=new ea.PdfColor(255,193,7),e.taskbar.baselineBorderColor=new ea.PdfColor(255,193,7),e.criticalConnectorLineColor=new ea.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new ea.PdfColor(255,85,85),e.taskbar.parentTaskColor=new ea.PdfColor(108,117,125),e.taskbar.parentProgressColor=new ea.PdfColor(73,80,87),e.taskbar.taskBorderColor=new ea.PdfColor(0,86,179),e.taskbar.parentTaskBorderColor=new ea.PdfColor(73,80,87),e.taskbar.milestoneColor=new ea.PdfColor(73,80,87),e.footer.fontColor=new ea.PdfColor(0,0,0),e.footer.fontColor.gray=.2,e.connectorLineColor=new ea.PdfColor(0,86,179),e.footer.backgroundColor=new ea.PdfColor(255,255,255),e.taskbar.progressFontColor=new ea.PdfColor(255,255,255),e.label.fontColor=new ea.PdfColor(33,37,41),e.taskbar.splitLineBackground=new ea.PdfColor(0,0,0),e.taskbar.unscheduledTaskBarColor=new ea.PdfColor(0,123,255),e.taskbar.manualParentBackground=new ea.PdfColor(108,117,125),e.taskbar.manualParentProgress=new ea.PdfColor(73,80,87),e.taskbar.manualChildBackground=new ea.PdfColor(133,83,241),e.taskbar.manualChildProgress=new ea.PdfColor(102,40,238),e.taskbar.manualLineColor=new ea.PdfColor(152,154,156),e.taskbar.manualParentBorder=new ea.PdfColor(73,80,87),e.taskbar.manualChildBorder=new ea.PdfColor(102,40,238),e.eventMarker.label.backgroundColor=new ea.PdfColor(255,193,7),e.eventMarker.label.fontColor=new ea.PdfColor(0,0,0),e.eventMarker.lineStyle=new ea.PdfPen(new ea.PdfColor(0,123,255)),e.holiday.backgroundColor=new ea.PdfColor(233,236,239);break;case"Fabric":e.columnHeader.fontColor=new ea.PdfColor(102,102,102),e.cell.fontColor=new ea.PdfColor(51,51,51),e.taskbar.taskColor=new ea.PdfColor(0,120,214),e.taskbar.progressColor=new ea.PdfColor(0,91,163),e.taskbar.criticalTaskColor=new ea.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new ea.PdfColor(255,85,85),e.taskbar.baselineColor=new ea.PdfColor(216,59,1),e.taskbar.baselineBorderColor=new ea.PdfColor(216,59,1),e.criticalConnectorLineColor=new ea.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new ea.PdfColor(255,85,85),e.taskbar.parentTaskColor=new ea.PdfColor(118,118,118),e.taskbar.parentProgressColor=new ea.PdfColor(80,80,80),e.taskbar.taskBorderColor=new ea.PdfColor(0,91,163),e.taskbar.parentTaskBorderColor=new ea.PdfColor(80,80,80),e.taskbar.milestoneColor=new ea.PdfColor(80,80,80),e.footer.fontColor=new ea.PdfColor(51,51,51),e.footer.fontColor.gray=.2,e.connectorLineColor=new ea.PdfColor(0,69,122),e.footer.backgroundColor=new ea.PdfColor(255,255,255),e.taskbar.progressFontColor=new ea.PdfColor(255,255,255),e.label.fontColor=new ea.PdfColor(51,51,51),e.taskbar.splitLineBackground=new ea.PdfColor(0,0,0),e.taskbar.unscheduledTaskBarColor=new ea.PdfColor(0,120,214),e.taskbar.manualParentBackground=new ea.PdfColor(118,118,118),e.taskbar.manualParentProgress=new ea.PdfColor(80,80,80),e.taskbar.manualChildBackground=new ea.PdfColor(154,56,186),e.taskbar.manualChildProgress=new ea.PdfColor(109,24,136),e.taskbar.manualLineColor=new ea.PdfColor(152,154,156),e.taskbar.manualParentBorder=new ea.PdfColor(80,80,80),e.taskbar.manualChildBorder=new ea.PdfColor(109,24,136),e.eventMarker.label.backgroundColor=new ea.PdfColor(202,232,255),e.eventMarker.label.fontColor=new ea.PdfColor(0,90,158),e.eventMarker.lineStyle=new ea.PdfPen(new ea.PdfColor(0,120,214)),e.holiday.backgroundColor=new ea.PdfColor(244,244,244);break;default:e.taskbar.taskColor=new ea.PdfColor(88,105,197),e.taskbar.progressColor=new ea.PdfColor(63,81,181),e.taskbar.criticalTaskColor=new ea.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new ea.PdfColor(255,85,85),e.taskbar.baselineColor=new ea.PdfColor(193,87,0),e.taskbar.baselineBorderColor=new ea.PdfColor(193,87,0),e.criticalConnectorLineColor=new ea.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new ea.PdfColor(255,85,85),e.taskbar.parentTaskColor=new ea.PdfColor(132,132,132),e.taskbar.parentProgressColor=new ea.PdfColor(97,97,97),e.taskbar.taskBorderColor=new ea.PdfColor(63,81,181),e.taskbar.parentTaskBorderColor=new ea.PdfColor(51,51,51),e.taskbar.milestoneColor=new ea.PdfColor(97,97,97),e.footer.fontColor=new ea.PdfColor(0,0,0),e.footer.fontColor.gray=.2,e.connectorLineColor=new ea.PdfColor(63,81,181),e.footer.backgroundColor=new ea.PdfColor(255,255,255),e.taskbar.progressFontColor=new ea.PdfColor(255,255,255),e.label.fontColor=new ea.PdfColor(51,51,51),e.taskbar.splitLineBackground=new ea.PdfColor(0,0,0),e.taskbar.unscheduledTaskBarColor=new ea.PdfColor(63,81,181),e.taskbar.manualParentBackground=new ea.PdfColor(97,97,97),e.taskbar.manualParentProgress=new ea.PdfColor(97,97,97),e.taskbar.manualChildBackground=new ea.PdfColor(0,135,134),e.taskbar.manualChildProgress=new ea.PdfColor(0,135,134),e.taskbar.manualLineColor=new ea.PdfColor(152,154,156),e.taskbar.manualParentBorder=new ea.PdfColor(97,97,97),e.taskbar.manualChildBorder=new ea.PdfColor(0,135,134),e.eventMarker.label.backgroundColor=new ea.PdfColor(253,191,100),e.eventMarker.label.fontColor=new ea.PdfColor(33,33,33),e.eventMarker.lineStyle=new ea.PdfPen(new ea.PdfColor(227,22,91)),e.holiday.backgroundColor=new ea.PdfColor(238,238,238)}},e.prototype.initStyles=function(e){e.columnHeader={},e.columnHeader.format=new ea.PdfStringFormat,e.cell={},e.cell.format=new ea.PdfStringFormat,e.timeline={},e.footer={},e.footer.format=new ea.PdfStringFormat,e.label={},e.taskbar={},e.eventMarker={},e.eventMarker.label={},e.eventMarker.lineStyle=new ea.PdfPen(null),e.holiday={}},e}(),ia=function(){function e(){this.mKeys=[],this.mValues=[]}return e.prototype.size=function(){return this.mKeys.length},e.prototype.add=function(e,t){if(null==e||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(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(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(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(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}(),aa=function(){function e(){var e=new ea.PdfPen(new ea.PdfColor(0,0,0));e.dashStyle=ea.PdfDashStyle.Solid;var t=new ea.PdfPen(new ea.PdfColor(0,0,0));t.dashStyle=ea.PdfDashStyle.Solid;var i=new ea.PdfPen(new ea.PdfColor(0,0,0));i.dashStyle=ea.PdfDashStyle.Solid;var a=new ea.PdfPen(new ea.PdfColor(0,0,0));a.dashStyle=ea.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}(),ra=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}(),na=function(){},sa=function(){this.cellSpacing=0,this.borderOverlapStyle=ea.PdfBorderOverlapStyle.Overlap,this.allowHorizontalOverflow=!1,this.horizontalOverflowType=w.LastPage,this.cellPadding=new ra},oa=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])},e(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)}}(),la=function(t){function i(e){var i=t.call(this,e)||this;return i.columnRanges=[],i.repeatRowIndex=-1,i.pageHeightCollection=[],i.headerHeight=0,i.currentBounds=new ea.RectangleF(0,0,0,0),i}return oa(i,t),Object.defineProperty(i.prototype,"treegrid",{get:function(){return this.elements},enumerable:!0,configurable:!0}),i.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===ea.PdfLayoutBreakType.FitColumnsToPage?this.currentBounds=new ea.RectangleF(new ea.PointF(e.bounds.x,e.bounds.y),new ea.SizeF(this.treegrid.columns.width,this.currentGraphics.clientSize.height)):this.currentBounds=new ea.RectangleF(new ea.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 ea.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)},i.prototype.determineColumnDrawRanges=function(){for(var e=0,t=0,i=0,a=this.treegrid.taskbar.isAutoFit()?f(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])},i.prototype.getFormat=function(e){return e},i.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})}},i.prototype.layoutOnPage=function(e){for(var t,i=0,a=0,r=[],n=[],s=this.getFormat(e.format),o=new ia,l=e.page,d=0;d<this.columnRanges.length;d++){var h=this.columnRanges[d];this.cellStartIndex=h[0],this.cellEndIndex=h[1];for(var p=this.treegrid.rows.count,u=0,c=!1,g=0;g<p;g++){var f=this.treegrid.rows.getRow(g);u++;var m=this.currentBounds.y;null===this.currentPage||o.containsKey(this.currentPage)||(r.push({height:i,pageNumber:a}),a++,i=0,o.add(this.currentPage,h));var y=this.drawRow(f);for(m===this.currentBounds.y?(c=!0,this.repeatRowIndex=this.treegrid.rows.rowCollection.indexOf(f)):(c=!1,this.repeatRowIndex=-1,this.updateCollection(this.currentPage,r,n,g,f.height,a,0));!y.isFinish&&null!==l;)if(this.treegrid.allowRowBreakAcrossPages)this.currentPage=this.getNextPageFormat(s),this.treegrid.enableHeader&&this.drawHeader(),this.checkBounds(s),y=this.drawRow(f),i+=f.height,this.updateCollection(this.currentPage,r,n,g,f.height,a,1);else{if(!this.treegrid.allowRowBreakAcrossPages&&u<length){this.currentPage=this.getNextPageFormat(s),this.treegrid.enableHeader&&this.drawHeader();break}if(u>=length)break}if(!y.isFinish&&null!==l&&s.layout!==ea.PdfLayoutType.OnePage&&c){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 ea.RectangleF(0,0,0,0))this.currentBounds.x+=this.startLocation.x;else{var D=this.currentBounds.x;this.currentBounds.x=D}this.currentBounds.x===aa.default.left.width/2&&(this.currentBounds.y+=this.startLocation.x),this.drawRow(f),null===this.currentPage||o.containsKey(this.currentPage)||o.add(this.currentPage,h),this.updateCollection(this.currentPage,r,n,g,f.height,a,0)}}this.columnRanges.indexOf(h)<this.columnRanges.length-1&&null!==l&&s.layout!==ea.PdfLayoutType.OnePage&&(this.currentPage=this.getNextPageFormat(s),this.checkBounds(s))}t=this.getLayoutResult(),this.treegrid.style.allowHorizontalOverflow&&this.treegrid.style.horizontalOverflowType===w.NextPage&&this.reArrangePages(o),r.push({height:i,pageNumber:a});var v={};this.headerHeight=n[0].height,n.forEach(function(e){v[e.pageNumber]||(v[e.pageNumber]=[]),v[e.pageNumber].push(e.height)});var k=Object.keys(v).map(function(e){var t=parseInt(e,10);return{pageNumber:t,totalHeight:v[t].reduce(function(e,t){return e+t},0)}});return this.pageHeightCollection=k,t},i.prototype.checkBounds=function(e){var t=new ea.PointF(aa.default.right.width/2,aa.default.top.width/2);e.paginateBounds===new ea.RectangleF(0,0,0,0)&&this.startLocation===t&&(this.currentBounds.x+=this.startLocation.x,this.currentBounds.y+=this.startLocation.y)},i.prototype.drawHeader=function(){this.drawRow(this.treegrid.rows.getRow(0))},i.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)}},i.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 ea.RectangleF(new ea.PointF(0,0),i.getClientSize()),i},i.prototype.getLayoutResult=function(){var e=new ea.RectangleF(this.startLocation,new ea.SizeF(this.currentBounds.width,this.currentBounds.y-this.startLocation.y));return new da(this.currentPage,e)},i.prototype.checkIfDefaultFormat=function(e){var t=new ea.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},i.prototype.drawRow=function(t,i,a){if((0,e.isNullOrUndefined)(i)){var r=new ea.RowLayoutResult;return(a=t.rowBreakHeight>0?t.rowBreakHeight:t.height)>this.currentPageBounds.height?this.treegrid.allowRowBreakAcrossPages?(r.isFinish=!0,this.drawRowWithBreak(r,t,a)):(r.isFinish=!1,this.drawRow(t,r,a)):this.currentBounds.y+a>this.currentPageBounds.height||this.currentBounds.y+a>this.currentBounds.height?this.repeatRowIndex>-1&&this.repeatRowIndex===t.rowIndex?this.treegrid.allowRowBreakAcrossPages?(r.isFinish=!0,this.drawRowWithBreak(r,t,a)):(r.isFinish=!1,this.drawRow(t,r,a)):r.isFinish=!1:(r.isFinish=!0,this.drawRow(t,r,a)),r}var n=new ea.PointF(this.currentBounds.x,this.currentBounds.y);i.bounds=new ea.RectangleF(n,new ea.SizeF(0,0));var s=0;a=this.reCalculateHeight(t,a);for(var o=this.cellStartIndex;o<=this.cellEndIndex;o++){var l=t.cells.getCell(o),d=this.treegrid.columns.getColumn(o);if(!(0,e.isNullOrUndefined)(l.value)){d.isTreeColumn&&(s=t.level);var h=l.columnSpan>1&&o>this.cellEndIndex+1;if(!h)for(var p=1;p<l.columnSpan;p++)t.cells.getCell(o+p).isCellMergeContinue=!0;var u=new ea.SizeF(d.width,a);l.columnSpan>1&&(u=new ea.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 ea.RectangleF(n,u),h,s),t.treegrid.style.allowHorizontalOverflow&&(l.columnSpan>this.cellEndIndex||o+l.columnSpan>this.cellEndIndex+1)&&this.cellEndIndex<t.cells.count-1&&(t.rowOverflowIndex=this.cellEndIndex),n.x+=d.width,s=0}}return this.currentBounds.y+=a,i.bounds=new ea.RectangleF(new ea.PointF(i.bounds.x,i.bounds.y),new ea.SizeF(n.x,n.y)),null},i.prototype.drawRowWithBreak=function(e,t,i){var a=new ea.PointF(this.currentBounds.x,this.currentBounds.y);e.bounds=new ea.RectangleF(a,new ea.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,d=(l=t.cells.getCell(s)).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 ea.SizeF(o.width,p);!this.checkIfDefaultFormat(o.format)&&this.checkIfDefaultFormat(l.style.format)&&(l.style.format=o.format),l.draw(this.currentGraphics,new ea.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 ea.RectangleF(new ea.PointF(e.bounds.x,e.bounds.y),new ea.SizeF(a.x,a.y))}},i.prototype.reCalculateHeight=function(t,i){for(var a=0,r=this.cellStartIndex;r<=this.cellEndIndex;r++)(0,e.isNullOrUndefined)(t.cells.getCell(r).remainingString)&&""!==t.cells.getCell(r).remainingString||(a=Math.max(a,t.cells.getCell(r).measureHeight()));return Math.max(i,a)},i}(ea.ElementLayouter),da=function(e){function t(t,i){return e.call(this,t,i)||this}return oa(t,e),t}(ea.PdfLayoutResult),ha=function(e){function t(t){return void 0===t?e.call(this)||this:e.call(this,t)||this}return oa(t,e),t}(ea.PdfLayoutFormat),pa=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])},e(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)}}(),ua=function(t){function i(){var e=t.call(this)||this;return e.treeGridSize=new ea.SizeF(0,0),e.treeColumnIndex=0,e.allowRowBreakAcrossPages=!0,e.enableHeader=!0,e.isFitToWidth=!1,e.columns=new va(e),e.rows=new ma(e),e.headers=new ya(e),e.style=new sa,e.rowHeight=0,e}return pa(i,t),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 ea.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 ea.RectangleF&&void 0!==t.width&&void 0===i)return this.drawHelper(e,t,null);if(t instanceof ea.PointF&&void 0===t.width&&i instanceof ea.PdfLayoutFormat)return this.drawHelper(e,t.x,t.y,i);if("number"==typeof t&&"number"==typeof i&&(a instanceof ea.PdfLayoutFormat||null===a)){var r=e.graphics.clientSize.width-t,n=new ea.RectangleF(t,i,r,0);return this.drawHelper(e,n,a)}return t instanceof ea.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{t=[];var a=0,r=0,n=this.columns.count;for(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+=this.headers.getHeader(i).height}for(i=0;i<this.rows.count;i++){e+=this.rows.getRow(i).height}return new ea.SizeF(t,e)},i.prototype.drawGrid=function(e,t,i,a){this.initialWidth=e.graphics.clientSize.width;var r=new ea.RectangleF(0,0,e.getClientSize().height,0);return this.draw(e,r,a)},i.prototype.layout=function(t){if(0!==this.rows.count){var i=0!==this.rows.getRow(0).cells.count?this.rows.getRow(0).cells.getCell(0).style:null;if(!(0,e.isNullOrUndefined)(i)&&1!==i.borders.left.width){var a=i.borders.left.width/2,r=i.borders.top.width/2;if(t.bounds.x===aa.default.right.width/2&&t.bounds.y===aa.default.right.width/2){var n=new ea.RectangleF(new ea.PointF(a,r),new ea.SizeF(this.size.width,this.size.height));t.bounds=n}}}return this.layouter=new la(this),this.layouter.layoutInternal(t)},i}(ea.PdfLayoutElement),ca=function(){function t(t){this.cellWidth=0,this.cellHeight=0,this.finishedDrawingCell=!0,(0,e.isNullOrUndefined)(t)?(this.rowSpan=1,this.columnSpan=1):this.row=t,this.style={}}return Object.defineProperty(t.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(t.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}),t.prototype.measureWidth=function(){var e=0,t=new ea.PdfStringLayouter;if("string"==typeof this.value){var i=new ea.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,this.style.fontStyle);i=this.row.isParentRow?new ea.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,ea.PdfFontStyle.Bold):new ea.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 ea.SizeF(Number.MAX_VALUE,Number.MAX_VALUE),!1,new ea.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},t.prototype.measureHeight=function(){var t=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 ea.PdfStringLayouter;if("string"==typeof this.value||"string"==typeof this.remainingString){var n=this.value;this.finishedDrawingCell||(n=(0,e.isNullOrUndefined)(this.remainingString)||""===this.remainingString?this.value:this.remainingString);var s=null;s=this.row.isParentRow?new ea.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,ea.PdfFontStyle.Bold):new ea.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 ea.SizeF(a-10,0),!1,new ea.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)>t?i:t},t.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},t.prototype.draw=function(e,t,i,a){var r=null;this.drawCellBackground(e,t);var n=null,s=new ea.PdfSolidBrush(this.style.fontColor),o=null;if(this.row.isParentRow){var l=ea.PdfFontStyle.Bold;this.style.fontStyle&&(l=this.style.fontStyle),o=new ea.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,l)}else o=new ea.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,this.style.fontStyle);this.row.treegrid.ganttStyle.font&&(o=this.row.treegrid.ganttStyle.font);var d=t;if(this.isHeaderCell||(d.x=d.x,d.width=d.width),d.height>=e.clientSize.height&&(this.row.treegrid.allowRowBreakAcrossPages?(d.height-=d.y,t.height-=t.y):(d.height=e.clientSize.height,t.height=e.clientSize.height)),d=this.adjustContentLayoutArea(d),this.image&&this.value){var h=void 0;h=this.image.width<=d.width?new ea.RectangleF(d.x+a,d.y-this.style.padding.bottom,this.image.width,this.image.height):d,e.drawImage(this.image,h.x+a,h.y-5,h.width,h.height);var p=null,u=void 0,c=this.fontStyle;c||(c=this.style);var g=new ea.PdfStandardFont(c.fontFamily,c.fontSize,c.fontStyle);u=c.fontFamily?g:o;var f=s;this.row.treegrid.ganttStyle.cell.fontBrush&&(f=new ea.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?(p=""===this.remainingString?this.remainingString:this.value,e.drawString(p,u,n,f,d.x+a+(h.width?h.width+8:0),this.isHeaderCell?d.y-16:d.y-this.style.padding.bottom,d.width-a-10,d.height-10,this.style.format)):e.drawString(this.remainingString,u,n,f,d.x+a,this.isHeaderCell?d.y-16:d.y,this.style.format),r=e.stringLayoutResult}else if("string"==typeof this.value||"string"==typeof this.remainingString){p=null,u=void 0,g=new ea.PdfStandardFont(this.style.fontFamily,this.style.fontSize,this.style.fontStyle);u=this.style.fontFamily?g:o;f=s;this.row.treegrid.ganttStyle.cell.fontBrush&&(f=new ea.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?(p=""===this.remainingString?this.remainingString:this.value,e.drawString(p,u,n,f,d.x+a,this.isHeaderCell?d.y-16:d.y-this.style.padding.bottom-3,d.width-a-10,d.height-10,this.style.format)):e.drawString(this.remainingString,u,n,f,d.x+a,this.isHeaderCell?d.y-16:d.y,this.style.format),r=e.stringLayoutResult}else if(this.value instanceof ea.PdfImage||this.value instanceof ea.PdfBitmap){h=void 0;h=this.value.width<=d.width?new ea.RectangleF(d.x,d.y,this.value.width,d.height):d,e.drawImage(this.value,h.x,h.y-10,h.width,h.height)}else this.value instanceof ea.PdfTextWebLink&&this.value.draw(e.currentPage,d);return null!==this.style.borders&&this.drawCellBorder(e,t),r},t.prototype.drawCellBackground=function(e,t){var i=new ea.PdfSolidBrush(this.style.backgroundColor);null!==i&&(e.save(),e.drawRectangle(i,t.x,t.y,t.width,t.height),e.restore())},t.prototype.adjustContentLayoutArea=function(e){var t=new ea.RectangleF(new ea.PointF(e.x,e.y),new ea.SizeF(e.width,e.height)),i=this.style.padding;if(this.value instanceof ua){var a=this.value.size;this.style.format.alignment===ea.PdfTextAlignment.Center?(t.x+=i.left+(t.width-a.width)/2,t.y+=i.top+(t.height-a.height)/2):this.style.format.alignment===ea.PdfTextAlignment.Left?(t.x+=i.left,t.y+=i.top):this.style.format.alignment===ea.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},t.prototype.drawCellBorder=function(e,t){if(this.row.treegrid.style.borderOverlapStyle===ea.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 ea.PointF(t.x,t.y+t.height),a=new ea.PointF(t.x,t.y),r=this.style.borders.left;r.lineCap=this.style.borders.left.dashStyle===ea.PdfDashStyle.Solid?ea.PdfLineCap.Square:r.lineCap,e.drawLine(r,i,a),e.restore(),i=new ea.PointF(t.x+t.width,t.y),a=new ea.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 ea.PointF(e.clientSize.width-r.width/2,t.y),a=new ea.PointF(e.clientSize.width-r.width/2,t.y+t.height)),r.lineCap=this.style.borders.right.dashStyle===ea.PdfDashStyle.Solid?ea.PdfLineCap.Square:r.lineCap,e.drawLine(r,i,a),e.restore(),i=new ea.PointF(t.x,t.y),a=new ea.PointF(t.x+t.width,t.y),(r=this.style.borders.top).lineCap=this.style.borders.top.dashStyle===ea.PdfDashStyle.Solid?ea.PdfLineCap.Square:r.lineCap,e.drawLine(r,i,a),e.restore(),i=new ea.PointF(t.x+t.width,t.y+t.height),a=new ea.PointF(t.x,t.y+t.height),r=this.style.borders.bottom,t.y+t.height>e.clientSize.height-r.width/2&&(i=new ea.PointF(t.x+t.width,e.clientSize.height-r.width/2),a=new ea.PointF(t.x,e.clientSize.height-r.width/2)),r.lineCap=this.style.borders.bottom.dashStyle===ea.PdfDashStyle.Solid?ea.PdfLineCap.Square:r.lineCap,e.drawLine(r,i,a),e.restore()},t}(),ga=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 ca;return this.add(t),e}e.row=this.treegridRow,this.cells.push(e)},e.prototype.indexOf=function(e){return this.cells.indexOf(e)},e}(),fa=function(){function t(e){this.treegridRowOverflowIndex=0,this.rowHeight=0,this.rowWidth=0,this._isParentRow=!1,this.intendLevel=0,this.pdfTreeGrid=e}return Object.defineProperty(t.prototype,"cells",{get:function(){return(0,e.isNullOrUndefined)(this.treegridCells)&&(this.treegridCells=new ga(this)),this.treegridCells},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isParentRow",{get:function(){return this._isParentRow},set:function(e){this._isParentRow=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"treegrid",{get:function(){return this.pdfTreeGrid},set:function(e){this.pdfTreeGrid=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.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(t.prototype,"rowOverflowIndex",{get:function(){return this.treegridRowOverflowIndex},set:function(e){this.treegridRowOverflowIndex=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"level",{get:function(){return this.intendLevel},set:function(e){this.intendLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.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(t.prototype,"width",{get:function(){return 0===this.rowWidth&&(this.rowWidth=this.measureWidth()),this.rowWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rowIndex",{get:function(){return this.treegrid.rows.rowCollection.indexOf(this)},enumerable:!0,configurable:!0}),t.prototype.measureWidth=function(){for(var e=this.treegrid.columns.columns,t=0,i=0;i<e.length;i++){t+=e[i].width}return t},t.prototype.measureHeight=function(){for(var t=0===this.cells.count||(0,e.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);t=1===a.columnSpan||1===a.rowSpan?Math.max(t,a.height):Math.min(t,a.height),a.height=t}return t},t}(),ma=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 fa(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 ca);this.rows.push(e)},e.prototype.getRow=function(e){return this.rows[e]},e}(),ya=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}(),Da=function(){function t(e){this.columnWidth=0,this.treeColumnIndex=!1,this._headerText="",this._field="",this.treegrid=e}return Object.defineProperty(t.prototype,"headerText",{get:function(){return this._headerText},set:function(e){this._headerText=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"field",{get:function(){return this._field},set:function(e){this._field=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.columnWidth},set:function(e){this.columnWidth=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isTreeColumn",{get:function(){return this.treeColumnIndex},set:function(e){this.treeColumnIndex=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"format",{get:function(){return(0,e.isNullOrUndefined)(this.stringFormat)&&(this.stringFormat=new ea.PdfStringFormat),this.stringFormat},set:function(e){this.stringFormat=e},enumerable:!0,configurable:!0}),t}(),va=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 Da(this.treegrid));for(var i=0;i<this.treegrid.rows.count;i++){var a=this.treegrid.rows.getRow(i),r=new ca;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}(),ka=function(){return ka=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},ka.apply(this,arguments)},ba=function(){function t(e){this.totalColumnWidth=0,this.beforeSinglePageExport={},this.baselineHeight=8,this.parent=e}return t.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=(0,e.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=(0,e.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)),(0,e.isNullOrUndefined)(this.parent.projectStartDate)&&(0,e.isNullOrUndefined)(this.parent.projectEndDate)&&this.parent.dataOperation.calculateProjectDates();var t,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),t=this.exportProps.fitToWidthSettings.chartWidth?(t=parseInt(this.exportProps.fitToWidthSettings.chartWidth.split("%")[0],10))>100?100:t:this.exportProps.fitToWidthSettings.gridWidth?100-i:70;var r,n,s,o=this.parent.pdfExportModule.pdfPageDimensions.width*t/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=(0,e.extend)({},{},r,!0);(0,e.isNullOrUndefined)(this.parent.projectStartDate)&&this.parent.timelineModule.roundOffDateToZoom(this.parent.cloneProjectStartDate,!0,l,p.bottomTier.unit,r),(0,e.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}},t.prototype.processGridExport=function(e,t,i){this.flatData=e,this.gantt=t,this.exportValueFormatter=new wa(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=g(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},t.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++)})},t.prototype.processColumnHeader=function(t,i){this.gantt.columns.add(1);var a=this.gantt.columns.getColumn(i);this.columns[this.parent.treeColumnIndex].field===t.field&&(a.isTreeColumn=!0);var r=parseInt(t.width,10);a.width=g(r),this.totalColumnWidth+=a.width,a.headerText=t.headerText,a.field=t.field;var n=this.row.cells.getCell(i);n.value=t.headerText,n.isHeaderCell=!0,this.ganttStyle&&this.ganttStyle.columnHeader&&!(0,e.isNullOrUndefined)(this.ganttStyle.columnHeader.fontBrush)&&(n.style.fontBrush=new ea.PdfColor(this.ganttStyle.columnHeader.fontBrush));var s=this.parent.timelineModule.isSingleTier?45:60;this.copyStyles(this.ganttStyle.columnHeader,n,!1),this.row.height=g(s),t.headerTextAlign&&(n.style.format.alignment=ea.PdfTextAlignment[t.headerTextAlign]);n.fontStyle={fontSize:9};var o={cell:n,style:n.style,value:n.value,column:t,image:null,headerTemplate:{image:null,value:null,fontStyle:{fontBrush:null}}};this.parent.pdfColumnHeaderQueryCellInfo&&this.parent.trigger("pdfColumnHeaderQueryCellInfo",o),o.headerTemplate.image&&o.headerTemplate.value?(o.image=new ea.PdfBitmap(o.headerTemplate.image[0].base64),o.image.height=o.headerTemplate.image[0].height||o.image.height,o.image.width=o.headerTemplate.image[0].width||o.image.width,n.image=o.image,n.value=o.headerTemplate.value,n.fontStyle.fontSize=o.headerTemplate.fontStyle.fontSize,n.fontStyle.fontFamily=o.headerTemplate.fontStyle.fontFamily,n.fontStyle.fontBrush=o.headerTemplate.fontStyle.fontColor):n.value=o.value},t.prototype.isColumnVisible=function(e){return e.visible||this.exportProps.includeHiddenColumn},t.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++})},t.prototype.processTimeline=function(){this.parent.enableTimelineVirtualization&&(this.parent.timelineModule.pdfExportTopTierCollection=[],this.parent.timelineModule.pdfExportBottomTierCollection=[],this.parent.timelineModule.createTimelineSeries());var t=this.parent.timelineModule;if(this.gantt.chartHeader.topTierHeight=this.gantt.chartHeader.bottomTierHeight=this.parent.timelineModule.isSingleTier?45:30,this.gantt.chartHeader.topTierCellWidth=t.topTierCellWidth,this.gantt.chartHeader.bottomTierCellWidth=t.bottomTierCellWidth,this.gantt.chartHeader.topTier=(0,e.extend)([],[],this.parent.enableTimelineVirtualization?t.pdfExportTopTierCollection:t.topTierCollection,!0),this.gantt.chartHeader.bottomTier=(0,e.extend)([],[],this.parent.enableTimelineVirtualization?t.pdfExportBottomTierCollection:t.bottomTierCollection,!0),this.exportProps&&this.exportProps.fitToWidthSettings&&this.exportProps.fitToWidthSettings.isFitToWidth&&this.parent.enableTimelineVirtualization){var i="None"===t.topTier?"bottomTier":"topTier";this.gantt.chartHeader.width=t.calculateWidthBetweenTwoDate(i,t.timelineStartDate,t.timelineEndDate)}else this.gantt.chartHeader.width=this.parent.enableTimelineVirtualization?this.parent.timelineModule.wholeTimelineWidth:t.totalTimelineWidth;this.gantt.chartHeader.height=(0,e.isNullOrUndefined)(this.gantt.rows.getRow(0).height)?65:this.gantt.rows.getRow(0).height,this.gantt.timelineStartDate=new Date(t.timelineStartDate.getTime())},t.prototype.processPredecessor=function(){var t=this;((0,e.isNullOrUndefined)(this.exportProps.showPredecessorLines)||this.exportProps.showPredecessorLines)&&(this.parent.pdfExportModule.isPdfExport=!0,this.parent.predecessorModule.createConnectorLinesCollection(this.flatData),this.parent.updatedConnectorLineCollection.forEach(function(e){var i=t.gantt.predecessor.add();i.parentLeft=e.parentLeft,i.childLeft=e.childLeft,i.parentWidth=e.parentWidth,i.childWidth=e.childWidth,i.parentIndex=t.findIndexUsingParent(t.flatData,e.parentIndex),i.childIndex=t.findIndexUsingParent(t.flatData,e.childIndex),i.rowHeight=e.rowHeight,i.type=e.type,i.milestoneParent=e.milestoneParent,i.milestoneChild=e.milestoneChild,i.parentEndPoint=e.parentEndPoint,i.lineWidth=t.parent.connectorLineWidth>5?g(5):g(t.parent.connectorLineWidth),e.isCritical?i.connectorLineColor=t.ganttStyle.criticalConnectorLineColor:i.connectorLineColor=t.ganttStyle.connectorLineColor,t.gantt.predecessorCollection.push(i)}),this.parent.pdfExportModule.isPdfExport=!1)},t.prototype.findIndexUsingParent=function(e,t){return e.findIndex(function(e){return e.index===t})},t.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++)})},t.prototype.processRecordCell=function(t,i,a){var r=a.cells.getCell(this.colIndex),n=this.parent.taskFields,s=t.ganttProperties;"datepickeredit"===i.editType||"datetimepickeredit"===i.editType?r.value=t[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=(0,e.isNullOrUndefined)(t[i.field])?"":"number"===i.type?t[i.field]:t[i.field].toString();var o=(0,e.isNullOrUndefined)(r.value)?"":"number"===i.type?r.value:r.value.toString(),l=(0,e.isNullOrUndefined)(o)?"":o;r.isHeaderCell=!1,r.style.padding=new ra,this.copyStyles(this.ganttStyle.cell,r,a.isParentRow),i.index!==this.parent.treeColumnIndex?r.style.format.alignment=ea.PdfTextAlignment[i.textAlign]:r.style.format.paragraphIndent=10*r.row.level;var d={data:t,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(!(0,e.isNullOrUndefined)(d.image)&&!(0,e.isNullOrUndefined)(d.image.base64)){var g=(0,e.extend)({},d.image,null,!0);d.image=new ea.PdfBitmap(d.image.base64),d.image.height=g.height?g.height:d.image.height,d.image.width=g.width?g.width:d.image.width,r.image=d.image}r.value=d.value,(0,e.isNullOrUndefined)(d.hyperLink)||(0,e.isNullOrUndefined)(d.hyperLink.displayText)&&(0,e.isNullOrUndefined)(d.hyperLink.target)||(r.value=this.setHyperLink(d))},t.prototype.setHyperLink=function(e){var t=new ea.PdfTextWebLink;return t.url=e.hyperLink.target,t.text=e.hyperLink.displayText||e.hyperLink.target,t.font=new ea.PdfStandardFont(ea.PdfFontFamily.Helvetica,9.75),t.brush=new ea.PdfSolidBrush(new ea.PdfColor(51,102,187)),t},t.prototype.processTaskbar=function(){var t=this;this.flatData.forEach(function(i){var a=t.gantt.taskbar.add(),n=i.ganttProperties;a.left=n.left,a.width=n.width,a.left<0&&(a.width=a.width+a.left,a.left=0),a.progress=n.progress,a.isScheduledTask=r(n),r&&((0,e.isNullOrUndefined)(n.endDate)&&(0,e.isNullOrUndefined)(n.duration)?a.unscheduledTaskBy="startDate":(0,e.isNullOrUndefined)(n.startDate)&&(0,e.isNullOrUndefined)(n.duration)?a.unscheduledTaskBy="endDate":(a.unscheduledTaskBy="duration",a.unscheduleStarteDate=t.parent.dateValidationModule.getValidStartDate(i.ganttProperties),a.unscheduleEndDate=t.parent.dateValidationModule.getValidEndDate(i.ganttProperties))),a.startDate=n.startDate,a.endDate=n.endDate,a.height=t.parent.chartRowsModule.taskBarHeight,a.indicators=n.indicators,a.autoStartDate=n.autoStartDate,a.autoEndDate=n.autoEndDate,a.isAutoSchedule=n.isAutoSchedule,a.autoWidth=n.autoWidth,a.autoLeft=n.autoLeft,a.segment=n.segments,a.isSpliterTask=!(0,e.isNullOrUndefined)(n.segments)&&0!==n.segments.length,a.isSpliterTask&&(a.segmentCollection=a.segment.map(function(e){return ka({},e)})),a.baselineTop=t.parent.chartRowsModule.baselineTop,a.isMilestone=n.isMilestone,a.baselineStartDate=n.baselineStartDate,a.baselineEndDate=n.baselineEndDate,a.baselineLeft=n.baselineLeft,a.baselineWidth=n.baselineWidth,a.baselineLeft<0&&(a.baselineWidth=a.baselineWidth+a.baselineLeft,a.baselineLeft=0),a.milestoneColor=new ea.PdfColor(t.ganttStyle.taskbar.milestoneColor),a.isParentTask=i.hasChildRecords,n.isMilestone&&(a.height=n.width),i[t.parent.labelSettings.leftLabel]&&(a.leftTaskLabel.value=i[t.parent.labelSettings.leftLabel].toString()),i[t.parent.labelSettings.rightLabel]&&(a.rightTaskLabel.value=i[t.parent.labelSettings.rightLabel].toString()),(0,e.isNullOrUndefined)(i[t.parent.labelSettings.taskLabel])||(a.taskLabel=i[t.parent.labelSettings.taskLabel].toString());var s=n.isMilestone?Math.floor(t.parent.chartRowsModule.taskBarHeight/2)+33:33,o=!(i.hasChildRecords&&!i.ganttProperties.isAutoSchedule),l=o?n.left:n.autoLeft,d=o?n.width:n.autoWidth;a.rightTaskLabel.left=l+d+s,a.fontFamily=t.ganttStyle.fontFamily,a.progressWidth=n.progressWidth,a.labelColor=new ea.PdfColor(t.ganttStyle.label.fontColor),a.progressFontColor=new ea.PdfColor(t.ganttStyle.taskbar.progressFontColor),a.isParentTask?(a.taskColor=new ea.PdfColor(t.ganttStyle.taskbar.parentTaskColor),a.taskBorderColor=new ea.PdfColor(t.ganttStyle.taskbar.parentTaskBorderColor),a.progressColor=new ea.PdfColor(t.ganttStyle.taskbar.parentProgressColor)):i.isCritical?(a.taskColor=new ea.PdfColor(t.ganttStyle.taskbar.criticalTaskColor),a.progressColor=new ea.PdfColor(t.ganttStyle.taskbar.criticalProgressColor),a.taskBorderColor=new ea.PdfColor(t.ganttStyle.taskbar.criticalTaskBorderColor),a.milestoneColor=new ea.PdfColor(t.ganttStyle.taskbar.criticalTaskColor)):(a.taskColor=new ea.PdfColor(t.ganttStyle.taskbar.taskColor),a.progressColor=new ea.PdfColor(t.ganttStyle.taskbar.progressColor),a.taskBorderColor=new ea.PdfColor(t.ganttStyle.taskbar.taskBorderColor)),a.manualParentBorder=new ea.PdfColor(t.ganttStyle.taskbar.manualParentBorder),a.manualChildBorder=new ea.PdfColor(t.ganttStyle.taskbar.manualChildBorder),a.manuallineColor=new ea.PdfColor(t.ganttStyle.taskbar.manualLineColor),a.unscheduledTaskBarColor=new ea.PdfColor(t.ganttStyle.taskbar.unscheduledTaskBarColor),a.manualParentBackground=new ea.PdfColor(t.ganttStyle.taskbar.manualParentBackground),a.manualParentProgress=new ea.PdfColor(t.ganttStyle.taskbar.manualParentProgress),a.manualChildBackground=new ea.PdfColor(t.ganttStyle.taskbar.manualChildBackground),a.manualChildProgress=new ea.PdfColor(t.ganttStyle.taskbar.manualChildProgress),a.splitLineBackground=new ea.PdfColor(t.ganttStyle.taskbar.splitLineBackground),a.baselineColor=new ea.PdfColor(t.ganttStyle.taskbar.baselineColor),a.baselineBorderColor=new ea.PdfColor(t.ganttStyle.taskbar.baselineBorderColor),a.gridLineColor=new ea.PdfColor(t.ganttStyle.chartGridLineColor);var h={leftLabel:{value:null,image:null,fontStyle:{fontBrush:null}},rightLabel:{value:null,image:null,fontStyle:{fontBrush:null}},taskLabel:{value:null,image:null,fontStyle:{fontBrush:null}}};a.labelSettings=h;var p={value:null,image:null,fontStyle:{fontBrush:null}};a.taskbarTemplate=p,t.gantt.taskbarCollection.push(a);var u={};u.progressFontColor=a.progressFontColor,u.taskColor=a.taskColor,u.taskBorderColor=a.taskBorderColor,u.progressColor=a.progressColor,u.milestoneColor=a.milestoneColor,u.baselineColor=a.baselineColor,u.baselineBorderColor=a.baselineBorderColor,u.unscheduledTaskBarColor=a.unscheduledTaskBarColor,u.manualParentBackground=a.manualParentBackground,u.manualParentBorder=a.manualParentBorder,u.manualParentProgress=a.manualParentProgress,u.manualChildBackground=a.manualChildBackground,u.manualChildProgress=a.manualChildProgress,u.manualLineColor=a.manuallineColor,u.manualChildBorder=a.manualChildBorder,u.manualChildProgress=a.manualChildProgress,u.splitLineBackground=a.splitLineBackground;var c={taskbar:u,data:i,indicators:i.ganttProperties.indicators,labelSettings:h,taskbarTemplate:p};if(t.parent.pdfQueryTaskbarInfo){var g=[];if(c.taskbar.taskSegmentStyles=null,c.data.ganttProperties.segments){for(var f=0;f<c.data.ganttProperties.segments.length;f++){var m={taskColor:c.taskbar.taskColor,taskBorderColor:c.taskbar.taskBorderColor,progressColor:c.taskbar.progressColor};g.push(m)}c.taskbar.taskSegmentStyles=g}t.parent.trigger("pdfQueryTaskbarInfo",c),a.taskSegmentStyles=c.taskbar.taskSegmentStyles,a.progressFontColor=c.taskbar.progressFontColor,a.taskColor=c.taskbar.taskColor,a.taskBorderColor=c.taskbar.taskBorderColor,a.progressColor=c.taskbar.progressColor,a.milestoneColor=c.taskbar.milestoneColor,a.baselineColor=c.taskbar.baselineColor,a.baselineBorderColor=c.taskbar.baselineBorderColor,a.unscheduledTaskBarColor=c.taskbar.unscheduledTaskBarColor,a.manualParentBackground=c.taskbar.manualParentBackground,a.manualParentProgress=c.taskbar.manualParentProgress,a.manualParentBorder=c.taskbar.manualParentBorder,a.manualChildBackground=c.taskbar.manualChildBackground,a.manualChildProgress=c.taskbar.manualChildProgress,a.manuallineColor=c.taskbar.manualLineColor,a.manualChildBorder=c.taskbar.manualChildBorder,a.manualChildProgress=c.taskbar.manualChildProgress,a.splitLineBackground=c.taskbar.splitLineBackground,a.indicators=c.indicators,a.labelSettings.leftLabel.value=c.labelSettings.leftLabel.value;var y=c.labelSettings.leftLabel.image;a.labelSettings.rightLabel.value=c.labelSettings.rightLabel.value;var D=c.labelSettings.rightLabel.image;if((0,e.isNullOrUndefined)(c.labelSettings.taskLabel.value)||(a.taskLabel=c.labelSettings.taskLabel.value),!(0,e.isNullOrUndefined)(c.labelSettings.leftLabel.image)&&Array.isArray(c.labelSettings.leftLabel.image[0].base64)&&c.labelSettings.leftLabel.image[0].base64.length>0){var v=c.labelSettings.leftLabel.image[0].base64.length;a.labelSettings.leftLabel.image=[];for(f=0;f<v;f++)a.labelSettings.leftLabel.image.push({base64:y[0].base64[f],width:y[0].width,height:y[0].height})}else(0,e.isNullOrUndefined)(c.labelSettings.leftLabel.image)||(a.labelSettings.leftLabel.image=c.labelSettings.leftLabel.image);if(!(0,e.isNullOrUndefined)(c.labelSettings.rightLabel.image)&&Array.isArray(c.labelSettings.rightLabel.image[0].base64)&&c.labelSettings.rightLabel.image[0].base64.length>0){v=c.labelSettings.rightLabel.image[0].base64.length;a.labelSettings.rightLabel.image=[];for(f=0;f<v;f++)a.labelSettings.rightLabel.image.push({base64:D[0].base64[f],width:D[0].width,height:D[0].height})}else(0,e.isNullOrUndefined)(c.labelSettings.rightLabel.image)||(a.labelSettings.rightLabel.image=c.labelSettings.rightLabel.image);var k=function(i,r){if(i.progressFontColor=r.taskbar.progressFontColor,i.taskColor=new ea.PdfColor(r.taskbar.taskColor),i.taskBorderColor=r.taskbar.taskBorderColor,i.progressColor=r.taskbar.progressColor,i.milestoneColor=r.taskbar.milestoneColor,!(0,e.isNullOrUndefined)(r.taskbarTemplate.image)&&!(0,e.isNullOrUndefined)(r.taskbarTemplate.image[0].base64)){var n=r.taskbarTemplate.image[0].width,s=a.isMilestone&&r.taskbarTemplate.image[0].height<.7*t.parent.chartRowsModule.taskBarHeight?r.taskbarTemplate.image[0].height:.7*t.parent.chartRowsModule.taskBarHeight-2,o=(0,e.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}(0,e.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)};c.data.hasChildRecords||0===c.data.ganttProperties.duration?(c.data.hasChildRecords&&0!==c.data.ganttProperties.duration||0===c.data.ganttProperties.duration)&&k(a,c):k(a,c)}})},t.prototype.getHorizontalAlignment=function(e,t){switch(void 0===t&&(t=new ea.PdfStringFormat),e){case"Right":t.alignment=ea.PdfTextAlignment.Right;break;case"Center":t.alignment=ea.PdfTextAlignment.Center;break;case"Justify":t.alignment=ea.PdfTextAlignment.Justify;break;case"Left":t.alignment=ea.PdfTextAlignment.Left}return t},t.prototype.getVerticalAlignment=function(e,t,i){switch(void 0===t&&(t=new ea.PdfStringFormat,t=this.getHorizontalAlignment(i,t)),e){case"Bottom":t.lineAlignment=ea.PdfVerticalAlignment.Bottom;break;case"Middle":t.lineAlignment=ea.PdfVerticalAlignment.Middle;break;case"Top":t.lineAlignment=ea.PdfVerticalAlignment.Top}return t},t.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}},t.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}},t.prototype.getFont=function(t){if(t.font)return t.font;var i=this.exportProps.ganttStyle&&this.exportProps.ganttStyle.fontFamily?this.exportProps.ganttStyle.fontFamily:ea.PdfFontFamily.TimesRoman,a=(0,e.isNullOrUndefined)(t.style.fontSize)?9.75:.75*t.style.fontSize,r=(0,e.isNullOrUndefined)(t.style.fontFamily)?i:this.getFontFamily(t.style.fontFamily),n=ea.PdfFontStyle.Regular;return new ea.PdfStandardFont(r,a,n)},t.prototype.renderEmptyGantt=function(){var e=this.gantt.rows.addRow();0===e.cells.count&&e.cells.add(),e.cells.getCell(0).isHeaderCell=!1,e.height=g(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)},t.prototype.mergeCells=function(e,t,i){this.gantt.rows.getRow(e).cells.getCell(t).columnSpan=i},t.prototype.copyStyles=function(e,t,i){t.style.fontColor=new ea.PdfColor(e.fontColor),t.style.backgroundColor=new ea.PdfColor(e.backgroundColor),t.style.borderColor=new ea.PdfColor(e.borderColor),t.style.fontSize=e.fontSize,t.style.fontStyle=e.fontStyle,t.style.format=Object.assign(new ea.PdfStringFormat,e.format),t.style.borders=new aa,t.style.borders.all=new ea.PdfPen(t.style.borderColor),t.style.padding=new ra;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)},t.prototype.initializePdf=function(t){this.pdfDoc=t;var i=[],a=this.pdfDoc.pageSettings.width-82;if(this.exportProps&&this.exportProps.fitToWidthSettings&&this.exportProps.fitToWidthSettings.isFitToWidth){var r=void 0;if(this.exportProps.fitToWidthSettings.gridWidth)r=parseInt(this.exportProps.fitToWidthSettings.gridWidth.split("%")[0],10);else if(this.exportProps.fitToWidthSettings.chartWidth)r=100-parseInt(this.exportProps.fitToWidthSettings.chartWidth.split("%")[0],10);else r=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||(0,e.isNullOrUndefined)(this.exportProps.enableFooter)){var l=this.parent.pdfExportModule.getPageSize(this.exportProps.pageSize),d=new ea.RectangleF(0,0,l.width,35),h=new ea.PdfPen(this.ganttStyle.footer.borderColor),p=new ea.PdfPageTemplateElement(d),u=new ea.PdfSolidBrush(this.ganttStyle.footer.backgroundColor);p.graphics.drawRectangle(h,u,0,0,l.width,35);var c=new ea.PdfStandardFont(this.ganttStyle.fontFamily,this.ganttStyle.footer.fontSize,this.ganttStyle.footer.fontStyle);this.ganttStyle.font&&(c=this.ganttStyle.font);var g=new ea.PdfSolidBrush(this.ganttStyle.footer.fontColor),f=new ea.PdfPageNumberField(c),m=new ea.PdfPageCountField(c,g),y=new ea.PdfCompositeField(c,g,"Page {0}",f,m);y.stringFormat=this.ganttStyle.footer.format,y.bounds=d,y.draw(p.graphics,new ea.PointF(0,0)),t.template.bottom=p}var D=o.size,v=(0,e.isNullOrUndefined)(D)?this.pdfDoc.pageSettings.size:D;if(!(0,e.isNullOrUndefined)(this.exportProps.header)){var k=this.exportProps.header,b=new ea.PointF(0,k.fromTop),w=new ea.SizeF(1.1*v.width,k&&k.height?.75*k.height:50);d=new ea.RectangleF(b,w);t.template.top=this.drawPageTemplate(new ea.PdfPageTemplateElement(d),k)}if(!this.exportProps.enableFooter&&!(0,e.isNullOrUndefined)(this.exportProps.footer)){p=this.exportProps.footer,b=new ea.PointF(0,v.width-80-(p&&p.fromBottom?.75*p.fromBottom:0)),w=new ea.SizeF(1.1*v.width,p&&p.height?.75*p.height:50),d=new ea.RectangleF(b,w);this.pdfDoc.template.bottom=this.drawPageTemplate(new ea.PdfPageTemplateElement(d),p)}},t.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},t.prototype.drawText=function(t,i){var a=this.getFont(i);this.ganttStyle.font&&(a=this.ganttStyle.font);var r=this.getBrushFromContent(i),n=null;if(!(0,e.isNullOrUndefined)(i.style.textPenColor)){var s=this.hexToRgb(i.style.textPenColor);n=new ea.PdfPen(new ea.PdfColor(s.r,s.g,s.b))}null===r&&null===n&&(r=new ea.PdfSolidBrush(new ea.PdfColor(0,0,0)));var o=i.value.toString(),l=.75*i.position.x,d=.75*i.position.y,h=new ea.PdfStringFormat;(0,e.isNullOrUndefined)(i.style.stringFormat)||(h.alignment=i.style.stringFormat.alignment);var p=this.setContentFormat(i,h);null===p||(0,e.isNullOrUndefined)(p.format)||(0,e.isNullOrUndefined)(p.size)?t.graphics.drawString(o,a,n,r,l,d,h):t.graphics.drawString(o,a,n,r,l,d,p.size.width,p.size.height,p.format)},t.prototype.drawPageNumber=function(t,i){var a=this.getFont(i),r=null;if((0,e.isNullOrUndefined)(i.style.textBrushColor))r=new ea.PdfSolidBrush(new ea.PdfColor(0,0,0));else{var n=this.hexToRgb(i.style.textBrushColor);r=new ea.PdfSolidBrush(new ea.PdfColor(n.r,n.g,n.b))}var s,o,l=new ea.PdfPageNumberField(a,r);if(l.numberStyle=this.getPageNumberStyle(i.pageNumberType),(0,e.isNullOrUndefined)(i.format))o="{0}",s=new ea.PdfCompositeField(a,r,o,l);else{var d="$total",h="$current";if(-1!==i.format.indexOf(d)&&-1!==i.format.indexOf(h))(p=new ea.PdfPageCountField(a)).numberStyle=this.getPageNumberStyle(i.pageNumberType),o=i.format.indexOf(d)>i.format.indexOf(h)?(o=i.format.replace(h,"0")).replace(d,"1"):(o=i.format.replace(h,"1")).replace(d,"0"),s=new ea.PdfCompositeField(a,r,o,l,p);else if(-1!==i.format.indexOf(h)&&-1===i.format.indexOf(d))o=i.format.replace(h,"0"),s=new ea.PdfCompositeField(a,r,o,l);else{var p=new ea.PdfPageCountField(a);o=i.format.replace(d,"0"),s=new ea.PdfCompositeField(a,r,o,p)}}var u=.75*i.position.x,c=.75*i.position.y,g=this.setContentFormat(i,s.stringFormat);null===g||(0,e.isNullOrUndefined)(g.format)||(0,e.isNullOrUndefined)(g.size)||(s.stringFormat=g.format,s.bounds=new ea.RectangleF(u,c,g.size.width,g.size.height)),s.draw(t.graphics,u,c)},t.prototype.drawImage=function(t,i){var a=.75*i.position.x,r=.75*i.position.y,n=(0,e.isNullOrUndefined)(i.size)||(0,e.isNullOrUndefined)(i.size.width)?void 0:.5*i.size.width,s=(0,e.isNullOrUndefined)(i.size)||(0,e.isNullOrUndefined)(i.size.height)?void 0:.75*i.size.height,o=new ea.PdfBitmap(i.src);(0,e.isNullOrUndefined)(n)?t.graphics.drawImage(o,a,r):t.graphics.drawImage(o,a,r,n,s)},t.prototype.drawLine=function(t,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);(0,e.isNullOrUndefined)(i.style)||((0,e.isNullOrUndefined)(i.style.penSize)||"number"!=typeof i.style.penSize||(o.width=.75*i.style.penSize),o.dashStyle=this.getDashStyle(i.style.dashStyle)),t.graphics.drawLine(o,a,r,n,s)},t.prototype.getPenFromContent=function(t){var i=new ea.PdfPen(new ea.PdfColor(0,0,0));if(!(0,e.isNullOrUndefined)(t.style)&&null!==t.style&&!(0,e.isNullOrUndefined)(t.style.penColor)){var a=this.hexToRgb(t.style.penColor);i=new ea.PdfPen(new ea.PdfColor(a.r,a.g,a.b))}return i},t.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}},t.prototype.getBrushFromContent=function(t){var i=null;if(!(0,e.isNullOrUndefined)(t.style.textBrushColor)){var a=this.hexToRgb(t.style.textBrushColor);i=new ea.PdfSolidBrush(new ea.PdfColor(a.r,a.g,a.b))}return i},t.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}},t.prototype.setContentFormat=function(t,i){var a=t.size?.75*t.size.width:this.pdfDoc.pageSettings.size.width,r=t.size?.75*t.size.height:(0,e.isNullOrUndefined)(this.exportProps.footer)?0:.5*this.exportProps.footer.height;if(i=new ea.PdfStringFormat(ea.PdfTextAlignment.Left,ea.PdfVerticalAlignment.Middle),!(0,e.isNullOrUndefined)(t.style.hAlign))switch(t.style.hAlign){case"Right":i.alignment=ea.PdfTextAlignment.Right;break;case"Center":i.alignment=ea.PdfTextAlignment.Center;break;case"Justify":i.alignment=ea.PdfTextAlignment.Justify;break;default:i.alignment=ea.PdfTextAlignment.Left}return(0,e.isNullOrUndefined)(t.style.vAlign)||(i=this.getVerticalAlignment(t.style.vAlign,i)),{format:i,size:new ea.SizeF(a,r)}},t.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}},t}(),wa=function(){function t(t){this.valueFormatter=new Ze.ValueFormatter(t),this.internationalization=new e.Internationalization(t)}return t.prototype.returnFormattedValue=function(t,i){return!(0,e.isNullOrUndefined)(t.value)&&t.value?this.valueFormatter.getFormatFunction(i)(t.value):""},t.prototype.formatCellValue=function(t,i){if(t.isForeignKey&&(t.value=(0,e.getValue)(t.column.foreignKeyValue,(0,Ze.getForeignData)(t.column,{},t.value)[0])),"number"===t.column.type&&void 0!==t.column.format&&""!==t.column.format)return t.value?this.internationalization.getNumberFormat({format:t.column.format})(t.value):"";if("boolean"===t.column.type)return t.value?"true":"false";if("date"!==t.column.type&&"datetime"!==t.column.type&&"time"!==t.column.type||void 0===t.column.format||""===t.value){if(((0,e.isNullOrUndefined)(t.column.type)||(0,e.isNullOrUndefined)(t.value))&&(0,e.isNullOrUndefined)(t.value))return"";if(t.column.field===i.taskFields.constraintType){var a=D[t.value],r=i.treeGridModule.getLocalizedConstraintTypeText(a);t.value=r}return t.value.toString()}if("string"==typeof t.value&&(t.value=new Date(t.value)),"string"==typeof t.column.format){var n=void 0;return n="date"===t.column.type?{type:"date",format:t.column.format}:"time"===t.column.type?{type:"time",format:t.column.format}:{type:"dateTime",format:t.column.format},this.returnFormattedValue(t,n)}if(t.column.format instanceof Object&&void 0===t.column.format.type)return t.value.toString();var s=void 0;return s="date"===t.column.type?{type:t.column.format.type,format:t.column.format.format,skeleton:t.column.format.skeleton}:"time"===t.column.type?{type:"time",format:t.column.format.format,skeleton:t.column.format.skeleton}:{type:"dateTime",format:t.column.format.format,skeleton:t.column.format.skeleton},this.returnFormattedValue(t,s)},t}(),Ta=function(){return Ta=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Ta.apply(this,arguments)},Sa=function(){function t(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 t.prototype.add=function(){return new t(this.parent)},t.prototype.GetNextPage=function(e){var t=e.section,i=t.indexOf(e);return i===t.count-1?t.add():t.getPages()[i+1]},t.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)},t.prototype.drawTaskbar=function(t,i,a,r,n,s,o,l){var d=this,h=t.graphics,p=!1,u=t.getClientSize();i.y+n>u.height&&((t=this.GetNextPage(t)).contentWidth=this.isAutoFit()?f(a.endPoint-a.startPoint):a.endPoint-a.startPoint,h=t.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(t,i,a,this.parent.pdfExportModule.gantt.currentPage),i.y=g(this.parent.timelineModule.isSingleTier?45:60)),p=!0),this.drawLeftLabel(t,i,a,r,s);var c,m,y,D,v,k=new ea.PdfStandardFont(this.fontFamily,this.defaultFontSize,ea.PdfFontStyle.Regular),b=null,w=new ea.PdfSolidBrush(this.progressFontColor);c=k,!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)&&s.taskbarTemplate.fontStyle&&s.taskbarTemplate.fontStyle.fontFamily&&s.taskbarTemplate.fontStyle.fontSize&&(c=new ea.PdfStandardFont(s.taskbarTemplate.fontStyle.fontFamily,s.taskbarTemplate.fontStyle.fontSize,s.taskbarTemplate.fontStyle.fontStyle)),m=!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)&&s.taskbarTemplate.fontStyle&&s.taskbarTemplate.fontStyle.fontColor?new ea.PdfSolidBrush(s.taskbarTemplate.fontStyle.fontColor):w,y=!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)&&s.taskbarTemplate.fontStyle&&s.taskbarTemplate.fontStyle.fontBrush?new ea.PdfPen(s.taskbarTemplate.fontStyle.fontBrush):b,!(0,e.isNullOrUndefined)(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(k=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var T=this.parent.pdfExportModule.helper.exportProps.ganttStyle,S=this.labelSettings.taskLabel;if(S.fontStyle.fontSize||S.fontStyle.fontFamily||S.fontStyle.fontStyle){var P=S.fontStyle&&S.fontStyle.fontFamily?S.fontStyle.fontFamily:this.fontFamily||ea.PdfFontFamily.Helvetica,C=S.fontStyle&&S.fontStyle.fontSize?S.fontStyle.fontSize:this.defaultFontSize,R=S.fontStyle&&"string"==typeof S.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(S.fontStyle.fontStyle):S.fontStyle&&S.fontStyle.fontStyle?S.fontStyle.fontStyle:ea.PdfFontStyle.Regular;D=new ea.PdfStandardFont(P,C,R)}else T&&T.label&&T.label.fontBrush?v=new ea.PdfSolidBrush(T.label.fontBrush):D=k;v=s.labelSettings.taskLabel.fontStyle.fontColor?new ea.PdfSolidBrush(s.labelSettings.taskLabel.fontStyle.fontColor):T&&T.label&&T.label.fontColor?new ea.PdfSolidBrush(T.label.fontColor):w,(0,e.isNullOrUndefined)(T)||(0,e.isNullOrUndefined)(T.label)||(0,e.isNullOrUndefined)(T.label.fontBrush)||(b=new ea.PdfPen(T.label.fontBrush)),(0,e.isNullOrUndefined)(T)||(0,e.isNullOrUndefined)(T.label)||(0,e.isNullOrUndefined)(T.label.fontSize)&&(0,e.isNullOrUndefined)(T.label.fontStyle)&&(0,e.isNullOrUndefined)(T.label.fontFamily)||(D=this.getPdfFont(T));var M=new ea.PdfStringFormat;M.lineAlignment=ea.PdfVerticalAlignment.Middle,M.alignment=ea.PdfTextAlignment.Right;var x,O=!1;!(0,e.isNullOrUndefined)(this.taskLabel)&&/^[a-zA-Z0-9]/.test(this.taskLabel)&&("0"!==this.taskLabel&&"0%"!==this.taskLabel||(x=this.width,M.alignment=ea.PdfTextAlignment.Left)),(!(0,e.isNullOrUndefined)(this.taskLabel)&&/^[a-zA-Z]/.test(this.taskLabel)||!(0,e.isNullOrUndefined)(s.taskbarTemplate.value))&&(O=!0,M.alignment=ea.PdfTextAlignment.Left),(0,e.isNullOrUndefined)(T)||(0,e.isNullOrUndefined)(T.label)||(0,e.isNullOrUndefined)(T.label.format)||(M=T.label.format);var I={left:0,right:0,top:0,bottom:0};(0,e.isNullOrUndefined)(T)||(0,e.isNullOrUndefined)(T.label)||(0,e.isNullOrUndefined)(T.label.padding)||(I=T.label.padding);var E=-1,F=new ea.PdfPen(s.baselineBorderColor),U=new ea.PdfSolidBrush(s.baselineColor),N=s.taskbarTemplate;if(s.isMilestone)this.drawMilestone(t,i,a,r,s,!1),this.parent.renderBaseline&&s.baselineStartDate&&s.baselineEndDate&&this.drawMilestone(t,i,a,r,s,!0);else{var L=new ea.PdfPen(s.taskBorderColor),V=new ea.PdfSolidBrush(s.taskColor),B=new ea.PdfPen(s.manualParentBorder),A=new ea.PdfPen(s.manualChildBorder),W=new ea.PdfPen(s.manuallineColor),H=(new ea.PdfPen(s.manualParentProgress),new ea.PdfPen(s.manuallineColor)),j=new ea.PdfSolidBrush(s.manuallineColor),z=new ea.PdfPen(s.splitLineBackground),q=new ea.PdfSolidBrush(s.manualParentBackground),G=new ea.PdfSolidBrush(s.manualChildBackground),_=new ea.PdfSolidBrush(s.manualChildProgress),Z=new ea.PdfSolidBrush(s.manualParentProgress),X=new ea.PdfPen(s.progressColor),Y=new ea.PdfSolidBrush(s.progressColor),K=g((this.parent.rowHeight-this.height)/2),Q=g((this.parent.rowHeight-this.height)/4.5),$=this.parent.renderBaseline?Q:K;E=t.section.indexOf(t);var J=(0,e.isNullOrUndefined)(this.unscheduleStarteDate)?this.startDate:this.unscheduleStarteDate,ee=(0,e.isNullOrUndefined)(this.unscheduleEndDate)?this.endDate:this.unscheduleEndDate,te=10;if(a.startDate<=J&&ee<=a.endDate){if(this.isStartPoint||(this.taskStartPoint=Ta({},i),this.isStartPoint=!0),this.isScheduledTask||"duration"!==this.unscheduledTaskBy)if(this.isScheduledTask||"endDate"!==this.unscheduledTaskBy)if(this.isScheduledTask||"duration"===this.unscheduledTaskBy){if(s.isSpliterTask)z.dashStyle=ea.PdfDashStyle.Dot,this.isAutoFit()?h.drawLine(z,new ea.PointF(i.x+(this.left-r)+.5,i.y+$+g(s.height/2)),new ea.PointF(s.width+i.x+(this.left-r)+.5,i.y+$+g(s.height/2))):h.drawLine(z,new ea.PointF(i.x+g(this.left-r)+.5,i.y+$+g(s.height/2)),new ea.PointF(g(s.width)+i.x+g(this.left-r)+.5,i.y+$+g(s.height/2))),s.segmentCollection.map(function(t,a){var n=(0,e.isNullOrUndefined)(d.taskSegmentStyles)?L:new ea.PdfPen(d.taskSegmentStyles[a].taskBorderColor),o=(0,e.isNullOrUndefined)(d.taskSegmentStyles)?V:new ea.PdfSolidBrush(d.taskSegmentStyles[a].taskColor);if(d.isAutoFit()){if(h.drawRectangle(n,o,i.x+(d.left+t.left-r)+.5,i.y+$,t.width,g(s.height)),N.image||N.value){var l=void 0;if((0,e.isNullOrUndefined)(s.taskbarTemplate.image))l=0;else{l=s.taskbarTemplate.image[0].width;var p=new ea.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(p,i.x+(d.left+t.left-r)+.5,i.y+$,g(s.taskbarTemplate.image[0].width),g(s.taskbarTemplate.image[0].height))}!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)&&h.drawString(s.taskbarTemplate.value,c,y,m,i.x+(d.left+t.left-r)+.5+l,i.y+$,g(t.width),g(s.height),M)}}else if(h.drawRectangle(n,o,i.x+g(d.left+t.left-r)+.5,i.y+$,g(t.width),g(s.height)),N.image||N.value){l=void 0;if((0,e.isNullOrUndefined)(s.taskbarTemplate.image))l=0;else{l=s.taskbarTemplate.image[0].width;p=new ea.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(p,i.x+g(d.left+t.left-r)+.5,i.y+$,g(s.taskbarTemplate.image[0].width),g(s.taskbarTemplate.image[0].height))}!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)&&h.drawString(s.taskbarTemplate.value,c,y,m,i.x+g(d.left+t.left-r)+.5+l,i.y+$,g(t.width),g(s.height),M)}});else if(!s.isAutoSchedule&&s.isParentTask){h.save(),(de=new ea.PdfPath).addEllipse(0,0,5,5),this.isAutoFit()?h.translateTransform(i.x+(this.left-r)+.5,i.y+$-2):h.translateTransform(i.x+g(this.left-r)+.5,i.y+$-2),h.drawPath(W,j,de),h.restore(),(ce=new ea.PdfPath).addEllipse(0,0,5,5),h.save(),this.isAutoFit()?h.translateTransform(i.x+(this.left-r)+.5+this.width,i.y+$-2):h.translateTransform(i.x+g(this.left-r)+.5+g(this.width),i.y+$-2),h.drawPath(W,j,ce),h.restore(),H.dashStyle=ea.PdfDashStyle.Solid,this.isAutoFit()?h.drawLine(H,new ea.PointF(i.x+(this.left-r)+.5,i.y+$),new ea.PointF(s.width+i.x+(this.left-r)+.5,i.y+$)):h.drawLine(H,new ea.PointF(i.x+g(this.left-r)+.5,i.y+$),new ea.PointF(g(s.width)+i.x+g(this.left-r)+.5,i.y+$))}else if(s.isAutoSchedule||s.isParentTask)if(this.isAutoFit())if((0,e.isNullOrUndefined)(N.value)&&(0,e.isNullOrUndefined)(N.image))h.drawRectangle(L,V,i.x+(this.left-r)+.5,i.y+$,s.width,g(s.height));else{h.drawRectangle(L,V,i.x+(this.left-r)+.5,i.y+$,s.width,g(s.height));re=void 0;if((0,e.isNullOrUndefined)(s.taskbarTemplate.image))re=0;else{re=s.taskbarTemplate.image[0].width/2;ne=new ea.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ne,i.x+(this.left-r)+.5,i.y+$+(s.height-s.taskbarTemplate.image[0].height)/2,s.taskbarTemplate.image[0].width/2,s.taskbarTemplate.image[0].height/2)}s.taskbarTemplate.value&&(O&&(x=this.width),h.drawString(s.taskbarTemplate.value,c,y,m,i.x+(this.left-r)+re,i.y+$,x,g(this.height),M))}else if((0,e.isNullOrUndefined)(N.value)&&(0,e.isNullOrUndefined)(N.image))h.drawRectangle(L,V,i.x+g(this.left-r)+.5,i.y+$,g(s.width),g(s.height));else{h.drawRectangle(L,V,i.x+g(this.left-r)+.5,i.y+$,g(s.width),g(s.height));re=void 0;if((0,e.isNullOrUndefined)(s.taskbarTemplate.image))re=0;else{re=s.taskbarTemplate.image[0].width;ne=new ea.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ne,i.x+g(this.left-r)+1,i.y+$+1+g((s.height-s.taskbarTemplate.image[0].height)/2),g(s.taskbarTemplate.image[0].width),g(s.taskbarTemplate.image[0].height))}!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)&&h.drawString(s.taskbarTemplate.value,c,y,m,i.x+g(this.left-r)+re,i.y+$,g(x),g(this.height),M)}else h.save(),h.setTransparency(.87),this.isAutoFit()?h.drawRectangle(A,G,i.x+(this.left-r)+.5,i.y+$,s.width,g(s.height)):h.drawRectangle(A,G,i.x+g(this.left-r)+.5,i.y+$,g(s.width),g(s.height)),h.restore(),this.isAutoFit()?h.drawRectangle(null,_,i.x+(this.left-r)+.5,i.y+$,s.progressWidth,g(this.height)):h.drawRectangle(null,_,i.x+g(this.left-r)+.5,i.y+$,g(s.progressWidth),g(this.height));this.isScheduledTask&&!s.isSpliterTask?(0,e.isNullOrUndefined)(N.image)&&(0,e.isNullOrUndefined)(N.value)&&(this.isAutoFit()&&s.isAutoSchedule?h.drawRectangle(X,Y,i.x+(this.left-r)+.5,i.y+$,s.progressWidth,g(s.height)):s.isAutoSchedule&&h.drawRectangle(X,Y,i.x+g(this.left-r)+.5,i.y+$,g(s.progressWidth),g(s.height)),(0,e.isNullOrUndefined)(this.parent.labelSettings.taskLabel)||(0,e.isNullOrUndefined)(this.taskLabel)||("0"!==this.taskLabel&&"0%"!==this.taskLabel&&(x=this.progressWidth),O&&(x=this.width),this.isAutoFit()?h.drawString(this.taskLabel.toString(),D,b,v,i.x+(this.left-r)-(I.left+I.right),i.y+$-(I.top+I.bottom),x,g(this.height),M):h.drawString(this.taskLabel.toString(),D,b,v,i.x+g(this.left-r)-(I.left+I.right),i.y+$-(I.top+I.bottom),g(x),g(this.height),M))):s.isSpliterTask&&s.segment.map(function(t,a){var n=(0,e.isNullOrUndefined)(d.taskSegmentStyles)?X:new ea.PdfPen(d.taskSegmentStyles[a].progressColor),o=(0,e.isNullOrUndefined)(d.taskSegmentStyles)?Y:new ea.PdfSolidBrush(d.taskSegmentStyles[a].progressColor);d.isAutoFit()?h.drawRectangle(n,o,i.x+(d.left+t.left-r)+.5,i.y+$,t.progressWidth,g(s.height)):h.drawRectangle(n,o,i.x+g(d.left+t.left-r)+.5,i.y+$,g(t.progressWidth),g(s.height))})}else this.drawUnscheduledTask(h,i,r,$);else this.drawUnscheduledTask(h,i,r,$);else{var ie=void 0,ae=void 0;if(this.isAutoFit()){if(ie=new ea.PdfLinearGradientBrush(new ea.PointF(i.x+(this.left-r)+.5+s.width/2,0),new ea.PointF(i.x+(this.left-r),0),new ea.PdfColor(s.unscheduledTaskBarColor),new ea.PdfColor(255,255,255)),h.drawRectangle(ie,i.x+(this.left-r)+.5,i.y+$,s.width,g(s.height)),ae=new ea.PdfLinearGradientBrush(new ea.PointF(i.x+(this.left-r)+.5+s.width,0),new ea.PointF(i.x+(this.left-r)+s.width/2,0),new ea.PdfColor(255,255,255),new ea.PdfColor(s.unscheduledTaskBarColor)),h.drawRectangle(ae,i.x+(this.left-r)+.5+s.width/2,i.y+$,s.width/2,g(s.height)),N.image||N.value){var re=void 0;if((0,e.isNullOrUndefined)(s.taskbarTemplate.image))re=0;else{re=s.taskbarTemplate.image[0].width;var ne=new ea.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ne,i.x+(this.left-r)+.5,i.y+$,g(s.taskbarTemplate.image[0].width),g(s.taskbarTemplate.image[0].height))}!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)&&h.drawString(s.taskbarTemplate.value,c,y,m,i.x+(this.left-r)+.5+re,i.y+$,g(s.width),g(this.height),M)}}else if(ie=new ea.PdfLinearGradientBrush(new ea.PointF(i.x+g(this.left-r)+.5+g(s.width)/2,0),new ea.PointF(i.x+g(this.left-r),0),new ea.PdfColor(s.unscheduledTaskBarColor),new ea.PdfColor(255,255,255)),h.drawRectangle(ie,i.x+g(this.left-r)+.5,i.y+$,g(s.width),g(s.height)),ae=new ea.PdfLinearGradientBrush(new ea.PointF(i.x+g(this.left-r)+.5+g(s.width),0),new ea.PointF(i.x+g(this.left-r)+g(s.width)/2,0),new ea.PdfColor(255,255,255),new ea.PdfColor(s.unscheduledTaskBarColor)),h.drawRectangle(ae,i.x+g(this.left-r)+.5+g(s.width)/2,i.y+$,g(s.width)/2,g(s.height)),N.image||N.value){var re=void 0;if((0,e.isNullOrUndefined)(s.taskbarTemplate.image))re=0;else{re=s.taskbarTemplate.image[0].width;var ne=new ea.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ne,i.x+g(this.left-r)+.5,i.y+$,g(s.taskbarTemplate.image[0].width),g(s.taskbarTemplate.image[0].height))}!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)&&h.drawString(s.taskbarTemplate.value,c,y,m,i.x+g(this.left-r)+.5+re,i.y+$,g(s.width),g(this.height),M)}}this.isCompleted=!0,this.startPage=E,this.endPage=E}else if(a.startDate<=J&&a.endDate>=J&&ee>=a.endDate){this.isStartPoint||(this.taskStartPoint=Ta({},i),this.isStartPoint=!0);var se=this.width,oe=0,le=0;if(this.width=this.width-(a.totalWidth-(this.left-r)),oe=a.totalWidth-(this.left-r),le=a.totalWidth-(this.left-r),se<oe&&(oe=se),this.isScheduledTask||"duration"!==this.unscheduledTaskBy)if(this.isScheduledTask||"duration"===this.unscheduledTaskBy)if(!s.isAutoSchedule&&s.isParentTask){var de;h.save(),(de=new ea.PdfPath).addEllipse(0,0,5,5),this.isAutoFit()?h.translateTransform(i.x+(this.left-r)+.5,i.y+$-2):h.translateTransform(i.x+g(this.left-r)+.5,i.y+$-2),h.drawPath(W,j,de),h.restore(),H.dashStyle=ea.PdfDashStyle.Solid,this.isAutoFit()?h.drawLine(H,new ea.PointF(i.x+(this.left-r)+.5,i.y+$),new ea.PointF(oe+i.x+(this.left-r)+.5,i.y+$)):h.drawLine(H,new ea.PointF(i.x+g(this.left-r)+.5,i.y+$),new ea.PointF(g(oe)+i.x+g(this.left-r)+.5,i.y+$))}else if(s.isAutoSchedule||s.isParentTask)if(this.isScheduledTask||"duration"===this.unscheduledTaskBy)if(this.isScheduledTask||"endDate"!==this.unscheduledTaskBy)if(s.isSpliterTask){var he=0;z.dashStyle=ea.PdfDashStyle.Dot,this.isAutoFit()?h.drawLine(z,new ea.PointF(i.x+(this.left-r)+.5,i.y+$+g(s.height/2)),new ea.PointF(oe+(this.left-r)+i.x,i.y+$+g(s.height/2))):h.drawLine(z,new ea.PointF(i.x+g(this.left-r)+.5,i.y+$+g(s.height/2)),new ea.PointF(g(oe)+g(this.left-r)+i.x,i.y+$+g(s.height/2))),s.segmentCollection.map(function(t,n){if(t.startDate<a.endDate&&t.endDate>a.startDate){var o=(0,e.isNullOrUndefined)(d.taskSegmentStyles)?L:new ea.PdfPen(d.taskSegmentStyles[n].taskBorderColor),l=(0,e.isNullOrUndefined)(d.taskSegmentStyles)?V:new ea.PdfSolidBrush(d.taskSegmentStyles[n].taskColor),p=(0,e.isNullOrUndefined)(d.taskSegmentStyles)?X:new ea.PdfPen(d.taskSegmentStyles[n].progressColor),u=(0,e.isNullOrUndefined)(d.taskSegmentStyles)?Y:new ea.PdfSolidBrush(d.taskSegmentStyles[n].progressColor),f=oe-t.left;t.width<f&&(f=t.width);var D=f;if(t.progressWidth<D&&(D=t.progressWidth),d.isAutoFit()){if(h.drawRectangle(o,l,i.x+(d.left-r)+.5+t.left,i.y+$,t.width,g(s.height)),h.drawRectangle(p,u,i.x+(d.left+t.left-r)+.5,i.y+$,t.progressWidth,g(s.height)),N.image||N.value){var v=void 0;if((0,e.isNullOrUndefined)(s.taskbarTemplate.image))v=0;else{v=s.taskbarTemplate.image[0].width;var k=new ea.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(k,i.x+(d.left-r)+.5+t.left,i.y+$,s.taskbarTemplate.image[0].width,s.taskbarTemplate.image[0].height)}!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)&&h.drawString(s.taskbarTemplate.value,c,y,m,i.x+(d.left-r)+.5+t.left+v,i.y+$,t.width,s.height,M)}}else if(h.drawRectangle(o,l,i.x+g(d.left-r)+.5+g(t.left),i.y+$,g(f),g(s.height)),h.drawRectangle(p,u,i.x+g(d.left+t.left-r)+.5,i.y+$,g(D),g(s.height)),N.image||N.value){v=void 0;if((0,e.isNullOrUndefined)(s.taskbarTemplate.image))v=0;else{v=s.taskbarTemplate.image[0].width;k=new ea.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(k,i.x+g(d.left-r)+.5+g(t.left),i.y+$,g(s.taskbarTemplate.image[0].width),g(s.taskbarTemplate.image[0].height))}!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)&&h.drawString(s.taskbarTemplate.value,c,y,m,i.x+g(d.left-r)+.5+g(t.left)+v,i.y+$,g(t.width),g(s.height),M)}0===d.segmentCollection[parseInt(n.toString(),10)].width?d.segmentCollection[parseInt(n.toString(),10)].progressWidth=0:t.width-d.segmentCollection[parseInt(n.toString(),10)].width<t.progressWidth&&t.width!==d.segmentCollection[n].width&&(d.segmentCollection[parseInt(n.toString(),10)].progressWidth=t.progressWidth-(t.width-d.segmentCollection[n].width)),f>=(he=t.left+t.width)?(d.segmentCollection[parseInt(n.toString(),10)].width=0,d.segmentCollection[parseInt(n.toString(),10)].left=0):(f>=he-t.width?(d.segmentCollection[parseInt(n.toString(),10)].left=0,d.segmentCollection[parseInt(n.toString(),10)].width=t.width-f):d.segmentCollection[parseInt(n.toString(),10)].left=t.left-a.totalWidth,oe>=he&&(d.segmentCollection[parseInt(n.toString(),10)].width=0))}}),this.pageDetailedWidth+=oe}else{if(this.isAutoFit())if((0,e.isNullOrUndefined)(N.value)&&(0,e.isNullOrUndefined)(N.image))h.drawRectangle(L,V,i.x+(this.left-r)+.5,i.y+$,oe,g(s.height));else{if(h.drawRectangle(L,V,i.x+(this.left-r)+.5,i.y+$,oe,g(s.height)),!(0,e.isNullOrUndefined)(s.taskbarTemplate.image)){ne=new ea.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ne,i.x+(this.left-r)+.5,i.y+$+g((s.height-s.taskbarTemplate.image[0].height)/.5),s.taskbarTemplate.image[0].width/2,s.taskbarTemplate.image[0].height/2)}if(!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)){re=(0,e.isNullOrUndefined)(s.taskbarTemplate.image)?0:s.taskbarTemplate.image[0].width;h.drawString(s.taskbarTemplate.value,c,y,m,i.x+(this.left-r)+re,i.y+$,g(x),g(this.height),M)}}else if((0,e.isNullOrUndefined)(N.value)&&(0,e.isNullOrUndefined)(N.image))h.drawRectangle(L,V,i.x+g(this.left-r)+.5,i.y+$,g(oe),g(s.height));else{h.drawRectangle(L,V,i.x+g(this.left-r)+.5,i.y+$,g(oe),g(s.height));re=void 0;if((0,e.isNullOrUndefined)(s.taskbarTemplate.image))re=0;else{re=s.taskbarTemplate.image[0].width;ne=new ea.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ne,i.x+g(this.left-r)+1,i.y+$+1+g((s.height-s.taskbarTemplate.image[0].height)/2),g(s.taskbarTemplate.image[0].width),g(s.taskbarTemplate.image[0].height))}if(!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)){this.stringLeft=g(this.left);var pe=this.getWidth(s.taskbarTemplate.value,a.endPoint-this.stringLeft,15);h.drawString(pe.lines[0].text,c,y,m,i.x+g(this.left-r)+re,i.y+$,g(x),g(this.height),M),(0,e.isNullOrUndefined)(pe.remainder)||(this.remainString=pe.remainder,this.stringLeft=a.endPoint)}}if(s.isAutoSchedule&&!s.isSpliterTask){var ue=0;if(ue=this.progressWidth<=oe?this.progressWidth:oe,(0,e.isNullOrUndefined)(N.image)&&(0,e.isNullOrUndefined)(N.value)&&(this.isAutoFit()?h.drawRectangle(X,Y,i.x+(this.left-r)+.5,i.y+$,ue,g(s.height)):h.drawRectangle(X,Y,i.x+g(this.left-r)+.5,i.y+$,g(ue),g(s.height))),this.progressWidth-=ue,this.parent.labelSettings.taskLabel&&!(0,e.isNullOrUndefined)(this.taskLabel))if(x=ue,O&&(x=oe),this.stringLeft=this.left,(0,e.isNullOrUndefined)(s.taskbarTemplate.value)){pe=this.getWidth(this.taskLabel.toString(),a.endPoint-this.stringLeft,15);h.drawString(pe.lines[0].text,D,b,v,i.x+g(this.left-r),i.y+$,g(x),g(this.height),M),(0,e.isNullOrUndefined)(pe.remainder)||(this.remainString=pe.remainder,this.stringLeft=a.endPoint)}else this.isAutoFit()?h.drawString(this.taskLabel.toString(),D,b,v,i.x+(this.left-r)-(I.left+I.right),i.y+$-(I.top+I.bottom),x,g(this.height),M):h.drawString(this.taskLabel.toString(),D,b,v,i.x+g(this.left-r)-(I.left+I.right),i.y+$-(I.top+I.bottom),g(x),g(this.height),M)}}else this.drawUnscheduledTask(h,i,r,$);else this.drawUnscheduledTask(h,i,r,$);else this.isAutoFit()?h.drawRectangle(A,null,i.x+(this.left-r)+.5,i.y+$,oe,g(s.height)):h.drawRectangle(A,null,i.x+g(this.left-r)+.5,i.y+$,g(oe),g(s.height)),h.save(),h.setTransparency(.87),this.isAutoFit()?h.drawRectangle(null,G,i.x+(this.left-r)+.5,i.y+$,oe,g(s.height)):h.drawRectangle(null,G,i.x+g(this.left-r)+.5,i.y+$,g(oe),g(s.height)),h.restore(),this.isAutoFit()?h.drawRectangle(null,_,i.x+(this.left-r)+.5,i.y+$,le,g(s.height)):h.drawRectangle(null,_,i.x+g(this.left-r)+.5,i.y+$,g(le),g(s.height)),s.progressWidth=s.progressWidth-le;else this.drawUnscheduledTask(h,i,r,$);else{ie=void 0,ae=void 0;if(this.isAutoFit()){if(ie=new ea.PdfLinearGradientBrush(new ea.PointF(i.x+(this.left-r)+.5+oe/2,0),new ea.PointF(i.x+(this.left-r),0),new ea.PdfColor(s.unscheduledTaskBarColor),new ea.PdfColor(255,255,255)),h.drawRectangle(ie,i.x+(this.left-r)+.5,i.y+$,oe,g(s.height)),ae=new ea.PdfLinearGradientBrush(new ea.PointF(i.x+(this.left-r)+.5+oe,0),new ea.PointF(i.x+(this.left-r)+oe/2,0),new ea.PdfColor(255,255,255),new ea.PdfColor(s.unscheduledTaskBarColor)),h.drawRectangle(ae,i.x+(this.left-r)+.5+oe/2,i.y+$,oe/2,g(s.height)),N.image||N.value){var re=void 0;if((0,e.isNullOrUndefined)(s.taskbarTemplate.image))re=0;else{re=s.taskbarTemplate.image[0].width;var ne=new ea.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ne,i.x+(this.left-r)+.5,i.y+$,g(s.taskbarTemplate.image[0].width),g(s.taskbarTemplate.image[0].height))}!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)&&h.drawString(s.taskbarTemplate.value,c,y,m,i.x+(this.left-r)+.5+re,i.y+$,g(s.width),g(this.height),M)}}else if(ie=new ea.PdfLinearGradientBrush(new ea.PointF(i.x+g(this.left-r)+.5+g(oe)/2,0),new ea.PointF(i.x+g(this.left-r),0),new ea.PdfColor(s.unscheduledTaskBarColor),new ea.PdfColor(255,255,255)),h.drawRectangle(ie,i.x+g(this.left-r)+.5,i.y+$,g(oe),g(s.height)),ae=new ea.PdfLinearGradientBrush(new ea.PointF(i.x+g(this.left-r)+.5+g(oe),0),new ea.PointF(i.x+g(this.left-r)+g(oe)/2,0),new ea.PdfColor(255,255,255),new ea.PdfColor(s.unscheduledTaskBarColor)),h.drawRectangle(ae,i.x+g(this.left-r)+.5+g(oe)/2,i.y+$,g(oe)/2,g(s.height)),N.image||N.value){re=void 0;if((0,e.isNullOrUndefined)(s.taskbarTemplate.image))re=0;else{re=s.taskbarTemplate.image[0].width;ne=new ea.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ne,i.x+g(this.left-r)+.5,i.y+$,g(s.taskbarTemplate.image[0].width),g(s.taskbarTemplate.image[0].height))}!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)&&h.drawString(s.taskbarTemplate.value,c,y,m,i.x+g(this.left-r)+.5+re,i.y+$,g(s.width),g(this.height),M)}}this.left=0,this.isCompleted=!1,this.startPage=E}else if(ee<=a.endDate&&a.startDate<=ee&&!this.isCompleted){if(this.isStartPoint||(this.taskStartPoint=Ta({},i),this.isStartPoint=!0),this.isScheduledTask||"duration"!==this.unscheduledTaskBy)if(!s.isAutoSchedule&&s.isParentTask){var ce;(ce=new ea.PdfPath).addEllipse(0,0,5,5),h.save();var ge=i.x+g(this.left+.5),fe=g(s.width)+ge-5,me=i.y+$;h.drawLine(H,ge,me,fe,me),h.translateTransform(fe,me-2),h.drawPath(W,j,ce),h.restore(),H.dashStyle=ea.PdfDashStyle.Solid}else s.isAutoSchedule||s.isParentTask?this.isScheduledTask||"endDate"!==this.unscheduledTaskBy?s.isSpliterTask?(z.dashStyle=ea.PdfDashStyle.Dot,h.drawLine(z,new ea.PointF(i.x+g(this.left)+.5,i.y+$+g(s.height/2)),new ea.PointF(g(s.width)+i.x+g(this.left),i.y+$+g(s.height/2))),s.segmentCollection.map(function(t,r){var n=(0,e.isNullOrUndefined)(d.taskSegmentStyles)?L:new ea.PdfPen(d.taskSegmentStyles[r].taskBorderColor),o=(0,e.isNullOrUndefined)(d.taskSegmentStyles)?V:new ea.PdfSolidBrush(d.taskSegmentStyles[r].taskColor);if(0!==t.width&&t.startDate<a.endDate&&t.endDate>a.startDate){0!==d.segmentCollection[r].left&&(d.segmentCollection[r].left=d.segmentCollection[r].left-d.pageDetailedWidth);var l=a.totalWidth-t.left;t.width<l&&(l=t.width);var p=l;t.progressWidth<p&&(p=t.progressWidth),h.drawRectangle(n,o,i.x+g(s.left+.5+t.left),i.y+$,g(l),g(s.height));var u=(0,e.isNullOrUndefined)(d.taskSegmentStyles)?X:new ea.PdfPen(d.taskSegmentStyles[r].progressColor),f=(0,e.isNullOrUndefined)(d.taskSegmentStyles)?Y:new ea.PdfSolidBrush(d.taskSegmentStyles[r].progressColor);if(h.drawRectangle(u,f,i.x+g(s.left+.5+t.left),i.y+$,g(p),g(s.height)),N.image||N.value){var D=void 0;if((0,e.isNullOrUndefined)(s.taskbarTemplate.image))D=0;else{D=s.taskbarTemplate.image[0].width;var v=new ea.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(v,i.x+g(s.left+.5+t.left),i.y+$,g(s.taskbarTemplate.image[0].width),g(s.taskbarTemplate.image[0].height))}!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)&&h.drawString(s.taskbarTemplate.value,c,y,m,i.x+g(s.left+.5+t.left)+D,i.y+$,g(t.width),g(s.height),M)}}}),this.pageDetailedWidth+=a.totalWidth):h.drawRectangle(L,V,i.x+g(s.left+.5),i.y+$,g(s.width),g(s.height)):this.drawUnscheduledTask(h,i,r,$):(h.drawRectangle(A,null,i.x+g(this.left+.5),i.y+$,g(s.width),g(s.height)),h.save(),h.setTransparency(.87),h.drawRectangle(null,G,i.x+g(this.left+.5),i.y+$,g(s.width),g(s.height)),h.restore(),h.drawRectangle(null,_,i.x+g(this.left+.5),i.y+$,g(s.progressWidth),g(s.height)));else{ie=void 0,ae=void 0;if(ie=new ea.PdfLinearGradientBrush(new ea.PointF(i.x+g(s.left+.5)+g(s.width)/2,0),new ea.PointF(i.x+g(s.left+.5),0),new ea.PdfColor(s.unscheduledTaskBarColor),new ea.PdfColor(255,255,255)),h.drawRectangle(ie,i.x+g(s.left+.5),i.y+$,g(s.width),g(s.height)),ae=new ea.PdfLinearGradientBrush(new ea.PointF(i.x+g(s.left+.5)+g(s.width),0),new ea.PointF(i.x+g(s.left+.5)+g(s.width)/2,0),new ea.PdfColor(255,255,255),new ea.PdfColor(s.unscheduledTaskBarColor)),h.drawRectangle(ae,i.x+g(s.left+.5)+g(s.width)/2,i.y+$,g(s.width)/2,g(s.height)),N.image||N.value){re=void 0;if((0,e.isNullOrUndefined)(s.taskbarTemplate.image))re=0;else{re=s.taskbarTemplate.image[0].width;ne=new ea.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ne,i.x+g(s.left+.5),i.y+$,g(s.taskbarTemplate.image[0].width),g(s.taskbarTemplate.image[0].height))}!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)&&h.drawString(s.taskbarTemplate.value,c,y,m,i.x+g(s.left+.5)+re,i.y+$,g(s.width),g(this.height),M)}}if(this.isScheduledTask&&!s.isSpliterTask&&((0,e.isNullOrUndefined)(N.image)&&(0,e.isNullOrUndefined)(N.value)&&s.isAutoSchedule&&h.drawRectangle(X,Y,i.x+g(s.left+.5),i.y+$,g(s.progressWidth),g(s.height)),!(0,e.isNullOrUndefined)(this.taskLabel)))if(x=this.progressWidth,O&&(x=this.width),O&&(0,e.isNullOrUndefined)(s.taskbarTemplate.value)){if(!(0,e.isNullOrUndefined)(this.remainString)){pe=this.getWidth(this.remainString,a.endPoint-this.stringLeft,15);h.drawString(pe.lines[0].text,D,b,v,i.x+g(this.left)-(I.left+I.right),i.y+$-(I.top+I.bottom),g(x),g(this.height),M)}}else(0,e.isNullOrUndefined)(this.taskLabel)||O||(x=this.progressWidth,O&&(x=this.width),h.drawString(this.taskLabel.toString(),D,b,v,i.x+g(this.left)-(I.left+I.right),i.y+$-(I.top+I.bottom),g(x),g(this.height),M));this.isCompleted=!0,this.endPage=E}else if(J<a.startDate&&ee>a.endDate){if(this.isStartPoint||(this.taskStartPoint=Ta({},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)H.dashStyle=ea.PdfDashStyle.Solid,h.drawLine(H,i.x+g(s.left)+.5,i.y+$,g(a.totalWidth),i.y+$);else if(s.isSpliterTask)z.dashStyle=ea.PdfDashStyle.Dot,this.isAutoFit()?h.drawLine(z,new ea.PointF(i.x+this.left+.5,i.y+$+g(s.height/2)),new ea.PointF(a.totalWidth+i.x+this.left,i.y+$+g(s.height/2))):h.drawLine(z,new ea.PointF(i.x+g(this.left)+.5,i.y+$+g(s.height/2)),new ea.PointF(g(a.totalWidth)+i.x+g(this.left),i.y+$+g(s.height/2))),s.segmentCollection.map(function(t,r){var n=(0,e.isNullOrUndefined)(d.taskSegmentStyles)?L:new ea.PdfPen(d.taskSegmentStyles[r].taskBorderColor),o=(0,e.isNullOrUndefined)(d.taskSegmentStyles)?V:new ea.PdfSolidBrush(d.taskSegmentStyles[r].taskColor);if(0!==t.width&&t.startDate<a.endDate&&t.endDate>a.startDate){0!==d.segmentCollection[r].left&&(d.segmentCollection[r].left=d.segmentCollection[r].left-d.pageDetailedWidth);var l=a.totalWidth-t.left;t.width<l&&(l=t.width);var p=l;t.progressWidth<p&&(p=t.progressWidth),h.drawRectangle(n,o,i.x+g(s.left+.5+t.left),i.y+$,g(l),g(s.height));var u=(0,e.isNullOrUndefined)(d.taskSegmentStyles)?X:new ea.PdfPen(d.taskSegmentStyles[r].progressColor),c=(0,e.isNullOrUndefined)(d.taskSegmentStyles)?Y:new ea.PdfSolidBrush(d.taskSegmentStyles[r].progressColor);h.drawRectangle(u,c,i.x+g(s.left+.5+t.left),i.y+$,g(p),g(s.height)),t.width>l&&(d.segmentCollection[parseInt(r.toString(),10)].width=t.width-l,d.segmentCollection[parseInt(r.toString(),10)].left=0)}}),this.pageDetailedWidth+=a.totalWidth;else{if(h.drawRectangle(L,V,i.x+g(s.left)+.5,i.y+$,g(a.totalWidth),g(s.height)),!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)&&!(0,e.isNullOrUndefined)(this.remainString)){pe=this.getWidth(this.remainString,a.endPoint-this.stringLeft,15);h.drawString(pe.lines[0].text,c,y,m,i.x+g(s.left)+.5,i.y+$,g(a.totalWidth),g(this.height),M)}if(this.isScheduledTask&&!s.isParentTask){ue=0;ue=this.progressWidth<=a.totalWidth?this.progressWidth:a.totalWidth,(0,e.isNullOrUndefined)(N.image)&&(0,e.isNullOrUndefined)(N.value)&&h.drawRectangle(X,Y,i.x+g(s.left)+.5,i.y+$,g(ue),g(s.height)),this.progressWidth-=ue,(0,e.isNullOrUndefined)(this.taskLabel)||(x=ue,O&&(x=this.width),h.drawString(this.taskLabel.toString(),D,b,v,i.x+g(this.left)-(I.left+I.right),i.y+$-(I.top+I.bottom),g(x),g(this.height),M))}}else{h.drawRectangle(A,null,i.x+g(s.left)+.5,i.y+$,g(a.totalWidth),g(s.height)),h.save(),h.setTransparency(.87),h.drawRectangle(null,G,i.x+g(s.left)+.5,i.y+$,g(a.totalWidth),g(s.height)),h.restore();var ue=0;ue=this.progressWidth<=a.totalWidth?this.progressWidth:a.totalWidth,(0,e.isNullOrUndefined)(N.image)&&(0,e.isNullOrUndefined)(N.value)&&h.drawRectangle(X,Y,i.x+g(s.left)+.5,i.y+$,g(ue),g(s.height)),this.progressWidth-=ue,h.drawRectangle(null,_,i.x+g(s.left)+.5,i.y+$,g(ue),g(s.height))}else this.drawUnscheduledTask(h,i,r,$);else{ie=void 0,ae=void 0;if(ie=new ea.PdfLinearGradientBrush(new ea.PointF(i.x+g(s.left)+.5+g(a.totalWidth)/2,0),new ea.PointF(i.x+g(s.left),0),new ea.PdfColor(s.unscheduledTaskBarColor),new ea.PdfColor(255,255,255)),h.drawRectangle(ie,i.x+g(s.left)+.5,i.y+$,g(a.totalWidth),g(s.height)),ae=new ea.PdfLinearGradientBrush(new ea.PointF(i.x+g(s.left)+.5+g(a.totalWidth),0),new ea.PointF(i.x+g(s.left)+g(a.totalWidth)/2,0),new ea.PdfColor(255,255,255),new ea.PdfColor(s.unscheduledTaskBarColor)),h.drawRectangle(ae,i.x+g(s.left)+.5+g(a.totalWidth)/2,i.y+$,g(a.totalWidth)/2,g(s.height)),N.image||N.value){re=void 0;if((0,e.isNullOrUndefined)(s.taskbarTemplate.image))re=0;else{re=s.taskbarTemplate.image[0].width;ne=new ea.PdfBitmap(s.taskbarTemplate.image[0].base64);h.drawImage(ne,i.x+g(s.left)+.5,i.y+$,g(s.taskbarTemplate.image[0].width),g(s.taskbarTemplate.image[0].height))}!(0,e.isNullOrUndefined)(s.taskbarTemplate.value)&&h.drawString(s.taskbarTemplate.value,c,y,m,i.x+g(s.left+.5)+re,i.y+$,g(s.width),g(this.height),M)}}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=Ta({},i),this.isStartPoint=!0),this.parent.renderBaseline&&s.baselineStartDate&&s.baselineEndDate&&(this.isAutoFit()?h.drawRectangle(F,U,i.x+(s.baselineLeft-r)+.5,i.y+$+g(s.height+3),s.baselineWidth,g(this.baselineHeight)):h.drawRectangle(F,U,i.x+g(s.baselineLeft-r)+.5,i.y+$+g(s.height+3),g(s.baselineWidth),g(this.baselineHeight))),this.isCompletedBaseline=!0,this.startPage=E,this.endPage=E;else if(a.startDate<=s.baselineStartDate&&a.endDate>=s.baselineStartDate&&s.baselineEndDate>=a.endDate){this.isStartPoint||(this.taskStartPoint=Ta({},i),this.isStartPoint=!0);var ye=0;(se=this.baselineWidth)<(ye=a.totalWidth-(s.baselineLeft-r))&&(ye=se),this.parent.renderBaseline&&s.baselineStartDate&&s.baselineEndDate&&(this.isAutoFit()?h.drawRectangle(F,U,i.x+(s.baselineLeft-r)+.5,i.y+$+g(s.height+3),ye,g(this.baselineHeight)):h.drawRectangle(F,U,i.x+g(s.baselineLeft-r)+.5,i.y+$+g(s.height+3),g(ye),g(this.baselineHeight))),s.baselineWidth=s.baselineWidth-ye,this.baselineLeft=0,this.isCompletedBaseline=!1,this.startPage=E}else s.baselineEndDate<=a.endDate&&a.startDate<=s.baselineEndDate&&!this.isCompletedBaseline?(this.parent.renderBaseline&&s.baselineStartDate&&s.baselineEndDate&&(this.isAutoFit()?h.drawRectangle(F,U,i.x+(s.baselineLeft+.5),i.y+$+g(s.height+3),s.baselineWidth,g(this.baselineHeight)):h.drawRectangle(F,U,i.x+g(s.baselineLeft+.5),i.y+$+g(s.height+3),g(s.baselineWidth),g(this.baselineHeight))),this.isCompletedBaseline=!0,this.endPage=E):s.baselineStartDate<a.startDate&&s.baselineEndDate>a.endDate&&(this.parent.renderBaseline&&s.baselineStartDate&&s.baselineEndDate&&(this.isAutoFit()?h.drawRectangle(F,U,i.x+s.baselineLeft+.5,i.y+$+g(s.height+3),a.totalWidth,g(s.baselineHeight)):h.drawRectangle(F,U,i.x+g(s.baselineLeft)+.5,i.y+$+g(s.height+3),g(a.totalWidth),g(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=Ta({},i),this.isStartPoint=!0),!s.isAutoSchedule&&s.isParentTask&&(this.isAutoFit()?h.drawRectangle(B,null,i.x+(this.autoLeft-r)+.5,i.y+$+10,this.autoWidth,g(12)):h.drawRectangle(B,null,i.x+g(this.autoLeft-r)+.5,i.y+$+10,g(this.autoWidth),g(12)),h.save(),h.setTransparency(.87),this.isAutoFit()?h.drawRectangle(null,q,i.x+(this.autoLeft-r)+.5,i.y+$+10,this.autoWidth,g(12)):h.drawRectangle(null,q,i.x+g(this.autoLeft-r)+.5,i.y+$+10,g(this.autoWidth),g(12)),h.restore(),this.isAutoFit()?h.drawRectangle(null,Z,i.x+(this.autoLeft-r)+.5,i.y+$+10,s.progressWidth,g(12)):h.drawRectangle(null,Z,i.x+g(this.autoLeft-r)+.5,i.y+$+10,g(s.progressWidth),g(12))),(0,e.isNullOrUndefined)(this.taskLabel)||(this.isAutoFit()?h.drawString(this.taskLabel.toString(),D,b,v,i.x+(this.autoLeft-r)+.5-(I.left+I.right),i.y+$+8-(I.top+I.bottom),this.autoWidth,g(this.height),M):h.drawString(this.taskLabel.toString(),D,b,v,i.x+g(this.autoLeft-r)+.5-(I.left+I.right),i.y+$+8-(I.top+I.bottom),g(this.autoWidth),g(this.height),M)),this.isCompletedAutotask=!0,this.startPage=E,this.endPage=E;else if(a.startDate<=s.autoStartDate&&a.endDate>=s.autoStartDate&&s.autoEndDate>=a.endDate){this.isStartPoint||(this.taskStartPoint=Ta({},i),this.isStartPoint=!0);ye=0,le=0;if(ye=a.totalWidth-(this.autoLeft-r),le=a.totalWidth-(this.autoLeft-r),!s.isAutoSchedule&&s.isParentTask&&(this.isAutoFit()?h.drawRectangle(B,null,i.x+(this.autoLeft-r)+.5,i.y+$+10,ye,g(12)):h.drawRectangle(B,null,i.x+g(this.autoLeft-r)+.5,i.y+$+10,g(ye),g(12)),h.save(),h.setTransparency(.87),this.isAutoFit()?h.drawRectangle(null,q,i.x+(this.autoLeft-r)+.5,i.y+$+10,ye,g(12)):h.drawRectangle(null,q,i.x+g(this.autoLeft-r)+.5,i.y+$+10,g(ye),g(12)),h.restore(),this.isAutoFit()?h.drawRectangle(null,Z,i.x+(this.autoLeft-r)+.5,i.y+$+10,s.progressWidth,g(12)):h.drawRectangle(null,Z,i.x+g(this.autoLeft-r)+.5,i.y+$+10,g(le),g(12)),s.autoWidth=s.autoWidth-ye,s.progressWidth=s.progressWidth-le),this.parent.labelSettings.taskLabel&&!(0,e.isNullOrUndefined)(this.taskLabel))if(this.stringLeft=this.autoLeft,(0,e.isNullOrUndefined)(s.taskbarTemplate.value)){pe=this.getWidth(this.taskLabel.toString(),a.endPoint-this.stringLeft,15);h.drawString(pe.lines[0].text,D,b,v,i.x+g(this.autoLeft-r)+.5,i.y+$+10,g(s.progressWidth),g(this.height),M),(0,e.isNullOrUndefined)(pe.remainder)||(this.remainString=pe.remainder,this.stringLeft=a.endPoint)}else this.isAutoFit()?h.drawString(this.taskLabel.toString(),D,b,v,i.x+(this.autoLeft-r)+.5-(I.left+I.right),i.y+$+10-(I.top+I.bottom),s.progressWidth,g(this.height),M):h.drawString(this.taskLabel.toString(),D,b,v,i.x+g(this.autoLeft-r)+.5-(I.left+I.right),i.y+$+10-(I.top+I.bottom),g(s.progressWidth),g(this.height),M);this.autoLeft=0,this.isCompletedAutotask=!1,this.startPage=E}else if(s.autoEndDate<=a.endDate&&a.startDate<=s.autoEndDate&&!this.isCompletedAutotask){if(this.isStartPoint?!s.isAutoSchedule&&s.isParentTask&&(h.drawRectangle(B,null,i.x+g(this.autoLeft+.5),i.y+$+10,g(s.autoWidth),g(12)),h.save(),h.setTransparency(.87),h.drawRectangle(q,i.x+g(this.autoLeft+.5),i.y+$+10,g(s.autoWidth),g(12)),h.restore(),h.drawRectangle(null,Z,i.x+g(this.autoLeft+.5),i.y+$+10,g(s.progressWidth),g(12))):(this.taskStartPoint=Ta({},i),this.isStartPoint=!0),!(0,e.isNullOrUndefined)(this.taskLabel))if(O&&(0,e.isNullOrUndefined)(s.taskbarTemplate.value)){if(!(0,e.isNullOrUndefined)(this.remainString)){pe=this.getWidth(this.remainString,a.endPoint-this.stringLeft,15);h.drawString(pe.lines[0].text,D,b,v,i.x+g(this.autoLeft+.5)-(I.left+I.right),i.y+$+10-(I.top+I.bottom),g(s.progressWidth),g(this.height),M)}}else(0,e.isNullOrUndefined)(this.taskLabel)||O||h.drawString(this.taskLabel.toString(),D,b,v,i.x+g(this.autoLeft+.5)-(I.left+I.right),i.y+$+10-(I.top+I.bottom),g(s.progressWidth),g(this.height),M);this.isCompletedAutotask=!0,this.endPage=E}else if(s.autoStartDate<a.startDate&&s.autoEndDate>a.endDate){if(this.isStartPoint||(this.taskStartPoint=Ta({},i),this.isStartPoint=!0),!s.isAutoSchedule&&s.isParentTask){ue=0;ue=this.progressWidth<=a.totalWidth?this.progressWidth:a.totalWidth,this.isAutoFit()?h.drawRectangle(null,Z,i.x+(this.autoLeft+.5),i.y+$+10,ue,g(12)):0!==s.progressWidth&&h.drawRectangle(null,Z,i.x+g(this.autoLeft+.5),i.y+$+10,g(ue),g(12)),this.progressWidth-=ue,this.isAutoFit()?h.drawRectangle(B,null,i.x+this.autoLeft+.5,i.y+$+10,a.totalWidth,g(12)):h.drawRectangle(B,null,i.x+g(this.autoLeft)+.5,i.y+$+10,g(a.totalWidth),g(12)),h.save(),h.setTransparency(.87),this.isAutoFit()?h.drawRectangle(null,q,i.x+(this.autoLeft-r)+.5,i.y+$+10,a.totalWidth,g(12)):h.drawRectangle(null,q,i.x+g(this.autoLeft)+.5,i.y+$+10,g(a.totalWidth),g(12)),h.restore()}this.isCompletedAutotask=!1,this.autoWidth-=a.totalWidth}!(0,e.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(!(0,e.isNullOrUndefined)(s.base64)){var u=new ea.PdfBitmap(s.base64);if(d.isAutoFit()){h.drawImage(u,i.x+(p-r)+.5+10-d.parent.perDayWidth/2,i.y+$,te,te);var c=h.save();h.setClip(new ea.RectangleF(i.x,i.y,t.contentWidth,n)),h.drawString(s.name,k,null,ea.PdfBrushes.Black,i.x+(p-r)+.5+15+te-d.parent.perDayWidth/2,i.y+$,null),h.restore(c)}else{h.drawImage(u,i.x+g(p-r)+.5+10,i.y+$,te,te);c=h.save();h.setClip(new ea.RectangleF(i.x,i.y,t.contentWidth,n)),h.drawString(s.name,k,null,ea.PdfBrushes.Black,i.x+g(p-r)+.5+15+te,i.y+$,null),h.restore(c)}}}})}return this.drawRightLabel(t,i,a,r),p},t.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):ea.PdfFontStyle.Regular;t=new ea.PdfStandardFont(r,i,s)}return t},t.prototype.drawRightLabel=function(t,i,a,r){var n,s=t.graphics;if((0,e.isNullOrUndefined)(this.rightTaskLabel.value))if((0,e.isNullOrUndefined)(this.labelSettings.rightLabel.image))this.labelSettings.rightLabel.value&&this.drawRightLabelValue(t,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(t,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(t,i,a,r-this.spaceBetweenImageAndValue,l[o]))}}else{n=this.rightTaskLabel.isLeftCalculated||this.isAutoFit()?this.rightTaskLabel.left:g(this.rightTaskLabel.left);var d=void 0;d=this.isAutoFit()?n-r+i.x:n-g(r)+i.x;var h=this.isAutoFit()?g(n):n;if(a.startPoint<=h&&h<a.endPoint&&!(0,e.isNullOrUndefined)(this.rightTaskLabel.value)&&!this.rightTaskLabel.isCompleted){var p=this.getWidth(this.rightTaskLabel.value,a.endPoint-h,15),u=new ea.PdfStandardFont(this.fontFamily,this.defaultFontSize),c=void 0,f=this.parent.pdfExportModule.helper.exportProps.ganttStyle;(0,e.isNullOrUndefined)(f)||(0,e.isNullOrUndefined)(f.label)||(0,e.isNullOrUndefined)(f.label.fontSize)&&(0,e.isNullOrUndefined)(f.label.fontStyle)&&(0,e.isNullOrUndefined)(f.label.fontFamily)||(c=this.getPdfFont(f)),(0,e.isNullOrUndefined)(c)||(u=c);var m={left:0,right:0,top:0,bottom:0};(0,e.isNullOrUndefined)(f)||(0,e.isNullOrUndefined)(f.label)||(0,e.isNullOrUndefined)(f.label.padding)||(m=f.label.padding),!(0,e.isNullOrUndefined)(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(u=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var y=(g(this.parent.rowHeight)-p.actualSize.height)/2,D=new ea.PointF(d+m.left,i.y+y+m.top),v=new ea.SizeF(t.contentWidth-d-(m.left+m.right),p.actualSize.height-(m.top+m.bottom)),k=new ea.RectangleF(D,v),b=new ea.PdfStringFormat;if(b.alignment=ea.PdfTextAlignment.Left,b.lineAlignment=ea.PdfVerticalAlignment.Middle,(0,e.isNullOrUndefined)(f)||(0,e.isNullOrUndefined)(f.label)||(0,e.isNullOrUndefined)(f.label.format)||(0,e.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 ea.PdfSolidBrush(w&&w.label&&w.label.fontBrush?w.label.fontBrush:this.labelColor),S=null;(0,e.isNullOrUndefined)(w)||(0,e.isNullOrUndefined)(w.label)||(0,e.isNullOrUndefined)(w.label.backgroundColor)||(S=new ea.PdfSolidBrush(w.label.backgroundColor));var P=null;if((0,e.isNullOrUndefined)(w)||(0,e.isNullOrUndefined)(w.label)||(0,e.isNullOrUndefined)(w.label.borderColor)||(P=new ea.PdfPen(w.label.borderColor)),this.labelSettings.rightLabel&&(this.labelSettings.rightLabel.fontStyle.fontSize||this.labelSettings.rightLabel.fontStyle.fontStyle||this.labelSettings.rightLabel.fontStyle.fontFamily)){var C=this.labelSettings.rightLabel,R=C.fontStyle&&C.fontStyle.fontFamily?C.fontStyle.fontFamily:this.fontFamily||ea.PdfFontFamily.Helvetica,M=C.fontStyle&&C.fontStyle.fontSize?C.fontStyle.fontSize:u.fontSize||this.defaultFontSize,x=C.fontStyle&&"string"==typeof C.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(C.fontStyle.fontStyle):C.fontStyle&&C.fontStyle.fontStyle?C.fontStyle.fontStyle:ea.PdfFontStyle.Regular;u=new ea.PdfStandardFont(R,M,x),T=C.fontStyle.fontColor?new ea.PdfSolidBrush(C.fontStyle.fontColor):T}var O=u.measureString(p.lines[0].text);s.drawRectangle(P,S,k.x-3,k.y,O.width+6,O.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}}},t.prototype.drawRigthlabelImage=function(t,i,a,r,n){var s,o,l=t.graphics;if(!(0,e.isNullOrUndefined)(this.labelSettings.rightLabel)&&!(0,e.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;(0,e.isNullOrUndefined)(this.labelSettings.rightLabel.value)||(d=this.labelSettings.rightLabel.value.split(",")),this.labelSettings.rightLabel.image.length>1&&d.length>1?(s=g(this.rightTaskLabel.left)+this.previousWidthofRightValue,this.previousWidthofRightImage=n.width):this.labelSettings.rightLabel.image.length>1?(s=g(this.rightTaskLabel.left)+this.previousWidthofRightImage,this.previousWidthofRightImage=n.width):s=g(this.rightTaskLabel.left)}var h=void 0;h=this.isAutoFit()?s-r+i.x:s-g(r)+i.x;var p=this.isAutoFit()?g(s):s;if(a.startPoint<=p&&p<a.endPoint&&!(0,e.isNullOrUndefined)(this.labelSettings.rightLabel)&&!this.rightTaskLabel.isCompleted){var u=new ea.SizeF(n.width,n.height),c=(g(this.parent.rowHeight)-u.height)/2,f=new ea.PointF(h,i.y+c),m=new ea.SizeF(u.width,u.height);o=new ea.RectangleF(f,m);var y=new ea.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:(0,e.isNullOrUndefined)(this.labelSettings.rightLabel.value)&&(this.rightTaskLabel.isCompleted=!0)):this.rightTaskLabel.left=a.endPoint}}},t.prototype.drawRightLabelValue=function(t,i,a,r,n){var s,o=t.graphics;if(!(0,e.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,!(0,e.isNullOrUndefined)(n)){var l=this.getWidthofrightLabel(n,a.endPoint-s,15);this.previousWidthofRightValue+=l.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=g(this.rightTaskLabel.left)+this.previousWidthofRightImage+this.previousWidthofRightValue,!(0,e.isNullOrUndefined)(n)){l=this.getWidthofrightLabel(n,a.endPoint-s,15);this.previousWidthofRightValue+=l.actualSize.width+this.previousWidthofRightImage}}else s=g(this.rightTaskLabel.left)+this.labelSettings.rightLabel.image[0].width;else s=g(this.rightTaskLabel.left);var d=void 0;d=this.isAutoFit()?s-r+i.x:s-g(r)+i.x;var h=this.isAutoFit()?g(s):s;if(a.startPoint<=h&&h<a.endPoint&&!(0,e.isNullOrUndefined)(n)&&!this.rightTaskLabel.isCompleted){l=this.getWidthofrightLabel(n,a.endPoint-h,15);var p=new ea.PdfStandardFont(this.fontFamily,this.defaultFontSize);!(0,e.isNullOrUndefined)(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(p=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var u=(g(this.parent.rowHeight)-l.actualSize.height)/2,c=new ea.PointF(d,i.y+u),f=new ea.SizeF(l.actualSize.width,l.actualSize.height),m=new ea.RectangleF(c,f),y=new ea.PdfStringFormat;if(y.alignment=ea.PdfTextAlignment.Right,y.lineAlignment=ea.PdfVerticalAlignment.Middle,l.actualSize.width>0){var D=new ea.PdfSolidBrush(this.labelColor),v=this.labelSettings.rightLabel,k=v.fontStyle&&v.fontStyle.fontFamily?v.fontStyle.fontFamily:this.fontFamily||ea.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:ea.PdfFontStyle.Regular,T=new ea.PdfStandardFont(k,b,w),S=v.fontStyle.fontColor?new ea.PdfSolidBrush(v.fontStyle.fontColor):D;o.drawString(n,T,null,S,m.x,m.y,l.actualSize.width,l.actualSize.height,y),(0,e.isNullOrUndefined)(l.remainder)||null===l.remainder?(0,e.isNullOrUndefined)(v.value)&&(this.rightTaskLabel.isCompleted=!0):(this.rightTaskLabel.value=l.remainder,this.rightTaskLabel.left=a.endPoint,this.rightTaskLabel.isLeftCalculated=!0)}else this.rightTaskLabel.left=a.endPoint}}},t.prototype.drawLeftLabel=function(t,i,a,r,n){var s,o=t.graphics;if((0,e.isNullOrUndefined)(this.leftTaskLabel.value))if((0,e.isNullOrUndefined)(this.labelSettings.leftLabel)||(0,e.isNullOrUndefined)(this.labelSettings.leftLabel.image))(0,e.isNullOrUndefined)(this.labelSettings.leftLabel)||(0,e.isNullOrUndefined)(this.labelSettings.leftLabel.value)||this.drawLeftLabelValue(t,i,a,r,this.labelSettings.leftLabel.value);else{this.previousWidthofLeftImage=0,this.previousWidthofLeftValue=0,this.totalLeftWidth=0;for(var l=0;l<this.labelSettings.leftLabel.image.length;l++){var d=void 0;u=void 0;(0,e.isNullOrUndefined)(this.labelSettings.leftLabel.value)||(d=this.labelSettings.leftLabel.value.split(","),u=this.getWidth(d[l],Number.MAX_VALUE,15));var h=(0,e.isNullOrUndefined)(u)?0:u.actualSize.width;this.totalLeftWidth+=this.labelSettings.leftLabel.image[l].width+h}for(l=0;l<this.labelSettings.leftLabel.image.length;l++){if(this.drawLeftLabelImage(t,i,a,r,this.labelSettings.leftLabel.image[l]),this.labelSettings.leftLabel.value)(d=this.labelSettings.leftLabel.value.split(","))&&this.drawLeftLabelValue(t,i,a,r-this.spaceBetweenImageAndValue,d[l])}}else{var p;if(p=this.left,this.leftTaskLabel.isLeftCalculated)s=this.leftTaskLabel.left;else{var u=this.getWidth(this.leftTaskLabel.value,Number.MAX_VALUE,15),c=this.isMilestone?Math.floor(this.parent.chartRowsModule.taskBarHeight/2)+33:33;s=this.isAutoFit()?p-c-u.actualSize.width:g(p-c)-u.actualSize.width,this.leftTaskLabel.left=s,this.leftTaskLabel.isLeftCalculated=!0}var f=void 0;if(this.isAutoFit()){if(f=s-g(r)+i.x,!n.isAutoSchedule&&n.isParentTask){var m=n.left-n.autoLeft;f=n.left<n.autoLeft?s-r+i.x:s-r+i.x-m}}else if(f=s-g(r)+i.x,!n.isAutoSchedule&&n.isParentTask){m=g(n.left)-g(n.autoLeft);f=n.left<n.autoLeft?s-g(r)+i.x:s-g(r)+i.x-m}var y=this.isAutoFit()?g(s):s;if(a.startPoint<=y&&y<a.endPoint&&!(0,e.isNullOrUndefined)(this.leftTaskLabel.value)&&!this.leftTaskLabel.isCompleted){var u=this.getWidth(this.leftTaskLabel.value,a.endPoint-y,15),D=new ea.PdfStandardFont(this.fontFamily,this.defaultFontSize),v=void 0,k=this.parent.pdfExportModule.helper.exportProps.ganttStyle;(0,e.isNullOrUndefined)(k)||(0,e.isNullOrUndefined)(k.label)||(0,e.isNullOrUndefined)(k.label.fontSize)&&(0,e.isNullOrUndefined)(k.label.fontStyle)&&(0,e.isNullOrUndefined)(k.label.fontFamily)||(v=this.getPdfFont(k)),(0,e.isNullOrUndefined)(v)||(D=v),!(0,e.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};(0,e.isNullOrUndefined)(k)||(0,e.isNullOrUndefined)(k.label)||(0,e.isNullOrUndefined)(k.label.padding)||(b=k.label.padding);var w=(g(this.parent.rowHeight)-u.actualSize.height)/2,T=new ea.PointF(f+b.left,i.y+w+b.top),S=new ea.SizeF(u.actualSize.width-(b.left+b.right),u.actualSize.height-(b.top+b.bottom)),P=new ea.RectangleF(T,S),C=new ea.PdfStringFormat;if(C.alignment=ea.PdfTextAlignment.Right,C.lineAlignment=ea.PdfVerticalAlignment.Middle,u.actualSize.width>0){var R=new ea.PdfSolidBrush(k&&k.label&&k.label.fontBrush?k.label.fontBrush:this.labelColor),M=null;(0,e.isNullOrUndefined)(k)||(0,e.isNullOrUndefined)(k.label)||(0,e.isNullOrUndefined)(k.label.backgroundColor)||(M=new ea.PdfSolidBrush(k.label.backgroundColor));var x=null;if((0,e.isNullOrUndefined)(k)||(0,e.isNullOrUndefined)(k.label)||(0,e.isNullOrUndefined)(k.label.borderColor)||(x=new ea.PdfPen(k.label.borderColor)),this.labelSettings.leftLabel&&(this.labelSettings.leftLabel.fontStyle.fontSize||this.labelSettings.leftLabel.fontStyle.fontStyle||this.labelSettings.leftLabel.fontStyle.fontFamily)){var O=this.labelSettings.leftLabel,I=O.fontStyle&&O.fontStyle.fontFamily?O.fontStyle.fontFamily:this.fontFamily||ea.PdfFontFamily.Helvetica,E=O.fontStyle&&O.fontStyle.fontSize?O.fontStyle.fontSize:D.fontSize||this.defaultFontSize,F=O.fontStyle&&"string"==typeof O.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(O.fontStyle.fontStyle):O.fontStyle&&O.fontStyle.fontStyle?O.fontStyle.fontStyle:ea.PdfFontStyle.Regular;D=new ea.PdfStandardFont(I,E,F),R=O.fontStyle.fontColor?new ea.PdfSolidBrush(O.fontStyle.fontColor):R}var U=D.measureString(u.lines[0].text);o.drawRectangle(x,M,P.x-3,P.y,U.width+6,U.height),o.drawString(u.lines[0].text,D,null,R,P.x,P.y,u.actualSize.width,u.actualSize.height,C),null!==u.remainder?(this.leftTaskLabel.value=u.remainder,this.leftTaskLabel.left=a.endPoint):this.leftTaskLabel.isCompleted=!0}else this.leftTaskLabel.left=a.endPoint}}},t.prototype.drawLeftLabelImage=function(t,i,a,r,n){var s,o,l=t.graphics;if(o=this.left,!(0,e.isNullOrUndefined)(this.labelSettings.leftLabel)&&!(0,e.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 ea.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=o-this.totalLeftWidth-d.width,this.previousWidthofLeftImage+=d.width):s=o-h-d.width:this.labelSettings.leftLabel.image.length>0&&p.length>0?(s=g(o)-this.totalLeftWidth-d.width,this.previousWidthofLeftImage+=d.width):s=g(o-h)-d.width,this.leftTaskLabel.left=s,this.leftTaskLabel.isLeftCalculated=!0}var u=void 0;if(u=(this.isAutoFit(),s-g(r)+i.x),a.startPoint<=s&&s<a.endPoint&&!(0,e.isNullOrUndefined)(n)&&!this.leftTaskLabel.isCompleted){d=new ea.SizeF(n.width,n.height);var c=(g(this.parent.rowHeight)-d.height)/2,f=new ea.PointF(u,i.y+c),m=new ea.SizeF(d.width,d.height),y=new ea.RectangleF(f,m),D=new ea.PdfBitmap(n.base64);d.width>0?(l.drawImage(D,y.x,y.y,d.width,d.height),this.totalLeftWidth=this.totalLeftWidth-d.width):this.leftTaskLabel.left=a.endPoint}}},t.prototype.drawLeftLabelValue=function(t,i,a,r,n){var s,o=t.graphics;if(!(0,e.isNullOrUndefined)(n)){var l;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=!(0,e.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=g(l-h)-d.actualSize.width;this.leftTaskLabel.left=s,this.leftTaskLabel.isLeftCalculated=!0}var D=void 0;D=(this.isAutoFit(),s-g(r)+i.x);var v=this.isAutoFit()?g(s):s;if(a.startPoint<=v&&v<a.endPoint&&!(0,e.isNullOrUndefined)(n)&&!this.leftTaskLabel.isCompleted){d=this.getWidthofLeftLabel(n,a.endPoint-v,15);var k=new ea.PdfStandardFont(this.fontFamily,this.defaultFontSize);!(0,e.isNullOrUndefined)(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(k=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var b=(g(this.parent.rowHeight)-d.actualSize.height)/2,w=new ea.PointF(D,i.y+b),T=new ea.SizeF(d.actualSize.width,d.actualSize.height),S=new ea.RectangleF(w,T),P=new ea.PdfStringFormat;if(P.alignment=ea.PdfTextAlignment.Right,P.lineAlignment=ea.PdfVerticalAlignment.Middle,d.actualSize.width>0){var C=new ea.PdfSolidBrush(this.labelColor),R=this.labelSettings.leftLabel,M=R.fontStyle&&R.fontStyle.fontFamily?R.fontStyle.fontFamily:this.fontFamily||ea.PdfFontFamily.Helvetica,x=R.fontStyle&&R.fontStyle.fontSize?R.fontStyle.fontSize:k.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:ea.PdfFontStyle.Regular,I=new ea.PdfStandardFont(M,x,O),E=R.fontStyle.fontColor?new ea.PdfSolidBrush(R.fontStyle.fontColor):C;o.drawString(n,I,null,E,S.x,S.y,d.actualSize.width,d.actualSize.height,P);p=R.value.split(",");(0,e.isNullOrUndefined)(d.remainder)||null===d.remainder?(0,e.isNullOrUndefined)(R.image)||1!==R.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}}},t.prototype.getWidth=function(t,i,a){var r;r=new ea.PdfStandardFont(this.fontFamily,this.defaultFontSize);var n=this.parent.pdfExportModule.helper.exportProps.ganttStyle;(0,e.isNullOrUndefined)(n)||(0,e.isNullOrUndefined)(n.label)||(0,e.isNullOrUndefined)(n.label.fontSize)&&(0,e.isNullOrUndefined)(n.label.fontStyle)&&(0,e.isNullOrUndefined)(n.label.fontFamily)||(a=(r=this.getPdfFont(n)).height),!(0,e.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||ea.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:ea.PdfFontStyle.Regular;r=new ea.PdfStandardFont(o,l,d)}var h=this.labelSettings.rightLabel;if(h&&(h.fontStyle.fontSize||h.fontStyle.fontFamily||h.fontStyle.fontStyle)){o=h.fontStyle&&h.fontStyle.fontFamily?h.fontStyle.fontFamily:this.fontFamily||ea.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:ea.PdfFontStyle.Regular;r=new ea.PdfStandardFont(o,l,d)}var p=new ea.PdfStringLayouter,u=new ea.PdfStringFormat;return u.alignment=ea.PdfTextAlignment.Left,u.wordWrap=ea.PdfWordWrapType.Character,u.lineAlignment=ea.PdfVerticalAlignment.Middle,p.layout(t,r,u,new ea.SizeF(i,a),!1,new ea.SizeF(i,a))},t.prototype.getWidthofLeftLabel=function(t,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||ea.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:ea.PdfFontStyle.Regular;r=new ea.PdfStandardFont(s,o,l)}else r=new ea.PdfStandardFont(this.fontFamily,this.defaultFontSize);!(0,e.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 ea.PdfStringLayouter,h=new ea.PdfStringFormat;return h.alignment=ea.PdfTextAlignment.Left,h.wordWrap=ea.PdfWordWrapType.Character,h.lineAlignment=ea.PdfVerticalAlignment.Middle,d.layout(t,r,h,new ea.SizeF(i,a),!1,new ea.SizeF(i,a))},t.prototype.getWidthofrightLabel=function(t,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||ea.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:ea.PdfFontStyle.Regular;r=new ea.PdfStandardFont(s,o,l)}else r=new ea.PdfStandardFont(this.fontFamily,this.defaultFontSize);!(0,e.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 ea.PdfStringLayouter,h=new ea.PdfStringFormat;return h.alignment=ea.PdfTextAlignment.Left,h.wordWrap=ea.PdfWordWrapType.Character,h.lineAlignment=ea.PdfVerticalAlignment.Middle,d.layout(t,r,h,new ea.SizeF(i,a),!1,new ea.SizeF(i,a))},t.prototype.drawUnscheduledTask=function(e,t,i,a){var r=new ea.PdfSolidBrush(this.taskColor);this.isAutoFit()?e.drawRectangle(r,t.x+(this.left-i),t.y+a,g(3),g(this.height)):e.drawRectangle(r,t.x+g(this.left-i),t.y+a,g(3),g(this.height))},t.prototype.drawMilestone=function(t,i,a,r,n,s){if(a.startDate<=this.startDate&&this.startDate<=a.endDate){var o=t.graphics,l=t.section.indexOf(t);this.taskStartPoint=Ta({},i);var d=new ea.PdfPen(this.milestoneColor),h=g((this.parent.rowHeight-this.height)/3),p=g((this.parent.rowHeight-this.height)/2),u=this.parent.renderBaseline?h:p,c=new ea.PdfSolidBrush(this.milestoneColor),f=new ea.PdfPen(this.baselineBorderColor),m=new ea.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+g(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+g(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,g(y),g(y)),s||o.drawRectangle(d,c,0,0,g(y),g(y)),o.restore(),this.isAutoFit()){if(!(0,e.isNullOrUndefined)(n.taskbarTemplate.image)){var D=new ea.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(!(0,e.isNullOrUndefined)(n.taskbarTemplate.image)){D=new ea.PdfBitmap(n.taskbarTemplate.image[0].base64),v=i.x+g(this.left-r)-.7*this.parent.chartRowsModule.taskBarHeight/2+g(.7*this.parent.chartRowsModule.taskBarHeight-n.taskbarTemplate.image[0].height)/1;o.drawImage(D,v,i.y+u-.7*this.parent.chartRowsModule.taskBarHeight/2+g((.7*this.parent.chartRowsModule.taskBarHeight-n.taskbarTemplate.image[0].height)/.5),g(n.taskbarTemplate.image[0].width),g(n.taskbarTemplate.image[0].height-2))}this.endPage=this.startPage=l}},t}(),Pa=function(){function t(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 ea.PointF,this.bottomTierPoint=new ea.PointF,this.topTierIndex=0,this.bottomTierIndex=0,this.prevTopTierIndex=0,this.prevBottomTierIndex=0}return t.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()?f(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){var o=!1;this.topTier[this.topTierIndex].isFinished||(r>=s.width?(n=s.width,s.isFinished=!0,s.completedWidth=n,o=!0):(n=r,o=!1,s.isFinished=!1,s.width=s.width-r,s.completedWidth=n));var l=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?n:g(n);this.triggerQueryTimelinecell(e,this.topTierPoint.x,this.topTierPoint.y,this.topTierHeight,l,s.value,!0,this.parent.timelineModule.isSingleTier&&"Day"===this.parent.timelineSettings.topTier.unit?s.startDate:null),this.topTierPoint.x+=l,r-=n,o&&this.topTierIndex++}else r=0}r=Math.round(i.totalWidth);var d=this.parent.timelineModule.isSingleTier?0:this.topTierHeight;for(this.bottomTierPoint=new ea.PointF(t.x,g(t.y+d));r>0;){var h=this.bottomTier[this.bottomTierIndex];if(this.bottomTier.length>this.bottomTierIndex){o=!0;var p=h.width;r<p&&(p=r,o=!1,h.completedWidth=p),this.triggerQueryTimelinecell(e,this.bottomTierPoint.x,this.bottomTierPoint.y,this.bottomTierHeight,this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?p:g(p),h.value,!1,h.startDate),this.bottomTierPoint.x=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?this.bottomTierPoint.x+p:this.bottomTierPoint.x+g(p),r-=p,h.completedWidth=p,this.bottomTierIndex++,r>0&&r<p&&(r=h.width-1)}else r=0}this.timelineWidth=this.lastWidth},t.prototype.drawPageTimeline=function(t,i,a,r){this.pageIndex=r,this.timelineHeight=0,this.topTierPoint=(0,e.extend)({},{},i,!0);for(var n=this.prevTopTierIndex;n<=this.topTierIndex;n++)if(this.topTier.length>n){var s=this.topTier[n];s.completedWidth>0&&(this.triggerQueryTimelinecell(t,this.topTierPoint.x,this.topTierPoint.y,this.topTierHeight,this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?s.completedWidth:g(s.completedWidth),s.value,!0,this.parent.timelineModule.isSingleTier&&"Day"===this.parent.timelineSettings.topTier.unit?s.startDate:null),this.topTierPoint.x+=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?s.completedWidth:g(s.completedWidth))}this.bottomTierPoint.x=i.x,this.bottomTierPoint.y=g(i.y+this.topTierHeight);for(n=this.prevBottomTierIndex;n<=this.bottomTierIndex;n++)if(this.bottomTier.length>n){var o=this.bottomTier[n];o.completedWidth>0&&(this.triggerQueryTimelinecell(t,this.bottomTierPoint.x,this.bottomTierPoint.y,this.bottomTierHeight,this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?o.width:g(o.width),o.value,!1,o.startDate),this.bottomTierPoint.x=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?this.bottomTierPoint.x+o.width:this.bottomTierPoint.x+g(o.width))}},t.prototype.triggerQueryTimelinecell=function(t,i,a,r,n,s,o,l){var d=this,h=new Date(l).getDay(),p=t.graphics,u={},c=this.gantt.ganttStyle;u.borderColor=new ea.PdfColor(c.timeline.borderColor),u.fontColor=new ea.PdfColor(c.timeline.fontColor),u.fontSize=c.timeline.fontSize,u.fontStyle=c.timeline.fontStyle,u.backgroundColor=new ea.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 ea.PdfSolidBrush(m.timelineCell.backgroundColor),v=this.parent.nonWorkingDayIndex,k=!1,b=new ea.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=g(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 ea.PdfPen(c.holiday.borderColor):new ea.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,g(r));var S=o||"Both"!==this.parent.gridLines&&"Vertical"!==this.parent.gridLines?null:new ea.PdfPen(c.chartGridLineColor),P=k&&(c.holiday.borderColor||c.holiday.borders)?w:S;p.drawRectangle(P,D,i,a+g(r),T,this.gantt.layouter.pageHeightCollection[this.pageIndex].totalHeight-this.timelineHeight);var C=new ea.PdfStandardFont(c.fontFamily,y.fontSize,y.fontStyle);c.font&&(C=c.font);var R=this.getPdfFont(c);(0,e.isNullOrUndefined)(R)||(C=R);var M=c.holiday&&c.holiday.fontColor?new ea.PdfSolidBrush(c.holiday.fontColor):new ea.PdfSolidBrush(new ea.PdfColor(0,0,0)),x=c.holiday&&c.holiday.fontBrush?new ea.PdfPen(new ea.PdfColor(c.holiday.fontBrush)):null,O=new ea.PdfStringFormat;O=c.holiday&&c.holiday.format?c.holiday.format:null;var I,E={left:0,right:0,top:0,bottom:0};if((0,e.isNullOrUndefined)(c)||(0,e.isNullOrUndefined)(c.holiday)||(0,e.isNullOrUndefined)(c.holiday.padding)||(E=c.holiday.padding),(0,e.isNullOrUndefined)(this.holidayLabel)||(I=C.measureString(this.holidayLabel)),this.holidayCompleted){var F=(this.gantt.layouter.pageHeightCollection[this.pageIndex].totalHeight-this.timelineHeight)/2,U=p.save(),N=C.height,L=C.size;p.translateTransform(this.holidayWidth+n-L/2*this.holidayNumberOfDays-N+N/2+n*this.holidayNumberOfDays/2,40),p.rotateTransform(-90),p.translateTransform(-F,-(this.holidayWidth+n+L)/((this.holidayWidth+n)/n)),I.width+10<F&&p.drawString(this.holidayLabel,C,x,M,5-(E.left+E.right),5-(E.top+E.bottom),I.width+10,I.height+10,O),p.restore(U),this.holidayCompleted=!1}if(this.fitHolidayCompleted){F=(this.gantt.layouter.pageHeightCollection[this.pageIndex].totalHeight-this.timelineHeight)/2;var V=b;L=C.size;p.drawRectangle(P,V,i+n/2-L,a+g(r),L,2*F);var B=p.save();p.translateTransform(i+n+n/2-L,40),p.rotateTransform(-90),p.translateTransform(-F,-(this.holidayWidth+n+L)/((this.holidayWidth+n)/n)),I.width+10<F&&p.drawString(this.holidayLabel,C,x,M,5-(E.left+E.right),5-(E.top+E.bottom),I.width+10,I.height+10,O),p.restore(B),this.fitHolidayCompleted=!1}var A=new ea.PdfStandardFont(c.fontFamily,y.fontSize,y.fontStyle);c.font&&(A=c.font);var W=new ea.PdfSolidBrush((0,e.isNullOrUndefined)(c.timeline.fontBrush)?m.timelineCell.fontColor:c.timeline.fontBrush),H=c.timeline.padding?m.timelineCell.padding.left:0,j=c.timeline.padding?m.timelineCell.padding.top:0,z=p.save();p.setClip(new ea.RectangleF(i,a,n,g(r))),o?i=i+H+this.topTierValueLeftPadding:i+=H,p.drawString(m.value,A,null,W,i,a+j,g(n),g(r),y.format),p.restore(z)},t.prototype.initializePdfStringFormat=function(t,i){var a=new ea.PdfStringFormat;return(0,e.isNullOrUndefined)(t.timeline.format)?i?(a.lineAlignment=ea.PdfVerticalAlignment.Middle,a.alignment=ea.PdfTextAlignment.Left):(a.lineAlignment=ea.PdfVerticalAlignment.Middle,a.alignment=ea.PdfTextAlignment.Center,a.wordWrap=ea.PdfWordWrapType.Character):a=t.timeline.format,a},t.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:ea.PdfFontStyle.Regular;t=new ea.PdfStandardFont(a,i,r)}return t},t}(),Ca=function(){function t(e,t){this.parent=e,this.pdfGantt=t}return t.prototype.add=function(){return new t(this.parent)},t.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 ea.PdfPage,o=new ea.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=g(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 ea.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,C=void 0,R=void 0,M=void 0;switch(this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?(S=new ea.PointF(this.parentLeft+this.parentWidth,d+f),P=new ea.PointF(this.parentLeft-1,d+f),C=new ea.PointF(this.childLeft-20,h+f),R=new ea.PointF(this.childLeft-6-this.lineWidth-1,h+f),M=new ea.PointF(this.childLeft+this.childWidth+6+this.lineWidth+1,h+f)):(S=new ea.PointF(g(this.parentLeft+this.parentWidth),d+f),P=new ea.PointF(g(this.parentLeft)-1,d+f),C=new ea.PointF(g(this.childLeft-20),h+f),R=new ea.PointF(g(this.childLeft-6-this.lineWidth)-1,h+f),M=new ea.PointF(g(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 ea.PointF(this.childLeft-20,d+f):new ea.PointF(g(this.childLeft-20),d+f),D=C,v=R,this.connectLines(s,o,m,y,D,v,n,f);break;case"FSType2":m=S,y=new ea.PointF(m.x+10,d+f),D=new ea.PointF(m.x+10,h+2),v=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?new ea.PointF(this.childLeft-20,h+2):new ea.PointF(g(this.childLeft-20),h+2),k=C,b=R,this.connectLines(s,o,m,y,D,v,n,f,k,b);break;case"FSType4":m=S,y=new ea.PointF(m.x+10,d+f),D=new ea.PointF(m.x+10,d+2),v=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?new ea.PointF(this.childLeft-20,d+2):new ea.PointF(g(this.childLeft-20),d+2),k=C,b=R,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 ea.PointF(this.parentLeft+this.parentWidth+1,d+f),y=new ea.PointF(this.childLeft+this.childWidth+20,d+f)):(m=new ea.PointF(g(this.parentLeft+this.parentWidth)+1,d+f),y=new ea.PointF(g(this.childLeft+this.childWidth+20),d+f)),D=new ea.PointF(y.x,h+f),v=M,this.connectLines(s,o,m,y,D,v,n,f);break;case"FFType2":case"FFType4":this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?(m=new ea.PointF(this.parentLeft+this.parentWidth+1,d+f),y=new ea.PointF(this.parentLeft+this.parentWidth+20,d+f)):(m=new ea.PointF(g(this.parentLeft+this.parentWidth)+1,d+f),y=new ea.PointF(g(this.parentLeft+this.parentWidth+20),d+f)),D=new ea.PointF(y.x,h+f),v=M,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 ea.PointF(this.childLeft-20,d+f):new ea.PointF(g(this.childLeft-20),d+f),D=new ea.PointF(y.x,h+f),v=R,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 ea.PointF(this.parentLeft-20,d+f):new ea.PointF(g(this.parentLeft-20),d+f),D=new ea.PointF(y.x,h+f),v=R,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 ea.PointF(this.childLeft+this.childWidth+20,d+f):new ea.PointF(g(this.childLeft+this.childWidth+20),d+f),D=new ea.PointF(y.x,h+f),v=M,this.connectLines(s,o,m,y,D,v,n,f);break;case"SFType2":m=P,this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?(y=new ea.PointF(this.parentLeft-20,d+f),v=new ea.PointF(this.childLeft+this.childWidth+20,h+2)):(y=new ea.PointF(g(this.parentLeft-20),d+f),v=new ea.PointF(g(this.childLeft+this.childWidth+20),h+2)),D=new ea.PointF(y.x,h+2),k=new ea.PointF(v.x,h+f),b=M,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 ea.PointF(this.parentLeft-20,d+f),v=new ea.PointF(this.childLeft+this.childWidth+20,d+2)):(y=new ea.PointF(g(this.parentLeft-20),d+f),v=new ea.PointF(g(this.childLeft+this.childWidth+20),d+2)),D=new ea.PointF(y.x,d+2),k=new ea.PointF(v.x,h+f),b=M,this.connectLines(s,o,m,y,D,v,n,f,k,b)}}},t.prototype.connectLines=function(t,i,a,r,n,s,o,l,d,h){this.drawLine(t,a,r),this.drawLine(t,r,n),this.drawLine(t,n,s),(0,e.isNullOrUndefined)(d)||(0,e.isNullOrUndefined)(h)||(this.drawLine(t,s,d),this.drawLine(t,d,h)),this.drawArrow(i,o,l)},t.prototype.contains=function(e,t,i){return e.x<=t&&t<e.x+e.width&&e.y<=i&&i<e.y+e.height},t.prototype.findPageIndex=function(e){for(var t=-1,i=0;i<this.pdfGantt.pdfPageDetail.length;i++){var a=this.pdfGantt.pdfPageDetail[i],r=new ea.RectangleF(a.startPoint.x,a.startPoint.y,a.width,a.height);if(this.contains(r,e.x,e.y)){t=i;break}}return t},t.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 ea.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 ea.PointF(t.x,t.y),i=new ea.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+=this.parent.timelineModule.isSingleTier?g(45):g(62))):y>i.y&&(s.y=o.y=y-1,i.y=y,this.pdfGantt.enableHeader&&(o.y+=this.parent.timelineModule.isSingleTier?g(45):g(62),i.y+=this.parent.timelineModule.isSingleTier?g(45):g(62))),-1!==(u=this.findPageIndex(o))&&this.drawLine(a[u+this.pdfGantt.chartPageIndex],s,n)}if(h){t=new ea.PointF(t.x,t.y),i=new ea.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 ea.PdfSolidBrush(this.connectorLineColor),v=new ea.PdfPen(D,g(this.lineWidth));r.drawLine(v,t,i)}},t.prototype.drawArrow=function(e,t,i){var a,r=this.pdfGantt.pdfPageDetail[e.section.indexOf(e)-this.pdfGantt.chartPageIndex],n=new ea.RectangleF(new ea.PointF(r.startPoint.x,r.startPoint.y),new ea.SizeF(r.width,r.height)),s=new ea.PointF,o=e.section.getPages(),l=6+this.lineWidth;if(s=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?"FS"===this.type||"SS"===this.type?new ea.PointF(this.childLeft-1,t.taskStartPoint.y+r.startPoint.y):new ea.PointF(this.childLeft+this.childWidth+1,t.taskStartPoint.y+r.startPoint.y):"FS"===this.type||"SS"===this.type?new ea.PointF(g(this.childLeft)-1,t.taskStartPoint.y+r.startPoint.y):new ea.PointF(g(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 ea.PointF(s.x,s.y+i);a=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?"FS"===this.type||"SS"===this.type?new ea.PointF(p.x-l,p.y-l):new ea.PointF(p.x+l,p.y-l):"FS"===this.type||"SS"===this.type?new ea.PointF(p.x-g(l),p.y-g(l)):new ea.PointF(p.x+g(l),p.y-g(l));var u,c,f=new ea.PdfSolidBrush(this.connectorLineColor);this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?(u=new ea.PointF(a.x,a.y+2*l),c=new ea.PdfPen(f,this.lineWidth)):(u=new ea.PointF(a.x,a.y+g(2*l)),c=new ea.PdfPen(f,g(this.lineWidth))),this.childLeft>0&&(h.drawLine(c,p,a),h.drawLine(c,a,u),h.drawLine(c,u,p))},t}(),Ra=function(){function t(e){this.renderHeight=0,this.parent=e}return t.prototype.drawEventMarker=function(t,i,a,r,n,s,o){var l,d=t.graphics,h=(t.getClientSize(),new ea.PdfStandardFont(ea.PdfFontFamily.Helvetica,10));!(0,e.isNullOrUndefined)(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(h=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font),(0,e.isNullOrUndefined)(n.label)||(l=h.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 ea.PdfStringFormat;u.alignment=ea.PdfTextAlignment.Center;var c=(0,e.isNullOrUndefined)(o.eventMarker.label.format)?u:o.eventMarker.label.format,f=new ea.PdfSolidBrush(o.eventMarker.label.backgroundColor),m=o.eventMarker.label&&o.eventMarker.label.fontColor?new ea.PdfSolidBrush(o.eventMarker.label.fontColor):null,y=this.getPdfFont(o);(0,e.isNullOrUndefined)(y)&&(y=h);var D=o.eventMarker.label.borders?o.eventMarker.label.borders:null;if(o.eventMarker.label.borderColor){var v=new aa;v.all=new ea.PdfPen(new ea.PdfColor(o.eventMarker.label.borderColor)),D=v}var k=(0,e.isNullOrUndefined)(D)||(0,e.isNullOrUndefined)(D.left)?null:D.left,b={left:0,right:0,top:0,bottom:0};(0,e.isNullOrUndefined)(o)||(0,e.isNullOrUndefined)(o.eventMarker)||(0,e.isNullOrUndefined)(o.eventMarker.label)||(0,e.isNullOrUndefined)(o.eventMarker.label.padding)||(b=o.eventMarker.label.padding);var w=(0,e.isNullOrUndefined)(o.eventMarker.label.fontBrush)?null:new ea.PdfPen(o.eventMarker.label.fontBrush),T=this.parent.dataOperation.getTaskLeft(this.parent.dateValidationModule.getDateFromFormat(n.date,!0),!1,!0),S=10;if(this.parent.pdfExportModule.gantt.taskbar.isAutoFit()){if(d.drawLine(p,new ea.PointF(i.x+(T-a)+S,s),new ea.PointF(i.x+(T-a)+S,this.renderHeight)),!(0,e.isNullOrUndefined)(n.label)&&n.label.length>0)s+g(50)+2*l.height<this.renderHeight&&(d.save(),d.translateTransform(i.x+(T-a)+7+S,s+g(50)+l.height/2),d.rotateTransform(45),d.drawRectangle(k,f,0,0,8,8),d.restore(),d.drawRectangle(k,f,i.x+(T-a)+7+S,s+g(50),l.width+10,2*l.height),d.drawString(n.label,y,w,m,i.x+(T-a)+12+S-(b.left+b.right),s+g(50)+g(l.height/2)-(b.top+b.bottom),l.width,l.height,c))}else if(d.drawLine(p,new ea.PointF(i.x+g(T-a)+S,s),new ea.PointF(i.x+g(T-a)+S,this.renderHeight)),!(0,e.isNullOrUndefined)(n.label)&&n.label.length>0)s+g(50)+2*l.height<this.renderHeight&&(d.save(),d.translateTransform(i.x+g(T-a)+7+S,s+g(50)+l.height/2),d.rotateTransform(45),d.drawRectangle(k,f,0,0,8,8),d.restore(),d.drawRectangle(k,f,i.x+g(T-a)+7+S,s+g(50),l.width+10,2*l.height),d.drawString(n.label,y,w,m,i.x+g(T-a)+12+S-(b.left+b.right),s+g(51)+g(l.height/2)-(b.top+b.bottom),l.width,l.height,c))}},t.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:ea.PdfFontStyle.Regular;t=new ea.PdfStandardFont(a,i,r)}return t},t}(),Ma=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])},e(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)}}(),xa=function(){return xa=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},xa.apply(this,arguments)},Oa=function(t){function i(e){var i=t.call(this)||this;return i.exportProps={},i.changeCloneProjectDates=!1,i.currentPage=0,i.parent=e,i.chartHeader=new Pa(i),i.eventMarker=new Ra(e),i.predecessor=new Ca(e,i),i.headerDetails=[],i.pdfPageDetail=[],i.taskbarCollection=[],i.predecessorCollection=[],i}return Ma(i,t),Object.defineProperty(i.prototype,"taskbar",{get:function(){return(0,e.isNullOrUndefined)(this.taskbars)&&(this.taskbars=new Sa(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 t=this.layouter.columnRanges[this.layouter.columnRanges.length-1],i=0,a=!0,r=0,n=0,s=0,o=g(this.chartHeader.width),l=this.parent.timelineModule,d=t[0];d<=t[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 ea.PointF(i,0)):(this.result.page.section.add(),this.chartPageIndex=this.startPageIndex=this.totalPages,a=!0,this.startPoint=new ea.PointF(s,0));Math.round(s)<Math.round(o);){a?r=this.result.page.getClientSize().width:(r=n,a=!0);var h={},p=[],u=g(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=f(o-s)):(p[1]=s+c,h.totalWidth=f(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 m=this.parent.dataOperation.getDateFromFormat(this.parent.timelineModule.timelineStartDate),y=(0,e.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(m.getTime());var D=Math.floor(f(h.startPoint)/this.chartHeader.bottomTierCellWidth);h.startDate.setMinutes(h.startDate.getMinutes()+D*y),h.startDate.setSeconds(h.startDate.getSeconds()+1),h.endDate=new Date(h.startDate.getTime());var v=Math.floor(f(h.endPoint-h.startPoint)/this.chartHeader.bottomTierCellWidth);h.endDate.setMinutes(h.endDate.getMinutes()+v*y);break;case"Hour":h.startDate=new Date(m.getTime());var k=Math.floor(f(h.startPoint)/this.chartHeader.bottomTierCellWidth),b=new Date(h.startDate.getTime());this.parent.timelineSettings.showWeekend?(h.startDate.setHours(h.startDate.getHours()+k*y),h.startDate.setMinutes(h.startDate.getMinutes()+1)):(b=this.calculateHoursWithoutNonworkingDays(b,k,y),h.startDate=new Date(b.getTime()));var w=Math.floor((h.endPoint-h.startPoint)/f(this.chartHeader.bottomTierCellWidth));b=new Date(h.startDate.getTime()),this.parent.timelineSettings.showWeekend?b.setHours(b.getHours()+w*y):b=this.calculateHoursWithoutNonworkingDays(b,w,y),h.endDate=new Date(b.getTime());break;case"Day":h.startDate=new Date(m.getTime());var T=Math.round(h.startPoint/g(this.chartHeader.bottomTierCellWidth));b=new Date(h.startDate.getTime());this.parent.timelineSettings.showWeekend?h.startDate.setDate(h.startDate.getDate()+T*y):h.startDate=this.calculateDaysWithoutNonworkingDays(h.startDate,T*y);var S=Math.round((h.endPoint-h.startPoint)/g(this.chartHeader.bottomTierCellWidth))-1;h.startDate.setHours(0,0,0,0),b=new Date(h.startDate.getTime()),this.parent.timelineSettings.showWeekend?b.setDate(b.getDate()+S*y):b=this.calculateDaysWithoutNonworkingDays(b,S*y);var P=1e3*this.parent.workingTimeRanges[0].to;h.endDate=new Date(b.getTime()),h.endDate.setTime(h.endDate.getTime()+P);break;case"Week":h.startDate=new Date(m.getTime());var C=h.startPoint/g(this.chartHeader.bottomTierCellWidth)*7;this.parent.timelineSettings.showWeekend?h.startDate.setDate(h.startDate.getDate()+C*y):h.startDate=this.calculateDaysWithoutNonworkingDays(h.startDate,C*y);var R=7*Math.round((h.endPoint-h.startPoint)/g(this.chartHeader.bottomTierCellWidth))-1;h.endDate=new Date(h.startDate.getTime()),this.parent.timelineSettings.showWeekend?h.endDate.setDate(h.startDate.getDate()+R*y):h.endDate=this.calculateDaysWithoutNonworkingDays(h.endDate,R*y);break;case"Month":h.startDate=new Date(m.getTime());var M=h.startPoint/g(this.chartHeader.bottomTierCellWidth)*31;h.startDate.setDate(h.startDate.getDate()+M*y);var x=31*Math.round((h.endPoint-h.startPoint)/g(this.chartHeader.bottomTierCellWidth))-1;h.endDate=new Date(h.startDate.getTime()),h.endDate.setDate(h.startDate.getDate()+x*y);break;case"Year":h.startDate=new Date(m.getTime());var O=h.startPoint/g(this.chartHeader.bottomTierCellWidth)*365;h.startDate.setDate(h.startDate.getDate()+O*y);var I=365*Math.round((h.endPoint-h.startPoint)/g(this.chartHeader.bottomTierCellWidth))-1;h.endDate=new Date(h.startDate.getTime()),h.endDate.setDate(h.startDate.getDate()+I*y)}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 ea.PdfPen(new ea.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 ea.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()?f(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+g(t.parent.timelineModule.isSingleTier?45:60),r=i.x,s=g(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],m=c.graphics,y=new ea.PdfPen(new ea.PdfColor(t.ganttStyle.chartGridLineColor)),D=void 0;!d.contentWidth||"Both"!==t.parent.gridLines&&"Horizontal"!==t.parent.gridLines||(D=t.chartHeader.timelineWidth,m.drawRectangle(y,r,i.y,d.contentWidth+.5,u)),p.drawTaskbar(c,i,o,n,u,t.taskbarCollection[parseInt(h.toString(),10)],D,l)&&(t.enableHeader?i.y=g(t.parent.timelineModule.isSingleTier?45:60):i.y=0,t.startPageIndex++,(e={}).height=s,e.pageStartX=r,e.startPoint=xa({},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=g(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=xa({},a),t.parent.pdfExportModule.gantt.taskbar.isAutoFit()?e.width=o.totalWidth:e.width=g(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 ea.PointF(0,0))});for(var o=0;o<this.predecessorCollection.length;o++){this.predecessorCollection[o].drawPredecessor(this)}},i}(ua),Ia=function(){function t(e){this.isPdfExport=!1,this.parent=e,this.helper=new ba(this.parent),this.pdfDocument=void 0}return t.prototype.getModuleName=function(){return"pdfExport"},t.prototype.destroy=function(){},t.prototype.initGantt=function(){this.pdfDocument=void 0,this.gantt=new Oa(this.parent)},t.prototype.export=function(t,i,a,r){var n=this;this.isBlob=r;var s={requestType:"beforePdfExport",ganttObject:this.parent,cancel:!1};return this.parent.trigger("beforePdfExport",s),(0,e.getValue)("cancel",s)||this.parent.showLoadingIndicator(),(0,e.getValue)("cancel",s)?new Promise(function(e,t){return e()}):new Promise(function(e,r){n.exportWithData(a,e,t,i)})},t.prototype.exportWithData=function(t,i,a,r){var n=this,s=[],o=this.parent.getExpandedRecords(this.parent.updatedRecords);(0,e.isNullOrUndefined)(a)&&(a={}),a.fitToWidthSettings&&a.fitToWidthSettings.isFitToWidth?("CurrentViewData"===a.exportType?this.helper.beforeSinglePageExport.cloneFlatData=(0,e.extend)([],this.parent.currentViewData,null,!0):"AllData"===a.exportType?this.helper.beforeSinglePageExport.cloneFlatData=(0,e.extend)([],this.parent.flatData,null,!0):this.helper.beforeSinglePageExport.cloneFlatData=(0,e.extend)([],o,null,!0),this.helper.beforeSinglePageExport.cloneCurrentViewData=(0,e.extend)([],this.parent.currentViewData,null,!0),s=this.helper.beforeSinglePageExport.cloneFlatData):s=(0,e.isNullOrUndefined)(a.exportType)?o:"CurrentViewData"===a.exportType?this.parent.currentViewData:this.parent.flatData,this.initGantt(),(0,e.isNullOrUndefined)(t)?this.pdfDocument=new ea.PdfDocument:this.pdfDocument=t,this.processExport(s,a,r).then(function(){n.parent.trigger("pdfExportComplete",n.isBlob?{promise:n.blobPromise}:{}),n.parent.hideLoadingIndicator(),i(n.pdfDocument)})},t.prototype.processExport=function(t,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(e,a){r.helper.processGridExport(t,r.gantt,i),r.helper.initializePdf(r.pdfDocument),e()}).then(function(){var t=new ha;t.break=ea.PdfLayoutBreakType.FitElement;var n=r.gantt.drawGrid(r.pdfPage,0,0,t);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():!(0,e.isNullOrUndefined)(i)&&i.fileName?r.pdfDocument.save(i.fileName):r.pdfDocument.save("Export.pdf"),r.pdfDocument.destroy()),r.pdfDocument})},t.prototype.processSectionExportProperties=function(t,i){if((0,e.isNullOrUndefined)(i))this.gantt.ganttStyle=new ta(i.theme).style;else{var a=new ea.PdfPageSettings;if((0,e.isNullOrUndefined)(i.pageOrientation)||"Portrait"!==i.pageOrientation?a.orientation=ea.PdfPageOrientation.Landscape:a.orientation=ea.PdfPageOrientation.Portrait,(0,e.isNullOrUndefined)(i.pageSize)||(a.size=this.getPageSize(i.pageSize)),t.setPageSettings(a),(0,e.isNullOrUndefined)(i.ganttStyle))this.gantt.ganttStyle=new ta(i.theme).style;else{var r=new ta(i.theme).style;this.gantt.ganttStyle=(0,e.extend)({},r,i.ganttStyle,!0)}}},t.prototype.getPageSize=function(e){switch(e){case"Letter":return new ea.SizeF(612,792);case"Note":return new ea.SizeF(540,720);case"Legal":return new ea.SizeF(612,1008);case"A0":return new ea.SizeF(2380,3368);case"A1":return new ea.SizeF(1684,2380);case"A2":return new ea.SizeF(1190,1684);case"A3":return new ea.SizeF(842,1190);case"A5":return new ea.SizeF(421,595);case"A6":return new ea.SizeF(297,421);case"A7":return new ea.SizeF(210,297);case"A8":return new ea.SizeF(148,210);case"A9":return new ea.SizeF(105,148);case"B0":return new ea.SizeF(2836,4008);case"B1":return new ea.SizeF(2004,2836);case"B2":return new ea.SizeF(1418,2004);case"B3":return new ea.SizeF(1002,1418);case"B4":return new ea.SizeF(709,1002);case"B5":return new ea.SizeF(501,709);case"Archa":return new ea.SizeF(648,864);case"Archb":return new ea.SizeF(864,1296);case"Archc":return new ea.SizeF(1296,1728);case"Archd":return new ea.SizeF(1728,2592);case"Arche":return new ea.SizeF(2592,3456);case"Flsa":return new ea.SizeF(612,936);case"HalfLetter":return new ea.SizeF(396,612);case"Letter11x17":return new ea.SizeF(792,1224);case"Ledger":return new ea.SizeF(1224,792);default:return new ea.SizeF(595,842)}},t}(),Ea=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,$e.TreeGrid.Inject($e.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}()})(),y})());