uawdijnntqw1x1x1
IP : 18.222.107.172
Hostname : axolotl
Kernel : Linux axolotl 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
OS : Linux
PATH:
/
var
/
www
/
axolotl
/
data
/
www
/
axolotl.ru
/
www
/
bitrix
/
js
/
disk
/
..
/
tasks
/
gantt.min.js
/
/
(function(){if(BX.GanttChart){return}BX.GanttChart=function(e,a,i){this.layout={root:null,list:null,tree:null,treeStub:null,gutter:null,timelineInner:null,scalePrimary:null,scaleSecondary:null,timelineData:null,currentDay:null};this.benchTime=(new Date).getTime();this.settings=i||{};this.userProfileUrl=BX.type.isNotEmptyString(i.userProfileUrl)?i.userProfileUrl:"";this.chartContainer={element:BX.type.isDomNode(e)?e:null,padding:30,width:0,pos:{left:0,top:0},minPageX:0,maxPageX:0};this.adjustChartContainer();this.gutterOffset=this.normalizeGutterOffset(BX.type.isNumber(i.gutterOffset)?i.gutterOffset:300);this.timelineDataOffset=null;this.dragClientX=0;this.minBarWidth=4;this.minGroupBarWidth=8;this.arrowBarWidth=4;this.firstDepthLevelOffset=33;this.depthLevelOffset=20;this.endlessBarDefaultDuration=9;this.currentDatetime=BX.Tasks.Date.isDate(a)?BX.GanttChart.convertDateToUTC(a):BX.GanttChart.convertDateToUTC(new Date);this.currentDate=new Date(Date.UTC(this.currentDatetime.getUTCFullYear(),this.currentDatetime.getUTCMonth(),this.currentDatetime.getUTCDate(),0,0,0,0));this.timeline=new s(this);this.calendar=new BX.Tasks.Calendar(this.settings);this.printSettings=null;this.dragger=new l(this);this.canDragTasks=this.settings.canDragTasks===true;this.canCreateDependency=this.settings.canCreateDependency!==false;this.tasks={};this.projects={0:new t(this,0,"Default Project")};this.dependencies={};this.treeMode=this.settings.treeMode!==false;this.oneGroupMode=this.settings.oneGroupMode===true;this.datetimeFormat=BX.type.isNotEmptyString(i.datetimeFormat)?i.datetimeFormat:"DD.MM.YYYY HH:MI:SS";this.dateFormat=BX.type.isNotEmptyString(i.dateFormat)?i.dateFormat:"DD.MM.YYYY";this.tooltip=new h(this);this.pointer=new r(this);this.allowRowHover=true;if(this.settings.events){for(var n in this.settings.events){if(this.settings.events.hasOwnProperty(n)){BX.addCustomEvent(this,n,this.settings.events[n])}}}BX.bind(window,"resize",BX.proxy(this.onWindowResize,this))};BX.GanttChart.prototype.draw=function(){if(this.chartContainer.element===null){return}this.drawLayout();this.drawTasks();this.timeline.autoScroll()};BX.GanttChart.prototype.zoomToLevel=function(t){if(this.layout.root===null){return}this.timeline.setZoomLevel(t);for(var e in this.tasks){var s=this.tasks[e];this.timeline.autoExpandTimeline([s.getMinDate(),s.getMaxDate()],true)}this.timeline.draw();for(e in this.tasks){s=this.tasks[e];s.updateBars()}this.drawDependencies();this.timeline.autoScroll();BX.onCustomEvent(this,"onZoomChange",[t])};BX.GanttChart.prototype.zoomIn=function(){var t=this.timeline.zoom.getNextLevel();var e=this.timeline.zoom.getCurrentLevel();if(t.id!==e.id){this.zoomToLevel(t.id)}};BX.GanttChart.prototype.zoomOut=function(){var t=this.timeline.zoom.getPrevLevel();var e=this.timeline.zoom.getCurrentLevel();if(t.id!==e.id){this.zoomToLevel(t.id)}};BX.GanttChart.prototype.drawLayout=function(){if(!this.chartContainer.element||this.layout.root!=null){return}this.layout.root=BX.create("div",{props:{className:"task-gantt"},style:{width:this.chartContainer.width+"px"},children:[this.layout.list=BX.create("div",{props:{className:"task-gantt-list"},style:{width:this.gutterOffset+"px"},children:[BX.create("div",{props:{className:"task-gantt-list-controls"},children:[BX.Scheduler.Util.isMSBrowser()?null:this.layout.print=BX.create("div",{props:{className:"task-gantt-print"},events:{click:BX.proxy(this.onPrintClick,this)}}),this.layout.zoomIn=BX.create("div",{props:{className:"task-gantt-zoom-in"},events:{click:BX.proxy(this.onZoomInClick,this)}}),this.layout.zoomOut=BX.create("div",{props:{className:"task-gantt-zoom-out"},events:{click:BX.proxy(this.onZoomOutClick,this)}})]}),BX.create("div",{props:{className:"task-gantt-list-title"},text:BX.message("TASKS_GANTT_CHART_TITLE")}),this.layout.tree=BX.create("div",{props:{className:"task-gantt-items"}}),this.layout.gutter=BX.create("div",{props:{className:"task-gantt-gutter"},events:{mousedown:BX.proxy(this.onGutterMouseDown,this)}}),this.layout.treeStub=BX.create("div",{props:{className:"task-gantt-item task-gantt-item-stub"},attrs:{"data-project-id":"stub"}})]}),this.layout.timeline=BX.create("div",{props:{className:"task-gantt-timeline"},events:{scroll:this.handleTimelineScroll.bind(this)},children:[this.layout.timelineInner=BX.create("div",{props:{className:"task-gantt-timeline-inner"},events:{mousedown:BX.proxy(this.onTimelineMouseDown,this)},children:[BX.create("div",{props:{className:"task-gantt-timeline-head"},children:[this.layout.scalePrimary=BX.create("div",{props:{className:"task-gantt-scale-primary"}}),this.layout.scaleSecondary=BX.create("div",{props:{className:"task-gantt-scale-secondary"}})]}),this.layout.timelineData=BX.create("div",{props:{className:"task-gantt-timeline-data"}}),this.layout.currentDay=BX.create("div",{props:{className:"task-gantt-current-day"}}),this.tooltip.getLayout(),this.pointer.getLayout()]})]})]});this.dragger.registerProject(this.layout.treeStub);this.timeline.draw();this.chartContainer.element.appendChild(this.layout.root)};BX.GanttChart.prototype.drawTasks=function(){if(this.layout.root===null){return}var t=document.createDocumentFragment();var e=document.createDocumentFragment();var s=this.getSortedProjects();for(var a=0;a<s.length;a++){if(s[a].id!=0){t.appendChild(s[a].createItem());e.appendChild(s[a].createBars())}this.drawTasksRecursive(s[a].tasks,t,e)}BX.cleanNode(this.layout.tree);BX.cleanNode(this.layout.timelineData);this.layout.tree.appendChild(t);this.layout.timelineData.appendChild(e);this.adjustChartContainer();this.drawDependencies()};BX.GanttChart.prototype.drawTasksRecursive=function(t,e,s){for(var a=0,i=t.length;a<i;a++){e.appendChild(t[a].createItem());s.appendChild(t[a].createBars());if(t[a].childTasks.length>0){this.drawTasksRecursive(t[a].childTasks,e,s)}}};BX.GanttChart.prototype.drawDependencies=function(){for(var t in this.dependencies){if(this.dependencies.hasOwnProperty(t)){this.dependencies[t].draw()}}};BX.GanttChart.prototype.autoExpandTimeline=function(t){this.timeline.autoExpandTimeline(t)};BX.GanttChart.prototype.adjustChartContainer=function(){if(this.chartContainer.element!=null){var t=this.chartContainer.width;this.chartContainer.width=this.chartContainer.element.offsetWidth;this.chartContainer.pos=BX.pos(this.chartContainer.element);this.adjustChartContainerPadding();if(this.layout.root!==null&&t!==this.chartContainer.width){this.layout.root.style.width=this.chartContainer.width+"px";this.getTimeline().renderHeader()}}};BX.GanttChart.prototype.adjustChartContainerPadding=function(){if(this.chartContainer.element!=null){this.chartContainer.minPageX=this.chartContainer.pos.left+this.gutterOffset+this.chartContainer.padding;this.chartContainer.maxPageX=this.chartContainer.pos.left+this.chartContainer.width-this.chartContainer.padding}};BX.GanttChart.prototype.addProject=function(t,e){if(t&&this.projects[t]){return this.projects[t]}var s=this.__createProject(t,e);if(!s){return null}this.__addProject(s);if(this.layout.root!=null){this.__addProjectDynamic(s)}return s};BX.GanttChart.prototype.addProjectFromJSON=function(t){if(!t||typeof t!=="object"){return null}if(t.id&&this.projects[t.id]){return this.projects[t.id]}var e=this.__createProject(t.id,t.name);if(e==null){return null}if(BX.type.isBoolean(t.opened)){e.opened=t.opened}if(BX.type.isBoolean(t.canCreateTasks)){e.canCreateTasks=t.canCreateTasks}if(BX.type.isBoolean(t.canEditTasks)){e.canEditTasks=t.canEditTasks}if(BX.type.isArray(t.menuItems)){e.menuItems=t.menuItems}this.__addProject(e);if(this.layout.root!=null){this.__addProjectDynamic(e)}return e};BX.GanttChart.prototype.addProjectsFromJSON=function(t){if(BX.type.isArray(t)){for(var e=0;e<t.length;e++){this.addProjectFromJSON(t[e])}}};BX.GanttChart.prototype.__createProject=function(e,s){if(!BX.type.isNumber(e)||!BX.type.isNotEmptyString(s)){return null}return new t(this,e,s)};BX.GanttChart.prototype.__addProject=function(e){if(!e||typeof e!="object"||!(e instanceof t)){return null}if(this.projects[e.id]){return this.projects[e.id]}this.projects[e.id]=e;return e};BX.GanttChart.prototype.__addProjectDynamic=function(t){var e=t.createItem();var s=t.createBars();var a=this.getSortedProjects();var i=null;for(var r=0;r<a.length;r++){if(a[r]===t){i=r;break}}if(i!==null&&a[i+1]){this.layout.tree.insertBefore(e,a[i+1].layout.item);this.layout.timelineData.insertBefore(s,a[i+1].layout.row)}else{this.layout.tree.appendChild(e);this.layout.timelineData.appendChild(s)}};BX.GanttChart.prototype.addTask=function(t,e,s,a){if(t&&this.tasks[t])return this.tasks[t];var i=this.__createTask(t,e,s,a);if(!i)return null;i.setProject(0);this.__addTask(i);this.drawTasks();return i};BX.GanttChart.prototype.addTaskFromJSON=function(t,e){if(!t||typeof t!="object"){return null}if(t.id&&this.tasks[t.id]){return this.tasks[t.id]}var s=this.__createTask(t.id,t.name,t.status,t.dateCreated);if(s==null){return null}s.setTaskFromJSON(t);s.setProject(t.projectId);this.__addTask(s);e=e!==false;if(t.children&&BX.type.isArray(t.children)){for(var a=0,i=t.children.length;a<i;a++){t.children[a].parentTask=s;t.children[a].parentTaskId=s.id;this.addTaskFromJSON(t.children[a],false)}}if(e){this.drawTasks()}return s};BX.GanttChart.prototype.addTasksFromJSON=function(t){if(BX.type.isArray(t)){for(var e=0;e<t.length;e++){this.addTaskFromJSON(t[e],false)}this.drawTasks()}};BX.GanttChart.prototype.__createTask=function(t,s,a,i){if(!BX.type.isNumber(t)||!BX.type.isNotEmptyString(s)||!BX.type.isNotEmptyString(a))return null;return new e(this,t,s,a,i)};BX.GanttChart.prototype.__addTask=function(t){if(!t||typeof t!="object"||!(t instanceof e))return null;if(this.tasks[t.id])return this.tasks[t.id];this.tasks[t.id]=t;var s=t.getMinDate();var a=t.getMaxDate();this.autoExpandTimeline([s,a]);return t};BX.GanttChart.prototype.removeTask=function(t){var e=this.getTaskById(t);if(!e)return;if(e.project!=null){e.project.removeTask(e)}var s=e.getDependencies();for(var a=0;a<s.length;a++){var i=s[a];this.removeDependency(i)}this.__removeTaskChildren(e,e.childTasks,1);if(e.parentTask!==null){var r=e.parentTask;r.removeChild(e);r.redraw()}delete this.tasks[t];if(this.layout.root!=null){this.layout.tree.removeChild(e.layout.item);this.layout.timelineData.removeChild(e.layout.row)}this.drawDependencies();BX.onCustomEvent(this,"onTaskDelete",[e])};BX.GanttChart.prototype.__removeTaskChildren=function(t,e,s){if(!BX.type.isArray(e)||e.length<1)return;s=BX.type.isNumber(s)&&s>0?s:1;for(var a=0,i=e.length;a<i;a++){if(s==1){if(t.parentTask!=null)t.parentTask.addChild(e[a]);else{e[a].depthLevel=s;e[a].parentTask=null;e[a].project.addTask(e[a])}}else e[a].depthLevel=s;this.__removeTaskChildren(t,e[a].childTasks,(s==1&&t.parentTask!=null?e[a].depthLevel:s)+1);e[a].redraw()}};BX.GanttChart.prototype.updateTask=function(t,e){var s=this.getTaskById(t);if(!s){return false}if(typeof e.parentTaskId!=="undefined"&&e.parentTaskId!=s.parentTaskId&&this.treeMode){return false}if(typeof e.projectId!=="undefined"&&e.projectId!=s.projectId){return false}delete e.parentTaskId;delete e.projectId;s.setTaskFromJSON(e);s.updateLags();s.redraw();BX.onCustomEvent(this,"onTaskUpdate",[s]);return true};BX.GanttChart.prototype.moveTask=function(t,e,s){var a=this.getTaskById(t);var i=this.getTaskById(e);if(!a||!i||a===i||i.isChildOf(a)){return}if(a.parentTask){a.parentTask.removeChild(a)}else{a.project.removeTask(a)}var r=i.parentTask?i.parentTask.childTasks:i.project.tasks;var n=BX.util.array_search(i,r);if(n<0){return}if(s===true){r.splice(n+1,0,a)}else{r.splice(n,0,a)}a.parentTask=i.parentTask;a.parentTaskId=i.parentTaskId;a.depthLevel=i.depthLevel;a.projectId=i.projectId;a.project=i.project;a.shiftChildren();this.drawTasks()};BX.GanttChart.prototype.moveTaskToProject=function(t,e){var s=this.getTaskById(t);var a=this.getProjectById(e);if(!s||!a){return}if(s.parentTask){s.parentTask.removeChild(s)}else{s.project.removeTask(s)}a.addTask(s);s.parentTask=null;s.parentTaskId=0;s.depthLevel=1;s.projectId=a.id;s.project=a;s.shiftChildren();this.drawTasks()};BX.GanttChart.prototype.indentTask=function(t){var e=this.getTaskById(t);if(!e||!e.canEdit||!this.treeMode){return}var s=e.parentTask?e.parentTask.childTasks:e.project.tasks;var a=BX.util.array_search(e,s);if(a<1){return}var i=s[a-1];if(i.hasChildren===false&&i.childTasks.length<1){i.addChild(e);i.expand();this.drawTasks();r(this)}else{i.expand(false,BX.proxy(function(){i.addChild(e);this.drawTasks();r(this)},this))}function r(s){var a=e.getPreviousTask();BX.onCustomEvent(s,"onTaskMove",[t,a?a.id:e.parentTaskId,false,null,i.id])}};BX.GanttChart.prototype.outdentTask=function(t){var e=this.getTaskById(t);if(!e||!e.parentTask||!e.canEdit||!this.treeMode){return}var s=e.parentTaskId;var a=e.projectId;this.moveTask(t,e.parentTask.id,true);BX.onCustomEvent(this,"onTaskMove",[t,s,false,a!==e.projectId?e.projectId:null,s!==e.parentTaskId?e.parentTaskId:null])};BX.GanttChart.prototype.autoSchedule=function(){for(var t=0,e=this.tasks.length;t<e;t++){this.tasks[t].schedule()}};BX.GanttChart.prototype.addDependency=function(t,e,s){if(!this.isValidDependency(t,e)){return null}var a=this.getDependencyId(t,e);if(this.dependencies[a]){return this.dependencies[a]}var r=new i(this,a,t,e,s);this.dependencies[r.id]=r;var n=this.getTaskById(t);var o=this.getTaskById(e);n.addSuccessor(r);o.addPredecessor(r);if(this.layout.root!==null){r.draw()}return r};BX.GanttChart.prototype.getDependency=function(t,e){var s=this.getDependencyId(t,e);if(this.dependencies[s]){return this.dependencies[s]}return null};BX.GanttChart.prototype.getDependencyId=function(t,e){var s=this.getTaskById(t);var a=this.getTaskById(e);return s&&a?s.id+"_"+a.id:null};BX.GanttChart.prototype.isValidDependency=function(t,e){if(!BX.type.isNumber(t)||!BX.type.isNumber(e)||t===e){return false}var s=this.getTaskById(t);var a=this.getTaskById(e);if(!s||!a||!s.isRealDateEnd||!a.isRealDateEnd){return false}if(s.isChildOf(a)||a.isChildOf(s)){return false}return!this.isCircularDependency(t,e)};BX.GanttChart.prototype.isCircularDependency=function(t,e){var s=this.getTaskById(t);var a=this.getTaskById(e);return s&&a&&(s.hasSuccessor(e)||a.hasSuccessor(t))};BX.GanttChart.prototype.canAddDependency=function(t,e){var s=this.getTaskById(t);var a=this.getTaskById(e);return s&&a&&s.canEditPlanDates&&a.canEditPlanDates};BX.GanttChart.prototype.addDependencyFromJSON=function(t){if(!t||typeof t!=="object"){return null}return this.addDependency(t.from,t.to,t.type)};BX.GanttChart.prototype.addDependenciesFromJSON=function(t){if(BX.type.isArray(t)){for(var e=0;e<t.length;e++){this.addDependencyFromJSON(t[e])}}};BX.GanttChart.prototype.removeDependency=function(t){if(!t||!t instanceof i){return}var e=this.getTaskById(t.from);var s=this.getTaskById(t.to);e&&e.removeSuccessor(t);s&&s.removePredecessor(t);t.clear();delete this.dependencies[t.id]};BX.GanttChart.prototype.getTimeline=function(){return this.timeline};BX.GanttChart.prototype.getTaskById=function(t){if(this.tasks[t])return this.tasks[t];return null};BX.GanttChart.prototype.getProjectById=function(t){if(this.projects[t])return this.projects[t];return null};BX.GanttChart.prototype.getDefaultProject=function(){return this.getProjectById(0)};BX.GanttChart.prototype.getSortedProjects=function(){var t=[];for(var e in this.projects){t.push(this.projects[e])}return t.sort(function(t,e){return t.id-e.id})};BX.GanttChart.prototype.getLastProject=function(){var t=this.getSortedProjects();return t[t.length-1]};BX.GanttChart.prototype.getPreviousProject=function(t){var e=0;var s=this.getSortedProjects();for(var a=0;a<s.length;a++){if(s[a].id===t){break}e=s[a].id}return this.getProjectById(e)};BX.GanttChart.prototype.getPreviousTask=function(t){var e=this.getTaskById(t);if(!e){return null}var s=e.getPreviousTask();if(s){return s}else if(e.projectId===0){return null}var a=[this.getDefaultProject()];var i=this.getSortedProjects();for(var r=0;r<i.length;r++){if(i[r].id===e.projectId){break}a.unshift(i[r])}for(r=0;r<a.length;r++){var n=a[r];var o=n.tasks.length;if(o){return n.tasks[o-1]}}return null};BX.GanttChart.prototype.getNextTask=function(t){var e=this.getTaskById(t);if(!e){return null}var s=e.getNextTask();if(s){return s}var a=[];var i=this.getSortedProjects();for(var r=0,n=false;r<i.length;r++){if(n){a.push(i[r])}if(i[r].id===e.projectId){n=true}}for(r=0;r<a.length;r++){var o=a[r];var h=o.tasks.length;if(h){return o.tasks[0]}}return null};BX.GanttChart.prototype.profile=function(t){if(typeof console!=="undefined"){var e=(new Date).getTime();console.log(t+": "+(e-this.benchTime)/1e3+" sec. ");this.benchTime=(new Date).getTime()}};BX.GanttChart.prototype.normalizeGutterOffset=function(t){var e=2;var s=this.chartContainer.width-100;return Math.min(Math.max(t,e),s>e?s:e)};BX.GanttChart.prototype.setGutterOffset=function(t){this.gutterOffset=this.normalizeGutterOffset(t);this.layout.list.style.width=this.gutterOffset+"px";return this.gutterOffset};BX.GanttChart.prototype.onGutterMouseDown=function(t){t=t||window.event;if(!BX.GanttChart.isLeftClick(t))return;BX.bind(document,"mouseup",BX.proxy(this.onGutterMouseUp,this));BX.bind(document,"mousemove",BX.proxy(this.onGutterMouseMove,this));this.gutterClientX=t.clientX;this.allowRowHover=false;document.onmousedown=BX.False;document.body.onselectstart=BX.False;document.body.ondragstart=BX.False;document.body.style.MozUserSelect="none";document.body.style.cursor="ew-resize"};BX.GanttChart.prototype.onGutterMouseUp=function(t){t=t||window.event;BX.unbind(document,"mouseup",BX.proxy(this.onGutterMouseUp,this));BX.unbind(document,"mousemove",BX.proxy(this.onGutterMouseMove,this));this.allowRowHover=true;document.onmousedown=null;document.body.onselectstart=null;document.body.ondragstart=null;document.body.style.MozUserSelect="";document.body.style.cursor="default";BX.onCustomEvent(this,"onGutterResize",[this.gutterOffset])};BX.GanttChart.prototype.onGutterMouseMove=function(t){t=t||window.event;this.setGutterOffset(this.gutterOffset+(t.clientX-this.gutterClientX));this.adjustChartContainerPadding();this.gutterClientX=t.clientX};BX.GanttChart.prototype.getTimelineDataOffset=function(){if(this.timelineDataOffset===null){this.timelineDataOffset=this.layout.timelineData.offsetTop}return this.timelineDataOffset};BX.GanttChart.prototype.onTimelineMouseDown=function(t){t=t||window.event;if(!BX.GanttChart.isLeftClick(t))return;this.dragClientX=t.clientX;BX.TaskQuickInfo.hide();BX.GanttChart.startDrag(document.body,{mouseup:BX.proxy(this.onTimelineMouseUp,this),mousemove:BX.proxy(this.onTimelineMouseMove,this)});BX.PreventDefault(t)};BX.GanttChart.prototype.onTimelineMouseUp=function(t){t=t||window.event;BX.GanttChart.stopDrag(document.body,{mouseup:BX.proxy(this.onTimelineMouseUp,this),mousemove:BX.proxy(this.onTimelineMouseMove,this)});this.dragClientX=0};BX.GanttChart.prototype.onTimelineMouseMove=function(t){t=t||window.event;var e=this.layout.timeline.scrollLeft+(this.dragClientX-t.clientX);this.layout.timeline.scrollLeft=e<0?0:e;this.dragClientX=t.clientX};BX.GanttChart.prototype.onWindowResize=function(t){this.adjustChartContainer()};BX.GanttChart.prototype.onPrintClick=function(t){if(this.printSettings===null){this.printSettings=new BX.Scheduler.PrintSettings(this.getTimeline())}this.printSettings.show()};BX.GanttChart.prototype.onZoomInClick=function(t){t=t||window.event;this.zoomIn()};BX.GanttChart.prototype.onZoomOutClick=function(t){t=t||window.event;this.zoomOut()};BX.GanttChart.prototype.handleTimelineScroll=function(){this.timeline.renderHeader()};BX.GanttChart.convertDateToUTC=function(t){if(!t)return null;return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),0))};BX.GanttChart.convertDateFromUTC=function(t){if(!t)return null;return new Date(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),0)};BX.GanttChart.allowSelection=function(t){if(!BX.type.isDomNode(t))return;t.onselectstart=null;t.ondragstart=null;t.style.MozUserSelect=""};BX.GanttChart.isLeftClick=function(t){if(!t.which&&t.button!==undefined){if(t.button&1)t.which=1;else if(t.button&4)t.which=2;else if(t.button&2)t.which=3;else t.which=0}return t.which==1||t.which==0&&BX.browser.IsIE()};BX.GanttChart.denySelection=function(t){if(!BX.type.isDomNode(t))return;t.onselectstart=BX.False;t.ondragstart=BX.False;t.style.MozUserSelect="none"};BX.GanttChart.startDrag=function(t,e,s){if(!t)return;if(e){for(var a in e)BX.bind(document,a,e[a])}BX.GanttChart.denySelection(t);t.style.cursor=BX.type.isString(s)?s:"ew-resize"};BX.GanttChart.stopDrag=function(t,e,s){if(!t)return;if(e){for(var a in e)BX.unbind(document,a,e[a])}BX.GanttChart.allowSelection(t);t.style.cursor=BX.type.isString(s)?s:"default"};var t=function(t,e,s){this.chart=t;this.id=e;this.name=s;this.tasks=[];this.menuItems=[];this.layout={item:null,row:null};this.opened=true;this.canCreateTasks=true;this.canEditTasks=true};t.prototype.addTask=function(t){if(!t||typeof t!="object"||!(t instanceof e)){return false}if(t.project!==null&&t.project!==this){t.project.removeTask(t)}t.project=this;t.projectId=this.id;if(t.parentTask===null){t.depthLevel=1;this.tasks.push(t)}return true};t.prototype.removeTask=function(t){for(var e=0;e<this.tasks.length;e++){if(this.tasks[e]===t){this.tasks.splice(e,1);break}}};t.prototype.collapse=function(){this.opened=false;BX.addClass(this.layout.item,"task-gantt-item-closed");for(var t=0;t<this.tasks.length;t++){this.tasks[t].hide();this.tasks[t].collapse(true)}BX.onCustomEvent(this.chart,"onProjectOpen",[this]);this.chart.drawDependencies()};t.prototype.expand=function(){this.opened=true;BX.removeClass(this.layout.item,"task-gantt-item-closed");for(var t=0;t<this.tasks.length;t++){this.tasks[t].show();if(this.tasks[t].opened)this.tasks[t].expand()}BX.onCustomEvent(this.chart,"onProjectOpen",[this]);this.chart.drawDependencies()};t.prototype.createBars=function(){if(this.layout.row!==null){return this.layout.row}this.layout.row=BX.create("div",{props:{className:"task-gantt-timeline-row",id:"task-gantt-timeline-row-p"+this.id},events:{mouseover:BX.proxy(this.onRowMouseOver,this),mouseout:BX.proxy(this.onRowMouseOut,this),contextmenu:BX.proxy(this.onRowContextMenu,this)}});return this.layout.row};t.prototype.createItem=function(){if(this.layout.item!==null){return this.layout.item}var t="task-gantt-item task-gantt-item-project";if(!this.opened){t+=" task-gantt-item-closed"}this.layout.item=BX.create("div",{props:{className:t,id:"task-gantt-item-p"+this.id},attrs:{"data-project-id":this.id},events:{mouseover:BX.proxy(this.onItemMouseOver,this),mouseout:BX.proxy(this.onItemMouseOut,this),click:BX.proxy(this.onFoldingClick,this)},children:[BX.create("span",{props:{className:"task-gantt-item-project-folding"}}),BX.create("span",{props:{className:"task-gantt-item-name"},html:this.name}),this.layout.menu=this.menuItems.length>0?BX.create("div",{props:{className:"task-gantt-item-actions"},children:[BX.create("span",{props:{className:"task-gantt-item-menu"},events:{click:BX.proxy(this.onItemMenuClick,this)}})]}):null]});if(!this.chart.oneGroupMode){this.chart.dragger.registerProject(this.layout.item)}return this.layout.item};t.prototype.onFoldingClick=function(t){if(this.opened){this.collapse()}else{this.expand()}};t.prototype.onItemMenuClick=function(t){var e=BX.PopupMenu.create("p"+this.id,this.layout.menu,this.menuItems,{offsetLeft:8,bindOptions:{forceBindPosition:true},events:{onPopupClose:BX.proxy(this.onItemMenuClose,this)},chart:this.chart,project:this});e.getPopupWindow().setBindElement(this.layout.menu);e.show();this.denyItemsHover();BX.addClass(this.layout.menu,"task-gantt-item-menu-selected")};t.prototype.onItemMenuClose=function(t,e){this.allowItemsHover(e);BX.removeClass(this.layout.menu,"task-gantt-item-menu-selected")};t.prototype.onItemMouseOver=function(t){if(!this.chart.allowRowHover)return;BX.addClass(this.layout.item,"task-gantt-item-tree-hover");BX.addClass(this.layout.row,"task-gantt-timeline-row-hover")};t.prototype.onItemMouseOut=function(t){if(!this.chart.allowRowHover)return;BX.removeClass(this.layout.item,"task-gantt-item-tree-hover");BX.removeClass(this.layout.row,"task-gantt-timeline-row-hover")};t.prototype.onRowMouseOver=function(t){if(!this.chart.allowRowHover)return;BX.addClass(this.layout.row,"task-gantt-timeline-row-hover")};t.prototype.onRowMouseOut=function(t){if(!this.chart.allowRowHover)return;BX.removeClass(this.layout.row,"task-gantt-timeline-row-hover")};t.prototype.onRowContextMenu=function(t){t=t||window.event;if(this.menuItems.length<1||t.ctrlKey)return;BX.TaskQuickInfo.hide();var e=BX.PopupMenu.create("p"+this.id,t,this.menuItems,{offsetLeft:1,autoHide:true,closeByEsc:true,bindOptions:{forceBindPosition:true},events:{onPopupClose:BX.proxy(this.onItemMenuClose,this)},chart:this.chart,project:this});e.getPopupWindow().setBindElement(t);e.show();var s=t.target||t.srcElement;if(s&&BX.hasClass(s,"task-gantt-timeline-row")&&BX.type.isNotEmptyString(s.id)){var a=this.chart.getProjectById(s.id.substr("task-gantt-timeline-row-p".length));if(a!=null)BX.addClass(a.layout.row,"task-gantt-timeline-row-hover")}this.denyItemsHover();BX.PreventDefault(t)};t.prototype.denyItemsHover=function(){this.chart.allowRowHover=false};t.prototype.allowItemsHover=function(t){this.chart.allowRowHover=true;t=t||window.event||null;if(!t)return;var e=t.target||t.srcElement;if(e!=this.layout.row&&e.parentNode!=this.layout.row&&e.parentNode.parentNode!=this.layout.row&&e!=this.layout.item&&e.parentNode!=this.layout.item){BX.removeClass(this.layout.item,"task-gantt-item-tree-hover");BX.removeClass(this.layout.row,"task-gantt-timeline-row-hover")}else if(e!=this.layout.item&&e.parentNode!=this.layout.item){BX.removeClass(this.layout.item,"task-gantt-item-tree-hover")}};var e=function(t,e,s,a,i){this.chart=t;this.id=e;this.name=s;this.setStatus(a);this.dateCreated=BX.Tasks.Date.isDate(i)?BX.GanttChart.convertDateToUTC(i):this.chart.currentDatetime;this.dateStart=null;this.isRealDateStart=false;this.dateEnd=null;this.isRealDateEnd=false;this.__setDateStart(this.dateCreated,false,true);this.dateStarted=null;this.dateCompleted=null;this.dateDeadline=null;this.matchWorkTime=true;this.duration=null;this.files=[];this.responsible="";this.responsibleId=0;this.director="";this.directorId=0;this.priority=1;this.depthLevel=1;this.parentTask=null;this.parentTaskId=0;this.childTasks=[];this.hasChildren=false;this.projectId=0;this.project=null;this.predecessors={};this.succesors={};this.menuItems=[];this.url="";this.details=null;this.layout={item:null,row:null,name:null,menu:null,planBar:null,realBar:null,deadlineBar:null,deadlineSlider:null,deadlineOverdue:null,realOverdue:null,completeFlag:null,pointStart:null,pointEnd:null};this.opened=false;this.status=null;this.canEditDeadline=true;this.canEditPlanDates=true;this.canEdit=true;this.projectPlanFromSubTasks=false;this.isParent=false;this.resizerOffsetX=0;this.resizerOffsetY=0;this.resizerChangePos=false;this.resizerPageX=0;this.resizerPageY=0;this.autoResizeIntID=null;this.autoResizeTimeout=50;this.autoResizeCallback=null;this.autoResizeEvent=null;this.highlightTimeout=null};e.prototype.addChild=function(t){if(!t||typeof t!="object"||!(t instanceof e)||t===this||t.parentTask===this){return false}if(this.isChildOf(t)){return false}if(t.parentTask!==null&&t.parentTask!==this){t.parentTask.removeChild(t)}if(t.parentTask===null&&t.project!==null){t.project.removeTask(t)}this.childTasks.push(t);this.hasChildren=true;t.parentTask=this;t.parentTaskId=this.id;t.depthLevel=this.depthLevel+1;t.setProject(this.projectId);t.shiftChildren();return true};e.prototype.isChildOf=function(t){var e=this.parentTask;while(e!==null){if(e===t){return true}e=e.parentTask}return false};e.prototype.isGroup=function(){return this.projectPlanFromSubTasks&&this.isRealDateEnd&&this.canEditPlanDates&&(this.childTasks.length>0||this.hasChildren)};e.prototype.shiftChildren=function(){var t=this.childTasks;for(var e=0,s=t.length;e<s;e++){t[e].depthLevel=t[e].parentTask.depthLevel+1;t[e].projectId=t[e].parentTask.projectId;t[e].project=t[e].parentTask.project;t[e].shiftChildren()}};e.prototype.addChildren=function(t){for(var e=0;e<t.length;e++){this.addChild(t[e])}};e.prototype.removeChild=function(t){for(var e=0;e<this.childTasks.length;e++){if(this.childTasks[e]==t){this.childTasks.splice(e,1);t.depthLevel=1;t.parentTask=null;t.parentTaskId=0;break}}this.hasChildren=this.childTasks.length>0};e.prototype.addPredecessor=function(t){if(t instanceof i){this.predecessors[t.id]=t}};e.prototype.addSuccessor=function(t){if(t instanceof i){this.succesors[t.id]=t}};e.prototype.removePredecessor=function(t){if(t instanceof i){delete this.predecessors[t.id]}};e.prototype.removeSuccessor=function(t){if(t instanceof i){delete this.succesors[t.id]}};e.prototype.hasSuccessor=function(t){for(var e in this.succesors){if(this.succesors.hasOwnProperty(e)){var s=this.chart.getTaskById(this.succesors[e].to);if(s.id===t){return true}if(s.hasSuccessor(t)){return true}}}return false};e.prototype.getDependencies=function(){var t=[];for(var e in this.predecessors){if(this.predecessors.hasOwnProperty(e)){t.push(this.predecessors[e])}}for(e in this.succesors){if(this.succesors.hasOwnProperty(e)){t.push(this.succesors[e])}}return t};e.prototype.getNextTask=function(){var t=this.parentTask?this.parentTask.childTasks:this.project.tasks;for(var e=0;e<t.length;e++){if(t[e]==this){return t[e+1]?t[e+1]:null}}};e.prototype.getPreviousTask=function(){var t=this.parentTask?this.parentTask.childTasks:this.project.tasks;for(var e=0;e<t.length;e++){if(t[e]==this){return e>0&&t[e-1]?t[e-1]:null}}};e.prototype.setTaskFromJSON=function(t){if(typeof t!="object"){return null}this.setStatus(t.status);this.setDateCompleted(t.dateCompleted);this.setDateDeadline(t.dateDeadline);this.setDateStarted(t.dateStarted);if(BX.Tasks.Date.isDate(t.dateEnd)&&t.dateEnd>this.dateStart){this.setDateEnd(t.dateEnd);this.setDateStart(t.dateStart)}else{this.setDateStart(t.dateStart);this.setDateEnd(t.dateEnd)}this.setMatchWorkTime(t.matchWorkTime);this.setMenuItems(t.menuItems);this.setName(t.name);this.setUrl(t.url);this.setDetails(t.details||function(){if(BX.type.isNotEmptyString(this.url)){window.top.location=this.url}});this.setFiles(t.files);if(BX.type.isBoolean(t.opened)){this.opened=t.opened}if(BX.type.isBoolean(t.hasChildren)){this.hasChildren=t.hasChildren}if(BX.type.isBoolean(t.canEditDeadline)){this.canEditDeadline=t.canEditDeadline}if(BX.type.isBoolean(t.canEditPlanDates)){this.canEditPlanDates=t.canEditPlanDates}if(BX.type.isBoolean(t.canEdit)){this.canEdit=t.canEdit}if(t.parameters&&BX.type.isBoolean(t.parameters.projectPlanFromSubTasks)){this.projectPlanFromSubTasks=t.parameters.projectPlanFromSubTasks}if(BX.type.isBoolean(t.isParent)){this.isParent=t.isParent}if(t.responsible){this.responsible=t.responsible}if(t.responsibleId){this.responsibleId=t.responsibleId}if(t.director){this.director=t.director}if(t.directorId){this.directorId=t.directorId}if(BX.type.isNumber(t.priority)){this.priority=t.priority}if(t.parentTask!=null){t.parentTask.addChild(this);t.parentTask=null}else if(t.parentTaskId){var e=this.chart.getTaskById(t.parentTaskId);if(e){e.addChild(this)}}return this};e.prototype.setDateStart=function(t){if(t===null){this.isRealDateStart=false;return this.__setDateStart(this.dateCreated,false,true)}return this.__setDateStart(t,true,false)};e.prototype.__setDateStart=function(t,e,s){if(!BX.Tasks.Date.isDate(t))return;s=!!s;if(!s)t=BX.GanttChart.convertDateToUTC(t);if(this.isRealDateEnd&&t>this.dateEnd)return;this.isRealDateStart=e;this.dateStart=new Date(t.getTime());if(!this.isRealDateEnd){if(this.status==="completed"){if(this.dateCompleted==null||this.dateCompleted<=this.dateStart||BX.Tasks.Date.getDurationInHours(this.dateStart,this.dateCompleted)<this.chart.endlessBarDefaultDuration){this.dateEnd=BX.Tasks.Date.add(this.dateStart,BX.Tasks.Date.Unit.Hour,this.chart.endlessBarDefaultDuration)}else{this.dateEnd=this.dateCompleted}}else{this.dateEnd=BX.Tasks.Date.ceilDate(this.chart.currentDatetime,BX.Tasks.Date.Unit.Day,1);if(this.dateEnd<=this.dateStart||BX.Tasks.Date.getDurationInHours(this.dateStart,this.dateEnd)<this.chart.endlessBarDefaultDuration){this.dateEnd=BX.Tasks.Date.add(this.dateStart,BX.Tasks.Date.Unit.Hour,this.chart.endlessBarDefaultDuration)}}}};e.prototype.setDateEnd=function(t){if(t===null){this.dateEnd=null;this.isRealDateEnd=false;this.__setDateStart(this.dateStart,this.isRealDateStart,true)}else if(BX.Tasks.Date.isDate(t)){t=BX.GanttChart.convertDateToUTC(t);if(t>this.dateStart){this.dateEnd=new Date(t.getTime());this.isRealDateEnd=true}}};e.prototype.setDateCompleted=function(t){if(t===null){this.dateCompleted=null}else if(BX.Tasks.Date.isDate(t)){this.dateCompleted=BX.GanttChart.convertDateToUTC(t);if(this.status=="completed"){if(!this.isRealDateEnd&&this.dateCompleted<=this.dateStart){this.dateEnd=BX.Tasks.Date.add(this.dateStart,BX.Tasks.Date.Unit.Hour,this.chart.endlessBarDefaultDuration)}else{this.dateEnd=this.dateCompleted}}}};e.prototype.setDateStarted=function(t){if(t===null){this.dateStarted=null}else if(BX.Tasks.Date.isDate(t)){this.dateStarted=BX.GanttChart.convertDateToUTC(t)}};e.prototype.setDateDeadline=function(t){if(t===null){this.dateDeadline=null}else if(BX.Tasks.Date.isDate(t)){this.dateDeadline=BX.GanttChart.convertDateToUTC(t)}};e.prototype.setRealDates=function(){if(this.isRealDateStart&&this.isRealDateEnd){return null}if(this.matchWorkTime){var t=this.calculateDuration();var e=BX.Tasks.Date.getUnitRatio(BX.Tasks.Date.Unit.Milli,BX.Tasks.Date.Unit.Hour);if(t<this.chart.endlessBarDefaultDuration*e){t=e*this.chart.endlessBarDefaultDuration}var s=this.chart.calendar;if(!this.isRealDateStart){this.dateStart=s.getClosestWorkTime(this.dateStart,true);this.dateEnd=s.calculateEndDate(this.dateStart,t);this.isRealDateEnd=true;this.isRealDateStart=true}else if(!this.isRealDateEnd){this.dateEnd=s.calculateEndDate(this.dateStart,t);this.isRealDateEnd=true}}else{this.isRealDateEnd=true;this.isRealDateStart=true}this.redraw();return{dateStart:new Date(this.dateStart.getTime()),dateEnd:new Date(this.dateEnd.getTime())}};e.prototype.setName=function(t){if(BX.type.isNotEmptyString(t)){this.name=t}};e.prototype.setMatchWorkTime=function(t){if(t===true||t===false){this.matchWorkTime=t}};e.prototype.setUrl=function(t){if(BX.type.isNotEmptyString(t))this.url=t};e.prototype.setFiles=function(t){if(!BX.type.isArray(t))return;this.files=[];for(var e=0;e<t.length;e++){var s=t[e];if(typeof s=="object"&&BX.type.isNotEmptyString(s.name)){this.files.push({name:s.name,url:s.url?s.url:"",size:s.size?s.size:""})}}};e.prototype.setDetails=function(t){if(BX.type.isFunction(t))this.details=t};e.prototype.getTimeline=function(t){return this.chart.getTimeline()};e.prototype.setMenuItems=function(t){if(BX.type.isArray(t))this.menuItems=t};e.prototype.setStatus=function(t){if(!BX.type.isNotEmptyString(t))return;this.status=t};e.prototype.allowEditDeadline=function(){this.canEditDeadline=true};e.prototype.denyEditDeadline=function(){this.canEditDeadline=false};e.prototype.allowEditPlanDates=function(){this.canEditPlanDates=true};e.prototype.denyEditPlanDates=function(){this.canEditPlanDates=false};e.prototype.setProject=function(t){var e=this.project!=null?this.project:null;if(this.parentTask!==null){this.projectId=this.parentTask.projectId;this.project=this.parentTask.project}else{var s=this.chart.getProjectById(BX.type.isNumber(t)?t:0);if(!s){s=this.chart.getDefaultProject()}this.projectId=s.id;this.project=s}if(e!==null&&e!==this.project){e.removeTask(this)}this.project.addTask(this)};e.prototype.createItem=function(){if(this.layout.item!=null){this.updateItem();return this.layout.item}this.layout.item=BX.create("div",{props:{id:"task-gantt-item-"+this.id},attrs:{"data-task-id":this.id},events:{mouseover:BX.proxy(this.onItemMouseOver,this),mouseout:BX.proxy(this.onItemMouseOut,this)},children:[this.chart.canDragTasks?BX.create("span",{props:{className:"task-gantt-item-handle"}}):null,BX.create("span",{props:{className:"task-gantt-item-folding"},events:{click:BX.proxy(this.onFoldingClick,this)}}),this.layout.name=BX.create("a",{props:{className:"task-gantt-item-name",href:""},events:{click:BX.proxy(this.onItemNameClick,this)}}),BX.create("div",{props:{className:"task-gantt-item-actions"},children:[this.layout.outdent=this.chart.canDragTasks&&this.chart.treeMode?BX.create("span",{props:{className:"task-gantt-item-outdent"},attrs:{title:BX.message("TASKS_GANTT_OUTDENT_TASK")},events:{click:BX.proxy(this.onOutdentClick,this)}}):null,this.layout.indent=this.chart.canDragTasks&&this.chart.treeMode?BX.create("span",{props:{className:"task-gantt-item-indent"},attrs:{title:BX.message("TASKS_GANTT_INDENT_TASK")},events:{click:BX.proxy(this.onIndentClick,this)}}):null,this.layout.menu=BX.create("span",{props:{className:"task-gantt-item-menu"},events:{click:BX.proxy(this.onItemMenuClick,this)}})]})]});this.chart.dragger.registerTask(this.layout.item);this.updateItem();return this.layout.item};e.prototype.updateItem=function(){if(this.layout.item==null){return null}this.layout.name.innerHTML=this.name;this.layout.name.href=this.url;var t="task-gantt-item";if(this.chart.treeMode&&(this.childTasks.length>0||this.hasChildren)){t+=" task-gantt-item-has-children"}if(this.isHidden()){t+=" task-gantt-item-hidden"}if(this.opened){t+=" task-gantt-item-opened"}if(this.canEdit){t+=" task-gantt-item-can-edit"}if(this.status){t+=" task-gantt-item-status-"+this.status}if(this.projectId==0){t+=" task-gantt-item-empty-project"}this.layout.item.className=t;if(this.menuItems.length<1){BX.addClass(this.layout.menu,"task-gantt-item-menu-empty")}else{BX.removeClass(this.layout.menu,"task-gantt-item-menu-empty")}var e=this.projectId==0?this.depthLevel-1:this.depthLevel;if(e>0&&this.chart.treeMode){this.layout.item.style.paddingLeft=this.chart.firstDepthLevelOffset+(e-1)*this.chart.depthLevelOffset+"px"}else{this.layout.item.style.cssText=""}return this.layout.item};e.prototype.createBars=function(){if(this.layout.row!==null){this.updateBars();return this.layout.row}this.createRow();this.createPlanBars();this.createRealBar();this.createCompleteFlag();this.createDeadlineBars();BX.onCustomEvent(window,"onGanttTaskCreateBars",this);return this.layout.row};e.prototype.updateBars=function(){if(this.layout.row===null){return null}this.updateRow();this.updatePlanBars();this.updateRealBar();this.updateCompleteFlag();this.updateDeadlineBars();BX.onCustomEvent(window,"onGanttTaskUpdateBars",this);return this.layout.row};e.prototype.redraw=function(){if(!this.layout.item||!this.layout.row){return}this.chart.autoExpandTimeline([this.getMinDate(),this.getMaxDate()]);this.updateItem();this.updateBars();this.redrawDependencies()};e.prototype.redrawDependencies=function(){for(var t in this.predecessors){if(this.predecessors.hasOwnProperty(t)){this.predecessors[t].draw()}}for(t in this.succesors){if(this.succesors.hasOwnProperty(t)){this.succesors[t].draw()}}};e.prototype.updateLags=function(){for(var t in this.predecessors){if(this.predecessors.hasOwnProperty(t)){this.predecessors[t].updateLag()}}for(t in this.succesors){if(this.succesors.hasOwnProperty(t)){this.succesors[t].updateLag()}}};e.prototype.createRow=function(){if(this.layout.row!=null)return;this.layout.row=BX.create("div",{props:{id:"task-gantt-timeline-row-"+this.id},events:{mouseover:BX.proxy(this.onRowMouseOver,this),mouseout:BX.proxy(this.onRowMouseOut,this),dblclick:BX.proxy(this.onRowDoubleClick,this),contextmenu:BX.proxy(this.onRowContextMenu,this)}});this.updateRow()};e.prototype.updateRow=function(){if(this.layout.row==null)return;var t="task-gantt-timeline-row";if(this.isHidden()){t+=" task-gantt-item-hidden"}if(this.status){t+=" task-gantt-item-status-"+this.status}if(this.isGroup()){t+=" task-gantt-row-group"}this.layout.row.className=t};e.prototype.createPlanBars=function(){if(this.layout.row==null)return;this.layout.planBar=BX.create("div",{attrs:{"data-task-id":this.id},events:{mousedown:BX.proxy(this.onPlanBarMouseDown,this)},children:[this.layout.planBarStart=BX.create("div",{props:{className:"task-gantt-bar-plan-start"},style:{zIndex:0},events:{mousedown:BX.proxy(this.onStartDateMouseDown,this)}}),this.layout.planBarEnd=BX.create("div",{props:{className:"task-gantt-bar-plan-end"},style:{zIndex:0},events:{mousedown:BX.proxy(this.onEndDateMouseDown,this)}}),this.layout.pointStart=this.chart.canCreateDependency?BX.create("div",{props:{className:"task-gantt-point task-gantt-point-start"},style:{},events:{mousedown:BX.proxy(this.onStartPointMouseDown,this)}}):null,this.layout.pointEnd=this.chart.canCreateDependency?BX.create("div",{props:{className:"task-gantt-point task-gantt-point-end"},style:{},events:{mousedown:BX.proxy(this.onEndPointMouseDown,this)}}):null]});this.layout.row.appendChild(this.layout.planBar);this.updatePlanBars()};e.prototype.updatePlanBars=function(){if(this.layout.row==null)return;var t=!this.isRealDateEnd;this.layout.planBar.className="task-gantt-bar-plan"+(t?" task-gantt-bar-plan-endless":"")+(!this.canEditPlanDates?" task-gantt-bar-plan-read-only":"");this.resizePlanBar(this.dateStart,this.dateEnd)};e.prototype.createRealBar=function(){if(this.layout.row==null||this.dateStarted==null)return;this.layout.realBar=BX.create("div",{props:{className:"task-gantt-bar-real"}});this.layout.row.appendChild(this.layout.realBar);this.updateRealBar()};e.prototype.updateRealBar=function(){if(this.layout.row==null){return}if(this.dateStarted!=null){if(this.layout.realBar==null){this.createRealBar()}else{var t=this.getTimeline().getPixelsFromDate(this.dateStarted);var e=this.dateCompleted!=null?this.dateCompleted:this.chart.currentDatetime;var s=e>this.dateStarted?this.getTimeline().getPixelsFromDate(e)-t:0;this.layout.realBar.style.left=t+"px";this.layout.realBar.style.width=s+"px"}}else{if(this.layout.realBar!=null){this.layout.row.removeChild(this.layout.realBar)}this.layout.realBar=null}};e.prototype.createCompleteFlag=function(){if(this.layout.row==null||this.dateCompleted==null)return;this.layout.completeFlag=BX.create("div",{props:{className:"task-gantt-complete-flag"}});this.layout.row.appendChild(this.layout.completeFlag);this.updateCompleteFlag()};e.prototype.updateCompleteFlag=function(){if(this.layout.row==null){return}if(this.dateCompleted!=null){if(this.layout.completeFlag==null){this.createCompleteFlag()}else{this.layout.completeFlag.style.left=this.getTimeline().getPixelsFromDate(this.dateCompleted)-8+"px"}}else{if(this.layout.completeFlag!=null){this.layout.row.removeChild(this.layout.completeFlag)}this.layout.completeFlag=null}};e.prototype.createDeadlineBars=function(){if(this.layout.row==null||this.dateDeadline==null){return}this.layout.deadlineSlider=BX.create("div",{props:{className:"task-gantt-deadline-slider"},events:{mousedown:BX.proxy(this.onDeadlineMouseDown,this)}});this.layout.row.appendChild(this.layout.deadlineSlider);this.layout.deadlineBar=BX.create("div",{props:{className:"task-gantt-bar-deadline"}});this.layout.row.appendChild(this.layout.deadlineBar);this.layout.deadlineOverdue=BX.create("div",{props:{className:"task-gantt-bar-deadline-overdue"}});this.layout.row.appendChild(this.layout.deadlineOverdue);this.layout.realOverdue=BX.create("div",{props:{className:"task-gantt-bar-real-overdue"}});this.layout.row.appendChild(this.layout.realOverdue);this.updateDeadlineBars()};e.prototype.updateDeadlineBars=function(){if(this.layout.row==null){return}if(this.dateDeadline!=null){if(this.layout.deadlineSlider==null){this.createDeadlineBars()}else{if(this.canEditDeadline){BX.removeClass(this.layout.deadlineSlider,"task-gantt-deadline-read-only")}else{BX.addClass(this.layout.deadlineSlider,"task-gantt-deadline-read-only")}this.layout.deadlineSlider.style.left=this.getTimeline().getPixelsFromDate(this.dateDeadline)+"px";this.resizeDeadlineBar(this.dateDeadline);this.resizeDeadlineOverdueBar(this.dateDeadline);this.resizeRealOverdueBar(this.dateDeadline)}}else{if(this.layout.deadlineSlider!=null){this.layout.row.removeChild(this.layout.deadlineBar);this.layout.row.removeChild(this.layout.deadlineSlider);this.layout.row.removeChild(this.layout.deadlineOverdue);this.layout.row.removeChild(this.layout.realOverdue)}this.layout.deadlineBar=null;this.layout.deadlineSlider=null;this.layout.deadlineOverdue=null;this.layout.realOverdue=null}};e.prototype.offsetBars=function(t){this.resizerOffsetX+=t;if(this.layout.planBar)this.layout.planBar.style.left=(parseInt(this.layout.planBar.style.left)||0)+t+"px";if(this.layout.realBar)this.layout.realBar.style.left=(parseInt(this.layout.realBar.style.left)||0)+t+"px";if(this.layout.completeFlag)this.layout.completeFlag.style.left=(parseInt(this.layout.completeFlag.style.left)||0)+t+"px";if(this.layout.deadlineSlider){this.layout.deadlineSlider.style.left=(parseInt(this.layout.deadlineSlider.style.left)||0)+t+"px";this.layout.deadlineBar.style.left=(parseInt(this.layout.deadlineBar.style.left)||0)+t+"px";this.layout.deadlineOverdue.style.left=(parseInt(this.layout.deadlineOverdue.style.left)||0)+t+"px";this.layout.realOverdue.style.left=(parseInt(this.layout.realOverdue.style.left)||0)+t+"px"}};e.prototype.resizePlanBar=function(t,e){if(this.layout.planBar==null)return;var s=this.getTimeline().getPixelsFromDate(t);var a=this.getTimeline().getPixelsFromDate(e);var i=a-s;i=Math.max(i,this.chart.minBarWidth);if(!this.isRealDateEnd){var r=i-this.chart.arrowBarWidth;if(r<this.chart.minBarWidth){BX.removeClass(this.layout.planBar,"task-gantt-bar-plan-endless")}else{i=r;BX.addClass(this.layout.planBar,"task-gantt-bar-plan-endless")}}if(this.isGroup()){if(i<this.chart.minGroupBarWidth){BX.addClass(this.layout.planBar,"task-gantt-min-group-bar")}else{BX.removeClass(this.layout.planBar,"task-gantt-min-group-bar")}}this.layout.planBar.style.left=s+"px";this.layout.planBar.style.width=i+"px"};e.prototype.resizeDeadlineBar=function(t){if(this.layout.deadlineBar==null){return}var e=0;var s=0;if(t>this.dateEnd){e=this.getTimeline().getPixelsFromDate(this.dateEnd);s=this.getTimeline().getPixelsFromDate(t)}else if(t<this.dateStart){e=this.getTimeline().getPixelsFromDate(this.dateDeadline);s=this.getTimeline().getPixelsFromDate(this.dateStart)}this.layout.deadlineBar.style.left=e+"px";this.layout.deadlineBar.style.width=s-e+"px"};e.prototype.resizeDeadlineOverdueBar=function(t){if(this.layout.deadlineOverdue==null){return}var e=0;var s=0;if(this.dateCompleted==null&&this.chart.currentDatetime>t){e=this.getTimeline().getPixelsFromDate(t);s=this.getTimeline().getPixelsFromDate(this.chart.currentDatetime)}else if(this.dateCompleted!=null&&this.dateCompleted>t){e=this.getTimeline().getPixelsFromDate(t);s=this.getTimeline().getPixelsFromDate(this.dateCompleted)}this.layout.deadlineOverdue.style.left=e+"px";this.layout.deadlineOverdue.style.width=s-e+"px"};e.prototype.resizeRealOverdueBar=function(t){if(this.layout.realOverdue==null||this.dateStarted==null){return}if(this.dateStarted>t){t=this.dateStarted}var e=0;var s=0;if(this.dateCompleted==null&&this.chart.currentDatetime>t){e=this.getTimeline().getPixelsFromDate(t);s=this.getTimeline().getPixelsFromDate(this.chart.currentDatetime)}else if(this.dateCompleted!=null&&this.dateCompleted>t){e=this.getTimeline().getPixelsFromDate(t);s=this.getTimeline().getPixelsFromDate(this.dateCompleted)}this.layout.realOverdue.style.left=e+"px";this.layout.realOverdue.style.width=s-e+"px"};e.prototype.onIndentClick=function(t){this.chart.indentTask(this.id)};e.prototype.onOutdentClick=function(t){this.chart.outdentTask(this.id)};e.prototype.onFoldingClick=function(t){if(this.opened){this.collapse()}else{this.expand()}};e.prototype.onItemNameClick=function(t){t=t||window.event;if(!BX.GanttChart.isLeftClick(t))return;if(!this.chart.settings.disableItemNameClickHandler&&BX.type.isFunction(this.details)){this.details({event:t});BX.PreventDefault(t)}};e.prototype.onItemMenuClick=function(t){var e=BX.PopupMenu.create(this.id,this.layout.menu,this.menuItems,{offsetLeft:8,bindOptions:{forceBindPosition:true},events:{onPopupClose:function(){this.destroy()},onPopupDestroy:BX.proxy(this.onItemMenuClose,this)},chart:this.chart,task:this});e.getPopupWindow().setBindElement(this.layout.menu);e.show();this.denyItemsHover();BX.addClass(this.layout.menu,"task-gantt-item-menu-selected")};e.prototype.onItemMenuClose=function(t,e){this.allowItemsHover(e);BX.removeClass(this.layout.menu,"task-gantt-item-menu-selected")};e.prototype.onItemMouseOver=function(t){if(!this.chart.allowRowHover)return;t=t||window.event;BX.addClass(this.layout.item,"task-gantt-item-hover task-gantt-item-tree-hover");BX.addClass(this.layout.row,"task-gantt-timeline-row-hover")};e.prototype.onItemMouseOut=function(t){if(!this.chart.allowRowHover)return;if(this.isShowQuickInfo(t))BX.TaskQuickInfo.hide();BX.removeClass(this.layout.item,"task-gantt-item-hover task-gantt-item-tree-hover");BX.removeClass(this.layout.row,"task-gantt-timeline-row-hover")};e.prototype.onRowMouseOver=function(t){if(!this.chart.allowRowHover)return;t=t||window.event;if(this.isShowQuickInfo(t)){BX.fixEventPageX(t);BX.TaskQuickInfo.show(function(){this.chart.adjustChartContainer();var e=this.layout.row.offsetTop+this.chart.chartContainer.pos.top+58;var s=t.pageX;var a=e+27;return{left:s,top:e,bottom:a}}.bind(this),this.getQuickInfoData(),{dateFormat:this.chart.dateFormat,dateInUTC:true,onDetailClick:this.chart.settings.disableDetailClickHandler?null:BX.proxy(this.onQuickInfoDetails,this),userProfileUrl:this.chart.userProfileUrl})}BX.addClass(this.layout.item,"task-gantt-item-hover");BX.addClass(this.layout.row,"task-gantt-timeline-row-hover")};e.prototype.onRowMouseOut=function(t){if(!this.chart.allowRowHover)return;if(this.isShowQuickInfo(t))BX.TaskQuickInfo.hide();BX.removeClass(this.layout.item,"task-gantt-item-hover task-gantt-item-tree-hover");BX.removeClass(this.layout.row,"task-gantt-timeline-row-hover")};e.prototype.onRowDoubleClick=function(t){t=t||window.event;if(BX.type.isFunction(this.details))return this.details({event:t})};e.prototype.onRowContextMenu=function(t){t=t||window.event;if(this.menuItems.length<1||t.ctrlKey)return;BX.TaskQuickInfo.hide();BX.fireEvent(document.body,"click");BX.PopupMenu.destroy(this.id);var e=BX.PopupMenu.create(this.id,t,this.menuItems,{offsetLeft:1,autoHide:true,closeByEsc:true,bindOptions:{forceBindPosition:true},events:{onPopupClose:BX.proxy(this.onItemMenuClose,this)},chart:this.chart,task:this});e.getPopupWindow().setBindElement(t);e.show();var s=null;var a=t.target||t.srcElement;if(BX.hasClass(a,"task-gantt-timeline-row"))s=a;else if(BX.hasClass(a.parentNode,"task-gantt-timeline-row"))s=a.parentNode;else if(BX.hasClass(a.parentNode.parentNode,"task-gantt-timeline-row"))s=a.parentNode.parentNode;if(s!=null&&BX.type.isNotEmptyString(s.id)){var i=this.chart.getTaskById(s.id.substr("task-gantt-timeline-row-".length));if(i!=null){BX.addClass(i.layout.item,"task-gantt-item-hover");BX.addClass(i.layout.row,"task-gantt-timeline-row-hover")}}this.denyItemsHover();BX.PreventDefault(t)};e.prototype.onQuickInfoDetails=function(t,e,s){e.close();if(BX.type.isFunction(this.details))return this.details({event:t,popupWindow:e,quickInfo:s})};e.prototype.isShowQuickInfo=function(t){if(this.chart.dragClientX!=0||!this.chart.allowRowHover)return false;t=t||window.event;var e=t.target||t.srcElement;return e==this.layout.planBar||e==this.layout.realBar||e==this.layout.name||e==this.layout.deadlineBar||e==this.layout.deadlineOverdue||e==this.layout.realOverdue||e==this.layout.completeFlag||e==this.layout.deadlineSlider};e.prototype.getQuickInfoData=function(){var t=this.isRealDateStart?this.dateStart:null;var e=this.isRealDateEnd?this.dateEnd:null;return{id:this.id,name:this.name,dateCreated:this.dateCreated,dateStart:t,dateEnd:e,dateDeadline:this.dateDeadline,dateCompleted:this.dateCompleted,dateStarted:this.dateStarted,files:this.files,priority:this.priority,status:this.status,responsible:this.responsible,responsibleId:this.responsibleId,director:this.director,directorId:this.directorId,url:this.url}};e.prototype.denyItemsHover=function(){this.chart.allowRowHover=false};e.prototype.allowItemsHover=function(t){this.chart.allowRowHover=true;t=t||window.event||null;if(!t)return;var e=t.target||t.srcElement;if(t.keyCode==27||e!=this.layout.row&&e.parentNode!=this.layout.row&&e.parentNode.parentNode!=this.layout.row&&e!=this.layout.item&&e.parentNode!=this.layout.item){BX.removeClass(this.layout.item,"task-gantt-item-hover task-gantt-item-tree-hover");BX.removeClass(this.layout.row,"task-gantt-timeline-row-hover")}else if(e!=this.layout.item&&e.parentNode!=this.layout.item){BX.removeClass(this.layout.item,"task-gantt-item-tree-hover")}};e.prototype.isHidden=function(){if(this.project.opened===false)return true;var t=this.parentTask;while(t!=null){if(t.opened===false)return true;t=t.parentTask}return false};e.prototype.show=function(){BX.removeClass(this.layout.item,"task-gantt-item-hidden");BX.removeClass(this.layout.row,"task-gantt-item-hidden")};e.prototype.hide=function(){BX.addClass(this.layout.item,"task-gantt-item-hidden");BX.addClass(this.layout.row,"task-gantt-item-hidden")};e.prototype.collapse=function(t,e){var s=this.childTasks.length;e=BX.type.isFunction(e)?e:BX.DoNothing;if(s<1){e();return}if(!t){BX.removeClass(this.layout.item,"task-gantt-item-opened");this.opened=false;BX.onCustomEvent(this.chart,"onTaskOpen",[this,e])}for(var a=0;a<s;a++){this.childTasks[a].hide();this.childTasks[a].collapse(true)}if(!t){this.chart.drawDependencies()}};e.prototype.expand=function(t,e){var s=this.childTasks.length;e=BX.type.isFunction(e)?e:BX.DoNothing;if(s<1&&this.hasChildren===false){e();return}if(!t){this.opened=true;BX.addClass(this.layout.item,"task-gantt-item-opened");BX.onCustomEvent(this.chart,"onTaskOpen",[this,e])}for(var a=0;a<s;a++){this.childTasks[a].show();if(this.childTasks[a].opened){this.childTasks[a].expand(true)}}if(!t){this.chart.drawDependencies()}};e.prototype.highlight=function(){if(!this.highlightTimeout){BX.addClass(this.layout.item,"task-gantt-item-highlighted");BX.addClass(this.layout.row,"task-gantt-row-highlighted");this.highlightTimeout=setTimeout(BX.proxy(this.stopHighlight,this),1e3)}};e.prototype.stopHighlight=function(){if(this.highlightTimeout){clearTimeout(this.highlightTimeout)}this.highlightTimeout=null;BX.removeClass(this.layout.item,"task-gantt-item-highlighted");BX.removeClass(this.layout.row,"task-gantt-row-highlighted")};e.prototype.scrollIntoView=function(t){this.layout.item.scrollIntoView(t)};e.prototype.getMinDate=function(){var t=[this.dateStart,this.dateEnd,this.dateCreated,this.dateStarted,this.dateCompleted,this.dateDeadline];for(var e=t.length-1;e>=0;e--)if(t[e]==null)t.splice(e,1);return new Date(Math.min.apply(null,t))};e.prototype.getMaxDate=function(){var t=[this.dateStart,this.dateEnd,this.dateCreated,this.dateStarted,this.dateCompleted,this.dateDeadline];for(var e=t.length-1;e>=0;e--)if(t[e]==null)t.splice(e,1);return new Date(Math.max.apply(null,t))};e.prototype.startResize=function(t,e,s,a){t=t||window.event;BX.bind(document,"mouseup",e);BX.bind(document,"mousemove",s);document.body.onselectstart=BX.False;document.body.ondragstart=BX.False;document.body.style.MozUserSelect="none";document.body.style.cursor=a?a:"ew-resize";this.denyItemsHover();BX.TaskQuickInfo.hide();BX.PreventDefault(t)};e.prototype.endResize=function(t,e,s){t=t||window.event;BX.unbind(document,"mouseup",e);BX.unbind(document,"mousemove",s);document.body.onselectstart=null;document.body.ondragstart=null;document.body.style.MozUserSelect="";document.body.style.cursor="default";this.stopAutoResize();this.allowItemsHover(t);this.chart.tooltip.hide()};e.prototype.onDeadlineMouseDown=function(t){if(!this.canEditDeadline){return}t=t||window.event;BX.fixEventPageX(t);if(!BX.GanttChart.isLeftClick(t)){return}this.resizerOffsetX=this.getTimeline().getPixelsFromDate(this.dateDeadline);this.resizerPageX=t.pageX;this.resizerChangePos=false;this.startResize(t,BX.proxy(this.onDeadlineMouseUp,this),BX.proxy(this.onDeadlineMouseMove,this))};e.prototype.onDeadlineMouseUp=function(t){this.endResize(t,BX.proxy(this.onDeadlineMouseUp,this),BX.proxy(this.onDeadlineMouseMove,this));if(this.resizerChangePos){if(this.matchWorkTime){this.dateDeadline=this.chart.calendar.getClosestWorkTime(this.dateDeadline,true);this.redraw()}BX.onCustomEvent(this.chart,"onTaskChange",[[this.getEventObject(["dateDeadline"])]])}};e.prototype.onDeadlineMouseMove=function(t){this.autoResize(t,this.resizeDeadlineDate)};e.prototype.resizeDeadlineDate=function(t){this.resizerOffsetX=this.resizerOffsetX+t;this.layout.deadlineSlider.style.left=this.resizerOffsetX+"px";this.dateDeadline=this.getTimeline().getDateFromPixels(this.resizerOffsetX);this.resizeDeadlineBar(this.dateDeadline);this.resizeDeadlineOverdueBar(this.dateDeadline);this.resizeRealOverdueBar(this.dateDeadline);this.chart.tooltip.show(this.resizerOffsetX,this);this.chart.autoExpandTimeline(this.dateDeadline)};e.prototype.onStartDateMouseDown=function(t){if(!this.canEditPlanDates||this.isGroup()){return}if(this.isParent&&this.projectPlanFromSubTasks&&this.isRealDateEnd){return}t=t||window.event;BX.fixEventPageX(t);if(!BX.GanttChart.isLeftClick(t)){return}this.layout.planBarStart.style.zIndex=parseInt(this.layout.planBarEnd.style.zIndex)+1;this.resizerOffsetX=this.getTimeline().getPixelsFromDate(this.dateStart);this.resizerPageX=t.pageX;this.resizerChangePos=false;this.startResize(t,BX.proxy(this.onStartDateMouseUp,this),BX.proxy(this.onStartDateMouseMove,this))};e.prototype.onStartDateMouseUp=function(t){this.endResize(t,BX.proxy(this.onStartDateMouseUp,this),BX.proxy(this.onStartDateMouseMove,this));if(this.resizerChangePos){this.matchWorkingTime(this.dateStart);this.schedule();this.chart.drawDependencies();BX.onCustomEvent(this.chart,"onTaskChange",[[this.getEventObject(["dateStart"])]])}};e.prototype.onStartDateMouseMove=function(t){this.autoResize(t,this.resizeStartDate)};e.prototype.resizeStartDate=function(t){this.resizerOffsetX=this.resizerOffsetX+t;var e=this.getTimeline().getPixelsFromDate(this.dateEnd);if(e-this.resizerOffsetX<this.chart.minBarWidth){this.dateStart=this.getTimeline().getDateFromPixels(e-this.chart.minBarWidth);this.isRealDateStart=true;this.resizePlanBar(this.dateStart,this.dateEnd);this.resizeDeadlineBar(this.dateDeadline);this.chart.tooltip.show(this.resizerOffsetX,this)}else{this.dateStart=this.getTimeline().getDateFromPixels(this.resizerOffsetX);this.isRealDateStart=true;this.resizePlanBar(this.dateStart,this.dateEnd);this.resizeDeadlineBar(this.dateDeadline);this.chart.tooltip.show(this.resizerOffsetX,this);this.chart.autoExpandTimeline(this.dateStart)}this.redrawDependencies()};e.prototype.onEndDateMouseDown=function(t){if(!this.canEditPlanDates||this.isGroup()){return}if(this.isParent&&this.projectPlanFromSubTasks&&this.isRealDateEnd){return}t=t||window.event;BX.fixEventPageX(t);if(!BX.GanttChart.isLeftClick(t))return;this.layout.planBarEnd.style.zIndex=parseInt(this.layout.planBarStart.style.zIndex)+1;this.resizerOffsetX=this.getTimeline().getPixelsFromDate(this.dateEnd);this.resizerPageX=t.pageX;this.resizerChangePos=false;this.startResize(t,BX.proxy(this.onEndDateMouseUp,this),BX.proxy(this.onEndDateMouseMove,this))};e.prototype.onEndDateMouseUp=function(t){this.endResize(t,BX.proxy(this.onEndDateMouseUp,this),BX.proxy(this.onEndDateMouseMove,this));if(this.resizerChangePos){this.matchWorkingTime(null,this.dateEnd);this.schedule();this.chart.drawDependencies();BX.onCustomEvent(this.chart,"onTaskChange",[[this.getEventObject(["dateEnd"])]])}};e.prototype.onEndDateMouseMove=function(t){if(!this.isRealDateEnd){this.isRealDateEnd=true;BX.removeClass(this.layout.planBar,"task-gantt-bar-plan-endless")}this.autoResize(t,this.resizeEndDate)};e.prototype.resizeEndDate=function(t){this.resizerOffsetX=this.resizerOffsetX+t;var e=this.getTimeline().getPixelsFromDate(this.dateStart);if(this.resizerOffsetX-e<this.chart.minBarWidth){this.dateEnd=this.getTimeline().getDateFromPixels(e+this.chart.minBarWidth);this.resizePlanBar(this.dateStart,this.dateEnd);this.resizeDeadlineBar(this.dateDeadline);this.chart.tooltip.show(this.resizerOffsetX,this)}else{this.dateEnd=this.getTimeline().getDateFromPixels(this.resizerOffsetX);this.resizePlanBar(this.dateStart,this.dateEnd);this.resizeDeadlineBar(this.dateDeadline);this.chart.tooltip.show(this.resizerOffsetX,this);this.chart.autoExpandTimeline(this.dateEnd)}this.redrawDependencies()};e.prototype.onPlanBarMouseDown=function(t){if(!this.canEditPlanDates){return}t=t||window.event;BX.fixEventPageX(t);if(!BX.GanttChart.isLeftClick(t)){return}this.resizerOffsetX=this.getTimeline().getPixelsFromDate(this.dateStart);this.resizerPageX=t.pageX;this.resizerChangePos=false;this.startResize(t,BX.proxy(this.onPlanBarMouseUp,this),BX.proxy(this.onPlanBarMouseMove,this),"move");this.duration=this.calculateDuration()};e.prototype.onPlanBarMouseUp=function(t){this.endResize(t,BX.proxy(this.onPlanBarMouseUp,this),BX.proxy(this.onPlanBarMouseMove,this));if(this.resizerChangePos){this.matchWorkingTime(this.dateStart,this.dateEnd,this.duration);this.schedule();this.chart.drawDependencies();BX.onCustomEvent(this.chart,"onTaskChange",[[this.getEventObject(["dateStart","dateEnd"])]])}};e.prototype.onPlanBarMouseMove=function(t){if(!this.isRealDateEnd){this.isRealDateEnd=true;BX.removeClass(this.layout.planBar,"task-gantt-bar-plan-endless")}this.autoResize(t,this.resizeStartEndDate,true)};e.prototype.resizeStartEndDate=function(t){this.resizerOffsetX=this.resizerOffsetX+t;var e=this.getCoords();this.dateStart=this.getTimeline().getDateFromPixels(e.startX+t);this.dateEnd=this.getTimeline().getDateFromPixels(e.endX+t);this.layout.planBar.style.left=e.startX+t+"px";this.isRealDateStart=true;this.isRealDateEnd=true;this.resizeDeadlineBar(this.dateDeadline);this.chart.tooltip.show(this.autoResizeEvent.pageX-this.chart.chartContainer.pos.left-this.chart.gutterOffset+this.getTimeline().getScrollLeft(),this);this.chart.autoExpandTimeline([this.dateStart,this.dateEnd]);this.redrawDependencies()};e.prototype.onStartPointMouseDown=function(t){this.chart.pointer.startDrag(this,true,t)};e.prototype.onEndPointMouseDown=function(t){this.chart.pointer.startDrag(this,false,t)};e.prototype.autoResize=function(t,e,s){t=t||window.event;BX.fixEventPageXY(t);this.autoResizeEvent={clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY};this.autoResizeCallback=e;this.resizerChangePos=true;s=!!s;if(t.pageX>this.chart.chartContainer.maxPageX&&t.pageX-this.resizerPageX>0&&!this.autoResizeIntID){this.stopAutoResize();if(!s){var a=this.chart.chartContainer.width-this.chart.chartContainer.padding-this.chart.gutterOffset+this.getTimeline().getScrollLeft();this.autoResizeCallback(a-this.resizerOffsetX,t.pageY-this.resizerPageY);this.resizerPageX=this.chart.chartContainer.maxPageX;this.resizerPageY=t.pageY}this.autoResizeIntID=setInterval(BX.proxy(this.autoResizeRight,this),this.autoResizeTimeout)}else if(t.pageX<this.chart.chartContainer.minPageX&&t.pageX-this.resizerPageX<0&&!this.autoResizeIntID){this.stopAutoResize();if(!s){var i=this.chart.chartContainer.padding+this.getTimeline().getScrollLeft();this.autoResizeCallback(i-this.resizerOffsetX,t.pageY-this.resizerPageY);this.resizerPageX=this.chart.chartContainer.minPageX;this.resizerPageY=t.pageY}this.autoResizeIntID=setInterval(BX.proxy(this.autoResizeLeft,this),this.autoResizeTimeout)}else if(t.pageX>this.chart.chartContainer.minPageX&&t.pageX<this.chart.chartContainer.maxPageX||!this.autoResizeIntID){this.stopAutoResize();this.autoResizeCallback(t.pageX-this.resizerPageX,t.pageY-this.resizerPageY);this.resizerPageX=t.pageX;this.resizerPageY=t.pageY}else{this.resizerPageX=t.pageX;this.resizerPageY=t.pageY}};e.prototype.stopAutoResize=function(){if(this.autoResizeIntID)clearInterval(this.autoResizeIntID);this.autoResizeIntID=null};e.prototype.autoResizeRight=function(){this.getTimeline().setScrollLeft(this.getTimeline().getScrollLeft()+this.chart.chartContainer.padding);this.autoResizeCallback(this.chart.chartContainer.padding,0)};e.prototype.autoResizeLeft=function(){this.getTimeline().setScrollLeft(this.getTimeline().getScrollLeft()-this.chart.chartContainer.padding);this.autoResizeCallback(-this.chart.chartContainer.padding,0)};e.prototype.getMouseOffset=function(t){return t.pageX-(this.chart.chartContainer.pos.left+this.chart.gutterOffset)+this.getTimeline().getScrollLeft()};e.prototype.getRealDates=function(){var t=this.isRealDateStart?this.dateStart:null;var e=this.isRealDateEnd?this.dateEnd:null;return{dateCreated:BX.GanttChart.convertDateFromUTC(this.dateCreated),dateStart:BX.GanttChart.convertDateFromUTC(t),dateEnd:BX.GanttChart.convertDateFromUTC(e),dateDeadline:BX.GanttChart.convertDateFromUTC(this.dateDeadline),dateCompleted:BX.GanttChart.convertDateFromUTC(this.dateCompleted),dateStarted:BX.GanttChart.convertDateFromUTC(this.dateStarted)}};e.prototype.getEventObject=function(t){var e=this.getRealDates();e.task=this;e.changes=BX.type.isArray(t)?t:[];return e};e.prototype.getCoords=function(){var t=this.layout.planBar.offsetLeft;var e=this.layout.row.offsetTop+16;return{startX:t,startY:e,endX:t+this.layout.planBar.offsetWidth,endY:e}};e.prototype.schedule=function(t,e){if(!this.canEditPlanDates){return}e=e||(new Date).getTime();if(t&&this.transaction!==e){var s=t.getMinDate();var a=this.calculateDuration();var i=BX.Tasks.Date.add(s,BX.Tasks.Date.Unit.Milli,a);this.setTaskFromJSON({dateStart:BX.GanttChart.convertDateFromUTC(s),dateEnd:BX.GanttChart.convertDateFromUTC(i)});this.correctWorkTime(s,i,a);this.redraw()}this.transaction=e;for(var r in this.predecessors){if(this.predecessors.hasOwnProperty(r)){var n=this.predecessors[r];n.updateLag()}}for(r in this.succesors){if(this.succesors.hasOwnProperty(r)){var o=this.chart.getTaskById(this.succesors[r].to);o.schedule(this.succesors[r],e)}}};e.prototype.calculateDuration=function(){if(this.matchWorkTime){var t=this.chart.calendar.calculateDuration(this.dateStart,this.dateEnd);return t>0?t:this.dateEnd-this.dateStart}else{return this.dateEnd-this.dateStart}};e.prototype.getMinimalStartDate=function(){var t=null;for(var e in this.predecessors){if(!this.predecessors.hasOwnProperty(e)){continue}var s=this.predecessors[e];var a=s.getMinDate();if(t===null||t<a){t=a}}return t};e.prototype.correctWorkTime=function(t,e,s){if(!this.matchWorkTime){return}var a=this.chart.calendar;if(!a.isWorkTime(t)){this.dateStart=a.getClosestWorkTime(t,true);this.dateEnd=a.calculateEndDate(t,s)}else{this.dateEnd=a.calculateEndDate(t,s)}};e.prototype.matchWorkingTime=function(t,e,s){if(!this.matchWorkTime){return}if(t&&e){this.correctWorkTime(t,e,s)}else if(t){this.dateStart=this.chart.calendar.getClosestWorkTime(t,true);if(this.dateStart>this.dateEnd){this.dateEnd=this.chart.calendar.calculateEndDate(t,this.dateEnd-t)}}else if(e){this.dateEnd=this.chart.calendar.getClosestWorkTime(e,false);if(this.dateStart>this.dateEnd){this.dateStart=this.chart.calendar.calculateStartDate(this.dateEnd,e-this.dateStart)}}this.redraw()};var s=function(t){this.chart=t;this.firstWeekDay=1;this.setFirstWeekDay(t.settings.firstWeekDay);this.headerViewportWidth=null;this.zoom=new a(t.settings.zoomLevel);this.reconfigure(this.zoom.getPreset())};s.prototype.reconfigure=function(t){this.topUnit=t.topUnit||this.topUnit||BX.Tasks.Date.Unit.Month;this.topIncrement=t.topIncrement||this.topIncrement||1;this.topDateFormat=t.topDateFormat||this.topDateFormat||"F Y";this.bottomUnit=t.bottomUnit||this.bottomUnit||BX.Tasks.Date.Unit.Day;this.bottomIncrement=t.bottomIncrement||this.bottomIncrement||1;this.bottomDateFormat=t.bottomDateFormat||this.bottomDateFormat||"j";this.snapUnit=t.snapUnit||this.snapUnit||BX.Tasks.Date.Unit.Hour;this.snapIncrement=t.snapIncrement||this.snapIncrement||1;this.snapWidth=t.snapWidth||this.snapWidth||1;this.columnWidth=t.columnWidth||this.columnWidth||24;var e=BX.Tasks.Date.floorDate(this.chart.currentDatetime,this.topUnit,this.firstWeekDay);var s=BX.Tasks.Date.ceilDate(this.chart.currentDatetime,this.topUnit,this.topIncrement,this.firstWeekDay);var a=Math.ceil(this.chart.chartContainer.width/this.getUnitInPixels(this.snapUnit));var i=BX.Tasks.Date.getDurationInUnit(e,s,this.snapUnit);var r=Math.ceil(a/i);this.startDate=BX.Tasks.Date.add(e,this.topUnit,-r);this.endDate=BX.Tasks.Date.add(s,this.topUnit,r)};s.prototype.setFirstWeekDay=function(t){if(BX.type.isNumber(t)&&t>=0&&t<=6){this.firstWeekDay=t}};s.prototype.setZoomLevel=function(t){this.zoom.setLevel(t);this.reconfigure(this.zoom.getPreset())};s.prototype.draw=function(){this.setTimelineWidth()};s.prototype.getTimelineWidth=function(){return this.getTimespanInPixels(this.startDate,this.endDate,this.snapUnit)};s.prototype.getTimespanWidth=function(t,e){return this.getTimespanInPixels(t,e,this.snapUnit)};s.prototype.getTimespanInPixels=function(t,e,s){var a=BX.Tasks.Date.getDurationInUnit(t,e,s);var i=this.getUnitInPixels(s);return a*i};s.prototype.setTimelineWidth=function(){this.chart.layout.timelineInner.style.width=this.getTimelineWidth()+"px"};s.prototype.getColumnWidth=function(){return this.chart.gutterOffset};s.prototype.getScrollHeight=function(){return this.chart.layout.root.scrollHeight};s.prototype.getRootContainer=function(){return this.chart.layout.root};s.prototype.autoExpandTimeline=function(t,e){if(!BX.type.isArray(t)){t=[t]}var s=Math.ceil(this.chart.chartContainer.width/this.getUnitInPixels(this.snapUnit));for(var a=0;a<t.length;a++){var i=t[a];var r=BX.Tasks.Date.floorDate(i,this.topUnit,this.firstWeekDay);var n=BX.Tasks.Date.ceilDate(i,this.topUnit,this.topIncrement,this.firstWeekDay);var o=BX.Tasks.Date.getDurationInUnit(r,n,this.snapUnit);var h=Math.ceil(s/o);var l=BX.Tasks.Date.getDurationInUnit(this.startDate,i,this.snapUnit);if(l<=s){var d=BX.Tasks.Date.add(r,this.topUnit,-h);this.expandTimelineLeft(d,e);continue}l=BX.Tasks.Date.getDurationInUnit(i,this.endDate,this.snapUnit);if(l<=s){var p=BX.Tasks.Date.add(n,this.topUnit,h);this.expandTimelineRight(p,e)}}};s.prototype.expandTimelineLeft=function(t,e){if(t>=this.startDate){return}var s=new Date(this.startDate.getTime());this.startDate=t;if(this.chart.layout.root===null||e===true){return}var a=BX.Tasks.Date.getDurationInUnit(this.startDate,s,this.snapUnit);var i=this.getUnitInPixels(this.snapUnit);var r=a*i;var n=this.getScrollLeft();this.setTimelineWidth();for(var o in this.chart.tasks){this.chart.tasks[o].offsetBars(r)}this.chart.drawDependencies();this.chart.pointer.offsetLine(r);this.setScrollLeft(n+r)};s.prototype.expandTimelineRight=function(t,e){if(t<=this.endDate){return}this.endDate=t;if(this.chart.layout.root===null||e===true){return}var s=this.getScrollLeft();this.setTimelineWidth();this.setScrollLeft(s)};s.prototype.getStart=function(){return this.startDate};s.prototype.getEnd=function(){return this.endDate};s.prototype.getHeaderViewportWidth=function(){return this.headerViewportWidth!==null?this.headerViewportWidth:this.chart.chartContainer.width};s.prototype.setHeaderViewportWidth=function(t){if(BX.type.isNumber(t)||t===null){this.headerViewportWidth=t}};s.prototype.renderHeader=function(){var t=this.getHeaderViewportWidth();var e=this.getScrollLeft();var s=this.getDateFromPixels(e);var a=this.getDateFromPixels(e+t);s=BX.Tasks.Date.floorDate(s,this.topUnit,this.firstWeekDay);a=BX.Tasks.Date.ceilDate(a,this.topUnit,this.topIncrement,this.firstWeekDay);var i=Math.ceil(t/this.getUnitInPixels(this.topUnit));s=BX.Tasks.Date.add(s,this.topUnit,-i);a=BX.Tasks.Date.add(a,this.topUnit,i);s=BX.Tasks.Date.max(s,this.getStart());a=BX.Tasks.Date.min(a,this.getEnd());this.chart.layout.scalePrimary.innerHTML=this.createHeader(s,a,"top",this.topUnit,this.topIncrement);this.chart.layout.scaleSecondary.innerHTML=this.createHeader(s,a,"bottom",this.bottomUnit,this.bottomIncrement)};s.prototype.createHeader=function(t,e,s,a,i){var r=this.getStart();var n=e;var o="";var h=0;while(r<n){var l=BX.Tasks.Date.min(BX.Tasks.Date.getNext(r,a,i,this.firstWeekDay),n);if(r>=t){o+=s==="top"?this.renderTopHeader(r,l):this.renderBottomHeader(r,l)}else{var d=BX.Tasks.Date.getDurationInUnit(r,l,this.snapUnit);var p=this.getUnitInPixels(this.snapUnit);h+=this.getTimespanInPixels(r,l,this.snapUnit)}r=l}return'<div style="position: absolute; left: '+h+'px">'+o+"</div>"};s.prototype.renderTopHeader=function(t,e){var s=BX.Tasks.Date.getDurationInUnit(t,e,this.snapUnit);var a=this.getUnitInPixels(this.snapUnit);return'<span class="task-gantt-top-column" '+'style="width:'+s*a+'px"><span class="task-gantt-scale-month-text">'+BX.date.format(this.topDateFormat,t,null,true)+"</span></span>"};s.prototype.renderBottomHeader=function(t,e){var s=BX.Tasks.Date.getDurationInUnit(t,e,this.snapUnit);var a=this.getUnitInPixels(this.snapUnit);var i="task-gantt-bottom-column";if(this.bottomUnit!==BX.Tasks.Date.Unit.Month&&this.bottomUnit!==BX.Tasks.Date.Unit.Quarter&&this.bottomUnit!==BX.Tasks.Date.Unit.Year){if(this.isToday(t,e)){i+=" task-gantt-today-column"}if(this.isWeekend(t,e)){i+=" task-gantt-weekend-column"}if(this.isHoliday(t,e)){i+=" task-gantt-holiday-column"}}return'<span class="'+i+'" style="width:'+s*a+'px">'+BX.date.format(this.bottomDateFormat,t,null,true)+"</span>"};s.prototype.isToday=function(t,e){return this.chart.currentDate.getUTCMonth()===t.getUTCMonth()&&this.chart.currentDate.getUTCDate()===t.getUTCDate()};s.prototype.isHoliday=function(t,e){return this.chart.calendar.isHoliday(t)};s.prototype.isWeekend=function(t,e){return this.chart.calendar.isWeekend(t)};s.prototype.getPixelsFromDate=function(t){var e=BX.Tasks.Date.getDurationInUnit(this.startDate,t,this.snapUnit);return e*this.getUnitInPixels(this.snapUnit)};s.prototype.getDateFromPixels=function(t){var e=BX.Tasks.Date.add(this.startDate,this.snapUnit,Math.floor(t/this.getUnitInPixels(this.snapUnit)));return this.snapDate(e)};s.prototype.getUnitInPixels=function(t){return BX.Tasks.Date.getUnitRatio(this.bottomUnit,t)*this.columnWidth/this.bottomIncrement};s.prototype.snapDate=function(t){var e=new Date(t.getTime());if(this.snapUnit===BX.Tasks.Date.Unit.Day){var s=BX.Tasks.Date.getDurationInDays(this.startDate,e);var a=Math.round(s/this.snapIncrement)*this.snapIncrement;e=BX.Tasks.Date.add(this.startDate,BX.Tasks.Date.Unit.Day,a)}else if(this.snapUnit===BX.Tasks.Date.Unit.Hour){var i=BX.Tasks.Date.getDurationInHours(this.startDate,e);var r=Math.round(i/this.snapIncrement)*this.snapIncrement;e=BX.Tasks.Date.add(this.startDate,BX.Tasks.Date.Unit.Minute,r*60)}else if(this.snapUnit===BX.Tasks.Date.Unit.Minute){var n=BX.Tasks.Date.getDurationInMinutes(this.startDate,e);var o=Math.round(n/this.snapIncrement)*this.snapIncrement;e=BX.Tasks.Date.add(this.startDate,BX.Tasks.Date.Unit.Second,o*60)}else if(this.snapUnit===BX.Tasks.Date.Unit.Week){e.setUTCHours(0,0,0,0);var h=e.getUTCDay()-this.firstWeekDay;if(h<0){h=7+h}var l=Math.round(h/7)===1?7-h:-h;e=BX.Tasks.Date.add(e,BX.Tasks.Date.Unit.Day,l)}else if(this.snapUnit===BX.Tasks.Date.Unit.Month){var d=BX.Tasks.Date.getDurationInMonths(this.startDate,e)+e.getUTCDate()/BX.Tasks.Date.getDaysInMonth(e);var p=Math.round(d/this.snapIncrement)*this.snapIncrement;e=BX.Tasks.Date.add(this.startDate,BX.Tasks.Date.Unit.Month,p)}else if(this.snapUnit===BX.Tasks.Date.Unit.Second){var u=BX.Tasks.Date.getDurationInSeconds(this.startDate,e);var c=Math.round(u/this.snapIncrement)*this.snapIncrement;e=BX.Tasks.Date.add(this.startDate,BX.Tasks.Date.Unit.Milli,c*1e3)}else if(this.snapUnit===BX.Tasks.Date.Unit.Milli){var f=BX.Tasks.Date.getDurationInMilliseconds(this.startDate,e);var m=Math.round(f/this.snapIncrement)*this.snapIncrement;e=BX.Tasks.Date.add(this.startDate,BX.Tasks.Date.Unit.Milli,m)}else if(this.snapUnit===BX.Tasks.Date.Unit.Year){var y=BX.Tasks.Date.getDurationInYears(this.startDate,e);var g=Math.round(y/this.snapIncrement)*this.snapIncrement;e=BX.Tasks.Date.add(this.startDate,BX.Tasks.Date.Unit.Year,g)}else if(this.snapUnit===BX.Tasks.Date.Unit.Quarter){e.setUTCHours(0,0,0,0);e.setDate(1);e=BX.Tasks.Date.add(e,BX.Tasks.Date.Unit.Month,3-e.getUTCMonth()%3)}return e};s.prototype.scrollToDate=function(t){if(!BX.Tasks.Date.isDate(t)||t<this.startDate||t>this.endDate){return}var e=this.getMaxScrollLeft();var s=this.getPixelsFromDate(t);this.setScrollLeft(s>e?e:s)};s.prototype.scrollTo=function(t){this.setScrollLeft(Math.min(Math.max(0,t),this.getMaxScrollLeft()));this.renderHeader()};s.prototype.getScrollLeft=function(){return this.chart.layout.timeline.scrollLeft};s.prototype.setScrollLeft=function(t){this.chart.layout.timeline.scrollLeft=t};s.prototype.getMaxScrollLeft=function(){var t=this.getPixelsFromDate(this.endDate);var e=this.getViewportWidth();return t-e};s.prototype.autoScroll=function(){var t=this.getViewportWidth();var e=this.getPixelsFromDate(BX.Tasks.Date.floorDate(this.chart.currentDatetime,this.snapUnit,this.firstWeekDay));this.scrollToDate(this.getDateFromPixels(e-t/4))};s.prototype.getViewportWidth=function(){return this.chart.chartContainer.width-this.chart.gutterOffset};s.prototype.getRelativeXY=function(t){BX.fixEventPageXY(t);return{x:t.pageX-this.chart.chartContainer.pos.left-this.chart.gutterOffset+this.getScrollLeft(),y:t.pageY-this.chart.chartContainer.pos.top+this.chart.layout.timeline.scrollTop}};function a(t){this.setLevel(t)}a.prototype.presets={yearquarter:{columnWidth:200,topUnit:BX.Tasks.Date.Unit.Year,topIncrement:1,topDateFormat:"Y",bottomUnit:BX.Tasks.Date.Unit.Quarter,bottomIncrement:1,bottomDateFormat:"f",snapUnit:BX.Tasks.Date.Unit.Day,snapIncrement:1,firstWeekDay:1},yearmonth:{columnWidth:100,topUnit:BX.Tasks.Date.Unit.Year,topIncrement:1,topDateFormat:"Y",bottomUnit:BX.Tasks.Date.Unit.Month,bottomIncrement:1,bottomDateFormat:"f",snapUnit:BX.Tasks.Date.Unit.Day,snapIncrement:1,firstWeekDay:1},monthday:{columnWidth:24,topUnit:BX.Tasks.Date.Unit.Month,topIncrement:1,topDateFormat:"f Y",bottomUnit:BX.Tasks.Date.Unit.Day,bottomIncrement:1,bottomDateFormat:"j",snapUnit:BX.Tasks.Date.Unit.Hour,snapIncrement:1},weekday:{columnWidth:48,topUnit:BX.Tasks.Date.Unit.Week,topIncrement:1,topDateFormat:"j F",bottomUnit:BX.Tasks.Date.Unit.Day,bottomIncrement:1,bottomDateFormat:"D",snapUnit:BX.Tasks.Date.Unit.Hour,snapIncrement:1,firstWeekDay:1},dayhour:{columnWidth:60,topUnit:BX.Tasks.Date.Unit.Day,topIncrement:1,topDateFormat:"j F",bottomUnit:BX.Tasks.Date.Unit.Hour,bottomIncrement:6,bottomDateFormat:"G:i",snapUnit:BX.Tasks.Date.Unit.Minute,snapIncrement:15},hourminute:{columnWidth:48,topUnit:BX.Tasks.Date.Unit.Hour,topIncrement:1,topDateFormat:"j F H:i",bottomUnit:BX.Tasks.Date.Unit.Minute,bottomIncrement:15,bottomDateFormat:"i:s",snapUnit:BX.Tasks.Date.Unit.Minute,snapIncrement:1}};a.prototype.levels=[{id:"yearquarter",preset:"yearquarter"},{id:"yearmonth",preset:"yearmonth"},{id:"monthday",preset:"monthday"},{id:"monthday2x",preset:"monthday",columnWidth:48},{id:"weekday",preset:"weekday"},{id:"dayhour",preset:"dayhour"}].concat(!BX.Scheduler.Util.isMSBrowser()?[{id:"daysecondhour",preset:"dayhour",bottomIncrement:2,snapIncrement:15},{id:"dayeveryhour",preset:"dayhour",bottomIncrement:1,snapIncrement:5},{id:"hourminute",preset:"hourminute"}]:[]);a.prototype.setLevel=function(t){var e=this.getLevelIndex(t);if(e===null){this.levelIndex=typeof this.levelIndex!=="undefined"?this.levelIndex:this.getLevelIndex("monthday")}else{this.levelIndex=e}};a.prototype.getLevelIndex=function(t){for(var e=0,s=this.levels.length;e<s;e++){var a=this.levels[e];if(a.id===t){return e}}return null};a.prototype.getCurrentLevel=function(){return this.levels[this.levelIndex]};a.prototype.getNextLevel=function(){return this.levelIndex===this.levels.length-1?this.levels[this.levels.length-1]:this.levels[this.levelIndex+1]};a.prototype.getPrevLevel=function(){return this.levelIndex>0?this.levels[this.levelIndex-1]:this.levels[0]};a.prototype.getPreset=function(){var t=this.levels[this.levelIndex];var e=BX.clone(this.presets[t.preset]);for(var s in t){if(t.hasOwnProperty(s)){e[s]=t[s]}}return e};var i=function(t,e,s,a,r){this.chart=t;this.id=e;this.from=s;this.to=a;this.type=typeof r!=="undefined"?r:i.Type.EndToStart;this.layout=null;this.fromTask=this.chart.getTaskById(this.from);this.toTask=this.chart.getTaskById(this.to);this.matchWorkTime=this.toTask.matchWorkTime;this.updateLag()};i.prototype.updateLag=function(){if(this.type===i.Type.StartToStart){if(this.matchWorkTime){this.lag=this.chart.calendar.calculateDuration(this.fromTask.dateStart,this.toTask.dateStart)}else{this.lag=this.toTask.dateStart-this.fromTask.dateStart}}else if(this.type===i.Type.StartToEnd){if(this.matchWorkTime){this.lag=this.chart.calendar.calculateDuration(this.fromTask.dateStart,this.toTask.dateEnd)}else{this.lag=this.toTask.dateEnd-this.fromTask.dateStart}}else if(this.type===i.Type.EndToEnd){if(this.matchWorkTime){this.lag=this.chart.calendar.calculateDuration(this.fromTask.dateEnd,this.toTask.dateEnd)}else{this.lag=this.toTask.dateEnd-this.fromTask.dateEnd}}else{if(this.matchWorkTime){this.lag=this.chart.calendar.calculateDuration(this.fromTask.dateEnd,this.toTask.dateStart)}else{this.lag=this.toTask.dateStart-this.fromTask.dateEnd}}};i.Type={StartToStart:0,StartToEnd:1,EndToStart:2,EndToEnd:3};i.prototype.draw=function(){var t=this.getPath();if(!t.length){return}if(this.fromTask.isHidden()||this.toTask.isHidden()){if(this.layout!==null){BX.cleanNode(this.layout,true);this.layout=null}return}var e=document.createDocumentFragment();var s=null;for(var a=0,i=t.length;a<i;a++){s=t[a];var r=document.createElement("div");r.className="task-gantt-link-line";r.style.left=s.x+"px";r.style.top=s.y+"px";if(s.direction==="left"){r.style.left=s.x-s.size+"px";r.style.width=s.size+"px";r.style.height="2px"}else if(s.direction==="right"){r.style.width=s.size+"px";r.style.height="2px"}else if(s.direction==="up"){r.style.top=s.y-s.size+"px";r.style.height=s.size+"px";r.style.width="2px"}else{r.style.height=s.size+"px";r.style.width="2px"}e.appendChild(r)}var n=document.createElement("div");if(s.direction==="right"){n.style.left=s.x+s.size-6+"px";n.style.top=s.y-5+"px";n.className="task-gantt-link-arrow task-gantt-link-arrow-right"}else{n.style.left=s.x-s.size-6+"px";n.style.top=s.y-5+"px";n.className="task-gantt-link-arrow task-gantt-link-arrow-left"}e.appendChild(n);if(this.layout===null){var o=!this.chart.canAddDependency(this.fromTask.id,this.toTask.id);this.layout=document.createElement("div");this.layout.className="task-gantt-link"+(o?" task-gantt-link-read-only":"");if(!o){BX.bind(this.layout,"click",BX.proxy(this.onMenuClick,this))}this.chart.layout.timelineData.appendChild(this.layout)}else{if(!this.layout.parentNode){this.chart.layout.timelineData.appendChild(this.layout)}BX.cleanNode(this.layout,false)}this.layout.appendChild(e)};i.prototype.clear=function(){if(this.layout!==null){BX.cleanNode(this.layout,true);this.layout=null}};i.prototype.getPath=function(){var t=this.getEdges();var e=20;var s=32;var a=t.endX-t.startX;var r=Math.abs(t.endY-t.startY);var o=t.endX>t.startX;var h=t.endY>t.startY?"down":"up";var l=new n(t.startX,t.startY);if(this.type==i.Type.StartToStart){l.addPoint("left",e);if(o){l.addPoint(h,r);l.addPoint("right",a)}else{l.addPoint("left",Math.abs(a));l.addPoint(h,r)}l.addPoint("right",e)}else if(this.type==i.Type.StartToEnd){o=t.endX>t.startX-2*e;l.addPoint("left",e);if(o){a+=2*e;l.addPoint(h,s/2);l.addPoint("right",a);l.addPoint(h,r-s/2);l.addPoint("left",e)}else{a+=e;l.addPoint(h,r);l.addPoint("left",Math.abs(a))}}else if(this.type==i.Type.EndToStart){o=t.endX>t.startX+2*e;l.addPoint("right",e);if(o){l.addPoint(h,r);l.addPoint("right",a-e)}else{a-=2*e;l.addPoint(h,s/2);l.addPoint("left",Math.abs(a));l.addPoint(h,r-s/2);l.addPoint("right",e)}}else if(this.type==i.Type.EndToEnd){l.addPoint("right",e);if(o){l.addPoint("right",a);l.addPoint(h,r)}else{l.addPoint(h,r);l.addPoint("left",Math.abs(a))}l.addPoint("left",e)}return l.getPath()};i.prototype.getEdges=function(){var t=this.fromTask.getCoords();var e=this.toTask.getCoords();if(this.type===i.Type.StartToStart){return{startX:t.startX,startY:t.startY,endX:e.startX,endY:e.startY}}else if(this.type===i.Type.StartToEnd){return{startX:t.startX,startY:t.startY,endX:e.endX,endY:e.endY}}else if(this.type===i.Type.EndToEnd){return{startX:t.endX,startY:t.endY,endX:e.endX,endY:e.endY}}else{return{startX:t.endX,startY:t.endY,endX:e.startX,endY:e.startY}}};i.prototype.getMinDate=function(){var t=null;var e=this.toTask.calculateDuration();if(this.type===i.Type.StartToStart){t=this.fromTask.dateStart}else if(this.type===i.Type.StartToEnd){if(this.matchWorkTime){t=this.chart.calendar.calculateStartDate(this.fromTask.dateStart,e)}else{t=BX.Tasks.Date.add(this.fromTask.dateStart,BX.Tasks.Date.Unit.Milli,-e)}}else if(this.type===i.Type.EndToEnd){if(this.matchWorkTime){t=this.chart.calendar.calculateStartDate(this.fromTask.dateEnd,e)}else{t=BX.Tasks.Date.add(this.fromTask.dateEnd,BX.Tasks.Date.Unit.Milli,-e)}}else{t=this.fromTask.dateEnd}if(this.matchWorkTime){return this.lag>0?this.chart.calendar.calculateEndDate(t,this.lag):this.chart.calendar.calculateStartDate(t,Math.abs(this.lag))}else{return BX.Tasks.Date.add(t,BX.Tasks.Date.Unit.Milli,this.lag)}};i.prototype.onMenuClick=function(t){BX.PopupMenu.show("task-dep-menu",t,[{text:BX.message("TASKS_GANTT_DELETE_DEPENDENCY"),title:BX.message("TASKS_GANTT_DELETE_DEPENDENCY"),className:"menu-popup-item-delete",onclick:BX.proxy(function(){this.chart.removeDependency(this);BX.onCustomEvent(this.chart,"onDependencyDelete",[this]);BX.PopupMenu.destroy("task-dep-menu")},this)}],{offsetTop:5,offsetLeft:0,angle:true,autoHide:true,closeByEsc:true,bindOptions:{forceBindPosition:true},events:{onPopupClose:BX.proxy(this.onMenuClose,this)}});BX.addClass(this.layout,"task-gantt-link-selected")};i.prototype.onMenuClose=function(t,e){BX.removeClass(this.layout,"task-gantt-link-selected");BX.PopupMenu.destroy("task-dep-menu")};function r(t){this.chart=t;this.layout=BX.create("div",{props:{className:"task-gantt-pointer"}});this.fromTask=null;this.fromStart=null;this.toTask=null;this.toStart=null;this.edges=null;this.error=null;this.startX=0;this.startY=0;this.popup=new o(this)}r.prototype.getLayout=function(){return this.layout};r.prototype.getTimeline=function(t){return this.chart.getTimeline()};r.prototype.startDrag=function(t,e,s){s=s||window.event;BX.fixEventPageXY(s);if(!BX.GanttChart.isLeftClick(s)){return}this.chart.adjustChartContainer();this.fromTask=t;this.fromStart=e;this.toTask=null;this.toStart=null;this.edges=this.fromTask.getCoords();this.startX=this.fromStart?this.edges.startX-9:this.edges.endX+(this.fromTask.isRealDateEnd?8:12);this.startY=(this.fromStart?this.edges.startY:this.edges.endY)+this.chart.getTimelineDataOffset();this.fromTask.startResize(s,BX.proxy(this.endDrag,this),BX.proxy(this.onDrag,this),"default")};r.prototype.onDrag=function(t){this.markDraggableTask();this.fromTask.autoResize(t,BX.proxy(this.resizePointer,this));this.popup.move(t)};r.prototype.endDrag=function(t){this.hidePointerLine();this.unmarkDraggableTask();this.unmarkDroppableTask();this.popup.hide();this.fromTask.endResize(t,BX.proxy(this.endDrag,this),BX.proxy(this.onDrag,this));if(this.toTask){this.fromTask.setRealDates();this.toTask.setRealDates();var e=this.chart.addDependency(this.fromTask.id,this.toTask.id,this.getType());BX.onCustomEvent(this.chart,"onDependencyAdd",[e])}};r.prototype.getType=function(){if(this.fromStart===false&&this.toStart===true){return i.Type.EndToStart}else if(this.fromStart===true&&this.toStart===true){return i.Type.StartToStart}else if(this.fromStart===false&&this.toStart===false){return i.Type.EndToEnd}else if(this.fromStart===true&&this.toStart===false){return i.Type.StartToEnd}else{return i.Type.EndToStart}};r.prototype.resizePointer=function(t,e){this.markDroppableTask();var s=this.getTimeline().getRelativeXY(this.fromTask.autoResizeEvent);this.drawPointerLine(this.startX,this.startY,s.x,s.y)};r.prototype.offsetLine=function(t){this.startX+=t;this.layout.style.left=(parseInt(this.layout.style.left)||0)+t+"px"};r.prototype.markDraggableTask=function(){BX.addClass(this.fromTask.layout.planBar,"task-gantt-bar-plan-draggable task-gantt-pointer-"+(this.fromStart?"start":"end"))};r.prototype.unmarkDraggableTask=function(){BX.removeClass(this.fromTask.layout.planBar,"task-gantt-bar-plan-draggable task-gantt-pointer-"+(this.fromStart?"start":"end"))};r.prototype.markDroppableTask=function(){this.error=null;this.layout.hidden=true;var t=null;var e=null;var s=document.elementFromPoint(this.fromTask.autoResizeEvent.clientX,this.fromTask.autoResizeEvent.clientY);if(!s){e=null;t=null}else if(BX.hasClass(s,"task-gantt-bar-plan")){e=null;t=s}else if(BX.hasClass(s.parentNode,"task-gantt-bar-plan")){e=s;t=s.parentNode}else if(BX.hasClass(s.parentNode.parentNode,"task-gantt-bar-plan")){e=s.parentNode;t=s.parentNode.parentNode}if(t){if(this.droppable){BX.removeClass(this.droppable,"task-gantt-bar-plan-droppable")}this.droppable=t;var a=this.chart.getTaskById(this.droppable.getAttribute("data-task-id"));if(!a||a===this.fromTask){this.droppable=null;this.toTask=null;this.toStart=null}else if(this.chart.isCircularDependency(this.fromTask.id,a.id)){this.toTask=null;this.toStart=null;this.error=BX.message("TASKS_GANTT_CIRCULAR_DEPENDENCY")}else if(this.fromTask.isChildOf(a)||a.isChildOf(this.fromTask)){this.toTask=null;this.toStart=null;this.error=BX.message("TASKS_GANTT_RELATION_ERROR")}else if(!this.chart.canAddDependency(this.fromTask.id,a.id)){this.toTask=null;this.toStart=null;this.error=BX.message("TASKS_GANTT_PERMISSION_ERROR")}else if(e!==null&&BX.hasClass(e,"task-gantt-point-start")){BX.addClass(this.droppable,"task-gantt-pointer-start");this.toTask=a;this.toStart=true}else if(e!==null&&BX.hasClass(e,"task-gantt-point-end")){BX.addClass(this.droppable,"task-gantt-pointer-end");this.toTask=a;this.toStart=false}else{BX.removeClass(this.droppable,"task-gantt-pointer-start task-gantt-pointer-end");this.toTask=null;this.toStart=null}if(this.droppable){BX.addClass(this.droppable,"task-gantt-bar-plan-droppable")}}else if(this.droppable){BX.removeClass(this.droppable,"task-gantt-bar-plan-droppable task-gantt-pointer-start task-gantt-pointer-end");this.droppable=null;this.toTask=null;this.toStart=null;this.error=null}this.layout.hidden=false};r.prototype.unmarkDroppableTask=function(){if(this.droppable){BX.removeClass(this.droppable,"task-gantt-bar-plan-droppable task-gantt-pointer-start task-gantt-pointer-end");this.droppable=null}};r.prototype.drawPointerLine=function(t,e,s,a){var i=Math.sqrt(Math.pow(s-t,2)+Math.pow(a-e,2));var r=Math.atan((a-e)/(s-t));var n=this.getQuarter(t,s,e,a);if(n===2){r+=Math.PI}else if(n===3){r-=Math.PI}var o="rotate("+r+"rad)";this.layout.style.webkitTransform=o;this.layout.style.msTransform=o;this.layout.style.transform=o;this.layout.style.width=i+"px";var h=t;var l=e;if(BX.browser.IsIE8()){var d=Math.sin(r);var p=Math.cos(r);this.layout.style.filter="progid:DXImageTransform.Microsoft.Matrix("+"M11 = "+p+","+"M12 = -"+d+","+"M21 = "+d+","+"M22 = "+p+","+"SizingMethod = 'auto expand')";var u=Math.abs(t-s);var c=Math.abs(a-e);if(n===1){l-=c}else if(n===2){h-=u;l-=c}else if(n===3){h-=u}}this.layout.style.left=h+"px";this.layout.style.top=l+"px"};r.prototype.getQuarter=function(t,e,s,a){if(e>=t){return a<=s?1:4}else{return a<=s?2:3}};r.prototype.hidePointerLine=function(){this.layout.style.cssText=""};function n(t,e){this.currentPoint={x:t,y:e};this.prevDirection=null;this.path=[]}n.prototype.addPoint=function(t,e){var s={x:this.currentPoint.x,y:this.currentPoint.y,direction:t,size:e};if(t==="up"){if(this.prevDirection==="right"){s.y+=2;s.size+=2}this.currentPoint.y-=e}else if(t==="right"){if(this.prevDirection==="up"){s.x+=2;s.size-=2}this.currentPoint.x+=e}else if(t==="down"){if(this.prevDirection==="left"){s.y+=2;s.size-=2}this.currentPoint.y+=e}else if(t==="left"){if(this.prevDirection==="down"){s.x+=2;s.size+=2}this.currentPoint.x-=e}this.prevDirection=t;this.path.push(s)};n.prototype.getPath=function(){return this.path};function o(t){this.pointer=t;this.layout={fromTitle:null,fromEdge:null,toTitle:null,toEdge:null,error:null};this.popup=BX.PopupWindowManager.create("task-gantt-pointer",null,{offsetLeft:5,offsetTop:30,content:BX.create("div",{props:{className:"task-gantt-pointer-popup"},children:[BX.create("div",{props:{className:"task-gantt-pointer-popup-row task-gantt-pointer-popup-from"},children:[BX.create("span",{props:{className:"task-gantt-pointer-popup-label"},text:BX.message("TASKS_GANTT_DEPENDENCY_FROM")+":"}),this.layout.fromTitle=BX.create("span",{props:{className:"task-gantt-pointer-popup-title"}}),this.layout.fromEdge=BX.create("span",{props:{className:"task-gantt-pointer-popup-edge"}})]}),BX.create("div",{props:{className:"task-gantt-pointer-popup-row task-gantt-pointer-popup-to"},children:[BX.create("span",{props:{className:"task-gantt-pointer-popup-label"},text:BX.message("TASKS_GANTT_DEPENDENCY_TO")+":"}),this.layout.toTitle=BX.create("span",{props:{className:"task-gantt-pointer-popup-title"}}),this.layout.toEdge=BX.create("span",{props:{className:"task-gantt-pointer-popup-edge"}})]}),this.layout.error=BX.create("div",{props:{className:"task-gantt-pointer-popup-row task-gantt-pointer-popup-error"}})]})})}o.prototype.move=function(t){this.layout.fromTitle.innerHTML=this.pointer.fromTask.name;this.layout.fromEdge.innerHTML="("+(this.pointer.fromStart?BX.message("TASKS_GANTT_START"):BX.message("TASKS_GANTT_END"))+")";if(this.pointer.error){this.layout.error.innerHTML=this.pointer.error;this.layout.toTitle.parentNode.style.display="none"}else{this.layout.error.innerHTML="";this.layout.toTitle.parentNode.style.display="block";this.layout.toTitle.innerHTML=this.pointer.toTask?this.pointer.toTask.name:"";this.layout.toEdge.innerHTML=this.pointer.toTask?"("+(this.pointer.toStart?BX.message("TASKS_GANTT_START"):BX.message("TASKS_GANTT_END"))+")":"—"}this.popup.setBindElement(t);this.popup.adjustPosition();this.popup.show()};o.prototype.hide=function(){this.popup.close()};var h=function(t){this.chart=t;this.initTop=false;this.window=null;this.start=null;this.end=null;this.deadline=null;this.windowSize=0;var e=this.formatDate(this.chart.currentDatetime);this.window=BX.create("div",{props:{className:"task-gantt-hint"},children:[BX.create("span",{props:{className:"task-gantt-hint-names"},children:[BX.create("span",{props:{className:"task-gantt-hint-name"},text:BX.message("TASKS_GANTT_DATE_START")+":"}),BX.create("span",{props:{className:"task-gantt-hint-name"},text:BX.message("TASKS_GANTT_DATE_END")+":"}),BX.create("span",{props:{className:"task-gantt-hint-name"},text:BX.message("TASKS_GANTT_DEADLINE")+":"})]}),BX.create("span",{props:{className:"task-gantt-hint-values"},children:[this.start=BX.create("span",{props:{className:"task-gantt-hint-value"},html:e}),this.end=BX.create("span",{props:{className:"task-gantt-hint-value"},html:e}),this.deadline=BX.create("span",{props:{className:"task-gantt-hint-value"},html:e})]})]})};h.prototype.getLayout=function(){return this.window};h.prototype.getTimeline=function(t){return this.chart.getTimeline()};h.prototype.init=function(t){this.window.style.top=t.layout.row.offsetTop+9+"px";this.initTop=true;this.windowSize=this.window.offsetWidth};h.prototype.show=function(t,e){if(!this.initTop)this.init(e);var s=e.isRealDateStart?e.dateStart:null;var a=e.isRealDateEnd?e.dateEnd:null;this.start.innerHTML=this.formatDate(s);this.end.innerHTML=this.formatDate(a);this.deadline.innerHTML=this.formatDate(e.dateDeadline);var i=this.chart.chartContainer.width-this.chart.chartContainer.padding-this.chart.gutterOffset+this.getTimeline().getScrollLeft();var r=this.chart.chartContainer.padding+this.getTimeline().getScrollLeft();if(t+this.windowSize/2>=i)this.window.style.left=i-this.windowSize+"px";else if(t-this.windowSize/2<=r)this.window.style.left=r+"px";else if(t>=i)this.window.style.left=t-this.windowSize+"px";else this.window.style.left=t-this.windowSize/2+"px"};h.prototype.formatDate=function(t){if(!t)return BX.message("TASKS_GANTT_EMPTY_DATE");var e=this.chart.dateFormat.replace(/YYYY/gi,'<span class="task-gantt-hint-year">'+t.getUTCFullYear().toString().substr(2)+"</span>").replace(/MMMM/gi,BX.util.str_pad_left((t.getUTCMonth()+1).toString(),2,"0")).replace(/MM/gi,BX.util.str_pad_left((t.getUTCMonth()+1).toString(),2,"0")).replace(/M/gi,BX.util.str_pad_left((t.getUTCMonth()+1).toString(),2,"0")).replace(/DD/gi,BX.util.str_pad_left(t.getUTCDate().toString(),2,"0"));var s=t.getUTCHours().toString();if(BX.isAmPmMode()){var a=" am";if(s>12){s=s-12;a=" pm"}else if(s==12){a=" pm"}}return e+" "+BX.util.str_pad_left(s,2,"0")+":"+BX.util.str_pad_left(t.getUTCMinutes().toString(),2,"0")+(a!=undefined?a:"")};h.prototype.hide=function(){this.window.style.left="-400px";this.initTop=false};var l=function(t){this.chart=t;this.stub=null;this.dropLine=null;this.draggableTask=null;this.droppable=null;this.error=null};l.prototype.registerTask=function(t){if(this.chart.canDragTasks===false){return}t.onbxdragstart=BX.proxy(this.onDragStart,this);t.onbxdrag=BX.proxy(this.onDrag,this);t.onbxdragstop=BX.proxy(this.onDragStop,this);t.onbxdraghover=BX.proxy(this.onDragOver,this);jsDD.registerObject(t);jsDD.registerDest(t)};l.prototype.registerProject=function(t){if(this.chart.canDragTasks===false){return}jsDD.registerDest(t)};l.prototype.onDragStart=function(){var t=BX.proxy_context;var e=BX.type.isDomNode(t)?t.getAttribute("data-task-id"):null;this.draggableTask=this.chart.getTaskById(e);if(!this.draggableTask){jsDD.stopCurrentDrag();return}if(!this.stub){this.stub=BX.create("div",{props:{className:"task-gantt-drag-stub"}});document.body.appendChild(this.stub)}if(!this.dropLine){this.dropLine=BX.create("div",{props:{className:"task-gantt-drop-line"}})}if(!this.dropLine.parentNode){this.chart.layout.tree.appendChild(this.dropLine)}this.error=null;this.draggableTask.denyItemsHover();this.stub.innerHTML=this.draggableTask.name;this.stub.style.display="block";BX.TaskQuickInfo.hide()};l.prototype.onDrag=function(t,e){this.stub.style.left=t+"px";this.stub.style.top=e+"px"};l.prototype.onDragStop=function(e,s,a){this.draggableTask.allowItemsHover(a);this.stub.style.display="none";this.dropLine.style.cssText="";if(this.error!==null||!this.droppable||this.draggableTask.id===this.droppable.id){return}var i=this.draggableTask.projectId;var r=this.draggableTask.parentTaskId;var n={id:null,before:true};if(this.droppable instanceof t){var o=this.chart.getPreviousProject(this.droppable.id);this.chart.moveTaskToProject(this.draggableTask.id,o.id);n=this.getTargetTask(this.draggableTask)}else if(this.droppable===this.chart.layout.treeStub){var h=this.chart.getLastProject();this.chart.moveTaskToProject(this.draggableTask.id,h.id);n=this.getTargetTask(this.draggableTask)}else{this.chart.moveTask(this.draggableTask.id,this.droppable.id);n.id=this.droppable.id;n.before=true}BX.onCustomEvent(this.chart,"onTaskMove",[this.draggableTask.id,n.id,n.before,i!==this.draggableTask.projectId?this.draggableTask.projectId:null,r!==this.draggableTask.parentTaskId&&this.chart.treeMode?this.draggableTask.parentTaskId:null])};l.prototype.getTargetTask=function(t){var e={id:null,before:true};var s=this.chart.getPreviousTask(t.id);if(s){e.id=s.id;e.before=false}else{var a=this.chart.getNextTask(t.id);if(a){e.id=a.id;e.before=true}}return e};l.prototype.onDragOver=function(t,s,a){this.error=null;var i=t.getAttribute("data-task-id");var r=t.getAttribute("data-project-id");var n=0;var o=null;var h=null;if(i){this.droppable=this.chart.getTaskById(i);if(this.droppable&&this.droppable.depthLevel===1&&this.droppable.projectId!==0){n=-this.chart.firstDepthLevelOffset}if(this.droppable){h=this.droppable.parentTaskId;o=this.droppable.project}}else if(r==="stub"){this.droppable=this.chart.layout.treeStub;h=0;o=this.chart.getLastProject()}else if(r){this.droppable=this.chart.getProjectById(r);if(this.droppable){h=0;o=this.chart.getPreviousProject(this.droppable.id)}}if(!this.droppable){jsDD.stopCurrentDrag();return}if(this.droppable instanceof e&&this.droppable.isChildOf(this.draggableTask)){this.error=true}if(o!==null&&this.draggableTask.projectId!==o.id&&(!this.draggableTask.canEdit||!o.canCreateTasks)){this.error=true}if(this.draggableTask.parentTaskId!==h&&!this.draggableTask.canEdit){this.error=true}var l=(parseInt(t.style.paddingLeft,10)||0)+n;var d=t.offsetTop;if(this.error===null){BX.removeClass(this.dropLine,"task-gantt-drop-line-error");BX.removeClass(this.stub,"task-gantt-drag-stub-error")}else{BX.addClass(this.dropLine,"task-gantt-drop-line-error");BX.addClass(this.stub,"task-gantt-drag-stub-error")}this.dropLine.style.left=l+"px";this.dropLine.style.top=d+"px";this.dropLine.style.width="100%"}})(); //# sourceMappingURL=gantt.map.js
/var/www/axolotl/data/www/axolotl.ru/www/bitrix/js/disk/../tasks/gantt.min.js